Loading services/core/java/com/android/server/wm/Dimmer.java +11 −8 Original line number Diff line number Diff line Loading @@ -204,7 +204,7 @@ class Dimmer { } private void dim(SurfaceControl.Transaction t, WindowContainer container, int relativeLayer, float alpha) { float alpha, int blurRadius) { final DimState d = getDimState(container); if (d == null) { Loading @@ -220,6 +220,7 @@ class Dimmer { t.setLayer(d.mDimLayer, Integer.MAX_VALUE); } t.setAlpha(d.mDimLayer, alpha); t.setBackgroundBlurRadius(d.mDimLayer, blurRadius); d.mDimming = true; } Loading Loading @@ -247,7 +248,7 @@ class Dimmer { * @param alpha The alpha at which to Dim. */ void dimAbove(SurfaceControl.Transaction t, float alpha) { dim(t, null, 1, alpha); dim(t, null, 1, alpha, 0); } /** Loading @@ -260,7 +261,7 @@ class Dimmer { * @param alpha The alpha at which to Dim. */ void dimAbove(SurfaceControl.Transaction t, WindowContainer container, float alpha) { dim(t, container, 1, alpha); dim(t, container, 1, alpha, 0); } /** Loading @@ -269,10 +270,12 @@ class Dimmer { * @param t A transaction in which to apply the Dim. * @param container The container which to dim below. Should be a child of our host. * @param alpha The alpha at which to Dim. * @param blurRadius The amount of blur added to the Dim. */ void dimBelow(SurfaceControl.Transaction t, WindowContainer container, float alpha) { dim(t, container, -1, alpha); void dimBelow(SurfaceControl.Transaction t, WindowContainer container, float alpha, int blurRadius) { dim(t, container, -1, alpha, blurRadius); } /** Loading services/core/java/com/android/server/wm/WindowState.java +7 −4 Original line number Diff line number Diff line Loading @@ -5229,14 +5229,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (!mAnimatingExit && mAppDied) { mIsDimming = true; getDimmer().dimAbove(getSyncTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW); } else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0 && isVisibleNow() && !mHidden) { // Only show a dim behind when the following is satisfied: // 1. The window has the flag FLAG_DIM_BEHIND } else if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || mAttrs.backgroundBlurRadius != 0) && isVisibleNow() && !mHidden) { // Only show the Dimmer when the following is satisfied: // 1. The window has the flag FLAG_DIM_BEHIND or background blur is requested // 2. The WindowToken is not hidden so dims aren't shown when the window is exiting. // 3. The WS is considered visible according to the isVisible() method // 4. The WS is not hidden. mIsDimming = true; getDimmer().dimBelow(getSyncTransaction(), this, mAttrs.dimAmount); final float dimAmount = (mAttrs.flags & FLAG_DIM_BEHIND) != 0 ? mAttrs.dimAmount : 0; getDimmer().dimBelow( getSyncTransaction(), this, mAttrs.dimAmount, mAttrs.backgroundBlurRadius); } } Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +0 −1 Original line number Diff line number Diff line Loading @@ -802,7 +802,6 @@ class WindowStateAnimator { if (displayed) { w.mToken.hasVisible = true; mSurfaceController.setBackgroundBlurRadius(w.mAttrs.backgroundBlurRadius); } } Loading services/core/java/com/android/server/wm/WindowSurfaceController.java +0 −22 Original line number Diff line number Diff line Loading @@ -64,8 +64,6 @@ class WindowSurfaceController { private float mLastDsdy = 0; private float mLastDtdy = 1; private int mLastBackgroundBlurRadius = 0; private float mSurfaceAlpha = 0; private int mSurfaceLayer = 0; Loading Loading @@ -242,26 +240,6 @@ class WindowSurfaceController { } } void setBackgroundBlurRadius(int radius) { ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE backgroundBlur=%o: %s", radius, title); if (mSurfaceControl == null || radius == mLastBackgroundBlurRadius) { return; } mLastBackgroundBlurRadius = radius; if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setBackgroundBlurRadius"); mService.openSurfaceTransaction(); try { getGlobalTransaction().setBackgroundBlurRadius(mSurfaceControl, radius); } finally { mService.closeSurfaceTransaction("setBackgroundBlurRadius"); if (SHOW_LIGHT_TRANSACTIONS) { Slog.i(TAG, "<<< CLOSE TRANSACTION setBackgroundBlurRadius"); } } } void setSecure(boolean isSecure) { ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isSecure=%b: %s", isSecure, title); Loading services/tests/wmtests/src/com/android/server/wm/DimmerTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -199,7 +199,7 @@ public class DimmerTests extends WindowTestsBase { mHost.addChild(child, 0); final float alpha = 0.8f; mDimmer.dimBelow(mTransaction, child, alpha); mDimmer.dimBelow(mTransaction, child, alpha, 0); SurfaceControl dimLayer = getDimLayer(); assertNotNull("Dimmer should have created a surface", dimLayer); Loading Loading
services/core/java/com/android/server/wm/Dimmer.java +11 −8 Original line number Diff line number Diff line Loading @@ -204,7 +204,7 @@ class Dimmer { } private void dim(SurfaceControl.Transaction t, WindowContainer container, int relativeLayer, float alpha) { float alpha, int blurRadius) { final DimState d = getDimState(container); if (d == null) { Loading @@ -220,6 +220,7 @@ class Dimmer { t.setLayer(d.mDimLayer, Integer.MAX_VALUE); } t.setAlpha(d.mDimLayer, alpha); t.setBackgroundBlurRadius(d.mDimLayer, blurRadius); d.mDimming = true; } Loading Loading @@ -247,7 +248,7 @@ class Dimmer { * @param alpha The alpha at which to Dim. */ void dimAbove(SurfaceControl.Transaction t, float alpha) { dim(t, null, 1, alpha); dim(t, null, 1, alpha, 0); } /** Loading @@ -260,7 +261,7 @@ class Dimmer { * @param alpha The alpha at which to Dim. */ void dimAbove(SurfaceControl.Transaction t, WindowContainer container, float alpha) { dim(t, container, 1, alpha); dim(t, container, 1, alpha, 0); } /** Loading @@ -269,10 +270,12 @@ class Dimmer { * @param t A transaction in which to apply the Dim. * @param container The container which to dim below. Should be a child of our host. * @param alpha The alpha at which to Dim. * @param blurRadius The amount of blur added to the Dim. */ void dimBelow(SurfaceControl.Transaction t, WindowContainer container, float alpha) { dim(t, container, -1, alpha); void dimBelow(SurfaceControl.Transaction t, WindowContainer container, float alpha, int blurRadius) { dim(t, container, -1, alpha, blurRadius); } /** Loading
services/core/java/com/android/server/wm/WindowState.java +7 −4 Original line number Diff line number Diff line Loading @@ -5229,14 +5229,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (!mAnimatingExit && mAppDied) { mIsDimming = true; getDimmer().dimAbove(getSyncTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW); } else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0 && isVisibleNow() && !mHidden) { // Only show a dim behind when the following is satisfied: // 1. The window has the flag FLAG_DIM_BEHIND } else if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || mAttrs.backgroundBlurRadius != 0) && isVisibleNow() && !mHidden) { // Only show the Dimmer when the following is satisfied: // 1. The window has the flag FLAG_DIM_BEHIND or background blur is requested // 2. The WindowToken is not hidden so dims aren't shown when the window is exiting. // 3. The WS is considered visible according to the isVisible() method // 4. The WS is not hidden. mIsDimming = true; getDimmer().dimBelow(getSyncTransaction(), this, mAttrs.dimAmount); final float dimAmount = (mAttrs.flags & FLAG_DIM_BEHIND) != 0 ? mAttrs.dimAmount : 0; getDimmer().dimBelow( getSyncTransaction(), this, mAttrs.dimAmount, mAttrs.backgroundBlurRadius); } } Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +0 −1 Original line number Diff line number Diff line Loading @@ -802,7 +802,6 @@ class WindowStateAnimator { if (displayed) { w.mToken.hasVisible = true; mSurfaceController.setBackgroundBlurRadius(w.mAttrs.backgroundBlurRadius); } } Loading
services/core/java/com/android/server/wm/WindowSurfaceController.java +0 −22 Original line number Diff line number Diff line Loading @@ -64,8 +64,6 @@ class WindowSurfaceController { private float mLastDsdy = 0; private float mLastDtdy = 1; private int mLastBackgroundBlurRadius = 0; private float mSurfaceAlpha = 0; private int mSurfaceLayer = 0; Loading Loading @@ -242,26 +240,6 @@ class WindowSurfaceController { } } void setBackgroundBlurRadius(int radius) { ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE backgroundBlur=%o: %s", radius, title); if (mSurfaceControl == null || radius == mLastBackgroundBlurRadius) { return; } mLastBackgroundBlurRadius = radius; if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setBackgroundBlurRadius"); mService.openSurfaceTransaction(); try { getGlobalTransaction().setBackgroundBlurRadius(mSurfaceControl, radius); } finally { mService.closeSurfaceTransaction("setBackgroundBlurRadius"); if (SHOW_LIGHT_TRANSACTIONS) { Slog.i(TAG, "<<< CLOSE TRANSACTION setBackgroundBlurRadius"); } } } void setSecure(boolean isSecure) { ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isSecure=%b: %s", isSecure, title); Loading
services/tests/wmtests/src/com/android/server/wm/DimmerTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -199,7 +199,7 @@ public class DimmerTests extends WindowTestsBase { mHost.addChild(child, 0); final float alpha = 0.8f; mDimmer.dimBelow(mTransaction, child, alpha); mDimmer.dimBelow(mTransaction, child, alpha, 0); SurfaceControl dimLayer = getDimLayer(); assertNotNull("Dimmer should have created a surface", dimLayer); Loading