Loading core/java/android/window/flags/windowing_frontend.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,17 @@ flag { } } flag { name: "update_dims_when_window_shown" namespace: "windowing_frontend" description: "Check if we need to update dim layers when a new window draws the first frame" bug: "327332488" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "release_snapshot_aggressively" namespace: "windowing_frontend" Loading services/core/java/com/android/server/wm/DimmerAnimationHelper.java +15 −6 Original line number Diff line number Diff line Loading @@ -109,8 +109,10 @@ public class DimmerAnimationHelper { // Sets the requested layer to reparent the dim to without applying it immediately void setRequestedGeometryParent(WindowContainer<?> geometryParent) { if (geometryParent != null) { mRequestedProperties.mGeometryParent = geometryParent; } } // Sets a requested change without applying it immediately void setRequestedAppearance(float alpha, int blurRadius) { Loading Loading @@ -139,9 +141,14 @@ public class DimmerAnimationHelper { dim.remove(t); return; } if (!dim.mDimSurface.isValid()) { Log.e(TAG, "Dimming surface " + dim.mDimSurface + " has already been released!" + " Can not apply changes."); return; } dim.ensureVisible(t); reparent(dim.mDimSurface, reparent(dim, startProperties.mGeometryParent != mRequestedProperties.mGeometryParent ? mRequestedProperties.mGeometryParent.getSurfaceControl() : null, mRequestedProperties.mDimmingContainer != startProperties.mDimmingContainer Loading @@ -159,7 +166,7 @@ public class DimmerAnimationHelper { "%s skipping animation and directly setting alpha=%f, blur=%d", dim, startProperties.mAlpha, mRequestedProperties.mBlurRadius); setCurrentAlphaBlur(dim.mDimSurface, t); setCurrentAlphaBlur(dim, t); dim.mSkipAnimation = false; } else { startAnimation(t, dim, startProperties, mRequestedProperties); Loading @@ -186,7 +193,7 @@ public class DimmerAnimationHelper { synchronized (dim.mHostContainer.mWmService.mGlobalLock) { SurfaceControl.Transaction finishTransaction = dim.mHostContainer.getSyncTransaction(); setCurrentAlphaBlur(dim.mDimSurface, finishTransaction); setCurrentAlphaBlur(dim, finishTransaction); if (targetAlpha == 0f && !dim.isDimming()) { dim.remove(finishTransaction); } Loading Loading @@ -229,10 +236,11 @@ public class DimmerAnimationHelper { /** * Change the geometry and relative parent of this dim layer */ static void reparent(@NonNull SurfaceControl dimLayer, void reparent(@NonNull Dimmer.DimState dim, @Nullable SurfaceControl newGeometryParent, @Nullable SurfaceControl newRelativeParent, @NonNull SurfaceControl.Transaction t) { final SurfaceControl dimLayer = dim.mDimSurface; try { if (newGeometryParent != null) { t.reparent(dimLayer, newGeometryParent); Loading @@ -245,7 +253,8 @@ public class DimmerAnimationHelper { } } void setCurrentAlphaBlur(@NonNull SurfaceControl sc, @NonNull SurfaceControl.Transaction t) { void setCurrentAlphaBlur(@NonNull Dimmer.DimState dim, @NonNull SurfaceControl.Transaction t) { final SurfaceControl sc = dim.mDimSurface; try { t.setAlpha(sc, mCurrentProperties.mAlpha); t.setBackgroundBlurRadius(sc, mCurrentProperties.mBlurRadius); Loading services/core/java/com/android/server/wm/WindowContainer.java +9 −0 Original line number Diff line number Diff line Loading @@ -2874,6 +2874,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } } /** * Go through the hierarchy to allow windows to request a dim if needed */ void adjustDims() { for (int i = 0; i < mChildren.size(); i++) { mChildren.get(i).adjustDims(); } } /** * Trigger a call to prepareSurfaces from the animation thread, such that pending transactions * will be applied. Loading services/core/java/com/android/server/wm/WindowState.java +17 −0 Original line number Diff line number Diff line Loading @@ -4409,6 +4409,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP for (int i = mChildren.size() - 1; i >= 0; i--) { committed |= mChildren.get(i).commitFinishDrawing(t); } // When a new activity is showing, update dim in this transaction if (Flags.updateDimsWhenWindowShown()) { final Dimmer dimmer = getDimController(); final WindowContainer<?> dimParent = getDimParent(); if (dimmer != null && dimParent != null) { dimParent.adjustDims(); dimmer.updateDims(t); } } // In case commitFinishDrawingLocked starts a window level animation, make sure the surface // operation (reparent to leash) is synced with the visibility by transition. if (getAnimationLeash() != null) { Loading Loading @@ -5304,6 +5315,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP super.prepareSurfaces(); } @Override void adjustDims() { applyDims(); super.adjustDims(); } void updateSurfacePositionIfNeeded() { if (mWindowFrames.mRelFrame.top == mWindowFrames.mLastRelFrame.top && mWindowFrames.mRelFrame.left == mWindowFrames.mLastRelFrame.left) { Loading Loading
core/java/android/window/flags/windowing_frontend.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,17 @@ flag { } } flag { name: "update_dims_when_window_shown" namespace: "windowing_frontend" description: "Check if we need to update dim layers when a new window draws the first frame" bug: "327332488" is_fixed_read_only: true metadata { purpose: PURPOSE_BUGFIX } } flag { name: "release_snapshot_aggressively" namespace: "windowing_frontend" Loading
services/core/java/com/android/server/wm/DimmerAnimationHelper.java +15 −6 Original line number Diff line number Diff line Loading @@ -109,8 +109,10 @@ public class DimmerAnimationHelper { // Sets the requested layer to reparent the dim to without applying it immediately void setRequestedGeometryParent(WindowContainer<?> geometryParent) { if (geometryParent != null) { mRequestedProperties.mGeometryParent = geometryParent; } } // Sets a requested change without applying it immediately void setRequestedAppearance(float alpha, int blurRadius) { Loading Loading @@ -139,9 +141,14 @@ public class DimmerAnimationHelper { dim.remove(t); return; } if (!dim.mDimSurface.isValid()) { Log.e(TAG, "Dimming surface " + dim.mDimSurface + " has already been released!" + " Can not apply changes."); return; } dim.ensureVisible(t); reparent(dim.mDimSurface, reparent(dim, startProperties.mGeometryParent != mRequestedProperties.mGeometryParent ? mRequestedProperties.mGeometryParent.getSurfaceControl() : null, mRequestedProperties.mDimmingContainer != startProperties.mDimmingContainer Loading @@ -159,7 +166,7 @@ public class DimmerAnimationHelper { "%s skipping animation and directly setting alpha=%f, blur=%d", dim, startProperties.mAlpha, mRequestedProperties.mBlurRadius); setCurrentAlphaBlur(dim.mDimSurface, t); setCurrentAlphaBlur(dim, t); dim.mSkipAnimation = false; } else { startAnimation(t, dim, startProperties, mRequestedProperties); Loading @@ -186,7 +193,7 @@ public class DimmerAnimationHelper { synchronized (dim.mHostContainer.mWmService.mGlobalLock) { SurfaceControl.Transaction finishTransaction = dim.mHostContainer.getSyncTransaction(); setCurrentAlphaBlur(dim.mDimSurface, finishTransaction); setCurrentAlphaBlur(dim, finishTransaction); if (targetAlpha == 0f && !dim.isDimming()) { dim.remove(finishTransaction); } Loading Loading @@ -229,10 +236,11 @@ public class DimmerAnimationHelper { /** * Change the geometry and relative parent of this dim layer */ static void reparent(@NonNull SurfaceControl dimLayer, void reparent(@NonNull Dimmer.DimState dim, @Nullable SurfaceControl newGeometryParent, @Nullable SurfaceControl newRelativeParent, @NonNull SurfaceControl.Transaction t) { final SurfaceControl dimLayer = dim.mDimSurface; try { if (newGeometryParent != null) { t.reparent(dimLayer, newGeometryParent); Loading @@ -245,7 +253,8 @@ public class DimmerAnimationHelper { } } void setCurrentAlphaBlur(@NonNull SurfaceControl sc, @NonNull SurfaceControl.Transaction t) { void setCurrentAlphaBlur(@NonNull Dimmer.DimState dim, @NonNull SurfaceControl.Transaction t) { final SurfaceControl sc = dim.mDimSurface; try { t.setAlpha(sc, mCurrentProperties.mAlpha); t.setBackgroundBlurRadius(sc, mCurrentProperties.mBlurRadius); Loading
services/core/java/com/android/server/wm/WindowContainer.java +9 −0 Original line number Diff line number Diff line Loading @@ -2874,6 +2874,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } } /** * Go through the hierarchy to allow windows to request a dim if needed */ void adjustDims() { for (int i = 0; i < mChildren.size(); i++) { mChildren.get(i).adjustDims(); } } /** * Trigger a call to prepareSurfaces from the animation thread, such that pending transactions * will be applied. Loading
services/core/java/com/android/server/wm/WindowState.java +17 −0 Original line number Diff line number Diff line Loading @@ -4409,6 +4409,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP for (int i = mChildren.size() - 1; i >= 0; i--) { committed |= mChildren.get(i).commitFinishDrawing(t); } // When a new activity is showing, update dim in this transaction if (Flags.updateDimsWhenWindowShown()) { final Dimmer dimmer = getDimController(); final WindowContainer<?> dimParent = getDimParent(); if (dimmer != null && dimParent != null) { dimParent.adjustDims(); dimmer.updateDims(t); } } // In case commitFinishDrawingLocked starts a window level animation, make sure the surface // operation (reparent to leash) is synced with the visibility by transition. if (getAnimationLeash() != null) { Loading Loading @@ -5304,6 +5315,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP super.prepareSurfaces(); } @Override void adjustDims() { applyDims(); super.adjustDims(); } void updateSurfacePositionIfNeeded() { if (mWindowFrames.mRelFrame.top == mWindowFrames.mLastRelFrame.top && mWindowFrames.mRelFrame.left == mWindowFrames.mLastRelFrame.left) { Loading