Merge "[DO NOT MERGE] Move device config high_refresh_rate_blacklist to display_manager" into qt-qpr1-dev

This commit is contained in:
Long Ling
2019-09-04 18:07:57 +00:00
committed by Android (Google) Code Review
4 changed files with 20 additions and 18 deletions

View File

@@ -868,5 +868,16 @@ public final class DisplayManager {
* @hide
*/
String KEY_PEAK_REFRESH_RATE_DEFAULT = "peak_refresh_rate_default";
/**
* Key for controlling which packages are explicitly blocked from running at refresh rates
* higher than 60hz. An app may be added to this list if they exhibit performance issues at
* higher refresh rates.
*
* @see android.provider.DeviceConfig#NAMESPACE_DISPLAY_MANAGER
* @see android.R.array#config_highRefreshRateBlacklist
* @hide
*/
String KEY_HIGH_REFRESH_RATE_BLACKLIST = "high_refresh_rate_blacklist";
}
}

View File

@@ -358,15 +358,6 @@ public final class DeviceConfig {
*/
String KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS =
"system_gesture_exclusion_log_debounce_millis";
/**
* Key for controlling which packages are explicitly blocked from running at refresh rates
* higher than 60hz.
*
* @see android.provider.DeviceConfig#NAMESPACE_WINDOW_MANAGER
* @hide
*/
String KEY_HIGH_REFRESH_RATE_BLACKLIST = "high_refresh_rate_blacklist";
}
private static final Object sLock = new Object();

View File

@@ -16,7 +16,7 @@
package com.android.server.wm;
import static android.provider.DeviceConfig.WindowManager.KEY_HIGH_REFRESH_RATE_BLACKLIST;
import static android.hardware.display.DisplayManager.DeviceConfig.KEY_HIGH_REFRESH_RATE_BLACKLIST;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -58,9 +58,9 @@ class HighRefreshRateBlacklist {
@VisibleForTesting
HighRefreshRateBlacklist(Resources r, DeviceConfigInterface deviceConfig) {
mDefaultBlacklist = r.getStringArray(R.array.config_highRefreshRateBlacklist);
deviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
deviceConfig.addOnPropertyChangedListener(DeviceConfig.NAMESPACE_DISPLAY_MANAGER,
BackgroundThread.getExecutor(), new OnPropertyChangedListener());
final String property = deviceConfig.getProperty(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
final String property = deviceConfig.getProperty(DeviceConfig.NAMESPACE_DISPLAY_MANAGER,
KEY_HIGH_REFRESH_RATE_BLACKLIST);
updateBlacklist(property);
}

View File

@@ -16,7 +16,7 @@
package com.android.server.wm;
import static android.provider.DeviceConfig.WindowManager.KEY_HIGH_REFRESH_RATE_BLACKLIST;
import static android.hardware.display.DisplayManager.DeviceConfig.KEY_HIGH_REFRESH_RATE_BLACKLIST;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -126,9 +126,9 @@ public class HighRefreshRateBlacklistTest {
@Override
public String getProperty(String namespace, String name) {
if (!DeviceConfig.NAMESPACE_WINDOW_MANAGER.equals(namespace)
if (!DeviceConfig.NAMESPACE_DISPLAY_MANAGER.equals(namespace)
|| !KEY_HIGH_REFRESH_RATE_BLACKLIST.equals(name)) {
throw new IllegalArgumentException("Only things in NAMESPACE_WINDOW_MANAGER "
throw new IllegalArgumentException("Only things in NAMESPACE_DISPLAY_MANAGER "
+ "supported.");
}
return mBlacklist;
@@ -138,8 +138,8 @@ public class HighRefreshRateBlacklistTest {
public void addOnPropertyChangedListener(String namespace, Executor executor,
DeviceConfig.OnPropertyChangedListener listener) {
if (!DeviceConfig.NAMESPACE_WINDOW_MANAGER.equals(namespace)) {
throw new IllegalArgumentException("Only things in NAMESPACE_WINDOW_MANAGER "
if (!DeviceConfig.NAMESPACE_DISPLAY_MANAGER.equals(namespace)) {
throw new IllegalArgumentException("Only things in NAMESPACE_DISPLAY_MANAGER "
+ "supported.");
}
mListeners.add(new Pair<>(listener, executor));
@@ -153,7 +153,7 @@ public class HighRefreshRateBlacklistTest {
final Executor executor = listenerInfo.second;
final DeviceConfig.OnPropertyChangedListener listener = listenerInfo.first;
executor.execute(() -> {
listener.onPropertyChanged(DeviceConfig.NAMESPACE_WINDOW_MANAGER,
listener.onPropertyChanged(DeviceConfig.NAMESPACE_DISPLAY_MANAGER,
KEY_HIGH_REFRESH_RATE_BLACKLIST, blacklist);
latch.countDown();
});