From 1f4b265dde4293f36ac09271e1830930d594e9a3 Mon Sep 17 00:00:00 2001 From: Toni Barzic Date: Fri, 21 Mar 2025 23:11:02 +0000 Subject: [PATCH 01/11] Prefer launching desktop tasks on freeform display Update usages of TaskbarActivityContext.inDesktopMode to account for a possibility of a desktop flavour taskbar (i.e. pinned taskbar that shows desktop tasks) being shown outside desktop mode, which may be the case on freeform displays (e.g. when enable_desktop_taskbar_on_freeform_displays feature is enabled, or on home). Tasks launched from this taskbar should preferably be launched into desktop mode. Bug: 390665752 Flag: com.android.window.flags.enable_desktop_taskbar_on_freeform_displays Test: manual on desktop device. verify correct taskbar is shown on home screen, in overview, in desktop mode, with fullscreen app shown. Verify opening/launching apps from taskbar works as expected. Change-Id: I8f198216d84fd165c2dcbf437c82e418e5c7405e --- .../launcher3/taskbar/BaseTaskbarContext.java | 9 +- .../taskbar/TaskbarActivityContext.java | 90 ++++++++++--------- .../taskbar/TaskbarDesktopModeController.kt | 6 +- .../launcher3/taskbar/TaskbarView.java | 2 +- .../taskbar/TaskbarViewController.java | 5 +- .../overlay/TaskbarOverlayContext.java | 5 ++ 6 files changed, 68 insertions(+), 49 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java index b82e6edd7c..2b749557ba 100644 --- a/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/BaseTaskbarContext.java @@ -57,10 +57,17 @@ public abstract class BaseTaskbarContext extends BaseContext public abstract NavigationMode getNavigationMode(); /** - * Returns whether the taskbar is in desktop mode. + * Returns whether the taskbar is in desktop mode. Implies that some desktop tasks are currently + * visible. */ public abstract boolean isInDesktopMode(); + /** + * Returns whether the taskbar is showing desktop tasks, which may happen even outside desktop + * mode on freeform displays. + */ + public abstract boolean isTaskbarShowingDesktopTasks(); + /** * Returns whether the taskbar is forced to be pinned when home is visible. */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index fc93d4a0ab..bf5cfc06fd 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -439,6 +439,13 @@ public class TaskbarActivityContext extends BaseTaskbarContext { && mControllers.taskbarDesktopModeController.isInDesktopMode(getDisplayId()); } + @Override + public boolean isTaskbarShowingDesktopTasks() { + return mControllers != null + && mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar( + getDisplayId()); + } + @Override public boolean showLockedTaskbarOnHome() { return DisplayController.showLockedTaskbarOnHome(this); @@ -1455,6 +1462,28 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mControllers.uiController.startSplitSelection(splitSelectSource); } + // If in overview, and a desktop task is available, launches the overview desktop task and + // schedules the provided runnable. + // Returns whether the runnable has been posted. + private boolean runAfterLaunchingDesktopTaskIfInOverview( + RecentsView recents, + Runnable runnableToRun) { + if (recents == null || !isTaskbarShowingDesktopTasks() + || !mControllers.uiController.isInOverviewUi()) { + return false; + } + + RunnableList runnableList = recents.launchRunningDesktopTaskView(); + // Wrapping it in runnable so we post after DW is ready for the app + // launch. + if (runnableList == null) { + return false; + } + + runnableList.add(() -> UI_HELPER_EXECUTOR.execute(runnableToRun)); + return true; + } + protected void onTaskbarIconClicked(View view) { TaskbarUIController taskbarUIController = mControllers.uiController; RecentsView recents = taskbarUIController.getRecentsView(); @@ -1466,25 +1495,17 @@ public class TaskbarActivityContext extends BaseTaskbarContext { // TODO: b/316004172, b/343289567: Handle `DesktopTask` and `SplitTask`. if (tag instanceof SingleTask singleTask) { RemoteTransition remoteTransition = - (isInDesktopMode() && canUnminimizeDesktopTask( + (isTaskbarShowingDesktopTasks() && canUnminimizeDesktopTask( singleTask.getTask().key.id)) ? createDesktopAppLaunchRemoteTransition(AppLaunchType.UNMINIMIZE, Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON) : null; - if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) { - RunnableList runnableList = recents.launchRunningDesktopTaskView(); - // Wrapping it in runnable so we post after DW is ready for the app - // launch. - if (runnableList != null) { - runnableList.add(() -> UI_HELPER_EXECUTOR.execute( - () -> handleGroupTaskLaunch(singleTask, remoteTransition, - isInDesktopMode(), - DesktopTaskToFrontReason.TASKBAR_TAP))); - } - } else { - handleGroupTaskLaunch(singleTask, remoteTransition, isInDesktopMode(), - DesktopTaskToFrontReason.TASKBAR_TAP); + Runnable launchTask = () -> handleGroupTaskLaunch(singleTask, remoteTransition, + isTaskbarShowingDesktopTasks(), DesktopTaskToFrontReason.TASKBAR_TAP); + if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) { + launchTask.run(); } + mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true); } else if (tag instanceof FolderInfo) { // Tapping an expandable folder icon on Taskbar @@ -1507,24 +1528,12 @@ public class TaskbarActivityContext extends BaseTaskbarContext { AppLaunchType.UNMINIMIZE, Cuj.CUJ_DESKTOP_MODE_APP_LAUNCH_FROM_ICON) : null; - - if (isInDesktopMode() && mControllers.uiController.isInOverviewUi()) { - RunnableList runnableList = recents.launchRunningDesktopTaskView(); - if (runnableList != null) { - runnableList.add(() -> - // wrapped it in runnable here since we need the post for DW to be - // ready. if we don't other DW will be gone and only the launched - // task will show. - UI_HELPER_EXECUTOR.execute(() -> - SystemUiProxy.INSTANCE.get(this).showDesktopApp( - info.getTaskId(), remoteTransition, - DesktopTaskToFrontReason.TASKBAR_TAP))); - } - } else { - UI_HELPER_EXECUTOR.execute(() -> - SystemUiProxy.INSTANCE.get(this).showDesktopApp( - info.getTaskId(), remoteTransition, - DesktopTaskToFrontReason.TASKBAR_TAP)); + Runnable launchTask = () -> + SystemUiProxy.INSTANCE.get(this).showDesktopApp( + info.getTaskId(), remoteTransition, + DesktopTaskToFrontReason.TASKBAR_TAP); + if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) { + UI_HELPER_EXECUTOR.execute(launchTask); } mControllers.taskbarStashController.updateAndAnimateTransientTaskbar( @@ -1781,17 +1790,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { .launchAppPair((AppPairIcon) launchingIconView, -1 /*cuj*/))); } else { - if (isInDesktopMode() - && mControllers.uiController.isInOverviewUi()) { - RunnableList runnableList = recents.launchRunningDesktopTaskView(); - // Wrapping it in runnable so we post after DW is ready for the app - // launch. - if (runnableList != null) { - runnableList.add(() -> UI_HELPER_EXECUTOR.execute( - () -> startItemInfoActivity(itemInfos.get(0), foundTask))); - } - } else { - startItemInfoActivity(itemInfos.get(0), foundTask); + Runnable launchTask = + () -> startItemInfoActivity(itemInfos.get(0), foundTask); + if (!runAfterLaunchingDesktopTaskIfInOverview(recents, launchTask)) { + launchTask.run(); } } } @@ -1827,7 +1829,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return; } } - if (isInDesktopMode() + if (isTaskbarShowingDesktopTasks() && DesktopModeFlags.ENABLE_DESKTOP_APP_LAUNCH_TRANSITIONS_BUGFIX.isTrue()) { launchDesktopApp(intent, info, displayId); } else { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDesktopModeController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDesktopModeController.kt index e96e67dfbc..50cf380f2b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDesktopModeController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDesktopModeController.kt @@ -48,8 +48,12 @@ class TaskbarDesktopModeController( } fun shouldShowDesktopTasksInTaskbar(): Boolean { + return shouldShowDesktopTasksInTaskbar(context.displayId) + } + + fun shouldShowDesktopTasksInTaskbar(displayId: Int): Boolean { val activityContext = taskbarControllers.taskbarActivityContext - return isInDesktopMode(context.displayId) || + return isInDesktopMode(displayId) || activityContext.showDesktopTaskbarForFreeformDisplay() || (activityContext.showLockedTaskbarOnHome() && taskbarControllers.taskbarStashController.isOnHome) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index b2989cd81a..b69f716683 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -462,7 +462,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar } // Recents divider takes priority. - if (!mAddedDividerForRecents && !mActivityContext.isInDesktopMode()) { + if (!mAddedDividerForRecents && !mActivityContext.isTaskbarShowingDesktopTasks()) { updateAllAppsDivider(); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index ac9d2ba8bf..629bc724b7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -748,8 +748,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } private boolean shouldUpdateIconContentDescription(BubbleTextView btv) { - boolean isInDesktopMode = mControllers.taskbarDesktopModeController.isInDesktopMode( - DEFAULT_DISPLAY); + boolean isInDesktopMode = + mControllers.taskbarDesktopModeController.shouldShowDesktopTasksInTaskbar( + DEFAULT_DISPLAY); boolean isAllAppsButton = btv instanceof TaskbarAllAppsButtonContainer; boolean isDividerButton = btv instanceof TaskbarDividerContainer; return isInDesktopMode && !isAllAppsButton && !isDividerButton; diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java index 8574b89ecb..8244c1fb73 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java @@ -162,6 +162,11 @@ public class TaskbarOverlayContext extends BaseTaskbarContext { return mTaskbarContext.isInDesktopMode(); } + @Override + public boolean isTaskbarShowingDesktopTasks() { + return mTaskbarContext.isTaskbarShowingDesktopTasks(); + } + @Override public boolean showLockedTaskbarOnHome() { return mTaskbarContext.showLockedTaskbarOnHome(); From 9f75f51a2c391371b48d267b36b9d5c24f2b9204 Mon Sep 17 00:00:00 2001 From: Schneider Victor-Tulias Date: Thu, 30 Jan 2025 15:13:22 -0500 Subject: [PATCH 02/11] Dispatch KeyEvents received by the RecentsWindowManager to the LauncherRootView - TaplTestsQuickstep.testDismissModalTaskAndOverviewWithEscKey was failing because RecentsWindowManager didn't dispatch key events at all. - Also moving all LauncherRootView setup to a one-time execution Flag: com.android.launcher3.enable_launcher_overview_in_window Bug: 368610710 Bug: 377678992 Test: TaplTestsQuickstep.testDismissModalTaskAndOverviewWithEscKey Change-Id: I9d8e0c91a549ed08398b2c89b1e4d23561f95c62 --- .../fallback/window/RecentsWindowManager.kt | 25 ++++++++++++++++--- .../android/launcher3/LauncherRootView.java | 7 ++++++ .../launcher3/views/ActivityContext.java | 9 +++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt index a674bf4e23..fc84afd2a2 100644 --- a/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt +++ b/quickstep/src/com/android/quickstep/fallback/window/RecentsWindowManager.kt @@ -67,6 +67,8 @@ import com.android.quickstep.fallback.RecentsState import com.android.quickstep.fallback.RecentsState.BACKGROUND_APP import com.android.quickstep.fallback.RecentsState.BG_LAUNCHER import com.android.quickstep.fallback.RecentsState.DEFAULT +import com.android.quickstep.fallback.RecentsState.MODAL_TASK +import com.android.quickstep.fallback.RecentsState.OVERVIEW_SPLIT_SELECT import com.android.quickstep.fallback.toLauncherState import com.android.quickstep.fallback.toLauncherStateOrdinal import com.android.quickstep.util.RecentsAtomicAnimationFactory @@ -392,13 +394,28 @@ class RecentsWindowManager(context: Context, wallpaperColorHints: Int) : } override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean { - // TODO(b/368610710) - return false + return windowView?.dispatchGenericMotionEvent(ev) ?: false } override fun dispatchKeyEvent(ev: KeyEvent?): Boolean { - // TODO(b/368610710) - return false + return windowView?.dispatchKeyEvent(ev) ?: false + } + + override fun onRootViewDispatchKeyEvent(event: KeyEvent?): Boolean { + TestLogging.recordKeyEvent(SEQUENCE_MAIN, "Key event", event) + return if ( + event?.action != KeyEvent.ACTION_DOWN || event.keyCode != KeyEvent.KEYCODE_ESCAPE + ) { + super.onRootViewDispatchKeyEvent(event) + } else if (isInState(OVERVIEW_SPLIT_SELECT) || isInState(MODAL_TASK)) { + stateManager.goToState(DEFAULT, true) + true + } else if (isInState(DEFAULT)) { + returnToHomescreen() + true + } else { + super.onRootViewDispatchKeyEvent(event) + } } override fun getActionsView(): OverviewActionsView<*>? { diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java index b8a0abd9e7..b8bb48b6df 100644 --- a/src/com/android/launcher3/LauncherRootView.java +++ b/src/com/android/launcher3/LauncherRootView.java @@ -6,6 +6,7 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Rect; import android.util.AttributeSet; +import android.view.KeyEvent; import android.view.ViewDebug; import android.view.WindowInsets; @@ -52,6 +53,12 @@ public class LauncherRootView extends InsettableFrameLayout { } } + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + return mStatefulContainer.onRootViewDispatchKeyEvent(event) + || super.dispatchKeyEvent(event); + } + @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { mStatefulContainer.handleConfigurationChanged( diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java index facde2c846..35bb4a5e6f 100644 --- a/src/com/android/launcher3/views/ActivityContext.java +++ b/src/com/android/launcher3/views/ActivityContext.java @@ -44,6 +44,7 @@ import android.os.Process; import android.os.UserHandle; import android.util.Log; import android.view.Display; +import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.View.AccessibilityDelegate; @@ -546,6 +547,14 @@ public interface ActivityContext extends SavedStateRegistryOwner { return (Context) this; } + /** + * Allows the current ActivityContext to intercept KeyEvent dispatches. + *

