diff options
| author | Galia Peycheva <galinap@google.com> | 2021-02-04 08:31:45 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-02-04 08:31:45 +0000 |
| commit | bf21f495dfd6fe8466d06ecb48c056ee51310007 (patch) | |
| tree | 0493abbd355510ae549b08d59b26fdc0e09a3d4e /core/java | |
| parent | b9cf7d051f4b3befdc33776cdc11fd8ad49e94b1 (diff) | |
| parent | 8e30771f55e84199106f9e9e3be10e4de343608a (diff) | |
Merge "Make window blur behind public API" into sc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/WindowManager.java | 29 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/PhoneWindow.java | 11 |
2 files changed, 25 insertions, 15 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 63f1eedf1c50..9e87c95a8a75 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1511,9 +1511,7 @@ public interface WindowManager extends ViewManager { * Use {@link #dimAmount} to control the amount of dim. */ public static final int FLAG_DIM_BEHIND = 0x00000002; - /** Window flag: blur everything behind this window. - * @deprecated Blurring is no longer supported. */ - @Deprecated + /** Window flag: enable blur behind for this window. */ public static final int FLAG_BLUR_BEHIND = 0x00000004; /** Window flag: this window won't ever get key input focus, so the @@ -3233,11 +3231,16 @@ public interface WindowManager extends ViewManager { public boolean preferMinimalPostProcessing = false; /** - * Indicates that this window wants to have blurred content behind it. + * Specifies the amount of blur to be used to blur everything behind the window. + * The effect is similar to the dimAmount, but instead of dimming, the content behind + * will be blurred. * - * @hide + * The blur behind radius range starts at 0, which means no blur, and increases until 150 + * for the densest blur. + * + * @see #FLAG_BLUR_BEHIND */ - public int backgroundBlurRadius = 0; + public int blurBehindRadius = 0; /** * The color mode requested by this window. The target display may @@ -3626,7 +3629,7 @@ public interface WindowManager extends ViewManager { out.writeInt(mFitInsetsSides); out.writeBoolean(mFitInsetsIgnoringVisibility); out.writeBoolean(preferMinimalPostProcessing); - out.writeInt(backgroundBlurRadius); + out.writeInt(blurBehindRadius); if (providesInsetsTypes != null) { out.writeInt(providesInsetsTypes.length); out.writeIntArray(providesInsetsTypes); @@ -3695,7 +3698,7 @@ public interface WindowManager extends ViewManager { mFitInsetsSides = in.readInt(); mFitInsetsIgnoringVisibility = in.readBoolean(); preferMinimalPostProcessing = in.readBoolean(); - backgroundBlurRadius = in.readInt(); + blurBehindRadius = in.readInt(); int insetsTypesLength = in.readInt(); if (insetsTypesLength > 0) { providesInsetsTypes = new int[insetsTypesLength]; @@ -3940,8 +3943,8 @@ public interface WindowManager extends ViewManager { changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED; } - if (backgroundBlurRadius != o.backgroundBlurRadius) { - backgroundBlurRadius = o.backgroundBlurRadius; + if (blurBehindRadius != o.blurBehindRadius) { + blurBehindRadius = o.blurBehindRadius; changes |= BACKGROUND_BLUR_RADIUS_CHANGED; } @@ -4108,9 +4111,9 @@ public interface WindowManager extends ViewManager { sb.append(" preferMinimalPostProcessing="); sb.append(preferMinimalPostProcessing); } - if (backgroundBlurRadius != 0) { - sb.append(" backgroundBlurRadius="); - sb.append(backgroundBlurRadius); + if (blurBehindRadius != 0) { + sb.append(" blurBehindRadius="); + sb.append(blurBehindRadius); } sb.append(System.lineSeparator()); sb.append(prefix).append(" fl=").append( diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 141dc79f4c93..5df175e8aee5 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -2540,8 +2540,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } } - params.backgroundBlurRadius = a.getDimensionPixelSize( - R.styleable.Window_windowBackgroundBlurRadius, 0); + if (a.getBoolean(R.styleable.Window_windowBlurBehindEnabled, false)) { + if ((getForcedWindowFlags() & WindowManager.LayoutParams.FLAG_BLUR_BEHIND) == 0) { + params.flags |= WindowManager.LayoutParams.FLAG_BLUR_BEHIND; + } + + params.blurBehindRadius = a.getDimensionPixelSize( + android.R.styleable.Window_windowBlurBehindRadius, 0); + } + if (params.windowAnimations == 0) { params.windowAnimations = a.getResourceId( |
