From 604e7a7a7c14e56e3d6b09ff57c87cf773cca28c Mon Sep 17 00:00:00 2001 From: minch Date: Sat, 19 Apr 2025 06:33:43 +0000 Subject: [PATCH 1/9] Remove RecentTasksList implement of DesktopVisibilityController This is not needed as DesktopTasksController notifies the RecentTasksController on the desk addition and removal. WMShell side change can be found at ag/33157203. Bug: 401602554 Test: m Flag: EXEMPT refactor Change-Id: Ib8a1833c80f636e29dddbeebae2341ef305b0ab6 --- .../android/quickstep/RecentTasksList.java | 39 +------------------ .../com/android/quickstep/RecentsModel.java | 8 +--- .../quickstep/RecentTasksListTest.java | 2 - 3 files changed, 3 insertions(+), 46 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index fcccfdce13..655d78e24d 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -38,8 +38,6 @@ import androidx.annotation.VisibleForTesting; import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.util.DaggerSingletonTracker; import com.android.launcher3.util.LooperExecutor; -import com.android.launcher3.util.SplitConfigurationOptions; -import com.android.launcher3.util.window.WindowManagerProxy; import com.android.quickstep.util.DesktopTask; import com.android.quickstep.util.ExternalDisplaysKt; import com.android.quickstep.util.GroupTask; @@ -50,7 +48,6 @@ import com.android.wm.shell.Flags; import com.android.wm.shell.recents.IRecentTasksListener; import com.android.wm.shell.shared.GroupedTaskInfo; import com.android.wm.shell.shared.desktopmode.DesktopModeStatus; -import com.android.wm.shell.shared.split.SplitBounds; import kotlin.collections.ArraysKt; import kotlin.collections.CollectionsKt; @@ -71,10 +68,7 @@ import java.util.stream.Collectors; /** * Manages the recent task list from the system, caching it as necessary. */ -// TODO: b/401602554 - Consider letting [DesktopTasksController] notify [RecentTasksController] of -// desk changes to trigger [IRecentTasksListener.onRecentTasksChanged()], instead of implementing -// [DesktopVisibilityListener]. -public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityListener { +public class RecentTasksList { private static final TaskLoadResult INVALID_RESULT = new TaskLoadResult(-1, false, 0); @@ -82,7 +76,6 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList private final KeyguardManager mKeyguardManager; private final LooperExecutor mMainThreadExecutor; private final SystemUiProxy mSysUiProxy; - private final DesktopVisibilityController mDesktopVisibilityController; // The list change id, increments as the task list changes in the system private int mChangeId; @@ -101,14 +94,12 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList public RecentTasksList(Context context, LooperExecutor mainThreadExecutor, KeyguardManager keyguardManager, SystemUiProxy sysUiProxy, TopTaskTracker topTaskTracker, - DesktopVisibilityController desktopVisibilityController, DaggerSingletonTracker tracker) { mContext = context; mMainThreadExecutor = mainThreadExecutor; mKeyguardManager = keyguardManager; mChangeId = 1; mSysUiProxy = sysUiProxy; - mDesktopVisibilityController = desktopVisibilityController; final IRecentTasksListener recentTasksListener = new IRecentTasksListener.Stub() { @Override public void onRecentTasksChanged() throws RemoteException { @@ -161,13 +152,6 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList tracker.addCloseable( () -> mSysUiProxy.unregisterRecentTasksListener(recentTasksListener)); - if (DesktopModeStatus.enableMultipleDesktops(mContext)) { - mDesktopVisibilityController.registerDesktopVisibilityListener( - this); - tracker.addCloseable( - () -> mDesktopVisibilityController.unregisterDesktopVisibilityListener(this)); - } - // We may receive onRunningTaskAppeared events later for tasks which have already been // included in the list returned by mSysUiProxy.getRunningTasks(), or may receive // onRunningTaskVanished for tasks not included in the returned list. These cases will be @@ -306,27 +290,6 @@ public class RecentTasksList implements WindowManagerProxy.DesktopVisibilityList return mRunningTasks; } - @Override - public void onDeskAdded(int displayId, int deskId) { - onRecentTasksChanged(); - } - - @Override - public void onDeskRemoved(int displayId, int deskId) { - onRecentTasksChanged(); - } - - @Override - public void onActiveDeskChanged(int displayId, int newActiveDesk, int oldActiveDesk) { - // Should desk activation changes lead to the invalidation of the loaded tasks? The cases - // are: - // - Switching from one active desk to another. - // - Switching from out of a desk session into an active desk. - // - Switching from an active desk to a non-desk session. - // These changes don't affect the list of desks, nor their contents, so let's ignore them - // for now. - } - private void onRunningTaskAppeared(RunningTaskInfo taskInfo) { // Make sure this task is not already in the list for (RunningTaskInfo existingTask : mRunningTasks) { diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java index 601b0a08a4..62662affd9 100644 --- a/quickstep/src/com/android/quickstep/RecentsModel.java +++ b/quickstep/src/com/android/quickstep/RecentsModel.java @@ -43,7 +43,6 @@ import com.android.launcher3.dagger.LauncherAppSingleton; import com.android.launcher3.graphics.ThemeManager; import com.android.launcher3.graphics.ThemeManager.ThemeChangeListener; import com.android.launcher3.icons.IconProvider; -import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.util.DaggerSingletonObject; import com.android.launcher3.util.DaggerSingletonTracker; import com.android.launcher3.util.DisplayController; @@ -105,14 +104,12 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe DisplayController displayController, LockedUserState lockedUserState, Lazy themeManagerLazy, - DesktopVisibilityController desktopVisibilityController, DaggerSingletonTracker tracker ) { // Lazily inject the ThemeManager and access themeManager once the device is // unlocked. See b/393248495 for details. this(context, new IconProvider(context), systemUiProxy, topTaskTracker, - displayController, lockedUserState, themeManagerLazy, desktopVisibilityController, - tracker); + displayController, lockedUserState, themeManagerLazy, tracker); } @SuppressLint("VisibleForTests") @@ -123,7 +120,6 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe DisplayController displayController, LockedUserState lockedUserState, Lazy themeManagerLazy, - DesktopVisibilityController desktopVisibilityController, DaggerSingletonTracker tracker) { this(context, new RecentTasksList( @@ -131,7 +127,7 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe MAIN_EXECUTOR, context.getSystemService(KeyguardManager.class), systemUiProxy, - topTaskTracker, desktopVisibilityController, tracker), + topTaskTracker, tracker), new TaskIconCache(context, RECENTS_MODEL_EXECUTOR, iconProvider, displayController), new TaskThumbnailCache(context, RECENTS_MODEL_EXECUTOR), iconProvider, diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java b/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java index 81f1485958..1c780f0ee0 100644 --- a/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java +++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/RecentTasksListTest.java @@ -48,7 +48,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.internal.R; -import com.android.launcher3.statehandlers.DesktopVisibilityController; import com.android.launcher3.util.DaggerSingletonTracker; import com.android.launcher3.util.Executors; import com.android.launcher3.util.LooperExecutor; @@ -106,7 +105,6 @@ public class RecentTasksListTest { mRecentTasksList = new RecentTasksList(mContext, mainThreadExecutor, mockKeyguardManager, mSystemUiProxy, mTopTaskTracker, - mock(DesktopVisibilityController.class), mock(DaggerSingletonTracker.class)); } From 1e2e88a884c13c594e160c820986ccbdfac78983 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Thu, 1 May 2025 01:48:16 +0000 Subject: [PATCH 2/9] Update All Apps divider color. Also update how theming is applied. We pass a ContextThemeWrapper to relevant views to retrieve the updated colors. Demos switching blur on and off with adb: - From top (QSB, handle, divider): https://drive.google.com/file/d/1FHNzp5bNbNtH8tM7rSjKELPr6hsETPST/view?usp=drive_link&resourcekey=0-JuiAUJoNh4Pe_xKa74h0-g - Scrolled down (header protection + private space): https://drive.google.com/file/d/1gb1GCH3tJHS7HzOjvXgrTxNQ9gfD59dw/view?usp=drive_link&resourcekey=0-AK58FpfN-sDfWhWkmqaEmA Test: Manual Flag: com.android.launcher3.all_apps_blur Fix: 413143411 Change-Id: I5da3b7c38ea4f81dec1011b6cc15ad8b591c761b --- .../appprediction/AppsDividerView.java | 25 ++++++++++++++++--- .../uioverrides/QuickstepLauncher.java | 8 +++--- .../allapps/ActivityAllAppsContainerView.java | 7 +++--- .../launcher3/allapps/FloatingHeaderRow.java | 4 +++ .../launcher3/allapps/FloatingHeaderView.java | 9 +++++++ .../PersonalWorkSlidingTabStrip.java | 5 ++-- 6 files changed, 46 insertions(+), 12 deletions(-) diff --git a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java index e1e3eec790..1f914bfd30 100644 --- a/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java +++ b/quickstep/src/com/android/launcher3/appprediction/AppsDividerView.java @@ -27,16 +27,19 @@ import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.util.AttributeSet; +import android.view.ContextThemeWrapper; import android.view.View; import android.view.accessibility.AccessibilityManager; import androidx.annotation.ColorInt; import androidx.annotation.VisibleForTesting; +import com.android.launcher3.Flags; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.allapps.FloatingHeaderRow; import com.android.launcher3.allapps.FloatingHeaderView; +import com.android.launcher3.util.Themes; /** * A view which shows a horizontal divider @@ -53,8 +56,8 @@ public class AppsDividerView extends View implements FloatingHeaderRow { private final TextPaint mPaint = new TextPaint(); private DividerType mDividerType = DividerType.NONE; - private final @ColorInt int mStrokeColor; - private final @ColorInt int mAllAppsLabelTextColor; + private @ColorInt int mStrokeColor; + private @ColorInt int mAllAppsLabelTextColor; private final AccessibilityManager mAccessibilityManager; private Layout mAllAppsLabelLayout; @@ -84,8 +87,9 @@ public class AppsDividerView extends View implements FloatingHeaderRow { getResources().getDimensionPixelSize(R.dimen.all_apps_divider_height) }; - mStrokeColor = context.getColor(R.color.materialColorOutlineVariant); - + mStrokeColor = Flags.allAppsBlur() + ? Themes.getAttrColor(context, R.attr.bottomSheetDragHandleColor) + : context.getColor(R.color.materialColorOutlineVariant); mAllAppsLabelTextColor = context.getColor(R.color.materialColorOnSurfaceVariant); mAccessibilityManager = AccessibilityManager.getInstance(context); @@ -99,6 +103,19 @@ public class AppsDividerView extends View implements FloatingHeaderRow { updateDividerType(); } + @Override + public void updateTheme(ContextThemeWrapper contextThemeWrapper) { + mStrokeColor = Themes.getAttrColor(contextThemeWrapper, R.attr.bottomSheetDragHandleColor); + mAllAppsLabelTextColor = + contextThemeWrapper.getColor(R.color.materialColorOnSurfaceVariant); + if (mDividerType == DividerType.LINE) { + mPaint.setColor(mStrokeColor); + } else if (mDividerType == DividerType.ALL_APPS_LABEL) { + mPaint.setColor(mAllAppsLabelTextColor); + } + invalidate(); + } + /** {@code true} if all apps label should be shown in place of divider. */ public void setShowAllAppsLabel(boolean showAllAppsLabel) { if (mAccessibilityManager.isEnabled() && !Utilities.isRunningInTestHarness()) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index fe1de21e84..1c4ea12b59 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -88,6 +88,7 @@ import android.os.Trace; import android.os.UserHandle; import android.text.TextUtils; import android.util.AttributeSet; +import android.view.ContextThemeWrapper; import android.view.Display; import android.view.HapticFeedbackConstants; import android.view.KeyEvent; @@ -463,10 +464,11 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer, if (!Flags.allAppsBlur() && !enableOverviewBackgroundWallpaperBlur()) { return; } - getTheme().applyStyle(getBlurStyleResId(), true); + int blurStyleResId = getBlurStyleResId(); + getTheme().applyStyle(blurStyleResId, true); if (Flags.allAppsBlur()) { - getAppsView().getContext().getTheme().applyStyle(getBlurStyleResId(), true); - getAppsView().onThemeChanged(); + getAppsView().onThemeChanged( + new ContextThemeWrapper(getApplicationContext(), blurStyleResId)); } if (enableOverviewBackgroundWallpaperBlur()) { getScrimView().setBackgroundColor( diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index c408a3021f..75757a4e95 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -50,6 +50,7 @@ import android.os.UserManager; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; +import android.view.ContextThemeWrapper; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -857,13 +858,13 @@ public class ActivityAllAppsContainerView } /** Refresh the UI according to the current theme. */ - public void onThemeChanged() { + public void onThemeChanged(ContextThemeWrapper contextThemeWrapper) { updateHeaderScroll(getActiveRecyclerView().computeVerticalScrollOffset()); invalidateHeader(); forAllRecyclerViews(RecyclerView::invalidateItemDecorations); getSearchUiManager().onThemeChanged(); - getFloatingHeaderView().getTabLayout().updateTheme(); - mBottomSheetHandle.setBackground(getContext().getDrawable( + getFloatingHeaderView().updateTheme(contextThemeWrapper); + mBottomSheetHandle.setBackground(contextThemeWrapper.getDrawable( R.drawable.bg_rounded_corner_bottom_sheet_handle)); } diff --git a/src/com/android/launcher3/allapps/FloatingHeaderRow.java b/src/com/android/launcher3/allapps/FloatingHeaderRow.java index 75e527aaa8..c64e720c75 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderRow.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderRow.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.allapps; +import android.view.ContextThemeWrapper; import android.view.View; /** @@ -60,4 +61,7 @@ public interface FloatingHeaderRow { default boolean isVisible() { return shouldDraw(); } + + /** Update colors using the provided theme wrapper. */ + default void updateTheme(ContextThemeWrapper contextThemeWrapper) {} } diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 896a4e1073..040d6cf33d 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -23,6 +23,7 @@ import android.graphics.Point; import android.graphics.Rect; import android.util.ArrayMap; import android.util.AttributeSet; +import android.view.ContextThemeWrapper; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -275,6 +276,14 @@ public class FloatingHeaderView extends LinearLayout implements mTabLayout.setVisibility(mTabsHidden ? GONE : visibility); } + /** Update colors using the provided theme wrapper. */ + void updateTheme(ContextThemeWrapper contextThemeWrapper) { + getTabLayout().updateTheme(contextThemeWrapper); + for (FloatingHeaderRow row : mAllRows) { + row.updateTheme(contextThemeWrapper); + } + } + /** Returns whether search bar has multi-line support, and is currently in multi-line state. */ private boolean isSearchBarMultiline() { return Flags.multilineSearchBar() && mSearchBarOffset > 0; diff --git a/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java b/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java index 0d30d5f2e3..f95ac7ce1a 100644 --- a/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java +++ b/src/com/android/launcher3/workprofile/PersonalWorkSlidingTabStrip.java @@ -18,6 +18,7 @@ package com.android.launcher3.workprofile; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; +import android.view.ContextThemeWrapper; import android.widget.Button; import android.widget.LinearLayout; @@ -47,10 +48,10 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd } /** Update the buttons background to match the theme. */ - public void updateTheme() { + public void updateTheme(ContextThemeWrapper contextThemeWrapper) { for (int i = 0; i < getChildCount(); i++) { Button tab = (Button) getChildAt(i); - tab.setBackground(getContext().getDrawable(R.drawable.all_apps_tabs_background)); + tab.setBackground(contextThemeWrapper.getDrawable(R.drawable.all_apps_tabs_background)); } } From 41b1c52c7f8044458fa6242cc40e4c67012a5b68 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 25 Apr 2025 21:35:03 +0000 Subject: [PATCH 3/9] Remove IME-specific touch passthrough for Taskbar It doesn't seem necessary anymore (and anyway, existing cases like Taskbar being stashed while IME is showing handle this as well). Removing the specific block fixes a bug where touches were going to the underlying app even though Taskbar window is fullscreen while editing a Folder name. Fixes: 400859085 Test: TaskbarInsetsControllerTest Flag: EXEMPT bugfix Change-Id: If30acd0b3b9c3fd0b29b94ca963beb1c70162416 --- .../taskbar/TaskbarInsetsController.kt | 90 ++++++++++----- .../taskbar/TaskbarInsetsControllerTest.kt | 106 ++++++++++++++++++ 2 files changed, 169 insertions(+), 27 deletions(-) create mode 100644 quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarInsetsControllerTest.kt diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index 9307899858..c9e613b913 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -32,8 +32,10 @@ import android.view.InsetsSource.FLAG_INSETS_ROUNDED_CORNER import android.view.InsetsSource.FLAG_SUPPRESS_SCRIM import android.view.Surface import android.view.ViewTreeObserver +import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION +import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE import android.view.WindowInsets import android.view.WindowInsets.Type.mandatorySystemGestures import android.view.WindowInsets.Type.navigationBars @@ -42,6 +44,7 @@ import android.view.WindowInsets.Type.tappableElement import android.view.WindowManager import android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD import android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION +import androidx.annotation.VisibleForTesting import androidx.core.graphics.toRegion import com.android.app.tracing.traceSection import com.android.internal.policy.GestureNavigationSettingsObserver @@ -51,6 +54,14 @@ import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION import com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DEFAULT_TOUCH_REGION +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DRAG_LAYER_INVISIBLE +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.FULLSCREEN_TASKBAR_WINDOW +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.ICONS_INVISIBLE +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.PHONE_MODE +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.SYSTEM_DRAG_IN_PROGRESS +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.TRANSIENT_IN_OVERVIEW +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.UI_CONTROLLER_UNTOUCHABLE import com.android.launcher3.testing.shared.ResourceUtils import com.android.launcher3.util.Executors import java.io.PrintWriter @@ -84,7 +95,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas context, this::onTaskbarOrBubblebarWindowHeightOrInsetsChanged, ) - private val debugTouchableRegion = DebugTouchableRegion() + @VisibleForTesting val debugTouchableRegion = DebugTouchableRegion() // Initialized in init. private lateinit var controllers: TaskbarControllers @@ -352,6 +363,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas */ fun updateInsetsTouchability(insetsInfo: ViewTreeObserver.InternalInsetsInfo) { insetsInfo.touchableRegion.setEmpty() + val touchableInsets: Int val bubbleBarVisible = controllers.bubbleControllers.isPresent && controllers.bubbleControllers.get().bubbleBarViewController.isBubbleBarVisible() @@ -362,32 +374,24 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas (!controllers.navbarButtonsViewController.isImeVisible || !controllers.navbarButtonsViewController.isImeRenderingNavButtons) ) { - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME) - debugTouchableRegion.lastSetTouchableReason = - "Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons" + touchableInsets = TOUCHABLE_INSETS_FRAME + debugTouchableRegion.lastSetTouchableReason = PHONE_MODE } else if (context.dragLayer.alpha < AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD) { // Let touches pass through us. - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) - debugTouchableRegion.lastSetTouchableReason = "Taskbar is invisible" - } else if ( - controllers.navbarButtonsViewController.isImeVisible && - controllers.taskbarStashController.isStashed - ) { - // Let touches pass through us. - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) - debugTouchableRegion.lastSetTouchableReason = "Stashed over IME" + touchableInsets = TOUCHABLE_INSETS_REGION + debugTouchableRegion.lastSetTouchableReason = DRAG_LAYER_INVISIBLE } else if (!controllers.uiController.isTaskbarTouchable) { // Let touches pass through us. - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) - debugTouchableRegion.lastSetTouchableReason = "Taskbar is not touchable" + touchableInsets = TOUCHABLE_INSETS_REGION + debugTouchableRegion.lastSetTouchableReason = UI_CONTROLLER_UNTOUCHABLE } else if (controllers.taskbarDragController.isSystemDragInProgress) { // Let touches pass through us. - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) - debugTouchableRegion.lastSetTouchableReason = "System drag is in progress" + touchableInsets = TOUCHABLE_INSETS_REGION + debugTouchableRegion.lastSetTouchableReason = SYSTEM_DRAG_IN_PROGRESS } else if (context.isTaskbarWindowFullscreen) { // Intercept entire fullscreen window. - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_FRAME) - debugTouchableRegion.lastSetTouchableReason = "Taskbar is fullscreen" + touchableInsets = TOUCHABLE_INSETS_FRAME + debugTouchableRegion.lastSetTouchableReason = FULLSCREEN_TASKBAR_WINDOW context.dragLayer.getBoundsInWindow(debugTouchableRegion.lastSetTouchableBounds, false) } else if ( controllers.taskbarViewController.areIconsVisible() || @@ -414,24 +418,26 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas region.addBoundsToRegion(bubbleBarBounds) } insetsInfo.touchableRegion.set(region) - debugTouchableRegion.lastSetTouchableReason = "Transient Taskbar is in Overview" + debugTouchableRegion.lastSetTouchableReason = TRANSIENT_IN_OVERVIEW debugTouchableRegion.lastSetTouchableBounds.set(region.bounds) } else { insetsInfo.touchableRegion.set(defaultTouchableRegion) - debugTouchableRegion.lastSetTouchableReason = "Using default touchable region" + debugTouchableRegion.lastSetTouchableReason = DEFAULT_TOUCH_REGION debugTouchableRegion.lastSetTouchableBounds.set(defaultTouchableRegion.bounds) } - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) + touchableInsets = TOUCHABLE_INSETS_REGION } else { - insetsInfo.setTouchableInsets(TOUCHABLE_INSETS_REGION) - debugTouchableRegion.lastSetTouchableReason = - "Icons are not visible, but other components such as 3 buttons might be" + touchableInsets = TOUCHABLE_INSETS_REGION + debugTouchableRegion.lastSetTouchableReason = ICONS_INVISIBLE } // Always have nav buttons be touchable controllers.navbarButtonsViewController.addVisibleButtonsRegion( context.dragLayer, insetsInfo.touchableRegion, ) + + insetsInfo.setTouchableInsets(touchableInsets) + debugTouchableRegion.lastSetTouchableInsets = touchableInsets debugTouchableRegion.lastSetTouchableBounds.set(insetsInfo.touchableRegion.bounds) } @@ -463,12 +469,42 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } pw.println() } - pw.println("$prefix\tlastSetTouchableBounds=${debugTouchableRegion.lastSetTouchableBounds}") - pw.println("$prefix\tlastSetTouchableReason=${debugTouchableRegion.lastSetTouchableReason}") + pw.println("$prefix\tdebugTouchableRegion=$debugTouchableRegion") } class DebugTouchableRegion { + + companion object { + const val PHONE_MODE = + "Phone button nav mode: Fullscreen touchable, IME not affecting nav buttons" + const val DRAG_LAYER_INVISIBLE = "Taskbar is invisible" + const val UI_CONTROLLER_UNTOUCHABLE = "Taskbar is not touchable" + const val SYSTEM_DRAG_IN_PROGRESS = "System drag is in progress" + const val FULLSCREEN_TASKBAR_WINDOW = "Taskbar is fullscreen" + const val TRANSIENT_IN_OVERVIEW = "Transient Taskbar is in Overview" + const val DEFAULT_TOUCH_REGION = "Using default touchable region" + const val ICONS_INVISIBLE = + "Icons are not visible, but other components such as 3 buttons might be" + } + val lastSetTouchableBounds = Rect() var lastSetTouchableReason = "" + var lastSetTouchableInsets = TOUCHABLE_INSETS_FRAME + + override fun toString(): String { + return "{lastSetTouchableBounds=$lastSetTouchableBounds" + + ", lastSetTouchableReason=\"$lastSetTouchableReason\"" + + ", lastSetTouchableInsets=${touchableInsetsToString()}" + } + + private fun touchableInsetsToString(): String { + return when (lastSetTouchableInsets) { + TOUCHABLE_INSETS_FRAME -> "TOUCHABLE_INSETS_FRAME" + TOUCHABLE_INSETS_CONTENT -> "TOUCHABLE_INSETS_CONTENT" + TOUCHABLE_INSETS_VISIBLE -> "TOUCHABLE_INSETS_VISIBLE" + TOUCHABLE_INSETS_REGION -> "TOUCHABLE_INSETS_REGION" + else -> "Unknown" + } + } } } diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarInsetsControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarInsetsControllerTest.kt new file mode 100644 index 0000000000..69c56f4e34 --- /dev/null +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarInsetsControllerTest.kt @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.taskbar + +import android.animation.AnimatorTestRule +import android.view.ViewTreeObserver +import com.android.launcher3.taskbar.TaskbarControllerTestUtil.runOnMainSync +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.DEFAULT_TOUCH_REGION +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.FULLSCREEN_TASKBAR_WINDOW +import com.android.launcher3.taskbar.TaskbarInsetsController.DebugTouchableRegion.Companion.ICONS_INVISIBLE +import com.android.launcher3.taskbar.rules.TaskbarModeRule.Mode.TRANSIENT +import com.android.launcher3.taskbar.rules.TaskbarModeRule.TaskbarMode +import com.android.launcher3.taskbar.rules.TaskbarUnitTestRule +import com.android.launcher3.taskbar.rules.TaskbarUnitTestRule.InjectController +import com.android.launcher3.taskbar.rules.TaskbarWindowSandboxContext +import com.android.launcher3.util.LauncherMultivalentJUnit +import com.android.launcher3.util.LauncherMultivalentJUnit.EmulatedDevices +import com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_VISIBLE +import com.google.common.truth.Truth.assertThat +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(LauncherMultivalentJUnit::class) +@EmulatedDevices(["pixelFoldable2023", "pixelTablet2023"]) +class TaskbarInsetsControllerTest { + + @get:Rule(order = 0) val context = TaskbarWindowSandboxContext.create() + @get:Rule(order = 1) val animatorTestRule = AnimatorTestRule(this) + @get:Rule(order = 2) val taskbarUnitTestRule = TaskbarUnitTestRule(this, context) + + @InjectController lateinit var taskbarInsetsController: TaskbarInsetsController + @InjectController lateinit var taskbarStashController: TaskbarStashController + + private val taskbarContext by taskbarUnitTestRule::activityContext + + @Test + fun imeShowing_taskbarWindowUntouchable() { + runOnMainSync { taskbarContext.updateSysuiStateFlags(SYSUI_STATE_IME_VISIBLE, false) } + runOnMainSync { + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason) + .isEqualTo(ICONS_INVISIBLE) + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets) + .isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION) + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableBounds.isEmpty) + .isTrue() + } + } + + @Test + @TaskbarMode(TRANSIENT) + fun imeShowing_transientTaskbarUnstashed_taskbarWindowTouchable() { + runOnMainSync { + taskbarContext.updateSysuiStateFlags(SYSUI_STATE_IME_VISIBLE, false) + taskbarStashController.updateAndAnimateTransientTaskbar(false) + animatorTestRule.advanceTimeBy(taskbarStashController.stashDuration) + } + runOnMainSync { + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason) + .isEqualTo(DEFAULT_TOUCH_REGION) + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets) + .isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION) + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableBounds.isEmpty) + .isFalse() + } + } + + @Test + fun windowFullscreen_entireTaskbarWindowTouchable() { + runOnMainSync { taskbarContext.setTaskbarWindowFullscreen(true) } + runOnMainSync { + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason) + .isEqualTo(FULLSCREEN_TASKBAR_WINDOW) + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets) + .isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME) + } + } + + @Test + fun windowFullscreen_imeShowing_entireTaskbarWindowTouchable() { + runOnMainSync { + taskbarContext.setTaskbarWindowFullscreen(true) + taskbarContext.updateSysuiStateFlags(SYSUI_STATE_IME_VISIBLE, false) + } + runOnMainSync { + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableReason) + .isEqualTo(FULLSCREEN_TASKBAR_WINDOW) + assertThat(taskbarInsetsController.debugTouchableRegion.lastSetTouchableInsets) + .isEqualTo(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME) + } + } +} From 506b2a8b352c24878292836a87c4cfe4434b6a3b Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 1 May 2025 10:52:41 -0700 Subject: [PATCH 4/9] Make sure animation is cancelled for existing flyout When we show a new flyout, it is possible for the previous flyout to still be there and animating out. We were removing the existing flyout, but did not cancel the animation. This meant that there could have been a hide animation running for the previous flyout. Once that animation finished, it removed the current flyout from the container. It was possible for the current flyout to already be updated to the new one. In which case the animation for the previous flyout hid the new flyout. Bug: 414808503 Test: atest PlatformScenarioTests:BubbleBarTest Flag: com.android.wm.shell.enable_bubble_bar Change-Id: I4229297fa999d815c12eefd9d583bdfc915ec00a --- .../taskbar/bubbles/flyout/BubbleBarFlyoutController.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt index 7c718e5b56..d3cd662243 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt @@ -64,6 +64,7 @@ constructor( } fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) { + animator?.cancel() flyout?.let(container::removeView) val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler) From 34024fe26a17483b6bd2e9b7fbdfaf5e91c3938c Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Thu, 1 May 2025 14:33:01 -0400 Subject: [PATCH 5/9] Send bubble bar distance to shell We previously sent the top coordinate of the bubble bar to shell. However when the screen height changes, launcher takes a bit longer to update than shell. So instead of calculating the top coordinate on the launcher side, we now send the amount of space between the bubble bar and the bottom of the screen to shell, where we can offset that as needed. Bug: 392893178 Flag: com.android.wm.shell.enable_bubble_bar Test: manual - send some bubbles - launch app - expand - swipe to home - fold and unfold Change-Id: I57b96db49dab1e2304fde8dc55a99eaaf85e40f8 --- .../taskbar/bubbles/BubbleBarController.java | 15 +++++------ .../taskbar/bubbles/BubbleBarView.java | 17 ++++++------ .../bubbles/BubbleBarViewController.java | 10 +++---- .../com/android/quickstep/SystemUiProxy.kt | 27 ++++++++++--------- .../bubbles/BubbleBarViewScreenshotTest.kt | 2 -- .../PersistentBubbleStashControllerTest.kt | 2 -- .../TransientBubbleStashControllerTest.kt | 2 -- .../animation/BubbleBarViewAnimatorTest.kt | 2 -- 8 files changed, 33 insertions(+), 44 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index b6a0ffe53c..5b641e9bb0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -123,8 +123,7 @@ public class BubbleBarController extends IBubblesListener.Stub { private BubbleCreator mBubbleCreator; private BubbleBarLocationListener mBubbleBarLocationListener; - // Cache last sent top coordinate to avoid sending duplicate updates to shell - private int mLastSentBubbleBarTop; + private int mLastSentBubbleBarTopToScreenBottom; private boolean mIsImeVisible = false; @@ -531,8 +530,8 @@ public class BubbleBarController extends IBubblesListener.Stub { /** Tells WMShell to show the currently selected bubble. */ public void showSelectedBubble() { if (getSelectedBubbleKey() != null) { - mLastSentBubbleBarTop = mBarView.getRestingTopPositionOnScreen(); - mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTop); + mLastSentBubbleBarTopToScreenBottom = mBarView.getTopToScreenBottom(); + mSystemUiProxy.showBubble(getSelectedBubbleKey(), mLastSentBubbleBarTopToScreenBottom); } else { Log.w(TAG, "Trying to show the selected bubble but it's null"); } @@ -630,10 +629,10 @@ public class BubbleBarController extends IBubblesListener.Stub { } private void onBubbleBarBoundsChanged(boolean forceUpdate) { - int newTop = mBarView.getRestingTopPositionOnScreen(); - if (newTop != mLastSentBubbleBarTop || forceUpdate) { - mLastSentBubbleBarTop = newTop; - mSystemUiProxy.updateBubbleBarTopOnScreen(newTop); + int bubbleBarTopToScreenBottom = mBarView.getTopToScreenBottom(); + if (bubbleBarTopToScreenBottom != mLastSentBubbleBarTopToScreenBottom || forceUpdate) { + mLastSentBubbleBarTopToScreenBottom = bubbleBarTopToScreenBottom; + mSystemUiProxy.updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index f104d93094..c1cddd06d1 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -651,13 +651,15 @@ public class BubbleBarView extends FrameLayout { } } - /** - * Get bubble bar top coordinate on screen when bar is resting - */ - public int getRestingTopPositionOnScreen() { - int displayHeight = mController.getScreenHeight(); + /** Get the distance between the bubble bar top coordinate and the bottom of the screen */ + public int getTopToScreenBottom() { + // the bottom of the bubble bar is aligned with the bottom of the screen. the distance + // between the top of the bubble bar and the bottom of the screen is the height of the + // bubble bar minus the y translation. since the bubble bar is always above the bottom of + // the screen, the translation is negative and the overall result is a positive value that + // represents the distance int bubbleBarHeight = getBubbleBarBounds().height(); - return displayHeight - bubbleBarHeight + (int) mController.getBubbleBarTranslationY(); + return bubbleBarHeight - (int) mController.getBubbleBarTranslationY(); } /** Returns the bounds with translation that may have been applied. */ @@ -1646,9 +1648,6 @@ public class BubbleBarView extends FrameLayout { /** Interface for BubbleBarView to communicate with its controller. */ public interface Controller { - /** Returns the screen height. */ - int getScreenHeight(); - /** Returns the translation Y that the bubble bar should have. */ float getBubbleBarTranslationY(); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index c74140a8fe..82cd3d86e4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -280,11 +280,6 @@ public class BubbleBarViewController { : PINNING_PERSISTENT; mBubbleBarPinning.updateValue(pinningValue); mBarView.setController(new BubbleBarView.Controller() { - @Override - public int getScreenHeight() { - return mActivity.getScreenSize().y; - } - @Override public float getBubbleBarTranslationY() { return mBubbleStashController.getBubbleBarTranslationY(); @@ -741,7 +736,8 @@ public class BubbleBarViewController { public boolean isEventOverBubbleBar(MotionEvent event) { if (!isBubbleBarVisible()) return false; final Rect bounds = getBubbleBarBounds(); - final int bubbleBarTopOnScreen = mBarView.getRestingTopPositionOnScreen(); + final int bubbleBarTopOnScreen = + mActivity.getScreenSize().y - mBarView.getTopToScreenBottom(); final float x = event.getX(); return event.getRawY() >= bubbleBarTopOnScreen && x >= bounds.left && x <= bounds.right; } @@ -1336,7 +1332,7 @@ public class BubbleBarViewController { * Notifies SystemUI to expand the selected bubble when the bubble is released. */ public void onBubbleDragRelease(BubbleBarLocation location) { - mSystemUiProxy.stopBubbleDrag(location, mBarView.getRestingTopPositionOnScreen()); + mSystemUiProxy.stopBubbleDrag(location, mBarView.getTopToScreenBottom()); } /** Handle given bubble being dismissed */ diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.kt b/quickstep/src/com/android/quickstep/SystemUiProxy.kt index a7b9d41828..8abc9a592b 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.kt +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.kt @@ -574,10 +574,13 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context: * Tells SysUI to show the bubble with the provided key. * * @param key the key of the bubble to show. - * @param top top coordinate of bubble bar on screen + * @param bubbleBarTopToScreenBottom distance between the top coordinate of bubble bar and the + * bottom of the screen */ - fun showBubble(key: String?, top: Int) = - executeWithErrorLog({ "Failed call showBubble" }) { bubbles?.showBubble(key, top) } + fun showBubble(key: String?, bubbleBarTopToScreenBottom: Int) = + executeWithErrorLog({ "Failed call showBubble" }) { + bubbles?.showBubble(key, bubbleBarTopToScreenBottom) + } /** Tells SysUI to remove all bubbles. */ fun removeAllBubbles() = @@ -603,11 +606,12 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context: * expanded. * * @param location location of the bubble bar - * @param top new top coordinate for bubble bar on screen + * @param bubbleBarTopToScreenBottom distance between the new top coordinate for bubble bar and + * the bottom of the screen */ - fun stopBubbleDrag(location: BubbleBarLocation?, top: Int) = + fun stopBubbleDrag(location: BubbleBarLocation?, bubbleBarTopToScreenBottom: Int) = executeWithErrorLog({ "Failed call stopBubbleDrag" }) { - bubbles?.stopBubbleDrag(location, top) + bubbles?.stopBubbleDrag(location, bubbleBarTopToScreenBottom) } /** @@ -643,13 +647,12 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context: } /** - * Tells SysUI the top coordinate of bubble bar on screen - * - * @param topOnScreen top coordinate for bubble bar on screen + * Tells SysUI the distance between the top coordinate of the bubble bar and the bottom of the + * screen */ - fun updateBubbleBarTopOnScreen(topOnScreen: Int) = - executeWithErrorLog({ "Failed call updateBubbleBarTopOnScreen" }) { - bubbles?.updateBubbleBarTopOnScreen(topOnScreen) + fun updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom: Int) = + executeWithErrorLog({ "Failed call updateBubbleBarTopToScreenBottom" }) { + bubbles?.updateBubbleBarTopToScreenBottom(bubbleBarTopToScreenBottom) } /** diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt index a206d4e18b..5325d506f3 100644 --- a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt +++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt @@ -127,8 +127,6 @@ class BubbleBarViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { bubbleBarView.setPadding(0, paddingTop, 0, 0) bubbleBarView.setController( object : BubbleBarView.Controller { - override fun getScreenHeight(): Int = 0 - override fun getBubbleBarTranslationY(): Float = 0f override fun onBubbleBarTouched() {} diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt index 4f88ec1544..0421a13aec 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt @@ -394,8 +394,6 @@ class PersistentBubbleStashControllerTest { bubbleBarView.layoutParams = FrameLayout.LayoutParams(0, 0) bubbleBarView.setController( object : BubbleBarView.Controller { - override fun getScreenHeight(): Int = 0 - override fun getBubbleBarTranslationY(): Float = 0f override fun onBubbleBarTouched() {} diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt index c721af0a0f..f0822dac93 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt @@ -559,8 +559,6 @@ class TransientBubbleStashControllerTest { FrameLayout.LayoutParams(BUBBLE_BAR_WIDTH, BUBBLE_BAR_HEIGHT) bubbleBarView.setController( object : BubbleBarView.Controller { - override fun getScreenHeight(): Int = 0 - override fun getBubbleBarTranslationY(): Float = 0f override fun onBubbleBarTouched() {} diff --git a/quickstep/tests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt b/quickstep/tests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt index 3e6d53f545..0a9ee2c8b6 100644 --- a/quickstep/tests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt +++ b/quickstep/tests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt @@ -1398,8 +1398,6 @@ class BubbleBarViewAnimatorTest { bubbleBarView = BubbleBarView(context) bubbleBarView.setController( object : BubbleBarView.Controller { - override fun getScreenHeight(): Int = 0 - override fun getBubbleBarTranslationY(): Float = 0f override fun onBubbleBarTouched() {} From 1725d9d75fda02b22c11063a50789c7a3efe6f1a Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Fri, 2 May 2025 10:44:03 -0700 Subject: [PATCH 6/9] Fix Data Import for folder-internal items Bug: 379378706 Test: Verified this works locally. Flag: com.android.launcher3.external_data_access Change-Id: I0396a593bd02591ae599e0eb9b9e44922bd17960 --- aconfig/launcher.aconfig | 11 +++++++++++ src/com/android/launcher3/LauncherProvider.java | 12 +++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index 466e791b64..82e12008ee 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -476,6 +476,17 @@ flag { bug: "395145453" } +flag { + name: "external_data_access" + namespace: "launcher" + description: "For LauncherProvider bug fixes and new static permissions as part of the cross oem backup / restore effort." + bug: "395145453" + is_fixed_read_only: true + metadata { + purpose: PURPOSE_BUGFIX + } +} + flag { name: "gsf_res" namespace: "launcher" diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java index 12854335c0..e61519f058 100644 --- a/src/com/android/launcher3/LauncherProvider.java +++ b/src/com/android/launcher3/LauncherProvider.java @@ -94,9 +94,15 @@ public class LauncherProvider extends ContentProvider { @Override public Uri insert(Uri uri, ContentValues values) { int rowId = executeControllerTask(controller -> { - // 1. Ensure that externally added items have a valid item id - int id = controller.generateNewItemId(); - values.put(LauncherSettings.Favorites._ID, id); + // 1. Ensure that externally added items have a valid item id. Don't update Folder ids + // because items inside the folder need to reference the original ID as their container + // id, or else be deleted. + if (Flags.externalDataAccess() && values.containsKey(Favorites._ID) + && Favorites.ITEM_TYPE_FOLDER != values.getAsInteger(Favorites.ITEM_TYPE) + && Favorites.ITEM_TYPE_APP_PAIR != values.getAsInteger(Favorites.ITEM_TYPE)) { + int id = controller.generateNewItemId(); + values.put(LauncherSettings.Favorites._ID, id); + } // 2. In the case of an app widget, and if no app widget id is specified, we // attempt allocate and bind the widget. From 69ba07f2cf2a1a23a031e75a52f8cacfc8e737c6 Mon Sep 17 00:00:00 2001 From: Suhua Lei Date: Tue, 29 Apr 2025 01:17:01 +0000 Subject: [PATCH 7/9] Fix taskbar visibility for desk->desk in Overview Bug: 413192207 Flag: com.android.window.flags.enable_multiple_desktops_frontend Flag: com.android.window.flags.enable_multiple_desktops_backend Test: switch between desks in Overview Change-Id: I49806fe2b0790b1bccbac04625d7ee553c7ab3eb --- .../src/com/android/quickstep/TaskViewUtils.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 47edb05928..697a9d3161 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -678,13 +678,6 @@ public final class TaskViewUtils { // interfere with a rapid swipe up to home in the live tile + running task case. @Override public void onAnimationSuccess(Animator animation) { - // If we're relaunching the desktop tile when already entering Overview from - // desktop, no need to change the launcher visibility and taskbar visibility - // below. - boolean launchingLiveDesktop = v instanceof DesktopTaskView desktopTaskView - && desktopTaskView.isRunningTask() - && recentsView.getRemoteTargetHandles() != null; - recentsView.finishRecentsAnimation(false /* toRecents */, () -> { recentsView.post(() -> { stateManager.moveToRestState(); @@ -695,7 +688,9 @@ public final class TaskViewUtils { // that launcher is still visible. TaskbarUIController controller = recentsView.getSizeStrategy() .getTaskbarController(); - if (controller != null && !launchingLiveDesktop) { + // If we're launching the desktop tile in Overview, no need to change + // the launcher visibility and taskbar visibility below. + if (controller != null && !(v instanceof DesktopTaskView)) { boolean launcherVisible = true; for (RemoteAnimationTarget target : appTargets) { launcherVisible &= target.isTranslucent; From 28f422544e3b3c7470a324126dfebe086a0b72bd Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Fri, 2 May 2025 01:34:57 +0000 Subject: [PATCH 8/9] Update All Apps sheet interpolators. This is a bit of a stopgap until we are able to adopt a more versatile mechanism similar to SysUI, but here's the high level: - Workspace scale finishes more quickly than blur (53% vs 83% of the transition) - Closing All Apps reverses the opening interpolators (avoid blur disappearing too quickly). Design intent is described in the bug. Demo: https://drive.google.com/file/d/14Y28NeHoh_RBh3acXijhhx_ZIUK8GmYy/view?usp=drive_link&resourcekey=0-A9AUbEZcJsmP1GtSqbbrgg Bug: 415247657 Flag: com.android.launcher3.all_apps_sheet_for_handheld Flag: com.android.launcher3.all_apps_blur Test: Manual Change-Id: Iffa8e6f9dd98817899aadb3fb28fecd6c53bca7e --- .../touch/AllAppsSwipeController.java | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index 4c04b66c47..631661242c 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.touch; -import static com.android.app.animation.Interpolators.DECELERATED_EASE; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE; import static com.android.app.animation.Interpolators.EMPHASIZED_DECELERATE; @@ -34,8 +33,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PR import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; +import android.graphics.Path; import android.view.MotionEvent; import android.view.animation.Interpolator; +import android.view.animation.PathInterpolator; import com.android.app.animation.Interpolators; import com.android.launcher3.AbstractFloatingView; @@ -64,7 +65,9 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD); // Depth to apply behind All Apps when it's presented on a sheet. - private static final Interpolator ALL_APPS_SHEET_DEPTH = DECELERATED_EASE; + private static final Interpolator ALL_APPS_SHEET_DEPTH = createAllAppsSheetDepthInterpolator(); + // Scale to apply behind All Apps when it's presented on a sheet. + private static final Interpolator ALL_APPS_SHEET_SCALE = createAllAppsSheetScaleInterpolator(); // ---- Custom interpolators for NORMAL -> ALL_APPS on phones only. ---- @@ -203,15 +206,15 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { */ public static void applyAllAppsToNormalConfig(Launcher launcher, StateAnimationConfig config) { if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) { - config.setInterpolator(ANIM_SCRIM_FADE, - Interpolators.reverse(ALL_APPS_SCRIM_RESPONDER)); config.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME); if (!config.isUserControlled()) { config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED); } - config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH); - config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH); - config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH); + config.setInterpolator( + ANIM_WORKSPACE_SCALE, Interpolators.reverse(ALL_APPS_SHEET_SCALE)); + config.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(ALL_APPS_SHEET_SCALE)); + config.setInterpolator(ANIM_DEPTH, Interpolators.reverse(ALL_APPS_SHEET_DEPTH)); + config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(ALL_APPS_SHEET_DEPTH)); if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) { // On phones without blur, reveal the workspace and hotseat when leaving All Apps. config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT); @@ -253,13 +256,13 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { Launcher launcher, StateAnimationConfig config) { if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) { config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT); - config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SCRIM_RESPONDER); if (!config.isUserControlled()) { config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED); } - config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH); - config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH); + config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_SCALE); + config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_SCALE); config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH); + config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SHEET_DEPTH); if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) { // On phones without blur, hide the workspace and hotseat when entering All Apps. config.setInterpolator(ANIM_WORKSPACE_FADE, FINAL_FRAME); @@ -292,6 +295,24 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { } } + private static Interpolator createAllAppsSheetDepthInterpolator() { + Path path = new Path(); + path.moveTo(0f, 0f); + path.cubicTo(0.016f, 0f, 0.04f, 0.1f, 0.08f, 0.1f); + path.cubicTo(0.218f, 0.1f, 0.218f, 1f, 1f, 1f); + + return Interpolators.clampToProgress(new PathInterpolator(path), 0f, 0.83f); + } + + private static Interpolator createAllAppsSheetScaleInterpolator() { + Path path = new Path(); + path.moveTo(0f, 0f); + path.cubicTo(0.025f, 0f, 0.0625f, 0.2f, 0.125f, 0.2f); + path.cubicTo(0.3875f, 0.2f, 0.125f, 1f, 1f, 1f); + + return Interpolators.clampToProgress(new PathInterpolator(path), 0f, 0.53f); + } + /** Creates an interpolator that is 0 until the threshold, then follows given interpolator. */ private static Interpolator thresholdInterpolator(float threshold, Interpolator interpolator) { return progress -> progress <= threshold ? 0 : interpolator.getInterpolation(progress); From 4efae39779e9ba5746d7086371acb8661da58e00 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Thu, 1 May 2025 23:23:37 +0000 Subject: [PATCH 9/9] Ensure an opaque scrim is used for legacy all apps. When there's no background panel, we should ensure an opaque background scrim is used. Fix: 414718408 Test: Manual with all_apps_blur and all_apps_sheet_for_handheld off. Flag: EXEMPT bugfix Change-Id: I1ac9f5f8fbb01f2c6a42e9f79823b5f293ebf709 --- .../taskbar/allapps/TaskbarAllAppsSlideInView.java | 10 ++++++---- .../launcher3/uioverrides/states/AllAppsState.java | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java index b7c0774494..5ba4c368ff 100644 --- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java +++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java @@ -268,11 +268,13 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView