summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/test-current.txt2
-rw-r--r--core/java/android/provider/Settings.java14
-rw-r--r--core/java/android/view/IWindowManager.aidl2
-rw-r--r--core/java/android/view/WindowManager.java14
-rw-r--r--core/java/android/view/WindowManagerImpl.java9
-rw-r--r--core/proto/android/providers/settings/global.proto1
-rw-r--r--packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java1
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java3
-rw-r--r--packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java1
-rw-r--r--services/core/java/com/android/server/wm/BlurController.java70
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java5
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerShellCommand.java5
12 files changed, 65 insertions, 62 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index d8c138759cf0..4e929a8067b0 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -2102,6 +2102,7 @@ package android.provider {
field public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
field public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
field public static final String DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW = "enable_non_resizable_multi_window";
+ field public static final String DISABLE_WINDOW_BLURS = "disable_window_blurs";
field public static final String DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD = "dynamic_power_savings_disable_threshold";
field public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
field public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
@@ -2779,7 +2780,6 @@ package android.view {
method public default void holdLock(android.os.IBinder, int);
method public default boolean isTaskSnapshotSupported();
method public default void setDisplayImePolicy(int, int);
- method public default void setForceCrossWindowBlurDisabled(boolean);
method public default void setShouldShowSystemDecors(int, boolean);
method public default void setShouldShowWithInsecureKeyguard(int, boolean);
method public default boolean shouldShowSystemDecors(int);
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f8991ce1e97b..55cdb26214b1 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -83,6 +83,7 @@ import android.util.ArraySet;
import android.util.Log;
import android.util.MemoryIntArray;
import android.view.Display;
+import android.view.Window;
import android.view.WindowManager.LayoutParams;
import com.android.internal.annotations.GuardedBy;
@@ -13372,6 +13373,19 @@ public final class Settings {
public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
/**
+ * Setting to disable cross-window blurs. This includes window blur behind, (see
+ * {@link LayoutParams#setBlurBehindRadius}) and window background blur (see
+ * {@link Window#setBackgroundBlurRadius}).
+ *
+ * The value is a boolean (1 or 0).
+ * @hide
+ */
+ @TestApi
+ @Readable
+ @SuppressLint("NoSettingsProvider")
+ public static final String DISABLE_WINDOW_BLURS = "disable_window_blurs";
+
+ /**
* Scaling factor for activity transition animations.
*
* The value is a float. Setting to 0.0f will disable window animations.
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 88406ffcdf14..cd8248934be7 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -857,7 +857,5 @@ interface IWindowManager
*/
void unregisterCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener);
- void setForceCrossWindowBlurDisabled(boolean disable);
-
boolean isTaskSnapshotSupported();
}
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 60516eb9efd4..c32ab3a2d717 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -908,20 +908,6 @@ public interface WindowManager extends ViewManager {
}
/**
- * Disables cross-window blurs device-wide. This includes window blur behind
- * (see {@link LayoutParams#setBlurBehindRadius}) and window background blur
- * (see {@link Window#setBackgroundBlurRadius}).
- *
- * @param disable specifies whether to disable the blur. Note that calling this
- * with 'disable=false' will not enable blurs if there is something
- * else disabling blurs.
- * @hide
- */
- @TestApi
- default void setForceCrossWindowBlurDisabled(boolean disable) {
- }
-
- /**
* @hide
*/
static String transitTypeToString(@TransitionType int type) {
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index 07eeb034b663..f800991944ac 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -328,15 +328,6 @@ public final class WindowManagerImpl implements WindowManager {
}
@Override
- public void setForceCrossWindowBlurDisabled(boolean disable) {
- try {
- WindowManagerGlobal.getWindowManagerService()
- .setForceCrossWindowBlurDisabled(disable);
- } catch (RemoteException e) {
- }
- }
-
- @Override
public boolean isTaskSnapshotSupported() {
try {
return WindowManagerGlobal.getWindowManagerService().isTaskSnapshotSupported();
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 8ee0e397191c..c3d159659622 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -285,6 +285,7 @@ message GlobalSettingsProto {
// Deprecated, use enable_non_resizable_multi_window
optional SettingProto enable_sizecompat_freeform = 7 [ (android.privacy).dest = DEST_AUTOMATIC, deprecated = true ];
optional SettingProto enable_non_resizable_multi_window = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto disable_window_blurs = 9 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
optional Development development = 39;
diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java
index c0e4df54c560..8f7f1faa4d91 100644
--- a/packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java
+++ b/packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java
@@ -138,6 +138,7 @@ public class GlobalSettingsValidators {
new InclusiveIntegerRangeValidator(
/* first= */Global.ONE_HANDED_KEYGUARD_SIDE_LEFT,
/* last= */Global.ONE_HANDED_KEYGUARD_SIDE_RIGHT));
+ VALIDATORS.put(Global.DISABLE_WINDOW_BLURS, BOOLEAN_VALIDATOR);
}
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 635434b5f7ba..2f54e2124247 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -553,6 +553,9 @@ class SettingsProtoDumpUtil {
dumpSetting(s, p,
Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
GlobalSettingsProto.Development.ENABLE_NON_RESIZABLE_MULTI_WINDOW);
+ dumpSetting(s, p,
+ Settings.Global.DISABLE_WINDOW_BLURS,
+ GlobalSettingsProto.Development.DISABLE_WINDOW_BLURS);
p.end(developmentToken);
final long deviceToken = p.start(GlobalSettingsProto.DEVICE);
diff --git a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
index 150d10db2692..22e38f4008da 100644
--- a/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
+++ b/packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java
@@ -231,6 +231,7 @@ public class SettingsBackupTest {
Settings.Global.DEVELOPMENT_USE_BLAST_ADAPTER_VR,
Settings.Global.DEVELOPMENT_WM_DISPLAY_SETTINGS_PATH,
Settings.Global.DEVICE_DEMO_MODE,
+ Settings.Global.DISABLE_WINDOW_BLURS,
Settings.Global.BATTERY_SAVER_CONSTANTS,
Settings.Global.BATTERY_TIP_CONSTANTS,
Settings.Global.DEFAULT_SM_DP_PLUS,
diff --git a/services/core/java/com/android/server/wm/BlurController.java b/services/core/java/com/android/server/wm/BlurController.java
index d920267bb44d..23c27f85b066 100644
--- a/services/core/java/com/android/server/wm/BlurController.java
+++ b/services/core/java/com/android/server/wm/BlurController.java
@@ -22,10 +22,12 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.database.ContentObserver;
import android.net.ConnectivityManager;
import android.os.PowerManager;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
+import android.provider.Settings;
import android.view.ICrossWindowBlurEnabledListener;
import com.android.internal.annotations.GuardedBy;
@@ -36,7 +38,7 @@ import com.android.internal.annotations.GuardedBy;
* blur enabled state changes.
*/
final class BlurController {
- private final PowerManager mPowerManager;
+ private final Context mContext;
private final RemoteCallbackList<ICrossWindowBlurEnabledListener>
mBlurEnabledListeners = new RemoteCallbackList<>();
// We don't use the WM global lock, because the BlurController is not involved in window
@@ -44,15 +46,11 @@ final class BlurController {
private final Object mLock = new Object();
@GuardedBy("mLock")
boolean mBlurEnabled;
- @GuardedBy("mLock")
- boolean mBlurForceDisabled;
- @GuardedBy("mLock")
- boolean mInBatterySaverMode;
+ private boolean mInPowerSaveMode;
+ private boolean mBlurDisabledSetting;
BlurController(Context context, PowerManager powerManager) {
- mPowerManager = powerManager;
- mInBatterySaverMode = mPowerManager.isPowerSaveMode();
- updateBlurEnabledLocked();
+ mContext = context;
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
filter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
@@ -60,10 +58,30 @@ final class BlurController {
@Override
public void onReceive(Context context, Intent intent) {
if (PowerManager.ACTION_POWER_SAVE_MODE_CHANGED.equals(intent.getAction())) {
- setBatterySaverEnabled(mPowerManager.isPowerSaveMode());
+ // onReceive always gets called on the same thread, so there is no
+ // multi-threaded execution here. Thus, we don't have to hold mLock here.
+ mInPowerSaveMode = powerManager.isPowerSaveMode();
+ updateBlurEnabled();
}
}
}, filter, null, null);
+ mInPowerSaveMode = powerManager.isPowerSaveMode();
+
+ context.getContentResolver().registerContentObserver(
+ Settings.Global.getUriFor(Settings.Global.DISABLE_WINDOW_BLURS), false,
+ new ContentObserver(null) {
+ @Override
+ public void onChange(boolean selfChange) {
+ super.onChange(selfChange);
+ // onChange always gets called on the same thread, so there is no
+ // multi-threaded execution here. Thus, we don't have to hold mLock here.
+ mBlurDisabledSetting = getBlurDisabledSetting();
+ updateBlurEnabled();
+ }
+ });
+ mBlurDisabledSetting = getBlurDisabledSetting();
+
+ updateBlurEnabled();
}
boolean registerCrossWindowBlurEnabledListener(ICrossWindowBlurEnabledListener listener) {
@@ -79,29 +97,16 @@ final class BlurController {
mBlurEnabledListeners.unregister(listener);
}
- void setForceCrossWindowBlurDisabled(boolean disable) {
+ private void updateBlurEnabled() {
synchronized (mLock) {
- mBlurForceDisabled = disable;
- updateBlurEnabledLocked();
- }
-
- }
-
- void setBatterySaverEnabled(boolean enabled) {
- synchronized (mLock) {
- mInBatterySaverMode = enabled;
- updateBlurEnabledLocked();
- }
- }
-
- private void updateBlurEnabledLocked() {
- final boolean newEnabled = CROSS_WINDOW_BLUR_SUPPORTED && !mBlurForceDisabled
- && !mInBatterySaverMode;
- if (mBlurEnabled == newEnabled) {
- return;
+ final boolean newEnabled = CROSS_WINDOW_BLUR_SUPPORTED && !mBlurDisabledSetting
+ && !mInPowerSaveMode;
+ if (mBlurEnabled == newEnabled) {
+ return;
+ }
+ mBlurEnabled = newEnabled;
+ notifyBlurEnabledChangedLocked(newEnabled);
}
- mBlurEnabled = newEnabled;
- notifyBlurEnabledChangedLocked(newEnabled);
}
private void notifyBlurEnabledChangedLocked(boolean enabled) {
@@ -117,4 +122,9 @@ final class BlurController {
}
mBlurEnabledListeners.finishBroadcast();
}
+
+ private boolean getBlurDisabledSetting() {
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, 0) == 1;
+ }
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 58e70f6140fa..482d8e600b2f 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -5553,11 +5553,6 @@ public class WindowManagerService extends IWindowManager.Stub
mBlurController.unregisterCrossWindowBlurEnabledListener(listener);
}
- @Override
- public void setForceCrossWindowBlurDisabled(boolean disable) {
- mBlurController.setForceCrossWindowBlurDisabled(disable);
- }
-
// -------------------------------------------------------------
// Internals
// -------------------------------------------------------------
diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
index 1b578d1d452c..eb8b6f5e06fd 100644
--- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
+++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
@@ -31,6 +31,7 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.ShellCommand;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.Display;
@@ -235,7 +236,9 @@ public class WindowManagerShellCommand extends ShellCommand {
return -1;
}
- mInterface.setForceCrossWindowBlurDisabled(disableBlur);
+ Settings.Global.putInt(mInternal.mContext.getContentResolver(),
+ Settings.Global.DISABLE_WINDOW_BLURS, disableBlur ? 1 : 0);
+
return 0;
}