From 14ff3d2a1c4e4e234c6b4639d401d70f29c63117 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Mon, 19 May 2025 15:07:16 +0800 Subject: [SP 2025-09-01] Use consistent animation when forcibly hiding non system overlay There are several non system overlay window types. When hiding the windows with animation, their specified exit animations may be used. This avoids ugly jump cut and inconsistent duration when these windows are requested to be hidden. Bug: 408215749 Flag: EXEMPT bugfix Test: Show multiple windows with different overlay types and window animations by non system apps. Launch Settings and check the windows are fading out in a short time. (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dd71ab6ba3950978bd28dc38fecec236cf1153ea) Merged-In: Ie7bb2663892d608715aa077e2170eae4c03a4e36 Change-Id: Ie7bb2663892d608715aa077e2170eae4c03a4e36 --- services/core/java/com/android/server/wm/WindowState.java | 4 ++++ services/core/java/com/android/server/wm/WindowStateAnimator.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 05b81d4bfb67..d5c1721183fe 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -2997,6 +2997,10 @@ class WindowState extends WindowContainer implements WindowManagerP return true; } + boolean isForceHiddenNonSystemOverlayWindow() { + return mForceHideNonSystemOverlayWindow; + } + void setForceHideNonSystemOverlayWindowIfNeeded(boolean forceHide) { final int baseType = getBaseType(); if (mSession.mCanAddInternalSystemWindow diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 0d434f51e082..3fd0e2e30f62 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -62,6 +62,7 @@ import android.view.Surface.OutOfResourcesException; import android.view.SurfaceControl; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; +import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationUtils; @@ -545,6 +546,10 @@ class WindowStateAnimator { a = AnimationUtils.loadAnimation(mContext, anim); Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); } + } else if (!isEntrance && mWin.isForceHiddenNonSystemOverlayWindow()) { + a = new AlphaAnimation(1f, 0f); + a.setDuration(mContext.getResources().getInteger( + com.android.internal.R.integer.config_shortAnimTime)); } else { switch (transit) { case WindowManagerPolicy.TRANSIT_ENTER: -- cgit v1.2.3-59-g8ed1b