+ * Returns true iff the event has been handled. */ + default boolean onRootViewDispatchKeyEvent(KeyEvent event) { + return false; + } + /** * Returns the ActivityContext associated with the given Context, or throws an exception if * the Context is not associated with any ActivityContext. From 9d962c8c3e2c3a4ad24aef5a4fbebac63c8d7f38 Mon Sep 17 00:00:00 2001 From: Wen-Chien Wang Date: Mon, 31 Mar 2025 23:34:00 +0000 Subject: [PATCH 03/11] pin-shortcut: Move flag to lse Bug: 375648361 Test: EXEMPT changing flag Flag: EXEMPT moving flag Change-Id: I13065db6dcf42e26e87aba27f395e4345c569d6f --- aconfig/launcher.aconfig | 7 ------- .../android/launcher3/taskbar/TaskbarPopupController.java | 5 +++-- .../launcher3/taskbar/TaskbarRecentAppsController.kt | 3 ++- .../launcher3/taskbar/TaskbarPopupControllerTest.kt | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index b083390b06..4f3f539efd 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -524,13 +524,6 @@ flag { bug: "377496684" } -flag { - name: "enable_pinning_app_with_context_menu" - namespace: "launcher" - description: "Add options to pin/unpin to taskbar to app context menus." - bug: "375648361" -} - flag { name: "enable_launcher_icon_shapes" namespace: "launcher" diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java index 939a13dd46..f8240720ce 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java @@ -19,6 +19,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APP import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.model.data.AppInfo.COMPONENT_KEY_COMPARATOR; import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition; +import static com.android.window.flags.Flags.enablePinningAppWithContextMenu; import android.content.Intent; import android.content.pm.LauncherApps; @@ -147,7 +148,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba ItemInfo itemInfo = null; if (icon.getTag() instanceof ItemInfo item && ShortcutUtil.supportsShortcuts(item)) { itemInfo = item; - } else if (Flags.enablePinningAppWithContextMenu() + } else if (enablePinningAppWithContextMenu() && icon.getTag() instanceof SingleTask task) { Task.TaskKey key = task.getTask().getKey(); AppInfo appInfo = getApp( @@ -172,7 +173,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba .collect(Collectors.toList()); // TODO(b/375648361): Revisit to see if this can be implemented within getSystemShortcuts(). - if (Flags.enablePinningAppWithContextMenu()) { + if (enablePinningAppWithContextMenu()) { SystemShortcut shortcut = createPinShortcut(context, itemInfo, icon); if (shortcut != null) { systemShortcuts.add(0, shortcut); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarRecentAppsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarRecentAppsController.kt index cb98b5e43e..0d603dc1c1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarRecentAppsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarRecentAppsController.kt @@ -31,6 +31,7 @@ import com.android.quickstep.RecentsModel import com.android.quickstep.util.DesktopTask import com.android.quickstep.util.GroupTask import com.android.quickstep.util.SingleTask +import com.android.window.flags.Flags.enablePinningAppWithContextMenu import com.android.wm.shell.shared.desktopmode.DesktopModeStatus import java.io.PrintWriter @@ -331,7 +332,7 @@ class TaskbarRecentAppsController(context: Context, private val recentsModel: Re .filter { it is SingleTask && it.task.key.id in deduplicatedDesktopTasks.map { it.task.key.id } && - (!Flags.enablePinningAppWithContextMenu() || + (!enablePinningAppWithContextMenu() || shownHotseatItems.none { hotseatItem -> it.containsPackage( hotseatItem.targetPackage, diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarPopupControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarPopupControllerTest.kt index f6b6d4a97c..10962518b0 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarPopupControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarPopupControllerTest.kt @@ -23,7 +23,6 @@ import android.util.SparseArray import com.android.launcher3.AbstractFloatingView import com.android.launcher3.BubbleTextView import com.android.launcher3.Flags.FLAG_ENABLE_MULTI_INSTANCE_MENU_TASKBAR -import com.android.launcher3.Flags.FLAG_ENABLE_PINNING_APP_WITH_CONTEXT_MENU import com.android.launcher3.R import com.android.launcher3.model.data.AppInfo import com.android.launcher3.model.data.WorkspaceItemInfo @@ -36,6 +35,7 @@ import com.android.launcher3.taskbar.rules.TaskbarWindowSandboxContext import com.android.launcher3.util.LauncherMultivalentJUnit import com.android.launcher3.util.LauncherMultivalentJUnit.EmulatedDevices import com.android.quickstep.util.GroupTask +import com.android.window.flags.Flags.FLAG_ENABLE_PINNING_APP_WITH_CONTEXT_MENU import com.google.common.truth.Truth.assertThat import org.junit.Before import org.junit.Rule From d8f6e839b3810fc7ab548f89d6ec6b6061f81743 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 1 Apr 2025 16:25:28 +0100 Subject: [PATCH 04/11] Avoid removing ClearAllButton in split select animation - When ClearAllButton is removed, lastTaskScroll calculation (which is baserd on clearAllScroll) no longer works, and causes TaskView to snap to wrong position when there are < 5 tasks - Also avoid showing empty Recents when rotating in split select without any TaskViews Fix: 407462546 Test: manaul Flag: EXEMPT bug fix Change-Id: I4ffd3c43046ab3e11adc2e58b21b4256c4445757 --- .../android/quickstep/views/RecentsView.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 1e0762d169..9057bc9ded 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -757,6 +757,7 @@ public abstract class RecentsView< /** * Placeholder view indicating where the first split screen selected app will be placed */ + @Nullable protected SplitSelectStateController mSplitSelectStateController; /** @@ -1220,7 +1221,8 @@ public abstract class RecentsView< } public boolean isSplitSelectionActive() { - return mSplitSelectStateController.isSplitSelectActive(); + return mSplitSelectStateController != null + && mSplitSelectStateController.isSplitSelectActive(); } /** @@ -4302,12 +4304,14 @@ public abstract class RecentsView< mTopRowIdSet.remove(dismissedTaskViewId); if (taskCount == 1) { - removeViewInLayout(mClearAllButton); - removeViewInLayout(mAddDesktopButton); - if (isHomeTaskDismissed) { - updateEmptyMessage(); - } else if (!mSplitSelectStateController.isSplitSelectActive()) { - startHome(); + if (!isSplitSelectionActive()) { + removeViewInLayout(mClearAllButton); + removeViewInLayout(mAddDesktopButton); + if (isHomeTaskDismissed) { + updateEmptyMessage(); + } else { + startHome(); + } } } else { // Update focus task and its size. @@ -4957,7 +4961,7 @@ public abstract class RecentsView< } public void updateEmptyMessage() { - boolean isEmpty = !hasTaskViews(); + boolean isEmpty = !hasTaskViews() && !isSplitSelectionActive(); boolean hasSizeChanged = mLastMeasureSize.x != getWidth() || mLastMeasureSize.y != getHeight(); if (isEmpty == mShowEmptyMessage && !hasSizeChanged) { From 263875546297eb49381dbdf6c5a7a8a8a99ce591 Mon Sep 17 00:00:00 2001 From: Randy Pfohl Date: Wed, 2 Apr 2025 17:27:47 +0000 Subject: [PATCH 05/11] Fixing crash when showing blocked by policy message without an activity Flag: com.android.launcher3.enable_launcher_overview_in_window Test: Built locally, no crash Bug: None/Exempt found and fixed Change-Id: Ia712c298ae498f34b8bf243d2e754db8339648f1 --- .../src/com/android/quickstep/TaskOverlayFactory.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index 5bf4451fad..79fa29234f 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -19,6 +19,7 @@ package com.android.quickstep; import static com.android.launcher3.Flags.enableRefactorTaskThumbnail; import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBNAIL; import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; +import static com.android.quickstep.views.RecentsViewContainer.containerFromContext; import android.annotation.SuppressLint; import android.content.Context; @@ -34,7 +35,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; -import com.android.launcher3.BaseActivity; import com.android.launcher3.R; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; @@ -65,8 +65,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { public static List getEnabledShortcuts(TaskView taskView, TaskContainer taskContainer) { final ArrayList shortcuts = new ArrayList<>(); - final RecentsViewContainer container = - RecentsViewContainer.containerFromContext(taskView.getContext()); + final RecentsViewContainer container = containerFromContext(taskView.getContext()); for (TaskShortcutFactory menuOption : MENU_OPTIONS) { if (taskView instanceof GroupedTaskView && !menuOption.showForGroupedTask()) { continue; @@ -184,7 +183,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { protected T getActionsView() { if (mActionsView == null) { - mActionsView = (T) RecentsViewContainer.containerFromContext( + mActionsView = (T) containerFromContext( mTaskContainer.getTaskView().getContext()).getActionsView(); } return mActionsView; @@ -343,7 +342,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { RectF boundsInBitmapSpace = new RectF(); boundsToBitmapSpace.mapRect(boundsInBitmapSpace, viewRect); - RecentsViewContainer container = RecentsViewContainer.containerFromContext( + RecentsViewContainer container = containerFromContext( getTaskView().getContext()); int bottomInset = container.getDeviceProfile().isTablet ? Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom) : 0; @@ -364,7 +363,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { : mTaskContainer.getTaskView().getContext().getString( R.string.blocked_by_policy); - Snackbar.show(BaseActivity.fromContext( + Snackbar.show(containerFromContext( mTaskContainer.getTaskView().getContext()), message, null); } From fdd34cb24ab847696b153f1f88608eb3604cda6f Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 2 Apr 2025 18:54:47 +0000 Subject: [PATCH 06/11] Don't report INSETS_ROUNDED_CORNER on phones Flag: EXEMPT bugfix Fixes: 406689798 Test: none (we can add one once we add TaskbarInsetsControllerTest) Change-Id: I0bba8f39104b7b6d6dbbc4029981fea2988dae50 --- .../android/launcher3/taskbar/TaskbarActivityContext.java | 5 +++++ .../launcher3/taskbar/TaskbarDragLayerController.java | 2 +- .../com/android/launcher3/taskbar/TaskbarInsetsController.kt | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index e4b81dc206..4e43a615ea 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -598,6 +598,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext { return isPhoneMode() && !isThreeButtonNav(); } + /** Returns whether Taskbar draws its own background, vs being translucent for apps to draw. */ + public boolean drawsTaskbarBackground() { + return !isPhoneMode(); + } + /** Returns {@code true} iff a tiny version of taskbar is shown on phone. */ public boolean isTinyTaskbar() { return enableTinyTaskbar() && mDeviceProfile.isPhone && mDeviceProfile.isTaskbarPresent; diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index 1e193f6817..174a02b4ea 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -215,7 +215,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa } private void updateBackgroundAlpha() { - if (mActivity.isPhoneMode() || mActivity.isDestroyed()) { + if (!mActivity.drawsTaskbarBackground() || mActivity.isDestroyed()) { return; } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 9ceca1a1a0..e4d0bedfb3 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -109,9 +109,9 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas val taskbarStashController = controllers.taskbarStashController val tappableHeight = taskbarStashController.tappableHeightToReportToApps // We only report tappableElement height for unstashed, persistent taskbar, - // which is also when we draw the rounded corners above taskbar. + // which is also when we draw the rounded corners above taskbar on tablets. val insetsRoundedCornerFlag = - if (tappableHeight > 0) { + if (tappableHeight > 0 && context.drawsTaskbarBackground()) { FLAG_INSETS_ROUNDED_CORNER } else { 0 From 8860d1eca953fafd98b65915152025e44fb2f3a5 Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Fri, 21 Mar 2025 15:06:45 -0700 Subject: [PATCH 07/11] PageIndicatorDot Placement && Arrow Touchboxes. In the previous image tests, the page indicator placement within folders was inconsistent depending on the number of pages in a folder. This change fixes that by removing the margin_End for the page indicator in folders, as well as fixing the onMeasure call in PageIndicatorDots to be the same as the legacy calculation, just with additional space for the arrows. Previously, the touchboxes were very small, and difficult to use. To enlarge the touchbox, enlarged padding is used. This means when the indicator & arrows are visible, we need to remove the margin from the layout container and move it to padding for the indicator. Bug: 394355070 Test: Tested folders with 2, 3, and 18 pages in both left to right and right to left mode. Flag: com.android.launcher3.enable_launcher_visual_refresh Change-Id: I3a5d9d6d77dec963865adede1c4bfe38890d608f --- src/com/android/launcher3/folder/Folder.java | 28 +++++++++++++------ .../launcher3/folder/FolderPagedView.java | 4 +++ .../pageindicators/PageIndicatorDots.java | 28 ++++++++++++------- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index d1c6a4f39a..8f2e4b70a1 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -298,13 +298,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo mContent.setFolder(this); mPageIndicator = findViewById(R.id.folder_page_indicator); - if (enableLauncherVisualRefresh()) { - MarginLayoutParams params = ((MarginLayoutParams) mPageIndicator.getLayoutParams()); - int horizontalMargin = getContext().getResources() - .getDimensionPixelSize(R.dimen.folder_footer_horiz_padding); - params.setMarginStart(horizontalMargin); - params.setMarginEnd(horizontalMargin); - } mFooter = findViewById(R.id.folder_footer); mFooterHeight = dp.folderFooterHeightPx; mFolderName = findViewById(R.id.folder_name); @@ -317,11 +310,26 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_WORDS); mFolderName.forceDisableSuggestions(true); - mKeyboardInsetAnimationCallback = new KeyboardInsetAnimationCallback(this); setWindowInsetsAnimationCallback(mKeyboardInsetAnimationCallback); } + /** If arrows are visible, replace the container padding with indicator padding */ + public void onIndicatorVisibilityChanged() { + int sidePadding = getResources().getDimensionPixelSize(R.dimen.folder_footer_horiz_padding); + if (mPageIndicator.getVisibility() == View.VISIBLE) { + // Replace the container padding with indicator padding for arrows + mFooter.setPadding(0, 0, 0, 0); + mPageIndicator.setPadding(sidePadding, 0, sidePadding, 0); + ((MarginLayoutParams) mFolderName.getLayoutParams()) + .setMarginStart(sidePadding); + } else { + mFooter.setPadding(sidePadding, 0, sidePadding, 0); + mPageIndicator.setPadding(0, 0, 0, 0); + ((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginStart(0); + } + } + public boolean onLongClick(View v) { // Return if global dragging is not enabled if (!getIsLauncherDraggingEnabled()) return true; @@ -1278,7 +1286,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo super.onSizeChanged(w, h, oldw, oldh); int minTitleWidth = getResources().getDimensionPixelSize(R.dimen.folder_title_min_width); if (enableLauncherVisualRefresh() && mFolderName.getMeasuredWidth() < minTitleWidth) { - mFolderName.setVisibility(View.GONE); + ((MarginLayoutParams) mFolderName.getLayoutParams()).setMarginStart(0); + // The post is necessary for margins to be recalculated. RTL UI is shifted otherwise. + mFolderName.post(() -> mFolderName.setVisibility(View.GONE)); } } diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index 0963421f8a..4a60390477 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -18,6 +18,7 @@ package com.android.launcher3.folder; import static com.android.launcher3.AbstractFloatingView.TYPE_ALL; import static com.android.launcher3.AbstractFloatingView.TYPE_FOLDER; +import static com.android.launcher3.Flags.enableLauncherVisualRefresh; import static com.android.launcher3.folder.FolderGridOrganizer.createFolderGridOrganizer; import android.annotation.SuppressLint; @@ -390,6 +391,9 @@ public class FolderPagedView extends PagedView implements Cli // Update footer mPageIndicator.setVisibility(getPageCount() > 1 ? View.VISIBLE : View.GONE); + if (enableLauncherVisualRefresh()) { + mFolder.onIndicatorVisibilityChanged(); + } // Set the gravity as LEFT or RIGHT instead of START, as START depends on the actual text. int horizontalGravity = getPageCount() > 1 ? (mIsRtl ? Gravity.RIGHT : Gravity.LEFT) : Gravity.CENTER_HORIZONTAL; diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java index 8f80515e36..8cd835490c 100644 --- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java +++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java @@ -75,10 +75,8 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator private static final int ENTER_ANIMATION_STAGGERED_DELAY = 150; private static final int ENTER_ANIMATION_DURATION = 400; - private static final int LARGE_HEIGHT_MULTIPLIER = 12; - private static final int SMALL_HEIGHT_MULTIPLIER = 4; - private static final int LARGE_WIDTH_MULTIPLIER = 5; - private static final int SMALL_WIDTH_MULTIPLIER = 3; + private static final int HEIGHT_MULTIPLIER = 4; + private static final int WIDTH_MULTIPLIER = 3; private static final float ARROW_TOUCH_BOX_FACTOR = 5f; private static final int PAGE_INDICATOR_ALPHA = 255; @@ -88,7 +86,7 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator private static final int VISIBLE_ALPHA = 255; private static final int INVISIBLE_ALPHA = 0; private Paint mPaginationPaint; - private Consumer mOnArrowClickListener; + private @Nullable Consumer mOnArrowClickListener; // This value approximately overshoots to 1.5 times the original size. private static final float ENTER_ANIMATION_OVERSHOOT_TENSION = 4.9f; @@ -135,6 +133,8 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator private final VectorDrawable mArrowLeft; private final Rect mArrowRightBounds = new Rect(); private final Rect mArrowLeftBounds = new Rect(); + private final int mArrowWidth; + private final int mArrowHeight; private int mNumPages; private int mActivePage; @@ -188,6 +188,11 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator mIsRtl = Utilities.isRtl(getResources()); mArrowRight = (VectorDrawable) getResources().getDrawable(R.drawable.ic_chevron_end); mArrowLeft = (VectorDrawable) getResources().getDrawable(R.drawable.ic_chevron_start); + /* the width of the arrows themselves plus extra folder / touch padding. x2 for 2 arrows. */ + mArrowWidth = 2 * ((int) ((5.5f) * mGapWidth) + + getResources().getDimensionPixelSize(R.dimen.folder_footer_horiz_padding)); + mArrowHeight = + getResources().getDimensionPixelSize(R.dimen.folder_footer_height_default); } @Override @@ -426,7 +431,7 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator } @Override - public void setArrowClickListener(Consumer listener) { + public void setArrowClickListener(@Nullable Consumer listener) { mOnArrowClickListener = listener; } @@ -449,12 +454,15 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator // and so the hitboxes of arrows can be clicked easier. int width = MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY ? MeasureSpec.getSize(widthMeasureSpec) - : (int) ((mNumPages * ((enableLauncherVisualRefresh()) - ? LARGE_WIDTH_MULTIPLIER : SMALL_WIDTH_MULTIPLIER) + 2) * mDotRadius); + : (int) ((mNumPages * WIDTH_MULTIPLIER + 2) * mDotRadius); int height = MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY ? MeasureSpec.getSize(heightMeasureSpec) - : (int) (((enableLauncherVisualRefresh()) - ? LARGE_HEIGHT_MULTIPLIER : SMALL_HEIGHT_MULTIPLIER) * mDotRadius); + : (int) (HEIGHT_MULTIPLIER * mDotRadius); + if (enableLauncherVisualRefresh() && mOnArrowClickListener != null) { + // Extra height and width and gaps for accessibility arrows. + width += mArrowWidth; + height = mArrowHeight; + } setMeasuredDimension(width, height); } From 59904c788eff3762d77406a4dca344a4243a08d3 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 14 Mar 2025 09:55:14 -0400 Subject: [PATCH 08/11] Fix app pair crash * With the change made in ag/31615582, we assumed that top level + stage level split roots would always be included in the transition, that isn't the case when an app pair is already showing and then we switch to another app pair (stage roots aren't included since they aren't modified in that scenario) * Now shell sends the entire tree. Also modified SplitScreenUtils to consider TRANSIT_CHANGE changes as well for the scenario where one app of an app pair is already full screen and then we launch an app pair which has that same app, the stage root there undergoes a change and not a open/close transition. * One KI is that the animation doesn't fully work when launching a second app pair from taskbar when split is already showing (though it is an improvement from current behavior/animation). This is because when the second app pair launches, the tasks' snapshot windows/leashes are passed back as leafs, however these snapshots have not been parented to be under the stage roots. So both snapshots are positioned at 0, 0 causing overlap. Will fix that in a followup Bug: 399037701 Test: Open app pairs from desktop windowing + normal taskbar Flag: EXEMPT bugfix Change-Id: I83adffd16fea98b8e877dfbe1ba1ef4a3d08fcb9 --- .../util/SplitAnimationController.kt | 69 +++++++++++-------- .../quickstep/util/SplitScreenUtils.kt | 25 ++++--- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt index 8601350b8f..7dc7b9ec31 100644 --- a/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationController.kt @@ -36,6 +36,7 @@ import android.view.RemoteAnimationTarget import android.view.SurfaceControl import android.view.SurfaceControl.Transaction import android.view.View +import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_OPEN import android.view.WindowManager.TRANSIT_TO_FRONT import android.window.TransitionInfo @@ -65,6 +66,7 @@ import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource import com.android.launcher3.views.BaseDragLayer import com.android.quickstep.TaskViewUtils +import com.android.quickstep.util.SplitScreenUtils.Companion.extractTopParentAndChildren import com.android.quickstep.views.FloatingAppPairView import com.android.quickstep.views.FloatingTaskView import com.android.quickstep.views.GroupedTaskView @@ -730,7 +732,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC val launchAnimation = AnimatorSet() val splitRoots: Pair>? = - SplitScreenUtils.extractTopParentAndChildren(transitionInfo) + extractTopParentAndChildren(transitionInfo) check(splitRoots != null) { "Could not find split roots" } // Will point to change (0) in diagram above @@ -981,35 +983,19 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC progressUpdater.setDuration(QuickstepTransitionManager.APP_LAUNCH_DURATION) progressUpdater.interpolator = Interpolators.EMPHASIZED - var rootCandidate: Change? = null - - for (change in transitionInfo.changes) { - val taskInfo: RunningTaskInfo = change.taskInfo ?: continue - - // TODO (b/316490565): Replace this logic when SplitBounds is available to - // startAnimation() and we can know the precise taskIds of launching tasks. - if ( - taskInfo.windowingMode == windowingMode && - (change.mode == TRANSIT_OPEN || change.mode == TRANSIT_TO_FRONT) - ) { - // Found one! - rootCandidate = change - break + val splitTree: Pair>? = extractTopParentAndChildren(transitionInfo) + check(splitTree != null) { "Could not find a split root candidate" } + val rootCandidate = splitTree.first + val stageRootTaskIds: Set = splitTree.second + .map { it.taskInfo!!.taskId } + .toSet() + val leafTasks: List = transitionInfo.changes + .filter { + (TransitionUtil.isOpeningMode(it.mode) || it.mode == TRANSIT_CHANGE) + && it.taskInfo != null + && it.taskInfo!!.parentTaskId in stageRootTaskIds } - } - - // If we could not find a proper root candidate, something went wrong. - check(rootCandidate != null) { "Could not find a split root candidate" } - - // Recurse up the tree until parent is null, then we've found our root. - var parentToken: WindowContainerToken? = rootCandidate.parent - while (parentToken != null) { - rootCandidate = transitionInfo.getChange(parentToken) ?: break - parentToken = rootCandidate.parent - } - - // Make sure nothing weird happened, like getChange() returning null. - check(rootCandidate != null) { "Failed to find a root leash" } + .toList() // Starting position is a 34% size tile centered in the middle of the screen. // Ending position is the full device screen. @@ -1037,13 +1023,38 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC t.apply() } + // When animation ends, run finishCallback progressUpdater.addListener( object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { finishCallback.run() } + + override fun onAnimationStart(animation: Animator) { + // Reset leaf and stage root tasks, animation can begin from freeform windows + for (leaf in leafTasks) { + val endAbsBounds = leaf.endAbsBounds + + t.setAlpha(leaf.leash, 1f) + t.setCrop(leaf.leash, 0f, 0f, + endAbsBounds.width().toFloat(), endAbsBounds.height().toFloat()) + t.setPosition(leaf.leash, 0f, 0f) + } + + for (stageRoot in splitTree.second) { + val endAbsBounds = stageRoot.endAbsBounds + + t.setAlpha(stageRoot.leash, 1f) + t.setCrop(stageRoot.leash, 0f, 0f, + endAbsBounds.width().toFloat(), endAbsBounds.height().toFloat()) + t.setPosition(stageRoot.leash, endAbsBounds.left.toFloat(), + endAbsBounds.top.toFloat()) + } + t.apply() + } } + ) launchAnimation.play(progressUpdater) diff --git a/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt b/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt index 4005c5a813..1919f68d4a 100644 --- a/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt +++ b/quickstep/src/com/android/quickstep/util/SplitScreenUtils.kt @@ -17,14 +17,13 @@ package com.android.quickstep.util import android.util.Log -import android.view.WindowManager.TRANSIT_OPEN -import android.view.WindowManager.TRANSIT_TO_FRONT +import android.view.WindowManager.TRANSIT_CHANGE import android.window.TransitionInfo import android.window.TransitionInfo.Change import android.window.TransitionInfo.FLAG_FIRST_CUSTOM import com.android.launcher3.util.SplitConfigurationOptions +import com.android.wm.shell.shared.TransitionUtil import com.android.wm.shell.shared.split.SplitBounds -import java.lang.IllegalStateException class SplitScreenUtils { companion object { @@ -54,14 +53,7 @@ class SplitScreenUtils { ): Pair>? { val parentToChildren = mutableMapOf>() val hasParent = mutableSetOf() - // filter out anything that isn't opening and the divider - val taskChanges: List = - transitionInfo.changes - .filter { change -> - (change.mode == TRANSIT_OPEN || change.mode == TRANSIT_TO_FRONT) && - change.flags < FLAG_FIRST_CUSTOM - } - .toList() + val taskChanges: List = getNonClosingChanges(transitionInfo) // 1. Build Parent-Child Relationships for (change in taskChanges) { @@ -90,5 +82,16 @@ class SplitScreenUtils { null } } + + + /** @return includes only opening + [TRANSIT_CHANGE] changes and the divider */ + private fun getNonClosingChanges(transitionInfo: TransitionInfo): List { + return transitionInfo.changes + .filter { change -> + (TransitionUtil.isOpeningMode(change.mode) || change.mode == TRANSIT_CHANGE) + && change.flags < FLAG_FIRST_CUSTOM + } + .toList() + } } } From daf6fd534a131d03c4e5069bef6ae0708ce3c123 Mon Sep 17 00:00:00 2001 From: Ajinkya Chalke Date: Wed, 2 Apr 2025 16:19:15 +0000 Subject: [PATCH 09/11] Fix Alt+Tab KQS for projected mode - Update to show Alt+Tab KQS for phones but only on CD. - When user triggers Alt+Tab while phone display is in focus, overview is triggered - existing behaviour. - Added back querying taskbar from TaskbarManager when Overview in window is disabled. Flag: com.android.launcher3.enable_alt_tab_kqs_on_connected_displays Bug: 407508421 Fix: 407508421 Test: manually ran CUJ Change-Id: If601055b4dd16b12683c2a80065acf3aaaedd211 --- .../quickstep/OverviewCommandHelper.kt | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt index 0aea994e69..6a889d1b95 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.kt @@ -31,6 +31,7 @@ import androidx.annotation.VisibleForTesting import com.android.app.displaylib.PerDisplayRepository import com.android.app.tracing.traceSection import com.android.internal.jank.Cuj +import com.android.launcher3.DeviceProfile import com.android.launcher3.Flags.enableLargeDesktopWindowingTile import com.android.launcher3.Flags.enableOverviewCommandHelperTimeout import com.android.launcher3.PagedView @@ -335,18 +336,34 @@ constructor( val recentsViewContainer = containerInterface.getCreatedContainer() val recentsView: RecentsView<*, *>? = recentsViewContainer?.getOverviewPanel() val deviceProfile = recentsViewContainer?.getDeviceProfile() - val taskbarUIController: TaskbarUIController? = containerInterface.getTaskbarController() + val taskbarUIController: TaskbarUIController? = + if (command.displayId != DEFAULT_DISPLAY && !enableOverviewInWindow) { + // When enableOverviewInWindow is false, getContainerInterface can only return + // BaseContainerInterface of DEFAULT_DISPLAY. Getting TaskbarUiController from + // TaskbarManager as a workaround. + taskbarManager.getUIControllerForDisplay(command.displayId) + } else { + containerInterface.getTaskbarController() + } when (command.type) { HIDE -> { - if (taskbarUIController == null || deviceProfile?.isTablet == false) return true + if ( + taskbarUIController == null || + !shouldShowAltTabKqs(deviceProfile, command.displayId) + ) { + return true + } keyboardTaskFocusIndex = taskbarUIController.launchFocusedTask() if (keyboardTaskFocusIndex == -1) return true } KEYBOARD_INPUT -> - if (taskbarUIController != null && deviceProfile?.isTablet == true) { + if ( + taskbarUIController != null && + shouldShowAltTabKqs(deviceProfile, command.displayId) + ) { taskbarUIController.openQuickSwitchView() return true } else { @@ -502,6 +519,12 @@ constructor( return false } + private fun shouldShowAltTabKqs(deviceProfile: DeviceProfile?, displayId: Int): Boolean = + // Alt+Tab KQS is always shown on tablets (large screen devices). + deviceProfile?.isTablet == true || + // For small screen devices, it's only shown on connected displays. + displayId != DEFAULT_DISPLAY + private fun onTransitionComplete( command: CommandInfo, handler: AbsSwipeUpHandler<*, *, *>, From 6329ae849b3fe5f84b4b8fb2243898363ac1d477 Mon Sep 17 00:00:00 2001 From: Will Osborn Date: Thu, 3 Apr 2025 12:37:49 +0000 Subject: [PATCH 10/11] Fix for getting Display from ApplicationContext in RotationTouchHelper Bug: b/407878199 Test: local on Tangor + presubmit Flag: EXEMPT bugfix Change-Id: Id25b2c179398ff25d2607872d17f494621bfea2e --- .../quickstep/RotationTouchHelper.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index ae6cfa005b..e2fdeb07f5 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -33,6 +33,7 @@ import android.content.res.Resources; import android.view.MotionEvent; import android.view.OrientationEventListener; +import com.android.app.displaylib.DisplayRepository; import com.android.launcher3.dagger.ApplicationContext; import com.android.launcher3.dagger.LauncherAppComponent; import com.android.launcher3.dagger.LauncherAppSingleton; @@ -132,30 +133,34 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { */ private boolean mInOverview; private boolean mTaskListFrozen; - private final Context mContext; + private final Context mApplicationContext; + private final Context mDisplayContext; @Inject RotationTouchHelper(@ApplicationContext Context context, DisplayController displayController, SystemUiProxy systemUiProxy, - DaggerSingletonTracker lifeCycle) { - mContext = context; + DaggerSingletonTracker lifeCycle, + DisplayRepository displayRepository) { + mApplicationContext = context; mDisplayController = displayController; mSystemUiProxy = systemUiProxy; // TODO (b/398195845): this needs updating so non-default displays do not rotate with the // default display. mDisplayId = DEFAULT_DISPLAY; + mDisplayContext = mApplicationContext.createDisplayContext( + displayRepository.getDisplay(mDisplayId)); - Resources resources = mContext.getResources(); + Resources resources = mApplicationContext.getResources(); mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode, - () -> QuickStepContract.getWindowCornerRadius(mContext)); + () -> QuickStepContract.getWindowCornerRadius(mDisplayContext)); // Register for navigation mode and rotation changes mDisplayController.addChangeListenerForDisplay(this, mDisplayId); DisplayController.Info info = mDisplayController.getInfoForDisplay(mDisplayId); onDisplayInfoChanged(context, info, CHANGE_ALL); - mOrientationListener = new OrientationEventListener(mContext) { + mOrientationListener = new OrientationEventListener(mApplicationContext) { @Override public void onOrientationChanged(int degrees) { int newRotation = RecentsOrientedState.getRotationForUserDegreesRotated(degrees, @@ -263,7 +268,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { NavigationMode newMode = info.getNavigationMode(); mOrientationTouchTransformer.setNavigationMode(newMode, mDisplayController.getInfoForDisplay(mDisplayId), - mContext.getResources()); + mApplicationContext.getResources()); TaskStackChangeListeners.getInstance() .unregisterTaskStackListener(mFrozenTaskListener); @@ -285,7 +290,7 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { void setGesturalHeight(int newGesturalHeight) { mOrientationTouchTransformer.setGesturalHeight( newGesturalHeight, mDisplayController.getInfoForDisplay(mDisplayId), - mContext.getResources()); + mApplicationContext.getResources()); } /** From 14e8c650d5c2bf69c244600e6dc43c9ceaa59219 Mon Sep 17 00:00:00 2001 From: Shamali P Date: Tue, 1 Apr 2025 20:13:11 +0000 Subject: [PATCH 11/11] Update title font for single-app & pin widget pickers Similar to ag/32643952 (that applied it to main picker) Bug: 393610557 Fix: 393610557 Flag: com.android.launcher3.gsf_res Test: on device Change-Id: Id46985652d16a5572907d051d7a4b47fa2763809 --- res/layout/add_item_confirmation_activity.xml | 2 +- res/layout/widgets_bottom_sheet_content.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/res/layout/add_item_confirmation_activity.xml b/res/layout/add_item_confirmation_activity.xml index 2bb2eb3097..44c95c9816 100644 --- a/res/layout/add_item_confirmation_activity.xml +++ b/res/layout/add_item_confirmation_activity.xml @@ -42,7 +42,7 @@ android:orientation="vertical" >