Prevent meta shortcut from cancelling split select state.
There are two things that need to be changed for this to work:
1. Make the isInOverview condition check for any Overview UI (including
the split select state, modal, etc.)
2. Toggle Home All Apps directly, because firing the intent will cause
Launcher to pause and resume before the intent is handled. We
misinterpret the pause as a request to cancel split screen. Since
TaskbarManager has a reference to Launcher, we might as well call the
method directly.
Test: Manual
Fix: 319076403
Flag: N/A
Change-Id: Ib8899188f593a168a054a16717df4a95be098557
diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
index 23380d6..896cc84 100644
--- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java
@@ -425,14 +425,14 @@
}
@Override
- protected boolean isInOverview() {
- return mTaskbarLauncherStateController.isInOverview();
+ protected boolean isInOverviewUi() {
+ return mTaskbarLauncherStateController.isInOverviewUi();
}
@Override
protected boolean canToggleHomeAllApps() {
return mLauncher.isResumed()
- && !mTaskbarLauncherStateController.isInOverview()
+ && !mTaskbarLauncherStateController.isInOverviewUi()
&& !mLauncher.areFreeformTasksVisible();
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
index 390dec9..e802e72 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java
@@ -665,7 +665,7 @@
LauncherAtom.TaskBarContainer.Builder taskbarBuilder =
LauncherAtom.TaskBarContainer.newBuilder();
- if (mControllers.uiController.isInOverview()) {
+ if (mControllers.uiController.isInOverviewUi()) {
taskbarBuilder.setTaskSwitcherContainer(
LauncherAtom.TaskSwitcherContainer.newBuilder());
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 8dc81cf..6163dad 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -375,7 +375,7 @@
) {
// Taskbar has some touchable elements, take over the full taskbar area
if (
- controllers.uiController.isInOverview &&
+ controllers.uiController.isInOverviewUi &&
DisplayController.isTransientTaskbar(context)
) {
val region =
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index b0abbe9..17dcace 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -666,8 +666,8 @@
&& !mLauncher.getWorkspace().isOverlayShown();
}
- boolean isInOverview() {
- return mLauncherState == LauncherState.OVERVIEW;
+ boolean isInOverviewUi() {
+ return mLauncherState.overviewUi;
}
private void playStateTransitionAnim(AnimatorSet animatorSet, long duration,
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index e4f9ba5..8f15d61 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -58,6 +58,7 @@
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.statemanager.StatefulActivity;
@@ -339,12 +340,12 @@
/**
* Toggles All Apps for Taskbar or Launcher depending on the current state.
- *
- * @param homeAllAppsIntent Intent used if Taskbar is not enabled or Launcher is resumed.
*/
- public void toggleAllApps(Intent homeAllAppsIntent) {
+ public void toggleAllApps() {
if (mTaskbarActivityContext == null || mTaskbarActivityContext.canToggleHomeAllApps()) {
- mContext.startActivity(homeAllAppsIntent);
+ // Home All Apps should be toggled from this class, because the controllers are not
+ // initialized when Taskbar is disabled (i.e. TaskbarActivityContext is null).
+ if (mActivity instanceof Launcher l) l.toggleAllAppsSearch();
} else {
mTaskbarActivityContext.toggleAllAppsSearch();
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
index cb0fa40..2e78489 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java
@@ -193,7 +193,7 @@
}
/** Returns {@code true} if Taskbar is currently within overview. */
- protected boolean isInOverview() {
+ protected boolean isInOverviewUi() {
return false;
}
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 66d7144..e66268a 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -602,23 +602,21 @@
}
private PendingIntent createAllAppsPendingIntent() {
- final Intent homeIntent = new Intent(mOverviewComponentObserver.getHomeIntent())
- .setAction(INTENT_ACTION_ALL_APPS_TOGGLE);
-
if (FeatureFlags.ENABLE_ALL_APPS_SEARCH_IN_TASKBAR.get()) {
return new PendingIntent(new IIntentSender.Stub() {
@Override
public void send(int code, Intent intent, String resolvedType,
IBinder allowlistToken, IIntentReceiver finishedReceiver,
String requiredPermission, Bundle options) {
- MAIN_EXECUTOR.execute(() -> mTaskbarManager.toggleAllApps(homeIntent));
+ MAIN_EXECUTOR.execute(() -> mTaskbarManager.toggleAllApps());
}
});
} else {
return PendingIntent.getActivity(
this,
GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS,
- homeIntent,
+ new Intent(mOverviewComponentObserver.getHomeIntent())
+ .setAction(INTENT_ACTION_ALL_APPS_TOGGLE),
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
}
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3273f27..155bfa1 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1647,7 +1647,7 @@
} else if (Intent.ACTION_ALL_APPS.equals(intent.getAction())) {
showAllAppsFromIntent(alreadyOnHome);
} else if (INTENT_ACTION_ALL_APPS_TOGGLE.equals(intent.getAction())) {
- toggleAllAppsFromIntent(alreadyOnHome);
+ toggleAllAppsSearch(alreadyOnHome);
} else if (Intent.ACTION_SHOW_WORK_APPS.equals(intent.getAction())) {
showAllAppsWithSelectedTabFromIntent(alreadyOnHome,
ActivityAllAppsContainerView.AdapterHolder.WORK);
@@ -1661,7 +1661,12 @@
// Overridden
}
- protected void toggleAllAppsFromIntent(boolean alreadyOnHome) {
+ /** Toggles Launcher All Apps with keyboard ready for search. */
+ public void toggleAllAppsSearch() {
+ toggleAllAppsSearch(/* alreadyOnHome= */ true);
+ }
+
+ protected void toggleAllAppsSearch(boolean alreadyOnHome) {
if (getStateManager().isInStableState(ALL_APPS)) {
getStateManager().goToState(NORMAL, alreadyOnHome);
} else {