Merge "Adding access to All Apps in the long press menu in Launcher" into main

This commit is contained in:
Sebastián Franco
2025-03-11 15:00:47 -07:00
committed by Android (Google) Code Review
4 changed files with 28 additions and 1 deletions
+2
View File
@@ -323,6 +323,8 @@
<string name="edit_home_screen">Edit Home Screen</string>
<!-- Text for settings button [CHAR LIMIT=20]-->
<string name="settings_button_text">Home settings</string>
<!-- Text for app menu button [CHAR LIMIT=30]-->
<string name="all_apps_home_screen">Apps</string>
<!-- Message shown when a feature is disabled by the administrator -->
<string name="msg_disabled_by_admin">Disabled by your admin</string>
@@ -34,7 +34,9 @@ public class TestEventEmitter {
RESIZE_FRAME_SHOWING("RESIZE_FRAME_SHOWING"),
WORKSPACE_FINISH_LOADING("WORKSPACE_FINISH_LOADING"),
SPRING_LOADED_STATE_STARTED("SPRING_LOADED_STATE_STARTED"),
SPRING_LOADED_STATE_COMPLETED("SPRING_LOADED_STATE_COMPLETED");
SPRING_LOADED_STATE_COMPLETED("SPRING_LOADED_STATE_COMPLETED"),
LAUNCHER_STATE_COMPLETED("LAUNCHER_STATE_COMPLETED");
TestEvent(String event) {
}
@@ -166,6 +166,9 @@ public class StatsLogManager implements ResourceBasedOverride {
@UiEvent(doc = "User tapped or long pressed on settings icon inside launcher settings.")
LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS(463),
@UiEvent(doc = "User tapped or long pressed on apps icon inside launcher settings.")
LAUNCHER_ALL_APPS_TAP_OR_LONGPRESS(2204),
@UiEvent(doc = "User tapped or long pressed on widget tray icon inside launcher settings.")
LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS(464),
@@ -19,6 +19,7 @@ import static com.android.launcher3.BuildConfig.WIDGETS_ENABLED;
import static com.android.launcher3.LauncherState.EDIT_MODE;
import static com.android.launcher3.config.FeatureFlags.MULTI_SELECT_EDIT_MODE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALL_APPS_TAP_OR_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS;
@@ -218,6 +219,11 @@ public class OptionsPopupView<T extends Context & ActivityContext> extends Arrow
LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS,
OptionsPopupView::enterHomeGardening));
}
options.add(new OptionItem(launcher,
R.string.all_apps_home_screen,
R.drawable.ic_apps,
LAUNCHER_ALL_APPS_TAP_OR_LONGPRESS,
OptionsPopupView::enterAllApps));
options.add(new OptionItem(launcher,
R.string.settings_button_text,
R.drawable.ic_setting,
@@ -226,6 +232,20 @@ public class OptionsPopupView<T extends Context & ActivityContext> extends Arrow
return options;
}
/**
* Used by the options to open All Apps, uses an intent as to not tie the implementation of
* opening All Apps with OptionsPopup, instead it uses the public API to open All Apps.
*/
public static boolean enterAllApps(View view) {
Launcher launcher = Launcher.getLauncher(view.getContext());
launcher.startActivity(
new Intent(Intent.ACTION_ALL_APPS)
.setComponent(launcher.getComponentName())
.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
);
return true;
}
private static boolean enterHomeGardening(View view) {
Launcher launcher = Launcher.getLauncher(view.getContext());
launcher.getStateManager().goToState(EDIT_MODE);