Merge "Add support to read refresh rate thresholds and controls from the DisplayDeviceConfig" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3b7ae930fa
@@ -4789,11 +4789,11 @@
|
||||
<integer name="config_defaultPeakRefreshRate">0</integer>
|
||||
|
||||
<!-- The display uses different gamma curves for different refresh rates. It's hard for panel
|
||||
vendor to tune the curves to have exact same brightness for different refresh rate. So
|
||||
vendors to tune the curves to have exact same brightness for different refresh rate. So
|
||||
flicker could be observed at switch time. The issue is worse at the gamma lower end.
|
||||
In addition, human eyes are more sensitive to the flicker at darker environment.
|
||||
To prevent flicker, we only support higher refresh rates if the display brightness is above
|
||||
a threshold. And the darker environment could have higher threshold.
|
||||
a threshold.
|
||||
For example, no higher refresh rate if
|
||||
display brightness <= disp0 && ambient brightness <= amb0
|
||||
|| display brightness <= disp1 && ambient brightness <= amb1 -->
|
||||
@@ -4815,13 +4815,12 @@
|
||||
<integer name="config_defaultRefreshRateInZone">0</integer>
|
||||
|
||||
<!-- The display uses different gamma curves for different refresh rates. It's hard for panel
|
||||
vendor to tune the curves to have exact same brightness for different refresh rate. So
|
||||
vendors to tune the curves to have exact same brightness for different refresh rate. So
|
||||
flicker could be observed at switch time. The issue can be observed on the screen with
|
||||
even full white content at the high brightness. To prevent flickering, we support fixed
|
||||
refresh rates if the display and ambient brightness are equal to or above the provided
|
||||
thresholds. You can define multiple threshold levels as higher brightness environments
|
||||
may have lower display brightness requirements for the flickering is visible. And the
|
||||
high brightness environment could have higher threshold.
|
||||
may have lower display brightness requirements for the flickering is visible.
|
||||
For example, fixed refresh rate if
|
||||
display brightness >= disp0 && ambient brightness >= amb0
|
||||
|| display brightness >= disp1 && ambient brightness >= amb1 -->
|
||||
|
||||
@@ -36,16 +36,19 @@ import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.display.BrightnessSynchronizer;
|
||||
import com.android.server.display.config.AutoBrightness;
|
||||
import com.android.server.display.config.BlockingZoneConfig;
|
||||
import com.android.server.display.config.BrightnessThresholds;
|
||||
import com.android.server.display.config.BrightnessThrottlingMap;
|
||||
import com.android.server.display.config.BrightnessThrottlingPoint;
|
||||
import com.android.server.display.config.Density;
|
||||
import com.android.server.display.config.DisplayBrightnessPoint;
|
||||
import com.android.server.display.config.DisplayConfiguration;
|
||||
import com.android.server.display.config.DisplayQuirks;
|
||||
import com.android.server.display.config.HbmTiming;
|
||||
import com.android.server.display.config.HighBrightnessMode;
|
||||
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.SdrHdrRatioMap;
|
||||
import com.android.server.display.config.SdrHdrRatioPoint;
|
||||
@@ -130,6 +133,35 @@ import javax.xml.datatype.DatatypeConfigurationException;
|
||||
* </brightnessThrottlingMap>
|
||||
* </thermalThrottling>
|
||||
*
|
||||
* <refreshRate>
|
||||
* <lowerBlockingZoneConfigs>
|
||||
* <defaultRefreshRate>75</defaultRefreshRate>
|
||||
* <blockingZoneThreshold>
|
||||
* <displayBrightnessPoint>
|
||||
* <lux>50</lux>
|
||||
* <nits>45.3</nits>
|
||||
* </displayBrightnessPoint>
|
||||
* <displayBrightnessPoint>
|
||||
* <lux>60</lux>
|
||||
* <nits>55.2</nits>
|
||||
* </displayBrightnessPoint>
|
||||
* </blockingZoneThreshold>
|
||||
* </lowerBlockingZoneConfigs>
|
||||
* <higherBlockingZoneConfigs>
|
||||
* <defaultRefreshRate>90</defaultRefreshRate>
|
||||
* <blockingZoneThreshold>
|
||||
* <displayBrightnessPoint>
|
||||
* <lux>500</lux>
|
||||
* <nits>245.3</nits>
|
||||
* </displayBrightnessPoint>
|
||||
* <displayBrightnessPoint>
|
||||
* <lux>600</lux>
|
||||
* <nits>232.3</nits>
|
||||
* </displayBrightnessPoint>
|
||||
* </blockingZoneThreshold>
|
||||
* </higherBlockingZoneConfigs>
|
||||
* </refreshRate>
|
||||
*
|
||||
* <highBrightnessMode enabled="true">
|
||||
* <transitionPoint>0.62</transitionPoint>
|
||||
* <minimumLux>10000</minimumLux>
|
||||
@@ -358,6 +390,9 @@ public class DisplayDeviceConfig {
|
||||
private static final String STABLE_ID_SUFFIX_FORMAT = "id_%d";
|
||||
private static final String NO_SUFFIX_FORMAT = "%d";
|
||||
private static final long STABLE_FLAG = 1L << 62;
|
||||
private static final int DEFAULT_LOW_REFRESH_RATE = 60;
|
||||
private static final int DEFAULT_HIGH_REFRESH_RATE = 0;
|
||||
private static final int[] DEFAULT_BRIGHTNESS_THRESHOLDS = new int[]{};
|
||||
|
||||
private static final float[] DEFAULT_AMBIENT_THRESHOLD_LEVELS = new float[]{0f};
|
||||
private static final float[] DEFAULT_AMBIENT_BRIGHTENING_THRESHOLDS = new float[]{100f};
|
||||
@@ -512,6 +547,49 @@ public class DisplayDeviceConfig {
|
||||
// This stores the raw value loaded from the config file - true if not written.
|
||||
private boolean mDdcAutoBrightnessAvailable = true;
|
||||
|
||||
/**
|
||||
* The default peak refresh rate for a given device. This value prevents the framework from
|
||||
* using higher refresh rates, even if display modes with higher refresh rates are available
|
||||
* from hardware composer. Only has an effect if the value is non-zero.
|
||||
*/
|
||||
private int mDefaultHighRefreshRate = DEFAULT_HIGH_REFRESH_RATE;
|
||||
|
||||
/**
|
||||
* The default refresh rate for a given device. This value sets the higher default
|
||||
* refresh rate. If the hardware composer on the device supports display modes with
|
||||
* a higher refresh rate than the default value specified here, the framework may use those
|
||||
* higher refresh rate modes if an app chooses one by setting preferredDisplayModeId or calling
|
||||
* setFrameRate(). We have historically allowed fallback to mDefaultHighRefreshRate if
|
||||
* mDefaultLowRefreshRate is set to 0, but this is not supported anymore.
|
||||
*/
|
||||
private int mDefaultLowRefreshRate = DEFAULT_LOW_REFRESH_RATE;
|
||||
|
||||
/**
|
||||
* The display uses different gamma curves for different refresh rates. It's hard for panel
|
||||
* vendors to tune the curves to have exact same brightness for different refresh rate. So
|
||||
* brightness flickers could be observed at switch time. The issue is worse at the gamma lower
|
||||
* end. In addition, human eyes are more sensitive to the flicker at darker environment. To
|
||||
* prevent flicker, we only support higher refresh rates if the display brightness is above a
|
||||
* threshold. For example, no higher refresh rate if display brightness <= disp0 && ambient
|
||||
* brightness <= amb0 || display brightness <= disp1 && ambient brightness <= amb1
|
||||
*/
|
||||
private int[] mLowDisplayBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS;
|
||||
private int[] mLowAmbientBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS;
|
||||
|
||||
/**
|
||||
* The display uses different gamma curves for different refresh rates. It's hard for panel
|
||||
* vendors to tune the curves to have exact same brightness for different refresh rate. So
|
||||
* brightness flickers could be observed at switch time. The issue can be observed on the screen
|
||||
* with even full white content at the high brightness. To prevent flickering, we support fixed
|
||||
* refresh rates if the display and ambient brightness are equal to or above the provided
|
||||
* thresholds. You can define multiple threshold levels as higher brightness environments may
|
||||
* have lower display brightness requirements for the flickering is visible. For example, fixed
|
||||
* refresh rate if display brightness >= disp0 && ambient brightness >= amb0 || display
|
||||
* brightness >= disp1 && ambient brightness >= amb1
|
||||
*/
|
||||
private int[] mHighDisplayBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS;
|
||||
private int[] mHighAmbientBrightnessThresholds = DEFAULT_BRIGHTNESS_THRESHOLDS;
|
||||
|
||||
// Brightness Throttling data may be updated via the DeviceConfig. Here we store the original
|
||||
// data, which comes from the ddc, and the current one, which may be the DeviceConfig
|
||||
// overwritten value.
|
||||
@@ -1196,15 +1274,15 @@ public class DisplayDeviceConfig {
|
||||
/**
|
||||
* @return Default peak refresh rate of the associated display
|
||||
*/
|
||||
public int getDefaultPeakRefreshRate() {
|
||||
return mContext.getResources().getInteger(R.integer.config_defaultPeakRefreshRate);
|
||||
public int getDefaultHighRefreshRate() {
|
||||
return mDefaultHighRefreshRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Default refresh rate of the associated display
|
||||
*/
|
||||
public int getDefaultRefreshRate() {
|
||||
return mContext.getResources().getInteger(R.integer.config_defaultRefreshRate);
|
||||
public int getDefaultLowRefreshRate() {
|
||||
return mDefaultLowRefreshRate;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1213,8 +1291,7 @@ public class DisplayDeviceConfig {
|
||||
* allowed
|
||||
*/
|
||||
public int[] getLowDisplayBrightnessThresholds() {
|
||||
return mContext.getResources().getIntArray(
|
||||
R.array.config_brightnessThresholdsOfPeakRefreshRate);
|
||||
return mLowDisplayBrightnessThresholds;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1223,8 +1300,7 @@ public class DisplayDeviceConfig {
|
||||
* allowed
|
||||
*/
|
||||
public int[] getLowAmbientBrightnessThresholds() {
|
||||
return mContext.getResources().getIntArray(
|
||||
R.array.config_ambientThresholdsOfPeakRefreshRate);
|
||||
return mLowAmbientBrightnessThresholds;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1233,8 +1309,7 @@ public class DisplayDeviceConfig {
|
||||
* allowed
|
||||
*/
|
||||
public int[] getHighDisplayBrightnessThresholds() {
|
||||
return mContext.getResources().getIntArray(
|
||||
R.array.config_highDisplayBrightnessThresholdsOfFixedRefreshRate);
|
||||
return mHighDisplayBrightnessThresholds;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1243,8 +1318,7 @@ public class DisplayDeviceConfig {
|
||||
* allowed
|
||||
*/
|
||||
public int[] getHighAmbientBrightnessThresholds() {
|
||||
return mContext.getResources().getIntArray(
|
||||
R.array.config_highAmbientBrightnessThresholdsOfFixedRefreshRate);
|
||||
return mHighAmbientBrightnessThresholds;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1336,6 +1410,17 @@ public class DisplayDeviceConfig {
|
||||
+ ", mBrightnessLevelsNits= " + Arrays.toString(mBrightnessLevelsNits)
|
||||
+ ", mDdcAutoBrightnessAvailable= " + mDdcAutoBrightnessAvailable
|
||||
+ ", mAutoBrightnessAvailable= " + mAutoBrightnessAvailable
|
||||
+ "\n"
|
||||
+ ", mDefaultRefreshRate= " + mDefaultLowRefreshRate
|
||||
+ ", mDefaultPeakRefreshRate= " + mDefaultHighRefreshRate
|
||||
+ ", mLowDisplayBrightnessThresholds= "
|
||||
+ Arrays.toString(mLowDisplayBrightnessThresholds)
|
||||
+ ", mLowAmbientBrightnessThresholds= "
|
||||
+ Arrays.toString(mLowAmbientBrightnessThresholds)
|
||||
+ ", mHighDisplayBrightnessThresholds= "
|
||||
+ Arrays.toString(mHighDisplayBrightnessThresholds)
|
||||
+ ", mHighAmbientBrightnessThresholds= "
|
||||
+ Arrays.toString(mHighAmbientBrightnessThresholds)
|
||||
+ "}";
|
||||
}
|
||||
|
||||
@@ -1393,6 +1478,7 @@ public class DisplayDeviceConfig {
|
||||
loadAmbientHorizonFromDdc(config);
|
||||
loadBrightnessChangeThresholds(config);
|
||||
loadAutoBrightnessConfigValues(config);
|
||||
loadRefreshRateSetting(config);
|
||||
} else {
|
||||
Slog.w(TAG, "DisplayDeviceConfig file is null");
|
||||
}
|
||||
@@ -1415,6 +1501,7 @@ public class DisplayDeviceConfig {
|
||||
useFallbackProxSensor();
|
||||
loadAutoBrightnessConfigsFromConfigXml();
|
||||
loadAutoBrightnessAvailableFromConfigXml();
|
||||
loadRefreshRateSetting(null);
|
||||
mLoadedFrom = "<config.xml>";
|
||||
}
|
||||
|
||||
@@ -1625,6 +1712,143 @@ public class DisplayDeviceConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadRefreshRateSetting(DisplayConfiguration config) {
|
||||
final RefreshRateConfigs refreshRateConfigs =
|
||||
(config == null) ? null : config.getRefreshRate();
|
||||
BlockingZoneConfig lowerBlockingZoneConfig =
|
||||
(refreshRateConfigs == null) ? null
|
||||
: refreshRateConfigs.getLowerBlockingZoneConfigs();
|
||||
BlockingZoneConfig higherBlockingZoneConfig =
|
||||
(refreshRateConfigs == null) ? null
|
||||
: refreshRateConfigs.getHigherBlockingZoneConfigs();
|
||||
loadLowerRefreshRateBlockingZones(lowerBlockingZoneConfig);
|
||||
loadHigherRefreshRateBlockingZones(higherBlockingZoneConfig);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads the refresh rate configurations pertaining to the upper blocking zones.
|
||||
*/
|
||||
private void loadLowerRefreshRateBlockingZones(BlockingZoneConfig lowerBlockingZoneConfig) {
|
||||
loadLowerBlockingZoneDefaultRefreshRate(lowerBlockingZoneConfig);
|
||||
loadLowerBrightnessThresholds(lowerBlockingZoneConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the refresh rate configurations pertaining to the upper blocking zones.
|
||||
*/
|
||||
private void loadHigherRefreshRateBlockingZones(BlockingZoneConfig upperBlockingZoneConfig) {
|
||||
loadHigherBlockingZoneDefaultRefreshRate(upperBlockingZoneConfig);
|
||||
loadHigherBrightnessThresholds(upperBlockingZoneConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the default peak refresh rate. Internally, this takes care of loading
|
||||
* the value from the display config, and if not present, falls back to config.xml.
|
||||
*/
|
||||
private void loadHigherBlockingZoneDefaultRefreshRate(
|
||||
BlockingZoneConfig upperBlockingZoneConfig) {
|
||||
if (upperBlockingZoneConfig == null) {
|
||||
mDefaultHighRefreshRate = mContext.getResources().getInteger(
|
||||
com.android.internal.R.integer.config_defaultPeakRefreshRate);
|
||||
} else {
|
||||
mDefaultHighRefreshRate =
|
||||
upperBlockingZoneConfig.getDefaultRefreshRate().intValue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the default refresh rate. Internally, this takes care of loading
|
||||
* the value from the display config, and if not present, falls back to config.xml.
|
||||
*/
|
||||
private void loadLowerBlockingZoneDefaultRefreshRate(
|
||||
BlockingZoneConfig lowerBlockingZoneConfig) {
|
||||
if (lowerBlockingZoneConfig == null) {
|
||||
mDefaultLowRefreshRate = mContext.getResources().getInteger(
|
||||
com.android.internal.R.integer.config_defaultRefreshRate);
|
||||
} else {
|
||||
mDefaultLowRefreshRate =
|
||||
lowerBlockingZoneConfig.getDefaultRefreshRate().intValue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the lower brightness thresholds for refresh rate switching. Internally, this takes care
|
||||
* of loading the value from the display config, and if not present, falls back to config.xml.
|
||||
*/
|
||||
private void loadLowerBrightnessThresholds(BlockingZoneConfig lowerBlockingZoneConfig) {
|
||||
if (lowerBlockingZoneConfig == null) {
|
||||
mLowDisplayBrightnessThresholds = mContext.getResources().getIntArray(
|
||||
R.array.config_brightnessThresholdsOfPeakRefreshRate);
|
||||
mLowAmbientBrightnessThresholds = mContext.getResources().getIntArray(
|
||||
R.array.config_ambientThresholdsOfPeakRefreshRate);
|
||||
if (mLowDisplayBrightnessThresholds == null || mLowAmbientBrightnessThresholds == null
|
||||
|| mLowDisplayBrightnessThresholds.length
|
||||
!= mLowAmbientBrightnessThresholds.length) {
|
||||
throw new RuntimeException("display low brightness threshold array and ambient "
|
||||
+ "brightness threshold array have different length: "
|
||||
+ "mLowDisplayBrightnessThresholds="
|
||||
+ Arrays.toString(mLowDisplayBrightnessThresholds)
|
||||
+ ", mLowAmbientBrightnessThresholds="
|
||||
+ Arrays.toString(mLowAmbientBrightnessThresholds));
|
||||
}
|
||||
} else {
|
||||
List<DisplayBrightnessPoint> lowerThresholdDisplayBrightnessPoints =
|
||||
lowerBlockingZoneConfig.getBlockingZoneThreshold().getDisplayBrightnessPoint();
|
||||
int size = lowerThresholdDisplayBrightnessPoints.size();
|
||||
mLowDisplayBrightnessThresholds = new int[size];
|
||||
mLowAmbientBrightnessThresholds = new int[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
// We are explicitly casting this value to an integer to be able to reuse the
|
||||
// existing DisplayBrightnessPoint type. It is fine to do this because the round off
|
||||
// will have the negligible and unnoticeable impact on the loaded thresholds.
|
||||
mLowDisplayBrightnessThresholds[i] = (int) lowerThresholdDisplayBrightnessPoints
|
||||
.get(i).getNits().floatValue();
|
||||
mLowAmbientBrightnessThresholds[i] = lowerThresholdDisplayBrightnessPoints
|
||||
.get(i).getLux().intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the higher brightness thresholds for refresh rate switching. Internally, this takes
|
||||
* care of loading the value from the display config, and if not present, falls back to
|
||||
* config.xml.
|
||||
*/
|
||||
private void loadHigherBrightnessThresholds(BlockingZoneConfig blockingZoneConfig) {
|
||||
if (blockingZoneConfig == null) {
|
||||
mHighDisplayBrightnessThresholds = mContext.getResources().getIntArray(
|
||||
R.array.config_highDisplayBrightnessThresholdsOfFixedRefreshRate);
|
||||
mHighAmbientBrightnessThresholds = mContext.getResources().getIntArray(
|
||||
R.array.config_highAmbientBrightnessThresholdsOfFixedRefreshRate);
|
||||
if (mHighAmbientBrightnessThresholds == null || mHighDisplayBrightnessThresholds == null
|
||||
|| mHighAmbientBrightnessThresholds.length
|
||||
!= mHighDisplayBrightnessThresholds.length) {
|
||||
throw new RuntimeException("display high brightness threshold array and ambient "
|
||||
+ "brightness threshold array have different length: "
|
||||
+ "mHighDisplayBrightnessThresholds="
|
||||
+ Arrays.toString(mHighDisplayBrightnessThresholds)
|
||||
+ ", mHighAmbientBrightnessThresholds="
|
||||
+ Arrays.toString(mHighAmbientBrightnessThresholds));
|
||||
}
|
||||
} else {
|
||||
List<DisplayBrightnessPoint> higherThresholdDisplayBrightnessPoints =
|
||||
blockingZoneConfig.getBlockingZoneThreshold().getDisplayBrightnessPoint();
|
||||
int size = higherThresholdDisplayBrightnessPoints.size();
|
||||
mHighDisplayBrightnessThresholds = new int[size];
|
||||
mHighAmbientBrightnessThresholds = new int[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
// We are explicitly casting this value to an integer to be able to reuse the
|
||||
// existing DisplayBrightnessPoint type. It is fine to do this because the round off
|
||||
// will have the negligible and unnoticeable impact on the loaded thresholds.
|
||||
mHighDisplayBrightnessThresholds[i] = (int) higherThresholdDisplayBrightnessPoints
|
||||
.get(i).getNits().floatValue();
|
||||
mHighAmbientBrightnessThresholds[i] = higherThresholdDisplayBrightnessPoints
|
||||
.get(i).getLux().intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadAutoBrightnessConfigValues(DisplayConfiguration config) {
|
||||
final AutoBrightness autoBrightness = config.getAutoBrightness();
|
||||
loadAutoBrightnessBrighteningLightDebounce(autoBrightness);
|
||||
|
||||
@@ -1163,7 +1163,7 @@ public class DisplayModeDirector {
|
||||
mDefaultRefreshRate =
|
||||
(displayDeviceConfig == null) ? (float) mContext.getResources().getInteger(
|
||||
R.integer.config_defaultRefreshRate)
|
||||
: (float) displayDeviceConfig.getDefaultRefreshRate();
|
||||
: (float) displayDeviceConfig.getDefaultLowRefreshRate();
|
||||
}
|
||||
|
||||
public void observe() {
|
||||
@@ -1250,7 +1250,7 @@ public class DisplayModeDirector {
|
||||
defaultPeakRefreshRate =
|
||||
(displayDeviceConfig == null) ? (float) mContext.getResources().getInteger(
|
||||
R.integer.config_defaultPeakRefreshRate)
|
||||
: (float) displayDeviceConfig.getDefaultPeakRefreshRate();
|
||||
: (float) displayDeviceConfig.getDefaultHighRefreshRate();
|
||||
}
|
||||
mDefaultPeakRefreshRate = defaultPeakRefreshRate;
|
||||
}
|
||||
|
||||
@@ -44,9 +44,11 @@
|
||||
</xs:element>
|
||||
<xs:element type="highBrightnessMode" name="highBrightnessMode" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element type="displayQuirks" name="quirks" minOccurs="0" maxOccurs="1" />
|
||||
<xs:element type="displayQuirks" name="quirks" minOccurs="0" maxOccurs="1"/>
|
||||
<xs:element type="autoBrightness" name="autoBrightness" minOccurs="0"
|
||||
maxOccurs="1" />
|
||||
maxOccurs="1"/>
|
||||
<xs:element type="refreshRateConfigs" name="refreshRate" minOccurs="0"
|
||||
maxOccurs="1"/>
|
||||
<xs:element type="nonNegativeDecimal" name="screenBrightnessRampFastDecrease">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
@@ -324,7 +326,7 @@
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- Thresholds for brightness changes. -->
|
||||
<xs:complexType name="thresholds">
|
||||
@@ -452,4 +454,35 @@
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="refreshRateConfigs">
|
||||
<xs:element name="lowerBlockingZoneConfigs" type="blockingZoneConfig"
|
||||
minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
<xs:element name="higherBlockingZoneConfigs" type="blockingZoneConfig"
|
||||
minOccurs="0" maxOccurs="1">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="blockingZoneConfig">
|
||||
<xs:element name="defaultRefreshRate" type="xs:nonNegativeInteger"
|
||||
minOccurs="1" maxOccurs="1">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
<xs:element name="blockingZoneThreshold" type="blockingZoneThreshold"
|
||||
minOccurs="1" maxOccurs="1">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="blockingZoneThreshold">
|
||||
<xs:sequence>
|
||||
<xs:element name="displayBrightnessPoint" type="displayBrightnessPoint"
|
||||
minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:annotation name="final"/>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
|
||||
@@ -13,6 +13,19 @@ package com.android.server.display.config {
|
||||
method public void setEnabled(boolean);
|
||||
}
|
||||
|
||||
public class BlockingZoneConfig {
|
||||
ctor public BlockingZoneConfig();
|
||||
method public final com.android.server.display.config.BlockingZoneThreshold getBlockingZoneThreshold();
|
||||
method public final java.math.BigInteger getDefaultRefreshRate();
|
||||
method public final void setBlockingZoneThreshold(com.android.server.display.config.BlockingZoneThreshold);
|
||||
method public final void setDefaultRefreshRate(java.math.BigInteger);
|
||||
}
|
||||
|
||||
public class BlockingZoneThreshold {
|
||||
ctor public BlockingZoneThreshold();
|
||||
method public final java.util.List<com.android.server.display.config.DisplayBrightnessPoint> getDisplayBrightnessPoint();
|
||||
}
|
||||
|
||||
public class BrightnessThresholds {
|
||||
ctor public BrightnessThresholds();
|
||||
method public final com.android.server.display.config.ThresholdPoints getBrightnessThresholdPoints();
|
||||
@@ -76,6 +89,7 @@ package com.android.server.display.config {
|
||||
method public final com.android.server.display.config.SensorDetails getLightSensor();
|
||||
method public final com.android.server.display.config.SensorDetails getProxSensor();
|
||||
method public com.android.server.display.config.DisplayQuirks getQuirks();
|
||||
method public com.android.server.display.config.RefreshRateConfigs getRefreshRate();
|
||||
method @NonNull public final java.math.BigDecimal getScreenBrightnessDefault();
|
||||
method @NonNull public final com.android.server.display.config.NitsMap getScreenBrightnessMap();
|
||||
method public final java.math.BigInteger getScreenBrightnessRampDecreaseMaxMillis();
|
||||
@@ -97,6 +111,7 @@ package com.android.server.display.config {
|
||||
method public final void setLightSensor(com.android.server.display.config.SensorDetails);
|
||||
method public final void setProxSensor(com.android.server.display.config.SensorDetails);
|
||||
method public void setQuirks(com.android.server.display.config.DisplayQuirks);
|
||||
method public void setRefreshRate(com.android.server.display.config.RefreshRateConfigs);
|
||||
method public final void setScreenBrightnessDefault(@NonNull java.math.BigDecimal);
|
||||
method public final void setScreenBrightnessMap(@NonNull com.android.server.display.config.NitsMap);
|
||||
method public final void setScreenBrightnessRampDecreaseMaxMillis(java.math.BigInteger);
|
||||
@@ -160,6 +175,14 @@ package com.android.server.display.config {
|
||||
method public final void setValue(@NonNull java.math.BigDecimal);
|
||||
}
|
||||
|
||||
public class RefreshRateConfigs {
|
||||
ctor public RefreshRateConfigs();
|
||||
method public final com.android.server.display.config.BlockingZoneConfig getHigherBlockingZoneConfigs();
|
||||
method public final com.android.server.display.config.BlockingZoneConfig getLowerBlockingZoneConfigs();
|
||||
method public final void setHigherBlockingZoneConfigs(com.android.server.display.config.BlockingZoneConfig);
|
||||
method public final void setLowerBlockingZoneConfigs(com.android.server.display.config.BlockingZoneConfig);
|
||||
}
|
||||
|
||||
public class RefreshRateRange {
|
||||
ctor public RefreshRateRange();
|
||||
method public final java.math.BigInteger getMaximum();
|
||||
|
||||
@@ -155,6 +155,18 @@ public class LocalDisplayAdapterTest {
|
||||
when(mMockedResources.getIntArray(
|
||||
com.android.internal.R.array.config_autoBrightnessLevels))
|
||||
.thenReturn(new int[]{});
|
||||
when(mMockedResources.getIntArray(
|
||||
com.android.internal.R.array.config_brightnessThresholdsOfPeakRefreshRate))
|
||||
.thenReturn(new int[]{});
|
||||
when(mMockedResources.getIntArray(
|
||||
com.android.internal.R.array.config_ambientThresholdsOfPeakRefreshRate))
|
||||
.thenReturn(new int[]{});
|
||||
when(mMockedResources.getIntArray(
|
||||
com.android.internal.R.array.config_highDisplayBrightnessThresholdsOfFixedRefreshRate))
|
||||
.thenReturn(new int[]{});
|
||||
when(mMockedResources.getIntArray(
|
||||
com.android.internal.R.array.config_highAmbientBrightnessThresholdsOfFixedRefreshRate))
|
||||
.thenReturn(new int[]{});
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -150,6 +150,16 @@ public final class DisplayDeviceConfigTest {
|
||||
|
||||
assertEquals("ProximitySensor123", mDisplayDeviceConfig.getProximitySensor().name);
|
||||
assertEquals("prox_type_1", mDisplayDeviceConfig.getProximitySensor().type);
|
||||
assertEquals(75, mDisplayDeviceConfig.getDefaultLowRefreshRate());
|
||||
assertEquals(90, mDisplayDeviceConfig.getDefaultHighRefreshRate());
|
||||
assertArrayEquals(new int[]{45, 55},
|
||||
mDisplayDeviceConfig.getLowDisplayBrightnessThresholds());
|
||||
assertArrayEquals(new int[]{50, 60},
|
||||
mDisplayDeviceConfig.getLowAmbientBrightnessThresholds());
|
||||
assertArrayEquals(new int[]{65, 75},
|
||||
mDisplayDeviceConfig.getHighDisplayBrightnessThresholds());
|
||||
assertArrayEquals(new int[]{70, 80},
|
||||
mDisplayDeviceConfig.getHighAmbientBrightnessThresholds());
|
||||
|
||||
// Todo(brup): Add asserts for BrightnessThrottlingData, DensityMapping,
|
||||
// HighBrightnessModeData AmbientLightSensor, RefreshRateLimitations and ProximitySensor.
|
||||
@@ -212,9 +222,8 @@ public final class DisplayDeviceConfigTest {
|
||||
mDisplayDeviceConfig.getAmbientDarkeningLevelsIdle(), ZERO_DELTA);
|
||||
assertArrayEquals(new float[]{29, 30, 31},
|
||||
mDisplayDeviceConfig.getAmbientDarkeningPercentagesIdle(), ZERO_DELTA);
|
||||
|
||||
assertEquals(mDisplayDeviceConfig.getDefaultRefreshRate(), DEFAULT_REFRESH_RATE);
|
||||
assertEquals(mDisplayDeviceConfig.getDefaultPeakRefreshRate(), DEFAULT_PEAK_REFRESH_RATE);
|
||||
assertEquals(mDisplayDeviceConfig.getDefaultLowRefreshRate(), DEFAULT_REFRESH_RATE);
|
||||
assertEquals(mDisplayDeviceConfig.getDefaultHighRefreshRate(), DEFAULT_PEAK_REFRESH_RATE);
|
||||
assertArrayEquals(mDisplayDeviceConfig.getLowDisplayBrightnessThresholds(),
|
||||
LOW_BRIGHTNESS_THRESHOLD_OF_PEAK_REFRESH_RATE);
|
||||
assertArrayEquals(mDisplayDeviceConfig.getLowAmbientBrightnessThresholds(),
|
||||
@@ -426,6 +435,38 @@ public final class DisplayDeviceConfigTest {
|
||||
+ "<name>ProximitySensor123</name>\n"
|
||||
+ "<type>prox_type_1</type>\n"
|
||||
+ "</proxSensor>\n"
|
||||
+ "<refreshRate>\n"
|
||||
+ "<lowerBlockingZoneConfigs>\n"
|
||||
+ "<defaultRefreshRate>75</defaultRefreshRate>\n"
|
||||
+ "<blockingZoneThreshold>\n"
|
||||
+ "<displayBrightnessPoint>\n"
|
||||
+ "<lux>50</lux>\n"
|
||||
// This number will be rounded to integer when read by the system
|
||||
+ "<nits>45.3</nits>\n"
|
||||
+ "</displayBrightnessPoint>\n"
|
||||
+ "<displayBrightnessPoint>\n"
|
||||
+ "<lux>60</lux>\n"
|
||||
// This number will be rounded to integer when read by the system
|
||||
+ "<nits>55.2</nits>\n"
|
||||
+ "</displayBrightnessPoint>\n"
|
||||
+ "</blockingZoneThreshold>\n"
|
||||
+ "</lowerBlockingZoneConfigs>\n"
|
||||
+ "<higherBlockingZoneConfigs>\n"
|
||||
+ "<defaultRefreshRate>90</defaultRefreshRate>\n"
|
||||
+ "<blockingZoneThreshold>\n"
|
||||
+ "<displayBrightnessPoint>\n"
|
||||
+ "<lux>70</lux>\n"
|
||||
// This number will be rounded to integer when read by the system
|
||||
+ "<nits>65.6</nits>\n"
|
||||
+ "</displayBrightnessPoint>\n"
|
||||
+ "<displayBrightnessPoint>\n"
|
||||
+ "<lux>80</lux>\n"
|
||||
// This number will be rounded to integer when read by the system
|
||||
+ "<nits>75</nits>\n"
|
||||
+ "</displayBrightnessPoint>\n"
|
||||
+ "</blockingZoneThreshold>\n"
|
||||
+ "</higherBlockingZoneConfigs>\n"
|
||||
+ "</refreshRate>\n"
|
||||
+ "</displayConfiguration>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -1896,8 +1896,8 @@ public class DisplayModeDirectorTest {
|
||||
|
||||
// Notify that the default display is updated, such that DisplayDeviceConfig has new values
|
||||
DisplayDeviceConfig displayDeviceConfig = mock(DisplayDeviceConfig.class);
|
||||
when(displayDeviceConfig.getDefaultRefreshRate()).thenReturn(50);
|
||||
when(displayDeviceConfig.getDefaultPeakRefreshRate()).thenReturn(55);
|
||||
when(displayDeviceConfig.getDefaultLowRefreshRate()).thenReturn(50);
|
||||
when(displayDeviceConfig.getDefaultHighRefreshRate()).thenReturn(55);
|
||||
when(displayDeviceConfig.getLowDisplayBrightnessThresholds()).thenReturn(new int[]{25});
|
||||
when(displayDeviceConfig.getLowAmbientBrightnessThresholds()).thenReturn(new int[]{30});
|
||||
when(displayDeviceConfig.getHighDisplayBrightnessThresholds()).thenReturn(new int[]{210});
|
||||
|
||||
Reference in New Issue
Block a user