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/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/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/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= bubbleBarTopOnScreen && x >= bounds.left && x <= bounds.right; } @@ -1359,7 +1355,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/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) 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/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index e4e89ddbca..b501f74881 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -204,9 +204,12 @@ public class AllAppsState extends LauncherState { @Override public int getWorkspaceScrimColor(Launcher launcher) { - if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet() && !Flags.allAppsBlur()) { - return launcher.getResources().getColor(R.color.widgets_picker_scrim); + if (!launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) { + // Always use an opaque scrim if there's no sheet. + return launcher.getResources().getColor(R.color.materialColorSurfaceDim); } - return Themes.getAttrColor(launcher, R.attr.allAppsScrimColor); + + return Flags.allAppsBlur() ? Themes.getAttrColor(launcher, R.attr.allAppsScrimColor) + : launcher.getResources().getColor(R.color.widgets_picker_scrim); } } 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 751597e747..8b35325f7a 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; @@ -116,14 +115,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") @@ -134,7 +131,6 @@ public class RecentsModel implements RecentTasksDataSource, TaskStackChangeListe DisplayController displayController, LockedUserState lockedUserState, Lazy themeManagerLazy, - DesktopVisibilityController desktopVisibilityController, DaggerSingletonTracker tracker) { this(context, new RecentTasksList( @@ -142,7 +138,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/src/com/android/quickstep/SystemUiProxy.kt b/quickstep/src/com/android/quickstep/SystemUiProxy.kt index 8214e7cb75..3b4638103f 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.kt +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.kt @@ -588,10 +588,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() = @@ -617,11 +620,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) } /** @@ -657,13 +661,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/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; 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 2a391a1833..2d473f1479 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/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) + } + } +} 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 d2baec12a7..3b6412d787 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/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)); } 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() {} 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. 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/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); 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)); } }