Prevent windows from dimming if host is going away
The exit animation has already started, and if someone keeps dimming,
then it would
- create a new surface (because exit animation removes the dim state)
- see that we need to interrupt the dim, since host is leaving
- destroy the surface
- repeat
Bug: 401449608
Fix: 403209573
Test: DimmerTests
Flag: EXEMPT minor change
Change-Id: I6bb6c540aba3d473e1587b4a7e0bef1883c335cd
diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java
index 2798e84..ab87459 100644
--- a/services/core/java/com/android/server/wm/Dimmer.java
+++ b/services/core/java/com/android/server/wm/Dimmer.java
@@ -218,6 +218,11 @@
*/
protected void adjustAppearance(@NonNull WindowState dimmingContainer,
float alpha, int blurRadius) {
+ if (!mHost.isVisibleRequested()) {
+ // If the host is already going away, there is no point in keeping dimming
+ return;
+ }
+
if (mDimState != null || (alpha != 0 || blurRadius != 0)) {
final DimState d = obtainDimState(dimmingContainer);
d.prepareLookChange(alpha, blurRadius);