Loading core/java/com/android/internal/policy/DecorView.java +18 −8 Original line number Original line Diff line number Diff line Loading @@ -258,6 +258,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private Drawable mLastOriginalBackgroundDrawable; private Drawable mLastOriginalBackgroundDrawable; private Drawable mResizingBackgroundDrawable; private Drawable mResizingBackgroundDrawable; private BackgroundBlurDrawable mBackgroundBlurDrawable; private BackgroundBlurDrawable mBackgroundBlurDrawable; private BackgroundBlurDrawable mLastBackgroundBlurDrawable; /** /** * Temporary holder for a window background when it is set before {@link #mWindow} is * Temporary holder for a window background when it is set before {@link #mWindow} is Loading Loading @@ -289,7 +290,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private int mOriginalBackgroundBlurRadius = 0; private int mOriginalBackgroundBlurRadius = 0; private int mBackgroundBlurRadius = 0; private int mBackgroundBlurRadius = 0; private int mLastBackgroundBlurRadius = 0; private boolean mCrossWindowBlurEnabled; private boolean mCrossWindowBlurEnabled; private final ViewTreeObserver.OnPreDrawListener mBackgroundBlurOnPreDrawListener = () -> { private final ViewTreeObserver.OnPreDrawListener mBackgroundBlurOnPreDrawListener = () -> { updateBackgroundBlurCorners(); updateBackgroundBlurCorners(); Loading Loading @@ -1278,13 +1278,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } if (mBackgroundInsets.equals(mLastBackgroundInsets) if (mBackgroundInsets.equals(mLastBackgroundInsets) && mBackgroundBlurRadius == mLastBackgroundBlurRadius && mBackgroundBlurDrawable == mLastBackgroundBlurDrawable && mLastOriginalBackgroundDrawable == mOriginalBackgroundDrawable) { && mLastOriginalBackgroundDrawable == mOriginalBackgroundDrawable) { return; return; } } Drawable destDrawable = mOriginalBackgroundDrawable; Drawable destDrawable = mOriginalBackgroundDrawable; if (mBackgroundBlurRadius > 0) { if (mBackgroundBlurDrawable != null) { destDrawable = new LayerDrawable(new Drawable[] {mBackgroundBlurDrawable, destDrawable = new LayerDrawable(new Drawable[] {mBackgroundBlurDrawable, mOriginalBackgroundDrawable}); mOriginalBackgroundDrawable}); } } Loading @@ -1309,7 +1309,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind super.setBackgroundDrawable(destDrawable); super.setBackgroundDrawable(destDrawable); mLastBackgroundInsets = mBackgroundInsets; mLastBackgroundInsets = mBackgroundInsets; mLastBackgroundBlurRadius = mBackgroundBlurRadius; mLastBackgroundBlurDrawable = mBackgroundBlurDrawable; mLastOriginalBackgroundDrawable = mOriginalBackgroundDrawable; mLastOriginalBackgroundDrawable = mOriginalBackgroundDrawable; } } Loading @@ -1334,11 +1334,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind ? mOriginalBackgroundBlurRadius : 0; ? mOriginalBackgroundBlurRadius : 0; if (mBackgroundBlurDrawable == null && mBackgroundBlurRadius > 0) { if (mBackgroundBlurDrawable == null && mBackgroundBlurRadius > 0) { mBackgroundBlurDrawable = getViewRootImpl().createBackgroundBlurDrawable(); mBackgroundBlurDrawable = getViewRootImpl().createBackgroundBlurDrawable(); updateBackgroundDrawable(); } } if (mBackgroundBlurDrawable != null) { if (mBackgroundBlurDrawable != null) { mBackgroundBlurDrawable.setBlurRadius(mBackgroundBlurRadius); mBackgroundBlurDrawable.setBlurRadius(mBackgroundBlurRadius); updateBackgroundDrawable(); } } } } Loading @@ -1357,12 +1357,20 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind updateBackgroundBlurRadius(); updateBackgroundBlurRadius(); } } } else if (mCrossWindowBlurEnabledListener != null) { } else if (mCrossWindowBlurEnabledListener != null) { mCrossWindowBlurEnabledListener = null; updateBackgroundBlurRadius(); removeBackgroundBlurDrawable(); } } void removeBackgroundBlurDrawable() { if (mCrossWindowBlurEnabledListener != null) { getContext().getSystemService(WindowManager.class) getContext().getSystemService(WindowManager.class) .removeCrossWindowBlurEnabledListener(mCrossWindowBlurEnabledListener); .removeCrossWindowBlurEnabledListener(mCrossWindowBlurEnabledListener); getViewTreeObserver().removeOnPreDrawListener(mBackgroundBlurOnPreDrawListener); mCrossWindowBlurEnabledListener = null; updateBackgroundBlurRadius(); } } getViewTreeObserver().removeOnPreDrawListener(mBackgroundBlurOnPreDrawListener); mBackgroundBlurDrawable = null; updateBackgroundDrawable(); } } @Override @Override Loading Loading @@ -1847,6 +1855,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mFloatingToolbar = null; mFloatingToolbar = null; } } removeBackgroundBlurDrawable(); PhoneWindow.PanelFeatureState st = mWindow.getPanelState(Window.FEATURE_OPTIONS_PANEL, false); PhoneWindow.PanelFeatureState st = mWindow.getPanelState(Window.FEATURE_OPTIONS_PANEL, false); if (st != null && st.menu != null && mFeatureId < 0) { if (st != null && st.menu != null && mFeatureId < 0) { st.menu.close(); st.menu.close(); Loading Loading
core/java/com/android/internal/policy/DecorView.java +18 −8 Original line number Original line Diff line number Diff line Loading @@ -258,6 +258,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private Drawable mLastOriginalBackgroundDrawable; private Drawable mLastOriginalBackgroundDrawable; private Drawable mResizingBackgroundDrawable; private Drawable mResizingBackgroundDrawable; private BackgroundBlurDrawable mBackgroundBlurDrawable; private BackgroundBlurDrawable mBackgroundBlurDrawable; private BackgroundBlurDrawable mLastBackgroundBlurDrawable; /** /** * Temporary holder for a window background when it is set before {@link #mWindow} is * Temporary holder for a window background when it is set before {@link #mWindow} is Loading Loading @@ -289,7 +290,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private int mOriginalBackgroundBlurRadius = 0; private int mOriginalBackgroundBlurRadius = 0; private int mBackgroundBlurRadius = 0; private int mBackgroundBlurRadius = 0; private int mLastBackgroundBlurRadius = 0; private boolean mCrossWindowBlurEnabled; private boolean mCrossWindowBlurEnabled; private final ViewTreeObserver.OnPreDrawListener mBackgroundBlurOnPreDrawListener = () -> { private final ViewTreeObserver.OnPreDrawListener mBackgroundBlurOnPreDrawListener = () -> { updateBackgroundBlurCorners(); updateBackgroundBlurCorners(); Loading Loading @@ -1278,13 +1278,13 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } if (mBackgroundInsets.equals(mLastBackgroundInsets) if (mBackgroundInsets.equals(mLastBackgroundInsets) && mBackgroundBlurRadius == mLastBackgroundBlurRadius && mBackgroundBlurDrawable == mLastBackgroundBlurDrawable && mLastOriginalBackgroundDrawable == mOriginalBackgroundDrawable) { && mLastOriginalBackgroundDrawable == mOriginalBackgroundDrawable) { return; return; } } Drawable destDrawable = mOriginalBackgroundDrawable; Drawable destDrawable = mOriginalBackgroundDrawable; if (mBackgroundBlurRadius > 0) { if (mBackgroundBlurDrawable != null) { destDrawable = new LayerDrawable(new Drawable[] {mBackgroundBlurDrawable, destDrawable = new LayerDrawable(new Drawable[] {mBackgroundBlurDrawable, mOriginalBackgroundDrawable}); mOriginalBackgroundDrawable}); } } Loading @@ -1309,7 +1309,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind super.setBackgroundDrawable(destDrawable); super.setBackgroundDrawable(destDrawable); mLastBackgroundInsets = mBackgroundInsets; mLastBackgroundInsets = mBackgroundInsets; mLastBackgroundBlurRadius = mBackgroundBlurRadius; mLastBackgroundBlurDrawable = mBackgroundBlurDrawable; mLastOriginalBackgroundDrawable = mOriginalBackgroundDrawable; mLastOriginalBackgroundDrawable = mOriginalBackgroundDrawable; } } Loading @@ -1334,11 +1334,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind ? mOriginalBackgroundBlurRadius : 0; ? mOriginalBackgroundBlurRadius : 0; if (mBackgroundBlurDrawable == null && mBackgroundBlurRadius > 0) { if (mBackgroundBlurDrawable == null && mBackgroundBlurRadius > 0) { mBackgroundBlurDrawable = getViewRootImpl().createBackgroundBlurDrawable(); mBackgroundBlurDrawable = getViewRootImpl().createBackgroundBlurDrawable(); updateBackgroundDrawable(); } } if (mBackgroundBlurDrawable != null) { if (mBackgroundBlurDrawable != null) { mBackgroundBlurDrawable.setBlurRadius(mBackgroundBlurRadius); mBackgroundBlurDrawable.setBlurRadius(mBackgroundBlurRadius); updateBackgroundDrawable(); } } } } Loading @@ -1357,12 +1357,20 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind updateBackgroundBlurRadius(); updateBackgroundBlurRadius(); } } } else if (mCrossWindowBlurEnabledListener != null) { } else if (mCrossWindowBlurEnabledListener != null) { mCrossWindowBlurEnabledListener = null; updateBackgroundBlurRadius(); removeBackgroundBlurDrawable(); } } void removeBackgroundBlurDrawable() { if (mCrossWindowBlurEnabledListener != null) { getContext().getSystemService(WindowManager.class) getContext().getSystemService(WindowManager.class) .removeCrossWindowBlurEnabledListener(mCrossWindowBlurEnabledListener); .removeCrossWindowBlurEnabledListener(mCrossWindowBlurEnabledListener); getViewTreeObserver().removeOnPreDrawListener(mBackgroundBlurOnPreDrawListener); mCrossWindowBlurEnabledListener = null; updateBackgroundBlurRadius(); } } getViewTreeObserver().removeOnPreDrawListener(mBackgroundBlurOnPreDrawListener); mBackgroundBlurDrawable = null; updateBackgroundDrawable(); } } @Override @Override Loading Loading @@ -1847,6 +1855,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mFloatingToolbar = null; mFloatingToolbar = null; } } removeBackgroundBlurDrawable(); PhoneWindow.PanelFeatureState st = mWindow.getPanelState(Window.FEATURE_OPTIONS_PANEL, false); PhoneWindow.PanelFeatureState st = mWindow.getPanelState(Window.FEATURE_OPTIONS_PANEL, false); if (st != null && st.menu != null && mFeatureId < 0) { if (st != null && st.menu != null && mFeatureId < 0) { st.menu.close(); st.menu.close(); Loading