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

Commit e463ad6d authored by Galia Peycheva's avatar Galia Peycheva
Browse files

Make window background blurs SystemApi

This CL makes windowBackgroundBlurEnabled, windowBackgroundBlurRadius
and WM.LP backgroundBlurRadius SystemApis to be used for bross-app blur.

WM.LP.backgroundBlurRadius is protected via a
Manifest.permission.USE_BACKGROUND_BLUR, which is checked both in the
system server and in SurfaceFlinger.

This CL also mokes WM.LP.FLAG_BLUR_BEHIND a SystemApi. It has been a
public API since 2009 and was deprected in 2011. It has been a no-op
ever since that. We are removing it from being a public api and will
use it as a system api in S

Bug: 167166562
Bug: 177524486
Test: manual - use PermissionController dialog to check SystemApis work
Change-Id: Icf98c3607b7d7ccdfb67b279e9fc5a83eba14204
parent 18b5ed4d
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -1055,11 +1055,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
@@ -1152,7 +1152,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
@@ -1293,10 +1293,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
@@ -49440,7 +49440,6 @@ 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_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
+4 −0
Original line number Diff line number Diff line
@@ -285,6 +285,8 @@ package android {
    field public static final int sdkVersion = 16844304; // 0x1010610
    field public static final int supportsAmbientMode = 16844173; // 0x101058d
    field public static final int userRestriction = 16844164; // 0x1010584
    field public static final int windowBackgroundBlurEnabled = 16844316; // 0x101061c
    field public static final int windowBackgroundBlurRadius = 16844315; // 0x101061b
  }
  public static final class R.bool {
@@ -13357,9 +13359,11 @@ package android.view {
  public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
    method public final long getUserActivityTimeout();
    method public final void setUserActivityTimeout(long);
    field @RequiresPermission(android.Manifest.permission.USE_BACKGROUND_BLUR) public static final int FLAG_BLUR_BEHIND = 4; // 0x4
    field @RequiresPermission(android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS) public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 524288; // 0x80000
    field @RequiresPermission(android.Manifest.permission.INTERNAL_SYSTEM_WINDOW) public static final int SYSTEM_FLAG_SHOW_FOR_ALL_USERS = 16; // 0x10
    field @RequiresPermission(android.Manifest.permission.SYSTEM_APPLICATION_OVERLAY) public static final int SYSTEM_FLAG_SYSTEM_APPLICATION_OVERLAY = 8; // 0x8
    field @RequiresPermission(android.Manifest.permission.USE_BACKGROUND_BLUR) public int backgroundBlurRadius;
  }
  @IntDef(flag=true, prefix={"SYSTEM_FLAG_"}, value={android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS, android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS, android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SYSTEM_APPLICATION_OVERLAY}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface WindowManager.LayoutParams.SystemFlags {
+12 −4
Original line number Diff line number Diff line
@@ -1508,9 +1508,13 @@ 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 blurring behind this window.
         * To set the amount of blur, use {@link #backgroundBlurRadius}
         *
         * @hide
         */
        @RequiresPermission(permission.USE_BACKGROUND_BLUR)
        @SystemApi
        public static final int FLAG_BLUR_BEHIND        = 0x00000004;

        /** Window flag: this window won't ever get key input focus, so the
@@ -3225,10 +3229,14 @@ public interface WindowManager extends ViewManager {
        public boolean preferMinimalPostProcessing = false;

        /**
         * Indicates that this window wants to have blurred content behind it.
         * When {@link FLAG_BLUR_BEHIND} is set, this is the amount of blur in pixels that this
         * window will use to blur behind itself.
         * The range is from 0, which means no blur, to 150.
         *
         * @hide
         */
        @SystemApi
        @RequiresPermission(permission.USE_BACKGROUND_BLUR)
        public int backgroundBlurRadius = 0;

        /**
+8 −2
Original line number Diff line number Diff line
@@ -2540,8 +2540,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            }
        }

        if (a.getBoolean(R.styleable.Window_windowBackgroundBlurEnabled, false)) {
            if ((getForcedWindowFlags() & WindowManager.LayoutParams.FLAG_BLUR_BEHIND) == 0) {
                params.flags |= WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
            }

            params.backgroundBlurRadius = a.getDimensionPixelSize(
                R.styleable.Window_windowBackgroundBlurRadius, 0);
                        android.R.styleable.Window_windowBackgroundBlurRadius, 0);
        }

        if (params.windowAnimations == 0) {
            params.windowAnimations = a.getResourceId(
+12 −4
Original line number Diff line number Diff line
@@ -87,6 +87,16 @@
             theme does not set this value, meaning it is based on whether the
             window is floating. -->
        <attr name="backgroundDimEnabled" format="boolean" />
        <!-- When windowBackgroundBlurEnabled is set, this is the amount of blur to apply
             behind the window. The range is from 0, which means no blur, to 150.
             @hide @SystemApi -->
        <attr name="windowBackgroundBlurRadius" format="dimension"/>
        <!-- If set, the area behind the window will be blurred with radius
             windowBackgroundBlurRadius.
             @hide @SystemApi -->
        <attr name="windowBackgroundBlurEnabled" format="boolean" />
        <!-- Color of background imagery used for popup windows. -->
        <attr name="colorPopupBackground" format="color" />
        <!-- Color used for list divider. -->
@@ -1964,6 +1974,8 @@
        <attr name="textColor" />
        <attr name="backgroundDimEnabled" />
        <attr name="backgroundDimAmount" />
        <attr name="windowBackgroundBlurEnabled" />
        <attr name="windowBackgroundBlurRadius" />
        <attr name="windowActionBar" />
        <attr name="windowActionModeOverlay" />
        <attr name="windowActionBarOverlay" />
@@ -2181,10 +2193,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}.
Loading