DeviceConfig: Split android:window_manager into android and window_manager
The keys are split according to whether they affect the system as a whole,
or simply the inner workings of the window manager.
Also encapsulates WindowManagerConstants properly and adds testing.
Bug: 139735771
Test: atest WindowManagerConstantsTest
Change-Id: I67c96a2bdd3140fe2ff9c6832d2d69f2e57115e2
diff --git a/services/core/java/com/android/server/wm/HighRefreshRateBlacklist.java b/services/core/java/com/android/server/wm/HighRefreshRateBlacklist.java
index f3bc217..29b6bc4 100644
--- a/services/core/java/com/android/server/wm/HighRefreshRateBlacklist.java
+++ b/services/core/java/com/android/server/wm/HighRefreshRateBlacklist.java
@@ -27,9 +27,9 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
+import com.android.server.wm.utils.DeviceConfigInterface;
import java.io.PrintWriter;
-import java.util.concurrent.Executor;
/**
* A Blacklist for packages that should force the display out of high refresh rate.
@@ -45,25 +45,7 @@
private OnPropertiesChangedListener mListener = new OnPropertiesChangedListener();
static HighRefreshRateBlacklist create(@NonNull Resources r) {
- return new HighRefreshRateBlacklist(r, new DeviceConfigInterface() {
- @Override
- public @Nullable String getProperty(@NonNull String namespace, @NonNull String name) {
- return DeviceConfig.getProperty(namespace, name);
- }
-
- @Override
- public void addOnPropertiesChangedListener(@NonNull String namespace,
- @NonNull Executor executor,
- @NonNull DeviceConfig.OnPropertiesChangedListener listener) {
- DeviceConfig.addOnPropertiesChangedListener(namespace, executor, listener);
- }
-
- @Override
- public void removePropertiesChangedListener(
- DeviceConfig.OnPropertiesChangedListener listener) {
- DeviceConfig.removeOnPropertiesChangedListener(listener);
- }
- });
+ return new HighRefreshRateBlacklist(r, DeviceConfigInterface.REAL);
}
@VisibleForTesting
@@ -116,19 +98,11 @@
/** Used to prevent WmTests leaking issues. */
@VisibleForTesting
void dispose() {
- mDeviceConfig.removePropertiesChangedListener(mListener);
+ mDeviceConfig.removeOnPropertiesChangedListener(mListener);
mDeviceConfig = null;
mBlacklistedPackages.clear();
}
- interface DeviceConfigInterface {
- @Nullable String getProperty(@NonNull String namespace, @NonNull String name);
- void addOnPropertiesChangedListener(@NonNull String namespace, @NonNull Executor executor,
- @NonNull DeviceConfig.OnPropertiesChangedListener listener);
- void removePropertiesChangedListener(
- @NonNull DeviceConfig.OnPropertiesChangedListener listener);
- }
-
private class OnPropertiesChangedListener implements DeviceConfig.OnPropertiesChangedListener {
public void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) {
updateBlacklist(