From e0a7478fde5a9bb1a8c87dd25165a59069551307 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Wed, 14 Sep 2022 17:42:05 +0100 Subject: [PATCH 01/10] Refresh taskbar apps show on DeviceProfile change. Fix: 244269456 Test: manual Change-Id: Ie95813c77b45b03a824542a25d1349675b1825c0 --- .../android/launcher3/taskbar/TaskbarViewController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 992aa4bd7d..31775e2b7d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -100,6 +100,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private int mThemeIconsColor; + private final DeviceProfile.OnDeviceProfileChangeListener mDeviceProfileChangeListener = + dp -> commitRunningAppsToUI(); + public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) { mActivity = activity; mTaskbarView = taskbarView; @@ -127,10 +130,13 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar controllers.navbarButtonsViewController.getTaskbarNavButtonTranslationY(); mTaskbarNavButtonTranslationYForInAppDisplay = controllers.navbarButtonsViewController .getTaskbarNavButtonTranslationYForInAppDisplay(); + + mActivity.addOnDeviceProfileChangeListener(mDeviceProfileChangeListener); } public void onDestroy() { LauncherAppState.getInstance(mActivity).getModel().removeCallbacks(mModelCallbacks); + mActivity.removeOnDeviceProfileChangeListener(mDeviceProfileChangeListener); mModelCallbacks.unregisterListeners(); } From d887b561834bbf9dee3c98b835fcd7c691657834 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 16 Sep 2022 16:45:50 -0700 Subject: [PATCH 02/10] Reset TaskView transformations on orientationHandler change * Transformations in the old orientation handler (ex. translate X for portrait) aren't reset when device changes to fake landscape (starts modifying translate Y). The new translations are picked up correctly, this resets the old ones. Test: Bug no longer repros. Rotated device while scrolling through tasks, no change in behavior from before. Can't think of other instances where tasks are in motion and orientation handler can change. Fixes: 233316942 Change-Id: Ie07340e69a2c93b71b1dabb8029c96ad05a4d4a1 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 1 + 1 file changed, 1 insertion(+) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 28a358e1c6..b7c6e6b275 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1771,6 +1771,7 @@ public abstract class RecentsView Date: Thu, 22 Sep 2022 16:25:10 -0700 Subject: [PATCH 03/10] Null out mSplitHiddenTaskView when resetting split selection state * May have accidentally been removed in ag/19984439 Fixes: 248153819 Test: Repro in bug doesn't occur Change-Id: Icdc04de84c28963d36368f9672baf5993cd87d8a --- quickstep/src/com/android/quickstep/views/RecentsView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 96607a0b84..b7d943268f 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4259,6 +4259,10 @@ public abstract class RecentsView Date: Wed, 28 Sep 2022 18:56:42 -0700 Subject: [PATCH 04/10] Remove ENABLE_QUICKSTEP_LIVE_TILE flag Fixes: 249627137 Test: manual - (1) swipe up from app (2) swipe home (3) quick switch (4) split in overview Change-Id: Ibe56ba3824b379b20fb3f0aa09be4d6bdb5abaa1 --- .../uioverrides/QuickstepLauncher.java | 7 +- .../NavBarToHomeTouchController.java | 13 +-- .../android/quickstep/AbsSwipeUpHandler.java | 57 ++++-------- .../quickstep/FallbackActivityInterface.java | 4 +- .../quickstep/LauncherActivityInterface.java | 6 +- .../android/quickstep/RecentsActivity.java | 11 +-- .../quickstep/TaskAnimationManager.java | 9 +- .../android/quickstep/TaskOverlayFactory.java | 13 +-- .../com/android/quickstep/TaskViewUtils.java | 3 +- .../quickstep/TouchInteractionService.java | 7 +- .../fallback/RecentsTaskController.java | 5 +- .../inputconsumers/OverviewInputConsumer.java | 29 +++--- .../quickstep/util/TaskViewSimulator.java | 3 +- .../android/quickstep/views/RecentsView.java | 89 +++++++------------ .../quickstep/views/TaskThumbnailView.java | 14 ++- .../com/android/quickstep/views/TaskView.java | 5 +- .../quickstep/AbstractQuickStepTest.java | 5 +- .../launcher3/config/FeatureFlags.java | 3 - 18 files changed, 94 insertions(+), 189 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 192ac6251e..4ca27b1145 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -29,7 +29,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK; import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT; import static com.android.launcher3.anim.Interpolators.EMPHASIZED; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.config.FeatureFlags.ENABLE_SPLIT_FROM_WORKSPACE; import static com.android.launcher3.config.FeatureFlags.ENABLE_WIDGET_PICKER_DEPTH; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; @@ -559,10 +558,8 @@ public class QuickstepLauncher extends Launcher { @Override protected void onScreenOff() { super.onScreenOff(); - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - RecentsView recentsView = getOverviewPanel(); - recentsView.finishRecentsAnimation(true /* toRecents */, null); - } + RecentsView recentsView = getOverviewPanel(); + recentsView.finishRecentsAnimation(true /* toRecents */, null); } /** diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index 30bb892c9a..40dfd82f5d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -25,7 +25,6 @@ import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PULL_BACK_TRANSLATION; import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; @@ -139,9 +138,7 @@ public class NavBarToHomeTouchController implements TouchController, AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder); - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - builder.addOnFrameCallback(recentsView::redrawLiveTile); - } + builder.addOnFrameCallback(recentsView::redrawLiveTile); AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_TASK_MENU); } else if (mStartState == ALL_APPS) { @@ -182,11 +179,9 @@ public class NavBarToHomeTouchController implements TouchController, boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS || (velocity < 0 && fling); if (success) { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - RecentsView recentsView = mLauncher.getOverviewPanel(); - recentsView.switchToScreenshot(null, - () -> recentsView.finishRecentsAnimation(true /* toRecents */, null)); - } + RecentsView recentsView = mLauncher.getOverviewPanel(); + recentsView.switchToScreenshot(null, + () -> recentsView.finishRecentsAnimation(true /* toRecents */, null)); if (mStartState.overviewUi) { new OverviewToHomeAnim(mLauncher, () -> onSwipeInteractionCompleted(mEndState)) .animateWithVelocity(velocity); diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index f3630c187b..a78142d4b3 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -26,7 +26,6 @@ import static com.android.launcher3.PagedView.INVALID_PAGE; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE; @@ -400,12 +399,6 @@ public abstract class AbsSwipeUpHandler, this::resetStateForAnimationCancel); mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_FINISH_WITH_NO_END, this::resetStateForAnimationCancel); - - if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT - | STATE_SCREENSHOT_VIEW_SHOWN | STATE_CAPTURE_SCREENSHOT, - (b) -> mRecentsView.setRunningTaskHidden(!b)); - } } protected boolean onActivityInit(Boolean alreadyOnHome) { @@ -583,14 +576,10 @@ public abstract class AbsSwipeUpHandler, } private void onDeferredActivityLaunch() { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mActivityInterface.switchRunningTaskViewToScreenshot( - null, () -> { - mTaskAnimationManager.finishRunningRecentsAnimation(true /* toHome */); - }); - } else { - mTaskAnimationManager.finishRunningRecentsAnimation(true /* toHome */); - } + mActivityInterface.switchRunningTaskViewToScreenshot( + null, () -> { + mTaskAnimationManager.finishRunningRecentsAnimation(true /* toHome */); + }); } private void setupRecentsViewUi() { @@ -1719,8 +1708,7 @@ public abstract class AbsSwipeUpHandler, } private void invalidateHandler() { - if (!ENABLE_QUICKSTEP_LIVE_TILE.get() || !mActivityInterface.isInLiveTileMode() - || mGestureState.getEndTarget() != RECENTS) { + if (!mActivityInterface.isInLiveTileMode() || mGestureState.getEndTarget() != RECENTS) { mInputConsumerProxy.destroy(); mTaskAnimationManager.setLiveTileCleanUpHandler(null); } @@ -1765,10 +1753,6 @@ public abstract class AbsSwipeUpHandler, * continued quick switch gesture, which cancels the previous handler but doesn't invalidate it. */ private void resetLauncherListeners() { - // Reset the callback for deferred activity launches - if (!ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mActivityInterface.setOnDeferredActivityLaunchCallback(null); - } mActivity.getRootView().setOnApplyWindowInsetsListener(null); mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener); @@ -1790,7 +1774,6 @@ public abstract class AbsSwipeUpHandler, mStateCallback.setStateOnUiThread(STATE_SCREENSHOT_CAPTURED); } else { final int runningTaskId = mGestureState.getRunningTaskId(); - final boolean refreshView = !ENABLE_QUICKSTEP_LIVE_TILE.get() /* refreshView */; boolean finishTransitionPosted = false; if (mRecentsAnimationController != null) { // Update the screenshot of the task @@ -1801,14 +1784,14 @@ public abstract class AbsSwipeUpHandler, mRecentsAnimationController.screenshotTask(runningTaskId); MAIN_EXECUTOR.execute(() -> { mTaskSnapshot = taskSnapshot; - if (!updateThumbnail(runningTaskId, refreshView)) { + if (!updateThumbnail(runningTaskId, false /* refreshView */)) { setScreenshotCapturedState(); } }); }); return; } - finishTransitionPosted = updateThumbnail(runningTaskId, refreshView); + finishTransitionPosted = updateThumbnail(runningTaskId, false /* refreshView */); } if (!finishTransitionPosted) { setScreenshotCapturedState(); @@ -1846,17 +1829,9 @@ public abstract class AbsSwipeUpHandler, } private void finishCurrentTransitionToRecents() { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); - if (mRecentsAnimationController != null) { - mRecentsAnimationController.detachNavigationBarFromApp(true); - } - } else if (!hasTargets() || mRecentsAnimationController == null) { - // If there are no targets or the animation not started, then there is nothing to finish - mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); - } else { - mRecentsAnimationController.finish(true /* toRecents */, - () -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED)); + mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED); + if (mRecentsAnimationController != null) { + mRecentsAnimationController.detachNavigationBarFromApp(true); } ActiveGestureLog.INSTANCE.addLog( /* event= */ "finishRecentsAnimation", @@ -1920,13 +1895,11 @@ public abstract class AbsSwipeUpHandler, } endLauncherTransitionController(); mRecentsView.onSwipeUpAnimationSuccess(); - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mTaskAnimationManager.setLiveTileCleanUpHandler(() -> { - mRecentsView.cleanupRemoteTargets(); - mInputConsumerProxy.destroy(); - }); - mTaskAnimationManager.enableLiveTileRestartListener(); - } + mTaskAnimationManager.setLiveTileCleanUpHandler(() -> { + mRecentsView.cleanupRemoteTargets(); + mInputConsumerProxy.destroy(); + }); + mTaskAnimationManager.enableLiveTileRestartListener(); SystemUiProxy.INSTANCE.get(mContext).onOverviewShown(false, TAG); doLogGesture(RECENTS, mRecentsView.getCurrentPageTaskView()); diff --git a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java index 466abbe62f..6e963f3315 100644 --- a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java @@ -15,7 +15,6 @@ */ package com.android.quickstep; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.util.NavigationMode.NO_BUTTON; import static com.android.quickstep.fallback.RecentsState.BACKGROUND_APP; import static com.android.quickstep.fallback.RecentsState.DEFAULT; @@ -120,8 +119,7 @@ public final class FallbackActivityInterface extends public RecentsView getVisibleRecentsView() { RecentsActivity activity = getCreatedActivity(); if (activity != null) { - if (activity.hasBeenResumed() - || (ENABLE_QUICKSTEP_LIVE_TILE.get() && isInLiveTileMode())) { + if (activity.hasBeenResumed() || isInLiveTileMode()) { return activity.getOverviewPanel(); } } diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java index 1127e2c8e7..1cb17cb815 100644 --- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java @@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.QUICK_SWITCH; import static com.android.launcher3.anim.AnimatorListeners.forEndCallback; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import android.animation.Animator; @@ -203,8 +202,7 @@ public final class LauncherActivityInterface extends private Launcher getVisibleLauncher() { Launcher launcher = getCreatedActivity(); return (launcher != null) && launcher.isStarted() - && ((ENABLE_QUICKSTEP_LIVE_TILE.get() && isInLiveTileMode()) - || launcher.hasBeenResumed()) ? launcher : null; + && (isInLiveTileMode() || launcher.hasBeenResumed()) ? launcher : null; } @Override @@ -213,7 +211,7 @@ public final class LauncherActivityInterface extends if (launcher == null) { return false; } - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isInLiveTileMode()) { + if (isInLiveTileMode()) { RecentsView recentsView = getVisibleRecentsView(); if (recentsView == null) { return false; diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index c879494c7d..4f5e216336 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -18,7 +18,6 @@ package com.android.quickstep; import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION; import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_DURATION; import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_PRE_DELAY; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.graphics.SysUiScrim.SYSUI_PROGRESS; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; import static com.android.quickstep.OverviewComponentObserver.startHomeIntentSafely; @@ -393,13 +392,9 @@ public final class RecentsActivity extends StatefulActivity { } public void startHome() { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - RecentsView recentsView = getOverviewPanel(); - recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true, - this::startHomeInternal)); - } else { - startHomeInternal(); - } + RecentsView recentsView = getOverviewPanel(); + recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true, + this::startHomeInternal)); } private void startHomeInternal() { diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index b9a1b0629f..7f1656500a 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -15,7 +15,6 @@ */ package com.android.quickstep; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_INITIALIZED; @@ -72,7 +71,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn return; } BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface(); - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityInterface.isInLiveTileMode() + if (activityInterface.isInLiveTileMode() && activityInterface.getCreatedActivity() != null) { RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); if (recentsView != null) { @@ -171,7 +170,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn .map(RemoteAnimationTargetCompat::unwrap) .toArray(RemoteAnimationTarget[]::new)); - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityInterface.isInLiveTileMode() + if (activityInterface.isInLiveTileMode() && activityInterface.getCreatedActivity() != null) { RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); @@ -204,7 +203,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn @Override public boolean onSwitchToScreenshot(Runnable onFinished) { - if (!ENABLE_QUICKSTEP_LIVE_TILE.get() || !activityInterface.isInLiveTileMode() + if (!activityInterface.isInLiveTileMode() || activityInterface.getCreatedActivity() == null) { // No need to switch since tile is already a screenshot. onFinished.run(); @@ -266,7 +265,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn return; } BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface(); - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityInterface.isInLiveTileMode() + if (activityInterface.isInLiveTileMode() && activityInterface.getCreatedActivity() != null) { RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel(); if (recentsView != null) { diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index e10cab60e0..d40f2ae017 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -18,7 +18,6 @@ package com.android.quickstep; import static android.view.Surface.ROTATION_0; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBNAIL; import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; @@ -174,14 +173,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride { * @param callback callback to run, after switching to screenshot */ public void endLiveTileMode(@NonNull Runnable callback) { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView(); - recentsView.switchToScreenshot( - () -> recentsView.finishRecentsAnimation(true /* toRecents */, - false /* shouldPip */, callback)); - } else { - callback.run(); - } + RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView(); + recentsView.switchToScreenshot( + () -> recentsView.finishRecentsAnimation(true /* toRecents */, + false /* shouldPip */, callback)); } /** diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index a96524e186..e7173f5c14 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -35,7 +35,6 @@ import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncest import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR; import static com.android.launcher3.anim.Interpolators.clampToProgress; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.statehandlers.DepthController.STATE_DEPTH; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING; @@ -637,7 +636,7 @@ public final class TaskViewUtils { }; } pa.add(launcherAnim); - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && recentsView.getRunningTaskIndex() != -1) { + if (recentsView.getRunningTaskIndex() != -1) { pa.addOnFrameCallback(recentsView::redrawLiveTile); } anim.play(pa.buildAnim()); diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 1999701f61..4476dcb3d8 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -20,7 +20,6 @@ import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.GestureState.DEFAULT_STATE; import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_DOWN; @@ -955,8 +954,7 @@ public class TouchInteractionService extends Service boolean launcherResumedThroughShellTransition = gestureState.getActivityInterface().isResumed() && !previousGestureState.isRecentsAnimationRunning(); - if (ENABLE_QUICKSTEP_LIVE_TILE.get() - && gestureState.getActivityInterface().isInLiveTileMode()) { + if (gestureState.getActivityInterface().isInLiveTileMode()) { return createOverviewInputConsumer( previousGestureState, gestureState, @@ -1044,8 +1042,7 @@ public class TouchInteractionService extends Service previousGestureState.isRunningAnimationToLauncher(); boolean forcingOverviewInputConsumer = ASSISTANT_GIVES_LAUNCHER_FOCUS.get() && forceOverviewInputConsumer; - boolean isInLiveTileMode = ENABLE_QUICKSTEP_LIVE_TILE.get() - && gestureState.getActivityInterface().isInLiveTileMode(); + boolean isInLiveTileMode = gestureState.getActivityInterface().isInLiveTileMode(); reasonString.append(SUBSTRING_PREFIX) .append(hasWindowFocus ? "activity has window focus" diff --git a/quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java b/quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java index eca61bb07d..db4927a0d1 100644 --- a/quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java +++ b/quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java @@ -15,8 +15,6 @@ */ package com.android.quickstep.fallback; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; - import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController; import com.android.quickstep.RecentsActivity; @@ -28,8 +26,7 @@ public class RecentsTaskController extends TaskViewTouchController, T extends StatefulAct @Override public void onHoverEvent(MotionEvent ev) { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - mActivity.dispatchGenericMotionEvent(ev); - } + mActivity.dispatchGenericMotionEvent(ev); } @Override public void onKeyEvent(KeyEvent ev) { - if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { - switch (ev.getKeyCode()) { - case KeyEvent.KEYCODE_VOLUME_DOWN: - case KeyEvent.KEYCODE_VOLUME_UP: - case KeyEvent.KEYCODE_VOLUME_MUTE: - MediaSessionManager mgr = mActivity.getSystemService(MediaSessionManager.class); - mgr.dispatchVolumeKeyEventAsSystemService(ev, - AudioManager.USE_DEFAULT_STREAM_TYPE); - break; - default: - break; - } - mActivity.dispatchKeyEvent(ev); + switch (ev.getKeyCode()) { + case KeyEvent.KEYCODE_VOLUME_DOWN: + case KeyEvent.KEYCODE_VOLUME_UP: + case KeyEvent.KEYCODE_VOLUME_MUTE: + MediaSessionManager mgr = mActivity.getSystemService(MediaSessionManager.class); + mgr.dispatchVolumeKeyEventAsSystemService(ev, + AudioManager.USE_DEFAULT_STREAM_TYPE); + break; + default: + break; } + mActivity.dispatchKeyEvent(ev); } } diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 1a026fc31d..4cdf557e3e 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -17,7 +17,6 @@ package com.android.quickstep.util; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.states.RotationHelper.deltaRotation; import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE; import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT; @@ -393,7 +392,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { .withCornerRadius(getCurrentCornerRadius()); // If mDrawsBelowRecents is unset, no reordering will be enforced. - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && mDrawsBelowRecents != null) { + if (mDrawsBelowRecents != null) { // In legacy transitions, the animation leashes remain in same hierarchy in the // TaskDisplayArea, so we don't want to bump the layer too high otherwise it will // conflict with layers that WM core positions (ie. the input consumers). For shell diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 2f91e16566..4fba8d6385 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -41,7 +41,6 @@ import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_75; import static com.android.launcher3.anim.Interpolators.clampToProgress; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_ACTIONS_SPLIT; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP; @@ -817,8 +816,7 @@ public abstract class RecentsView { - TaskViewSimulator simulator = remoteTargetHandle.getTaskViewSimulator(); - simulator.taskPrimaryTranslation.value = 0; - simulator.taskSecondaryTranslation.value = 0; - simulator.fullScreenProgress.value = 0; - simulator.recentsViewScale.value = 1; - }); - // Similar to setRunningTaskHidden below, reapply the state before runningTaskView is - // null. - if (!mRunningTaskShowScreenshot) { - setRunningTaskViewShowScreenshot(mRunningTaskShowScreenshot); - } + // resetTaskVisuals is called at the end of dismiss animation which could update + // primary and secondary translation of the live tile cut out. We will need to do so + // here accordingly. + runActionOnRemoteHandles(remoteTargetHandle -> { + TaskViewSimulator simulator = remoteTargetHandle.getTaskViewSimulator(); + simulator.taskPrimaryTranslation.value = 0; + simulator.taskSecondaryTranslation.value = 0; + simulator.fullScreenProgress.value = 0; + simulator.recentsViewScale.value = 1; + }); + // Similar to setRunningTaskHidden below, reapply the state before runningTaskView is + // null. + if (!mRunningTaskShowScreenshot) { + setRunningTaskViewShowScreenshot(mRunningTaskShowScreenshot); } if (mRunningTaskTileHidden) { setRunningTaskHidden(mRunningTaskTileHidden); @@ -2036,7 +2032,7 @@ public abstract class RecentsView { runActionOnRemoteHandles( remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator() @@ -3028,8 +3018,7 @@ public abstract class RecentsView { runActionOnRemoteHandles( remoteTargetHandle -> @@ -3123,8 +3112,7 @@ public abstract class RecentsView { runActionOnRemoteHandles( @@ -3247,8 +3235,7 @@ public abstract class RecentsView() { @Override public void accept(Boolean success) { - if (ENABLE_QUICKSTEP_LIVE_TILE.get() && mEnableDrawingLiveTile - && dismissedTaskView.isRunningTask() && success) { + if (mEnableDrawingLiveTile && dismissedTaskView.isRunningTask() && success) { finishRecentsAnimation(true /* toRecents */, false /* shouldPip */, () -> onEnd(success)); } else { @@ -3265,8 +3252,7 @@ public abstract class RecentsView removeTaskInternal(dismissedTaskViewId)); } else { @@ -3925,8 +3911,7 @@ public abstract class RecentsView remoteTargetHandle.getTaskViewSimulator() .taskPrimaryTranslation.value = totalTranslation); @@ -4150,10 +4135,8 @@ public abstract class RecentsView remoteTargetHandle.getTaskViewSimulator() - .addOverviewToAppAnim(mPendingAnimation, interpolator)); - mPendingAnimation.addOnFrameCallback(this::redrawLiveTile); - } + runActionOnRemoteHandles( + remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator() + .addOverviewToAppAnim(mPendingAnimation, interpolator)); + mPendingAnimation.addOnFrameCallback(this::redrawLiveTile); mPendingAnimation.addEndListener(isSuccess -> { if (isSuccess) { if (tv.getTaskIds()[1] != -1 && mRemoteTargetHandles != null) { @@ -4535,7 +4514,7 @@ public abstract class RecentsView Date: Tue, 20 Sep 2022 16:21:37 -0700 Subject: [PATCH 05/10] Add margin to SUW back button * navButtonsLayoutParams marginEnd was removed, and SUW was relying on that value to add margins to SUW back button, but was returning 0. Fixes: 242999939 Test: Visually observed in SUW test activity adb shell am start -n com.google.android.setupwizard/.SetupWizardTestActivity Change-Id: I5ffc421e9b731b0d9c7b7c48eab807d4419721b1 --- quickstep/res/values/dimens.xml | 2 +- .../android/launcher3/taskbar/NavbarButtonsViewController.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index c85e71cebc..fb78ef76f5 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -258,7 +258,7 @@ 16dp 8dp 44dp - 47dp + 48dp 24dp 35dp 24dp diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 1c345a6aa4..c27caf1dfe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -270,7 +270,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT // end-aligned, so start-align instead. FrameLayout.LayoutParams navButtonsLayoutParams = (FrameLayout.LayoutParams) mNavButtonContainer.getLayoutParams(); - navButtonsLayoutParams.setMarginStart(navButtonsLayoutParams.getMarginEnd()); + navButtonsLayoutParams.setMarginStart( + resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_margin)); navButtonsLayoutParams.setMarginEnd(0); navButtonsLayoutParams.gravity = Gravity.START; mNavButtonContainer.requestLayout(); From 7523b94105838d99f2ebaedea35c1e0c88b142a0 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 20 Sep 2022 16:46:27 -0700 Subject: [PATCH 06/10] Hide back button if IME shows in SUW Fixes: 230830643 Test: Visually see no back button when IME shows up on enter pin screen Change-Id: Icdde92d39962c3891a56bb07de5b16a22635729e --- .../launcher3/taskbar/NavbarButtonsViewController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index c27caf1dfe..725ce11dd0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -126,7 +126,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT public static final int ALPHA_INDEX_IMMERSIVE_MODE = 0; public static final int ALPHA_INDEX_KEYGUARD_OR_DISABLE = 1; - private static final int NUM_ALPHA_CHANNELS = 2; + public static final int ALPHA_INDEX_SUW = 2; + private static final int NUM_ALPHA_CHANNELS = 3; private final ArrayList mPropertyHolders = new ArrayList<>(); private final ArrayList mAllButtons = new ArrayList<>(); @@ -276,6 +277,11 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT navButtonsLayoutParams.gravity = Gravity.START; mNavButtonContainer.requestLayout(); + // Hide back button in SUW if keyboard is showing (IME draws its own back). + mPropertyHolders.add(new StatePropertyHolder( + mBackButtonAlpha.getProperty(ALPHA_INDEX_SUW), + flags -> (flags & FLAG_IME_VISIBLE) == 0)); + // TODO(b/210906568) Dark intensity is currently not propagated during setup, so set // it based on dark theme for now. int mode = resources.getConfiguration().uiMode From 517cafff1827c6ca3ab6d79436fc1a36f20b0fe9 Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Thu, 29 Sep 2022 19:08:02 +0100 Subject: [PATCH 07/10] Check for view measurement before animating Sometimes the view is there but it was not measured yet, and that was making the animation run with wrong icon position values. Fix: 233247401 Test: manual Change-Id: Ibcce24391e99b02ecdb492191c39b62d332abe4f --- .../src/com/android/quickstep/LauncherSwipeHandlerV2.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 36ca993f85..d1533f0347 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -84,7 +84,8 @@ public class LauncherSwipeHandlerV2 extends final View workspaceView = findWorkspaceView(launchCookies, mRecentsView.getRunningTaskView()); - boolean canUseWorkspaceView = workspaceView != null && workspaceView.isAttachedToWindow(); + boolean canUseWorkspaceView = workspaceView != null && workspaceView.isAttachedToWindow() + && workspaceView.getHeight() > 0; mActivity.getRootView().setForceHideBackArrow(true); if (!TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) { From 58bc28114298919af9ef168aed606e1ede279394 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 30 Sep 2022 18:14:33 +0100 Subject: [PATCH 08/10] Refactor TaskbarLauncherStateController to use a single AnimatedFLoat - Use a single iconAlignment animation - Introduced isInLauncher/goingToLauncher/FLAGS_LAUNCHER as combined FLAG_RESUMED|FLAG_RECENTS_ANIMATION_RUNNING - iconAlignment is now centralized in onStateChangeApplied with single source of truth Bug: 245320601 Test: Home<->Overview, Home<->App, App<->Overview, Home->Overview->App->Home, Home->App->Overview->Home, Overview->Home->App->Overview, Overview->App->Home->Overview, App->Overview->Home->App, App->Home->Overview->App Test: Go to AllApps, call KEYCODE_HOME, go to app and taskbar should be there Test: App->Overview->Select->Home->App Test: QuickSwitch -> App Test: Repeat above with taskbarStashed on/off Test: Repeat above with gesture and 3-button Change-Id: Ie51b602394c155aca060a84585eb0e677e23425c --- .../TaskbarLauncherStateController.java | 292 +++++++----------- .../com/android/quickstep/AnimatedFloat.java | 7 + 2 files changed, 113 insertions(+), 186 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 58c689bc36..de37b70632 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -50,7 +50,6 @@ import java.io.PrintWriter; import java.util.HashMap; import java.util.StringJoiner; import java.util.function.Consumer; -import java.util.function.Supplier; /** * Track LauncherState, RecentsAnimation, resumed state for task bar in one place here and animate @@ -65,15 +64,12 @@ import java.util.function.Supplier; public static final int FLAG_RECENTS_ANIMATION_RUNNING = 1 << 1; public static final int FLAG_TRANSITION_STATE_RUNNING = 1 << 2; + private static final int FLAGS_LAUNCHER = FLAG_RESUMED | FLAG_RECENTS_ANIMATION_RUNNING; /** Equivalent to an int with all 1s for binary operation purposes */ private static final int FLAGS_ALL = ~0; - private final AnimatedFloat mIconAlignmentForResumedState = - new AnimatedFloat(this::onIconAlignmentRatioChangedForAppAndHomeTransition); - private final AnimatedFloat mIconAlignmentForGestureState = - new AnimatedFloat(this::onIconAlignmentRatioChangedForAppAndHomeTransition); - private final AnimatedFloat mIconAlignmentForLauncherState = - new AnimatedFloat(this::onIconAlignmentRatioChangedForStateTransition); + private final AnimatedFloat mIconAlignment = + new AnimatedFloat(this::onIconAlignmentRatioChanged); private TaskbarControllers mControllers; private AnimatedFloat mTaskbarBackgroundAlpha; @@ -86,8 +82,7 @@ import java.util.function.Supplier; private @Nullable TaskBarRecentsAnimationListener mTaskBarRecentsAnimationListener; - private boolean mIsAnimatingToLauncherViaGesture; - private boolean mIsAnimatingToLauncherViaResume; + private boolean mIsAnimatingToLauncher; private boolean mShouldDelayLauncherStateAnim; @@ -148,8 +143,8 @@ import java.util.function.Supplier; mIconAlphaForHome = taskbarIconAlpha.getProperty(ALPHA_INDEX_HOME); mIconAlphaForHome.setConsumer(mIconAlphaForHomeConsumer); - mIconAlignmentForResumedState.finishAnimation(); - onIconAlignmentRatioChangedForAppAndHomeTransition(); + mIconAlignment.finishAnimation(); + onIconAlignmentRatioChanged(); mLauncher.getStateManager().addStateListener(mStateListener); @@ -165,9 +160,7 @@ import java.util.function.Supplier; public void onDestroy() { mCanSyncViews = false; - mIconAlignmentForResumedState.finishAnimation(); - mIconAlignmentForGestureState.finishAnimation(); - mIconAlignmentForLauncherState.finishAnimation(); + mIconAlignment.finishAnimation(); mIconAlphaForHome.setConsumer(null); mLauncher.getHotseat().setIconsAlpha(1f); @@ -187,6 +180,9 @@ import java.util.function.Supplier; TaskbarStashController stashController = mControllers.taskbarStashController; stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, toState.isTaskbarStashed(mLauncher)); + if (DEBUG) { + Log.d(TAG, "createAnimToLauncher - FLAG_IN_APP: " + false); + } stashController.updateStateForFlag(FLAG_IN_APP, false); updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, true); @@ -201,7 +197,7 @@ import java.util.function.Supplier; } public boolean isAnimatingToLauncher() { - return mIsAnimatingToLauncherViaResume || mIsAnimatingToLauncherViaGesture; + return mIsAnimatingToLauncher; } public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) { @@ -261,11 +257,29 @@ import java.util.function.Supplier; } private Animator onStateChangeApplied(int changedFlags, long duration, boolean start) { + boolean goingToLauncher = isInLauncher(); + final float toAlignment; + if (goingToLauncher) { + boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher); + boolean willStashVisually = isInStashedState + && mControllers.taskbarStashController.supportsVisualStashing(); + boolean isTaskbarAlignedWithHotseat = + mLauncherState.isTaskbarAlignedWithHotseat(mLauncher); + toAlignment = isTaskbarAlignedWithHotseat && !willStashVisually ? 1 : 0; + } else { + toAlignment = 0; + } + if (DEBUG) { + Log.d(TAG, "onStateChangeApplied - mState: " + getStateString(mState) + + ", changedFlags: " + getStateString(changedFlags) + + ", goingToLauncher: " + goingToLauncher + + ", mLauncherState: " + mLauncherState + + ", toAlignment: " + toAlignment); + } AnimatorSet animatorSet = new AnimatorSet(); // Add the state animation first to ensure FLAG_IN_STASHED_LAUNCHER_STATE is set and we can // determine whether goingToUnstashedLauncherStateChanged. - boolean wasGoingToUnstashedLauncherState = goingToUnstashedLauncherState(); if (hasAnyFlag(changedFlags, FLAG_TRANSITION_STATE_RUNNING)) { boolean committed = !hasAnyFlag(FLAG_TRANSITION_STATE_RUNNING); playStateTransitionAnim(animatorSet, duration, committed); @@ -276,95 +290,69 @@ import java.util.function.Supplier; applyState(0 /* duration */); } } - boolean goingToUnstashedLauncherStateChanged = wasGoingToUnstashedLauncherState - != goingToUnstashedLauncherState(); - boolean launcherStateChangedDuringAnimToResumeAlignment = - mIconAlignmentForResumedState.isAnimating() && goingToUnstashedLauncherStateChanged; - if (hasAnyFlag(changedFlags, FLAG_RESUMED) - || launcherStateChangedDuringAnimToResumeAlignment) { - boolean isResumed = isResumed(); - // If launcher is resumed, we show the icons when going to an unstashed launcher state - // or launcher state is not changed (e.g. in overview, launcher is paused and resumed). - float toAlignmentForResumedState = isResumed && (goingToUnstashedLauncherState() - || !goingToUnstashedLauncherStateChanged) ? 1 : 0; - // If we're already animating to the value, just leave it be instead of restarting it. - if (!mIconAlignmentForResumedState.isAnimatingToValue(toAlignmentForResumedState)) { - ObjectAnimator resumeAlignAnim = mIconAlignmentForResumedState - .animateToValue(toAlignmentForResumedState) - .setDuration(duration); - if (DEBUG) { - Log.d(TAG, "mIconAlignmentForResumedState - " - + mIconAlignmentForResumedState.value - + " -> " + toAlignmentForResumedState + ": " + duration); + if (hasAnyFlag(changedFlags, FLAGS_LAUNCHER)) { + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mIsAnimatingToLauncher = false; } - resumeAlignAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mIsAnimatingToLauncherViaResume = false; + @Override + public void onAnimationStart(Animator animation) { + mIsAnimatingToLauncher = goingToLauncher; + + TaskbarStashController stashController = + mControllers.taskbarStashController; + if (DEBUG) { + Log.d(TAG, "onAnimationStart - FLAG_IN_APP: " + !goingToLauncher); } - - @Override - public void onAnimationStart(Animator animation) { - mIsAnimatingToLauncherViaResume = isResumed; - - TaskbarStashController stashController = - mControllers.taskbarStashController; - stashController.updateStateForFlag(FLAG_IN_APP, !isResumed); - stashController.applyState(duration); - } - }); - animatorSet.play(resumeAlignAnim); - } - } - - - boolean launcherStateChangedDuringAnimToGestureAlignment = - mIconAlignmentForGestureState.isAnimating() && goingToUnstashedLauncherStateChanged; - if (hasAnyFlag(changedFlags, FLAG_RECENTS_ANIMATION_RUNNING) - || launcherStateChangedDuringAnimToGestureAlignment) { - boolean isRecentsAnimationRunning = isRecentsAnimationRunning(); - float toAlignmentForGestureState = isRecentsAnimationRunning - && goingToUnstashedLauncherState() ? 1 : 0; - // If we're already animating to the value, just leave it be instead of restarting it. - if (!mIconAlignmentForGestureState.isAnimatingToValue(toAlignmentForGestureState)) { - Animator gestureAlignAnim = mIconAlignmentForGestureState - .animateToValue(toAlignmentForGestureState); - if (isRecentsAnimationRunning) { - gestureAlignAnim.setDuration(duration); + stashController.updateStateForFlag(FLAG_IN_APP, !goingToLauncher); + stashController.applyState(duration); } - if (DEBUG) { - Log.d(TAG, "mIconAlignmentForGestureState - " - + mIconAlignmentForGestureState.value - + " -> " + toAlignmentForGestureState + ": " + duration); - } - gestureAlignAnim.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - mIsAnimatingToLauncherViaGesture = false; - } + }); - @Override - public void onAnimationStart(Animator animation) { - mIsAnimatingToLauncherViaGesture = isRecentsAnimationRunning(); - } - }); - animatorSet.play(gestureAlignAnim); - } - } - - if (hasAnyFlag(changedFlags, FLAG_RESUMED | FLAG_RECENTS_ANIMATION_RUNNING)) { - boolean goingToLauncher = hasAnyFlag(FLAG_RESUMED | FLAG_RECENTS_ANIMATION_RUNNING); if (goingToLauncher) { // Handle closing open popups when going home/overview AbstractFloatingView.closeAllOpenViews(mControllers.taskbarActivityContext); } - animatorSet.play(mTaskbarBackgroundAlpha.animateToValue(goingToLauncher ? 0 : 1) + } + + float backgroundAlpha = + goingToLauncher && mLauncherState.isTaskbarAlignedWithHotseat(mLauncher) + ? 0 : 1; + // Don't animate if background has reached desired value. + if (mTaskbarBackgroundAlpha.isAnimating() + || mTaskbarBackgroundAlpha.value != backgroundAlpha) { + mTaskbarBackgroundAlpha.cancelAnimation(); + if (DEBUG) { + Log.d(TAG, "onStateChangeApplied - taskbarBackgroundAlpha - " + + mTaskbarBackgroundAlpha.value + + " -> " + backgroundAlpha + ": " + duration); + } + animatorSet.play(mTaskbarBackgroundAlpha.animateToValue(backgroundAlpha) .setDuration(duration)); } + if (mIconAlignment.isAnimatingToValue(toAlignment) + || mIconAlignment.isSettledOnValue(toAlignment)) { + // Already at desired value, but make sure we run the callback at the end. + animatorSet.addListener(AnimatorListeners.forEndCallback( + this::onIconAlignmentRatioChanged)); + } else { + mIconAlignment.cancelAnimation(); + ObjectAnimator iconAlignAnim = mIconAlignment + .animateToValue(toAlignment) + .setDuration(duration); + if (DEBUG) { + Log.d(TAG, "onStateChangeApplied - iconAlignment - " + + mIconAlignment.value + + " -> " + toAlignment + ": " + duration); + } + animatorSet.play(iconAlignAnim); + } animatorSet.setInterpolator(EMPHASIZED); + if (start) { animatorSet.start(); } @@ -372,18 +360,13 @@ import java.util.function.Supplier; } /** Returns whether we're going to a state where taskbar icons should align with launcher. */ - private boolean goingToUnstashedLauncherState() { - return !mControllers.taskbarStashController.isInStashedLauncherState(); + public boolean goingToAlignedLauncherState() { + return mLauncherState.isTaskbarAlignedWithHotseat(mLauncher); } private void playStateTransitionAnim(AnimatorSet animatorSet, long duration, boolean committed) { boolean isInStashedState = mLauncherState.isTaskbarStashed(mLauncher); - boolean willStashVisually = - isInStashedState && mControllers.taskbarStashController.supportsVisualStashing(); - float toAlignment = - mLauncherState.isTaskbarAlignedWithHotseat(mLauncher) && !willStashVisually ? 1 : 0; - TaskbarStashController stashController = mControllers.taskbarStashController; stashController.updateStateForFlag(FLAG_IN_STASHED_LAUNCHER_STATE, isInStashedState); Animator stashAnimator = stashController.applyStateWithoutStart(duration); @@ -406,55 +389,23 @@ import java.util.function.Supplier; }); animatorSet.play(stashAnimator); } - if (mIconAlignmentForLauncherState.value == toAlignment) { - // Already at expected value, but make sure we run the callback at the end. - animatorSet.addListener(AnimatorListeners.forEndCallback( - this::onIconAlignmentRatioChangedForStateTransition)); - } - if (!mIconAlignmentForLauncherState.isAnimatingToValue(toAlignment)) { - // If we're already animating to the value, just leave it be instead of restarting it. - mIconAlignmentForLauncherState.finishAnimation(); - animatorSet.play(mIconAlignmentForLauncherState.animateToValue(toAlignment) - .setDuration(duration)); - if (DEBUG) { - Log.d(TAG, "mIconAlignmentForLauncherState - " - + mIconAlignmentForLauncherState.value - + " -> " + toAlignment + ": " + duration); - } - animatorSet.setInterpolator(EMPHASIZED); - } } - private boolean isResumed() { - return (mState & FLAG_RESUMED) != 0; + private boolean isInLauncher() { + return (mState & FLAGS_LAUNCHER) != 0; } - private boolean isRecentsAnimationRunning() { - return (mState & FLAG_RECENTS_ANIMATION_RUNNING) != 0; - } - - private void onIconAlignmentRatioChangedForStateTransition() { - if (!isResumed() && mTaskBarRecentsAnimationListener == null) { - return; - } - onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatioForLauncherState); - } - - private void onIconAlignmentRatioChangedForAppAndHomeTransition() { - onIconAlignmentRatioChanged(this::getCurrentIconAlignmentRatioBetweenAppAndHome); - } - - private void onIconAlignmentRatioChanged(Supplier alignmentSupplier) { - if (mControllers == null) { - return; - } - AnimatedFloat animatedFloat = alignmentSupplier.get(); + private void onIconAlignmentRatioChanged() { float currentValue = mIconAlphaForHome.getValue(); - boolean taskbarWillBeVisible = animatedFloat.value < 1; + boolean taskbarWillBeVisible = mIconAlignment.value < 1; boolean firstFrameVisChanged = (taskbarWillBeVisible && Float.compare(currentValue, 1) != 0) || (!taskbarWillBeVisible && Float.compare(currentValue, 0) != 0); - updateIconAlignment(animatedFloat.value, animatedFloat.getEndValue()); + mControllers.taskbarViewController.setLauncherIconAlignment( + mIconAlignment.value, mIconAlignment.getEndValue(), mLauncher.getDeviceProfile()); + mControllers.navbarButtonsViewController.updateTaskbarAlignment(mIconAlignment.value); + // Switch taskbar and hotseat in last frame + mIconAlphaForHome.setValue(taskbarWillBeVisible ? 1 : 0); // Sync the first frame where we swap taskbar and hotseat. if (firstFrameVisChanged && mCanSyncViews && !Utilities.IS_RUNNING_IN_TEST_HARNESS) { @@ -464,28 +415,6 @@ import java.util.function.Supplier; } } - private void updateIconAlignment(float alignment, Float endAlignment) { - mControllers.taskbarViewController.setLauncherIconAlignment( - alignment, endAlignment, mLauncher.getDeviceProfile()); - - // Switch taskbar and hotseat in last frame - setTaskbarViewVisible(alignment < 1); - mControllers.navbarButtonsViewController.updateTaskbarAlignment(alignment); - } - - private AnimatedFloat getCurrentIconAlignmentRatioBetweenAppAndHome() { - return mIconAlignmentForResumedState.value > mIconAlignmentForGestureState.value - ? mIconAlignmentForResumedState : mIconAlignmentForGestureState; - } - - private AnimatedFloat getCurrentIconAlignmentRatioForLauncherState() { - return mIconAlignmentForLauncherState; - } - - private void setTaskbarViewVisible(boolean isVisible) { - mIconAlphaForHome.setValue(isVisible ? 1 : 0); - } - private final class TaskBarRecentsAnimationListener implements RecentsAnimationCallbacks.RecentsAnimationListener { private final RecentsAnimationCallbacks mCallbacks; @@ -515,11 +444,11 @@ import java.util.function.Supplier; updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, false); updateStateForFlag(FLAG_RESUMED, launcherResumed); applyState(); - // Set this last because applyState() might also animate it. - mIconAlignmentForResumedState.cancelAnimation(); - mIconAlignmentForResumedState.updateValue(launcherResumed ? 1 : 0); TaskbarStashController controller = mControllers.taskbarStashController; + if (DEBUG) { + Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp); + } controller.updateStateForFlag(FLAG_IN_APP, finishedToApp); controller.applyState(); } @@ -527,29 +456,24 @@ import java.util.function.Supplier; private static String getStateString(int flags) { StringJoiner str = new StringJoiner("|"); - str.add((flags & FLAG_RESUMED) != 0 ? "FLAG_RESUMED" : ""); - str.add((flags & FLAG_RECENTS_ANIMATION_RUNNING) != 0 - ? "FLAG_RECENTS_ANIMATION_RUNNING" : ""); - str.add((flags & FLAG_TRANSITION_STATE_RUNNING) != 0 - ? "FLAG_TRANSITION_STATE_RUNNING" : ""); + if ((flags & FLAG_RESUMED) != 0) { + str.add("FLAG_RESUMED"); + } + if ((flags & FLAG_RECENTS_ANIMATION_RUNNING) != 0) { + str.add("FLAG_RECENTS_ANIMATION_RUNNING"); + } + if ((flags & FLAG_TRANSITION_STATE_RUNNING) != 0) { + str.add("FLAG_TRANSITION_STATE_RUNNING"); + } return str.toString(); } protected void dumpLogs(String prefix, PrintWriter pw) { pw.println(prefix + "TaskbarLauncherStateController:"); - pw.println(String.format( - "%s\tmIconAlignmentForResumedState=%.2f", + "%s\tmIconAlignment=%.2f", prefix, - mIconAlignmentForResumedState.value)); - pw.println(String.format( - "%s\tmIconAlignmentForGestureState=%.2f", - prefix, - mIconAlignmentForGestureState.value)); - pw.println(String.format( - "%s\tmIconAlignmentForLauncherState=%.2f", - prefix, - mIconAlignmentForLauncherState.value)); + mIconAlignment.value)); pw.println(String.format( "%s\tmTaskbarBackgroundAlpha=%.2f", prefix, mTaskbarBackgroundAlpha.value)); pw.println(String.format( @@ -558,13 +482,9 @@ import java.util.function.Supplier; pw.println(String.format("%s\tmState=%s", prefix, getStateString(mState))); pw.println(String.format("%s\tmLauncherState=%s", prefix, mLauncherState)); pw.println(String.format( - "%s\tmIsAnimatingToLauncherViaGesture=%b", + "%s\tmIsAnimatingToLauncher=%b", prefix, - mIsAnimatingToLauncherViaGesture)); - pw.println(String.format( - "%s\tmIsAnimatingToLauncherViaResume=%b", - prefix, - mIsAnimatingToLauncherViaResume)); + mIsAnimatingToLauncher)); pw.println(String.format( "%s\tmShouldDelayLauncherStateAnim=%b", prefix, mShouldDelayLauncherStateAnim)); } diff --git a/quickstep/src/com/android/quickstep/AnimatedFloat.java b/quickstep/src/com/android/quickstep/AnimatedFloat.java index a1665530a3..b06b894c6e 100644 --- a/quickstep/src/com/android/quickstep/AnimatedFloat.java +++ b/quickstep/src/com/android/quickstep/AnimatedFloat.java @@ -134,6 +134,13 @@ public class AnimatedFloat { return isAnimating() && mEndValue != null && mEndValue == endValue; } + /** + * Returns whether we are currently not animating, and the animation's value matches the given. + */ + public boolean isSettledOnValue(float endValue) { + return !isAnimating() && value == endValue; + } + /** * Returns the value we are animating to, or {@code null} if we are not currently animating. */ From 86065b81e00995f8699775bbf4904747fcc255d9 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Mon, 3 Oct 2022 12:21:41 -0700 Subject: [PATCH 09/10] Fix animation slowdown when splitting from All Apps This patch fixes a tablet bug related to splitting from All Apps. Splitting from AllApps was playing a very slow animation. The bug occurred because there was no case set in QuickstepAtomicAnimationFactory for animating from the ALL_APPS state. Fixed by setting the appropriate case in QuickstepAtomicAnimationFactory. Fixes: 247053528 Test: Manual Change-Id: I7391dc7049a6ff5a7f8c7e1ae8b69e29899248fa --- .../uioverrides/states/QuickstepAtomicAnimationFactory.java | 3 ++- quickstep/src/com/android/quickstep/views/RecentsView.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index bcd722f4e3..da07edf9bf 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -197,7 +197,8 @@ public class QuickstepAtomicAnimationFactory extends config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR, timings.getActionsFadeStartOffset(), timings.getActionsFadeEndOffset())); - } else if (fromState == NORMAL && toState == OVERVIEW_SPLIT_SELECT) { + } else if ((fromState == NORMAL || fromState == ALL_APPS) + && toState == OVERVIEW_SPLIT_SELECT) { // Splitting from Home is currently only available on tablets SplitAnimationTimings timings = SplitAnimationTimings.TABLET_HOME_TO_SPLIT; config.setInterpolator(ANIM_SCRIM_FADE, clampToProgress(LINEAR, diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 2f91e16566..1f601df162 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4156,6 +4156,9 @@ public abstract class RecentsView Date: Mon, 3 Oct 2022 22:22:08 +0000 Subject: [PATCH 10/10] Updating launcher for pip interface cleanup Bug: 238217847 Test: atest WMShellUnitTests Change-Id: I375e67eeb07ffe50bf15eafb65c1e9d215118c73 --- .../android/quickstep/AbsSwipeUpHandler.java | 4 +-- .../com/android/quickstep/SystemUiProxy.java | 35 +++++++++---------- .../android/quickstep/views/RecentsView.java | 6 ++-- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index f3630c187b..5837525506 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1010,8 +1010,8 @@ public abstract class AbsSwipeUpHandler, switch (endTarget) { case HOME: mStateCallback.setState(STATE_SCALED_CONTROLLER_HOME | STATE_CAPTURE_SCREENSHOT); - // Notify swipe-to-home (recents animation) is finished - SystemUiProxy.INSTANCE.get(mContext).notifySwipeToHomeFinished(); + // Notify the SysUI to use fade-in animation when entering PiP + SystemUiProxy.INSTANCE.get(mContext).setPipAnimationTypeToAlpha(); break; case RECENTS: mStateCallback.setState(STATE_SCALED_CONTROLLER_RECENTS | STATE_CAPTURE_SCREENSHOT diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 3b2df315b1..35d73946f3 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -187,7 +187,7 @@ public class SystemUiProxy implements ISystemUiProxy { linkToDeath(); // re-attach the listeners once missing due to setProxy has not been initialized yet. if (mPipAnimationListener != null && mPip != null) { - setPinnedStackAnimationListener(mPipAnimationListener); + setPipAnimationListener(mPipAnimationListener); } if (mSplitScreenListener != null && mSplitScreen != null) { registerSplitScreenListener(mSplitScreenListener); @@ -357,20 +357,6 @@ public class SystemUiProxy implements ISystemUiProxy { } } - /** - * Notifies that swipe-to-home action is finished. - */ - @Override - public void notifySwipeToHomeFinished() { - if (mSystemUiProxy != null) { - try { - mSystemUiProxy.notifySwipeToHomeFinished(); - } catch (RemoteException e) { - Log.w(TAG, "Failed call notifySwipeToHomeFinished", e); - } - } - } - @Override public void notifyPrioritizedRotation(int rotation) { if (mSystemUiProxy != null) { @@ -475,12 +461,12 @@ public class SystemUiProxy implements ISystemUiProxy { } /** - * Sets listener to get pinned stack animation callbacks. + * Sets listener to get pip animation callbacks. */ - public void setPinnedStackAnimationListener(IPipAnimationListener listener) { + public void setPipAnimationListener(IPipAnimationListener listener) { if (mPip != null) { try { - mPip.setPinnedStackAnimationListener(listener); + mPip.setPipAnimationListener(listener); } catch (RemoteException e) { Log.w(TAG, "Failed call setPinnedStackAnimationListener", e); } @@ -522,6 +508,19 @@ public class SystemUiProxy implements ISystemUiProxy { } } + /** + * Sets the next pip animation type to be the alpha animation. + */ + public void setPipAnimationTypeToAlpha() { + if (mPip != null) { + try { + mPip.setPipAnimationTypeToAlpha(); + } catch (RemoteException e) { + Log.w(TAG, "Failed call setPipAnimationTypeToAlpha", e); + } + } + } + // // Splitscreen // diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 2f91e16566..3a118210ad 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -941,7 +941,7 @@ public abstract class RecentsView