diff options
| author | 2023-04-06 01:36:58 +0000 | |
|---|---|---|
| committer | 2023-04-06 01:36:58 +0000 | |
| commit | 7220f21ddd422e5b4d186f060bfd54445b4e7e77 (patch) | |
| tree | 3a1e354c143be936c5474243e1dc3c3ef8c85853 | |
| parent | f3f8e10b3b7d7a2b5d826a70f3de2f6492ae95d3 (diff) | |
| parent | ade43f79e6d4b017b934eb6db2cc545bccf2ee3d (diff) | |
Merge "Explicitly specify thermal throttling type" into udc-dev
15 files changed, 275 insertions, 252 deletions
diff --git a/services/core/java/com/android/server/display/BrightnessThrottler.java b/services/core/java/com/android/server/display/BrightnessThrottler.java index 067a2d6d8b0d..cfdcd636904b 100644 --- a/services/core/java/com/android/server/display/BrightnessThrottler.java +++ b/services/core/java/com/android/server/display/BrightnessThrottler.java @@ -36,8 +36,8 @@ import android.provider.DeviceConfigInterface; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; -import com.android.server.display.DisplayDeviceConfig.BrightnessThrottlingData; -import com.android.server.display.DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel; +import com.android.server.display.DisplayDeviceConfig.ThermalBrightnessThrottlingData; +import com.android.server.display.DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel; import java.io.PrintWriter; import java.util.ArrayList; @@ -69,12 +69,12 @@ class BrightnessThrottler { // Maps the throttling ID to the data. Sourced from DisplayDeviceConfig. @NonNull - private HashMap<String, BrightnessThrottlingData> mDdcThrottlingDataMap; + private HashMap<String, ThermalBrightnessThrottlingData> mDdcThermalThrottlingDataMap; // Current throttling data being used. // Null if we do not support throttling. @Nullable - private BrightnessThrottlingData mThrottlingData; + private ThermalBrightnessThrottlingData mThermalThrottlingData; private float mBrightnessCap = PowerManager.BRIGHTNESS_MAX; private @BrightnessInfo.BrightnessMaxReason int mBrightnessMaxReason = @@ -82,51 +82,53 @@ class BrightnessThrottler { private String mUniqueDisplayId; // The most recent string that has been set from DeviceConfig - private String mBrightnessThrottlingDataString; + private String mThermalBrightnessThrottlingDataString; // The brightness throttling configuration that should be used. - private String mBrightnessThrottlingDataId; + private String mThermalBrightnessThrottlingDataId; // This is a collection of brightness throttling data that has been written as overrides from // the DeviceConfig. This will always take priority over the display device config data. // We need to store the data for every display device, so we do not need to update this each // time the underlying display device changes. // This map is indexed by uniqueDisplayId, to provide maps for throttlingId -> throttlingData. - // HashMap< uniqueDisplayId, HashMap< throttlingDataId, BrightnessThrottlingData >> - private final HashMap<String, HashMap<String, BrightnessThrottlingData>> - mBrightnessThrottlingDataOverride = new HashMap<>(1); + // HashMap< uniqueDisplayId, HashMap< throttlingDataId, ThermalBrightnessThrottlingData >> + private final HashMap<String, HashMap<String, ThermalBrightnessThrottlingData>> + mThermalBrightnessThrottlingDataOverride = new HashMap<>(1); BrightnessThrottler(Handler handler, Runnable throttlingChangeCallback, String uniqueDisplayId, String throttlingDataId, - @NonNull HashMap<String, BrightnessThrottlingData> brightnessThrottlingDataMap) { + @NonNull HashMap<String, ThermalBrightnessThrottlingData> + thermalBrightnessThrottlingDataMap) { this(new Injector(), handler, handler, throttlingChangeCallback, - uniqueDisplayId, throttlingDataId, brightnessThrottlingDataMap); + uniqueDisplayId, throttlingDataId, thermalBrightnessThrottlingDataMap); } @VisibleForTesting BrightnessThrottler(Injector injector, Handler handler, Handler deviceConfigHandler, Runnable throttlingChangeCallback, String uniqueDisplayId, String throttlingDataId, - @NonNull HashMap<String, BrightnessThrottlingData> brightnessThrottlingDataMap) { + @NonNull HashMap<String, ThermalBrightnessThrottlingData> + thermalBrightnessThrottlingDataMap) { mInjector = injector; mHandler = handler; mDeviceConfigHandler = deviceConfigHandler; - mDdcThrottlingDataMap = brightnessThrottlingDataMap; + mDdcThermalThrottlingDataMap = thermalBrightnessThrottlingDataMap; mThrottlingChangeCallback = throttlingChangeCallback; mSkinThermalStatusObserver = new SkinThermalStatusObserver(mInjector, mHandler); mUniqueDisplayId = uniqueDisplayId; mDeviceConfig = injector.getDeviceConfig(); mDeviceConfigListener = new DeviceConfigListener(); - mBrightnessThrottlingDataId = throttlingDataId; - mDdcThrottlingDataMap = brightnessThrottlingDataMap; - loadBrightnessThrottlingDataFromDeviceConfig(); - loadBrightnessThrottlingDataFromDisplayDeviceConfig(mDdcThrottlingDataMap, - mBrightnessThrottlingDataId, mUniqueDisplayId); + mThermalBrightnessThrottlingDataId = throttlingDataId; + mDdcThermalThrottlingDataMap = thermalBrightnessThrottlingDataMap; + loadThermalBrightnessThrottlingDataFromDeviceConfig(); + loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig(mDdcThermalThrottlingDataMap, + mThermalBrightnessThrottlingDataId, mUniqueDisplayId); } boolean deviceSupportsThrottling() { - return mThrottlingData != null; + return mThermalThrottlingData != null; } float getBrightnessCap() { @@ -154,14 +156,14 @@ class BrightnessThrottler { mThrottlingStatus = THROTTLING_INVALID; } - void loadBrightnessThrottlingDataFromDisplayDeviceConfig( - HashMap<String, BrightnessThrottlingData> ddcThrottlingDataMap, + void loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig( + HashMap<String, ThermalBrightnessThrottlingData> ddcThrottlingDataMap, String brightnessThrottlingDataId, String uniqueDisplayId) { - mDdcThrottlingDataMap = ddcThrottlingDataMap; - mBrightnessThrottlingDataId = brightnessThrottlingDataId; + mDdcThermalThrottlingDataMap = ddcThrottlingDataMap; + mThermalBrightnessThrottlingDataId = brightnessThrottlingDataId; mUniqueDisplayId = uniqueDisplayId; - resetThrottlingData(); + resetThermalThrottlingData(); } private float verifyAndConstrainBrightnessCap(float brightness) { @@ -183,11 +185,11 @@ class BrightnessThrottler { private void thermalStatusChanged(@Temperature.ThrottlingStatus int newStatus) { if (mThrottlingStatus != newStatus) { mThrottlingStatus = newStatus; - updateThrottling(); + updateThermalThrottling(); } } - private void updateThrottling() { + private void updateThermalThrottling() { if (!deviceSupportsThrottling()) { return; } @@ -195,9 +197,9 @@ class BrightnessThrottler { float brightnessCap = PowerManager.BRIGHTNESS_MAX; int brightnessMaxReason = BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE; - if (mThrottlingStatus != THROTTLING_INVALID && mThrottlingData != null) { + if (mThrottlingStatus != THROTTLING_INVALID && mThermalThrottlingData != null) { // Throttling levels are sorted by increasing severity - for (ThrottlingLevel level : mThrottlingData.throttlingLevels) { + for (ThrottlingLevel level : mThermalThrottlingData.throttlingLevels) { if (level.thermalStatus <= mThrottlingStatus) { brightnessCap = level.brightness; brightnessMaxReason = BrightnessInfo.BRIGHTNESS_MAX_REASON_THERMAL; @@ -230,21 +232,23 @@ class BrightnessThrottler { private void dumpLocal(PrintWriter pw) { pw.println("BrightnessThrottler:"); - pw.println(" mBrightnessThrottlingDataId=" + mBrightnessThrottlingDataId); - pw.println(" mThrottlingData=" + mThrottlingData); + pw.println(" mThermalBrightnessThrottlingDataId=" + mThermalBrightnessThrottlingDataId); + pw.println(" mThermalThrottlingData=" + mThermalThrottlingData); pw.println(" mUniqueDisplayId=" + mUniqueDisplayId); pw.println(" mThrottlingStatus=" + mThrottlingStatus); pw.println(" mBrightnessCap=" + mBrightnessCap); pw.println(" mBrightnessMaxReason=" + BrightnessInfo.briMaxReasonToString(mBrightnessMaxReason)); - pw.println(" mDdcThrottlingDataMap=" + mDdcThrottlingDataMap); - pw.println(" mBrightnessThrottlingDataOverride=" + mBrightnessThrottlingDataOverride); - pw.println(" mBrightnessThrottlingDataString=" + mBrightnessThrottlingDataString); + pw.println(" mDdcThermalThrottlingDataMap=" + mDdcThermalThrottlingDataMap); + pw.println(" mThermalBrightnessThrottlingDataOverride=" + + mThermalBrightnessThrottlingDataOverride); + pw.println(" mThermalBrightnessThrottlingDataString=" + + mThermalBrightnessThrottlingDataString); mSkinThermalStatusObserver.dump(pw); } - private String getBrightnessThrottlingDataString() { + private String getThermalBrightnessThrottlingDataString() { return mDeviceConfig.getString(DeviceConfig.NAMESPACE_DISPLAY_MANAGER, DisplayManager.DeviceConfig.KEY_BRIGHTNESS_THROTTLING_DATA, /* defaultValue= */ null); @@ -260,7 +264,7 @@ class BrightnessThrottler { // displayId, number, <state, val> * number // displayId, <number, <state, val> * number>, throttlingId private boolean parseAndAddData(@NonNull String strArray, - @NonNull HashMap<String, HashMap<String, BrightnessThrottlingData>> + @NonNull HashMap<String, HashMap<String, ThermalBrightnessThrottlingData>> displayIdToThrottlingIdToBtd) { boolean validConfig = true; String[] items = strArray.split(","); @@ -282,11 +286,11 @@ class BrightnessThrottler { } String throttlingDataId = (i < items.length) ? items[i++] : DEFAULT_ID; - BrightnessThrottlingData throttlingLevelsData = - DisplayDeviceConfig.BrightnessThrottlingData.create(throttlingLevels); + ThermalBrightnessThrottlingData throttlingLevelsData = + DisplayDeviceConfig.ThermalBrightnessThrottlingData.create(throttlingLevels); // Add throttlingLevelsData to inner map where necessary. - HashMap<String, BrightnessThrottlingData> throttlingMapForDisplay = + HashMap<String, ThermalBrightnessThrottlingData> throttlingMapForDisplay = displayIdToThrottlingIdToBtd.get(uniqueDisplayId); if (throttlingMapForDisplay == null) { throttlingMapForDisplay = new HashMap<>(); @@ -311,14 +315,14 @@ class BrightnessThrottler { return validConfig; } - private void loadBrightnessThrottlingDataFromDeviceConfig() { - HashMap<String, HashMap<String, BrightnessThrottlingData>> tempThrottlingData = + private void loadThermalBrightnessThrottlingDataFromDeviceConfig() { + HashMap<String, HashMap<String, ThermalBrightnessThrottlingData>> tempThrottlingData = new HashMap<>(1); - mBrightnessThrottlingDataString = getBrightnessThrottlingDataString(); + mThermalBrightnessThrottlingDataString = getThermalBrightnessThrottlingDataString(); boolean validConfig = true; - mBrightnessThrottlingDataOverride.clear(); - if (mBrightnessThrottlingDataString != null) { - String[] throttlingDataSplits = mBrightnessThrottlingDataString.split(";"); + mThermalBrightnessThrottlingDataOverride.clear(); + if (mThermalBrightnessThrottlingDataString != null) { + String[] throttlingDataSplits = mThermalBrightnessThrottlingDataString.split(";"); for (String s : throttlingDataSplits) { if (!parseAndAddData(s, tempThrottlingData)) { validConfig = false; @@ -327,26 +331,27 @@ class BrightnessThrottler { } if (validConfig) { - mBrightnessThrottlingDataOverride.putAll(tempThrottlingData); + mThermalBrightnessThrottlingDataOverride.putAll(tempThrottlingData); tempThrottlingData.clear(); } } else { - Slog.w(TAG, "DeviceConfig BrightnessThrottlingData is null"); + Slog.w(TAG, "DeviceConfig ThermalBrightnessThrottlingData is null"); } } - private void resetThrottlingData() { + private void resetThermalThrottlingData() { stop(); mDeviceConfigListener.startListening(); // Get throttling data for this id, if it exists - mThrottlingData = getConfigFromId(mBrightnessThrottlingDataId); + mThermalThrottlingData = getConfigFromId(mThermalBrightnessThrottlingDataId); // Fallback to default id otherwise. - if (!DEFAULT_ID.equals(mBrightnessThrottlingDataId) && mThrottlingData == null) { - mThrottlingData = getConfigFromId(DEFAULT_ID); + if (!DEFAULT_ID.equals(mThermalBrightnessThrottlingDataId) + && mThermalThrottlingData == null) { + mThermalThrottlingData = getConfigFromId(DEFAULT_ID); Slog.d(TAG, "Falling back to default throttling Id"); } @@ -355,17 +360,17 @@ class BrightnessThrottler { } } - private BrightnessThrottlingData getConfigFromId(String id) { - BrightnessThrottlingData returnValue; + private ThermalBrightnessThrottlingData getConfigFromId(String id) { + ThermalBrightnessThrottlingData returnValue; // Fallback pattern for fetching correct throttling data for this display and id. // 1) throttling data from device config for this throttling data id - returnValue = mBrightnessThrottlingDataOverride.get(mUniqueDisplayId) == null + returnValue = mThermalBrightnessThrottlingDataOverride.get(mUniqueDisplayId) == null ? null - : mBrightnessThrottlingDataOverride.get(mUniqueDisplayId).get(id); + : mThermalBrightnessThrottlingDataOverride.get(mUniqueDisplayId).get(id); // 2) throttling data from ddc for this throttling data id returnValue = returnValue == null - ? mDdcThrottlingDataMap.get(id) + ? mDdcThermalThrottlingDataMap.get(id) : returnValue; return returnValue; @@ -391,8 +396,8 @@ class BrightnessThrottler { @Override public void onPropertiesChanged(DeviceConfig.Properties properties) { - loadBrightnessThrottlingDataFromDeviceConfig(); - resetThrottlingData(); + loadThermalBrightnessThrottlingDataFromDeviceConfig(); + resetThermalThrottlingData(); } } diff --git a/services/core/java/com/android/server/display/DisplayDeviceConfig.java b/services/core/java/com/android/server/display/DisplayDeviceConfig.java index da021158eb65..a021174e3031 100644 --- a/services/core/java/com/android/server/display/DisplayDeviceConfig.java +++ b/services/core/java/com/android/server/display/DisplayDeviceConfig.java @@ -687,8 +687,8 @@ public class DisplayDeviceConfig { private int[] mHighDisplayBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS; private int[] mHighAmbientBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS; - private final HashMap<String, BrightnessThrottlingData> - mBrightnessThrottlingDataMapByThrottlingId = new HashMap<>(); + private final HashMap<String, ThermalBrightnessThrottlingData> + mThermalBrightnessThrottlingDataMapByThrottlingId = new HashMap<>(); private final Map<String, SparseArray<SurfaceControl.RefreshRateRange>> mRefreshRateThrottlingMap = new HashMap<>(); @@ -1348,9 +1348,9 @@ public class DisplayDeviceConfig { /** * @return brightness throttling configuration data for this display, for each throttling id. */ - public HashMap<String, BrightnessThrottlingData> - getBrightnessThrottlingDataMapByThrottlingId() { - return mBrightnessThrottlingDataMapByThrottlingId; + public HashMap<String, ThermalBrightnessThrottlingData> + getThermalBrightnessThrottlingDataMapByThrottlingId() { + return mThermalBrightnessThrottlingDataMapByThrottlingId; } /** @@ -1358,7 +1358,7 @@ public class DisplayDeviceConfig { * @return refresh rate throttling configuration */ @Nullable - public SparseArray<SurfaceControl.RefreshRateRange> getRefreshRateThrottlingData( + public SparseArray<SurfaceControl.RefreshRateRange> getThermalRefreshRateThrottlingData( @Nullable String id) { String key = id == null ? DEFAULT_ID : id; return mRefreshRateThrottlingMap.get(key); @@ -1525,8 +1525,8 @@ public class DisplayDeviceConfig { + ", isHbmEnabled=" + mIsHighBrightnessModeEnabled + ", mHbmData=" + mHbmData + ", mSdrToHdrRatioSpline=" + mSdrToHdrRatioSpline - + ", mBrightnessThrottlingDataMapByThrottlingId=" - + mBrightnessThrottlingDataMapByThrottlingId + + ", mThermalBrightnessThrottlingDataMapByThrottlingId=" + + mThermalBrightnessThrottlingDataMapByThrottlingId + "\n" + ", mBrightnessRampFastDecrease=" + mBrightnessRampFastDecrease + ", mBrightnessRampFastIncrease=" + mBrightnessRampFastIncrease @@ -1887,11 +1887,11 @@ public class DisplayDeviceConfig { Slog.i(TAG, "No thermal throttling config found"); return; } - loadBrightnessThrottlingMaps(throttlingConfig); - loadRefreshRateThermalThrottlingMap(throttlingConfig); + loadThermalBrightnessThrottlingMaps(throttlingConfig); + loadThermalRefreshRateThrottlingMap(throttlingConfig); } - private void loadBrightnessThrottlingMaps(ThermalThrottling throttlingConfig) { + private void loadThermalBrightnessThrottlingMaps(ThermalThrottling throttlingConfig) { final List<BrightnessThrottlingMap> maps = throttlingConfig.getBrightnessThrottlingMap(); if (maps == null || maps.isEmpty()) { Slog.i(TAG, "No brightness throttling map found"); @@ -1901,7 +1901,7 @@ public class DisplayDeviceConfig { for (BrightnessThrottlingMap map : maps) { final List<BrightnessThrottlingPoint> points = map.getBrightnessThrottlingPoint(); // At least 1 point is guaranteed by the display device config schema - List<BrightnessThrottlingData.ThrottlingLevel> throttlingLevels = + List<ThermalBrightnessThrottlingData.ThrottlingLevel> throttlingLevels = new ArrayList<>(points.size()); boolean badConfig = false; @@ -1912,24 +1912,24 @@ public class DisplayDeviceConfig { break; } - throttlingLevels.add(new BrightnessThrottlingData.ThrottlingLevel( + throttlingLevels.add(new ThermalBrightnessThrottlingData.ThrottlingLevel( convertThermalStatus(status), point.getBrightness().floatValue())); } if (!badConfig) { String id = map.getId() == null ? DEFAULT_ID : map.getId(); - if (mBrightnessThrottlingDataMapByThrottlingId.containsKey(id)) { + if (mThermalBrightnessThrottlingDataMapByThrottlingId.containsKey(id)) { throw new RuntimeException("Brightness throttling data with ID " + id + " already exists"); } - mBrightnessThrottlingDataMapByThrottlingId.put(id, - BrightnessThrottlingData.create(throttlingLevels)); + mThermalBrightnessThrottlingDataMapByThrottlingId.put(id, + ThermalBrightnessThrottlingData.create(throttlingLevels)); } } } - private void loadRefreshRateThermalThrottlingMap(ThermalThrottling throttlingConfig) { + private void loadThermalRefreshRateThrottlingMap(ThermalThrottling throttlingConfig) { List<RefreshRateThrottlingMap> maps = throttlingConfig.getRefreshRateThrottlingMap(); if (maps == null || maps.isEmpty()) { Slog.w(TAG, "RefreshRateThrottling: map not found"); @@ -3039,7 +3039,7 @@ public class DisplayDeviceConfig { /** * Container for brightness throttling data. */ - public static class BrightnessThrottlingData { + public static class ThermalBrightnessThrottlingData { public List<ThrottlingLevel> throttlingLevels; static class ThrottlingLevel { @@ -3080,7 +3080,8 @@ public class DisplayDeviceConfig { /** * Creates multiple temperature based throttling levels of brightness */ - public static BrightnessThrottlingData create(List<ThrottlingLevel> throttlingLevels) { + public static ThermalBrightnessThrottlingData create( + List<ThrottlingLevel> throttlingLevels) { if (throttlingLevels == null || throttlingLevels.size() == 0) { Slog.e(TAG, "BrightnessThrottlingData received null or empty throttling levels"); return null; @@ -3118,12 +3119,12 @@ public class DisplayDeviceConfig { } } - return new BrightnessThrottlingData(throttlingLevels); + return new ThermalBrightnessThrottlingData(throttlingLevels); } @Override public String toString() { - return "BrightnessThrottlingData{" + return "ThermalBrightnessThrottlingData{" + "throttlingLevels:" + throttlingLevels + "} "; } @@ -3134,12 +3135,12 @@ public class DisplayDeviceConfig { return true; } - if (!(obj instanceof BrightnessThrottlingData)) { + if (!(obj instanceof ThermalBrightnessThrottlingData)) { return false; } - BrightnessThrottlingData otherBrightnessThrottlingData = (BrightnessThrottlingData) obj; - return throttlingLevels.equals(otherBrightnessThrottlingData.throttlingLevels); + ThermalBrightnessThrottlingData otherData = (ThermalBrightnessThrottlingData) obj; + return throttlingLevels.equals(otherData.throttlingLevels); } @Override @@ -3148,7 +3149,7 @@ public class DisplayDeviceConfig { } @VisibleForTesting - BrightnessThrottlingData(List<ThrottlingLevel> inLevels) { + ThermalBrightnessThrottlingData(List<ThrottlingLevel> inLevels) { throttlingLevels = new ArrayList<>(inLevels.size()); for (ThrottlingLevel level : inLevels) { throttlingLevels.add(new ThrottlingLevel(level.thermalStatus, level.brightness)); diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 2322e03d6d37..5e3990ac7167 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -515,8 +515,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call private boolean mIsEnabled; private boolean mIsInTransition; - // The id of the brightness throttling policy that should be used. - private String mBrightnessThrottlingDataId; + // The id of the thermal brightness throttling policy that should be used. + private String mThermalBrightnessThrottlingDataId; // DPCs following the brightness of this DPC. This is used in concurrent displays mode - there // is one lead display, the additional displays follow the brightness value of the lead display. @@ -556,7 +556,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mHandler = new DisplayControllerHandler(handler.getLooper()); mLastBrightnessEvent = new BrightnessEvent(mDisplayId); mTempBrightnessEvent = new BrightnessEvent(mDisplayId); - mBrightnessThrottlingDataId = logicalDisplay.getBrightnessThrottlingDataIdLocked(); + mThermalBrightnessThrottlingDataId = + logicalDisplay.getThermalBrightnessThrottlingDataIdLocked(); if (mDisplayId == Display.DEFAULT_DISPLAY) { mBatteryStats = BatteryStatsService.getService(); @@ -891,8 +892,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked(); final boolean isEnabled = mLogicalDisplay.isEnabledLocked(); final boolean isInTransition = mLogicalDisplay.isInTransitionLocked(); - final String brightnessThrottlingDataId = - mLogicalDisplay.getBrightnessThrottlingDataIdLocked(); + final String thermalBrightnessThrottlingDataId = + mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked(); mHandler.postAtTime(() -> { boolean changed = false; if (mDisplayDevice != device) { @@ -901,7 +902,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mUniqueDisplayId = uniqueId; mDisplayStatsId = mUniqueDisplayId.hashCode(); mDisplayDeviceConfig = config; - mBrightnessThrottlingDataId = brightnessThrottlingDataId; + mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId; loadFromDisplayDeviceConfig(token, info, hbmMetadata); loadNitBasedBrightnessSetting(); @@ -909,12 +910,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call // last command that was sent to change it's state. Let's assume it is unknown so // that we trigger a change immediately. mPowerState.resetScreenState(); - } else if (!mBrightnessThrottlingDataId.equals(brightnessThrottlingDataId)) { + } else if ( + !mThermalBrightnessThrottlingDataId.equals(thermalBrightnessThrottlingDataId)) { changed = true; - mBrightnessThrottlingDataId = brightnessThrottlingDataId; - mBrightnessThrottler.loadBrightnessThrottlingDataFromDisplayDeviceConfig( - config.getBrightnessThrottlingDataMapByThrottlingId(), - mBrightnessThrottlingDataId, + mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId; + mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig( + config.getThermalBrightnessThrottlingDataMapByThrottlingId(), + mThermalBrightnessThrottlingDataId, mUniqueDisplayId); } if (mIsEnabled != isEnabled || mIsInTransition != isInTransition) { @@ -983,9 +985,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call sdrBrightness, maxDesiredHdrSdrRatio); } }); - mBrightnessThrottler.loadBrightnessThrottlingDataFromDisplayDeviceConfig( - mDisplayDeviceConfig.getBrightnessThrottlingDataMapByThrottlingId(), - mBrightnessThrottlingDataId, mUniqueDisplayId); + mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig( + mDisplayDeviceConfig.getThermalBrightnessThrottlingDataMapByThrottlingId(), + mThermalBrightnessThrottlingDataId, mUniqueDisplayId); } private void sendUpdatePowerState() { @@ -2121,8 +2123,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call () -> { sendUpdatePowerState(); postBrightnessChangeRunnable(); - }, mUniqueDisplayId, mLogicalDisplay.getBrightnessThrottlingDataIdLocked(), - ddConfig.getBrightnessThrottlingDataMapByThrottlingId()); + }, mUniqueDisplayId, mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked(), + ddConfig.getThermalBrightnessThrottlingDataMapByThrottlingId()); } private void blockScreenOn() { diff --git a/services/core/java/com/android/server/display/DisplayPowerController2.java b/services/core/java/com/android/server/display/DisplayPowerController2.java index d2af88b1c6c9..23e606c028ac 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController2.java +++ b/services/core/java/com/android/server/display/DisplayPowerController2.java @@ -400,8 +400,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal private boolean mIsEnabled; private boolean mIsInTransition; - // The id of the brightness throttling policy that should be used. - private String mBrightnessThrottlingDataId; + // The id of the thermal brightness throttling policy that should be used. + private String mThermalBrightnessThrottlingDataId; // DPCs following the brightness of this DPC. This is used in concurrent displays mode - there // is one lead display, the additional displays follow the brightness value of the lead display. @@ -439,7 +439,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal mDisplayStateController = new DisplayStateController(mDisplayPowerProximityStateController); mAutomaticBrightnessStrategy = new AutomaticBrightnessStrategy(context, mDisplayId); mTag = "DisplayPowerController2[" + mDisplayId + "]"; - mBrightnessThrottlingDataId = logicalDisplay.getBrightnessThrottlingDataIdLocked(); + mThermalBrightnessThrottlingDataId = + logicalDisplay.getThermalBrightnessThrottlingDataIdLocked(); mDisplayDevice = mLogicalDisplay.getPrimaryDisplayDeviceLocked(); mUniqueDisplayId = logicalDisplay.getPrimaryDisplayDeviceLocked().getUniqueId(); @@ -707,8 +708,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked(); final boolean isEnabled = mLogicalDisplay.isEnabledLocked(); final boolean isInTransition = mLogicalDisplay.isInTransitionLocked(); - final String brightnessThrottlingDataId = - mLogicalDisplay.getBrightnessThrottlingDataIdLocked(); + final String thermalBrightnessThrottlingDataId = + mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked(); mHandler.postAtTime(() -> { boolean changed = false; @@ -718,7 +719,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal mUniqueDisplayId = uniqueId; mDisplayStatsId = mUniqueDisplayId.hashCode(); mDisplayDeviceConfig = config; - mBrightnessThrottlingDataId = brightnessThrottlingDataId; + mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId; loadFromDisplayDeviceConfig(token, info, hbmMetadata); mDisplayPowerProximityStateController.notifyDisplayDeviceChanged(config); @@ -726,12 +727,13 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal // last command that was sent to change it's state. Let's assume it is unknown so // that we trigger a change immediately. mPowerState.resetScreenState(); - } else if (!mBrightnessThrottlingDataId.equals(brightnessThrottlingDataId)) { + } else if ( + !mThermalBrightnessThrottlingDataId.equals(thermalBrightnessThrottlingDataId)) { changed = true; - mBrightnessThrottlingDataId = brightnessThrottlingDataId; - mBrightnessThrottler.loadBrightnessThrottlingDataFromDisplayDeviceConfig( - config.getBrightnessThrottlingDataMapByThrottlingId(), - mBrightnessThrottlingDataId, + mThermalBrightnessThrottlingDataId = thermalBrightnessThrottlingDataId; + mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig( + config.getThermalBrightnessThrottlingDataMapByThrottlingId(), + mThermalBrightnessThrottlingDataId, mUniqueDisplayId); } if (mIsEnabled != isEnabled || mIsInTransition != isInTransition) { @@ -797,9 +799,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal sdrBrightness, maxDesiredHdrSdrRatio); } }); - mBrightnessThrottler.loadBrightnessThrottlingDataFromDisplayDeviceConfig( - mDisplayDeviceConfig.getBrightnessThrottlingDataMapByThrottlingId(), - mBrightnessThrottlingDataId, mUniqueDisplayId); + mBrightnessThrottler.loadThermalBrightnessThrottlingDataFromDisplayDeviceConfig( + mDisplayDeviceConfig.getThermalBrightnessThrottlingDataMapByThrottlingId(), + mThermalBrightnessThrottlingDataId, mUniqueDisplayId); } private void sendUpdatePowerState() { @@ -1762,8 +1764,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal () -> { sendUpdatePowerState(); postBrightnessChangeRunnable(); - }, mUniqueDisplayId, mLogicalDisplay.getBrightnessThrottlingDataIdLocked(), - ddConfig.getBrightnessThrottlingDataMapByThrottlingId()); + }, mUniqueDisplayId, mLogicalDisplay.getThermalBrightnessThrottlingDataIdLocked(), + ddConfig.getThermalBrightnessThrottlingDataMapByThrottlingId()); } private void blockScreenOn() { diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java index dee4cdea65fe..dab00d8070d4 100644 --- a/services/core/java/com/android/server/display/LogicalDisplay.java +++ b/services/core/java/com/android/server/display/LogicalDisplay.java @@ -175,11 +175,11 @@ final class LogicalDisplay { private boolean mDirty = false; /** - * The ID of the brightness throttling data that should be used. This can change e.g. in - * concurrent displays mode in which a stricter brightness throttling policy might need to be - * used. + * The ID of the thermal brightness throttling data that should be used. This can change e.g. + * in concurrent displays mode in which a stricter brightness throttling policy might need to + * be used. */ - private String mBrightnessThrottlingDataId; + private String mThermalBrightnessThrottlingDataId; public LogicalDisplay(int displayId, int layerStack, DisplayDevice primaryDisplayDevice) { mDisplayId = displayId; @@ -189,7 +189,7 @@ final class LogicalDisplay { mTempFrameRateOverride = new SparseArray<>(); mIsEnabled = true; mIsInTransition = false; - mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_ID; + mThermalBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_ID; } public void setDevicePositionLocked(int position) { @@ -349,7 +349,7 @@ final class LogicalDisplay { * * @param refreshRanges new refreshRateThermalThrottling ranges limited by layout or default */ - public void updateRefreshRateThermalThrottling( + public void updateThermalRefreshRateThrottling( @Nullable SparseArray<SurfaceControl.RefreshRateRange> refreshRanges) { if (refreshRanges == null) { refreshRanges = new SparseArray<>(); @@ -872,16 +872,16 @@ final class LogicalDisplay { /** * @return The ID of the brightness throttling data that this display should use. */ - public String getBrightnessThrottlingDataIdLocked() { - return mBrightnessThrottlingDataId; + public String getThermalBrightnessThrottlingDataIdLocked() { + return mThermalBrightnessThrottlingDataId; } /** * @param brightnessThrottlingDataId The ID of the brightness throttling data that this * display should use. */ - public void setBrightnessThrottlingDataIdLocked(String brightnessThrottlingDataId) { - mBrightnessThrottlingDataId = + public void setThermalBrightnessThrottlingDataIdLocked(String brightnessThrottlingDataId) { + mThermalBrightnessThrottlingDataId = brightnessThrottlingDataId; } @@ -950,7 +950,7 @@ final class LogicalDisplay { pw.println("mFrameRateOverrides=" + Arrays.toString(mFrameRateOverrides)); pw.println("mPendingFrameRateOverrideUids=" + mPendingFrameRateOverrideUids); pw.println("mDisplayGroupName=" + mDisplayGroupName); - pw.println("mBrightnessThrottlingDataId=" + mBrightnessThrottlingDataId); + pw.println("mThermalBrightnessThrottlingDataId=" + mThermalBrightnessThrottlingDataId); pw.println("mLeadDisplayId=" + mLeadDisplayId); } diff --git a/services/core/java/com/android/server/display/LogicalDisplayMapper.java b/services/core/java/com/android/server/display/LogicalDisplayMapper.java index 424eedc876ec..254441c2aa13 100644 --- a/services/core/java/com/android/server/display/LogicalDisplayMapper.java +++ b/services/core/java/com/android/server/display/LogicalDisplayMapper.java @@ -1022,17 +1022,17 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { newDisplay.updateLayoutLimitedRefreshRateLocked( config.getRefreshRange(displayLayout.getRefreshRateZoneId()) ); - newDisplay.updateRefreshRateThermalThrottling( - config.getRefreshRateThrottlingData( + newDisplay.updateThermalRefreshRateThrottling( + config.getThermalRefreshRateThrottlingData( displayLayout.getRefreshRateThermalThrottlingMapId() ) ); setEnabledLocked(newDisplay, displayLayout.isEnabled()); - newDisplay.setBrightnessThrottlingDataIdLocked( - displayLayout.getBrightnessThrottlingMapId() == null + newDisplay.setThermalBrightnessThrottlingDataIdLocked( + displayLayout.getThermalBrightnessThrottlingMapId() == null ? DisplayDeviceConfig.DEFAULT_ID - : displayLayout.getBrightnessThrottlingMapId()); + : displayLayout.getThermalBrightnessThrottlingMapId()); newDisplay.setDisplayGroupNameLocked(displayLayout.getDisplayGroupName()); } diff --git a/services/core/java/com/android/server/display/layout/Layout.java b/services/core/java/com/android/server/display/layout/Layout.java index 634f31d6268c..b55d7d5d9d3c 100644 --- a/services/core/java/com/android/server/display/layout/Layout.java +++ b/services/core/java/com/android/server/display/layout/Layout.java @@ -234,11 +234,11 @@ public class Layout { // {@link DeviceStateToLayoutMap.POSITION_UNKNOWN} is unspecified. private final int mPosition; - // The ID of the brightness throttling map that should be used. This can change e.g. in - // concurrent displays mode in which a stricter brightness throttling policy might need to - // be used. + // The ID of the thermal brightness throttling map that should be used. This can change + // e.g. in concurrent displays mode in which a stricter brightness throttling policy might + // need to be used. @Nullable - private final String mBrightnessThrottlingMapId; + private final String mThermalBrightnessThrottlingMapId; // The ID of the lead display that this display will follow in a layout. -1 means no lead. private final int mLeadDisplayId; @@ -248,7 +248,7 @@ public class Layout { private final String mRefreshRateZoneId; @Nullable - private final String mRefreshRateThermalThrottlingMapId; + private final String mThermalRefreshRateThrottlingMapId; private Display(@NonNull DisplayAddress address, int logicalDisplayId, boolean isEnabled, @NonNull String displayGroupName, String brightnessThrottlingMapId, int position, @@ -259,9 +259,9 @@ public class Layout { mIsEnabled = isEnabled; mDisplayGroupName = displayGroupName; mPosition = position; - mBrightnessThrottlingMapId = brightnessThrottlingMapId; + mThermalBrightnessThrottlingMapId = brightnessThrottlingMapId; mRefreshRateZoneId = refreshRateZoneId; - mRefreshRateThermalThrottlingMapId = refreshRateThermalThrottlingMapId; + mThermalRefreshRateThrottlingMapId = refreshRateThermalThrottlingMapId; mLeadDisplayId = leadDisplayId; } @@ -273,10 +273,10 @@ public class Layout { + ", displayGroupName: " + mDisplayGroupName + ", addr: " + mAddress + ((mPosition == POSITION_UNKNOWN) ? "" : ", position: " + mPosition) - + ", brightnessThrottlingMapId: " + mBrightnessThrottlingMapId + + ", mThermalBrightnessThrottlingMapId: " + mThermalBrightnessThrottlingMapId + ", mRefreshRateZoneId: " + mRefreshRateZoneId + ", mLeadDisplayId: " + mLeadDisplayId - + ", mRefreshRateThermalThrottlingMapId: " + mRefreshRateThermalThrottlingMapId + + ", mThermalRefreshRateThrottlingMapId: " + mThermalRefreshRateThrottlingMapId + "}"; } @@ -293,12 +293,12 @@ public class Layout { && otherDisplay.mLogicalDisplayId == this.mLogicalDisplayId && this.mDisplayGroupName.equals(otherDisplay.mDisplayGroupName) && this.mAddress.equals(otherDisplay.mAddress) - && Objects.equals(mBrightnessThrottlingMapId, - otherDisplay.mBrightnessThrottlingMapId) + && Objects.equals(mThermalBrightnessThrottlingMapId, + otherDisplay.mThermalBrightnessThrottlingMapId) && Objects.equals(otherDisplay.mRefreshRateZoneId, this.mRefreshRateZoneId) && this.mLeadDisplayId == otherDisplay.mLeadDisplayId - && Objects.equals(mRefreshRateThermalThrottlingMapId, - otherDisplay.mRefreshRateThermalThrottlingMapId); + && Objects.equals(mThermalRefreshRateThrottlingMapId, + otherDisplay.mThermalRefreshRateThrottlingMapId); } @Override @@ -309,10 +309,10 @@ public class Layout { result = 31 * result + mLogicalDisplayId; result = 31 * result + mDisplayGroupName.hashCode(); result = 31 * result + mAddress.hashCode(); - result = 31 * result + mBrightnessThrottlingMapId.hashCode(); + result = 31 * result + mThermalBrightnessThrottlingMapId.hashCode(); result = 31 * result + Objects.hashCode(mRefreshRateZoneId); result = 31 * result + mLeadDisplayId; - result = 31 * result + Objects.hashCode(mRefreshRateThermalThrottlingMapId); + result = 31 * result + Objects.hashCode(mThermalRefreshRateThrottlingMapId); return result; } @@ -338,12 +338,12 @@ public class Layout { } /** - * Gets the id of the brightness throttling map that should be used. - * @return The ID of the brightness throttling map that this display should use, null if - * unspecified, will fall back to default. + * Gets the id of the thermal brightness throttling map that should be used. + * @return The ID of the thermal brightness throttling map that this display should use, + * null if unspecified, will fall back to default. */ - public String getBrightnessThrottlingMapId() { - return mBrightnessThrottlingMapId; + public String getThermalBrightnessThrottlingMapId() { + return mThermalBrightnessThrottlingMapId; } /** @@ -361,7 +361,7 @@ public class Layout { } public String getRefreshRateThermalThrottlingMapId() { - return mRefreshRateThermalThrottlingMapId; + return mThermalRefreshRateThrottlingMapId; } } } diff --git a/services/core/java/com/android/server/display/mode/SkinThermalStatusObserver.java b/services/core/java/com/android/server/display/mode/SkinThermalStatusObserver.java index f93d9ee55d30..c04735d8f7e2 100644 --- a/services/core/java/com/android/server/display/mode/SkinThermalStatusObserver.java +++ b/services/core/java/com/android/server/display/mode/SkinThermalStatusObserver.java @@ -102,7 +102,7 @@ final class SkinThermalStatusObserver extends IThermalEventListener.Stub impleme //region DisplayManager.DisplayListener @Override public void onDisplayAdded(int displayId) { - updateRefreshRateThermalThrottling(displayId); + updateThermalRefreshRateThrottling(displayId); if (mLoggingEnabled) { Slog.d(TAG, "Display added:" + displayId); } @@ -122,7 +122,7 @@ final class SkinThermalStatusObserver extends IThermalEventListener.Stub impleme @Override public void onDisplayChanged(int displayId) { - updateRefreshRateThermalThrottling(displayId); + updateThermalRefreshRateThrottling(displayId); if (mLoggingEnabled) { Slog.d(TAG, "Display changed:" + displayId); } @@ -150,7 +150,7 @@ final class SkinThermalStatusObserver extends IThermalEventListener.Stub impleme } } - private void updateRefreshRateThermalThrottling(int displayId) { + private void updateThermalRefreshRateThrottling(int displayId) { DisplayInfo displayInfo = new DisplayInfo(); mInjector.getDisplayInfo(displayId, displayInfo); SparseArray<SurfaceControl.RefreshRateRange> throttlingMap = diff --git a/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerController2Test.java b/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerController2Test.java index fc503b7a749b..45fefe477f8a 100644 --- a/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerController2Test.java +++ b/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerController2Test.java @@ -804,7 +804,7 @@ public final class DisplayPowerController2Test { when(logicalDisplayMock.getDisplayInfoLocked()).thenReturn(info); when(logicalDisplayMock.isEnabledLocked()).thenReturn(isEnabled); when(logicalDisplayMock.isInTransitionLocked()).thenReturn(false); - when(logicalDisplayMock.getBrightnessThrottlingDataIdLocked()).thenReturn( + when(logicalDisplayMock.getThermalBrightnessThrottlingDataIdLocked()).thenReturn( DisplayDeviceConfig.DEFAULT_ID); when(displayDeviceMock.getDisplayDeviceInfoLocked()).thenReturn(deviceInfo); when(displayDeviceMock.getUniqueId()).thenReturn(uniqueId); diff --git a/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerControllerTest.java index c021ef65a291..d9133a441aff 100644 --- a/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerControllerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/display/DisplayPowerControllerTest.java @@ -809,7 +809,7 @@ public final class DisplayPowerControllerTest { when(logicalDisplayMock.getDisplayInfoLocked()).thenReturn(info); when(logicalDisplayMock.isEnabledLocked()).thenReturn(isEnabled); when(logicalDisplayMock.isInTransitionLocked()).thenReturn(false); - when(logicalDisplayMock.getBrightnessThrottlingDataIdLocked()).thenReturn( + when(logicalDisplayMock.getThermalBrightnessThrottlingDataIdLocked()).thenReturn( DisplayDeviceConfig.DEFAULT_ID); when(displayDeviceMock.getDisplayDeviceInfoLocked()).thenReturn(deviceInfo); when(displayDeviceMock.getUniqueId()).thenReturn(uniqueId); diff --git a/services/tests/servicestests/src/com/android/server/display/BrightnessThrottlerTest.java b/services/tests/servicestests/src/com/android/server/display/BrightnessThrottlerTest.java index ce4b438470df..46956d74cc5c 100644 --- a/services/tests/servicestests/src/com/android/server/display/BrightnessThrottlerTest.java +++ b/services/tests/servicestests/src/com/android/server/display/BrightnessThrottlerTest.java @@ -41,8 +41,8 @@ import androidx.test.runner.AndroidJUnit4; import com.android.internal.os.BackgroundThread; import com.android.server.display.BrightnessThrottler.Injector; -import com.android.server.display.DisplayDeviceConfig.BrightnessThrottlingData; -import com.android.server.display.DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel; +import com.android.server.display.DisplayDeviceConfig.ThermalBrightnessThrottlingData; +import com.android.server.display.DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel; import com.android.server.display.mode.DisplayModeDirectorTest; import org.junit.Before; @@ -93,7 +93,7 @@ public class BrightnessThrottlerTest { ///////////////// @Test - public void testBrightnessThrottlingData() { + public void testThermalBrightnessThrottlingData() { List<ThrottlingLevel> singleLevel = new ArrayList<>(); singleLevel.add(new ThrottlingLevel(PowerManager.THERMAL_STATUS_CRITICAL, 0.25f)); @@ -120,32 +120,32 @@ public class BrightnessThrottlerTest { PowerManager.BRIGHTNESS_MAX + EPSILON)); // Test invalid data - BrightnessThrottlingData data; - data = BrightnessThrottlingData.create((List<ThrottlingLevel>)null); + ThermalBrightnessThrottlingData data; + data = ThermalBrightnessThrottlingData.create((List<ThrottlingLevel>) null); assertEquals(data, null); - data = BrightnessThrottlingData.create(new ArrayList<ThrottlingLevel>()); + data = ThermalBrightnessThrottlingData.create(new ArrayList<ThrottlingLevel>()); assertEquals(data, null); - data = BrightnessThrottlingData.create(unsortedThermalLevels); + data = ThermalBrightnessThrottlingData.create(unsortedThermalLevels); assertEquals(data, null); - data = BrightnessThrottlingData.create(unsortedBrightnessLevels); + data = ThermalBrightnessThrottlingData.create(unsortedBrightnessLevels); assertEquals(data, null); - data = BrightnessThrottlingData.create(unsortedLevels); + data = ThermalBrightnessThrottlingData.create(unsortedLevels); assertEquals(data, null); - data = BrightnessThrottlingData.create(invalidLevel); + data = ThermalBrightnessThrottlingData.create(invalidLevel); assertEquals(data, null); // Test valid data - data = BrightnessThrottlingData.create(singleLevel); + data = ThermalBrightnessThrottlingData.create(singleLevel); assertNotEquals(data, null); assertThrottlingLevelsEquals(singleLevel, data.throttlingLevels); - data = BrightnessThrottlingData.create(validLevels); + data = ThermalBrightnessThrottlingData.create(validLevels); assertNotEquals(data, null); assertThrottlingLevelsEquals(validLevels, data.throttlingLevels); } @Test - public void testThrottlingUnsupported() { + public void testThermalThrottlingUnsupported() { final BrightnessThrottler throttler = createThrottlerUnsupported(); assertFalse(throttler.deviceSupportsThrottling()); @@ -157,13 +157,13 @@ public class BrightnessThrottlerTest { } @Test - public void testThrottlingSingleLevel() throws Exception { + public void testThermalThrottlingSingleLevel() throws Exception { final ThrottlingLevel level = new ThrottlingLevel(PowerManager.THERMAL_STATUS_CRITICAL, 0.25f); List<ThrottlingLevel> levels = new ArrayList<>(); levels.add(level); - final BrightnessThrottlingData data = BrightnessThrottlingData.create(levels); + final ThermalBrightnessThrottlingData data = ThermalBrightnessThrottlingData.create(levels); final BrightnessThrottler throttler = createThrottlerSupported(data); assertTrue(throttler.deviceSupportsThrottling()); @@ -212,7 +212,7 @@ public class BrightnessThrottlerTest { } @Test - public void testThrottlingMultiLevel() throws Exception { + public void testThermalThrottlingMultiLevel() throws Exception { final ThrottlingLevel levelLo = new ThrottlingLevel(PowerManager.THERMAL_STATUS_MODERATE, 0.62f); final ThrottlingLevel levelHi = new ThrottlingLevel(PowerManager.THERMAL_STATUS_CRITICAL, @@ -221,7 +221,7 @@ public class BrightnessThrottlerTest { List<ThrottlingLevel> levels = new ArrayList<>(); levels.add(levelLo); levels.add(levelHi); - final BrightnessThrottlingData data = BrightnessThrottlingData.create(levels); + final ThermalBrightnessThrottlingData data = ThermalBrightnessThrottlingData.create(levels); final BrightnessThrottler throttler = createThrottlerSupported(data); assertTrue(throttler.deviceSupportsThrottling()); @@ -292,32 +292,32 @@ public class BrightnessThrottlerTest { assertEquals(BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE, throttler.getBrightnessMaxReason()); } - @Test public void testUpdateThrottlingData() throws Exception { + @Test public void testUpdateThermalThrottlingData() throws Exception { // Initialise brightness throttling levels // Ensure that they are overridden by setting the data through device config. final ThrottlingLevel level = new ThrottlingLevel(PowerManager.THERMAL_STATUS_CRITICAL, 0.25f); List<ThrottlingLevel> levels = new ArrayList<>(); levels.add(level); - final BrightnessThrottlingData data = BrightnessThrottlingData.create(levels); - mDeviceConfigFake.setBrightnessThrottlingData("123,1,critical,0.4"); + final ThermalBrightnessThrottlingData data = ThermalBrightnessThrottlingData.create(levels); + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,1,critical,0.4"); final BrightnessThrottler throttler = createThrottlerSupported(data); verify(mThermalServiceMock).registerThermalEventListenerWithType( mThermalEventListenerCaptor.capture(), eq(Temperature.TYPE_SKIN)); final IThermalEventListener listener = mThermalEventListenerCaptor.getValue(); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.4f); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.4f); // Set new (valid) data from device config - mDeviceConfigFake.setBrightnessThrottlingData("123,1,critical,0.8"); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.8f); + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,1,critical,0.8"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.8f); - mDeviceConfigFake.setBrightnessThrottlingData( + mDeviceConfigFake.setThermalBrightnessThrottlingData( "123,1,critical,0.75;123,1,critical,0.99,id_2"); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.75f); - mDeviceConfigFake.setBrightnessThrottlingData( + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.75f); + mDeviceConfigFake.setThermalBrightnessThrottlingData( "123,1,critical,0.8,default;123,1,critical,0.99,id_2"); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.8f); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.8f); } @Test public void testInvalidThrottlingStrings() throws Exception { @@ -327,45 +327,54 @@ public class BrightnessThrottlerTest { 0.25f); List<ThrottlingLevel> levels = new ArrayList<>(); levels.add(level); - final BrightnessThrottlingData data = BrightnessThrottlingData.create(levels); + final ThermalBrightnessThrottlingData data = ThermalBrightnessThrottlingData.create(levels); final BrightnessThrottler throttler = createThrottlerSupported(data); verify(mThermalServiceMock).registerThermalEventListenerWithType( mThermalEventListenerCaptor.capture(), eq(Temperature.TYPE_SKIN)); final IThermalEventListener listener = mThermalEventListenerCaptor.getValue(); // None of these are valid so shouldn't override the original data - mDeviceConfigFake.setBrightnessThrottlingData("321,1,critical,0.4"); // Not the current id - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData("123,0,critical,0.4"); // Incorrect number - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData("123,2,critical,0.4"); // Incorrect number - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData("123,1,invalid,0.4"); // Invalid level - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData("123,1,critical,none"); // Invalid brightness - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData("123,1,critical,-3"); // Invalid brightness - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData("invalid string"); // Invalid format - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); - mDeviceConfigFake.setBrightnessThrottlingData(""); // Invalid format - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + + // Not the current id + mDeviceConfigFake.setThermalBrightnessThrottlingData("321,1,critical,0.4"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Incorrect number + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,0,critical,0.4"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Incorrect number + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,2,critical,0.4"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Invalid level + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,1,invalid,0.4"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Invalid brightness + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,1,critical,none"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Invalid brightness + mDeviceConfigFake.setThermalBrightnessThrottlingData("123,1,critical,-3"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Invalid format + mDeviceConfigFake.setThermalBrightnessThrottlingData("invalid string"); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + // Invalid format + mDeviceConfigFake.setThermalBrightnessThrottlingData(""); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); // Invalid string format - mDeviceConfigFake.setBrightnessThrottlingData( + mDeviceConfigFake.setThermalBrightnessThrottlingData( "123,default,1,critical,0.75,1,critical,0.99"); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); // Invalid level string and number string - mDeviceConfigFake.setBrightnessThrottlingData( + mDeviceConfigFake.setThermalBrightnessThrottlingData( "123,1,1,critical,0.75,id_2,1,critical,0.99"); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); // Invalid format - (two default ids for same display) - mDeviceConfigFake.setBrightnessThrottlingData( + mDeviceConfigFake.setThermalBrightnessThrottlingData( "123,1,critical,0.75,default;123,1,critical,0.99"); - testThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); + testThermalThrottling(throttler, listener, PowerManager.BRIGHTNESS_MAX, 0.25f); } - private void testThrottling(BrightnessThrottler throttler, IThermalEventListener listener, - float tooLowCap, float tooHighCap) throws Exception { + private void testThermalThrottling(BrightnessThrottler throttler, + IThermalEventListener listener, float tooLowCap, float tooHighCap) throws Exception { final ThrottlingLevel level = new ThrottlingLevel(PowerManager.THERMAL_STATUS_CRITICAL, tooHighCap); @@ -388,7 +397,7 @@ public class BrightnessThrottlerTest { 0.25f); List<ThrottlingLevel> levels = new ArrayList<>(); levels.add(level); - final BrightnessThrottlingData data = BrightnessThrottlingData.create(levels); + final ThermalBrightnessThrottlingData data = ThermalBrightnessThrottlingData.create(levels); // These are identical to the string set below final ThrottlingLevel levelSevere = new ThrottlingLevel(PowerManager.THERMAL_STATUS_SEVERE, @@ -398,7 +407,7 @@ public class BrightnessThrottlerTest { final ThrottlingLevel levelEmergency = new ThrottlingLevel( PowerManager.THERMAL_STATUS_EMERGENCY, 0.1f); - mDeviceConfigFake.setBrightnessThrottlingData( + mDeviceConfigFake.setThermalBrightnessThrottlingData( "123,3,severe,0.9,critical,0.5,emergency,0.1"); final BrightnessThrottler throttler = createThrottlerSupported(data); @@ -466,12 +475,13 @@ public class BrightnessThrottlerTest { private BrightnessThrottler createThrottlerUnsupported() { return new BrightnessThrottler(mInjectorMock, mHandler, mHandler, /* throttlingChangeCallback= */ () -> {}, /* uniqueDisplayId= */ null, - /* throttlingDataId= */ null, /* throttlingDataMap= */ new HashMap<>(1)); + /* thermalThrottlingDataId= */ null, + /* thermalThrottlingDataMap= */ new HashMap<>(1)); } - private BrightnessThrottler createThrottlerSupported(BrightnessThrottlingData data) { + private BrightnessThrottler createThrottlerSupported(ThermalBrightnessThrottlingData data) { assertNotNull(data); - HashMap<String, BrightnessThrottlingData> throttlingDataMap = new HashMap<>(1); + HashMap<String, ThermalBrightnessThrottlingData> throttlingDataMap = new HashMap<>(1); throttlingDataMap.put("default", data); return new BrightnessThrottler(mInjectorMock, mHandler, BackgroundThread.getHandler(), () -> {}, "123", "default", throttlingDataMap); diff --git a/services/tests/servicestests/src/com/android/server/display/DeviceStateToLayoutMapTest.java b/services/tests/servicestests/src/com/android/server/display/DeviceStateToLayoutMapTest.java index a7d3df90751f..130e6ad91b49 100644 --- a/services/tests/servicestests/src/com/android/server/display/DeviceStateToLayoutMapTest.java +++ b/services/tests/servicestests/src/com/android/server/display/DeviceStateToLayoutMapTest.java @@ -84,11 +84,11 @@ public class DeviceStateToLayoutMapTest { } @Test - public void testBrightnessThrottlingMapId() { + public void testThermalBrightnessThrottlingMapId() { Layout configLayout = mDeviceStateToLayoutMap.get(2); - assertEquals("concurrent1", configLayout.getAt(0).getBrightnessThrottlingMapId()); - assertEquals("concurrent2", configLayout.getAt(1).getBrightnessThrottlingMapId()); + assertEquals("concurrent1", configLayout.getAt(0).getThermalBrightnessThrottlingMapId()); + assertEquals("concurrent2", configLayout.getAt(1).getThermalBrightnessThrottlingMapId()); } @Test @@ -108,7 +108,7 @@ public class DeviceStateToLayoutMapTest { } @Test - public void testRefreshRateThermalThrottlingMapId() { + public void testThermalRefreshRateThrottlingMapId() { Layout configLayout = mDeviceStateToLayoutMap.get(4); assertEquals("test2", configLayout.getAt(0).getRefreshRateThermalThrottlingMapId()); @@ -124,12 +124,14 @@ public class DeviceStateToLayoutMapTest { /* isDefault= */ true, /* isEnabled= */ true, /* displayGroupName= */ null, mDisplayIdProducerMock, Layout.Display.POSITION_FRONT, Display.DEFAULT_DISPLAY, /* brightnessThrottlingMapId= */ "brightness1", - /* refreshRateZoneId= */ "zone1", /* refreshRateThermalThrottlingMapId= */ "rr1"); + /* refreshRateZoneId= */ "zone1", + /* refreshRateThermalThrottlingMapId= */ "rr1"); testLayout.createDisplayLocked(DisplayAddress.fromPhysicalDisplayId(678L), /* isDefault= */ false, /* isEnabled= */ false, /* displayGroupName= */ "group1", mDisplayIdProducerMock, Layout.Display.POSITION_REAR, Display.DEFAULT_DISPLAY, /* brightnessThrottlingMapId= */ "brightness2", - /* refreshRateZoneId= */ "zone2", /* refreshRateThermalThrottlingMapId= */ "rr2"); + /* refreshRateZoneId= */ "zone2", + /* refreshRateThermalThrottlingMapId= */ "rr2"); assertEquals(testLayout, configLayout); } @@ -147,7 +149,8 @@ public class DeviceStateToLayoutMapTest { layout.createDisplayLocked(DisplayAddress.fromPhysicalDisplayId(id), /* isDefault= */ false, enabled, group, mDisplayIdProducerMock, Layout.Display.POSITION_UNKNOWN, Display.DEFAULT_DISPLAY, /* brightnessThrottlingMapId= */ null, - /* refreshRateZoneId= */ null, /* refreshRateThermalThrottlingMapId= */ null); + /* refreshRateZoneId= */ null, + /* refreshRateThermalThrottlingMapId= */ null); } private void setupDeviceStateToLayoutMap() throws IOException { diff --git a/services/tests/servicestests/src/com/android/server/display/DisplayDeviceConfigTest.java b/services/tests/servicestests/src/com/android/server/display/DisplayDeviceConfigTest.java index ed0755949869..5837b21b89fd 100644 --- a/services/tests/servicestests/src/com/android/server/display/DisplayDeviceConfigTest.java +++ b/services/tests/servicestests/src/com/android/server/display/DisplayDeviceConfigTest.java @@ -187,72 +187,72 @@ public final class DisplayDeviceConfigTest { assertArrayEquals(new int[]{-1, 10, 20, 30, 40}, mDisplayDeviceConfig.getScreenOffBrightnessSensorValueToLux()); - List<DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel> + List<DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel> defaultThrottlingLevels = new ArrayList<>(); defaultThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.light), 0.4f )); defaultThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.moderate), 0.3f )); defaultThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.severe), 0.2f )); defaultThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.critical), 0.1f )); defaultThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.emergency), 0.05f )); defaultThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.shutdown), 0.025f )); - DisplayDeviceConfig.BrightnessThrottlingData defaultThrottlingData = - new DisplayDeviceConfig.BrightnessThrottlingData(defaultThrottlingLevels); + DisplayDeviceConfig.ThermalBrightnessThrottlingData defaultThrottlingData = + new DisplayDeviceConfig.ThermalBrightnessThrottlingData(defaultThrottlingLevels); - List<DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel> + List<DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel> concurrentThrottlingLevels = new ArrayList<>(); concurrentThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.light), 0.2f )); concurrentThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.moderate), 0.15f )); concurrentThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.severe), 0.1f )); concurrentThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.critical), 0.05f )); concurrentThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.emergency), 0.025f )); concurrentThrottlingLevels.add( - new DisplayDeviceConfig.BrightnessThrottlingData.ThrottlingLevel( + new DisplayDeviceConfig.ThermalBrightnessThrottlingData.ThrottlingLevel( DisplayDeviceConfig.convertThermalStatus(ThermalStatus.shutdown), 0.0125f )); - DisplayDeviceConfig.BrightnessThrottlingData concurrentThrottlingData = - new DisplayDeviceConfig.BrightnessThrottlingData(concurrentThrottlingLevels); + DisplayDeviceConfig.ThermalBrightnessThrottlingData concurrentThrottlingData = + new DisplayDeviceConfig.ThermalBrightnessThrottlingData(concurrentThrottlingLevels); - HashMap<String, DisplayDeviceConfig.BrightnessThrottlingData> throttlingDataMap = + HashMap<String, DisplayDeviceConfig.ThermalBrightnessThrottlingData> throttlingDataMap = new HashMap<>(2); throttlingDataMap.put("default", defaultThrottlingData); throttlingDataMap.put("concurrent", concurrentThrottlingData); assertEquals(throttlingDataMap, - mDisplayDeviceConfig.getBrightnessThrottlingDataMapByThrottlingId()); + mDisplayDeviceConfig.getThermalBrightnessThrottlingDataMapByThrottlingId()); assertNotNull(mDisplayDeviceConfig.getHostUsiVersion()); assertEquals(mDisplayDeviceConfig.getHostUsiVersion().getMajorVersion(), 2); @@ -351,16 +351,16 @@ public final class DisplayDeviceConfigTest { assertArrayEquals(mDisplayDeviceConfig.getHighAmbientBrightnessThresholds(), HIGH_AMBIENT_THRESHOLD_OF_PEAK_REFRESH_RATE); - // Todo: Add asserts for BrightnessThrottlingData, DensityMapping, + // Todo: Add asserts for ThermalBrightnessThrottlingData, DensityMapping, // HighBrightnessModeData AmbientLightSensor, RefreshRateLimitations and ProximitySensor. } @Test - public void testRefreshRateThermalThrottlingFromDisplayConfig() throws IOException { + public void testThermalRefreshRateThrottlingFromDisplayConfig() throws IOException { setupDisplayDeviceConfigFromDisplayConfigFile(); SparseArray<SurfaceControl.RefreshRateRange> defaultMap = - mDisplayDeviceConfig.getRefreshRateThrottlingData(null); + mDisplayDeviceConfig.getThermalRefreshRateThrottlingData(null); assertNotNull(defaultMap); assertEquals(2, defaultMap.size()); assertEquals(30, defaultMap.get(Temperature.THROTTLING_CRITICAL).min, SMALL_DELTA); @@ -369,7 +369,7 @@ public final class DisplayDeviceConfigTest { assertEquals(30, defaultMap.get(Temperature.THROTTLING_SHUTDOWN).max, SMALL_DELTA); SparseArray<SurfaceControl.RefreshRateRange> testMap = - mDisplayDeviceConfig.getRefreshRateThrottlingData("test"); + mDisplayDeviceConfig.getThermalRefreshRateThrottlingData("test"); assertNotNull(testMap); assertEquals(1, testMap.size()); assertEquals(60, testMap.get(Temperature.THROTTLING_EMERGENCY).min, SMALL_DELTA); diff --git a/services/tests/servicestests/src/com/android/server/display/LogicalDisplayMapperTest.java b/services/tests/servicestests/src/com/android/server/display/LogicalDisplayMapperTest.java index 567548e83dc8..7536c7949bcb 100644 --- a/services/tests/servicestests/src/com/android/server/display/LogicalDisplayMapperTest.java +++ b/services/tests/servicestests/src/com/android/server/display/LogicalDisplayMapperTest.java @@ -649,9 +649,9 @@ public class LogicalDisplayMapperTest { assertEquals(0, mLogicalDisplayMapper.getDisplayLocked(device2) .getLeadDisplayIdLocked()); assertEquals("concurrent", mLogicalDisplayMapper.getDisplayLocked(device1) - .getBrightnessThrottlingDataIdLocked()); + .getThermalBrightnessThrottlingDataIdLocked()); assertEquals("concurrent", mLogicalDisplayMapper.getDisplayLocked(device2) - .getBrightnessThrottlingDataIdLocked()); + .getThermalBrightnessThrottlingDataIdLocked()); mLogicalDisplayMapper.setDeviceStateLocked(1, false); advanceTime(1000); @@ -661,10 +661,10 @@ public class LogicalDisplayMapperTest { assertFalse(mLogicalDisplayMapper.getDisplayLocked(device2).isInTransitionLocked()); assertEquals(DisplayDeviceConfig.DEFAULT_ID, mLogicalDisplayMapper.getDisplayLocked(device1) - .getBrightnessThrottlingDataIdLocked()); + .getThermalBrightnessThrottlingDataIdLocked()); assertEquals(DisplayDeviceConfig.DEFAULT_ID, mLogicalDisplayMapper.getDisplayLocked(device2) - .getBrightnessThrottlingDataIdLocked()); + .getThermalBrightnessThrottlingDataIdLocked()); mLogicalDisplayMapper.setDeviceStateLocked(2, false); advanceTime(1000); @@ -674,10 +674,10 @@ public class LogicalDisplayMapperTest { assertFalse(mLogicalDisplayMapper.getDisplayLocked(device2).isInTransitionLocked()); assertEquals(DisplayDeviceConfig.DEFAULT_ID, mLogicalDisplayMapper.getDisplayLocked(device1) - .getBrightnessThrottlingDataIdLocked()); + .getThermalBrightnessThrottlingDataIdLocked()); assertEquals(DisplayDeviceConfig.DEFAULT_ID, mLogicalDisplayMapper.getDisplayLocked(device2) - .getBrightnessThrottlingDataIdLocked()); + .getThermalBrightnessThrottlingDataIdLocked()); } @Test @@ -863,7 +863,7 @@ public class LogicalDisplayMapperTest { layout.createDisplayLocked(address, /* isDefault= */ false, enabled, group, mIdProducer, Layout.Display.POSITION_UNKNOWN, Display.DEFAULT_DISPLAY, /* brightnessThrottlingMapId= */ null, /* refreshRateZoneId= */ null, - /* refreshRateThrottlingMapId= */ null); + /* refreshRateThermalThrottlingMapId= */ null); } private void advanceTime(long timeMs) { diff --git a/services/tests/servicestests/src/com/android/server/display/mode/DisplayModeDirectorTest.java b/services/tests/servicestests/src/com/android/server/display/mode/DisplayModeDirectorTest.java index db5a46976748..6907145542cc 100644 --- a/services/tests/servicestests/src/com/android/server/display/mode/DisplayModeDirectorTest.java +++ b/services/tests/servicestests/src/com/android/server/display/mode/DisplayModeDirectorTest.java @@ -2583,7 +2583,7 @@ public class DisplayModeDirectorTest { KEY_REFRESH_RATE_IN_HBM_HDR, String.valueOf(fps)); } - public void setBrightnessThrottlingData(String brightnessThrottlingData) { + public void setThermalBrightnessThrottlingData(String brightnessThrottlingData) { putPropertyAndNotify(DeviceConfig.NAMESPACE_DISPLAY_MANAGER, KEY_BRIGHTNESS_THROTTLING_DATA, brightnessThrottlingData); } |