Revert "Make window background blurs SystemApi" am: 3804d61f2a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13431934

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib770a5058e07ff9d1c54a8a1d97d175d81ddcb10
This commit is contained in:
Galia Peycheva
2021-02-03 06:11:45 +00:00
committed by Automerger Merge Worker
11 changed files with 28 additions and 71 deletions

View File

@@ -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 = 16844322; // 0x1010622
field public static final int fontProviderSystemFontFamily = 16844321; // 0x1010621
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 = 16844323; // 0x1010623
field public static final int hand_second = 16844322; // 0x1010622
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 = 16844320; // 0x1010620
field public static final int pathAdvancedPattern = 16844319; // 0x101061f
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 = 16844318; // 0x101061e
field public static final int pathSuffix = 16844317; // 0x101061d
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 = 16844317; // 0x101061d
field public static final int requireDeviceScreenOn = 16844316; // 0x101061c
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 = 16844321; // 0x1010621
field public static final int sspAdvancedPattern = 16844320; // 0x1010620
field public static final int sspPattern = 16843749; // 0x10103e5
field public static final int sspPrefix = 16843748; // 0x10103e4
field public static final int sspSuffix = 16844319; // 0x101061f
field public static final int sspSuffix = 16844318; // 0x101061e
field public static final int stackFromBottom = 16843005; // 0x10100fd
field public static final int stackViewStyle = 16843838; // 0x101043e
field public static final int starStyle = 16842882; // 0x1010082
@@ -49588,6 +49588,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_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

View File

