Merge "Prevent meta shortcut from cancelling split select state." into main

This commit is contained in:
Brian Isganitis
2024-04-10 07:34:47 +00:00
committed by Android (Google) Code Review
8 changed files with 23 additions and 19 deletions
@@ -425,14 +425,14 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
}
@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();
}
@@ -665,7 +665,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
LauncherAtom.TaskBarContainer.Builder taskbarBuilder =
LauncherAtom.TaskBarContainer.newBuilder();
if (mControllers.uiController.isInOverview()) {
if (mControllers.uiController.isInOverviewUi()) {
taskbarBuilder.setTaskSwitcherContainer(
LauncherAtom.TaskSwitcherContainer.newBuilder());
}
@@ -375,7 +375,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas
) {
// Taskbar has some touchable elements, take over the full taskbar area
if (
controllers.uiController.isInOverview &&
controllers.uiController.isInOverviewUi &&
DisplayController.isTransientTaskbar(context)
) {
val region =
@@ -666,8 +666,8 @@ public class TaskbarLauncherStateController {
&& !mLauncher.getWorkspace().isOverlayShown();
}
boolean isInOverview() {
return mLauncherState == LauncherState.OVERVIEW;
boolean isInOverviewUi() {
return mLauncherState.overviewUi;
}
private void playStateTransitionAnim(AnimatorSet animatorSet, long duration,
@@ -58,6 +58,7 @@ import androidx.annotation.Nullable;
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 @@ public class TaskbarManager {
/**
* 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();
}
@@ -193,7 +193,7 @@ public class TaskbarUIController {
}
/** Returns {@code true} if Taskbar is currently within overview. */
protected boolean isInOverview() {
protected boolean isInOverviewUi() {
return false;
}
@@ -602,23 +602,21 @@ public class TouchInteractionService extends Service {
}
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);
}
}
+7 -2
View File
@@ -1653,7 +1653,7 @@ public class Launcher extends StatefulActivity<LauncherState>
} 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);
@@ -1667,7 +1667,12 @@ public class Launcher extends StatefulActivity<LauncherState>
// 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 {