diff options
| author | 2021-06-30 21:17:52 +0800 | |
|---|---|---|
| committer | 2021-06-30 22:46:08 +0800 | |
| commit | 9768747be9bc2ff826eb60e724ad603df9d8b5f0 (patch) | |
| tree | 80578ec92bb6c25602c530b5900521469adfd041 | |
| parent | fc3e38324fd63b240e7f894279403e78a4496718 (diff) | |
Fix switch task flicker from reveal animation.
While prepareing reveal animation in core, the initial position will be
set to 0,0 even when the window is shift by other insets.
- Only splash screen need to apply reveal animation, so ignore the
animation when removing task snapshot starting window.
- Set the initial position after the animation leash just created.
Fixes: 192333159
Test: Rotate device to landscape then use task switch to launch apps,
testing for both hot and cold launch.
Change-Id: I82d78822e0a44350a49ac4cee105f10790014982
5 files changed, 18 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 0ad8782cea4f..4dd8221167a9 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2252,6 +2252,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } final WindowManagerPolicy.StartingSurface surface; + final StartingData startingData = mStartingData; if (mStartingData != null) { surface = mStartingSurface; mStartingData = null; @@ -2278,7 +2279,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final Runnable removeSurface = () -> { ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Removing startingView=%s", surface); try { - surface.remove(prepareAnimation); + surface.remove(prepareAnimation && startingData.needRevealAnimation()); } catch (Exception e) { Slog.w(TAG_WM, "Exception when removing starting window", e); } diff --git a/services/core/java/com/android/server/wm/SnapshotStartingData.java b/services/core/java/com/android/server/wm/SnapshotStartingData.java index 66ae0eb9b48f..b6cf91a584a9 100644 --- a/services/core/java/com/android/server/wm/SnapshotStartingData.java +++ b/services/core/java/com/android/server/wm/SnapshotStartingData.java @@ -41,6 +41,11 @@ class SnapshotStartingData extends StartingData { } @Override + boolean needRevealAnimation() { + return false; + } + + @Override boolean hasImeSurface() { return mSnapshot.hasImeSurface(); } diff --git a/services/core/java/com/android/server/wm/SplashScreenStartingData.java b/services/core/java/com/android/server/wm/SplashScreenStartingData.java index 185a317271ff..c659c05dceda 100644 --- a/services/core/java/com/android/server/wm/SplashScreenStartingData.java +++ b/services/core/java/com/android/server/wm/SplashScreenStartingData.java @@ -58,4 +58,9 @@ class SplashScreenStartingData extends StartingData { mLogo, mWindowFlags, mMergedOverrideConfiguration, activity.getDisplayContent().getDisplayId()); } + + @Override + boolean needRevealAnimation() { + return true; + } } diff --git a/services/core/java/com/android/server/wm/StartingData.java b/services/core/java/com/android/server/wm/StartingData.java index 3f9c93bbcfbe..c671e3835abc 100644 --- a/services/core/java/com/android/server/wm/StartingData.java +++ b/services/core/java/com/android/server/wm/StartingData.java @@ -47,6 +47,11 @@ public abstract class StartingData { */ abstract StartingSurface createStartingSurface(ActivityRecord activity); + /** + * @return Whether to apply reveal animation when exiting the starting window. + */ + abstract boolean needRevealAnimation(); + /** @see android.window.TaskSnapshot#hasImeSurface() */ boolean hasImeSurface() { return false; diff --git a/services/core/java/com/android/server/wm/TaskOrganizerController.java b/services/core/java/com/android/server/wm/TaskOrganizerController.java index 3a2ca80f2e12..abcb34c2e8d9 100644 --- a/services/core/java/com/android/server/wm/TaskOrganizerController.java +++ b/services/core/java/com/android/server/wm/TaskOrganizerController.java @@ -197,6 +197,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { ANIMATION_TYPE_STARTING_REVEAL); windowAnimationLeash = adaptor.mAnimationLeash; mainFrame = mainWindow.getRelativeFrame(); + t.setPosition(windowAnimationLeash, mainFrame.left, mainFrame.top); } } } |