@@ -295,8 +295,6 @@ 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 {
@@ -14090,10 +14088,8 @@ package android.view {
method public boolean isSystemApplicationOverlay();
method @RequiresPermission(android.Manifest.permission.SYSTEM_APPLICATION_OVERLAY) public void setSystemApplicationOverlay(boolean);
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.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}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface WindowManager.LayoutParams.SystemFlags {

View File

@@ -1511,13 +1511,9 @@ public interface WindowManager extends ViewManager {
* Use {@link #dimAmount} to control the amount of dim. */
public static final int FLAG_DIM_BEHIND = 0x00000002;
/** Window flag: enable blurring behind this window.
* To set the amount of blur, use {@link #backgroundBlurRadius}
*
* @hide
*/
@RequiresPermission(permission.USE_BACKGROUND_BLUR)
@SystemApi
/** Window flag: blur everything behind this window.
* @deprecated Blurring is no longer supported. */
@Deprecated
public static final int FLAG_BLUR_BEHIND = 0x00000004;
/** Window flag: this window won't ever get key input focus, so the
@@ -3237,14 +3233,10 @@ public interface WindowManager extends ViewManager {
public boolean preferMinimalPostProcessing = false;
/**
* 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.
* Indicates that this window wants to have blurred content behind it.
*
* @hide
*/
@SystemApi
@RequiresPermission(permission.USE_BACKGROUND_BLUR)
public int backgroundBlurRadius = 0;
/**

View File

@@ -2540,14 +2540,8 @@ 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(
android.R.styleable.Window_windowBackgroundBlurRadius, 0);
}
params.backgroundBlurRadius = a.getDimensionPixelSize(
R.styleable.Window_windowBackgroundBlurRadius, 0);
if (params.windowAnimations == 0) {
params.windowAnimations = a.getResourceId(

View File

@@ -87,16 +87,6 @@
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. -->
@@ -1974,8 +1964,6 @@
<attr name="textColor" />
<attr name="backgroundDimEnabled" />
<attr name="backgroundDimAmount" />
<attr name="windowBackgroundBlurEnabled" />
<attr name="windowBackgroundBlurRadius" />
<attr name="windowActionBar" />
<attr name="windowActionModeOverlay" />
<attr name="windowActionBarOverlay" />
@@ -2193,6 +2181,10 @@
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}.

View File

@@ -3049,10 +3049,7 @@
<public name="windowLayoutAffinity" />
<public name="canPauseRecording" />
<!-- @hide -->
<!-- @hide @SystemApi -->
<public name="windowBackgroundBlurRadius"/>
<!-- @hide @SystemApi -->
<public name="windowBackgroundBlurEnabled"/>
<public name="requireDeviceScreenOn" />
<public name="pathSuffix" />
<public name="sspSuffix" />

View File

@@ -22,7 +22,6 @@ import static android.Manifest.permission.HIDE_OVERLAY_WINDOWS;
import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.Manifest.permission.SYSTEM_APPLICATION_OVERLAY;
import static android.Manifest.permission.USE_BACKGROUND_BLUR;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.content.ClipDescription.MIMETYPE_APPLICATION_ACTIVITY;
import static android.content.ClipDescription.MIMETYPE_APPLICATION_SHORTCUT;
@@ -111,7 +110,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
final boolean mCanCreateSystemApplicationOverlay;
final boolean mCanHideNonSystemOverlayWindows;
final boolean mCanAcquireSleepToken;
final boolean mCanUseBackgroundBlur;
private AlertWindowNotification mAlertWindowNotification;
private boolean mShowingAlertWindowNotificationAllowed;
private boolean mClientDead = false;
@@ -142,8 +140,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
&& !mService.mAtmInternal.isCallerRecents(mUid);
mCanAcquireSleepToken = service.mContext.checkCallingOrSelfPermission(DEVICE_POWER)
== PERMISSION_GRANTED;
mCanUseBackgroundBlur = service.mContext.checkCallingOrSelfPermission(USE_BACKGROUND_BLUR)
== PERMISSION_GRANTED;
mShowingAlertWindowNotificationAllowed = mService.mShowAlertWindowNotifications;
mDragDropController = mService.mDragDropController;
StringBuilder sb = new StringBuilder();

View File

@@ -1652,7 +1652,7 @@ public class WindowManagerService extends IWindowManager.Stub
final WindowState win = new WindowState(this, session, client, token, parentWindow,
appOp[0], attrs, viewVisibility, session.mUid, userId,
session.mCanAddInternalSystemWindow, session.mCanUseBackgroundBlur);
session.mCanAddInternalSystemWindow);
if (win.mDeathRecipient == null) {
// Client has apparently died, so there is no reason to
// continue.

View File

@@ -45,7 +45,6 @@ import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON;
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
import static android.view.WindowManager.LayoutParams.FLAG_BLUR_BEHIND;
import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
@@ -297,8 +296,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
final int mShowUserId;
/** The owner has {@link android.Manifest.permission#INTERNAL_SYSTEM_WINDOW} */
final boolean mOwnerCanAddInternalSystemWindow;
/** The owner has {@link android.Manifest.permission#USE_BACKGROUND_BLUR} */
final boolean mOwnerCanUseBackgroundBlur;
final WindowId mWindowId;
WindowToken mToken;
// The same object as mToken if this is an app window and null for non-app windows.
@@ -897,11 +894,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState parentWindow, int appOp, WindowManager.LayoutParams a, int viewVisibility,
int ownerId, int showUserId, boolean ownerCanAddInternalSystemWindow,
boolean ownerCanUseBackgroundBlur) {
int ownerId, int showUserId, boolean ownerCanAddInternalSystemWindow) {
this(service, s, c, token, parentWindow, appOp, a, viewVisibility, ownerId, showUserId,
ownerCanAddInternalSystemWindow, ownerCanUseBackgroundBlur,
new PowerManagerWrapper() {
ownerCanAddInternalSystemWindow, new PowerManagerWrapper() {
@Override
public void wakeUp(long time, @WakeReason int reason, String details) {
service.mPowerManager.wakeUp(time, reason, details);
@@ -917,7 +912,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState parentWindow, int appOp, WindowManager.LayoutParams a, int viewVisibility,
int ownerId, int showUserId, boolean ownerCanAddInternalSystemWindow,
boolean ownerCanUseBackgroundBlur, PowerManagerWrapper powerManagerWrapper) {
PowerManagerWrapper powerManagerWrapper) {
super(service);
mTmpTransaction = service.mTransactionFactory.get();
mSession = s;
@@ -928,7 +923,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mOwnerUid = ownerId;
mShowUserId = showUserId;
mOwnerCanAddInternalSystemWindow = ownerCanAddInternalSystemWindow;
mOwnerCanUseBackgroundBlur = ownerCanUseBackgroundBlur;
mWindowId = new WindowId(this);
mAttrs.copyFrom(a);
mLastSurfaceInsets.set(mAttrs.surfaceInsets);
@@ -5275,7 +5269,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (!mAnimatingExit && mAppDied) {
mIsDimming = true;
getDimmer().dimAbove(getSyncTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW);
} else if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || isBlurEnabled())
} else if (((mAttrs.flags & FLAG_DIM_BEHIND) != 0 || mAttrs.backgroundBlurRadius != 0)
&& isVisibleNow() && !mHidden) {
// Only show the Dimmer when the following is satisfied:
// 1. The window has the flag FLAG_DIM_BEHIND or background blur is requested
@@ -5284,15 +5278,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// 4. The WS is not hidden.
mIsDimming = true;
final float dimAmount = (mAttrs.flags & FLAG_DIM_BEHIND) != 0 ? mAttrs.dimAmount : 0;
final int blurRadius = isBlurEnabled() ? mAttrs.backgroundBlurRadius : 0;
getDimmer().dimBelow(getSyncTransaction(), this, dimAmount, blurRadius);
getDimmer().dimBelow(
getSyncTransaction(), this, mAttrs.dimAmount, mAttrs.backgroundBlurRadius);
}
}
private boolean isBlurEnabled() {
return (mAttrs.flags & FLAG_BLUR_BEHIND) != 0 && mOwnerCanUseBackgroundBlur;
}
/**
* Notifies SF about the priority of the window, if it changed. SF then uses this information
* to decide which window's desired rendering rate should have a priority when deciding about

View File

@@ -541,7 +541,7 @@ public class DisplayAreaTest extends WindowTestsBase {
return new WindowState(mWm, mock(Session.class), new TestIWindow(), token,
null /* parentWindow */, 0 /* appOp */, new WindowManager.LayoutParams(),
View.VISIBLE, 0 /* ownerId */, 0 /* showUserId */,
false /* ownerCanAddInternalSystemWindow */, false /* ownerCanUseBackgroundBlur */);
false /* ownerCanAddInternalSystemWindow */);
}
private WindowToken createWindowToken(int type) {

View File

@@ -340,7 +340,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
final WindowState w = new WindowState(service, session, iWindow, token, parent,
OP_NONE, attrs, VISIBLE, ownerId, userId,
ownerCanAddInternalSystemWindow, false /* ownerCanUseBackgroundBlur */,
ownerCanAddInternalSystemWindow,
powerManagerWrapper);
// TODO: Probably better to make this call in the WindowState ctor to avoid errors with
// adding it to the token...
@@ -1213,8 +1213,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
TestWindowState(WindowManagerService service, Session session, IWindow window,
WindowManager.LayoutParams attrs, WindowToken token) {
super(service, session, window, token, null, OP_NONE, attrs, 0, 0, 0,
false /* ownerCanAddInternalSystemWindow */,
false /* ownerCanUseBackgroundBlur */);
false /* ownerCanAddInternalSystemWindow */);
}
@Override