Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e30771f authored by Galia Peycheva's avatar Galia Peycheva
Browse files

Make window blur behind public API

This CL makes the blur behind functionality a public API. As part of
this change, we change its previous name (windowBackgroundBlurRadius) to
windowBlurBehindRadius. This avoids a name clash with the Window
background blur, which only blurs the area of the window. Blur behind
blurs everything behind the window (similar behaviour to the dim).

This CL exposes WM.LP.blurBehindRadius and, in addition, undeprecates an
old flag - FLAG_BLUR_BEHIND. FLAG_BLUR_BEHIND enables the blur behind
and blurBehindRadius specifies how dense the blur will be.

In addition, we expose two xml attributes on the Window -
windowBlurBehindEnable and windowBlurBehindRadius. The usage is similar
to the dim api.

Bug: 167166562
Bug: 177524486
Test: m && test app
Change-Id: If2fcde644c5bcca112495ca99ee66bae909877db
Merged-In: If2fcde644c5bcca112495ca99ee66bae909877db
parent e6ae6e32
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -657,7 +657,7 @@ package android {
    field @Deprecated public static final int fontProviderCerts = 16844125; // 0x101055d
    field @Deprecated public static final int fontProviderPackage = 16844119; // 0x1010557
    field @Deprecated public static final int fontProviderQuery = 16844113; // 0x1010551
    field public static final int fontProviderSystemFontFamily = 16844321; // 0x1010621
    field public static final int fontProviderSystemFontFamily = 16844322; // 0x1010622
    field public static final int fontStyle = 16844095; // 0x101053f
    field public static final int fontVariationSettings = 16844144; // 0x1010570
    field public static final int fontWeight = 16844083; // 0x1010533
@@ -722,7 +722,7 @@ package android {
    field public static final int gwpAsanMode = 16844310; // 0x1010616
    field public static final int hand_hour = 16843011; // 0x1010103
    field public static final int hand_minute = 16843012; // 0x1010104
    field public static final int hand_second = 16844322; // 0x1010622
    field public static final int hand_second = 16844323; // 0x1010623
    field public static final int handle = 16843354; // 0x101025a
    field public static final int handleProfiling = 16842786; // 0x1010022
    field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e
@@ -1057,11 +1057,11 @@ package android {
    field public static final int parentActivityName = 16843687; // 0x10103a7
    field @Deprecated public static final int password = 16843100; // 0x101015c
    field public static final int path = 16842794; // 0x101002a
    field public static final int pathAdvancedPattern = 16844319; // 0x101061f
    field public static final int pathAdvancedPattern = 16844320; // 0x1010620
    field public static final int pathData = 16843781; // 0x1010405
    field public static final int pathPattern = 16842796; // 0x101002c
    field public static final int pathPrefix = 16842795; // 0x101002b
    field public static final int pathSuffix = 16844317; // 0x101061d
    field public static final int pathSuffix = 16844318; // 0x101061e
    field public static final int patternPathData = 16843978; // 0x10104ca
    field public static final int permission = 16842758; // 0x1010006
    field public static final int permissionFlags = 16843719; // 0x10103c7
@@ -1154,7 +1154,7 @@ package android {
    field public static final int reqNavigation = 16843306; // 0x101022a
    field public static final int reqTouchScreen = 16843303; // 0x1010227
    field public static final int requestLegacyExternalStorage = 16844291; // 0x1010603
    field public static final int requireDeviceScreenOn = 16844316; // 0x101061c
    field public static final int requireDeviceScreenOn = 16844317; // 0x101061d
    field public static final int requireDeviceUnlock = 16843756; // 0x10103ec
    field public static final int required = 16843406; // 0x101028e
    field public static final int requiredAccountType = 16843734; // 0x10103d6
@@ -1295,10 +1295,10 @@ package android {
    field public static final int spotShadowAlpha = 16843967; // 0x10104bf
    field public static final int src = 16843033; // 0x1010119
    field public static final int ssp = 16843747; // 0x10103e3
    field public static final int sspAdvancedPattern = 16844320; // 0x1010620
    field public static final int sspAdvancedPattern = 16844321; // 0x1010621
    field public static final int sspPattern = 16843749; // 0x10103e5
    field public static final int sspPrefix = 16843748; // 0x10103e4
    field public static final int sspSuffix = 16844318; // 0x101061e
    field public static final int sspSuffix = 16844319; // 0x101061f
    field public static final int stackFromBottom = 16843005; // 0x10100fd
    field public static final int stackViewStyle = 16843838; // 0x101043e
    field public static final int starStyle = 16842882; // 0x1010082
@@ -1609,6 +1609,8 @@ package android {
    field public static final int windowAnimationStyle = 16842926; // 0x10100ae
    field public static final int windowBackground = 16842836; // 0x1010054
    field public static final int windowBackgroundFallback = 16844035; // 0x1010503
    field public static final int windowBlurBehindEnabled = 16844316; // 0x101061c
    field public static final int windowBlurBehindRadius = 16844315; // 0x101061b
    field public static final int windowClipToOutline = 16843947; // 0x10104ab
    field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b
    field public static final int windowContentOverlay = 16842841; // 0x1010059
@@ -49588,7 +49590,7 @@ package android.view {
    field public static final int FLAGS_CHANGED = 4; // 0x4
    field public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 1; // 0x1
    field public static final int FLAG_ALT_FOCUSABLE_IM = 131072; // 0x20000
    field @Deprecated public static final int FLAG_BLUR_BEHIND = 4; // 0x4
    field public static final int FLAG_BLUR_BEHIND = 4; // 0x4
    field public static final int FLAG_DIM_BEHIND = 2; // 0x2
    field @Deprecated public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000
    field @Deprecated public static final int FLAG_DITHER = 4096; // 0x1000
@@ -49679,6 +49681,7 @@ package android.view {
    field @Deprecated public static final int TYPE_TOAST = 2005; // 0x7d5
    field public static final int TYPE_WALLPAPER = 2013; // 0x7dd
    field public float alpha;
    field public int blurBehindRadius;
    field public float buttonBrightness;
    field public float dimAmount;
    field public int flags;
+16 −13
Original line number Diff line number Diff line
@@ -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(
+9 −2
Original line number Diff line number Diff line
@@ -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(
+10 −4
Original line number Diff line number Diff line
@@ -87,6 +87,14 @@
             theme does not set this value, meaning it is based on whether the
             window is floating. -->
        <attr name="backgroundDimEnabled" format="boolean" />
        <!-- When windowBlurBehindEnabled is set, this is the amount of blur to apply
             behind the window. The range is from 0, which means no blur, to 150.  -->
        <attr name="windowBlurBehindRadius" format="dimension"/>
        <!-- If set, everything behind the window will be blurred with radius
             windowBackgroundBlurRadius. -->
        <attr name="windowBlurBehindEnabled" format="boolean" />
        <!-- Color of background imagery used for popup windows. -->
        <attr name="colorPopupBackground" format="color" />
        <!-- Color used for list divider. -->
@@ -1964,6 +1972,8 @@
        <attr name="textColor" />
        <attr name="backgroundDimEnabled" />
        <attr name="backgroundDimAmount" />
        <attr name="windowBlurBehindEnabled" />
        <attr name="windowBlurBehindRadius" />
        <attr name="windowActionBar" />
        <attr name="windowActionModeOverlay" />
        <attr name="windowActionBarOverlay" />
@@ -2181,10 +2191,6 @@
             the decor view. -->
        <attr name="windowLightNavigationBar" format="boolean" />
        <!-- @hide -->
        <attr name="windowBackgroundBlurRadius" format="dimension"/>
        <!-- Controls how the window is laid out if there is a {@code DisplayCutout}.
        <p>
        Defaults to {@code default}.
+2 −2
Original line number Diff line number Diff line
@@ -3048,8 +3048,8 @@
    <public name="allowClickWhenDisabled" />
    <public name="windowLayoutAffinity" />
    <public name="canPauseRecording" />
    <!-- @hide -->
    <public name="windowBackgroundBlurRadius"/>
    <public name="windowBlurBehindRadius"/>
    <public name="windowBlurBehindEnabled"/>
    <public name="requireDeviceScreenOn" />
    <public name="pathSuffix" />
    <public name="sspSuffix" />
Loading