From cb93ec5f2150be6cbe845d33f2117aa2c67c3c22 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Fri, 31 Mar 2023 22:51:17 -0700 Subject: [PATCH] Support second meta key closing the all apps tray Bug: 270244718 Test: Tap meta key twice, see all apps tray open an close Change-Id: I6db84aa16b7d21663053bf1b269af6ba36874e47 --- .../android/quickstep/TouchInteractionService.java | 3 ++- src/com/android/launcher3/Launcher.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 5e14d19fd0..9102f2f444 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -22,6 +22,7 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; +import static com.android.launcher3.Launcher.INTENT_ACTION_ALL_APPS_TOGGLE; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; @@ -514,7 +515,7 @@ public class TouchInteractionService extends Service if (isHomeAndOverviewSame) { Intent intent = new Intent(mOverviewComponentObserver.getHomeIntent()) - .setAction(Intent.ACTION_ALL_APPS); + .setAction(INTENT_ACTION_ALL_APPS_TOGGLE); RemoteAction allAppsAction = new RemoteAction( Icon.createWithResource(this, R.drawable.ic_apps), getString(R.string.all_apps_label), diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 2e382c8799..4f7380a20e 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -289,6 +289,9 @@ public class Launcher extends StatefulActivity // Type PendingSplitSelectInfo protected static final String PENDING_SPLIT_SELECT_INFO = "launcher.pending_split_select_info"; + public static final String INTENT_ACTION_ALL_APPS_TOGGLE = + "launcher.intent_action_all_apps_toggle"; + public static final String ON_CREATE_EVT = "Launcher.onCreate"; public static final String ON_START_EVT = "Launcher.onStart"; public static final String ON_RESUME_EVT = "Launcher.onResume"; @@ -1692,6 +1695,8 @@ public class Launcher extends StatefulActivity handleGestureContract(intent); } else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) { showAllAppsFromIntent(alreadyOnHome); + } else if (INTENT_ACTION_ALL_APPS_TOGGLE.equals(intent.getAction())) { + toggleAllAppsFromIntent(alreadyOnHome); } else if (Intent.ACTION_SHOW_WORK_APPS.equals(intent.getAction())) { showAllAppsWorkTabFromIntent(alreadyOnHome); } @@ -1699,6 +1704,14 @@ public class Launcher extends StatefulActivity TraceHelper.INSTANCE.endSection(traceToken); } + protected void toggleAllAppsFromIntent(boolean alreadyOnHome) { + if (getStateManager().isInStableState(ALL_APPS)) { + getStateManager().goToState(NORMAL, alreadyOnHome); + } else { + showAllAppsFromIntent(alreadyOnHome); + } + } + protected void showAllAppsFromIntent(boolean alreadyOnHome) { AbstractFloatingView.closeAllOpenViews(this); getStateManager().goToState(ALL_APPS, alreadyOnHome);