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

Commit f78234f1 authored by Galia Peycheva's avatar Galia Peycheva Committed by Android (Google) Code Review
Browse files

Merge changes from topic "blur_system_api"

* changes:
  Make BackgroundBlurDrawable a SystemApi
  Make window background blurs SystemApi
  Add permission for blur SystemApi
parents 0acf0dad 42f19b61
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
@@ -49461,7 +49461,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
+17 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ package android {
    field public static final String UPDATE_TIME_ZONE_RULES = "android.permission.UPDATE_TIME_ZONE_RULES";
    field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
    field public static final String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
    field public static final String USE_BACKGROUND_BLUR = "android.permission.USE_BACKGROUND_BLUR";
    field public static final String USE_RESERVED_DISK = "android.permission.USE_RESERVED_DISK";
    field public static final String WHITELIST_AUTO_REVOKE_PERMISSIONS = "android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS";
    field public static final String WHITELIST_RESTRICTED_PERMISSIONS = "android.permission.WHITELIST_RESTRICTED_PERMISSIONS";
@@ -285,6 +286,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 {
@@ -2579,6 +2582,18 @@ package android.debug {
}
package android.graphics.drawable {
  public final class BackgroundBlurDrawable extends android.graphics.drawable.Drawable {
    ctor @RequiresPermission(android.Manifest.permission.USE_BACKGROUND_BLUR) public BackgroundBlurDrawable();
    method public void setBlurRadius(int);
    method public void setColor(@ColorInt int);
    method public void setCornerRadius(float);
    method public void setCornerRadius(float, float, float, float);
  }
}
package android.hardware {
  public final class Sensor {
@@ -13363,9 +13378,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 {
+20 −0
Original line number Diff line number Diff line
@@ -9802,6 +9802,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
    }
    private void notifyAttachForDrawables() {
        if (mBackground != null) mBackground.onAttached(this);
        if (mForegroundInfo != null && mForegroundInfo.mDrawable != null) {
            mForegroundInfo.mDrawable.onAttached(this);
        }
    }
    private void notifyDetachForDrawables() {
        if (mBackground != null) mBackground.onDetached(this);
        if (mForegroundInfo != null && mForegroundInfo.mDrawable != null) {
            mForegroundInfo.mDrawable.onDetached(this);
        }
    }
    private void setNotifiedContentCaptureAppeared() {
        mPrivateFlags4 |= PFLAG4_NOTIFIED_CONTENT_CAPTURE_APPEARED;
        mPrivateFlags4 &= ~PFLAG4_NOTIFIED_CONTENT_CAPTURE_DISAPPEARED;
@@ -20653,6 +20667,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        notifyEnterOrExitForAutoFillIfNeeded(true);
        notifyAppearedOrDisappearedForContentCaptureIfNeeded(true);
        notifyAttachForDrawables();
    }
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
@@ -20702,6 +20717,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        notifyEnterOrExitForAutoFillIfNeeded(false);
        notifyAppearedOrDisappearedForContentCaptureIfNeeded(false);
        notifyDetachForDrawables();
    }
    /**
@@ -23830,6 +23846,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (mBackground != null) {
            if (isAttachedToWindow()) {
                mBackground.setVisible(false, false);
                mBackground.onDetached(this);
            }
            mBackground.setCallback(null);
            unscheduleDrawable(mBackground);
@@ -23879,6 +23896,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                background.setState(getDrawableState());
            }
            if (isAttachedToWindow()) {
                background.onAttached(this);
                background.setVisible(getWindowVisibility() == VISIBLE && isShown(), false);
            }
@@ -24111,6 +24129,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        if (mForegroundInfo.mDrawable != null) {
            if (isAttachedToWindow()) {
                mForegroundInfo.mDrawable.setVisible(false, false);
                mForegroundInfo.mDrawable.onDetached(this);
            }
            mForegroundInfo.mDrawable.setCallback(null);
            unscheduleDrawable(mForegroundInfo.mDrawable);
@@ -24128,6 +24147,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            }
            applyForegroundTint();
            if (isAttachedToWindow()) {
                foreground.onAttached(this);
                foreground.setVisible(getWindowVisibility() == VISIBLE && isShown(), false);
            }
            // Set callback last, since the view may still be initializing.
+9 −8
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ import android.graphics.RecordingCanvas;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.RenderNode;
import android.graphics.drawable.BackgroundBlurDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.hardware.display.DisplayManager;
@@ -186,7 +187,6 @@ import android.window.ClientWindowFrames;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.graphics.drawable.BackgroundBlurDrawable;
import com.android.internal.inputmethod.InputMethodDebug;
import com.android.internal.os.IResultReceiver;
import com.android.internal.os.SomeArgs;
@@ -669,6 +669,14 @@ public final class ViewRootImpl implements ViewParent,
    private final BackgroundBlurDrawable.Aggregator mBlurRegionAggregator =
            new BackgroundBlurDrawable.Aggregator(this);

    /**
     * @return {@link BackgroundBlurDrawable.Aggregator} for this instance.
     */
    @NonNull
    public BackgroundBlurDrawable.Aggregator getBlurRegionAggregator() {
        return mBlurRegionAggregator;
    }

    /**
     * @return {@link ImeFocusController} for this instance.
     */
@@ -10046,13 +10054,6 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    /**
     * Creates a background blur drawable for the backing {@link Surface}.
     */
    public BackgroundBlurDrawable createBackgroundBlurDrawable() {
        return mBlurRegionAggregator.createBackgroundBlurDrawable(mContext);
    }

    @Override
    public void onDescendantUnbufferedRequested() {
        mUnbufferedInputSource = mView.mUnbufferedInputSource;
+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;

        /**
Loading