Loading core/java/android/view/DisplayInfo.java +16 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.DisplayInfoProto.LOGICAL_HEIGHT; import static android.view.DisplayInfoProto.LOGICAL_WIDTH; import static android.view.DisplayInfoProto.NAME; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.WindowConfiguration; import android.compat.annotation.UnsupportedAppUsage; Loading @@ -37,6 +38,7 @@ import android.os.Parcelable; import android.os.Process; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import com.android.internal.display.BrightnessSynchronizer; Loading Loading @@ -348,6 +350,12 @@ public final class DisplayInfo implements Parcelable { */ public float hdrSdrRatio = Float.NaN; /** * RefreshRateRange limitation for @Temperature.ThrottlingStatus */ @NonNull public SparseArray<SurfaceControl.RefreshRateRange> refreshRateThermalThrottling = new SparseArray<>(); public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() { @Override Loading Loading @@ -425,7 +433,8 @@ public final class DisplayInfo implements Parcelable { && installOrientation == other.installOrientation && Objects.equals(displayShape, other.displayShape) && Objects.equals(layoutLimitedRefreshRate, other.layoutLimitedRefreshRate) && BrightnessSynchronizer.floatEquals(hdrSdrRatio, other.hdrSdrRatio); && BrightnessSynchronizer.floatEquals(hdrSdrRatio, other.hdrSdrRatio) && refreshRateThermalThrottling.contentEquals(other.refreshRateThermalThrottling); } @Override Loading Loading @@ -482,6 +491,7 @@ public final class DisplayInfo implements Parcelable { displayShape = other.displayShape; layoutLimitedRefreshRate = other.layoutLimitedRefreshRate; hdrSdrRatio = other.hdrSdrRatio; refreshRateThermalThrottling = other.refreshRateThermalThrottling; } public void readFromParcel(Parcel source) { Loading Loading @@ -544,6 +554,8 @@ public final class DisplayInfo implements Parcelable { displayShape = source.readTypedObject(DisplayShape.CREATOR); layoutLimitedRefreshRate = source.readTypedObject(SurfaceControl.RefreshRateRange.CREATOR); hdrSdrRatio = source.readFloat(); refreshRateThermalThrottling = source.readSparseArray(null, SurfaceControl.RefreshRateRange.class); } @Override Loading Loading @@ -604,6 +616,7 @@ public final class DisplayInfo implements Parcelable { dest.writeTypedObject(displayShape, flags); dest.writeTypedObject(layoutLimitedRefreshRate, flags); dest.writeFloat(hdrSdrRatio); dest.writeSparseArray(refreshRateThermalThrottling); } @Override Loading Loading @@ -871,6 +884,8 @@ public final class DisplayInfo implements Parcelable { } else { sb.append(hdrSdrRatio); } sb.append(", refreshRateThermalThrottling "); sb.append(refreshRateThermalThrottling); sb.append("}"); return sb.toString(); } Loading services/core/java/com/android/server/display/DeviceStateToLayoutMap.java +2 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ class DeviceStateToLayoutMap { display.setPosition(POSITION_UNKNOWN); } display.setRefreshRateZoneId(d.getRefreshRateZoneId()); display.setRefreshRateThermalThrottlingMapId( d.getRefreshRateThermalThrottlingMapId()); } } } catch (IOException | DatatypeConfigurationException | XmlPullParserException e) { Loading services/core/java/com/android/server/display/DisplayDeviceConfig.java +97 −5 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.text.TextUtils; import android.util.MathUtils; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.Spline; import android.view.DisplayAddress; import android.view.SurfaceControl; Loading @@ -54,6 +55,8 @@ import com.android.server.display.config.NitsMap; import com.android.server.display.config.Point; import com.android.server.display.config.RefreshRateConfigs; import com.android.server.display.config.RefreshRateRange; import com.android.server.display.config.RefreshRateThrottlingMap; import com.android.server.display.config.RefreshRateThrottlingPoint; import com.android.server.display.config.RefreshRateZone; import com.android.server.display.config.SdrHdrRatioMap; import com.android.server.display.config.SdrHdrRatioPoint; Loading Loading @@ -149,9 +152,26 @@ import javax.xml.datatype.DatatypeConfigurationException; * <brightness>0.005</brightness> * </brightnessThrottlingPoint> * </concurrentDisplaysBrightnessThrottlingMap> * <refreshRateThrottlingMap> * <refreshRateThrottlingPoint> * <thermalStatus>critical</thermalStatus> * <refreshRateRange> * <minimum>0</minimum> * <maximum>60</maximum> * </refreshRateRange> * </refreshRateThrottlingPoint> * </refreshRateThrottlingMap> * </thermalThrottling> * * <refreshRate> * <refreshRateZoneProfiles> * <refreshRateZoneProfile id="concurrent"> * <refreshRateRange> * <minimum>60</minimum> * <maximum>60</maximum> * </refreshRateRange> * </refreshRateZoneProfile> * </refreshRateZoneProfiles> * <defaultRefreshRateInHbmHdr>75</defaultRefreshRateInHbmHdr> * <defaultRefreshRateInHbmSunlight>75</defaultRefreshRateInHbmSunlight> * <lowerBlockingZoneConfigs> Loading Loading @@ -417,7 +437,7 @@ public class DisplayDeviceConfig { public static final String QUIRK_CAN_SET_BRIGHTNESS_VIA_HWC = "canSetBrightnessViaHwc"; static final String DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID = "default"; static final String DEFAULT_ID = "default"; private static final float BRIGHTNESS_DEFAULT = 0.5f; private static final String ETC_DIR = "etc"; Loading Loading @@ -662,7 +682,11 @@ public class DisplayDeviceConfig { private int[] mHighDisplayBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS; private int[] mHighAmbientBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS; private Map<String, BrightnessThrottlingData> mBrightnessThrottlingDataMap = new HashMap(); private final Map<String, BrightnessThrottlingData> mBrightnessThrottlingDataMap = new HashMap<>(); private final Map<String, SparseArray<SurfaceControl.RefreshRateRange>> mRefreshRateThrottlingMap = new HashMap<>(); @Nullable private HostUsiVersion mHostUsiVersion; Loading Loading @@ -1314,6 +1338,17 @@ public class DisplayDeviceConfig { return BrightnessThrottlingData.create(mBrightnessThrottlingDataMap.get(id)); } /** * @param id - throttling data id or null for default * @return refresh rate throttling configuration */ @Nullable public SparseArray<SurfaceControl.RefreshRateRange> getRefreshRateThrottlingData( @Nullable String id) { String key = id == null ? DEFAULT_ID : id; return mRefreshRateThrottlingMap.get(key); } /** * @return Auto brightness darkening light debounce */ Loading Loading @@ -1552,6 +1587,8 @@ public class DisplayDeviceConfig { + ", mRefreshRateZoneProfiles= " + mRefreshRateZoneProfiles + ", mDefaultRefreshRateInHbmHdr= " + mDefaultRefreshRateInHbmHdr + ", mDefaultRefreshRateInHbmSunlight= " + mDefaultRefreshRateInHbmSunlight + ", mRefreshRateThrottlingMap= " + mRefreshRateThrottlingMap + "\n" + ", mLowDisplayBrightnessThresholds= " + Arrays.toString(mLowDisplayBrightnessThresholds) + ", mLowAmbientBrightnessThresholds= " Loading Loading @@ -1613,7 +1650,7 @@ public class DisplayDeviceConfig { loadBrightnessDefaultFromDdcXml(config); loadBrightnessConstraintsFromConfigXml(); loadBrightnessMap(config); loadBrightnessThrottlingMaps(config); loadThermalThrottlingConfig(config); loadHighBrightnessModeData(config); loadQuirks(config); loadBrightnessRamps(config); Loading Loading @@ -1823,13 +1860,17 @@ public class DisplayDeviceConfig { return Spline.createSpline(nits, ratios); } private void loadBrightnessThrottlingMaps(DisplayConfiguration config) { private void loadThermalThrottlingConfig(DisplayConfiguration config) { final ThermalThrottling throttlingConfig = config.getThermalThrottling(); if (throttlingConfig == null) { Slog.i(TAG, "No thermal throttling config found"); return; } loadBrightnessThrottlingMaps(throttlingConfig); loadRefreshRateThermalThrottlingMap(throttlingConfig); } private void loadBrightnessThrottlingMaps(ThermalThrottling throttlingConfig) { final List<BrightnessThrottlingMap> maps = throttlingConfig.getBrightnessThrottlingMap(); if (maps == null || maps.isEmpty()) { Slog.i(TAG, "No brightness throttling map found"); Loading @@ -1855,7 +1896,7 @@ public class DisplayDeviceConfig { } if (!badConfig) { String id = map.getId() == null ? DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID String id = map.getId() == null ? DEFAULT_ID : map.getId(); if (mBrightnessThrottlingDataMap.containsKey(id)) { throw new RuntimeException("Brightness throttling data with ID " + id Loading @@ -1867,6 +1908,57 @@ public class DisplayDeviceConfig { } } private void loadRefreshRateThermalThrottlingMap(ThermalThrottling throttlingConfig) { List<RefreshRateThrottlingMap> maps = throttlingConfig.getRefreshRateThrottlingMap(); if (maps == null || maps.isEmpty()) { Slog.w(TAG, "RefreshRateThrottling: map not found"); return; } for (RefreshRateThrottlingMap map : maps) { List<RefreshRateThrottlingPoint> points = map.getRefreshRateThrottlingPoint(); String id = map.getId() == null ? DEFAULT_ID : map.getId(); if (points == null || points.isEmpty()) { // Expected at lease 1 throttling point for each map Slog.w(TAG, "RefreshRateThrottling: points not found for mapId=" + id); continue; } if (mRefreshRateThrottlingMap.containsKey(id)) { Slog.wtf(TAG, "RefreshRateThrottling: map already exists, mapId=" + id); continue; } SparseArray<SurfaceControl.RefreshRateRange> refreshRates = new SparseArray<>(); for (RefreshRateThrottlingPoint point : points) { ThermalStatus status = point.getThermalStatus(); if (!thermalStatusIsValid(status)) { Slog.wtf(TAG, "RefreshRateThrottling: Invalid thermalStatus=" + status.getRawName() + ",mapId=" + id); continue; } int thermalStatusInt = convertThermalStatus(status); if (refreshRates.contains(thermalStatusInt)) { Slog.wtf(TAG, "RefreshRateThrottling: thermalStatus=" + status.getRawName() + " is already in the map, mapId=" + id); continue; } refreshRates.put(thermalStatusInt, new SurfaceControl.RefreshRateRange( point.getRefreshRateRange().getMinimum().floatValue(), point.getRefreshRateRange().getMaximum().floatValue() )); } if (refreshRates.size() == 0) { Slog.w(TAG, "RefreshRateThrottling: no valid throttling points fond for map, mapId=" + id); continue; } mRefreshRateThrottlingMap.put(id, refreshRates); } } private void loadRefreshRateSetting(DisplayConfiguration config) { final RefreshRateConfigs refreshRateConfigs = (config == null) ? null : config.getRefreshRate(); Loading services/core/java/com/android/server/display/LogicalDisplay.java +16 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ final class LogicalDisplay { mTempFrameRateOverride = new SparseArray<>(); mIsEnabled = true; mIsInTransition = false; mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID; mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_ID; } public void setDevicePositionLocked(int position) { Loading Loading @@ -344,6 +344,21 @@ final class LogicalDisplay { mInfo.set(null); } } /** * Updates refreshRateThermalThrottling * * @param refreshRanges new refreshRateThermalThrottling ranges limited by layout or default */ public void updateRefreshRateThermalThrottling( @Nullable SparseArray<SurfaceControl.RefreshRateRange> refreshRanges) { if (refreshRanges == null) { refreshRanges = new SparseArray<>(); } if (!mBaseDisplayInfo.refreshRateThermalThrottling.contentEquals(refreshRanges)) { mBaseDisplayInfo.refreshRateThermalThrottling = refreshRanges; mInfo.set(null); } } /** * Updates the state of the logical display based on the available display devices. Loading services/core/java/com/android/server/display/LogicalDisplayMapper.java +7 −3 Original line number Diff line number Diff line Loading @@ -1013,19 +1013,23 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { if (newDisplay != oldDisplay) { newDisplay.swapDisplaysLocked(oldDisplay); } DisplayDeviceConfig config = device.getDisplayDeviceConfig(); newDisplay.setDevicePositionLocked(displayLayout.getPosition()); newDisplay.setLeadDisplayLocked(displayLayout.getLeadDisplayId()); newDisplay.updateLayoutLimitedRefreshRateLocked( device.getDisplayDeviceConfig().getRefreshRange( displayLayout.getRefreshRateZoneId() config.getRefreshRange(displayLayout.getRefreshRateZoneId()) ); newDisplay.updateRefreshRateThermalThrottling( config.getRefreshRateThrottlingData( displayLayout.getRefreshRateThermalThrottlingMapId() ) ); setEnabledLocked(newDisplay, displayLayout.isEnabled()); newDisplay.setBrightnessThrottlingDataIdLocked( displayLayout.getBrightnessThrottlingMapId() == null ? DisplayDeviceConfig.DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID ? DisplayDeviceConfig.DEFAULT_ID : displayLayout.getBrightnessThrottlingMapId()); newDisplay.setDisplayGroupNameLocked(displayLayout.getDisplayGroupName()); Loading Loading
core/java/android/view/DisplayInfo.java +16 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.view.DisplayInfoProto.LOGICAL_HEIGHT; import static android.view.DisplayInfoProto.LOGICAL_WIDTH; import static android.view.DisplayInfoProto.NAME; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.WindowConfiguration; import android.compat.annotation.UnsupportedAppUsage; Loading @@ -37,6 +38,7 @@ import android.os.Parcelable; import android.os.Process; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import com.android.internal.display.BrightnessSynchronizer; Loading Loading @@ -348,6 +350,12 @@ public final class DisplayInfo implements Parcelable { */ public float hdrSdrRatio = Float.NaN; /** * RefreshRateRange limitation for @Temperature.ThrottlingStatus */ @NonNull public SparseArray<SurfaceControl.RefreshRateRange> refreshRateThermalThrottling = new SparseArray<>(); public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() { @Override Loading Loading @@ -425,7 +433,8 @@ public final class DisplayInfo implements Parcelable { && installOrientation == other.installOrientation && Objects.equals(displayShape, other.displayShape) && Objects.equals(layoutLimitedRefreshRate, other.layoutLimitedRefreshRate) && BrightnessSynchronizer.floatEquals(hdrSdrRatio, other.hdrSdrRatio); && BrightnessSynchronizer.floatEquals(hdrSdrRatio, other.hdrSdrRatio) && refreshRateThermalThrottling.contentEquals(other.refreshRateThermalThrottling); } @Override Loading Loading @@ -482,6 +491,7 @@ public final class DisplayInfo implements Parcelable { displayShape = other.displayShape; layoutLimitedRefreshRate = other.layoutLimitedRefreshRate; hdrSdrRatio = other.hdrSdrRatio; refreshRateThermalThrottling = other.refreshRateThermalThrottling; } public void readFromParcel(Parcel source) { Loading Loading @@ -544,6 +554,8 @@ public final class DisplayInfo implements Parcelable { displayShape = source.readTypedObject(DisplayShape.CREATOR); layoutLimitedRefreshRate = source.readTypedObject(SurfaceControl.RefreshRateRange.CREATOR); hdrSdrRatio = source.readFloat(); refreshRateThermalThrottling = source.readSparseArray(null, SurfaceControl.RefreshRateRange.class); } @Override Loading Loading @@ -604,6 +616,7 @@ public final class DisplayInfo implements Parcelable { dest.writeTypedObject(displayShape, flags); dest.writeTypedObject(layoutLimitedRefreshRate, flags); dest.writeFloat(hdrSdrRatio); dest.writeSparseArray(refreshRateThermalThrottling); } @Override Loading Loading @@ -871,6 +884,8 @@ public final class DisplayInfo implements Parcelable { } else { sb.append(hdrSdrRatio); } sb.append(", refreshRateThermalThrottling "); sb.append(refreshRateThermalThrottling); sb.append("}"); return sb.toString(); } Loading
services/core/java/com/android/server/display/DeviceStateToLayoutMap.java +2 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ class DeviceStateToLayoutMap { display.setPosition(POSITION_UNKNOWN); } display.setRefreshRateZoneId(d.getRefreshRateZoneId()); display.setRefreshRateThermalThrottlingMapId( d.getRefreshRateThermalThrottlingMapId()); } } } catch (IOException | DatatypeConfigurationException | XmlPullParserException e) { Loading
services/core/java/com/android/server/display/DisplayDeviceConfig.java +97 −5 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.text.TextUtils; import android.util.MathUtils; import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.Spline; import android.view.DisplayAddress; import android.view.SurfaceControl; Loading @@ -54,6 +55,8 @@ import com.android.server.display.config.NitsMap; import com.android.server.display.config.Point; import com.android.server.display.config.RefreshRateConfigs; import com.android.server.display.config.RefreshRateRange; import com.android.server.display.config.RefreshRateThrottlingMap; import com.android.server.display.config.RefreshRateThrottlingPoint; import com.android.server.display.config.RefreshRateZone; import com.android.server.display.config.SdrHdrRatioMap; import com.android.server.display.config.SdrHdrRatioPoint; Loading Loading @@ -149,9 +152,26 @@ import javax.xml.datatype.DatatypeConfigurationException; * <brightness>0.005</brightness> * </brightnessThrottlingPoint> * </concurrentDisplaysBrightnessThrottlingMap> * <refreshRateThrottlingMap> * <refreshRateThrottlingPoint> * <thermalStatus>critical</thermalStatus> * <refreshRateRange> * <minimum>0</minimum> * <maximum>60</maximum> * </refreshRateRange> * </refreshRateThrottlingPoint> * </refreshRateThrottlingMap> * </thermalThrottling> * * <refreshRate> * <refreshRateZoneProfiles> * <refreshRateZoneProfile id="concurrent"> * <refreshRateRange> * <minimum>60</minimum> * <maximum>60</maximum> * </refreshRateRange> * </refreshRateZoneProfile> * </refreshRateZoneProfiles> * <defaultRefreshRateInHbmHdr>75</defaultRefreshRateInHbmHdr> * <defaultRefreshRateInHbmSunlight>75</defaultRefreshRateInHbmSunlight> * <lowerBlockingZoneConfigs> Loading Loading @@ -417,7 +437,7 @@ public class DisplayDeviceConfig { public static final String QUIRK_CAN_SET_BRIGHTNESS_VIA_HWC = "canSetBrightnessViaHwc"; static final String DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID = "default"; static final String DEFAULT_ID = "default"; private static final float BRIGHTNESS_DEFAULT = 0.5f; private static final String ETC_DIR = "etc"; Loading Loading @@ -662,7 +682,11 @@ public class DisplayDeviceConfig { private int[] mHighDisplayBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS; private int[] mHighAmbientBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS; private Map<String, BrightnessThrottlingData> mBrightnessThrottlingDataMap = new HashMap(); private final Map<String, BrightnessThrottlingData> mBrightnessThrottlingDataMap = new HashMap<>(); private final Map<String, SparseArray<SurfaceControl.RefreshRateRange>> mRefreshRateThrottlingMap = new HashMap<>(); @Nullable private HostUsiVersion mHostUsiVersion; Loading Loading @@ -1314,6 +1338,17 @@ public class DisplayDeviceConfig { return BrightnessThrottlingData.create(mBrightnessThrottlingDataMap.get(id)); } /** * @param id - throttling data id or null for default * @return refresh rate throttling configuration */ @Nullable public SparseArray<SurfaceControl.RefreshRateRange> getRefreshRateThrottlingData( @Nullable String id) { String key = id == null ? DEFAULT_ID : id; return mRefreshRateThrottlingMap.get(key); } /** * @return Auto brightness darkening light debounce */ Loading Loading @@ -1552,6 +1587,8 @@ public class DisplayDeviceConfig { + ", mRefreshRateZoneProfiles= " + mRefreshRateZoneProfiles + ", mDefaultRefreshRateInHbmHdr= " + mDefaultRefreshRateInHbmHdr + ", mDefaultRefreshRateInHbmSunlight= " + mDefaultRefreshRateInHbmSunlight + ", mRefreshRateThrottlingMap= " + mRefreshRateThrottlingMap + "\n" + ", mLowDisplayBrightnessThresholds= " + Arrays.toString(mLowDisplayBrightnessThresholds) + ", mLowAmbientBrightnessThresholds= " Loading Loading @@ -1613,7 +1650,7 @@ public class DisplayDeviceConfig { loadBrightnessDefaultFromDdcXml(config); loadBrightnessConstraintsFromConfigXml(); loadBrightnessMap(config); loadBrightnessThrottlingMaps(config); loadThermalThrottlingConfig(config); loadHighBrightnessModeData(config); loadQuirks(config); loadBrightnessRamps(config); Loading Loading @@ -1823,13 +1860,17 @@ public class DisplayDeviceConfig { return Spline.createSpline(nits, ratios); } private void loadBrightnessThrottlingMaps(DisplayConfiguration config) { private void loadThermalThrottlingConfig(DisplayConfiguration config) { final ThermalThrottling throttlingConfig = config.getThermalThrottling(); if (throttlingConfig == null) { Slog.i(TAG, "No thermal throttling config found"); return; } loadBrightnessThrottlingMaps(throttlingConfig); loadRefreshRateThermalThrottlingMap(throttlingConfig); } private void loadBrightnessThrottlingMaps(ThermalThrottling throttlingConfig) { final List<BrightnessThrottlingMap> maps = throttlingConfig.getBrightnessThrottlingMap(); if (maps == null || maps.isEmpty()) { Slog.i(TAG, "No brightness throttling map found"); Loading @@ -1855,7 +1896,7 @@ public class DisplayDeviceConfig { } if (!badConfig) { String id = map.getId() == null ? DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID String id = map.getId() == null ? DEFAULT_ID : map.getId(); if (mBrightnessThrottlingDataMap.containsKey(id)) { throw new RuntimeException("Brightness throttling data with ID " + id Loading @@ -1867,6 +1908,57 @@ public class DisplayDeviceConfig { } } private void loadRefreshRateThermalThrottlingMap(ThermalThrottling throttlingConfig) { List<RefreshRateThrottlingMap> maps = throttlingConfig.getRefreshRateThrottlingMap(); if (maps == null || maps.isEmpty()) { Slog.w(TAG, "RefreshRateThrottling: map not found"); return; } for (RefreshRateThrottlingMap map : maps) { List<RefreshRateThrottlingPoint> points = map.getRefreshRateThrottlingPoint(); String id = map.getId() == null ? DEFAULT_ID : map.getId(); if (points == null || points.isEmpty()) { // Expected at lease 1 throttling point for each map Slog.w(TAG, "RefreshRateThrottling: points not found for mapId=" + id); continue; } if (mRefreshRateThrottlingMap.containsKey(id)) { Slog.wtf(TAG, "RefreshRateThrottling: map already exists, mapId=" + id); continue; } SparseArray<SurfaceControl.RefreshRateRange> refreshRates = new SparseArray<>(); for (RefreshRateThrottlingPoint point : points) { ThermalStatus status = point.getThermalStatus(); if (!thermalStatusIsValid(status)) { Slog.wtf(TAG, "RefreshRateThrottling: Invalid thermalStatus=" + status.getRawName() + ",mapId=" + id); continue; } int thermalStatusInt = convertThermalStatus(status); if (refreshRates.contains(thermalStatusInt)) { Slog.wtf(TAG, "RefreshRateThrottling: thermalStatus=" + status.getRawName() + " is already in the map, mapId=" + id); continue; } refreshRates.put(thermalStatusInt, new SurfaceControl.RefreshRateRange( point.getRefreshRateRange().getMinimum().floatValue(), point.getRefreshRateRange().getMaximum().floatValue() )); } if (refreshRates.size() == 0) { Slog.w(TAG, "RefreshRateThrottling: no valid throttling points fond for map, mapId=" + id); continue; } mRefreshRateThrottlingMap.put(id, refreshRates); } } private void loadRefreshRateSetting(DisplayConfiguration config) { final RefreshRateConfigs refreshRateConfigs = (config == null) ? null : config.getRefreshRate(); Loading
services/core/java/com/android/server/display/LogicalDisplay.java +16 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ final class LogicalDisplay { mTempFrameRateOverride = new SparseArray<>(); mIsEnabled = true; mIsInTransition = false; mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID; mBrightnessThrottlingDataId = DisplayDeviceConfig.DEFAULT_ID; } public void setDevicePositionLocked(int position) { Loading Loading @@ -344,6 +344,21 @@ final class LogicalDisplay { mInfo.set(null); } } /** * Updates refreshRateThermalThrottling * * @param refreshRanges new refreshRateThermalThrottling ranges limited by layout or default */ public void updateRefreshRateThermalThrottling( @Nullable SparseArray<SurfaceControl.RefreshRateRange> refreshRanges) { if (refreshRanges == null) { refreshRanges = new SparseArray<>(); } if (!mBaseDisplayInfo.refreshRateThermalThrottling.contentEquals(refreshRanges)) { mBaseDisplayInfo.refreshRateThermalThrottling = refreshRanges; mInfo.set(null); } } /** * Updates the state of the logical display based on the available display devices. Loading
services/core/java/com/android/server/display/LogicalDisplayMapper.java +7 −3 Original line number Diff line number Diff line Loading @@ -1013,19 +1013,23 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener { if (newDisplay != oldDisplay) { newDisplay.swapDisplaysLocked(oldDisplay); } DisplayDeviceConfig config = device.getDisplayDeviceConfig(); newDisplay.setDevicePositionLocked(displayLayout.getPosition()); newDisplay.setLeadDisplayLocked(displayLayout.getLeadDisplayId()); newDisplay.updateLayoutLimitedRefreshRateLocked( device.getDisplayDeviceConfig().getRefreshRange( displayLayout.getRefreshRateZoneId() config.getRefreshRange(displayLayout.getRefreshRateZoneId()) ); newDisplay.updateRefreshRateThermalThrottling( config.getRefreshRateThrottlingData( displayLayout.getRefreshRateThermalThrottlingMapId() ) ); setEnabledLocked(newDisplay, displayLayout.isEnabled()); newDisplay.setBrightnessThrottlingDataIdLocked( displayLayout.getBrightnessThrottlingMapId() == null ? DisplayDeviceConfig.DEFAULT_BRIGHTNESS_THROTTLING_DATA_ID ? DisplayDeviceConfig.DEFAULT_ID : displayLayout.getBrightnessThrottlingMapId()); newDisplay.setDisplayGroupNameLocked(displayLayout.getDisplayGroupName()); Loading