From cc31ba5360d4a25b80bb6f3f95b280e53c41723c Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 20 Dec 2022 13:52:38 +0000 Subject: [PATCH] Do not animate moving to rest state on CHANGE_ACTIVE_SCREEN. Fix: 259380717 Test: manual Change-Id: Icec103b26603290c7998977fa9c4d89132620a9d --- .../android/launcher3/uioverrides/QuickstepLauncher.java | 7 +++++-- src/com/android/launcher3/statemanager/StateManager.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index 13d0be507a..b513f94f2e 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -96,7 +96,6 @@ import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.model.BgDataModel.FixedContainerItems; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.proxy.ProxyActivityStarter; import com.android.launcher3.proxy.StartActivityParams; @@ -920,7 +919,11 @@ public class QuickstepLauncher extends Launcher { // When changing screens, force moving to rest state similar to StatefulActivity.onStop, as // StatefulActivity isn't called consistently. if ((flags & CHANGE_ACTIVE_SCREEN) != 0) { - getStateManager().moveToRestState(); + // Do not animate moving to rest state, as it can clash with Launcher#onIdpChanged + // where reapplyUi calls StateManager's reapplyState during the state change animation, + // and cancel the state change unexpectedly. The screen will be off during screen + // transition, hiding the unanimated transition. + getStateManager().moveToRestState(/* isAnimated = */false); } if ((flags & CHANGE_NAVIGATION_MODE) != 0) { diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index 86277a790e..ad1e7f02b5 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -342,7 +342,6 @@ public class StateManager> { public void onAnimationSuccess(Animator animator) { onStateTransitionEnd(state); } - }; } @@ -377,12 +376,16 @@ public class StateManager> { } public void moveToRestState() { + moveToRestState(shouldAnimateStateChange()); + } + + public void moveToRestState(boolean isAnimated) { if (mConfig.currentAnimation != null && mConfig.userControlled) { // The user is doing something. Lets not mess it up return; } if (mState.shouldDisableRestore()) { - goToState(getRestState()); + goToState(getRestState(), isAnimated); // Reset history mLastStableState = mBaseState; }