From b8fe6eb7cae8e6c3329dcdc5a41f0880957b5d3c Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 22 Jun 2021 21:51:27 +0800 Subject: [PATCH] Ignore wallpaper enter animation The alpha animation is almost unnoticeable and rare to execute (e.g. orientation change across visibility change). It would be more efficient, consistent and less error prone to skip the animation which user won't aware it. Though the original issue is about the surface position of wallpaper animation leash: 1. WallpaperController#updateWallpaperOffset may calculate wrong offset by using frames in different rotation. This can be fixed by early return if !isVisible(). 2. Even if the wallpaper offset is correct, the surface position calculated by wallpaper scale will be ignored in WindowState#updateSurfacePosition because the window is animating (mSurfaceAnimator.hasLeash()). This can be fixed by relaxing the condition if wallpaper scale is not 1. But as the reason described above, the simple bypass has more benefit. Bug: 191441606 Test: Launch landscape app from portriat home with traditional rotation animation (e.g. when IME is vieible), and then return to home with fixed (seamless) rotation. The wallpaper should not have extra offset temporarily. Change-Id: Iaa76ea38c27dffb96b2c1d39a3a7a9cd8fe246c4 --- .../core/java/com/android/server/wm/WindowStateAnimator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 9a6e4448966d9..4471f6c91190d 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -683,8 +683,9 @@ class WindowStateAnimator { } // We don't apply animation for application main window here since this window type - // should be controlled by AppWindowToken in general. - if (mAttrType != TYPE_BASE_APPLICATION) { + // should be controlled by ActivityRecord in general. Wallpaper is also excluded because + // WallpaperController should handle it. + if (mAttrType != TYPE_BASE_APPLICATION && !mIsWallpaper) { applyAnimationLocked(transit, true); }