Merge "Add idle threshold levels to ddc" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d639c8ee73
@@ -592,10 +592,14 @@ class AutomaticBrightnessController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pw.println();
|
pw.println();
|
||||||
|
pw.println(" mAmbientBrightnessThresholds=");
|
||||||
mAmbientBrightnessThresholds.dump(pw);
|
mAmbientBrightnessThresholds.dump(pw);
|
||||||
|
pw.println(" mScreenBrightnessThresholds=");
|
||||||
mScreenBrightnessThresholds.dump(pw);
|
mScreenBrightnessThresholds.dump(pw);
|
||||||
|
pw.println(" mScreenBrightnessThresholdsIdle=");
|
||||||
mScreenBrightnessThresholdsIdle.dump(pw);
|
mScreenBrightnessThresholdsIdle.dump(pw);
|
||||||
mScreenBrightnessThresholdsIdle.dump(pw);
|
pw.println(" mAmbientBrightnessThresholdsIdle=");
|
||||||
|
mAmbientBrightnessThresholdsIdle.dump(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String configStateToString(int state) {
|
private String configStateToString(int state) {
|
||||||
@@ -860,6 +864,7 @@ class AutomaticBrightnessController {
|
|||||||
Slog.d(TAG, "updateAmbientLux: "
|
Slog.d(TAG, "updateAmbientLux: "
|
||||||
+ ((mFastAmbientLux > mAmbientLux) ? "Brightened" : "Darkened") + ": "
|
+ ((mFastAmbientLux > mAmbientLux) ? "Brightened" : "Darkened") + ": "
|
||||||
+ "mBrighteningLuxThreshold=" + mAmbientBrighteningThreshold + ", "
|
+ "mBrighteningLuxThreshold=" + mAmbientBrighteningThreshold + ", "
|
||||||
|
+ "mAmbientDarkeningThreshold=" + mAmbientDarkeningThreshold + ", "
|
||||||
+ "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", "
|
+ "mAmbientLightRingBuffer=" + mAmbientLightRingBuffer + ", "
|
||||||
+ "mAmbientLux=" + mAmbientLux);
|
+ "mAmbientLux=" + mAmbientLux);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import android.os.Environment;
|
|||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.MathUtils;
|
import android.util.MathUtils;
|
||||||
|
import android.util.Pair;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.Spline;
|
import android.util.Spline;
|
||||||
import android.view.DisplayAddress;
|
import android.view.DisplayAddress;
|
||||||
@@ -51,7 +52,7 @@ import com.android.server.display.config.SdrHdrRatioPoint;
|
|||||||
import com.android.server.display.config.SensorDetails;
|
import com.android.server.display.config.SensorDetails;
|
||||||
import com.android.server.display.config.ThermalStatus;
|
import com.android.server.display.config.ThermalStatus;
|
||||||
import com.android.server.display.config.ThermalThrottling;
|
import com.android.server.display.config.ThermalThrottling;
|
||||||
import com.android.server.display.config.Thresholds;
|
import com.android.server.display.config.ThresholdPoint;
|
||||||
import com.android.server.display.config.XmlParser;
|
import com.android.server.display.config.XmlParser;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
@@ -188,42 +189,153 @@ import javax.xml.datatype.DatatypeConfigurationException;
|
|||||||
* <ambientLightHorizonLong>10001</ambientLightHorizonLong>
|
* <ambientLightHorizonLong>10001</ambientLightHorizonLong>
|
||||||
* <ambientLightHorizonShort>2001</ambientLightHorizonShort>
|
* <ambientLightHorizonShort>2001</ambientLightHorizonShort>
|
||||||
*
|
*
|
||||||
* <displayBrightnessChangeThresholds> // Thresholds for screen changes
|
* <ambientBrightnessChangeThresholds> // Thresholds for lux changes
|
||||||
* <brighteningThresholds> // Thresholds for active mode brightness changes.
|
* <brighteningThresholds>
|
||||||
* <minimum>0.001</minimum> // Minimum change needed in screen brightness to brighten.
|
* // Minimum change needed in ambient brightness to brighten screen.
|
||||||
* </brighteningThresholds>
|
* <minimum>10</minimum>
|
||||||
* <darkeningThresholds>
|
* // Percentage increase of lux needed to increase the screen brightness at a lux range
|
||||||
* <minimum>0.002</minimum> // Minimum change needed in screen brightness to darken.
|
* // above the specified threshold.
|
||||||
* </darkeningThresholds>
|
* <brightnessThresholdPoints>
|
||||||
* </displayBrightnessChangeThresholds>
|
* <brightnessThresholdPoint>
|
||||||
*
|
* <threshold>0</threshold><percentage>13</percentage>
|
||||||
* <ambientBrightnessChangeThresholds> // Thresholds for lux changes
|
* </brightnessThresholdPoint>
|
||||||
* <brighteningThresholds> // Thresholds for active mode brightness changes.
|
* <brightnessThresholdPoint>
|
||||||
* <minimum>0.003</minimum> // Minimum change needed in ambient brightness to brighten.
|
* <threshold>100</threshold><percentage>14</percentage>
|
||||||
* </brighteningThresholds>
|
* </brightnessThresholdPoint>
|
||||||
* <darkeningThresholds>
|
* <brightnessThresholdPoint>
|
||||||
* <minimum>0.004</minimum> // Minimum change needed in ambient brightness to darken.
|
* <threshold>200</threshold><percentage>15</percentage>
|
||||||
* </darkeningThresholds>
|
* </brightnessThresholdPoint>
|
||||||
* </ambientBrightnessChangeThresholds>
|
* </brightnessThresholdPoints>
|
||||||
*
|
* </brighteningThresholds>
|
||||||
* <displayBrightnessChangeThresholdsIdle> // Thresholds for screen changes in idle mode
|
* <darkeningThresholds>
|
||||||
* <brighteningThresholds> // Thresholds for idle mode brightness changes.
|
* // Minimum change needed in ambient brightness to darken screen.
|
||||||
* <minimum>0.001</minimum> // Minimum change needed in screen brightness to brighten.
|
* <minimum>30</minimum>
|
||||||
* </brighteningThresholds>
|
* // Percentage increase of lux needed to decrease the screen brightness at a lux range
|
||||||
* <darkeningThresholds>
|
* // above the specified threshold.
|
||||||
* <minimum>0.002</minimum> // Minimum change needed in screen brightness to darken.
|
* <brightnessThresholdPoints>
|
||||||
* </darkeningThresholds>
|
* <brightnessThresholdPoint>
|
||||||
* </displayBrightnessChangeThresholdsIdle>
|
* <threshold>0</threshold><percentage>15</percentage>
|
||||||
*
|
* </brightnessThresholdPoint>
|
||||||
* <ambientBrightnessChangeThresholdsIdle> // Thresholds for lux changes in idle mode
|
* <brightnessThresholdPoint>
|
||||||
* <brighteningThresholds> // Thresholds for idle mode brightness changes.
|
* <threshold>300</threshold><percentage>16</percentage>
|
||||||
* <minimum>0.003</minimum> // Minimum change needed in ambient brightness to brighten.
|
* </brightnessThresholdPoint>
|
||||||
* </brighteningThresholds>
|
* <brightnessThresholdPoint>
|
||||||
* <darkeningThresholds>
|
* <threshold>400</threshold><percentage>17</percentage>
|
||||||
* <minimum>0.004</minimum> // Minimum change needed in ambient brightness to darken.
|
* </brightnessThresholdPoint>
|
||||||
* </darkeningThresholds>
|
* </brightnessThresholdPoints>
|
||||||
* </ambientBrightnessChangeThresholdsIdle>
|
* </darkeningThresholds>
|
||||||
*
|
* </ambientBrightnessChangeThresholds>
|
||||||
|
* <displayBrightnessChangeThresholds> // Thresholds for screen brightness changes
|
||||||
|
* <brighteningThresholds>
|
||||||
|
* // Minimum change needed in screen brightness to brighten screen.
|
||||||
|
* <minimum>0.1</minimum>
|
||||||
|
* // Percentage increase of screen brightness needed to increase the screen brightness
|
||||||
|
* // at a lux range above the specified threshold.
|
||||||
|
* <brightnessThresholdPoints>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0</threshold>
|
||||||
|
* <percentage>9</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.10</threshold>
|
||||||
|
* <percentage>10</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.20</threshold>
|
||||||
|
* <percentage>11</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* </brightnessThresholdPoints>
|
||||||
|
* </brighteningThresholds>
|
||||||
|
* <darkeningThresholds>
|
||||||
|
* // Minimum change needed in screen brightness to darken screen.
|
||||||
|
* <minimum>0.3</minimum>
|
||||||
|
* // Percentage increase of screen brightness needed to decrease the screen brightness
|
||||||
|
* // at a lux range above the specified threshold.
|
||||||
|
* <brightnessThresholdPoints>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0</threshold><percentage>11</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.11</threshold><percentage>12</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.21</threshold><percentage>13</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* </brightnessThresholdPoints>
|
||||||
|
* </darkeningThresholds>
|
||||||
|
* </displayBrightnessChangeThresholds>
|
||||||
|
* <ambientBrightnessChangeThresholdsIdle> // Thresholds for lux changes in idle mode
|
||||||
|
* <brighteningThresholds>
|
||||||
|
* // Minimum change needed in ambient brightness to brighten screen in idle mode
|
||||||
|
* <minimum>20</minimum>
|
||||||
|
* // Percentage increase of lux needed to increase the screen brightness at a lux range
|
||||||
|
* // above the specified threshold whilst in idle mode.
|
||||||
|
* <brightnessThresholdPoints>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0</threshold><percentage>21</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>500</threshold><percentage>22</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>600</threshold><percentage>23</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* </brightnessThresholdPoints>
|
||||||
|
* </brighteningThresholds>
|
||||||
|
* <darkeningThresholds>
|
||||||
|
* // Minimum change needed in ambient brightness to darken screen in idle mode
|
||||||
|
* <minimum>40</minimum>
|
||||||
|
* // Percentage increase of lux needed to decrease the screen brightness at a lux range
|
||||||
|
* // above the specified threshold whilst in idle mode.
|
||||||
|
* <brightnessThresholdPoints>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0</threshold><percentage>23</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>700</threshold><percentage>24</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>800</threshold><percentage>25</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* </brightnessThresholdPoints>
|
||||||
|
* </darkeningThresholds>
|
||||||
|
* </ambientBrightnessChangeThresholdsIdle>
|
||||||
|
* <displayBrightnessChangeThresholdsIdle> // Thresholds for idle screen brightness changes
|
||||||
|
* <brighteningThresholds>
|
||||||
|
* // Minimum change needed in screen brightness to brighten screen in idle mode
|
||||||
|
* <minimum>0.2</minimum>
|
||||||
|
* // Percentage increase of screen brightness needed to increase the screen brightness
|
||||||
|
* // at a lux range above the specified threshold whilst in idle mode
|
||||||
|
* <brightnessThresholdPoints>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0</threshold><percentage>17</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.12</threshold><percentage>18</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.22</threshold><percentage>19</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* </brightnessThresholdPoints>
|
||||||
|
* </brighteningThresholds>
|
||||||
|
* <darkeningThresholds>
|
||||||
|
* // Minimum change needed in screen brightness to darken screen in idle mode
|
||||||
|
* <minimum>0.4</minimum>
|
||||||
|
* // Percentage increase of screen brightness needed to decrease the screen brightness
|
||||||
|
* // at a lux range above the specified threshold whilst in idle mode
|
||||||
|
* <brightnessThresholdPoints>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0</threshold><percentage>19</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.13</threshold><percentage>20</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* <brightnessThresholdPoint>
|
||||||
|
* <threshold>0.23</threshold><percentage>21</percentage>
|
||||||
|
* </brightnessThresholdPoint>
|
||||||
|
* </brightnessThresholdPoints>
|
||||||
|
* </darkeningThresholds>
|
||||||
|
* </displayBrightnessChangeThresholdsIdle>
|
||||||
* </displayConfiguration>
|
* </displayConfiguration>
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
@@ -247,6 +359,13 @@ public class DisplayDeviceConfig {
|
|||||||
private static final String NO_SUFFIX_FORMAT = "%d";
|
private static final String NO_SUFFIX_FORMAT = "%d";
|
||||||
private static final long STABLE_FLAG = 1L << 62;
|
private static final long STABLE_FLAG = 1L << 62;
|
||||||
|
|
||||||
|
private static final float[] DEFAULT_AMBIENT_THRESHOLD_LEVELS = new float[]{0f};
|
||||||
|
private static final float[] DEFAULT_AMBIENT_BRIGHTENING_THRESHOLDS = new float[]{100f};
|
||||||
|
private static final float[] DEFAULT_AMBIENT_DARKENING_THRESHOLDS = new float[]{200f};
|
||||||
|
private static final float[] DEFAULT_SCREEN_THRESHOLD_LEVELS = new float[]{0f};
|
||||||
|
private static final float[] DEFAULT_SCREEN_BRIGHTENING_THRESHOLDS = new float[]{100f};
|
||||||
|
private static final float[] DEFAULT_SCREEN_DARKENING_THRESHOLDS = new float[]{200f};
|
||||||
|
|
||||||
private static final int INTERPOLATION_DEFAULT = 0;
|
private static final int INTERPOLATION_DEFAULT = 0;
|
||||||
private static final int INTERPOLATION_LINEAR = 1;
|
private static final int INTERPOLATION_LINEAR = 1;
|
||||||
|
|
||||||
@@ -344,6 +463,31 @@ public class DisplayDeviceConfig {
|
|||||||
private float mAmbientLuxBrighteningMinThresholdIdle = 0.0f;
|
private float mAmbientLuxBrighteningMinThresholdIdle = 0.0f;
|
||||||
private float mAmbientLuxDarkeningMinThreshold = 0.0f;
|
private float mAmbientLuxDarkeningMinThreshold = 0.0f;
|
||||||
private float mAmbientLuxDarkeningMinThresholdIdle = 0.0f;
|
private float mAmbientLuxDarkeningMinThresholdIdle = 0.0f;
|
||||||
|
|
||||||
|
// Screen brightness thresholds levels & percentages
|
||||||
|
private float[] mScreenBrighteningLevels = DEFAULT_SCREEN_THRESHOLD_LEVELS;
|
||||||
|
private float[] mScreenBrighteningPercentages = DEFAULT_SCREEN_BRIGHTENING_THRESHOLDS;
|
||||||
|
private float[] mScreenDarkeningLevels = DEFAULT_SCREEN_THRESHOLD_LEVELS;
|
||||||
|
private float[] mScreenDarkeningPercentages = DEFAULT_SCREEN_DARKENING_THRESHOLDS;
|
||||||
|
|
||||||
|
// Screen brightness thresholds levels & percentages for idle mode
|
||||||
|
private float[] mScreenBrighteningLevelsIdle = DEFAULT_SCREEN_THRESHOLD_LEVELS;
|
||||||
|
private float[] mScreenBrighteningPercentagesIdle = DEFAULT_SCREEN_BRIGHTENING_THRESHOLDS;
|
||||||
|
private float[] mScreenDarkeningLevelsIdle = DEFAULT_SCREEN_THRESHOLD_LEVELS;
|
||||||
|
private float[] mScreenDarkeningPercentagesIdle = DEFAULT_SCREEN_DARKENING_THRESHOLDS;
|
||||||
|
|
||||||
|
// Ambient brightness thresholds levels & percentages
|
||||||
|
private float[] mAmbientBrighteningLevels = DEFAULT_AMBIENT_THRESHOLD_LEVELS;
|
||||||
|
private float[] mAmbientBrighteningPercentages = DEFAULT_AMBIENT_BRIGHTENING_THRESHOLDS;
|
||||||
|
private float[] mAmbientDarkeningLevels = DEFAULT_AMBIENT_THRESHOLD_LEVELS;
|
||||||
|
private float[] mAmbientDarkeningPercentages = DEFAULT_AMBIENT_DARKENING_THRESHOLDS;
|
||||||
|
|
||||||
|
// Ambient brightness thresholds levels & percentages for idle mode
|
||||||
|
private float[] mAmbientBrighteningLevelsIdle = DEFAULT_AMBIENT_THRESHOLD_LEVELS;
|
||||||
|
private float[] mAmbientBrighteningPercentagesIdle = DEFAULT_AMBIENT_BRIGHTENING_THRESHOLDS;
|
||||||
|
private float[] mAmbientDarkeningLevelsIdle = DEFAULT_AMBIENT_THRESHOLD_LEVELS;
|
||||||
|
private float[] mAmbientDarkeningPercentagesIdle = DEFAULT_AMBIENT_DARKENING_THRESHOLDS;
|
||||||
|
|
||||||
private Spline mBrightnessToBacklightSpline;
|
private Spline mBrightnessToBacklightSpline;
|
||||||
private Spline mBacklightToBrightnessSpline;
|
private Spline mBacklightToBrightnessSpline;
|
||||||
private Spline mBacklightToNitsSpline;
|
private Spline mBacklightToNitsSpline;
|
||||||
@@ -684,7 +828,7 @@ public class DisplayDeviceConfig {
|
|||||||
/**
|
/**
|
||||||
* The minimum value for the ambient lux increase for a screen brightness change to actually
|
* The minimum value for the ambient lux increase for a screen brightness change to actually
|
||||||
* occur.
|
* occur.
|
||||||
* @return float value in brightness scale of 0 - 1.
|
* @return float value in lux.
|
||||||
*/
|
*/
|
||||||
public float getAmbientLuxBrighteningMinThreshold() {
|
public float getAmbientLuxBrighteningMinThreshold() {
|
||||||
return mAmbientLuxBrighteningMinThreshold;
|
return mAmbientLuxBrighteningMinThreshold;
|
||||||
@@ -693,7 +837,7 @@ public class DisplayDeviceConfig {
|
|||||||
/**
|
/**
|
||||||
* The minimum value for the ambient lux decrease for a screen brightness change to actually
|
* The minimum value for the ambient lux decrease for a screen brightness change to actually
|
||||||
* occur.
|
* occur.
|
||||||
* @return float value in brightness scale of 0 - 1.
|
* @return float value in lux.
|
||||||
*/
|
*/
|
||||||
public float getAmbientLuxDarkeningMinThreshold() {
|
public float getAmbientLuxDarkeningMinThreshold() {
|
||||||
return mAmbientLuxDarkeningMinThreshold;
|
return mAmbientLuxDarkeningMinThreshold;
|
||||||
@@ -702,7 +846,7 @@ public class DisplayDeviceConfig {
|
|||||||
/**
|
/**
|
||||||
* The minimum value for the ambient lux increase for a screen brightness change to actually
|
* The minimum value for the ambient lux increase for a screen brightness change to actually
|
||||||
* occur while in idle screen brightness mode.
|
* occur while in idle screen brightness mode.
|
||||||
* @return float value in brightness scale of 0 - 1.
|
* @return float value in lux.
|
||||||
*/
|
*/
|
||||||
public float getAmbientLuxBrighteningMinThresholdIdle() {
|
public float getAmbientLuxBrighteningMinThresholdIdle() {
|
||||||
return mAmbientLuxBrighteningMinThresholdIdle;
|
return mAmbientLuxBrighteningMinThresholdIdle;
|
||||||
@@ -711,12 +855,262 @@ public class DisplayDeviceConfig {
|
|||||||
/**
|
/**
|
||||||
* The minimum value for the ambient lux decrease for a screen brightness change to actually
|
* The minimum value for the ambient lux decrease for a screen brightness change to actually
|
||||||
* occur while in idle screen brightness mode.
|
* occur while in idle screen brightness mode.
|
||||||
* @return float value in brightness scale of 0 - 1.
|
* @return float value in lux.
|
||||||
*/
|
*/
|
||||||
public float getAmbientLuxDarkeningMinThresholdIdle() {
|
public float getAmbientLuxDarkeningMinThresholdIdle() {
|
||||||
return mAmbientLuxDarkeningMinThresholdIdle;
|
return mAmbientLuxDarkeningMinThresholdIdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of screen brightness that each threshold percentage
|
||||||
|
* applies within.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current screen brightness value
|
||||||
|
* level = mScreenBrighteningLevels
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mScreenBrighteningPercentages[n]
|
||||||
|
* level[MAX] <= value = mScreenBrighteningPercentages[MAX]
|
||||||
|
*
|
||||||
|
* @return the screen brightness levels between 0.0 and 1.0 for which each
|
||||||
|
* mScreenBrighteningPercentages applies
|
||||||
|
*/
|
||||||
|
public float[] getScreenBrighteningLevels() {
|
||||||
|
return mScreenBrighteningLevels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the screen brightening threshold percentage change at each screen
|
||||||
|
* brightness level described in mScreenBrighteningLevels.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of brightness increase required in order for the
|
||||||
|
* screen brightness to change
|
||||||
|
*/
|
||||||
|
public float[] getScreenBrighteningPercentages() {
|
||||||
|
return mScreenBrighteningPercentages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of screen brightness that each threshold percentage
|
||||||
|
* applies within.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current screen brightness value
|
||||||
|
* level = mScreenDarkeningLevels
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mScreenDarkeningPercentages[n]
|
||||||
|
* level[MAX] <= value = mScreenDarkeningPercentages[MAX]
|
||||||
|
*
|
||||||
|
* @return the screen brightness levels between 0.0 and 1.0 for which each
|
||||||
|
* mScreenDarkeningPercentages applies
|
||||||
|
*/
|
||||||
|
public float[] getScreenDarkeningLevels() {
|
||||||
|
return mScreenDarkeningLevels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the screen darkening threshold percentage change at each screen
|
||||||
|
* brightness level described in mScreenDarkeningLevels.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of brightness decrease required in order for the
|
||||||
|
* screen brightness to change
|
||||||
|
*/
|
||||||
|
public float[] getScreenDarkeningPercentages() {
|
||||||
|
return mScreenDarkeningPercentages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of ambient brightness that each threshold
|
||||||
|
* percentage applies within.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current ambient brightness value
|
||||||
|
* level = mAmbientBrighteningLevels
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mAmbientBrighteningPercentages[n]
|
||||||
|
* level[MAX] <= value = mAmbientBrighteningPercentages[MAX]
|
||||||
|
*
|
||||||
|
* @return the ambient brightness levels from 0 lux upwards for which each
|
||||||
|
* mAmbientBrighteningPercentages applies
|
||||||
|
*/
|
||||||
|
public float[] getAmbientBrighteningLevels() {
|
||||||
|
return mAmbientBrighteningLevels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the ambient brightening threshold percentage change at each ambient
|
||||||
|
* brightness level described in mAmbientBrighteningLevels.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of brightness increase required in order for the
|
||||||
|
* screen brightness to change
|
||||||
|
*/
|
||||||
|
public float[] getAmbientBrighteningPercentages() {
|
||||||
|
return mAmbientBrighteningPercentages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of ambient brightness that each threshold percentage
|
||||||
|
* applies within.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current ambient brightness value
|
||||||
|
* level = mAmbientDarkeningLevels
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mAmbientDarkeningPercentages[n]
|
||||||
|
* level[MAX] <= value = mAmbientDarkeningPercentages[MAX]
|
||||||
|
*
|
||||||
|
* @return the ambient brightness levels from 0 lux upwards for which each
|
||||||
|
* mAmbientDarkeningPercentages applies
|
||||||
|
*/
|
||||||
|
public float[] getAmbientDarkeningLevels() {
|
||||||
|
return mAmbientDarkeningLevels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the ambient darkening threshold percentage change at each ambient
|
||||||
|
* brightness level described in mAmbientDarkeningLevels.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of brightness decrease required in order for the
|
||||||
|
* screen brightness to change
|
||||||
|
*/
|
||||||
|
public float[] getAmbientDarkeningPercentages() {
|
||||||
|
return mAmbientDarkeningPercentages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of screen brightness that each threshold percentage
|
||||||
|
* applies within whilst in idle screen brightness mode.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current screen brightness value
|
||||||
|
* level = mScreenBrighteningLevelsIdle
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mScreenBrighteningPercentagesIdle[n]
|
||||||
|
* level[MAX] <= value = mScreenBrighteningPercentagesIdle[MAX]
|
||||||
|
*
|
||||||
|
* @return the screen brightness levels between 0.0 and 1.0 for which each
|
||||||
|
* mScreenBrighteningPercentagesIdle applies
|
||||||
|
*/
|
||||||
|
public float[] getScreenBrighteningLevelsIdle() {
|
||||||
|
return mScreenBrighteningLevelsIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the screen brightening threshold percentage change at each screen
|
||||||
|
* brightness level described in mScreenBrighteningLevelsIdle.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of brightness increase required in order for the
|
||||||
|
* screen brightness to change while in idle mode.
|
||||||
|
*/
|
||||||
|
public float[] getScreenBrighteningPercentagesIdle() {
|
||||||
|
return mScreenBrighteningPercentagesIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of screen brightness that each threshold percentage
|
||||||
|
* applies within whilst in idle screen brightness mode.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current screen brightness value
|
||||||
|
* level = mScreenDarkeningLevelsIdle
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mScreenDarkeningPercentagesIdle[n]
|
||||||
|
* level[MAX] <= value = mScreenDarkeningPercentagesIdle[MAX]
|
||||||
|
*
|
||||||
|
* @return the screen brightness levels between 0.0 and 1.0 for which each
|
||||||
|
* mScreenDarkeningPercentagesIdle applies
|
||||||
|
*/
|
||||||
|
public float[] getScreenDarkeningLevelsIdle() {
|
||||||
|
return mScreenDarkeningLevelsIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the screen darkening threshold percentage change at each screen
|
||||||
|
* brightness level described in mScreenDarkeningLevelsIdle.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of brightness decrease required in order for the
|
||||||
|
* screen brightness to change while in idle mode.
|
||||||
|
*/
|
||||||
|
public float[] getScreenDarkeningPercentagesIdle() {
|
||||||
|
return mScreenDarkeningPercentagesIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of ambient brightness that each threshold percentage
|
||||||
|
* applies within whilst in idle screen brightness mode.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current ambient brightness value
|
||||||
|
* level = mAmbientBrighteningLevelsIdle
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mAmbientBrighteningPercentagesIdle[n]
|
||||||
|
* level[MAX] <= value = mAmbientBrighteningPercentagesIdle[MAX]
|
||||||
|
*
|
||||||
|
* @return the ambient brightness levels from 0 lux upwards for which each
|
||||||
|
* mAmbientBrighteningPercentagesIdle applies
|
||||||
|
*/
|
||||||
|
public float[] getAmbientBrighteningLevelsIdle() {
|
||||||
|
return mAmbientBrighteningLevelsIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the ambient brightness threshold percentage change whilst in
|
||||||
|
* idle screen brightness mode at each ambient brightness level described in
|
||||||
|
* mAmbientBrighteningLevelsIdle.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of ambient brightness increase required in order
|
||||||
|
* for the screen brightness to change
|
||||||
|
*/
|
||||||
|
public float[] getAmbientBrighteningPercentagesIdle() {
|
||||||
|
return mAmbientBrighteningPercentagesIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the range of ambient brightness that each threshold percentage
|
||||||
|
* applies within whilst in idle screen brightness mode.
|
||||||
|
*
|
||||||
|
* The (zero-based) index is calculated as follows
|
||||||
|
* value = current ambient brightness value
|
||||||
|
* level = mAmbientDarkeningLevelsIdle
|
||||||
|
*
|
||||||
|
* condition return
|
||||||
|
* value < level[0] = 0.0f
|
||||||
|
* level[n] <= value < level[n+1] = mAmbientDarkeningPercentagesIdle[n]
|
||||||
|
* level[MAX] <= value = mAmbientDarkeningPercentagesIdle[MAX]
|
||||||
|
*
|
||||||
|
* @return the ambient brightness levels from 0 lux upwards for which each
|
||||||
|
* mAmbientDarkeningPercentagesIdle applies
|
||||||
|
*/
|
||||||
|
public float[] getAmbientDarkeningLevelsIdle() {
|
||||||
|
return mAmbientDarkeningLevelsIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The array that describes the ambient brightness threshold percentage change whilst in
|
||||||
|
* idle screen brightness mode at each ambient brightness level described in
|
||||||
|
* mAmbientDarkeningLevelsIdle.
|
||||||
|
*
|
||||||
|
* @return the percentages between 0 and 100 of ambient brightness decrease required in order
|
||||||
|
* for the screen brightness to change
|
||||||
|
*/
|
||||||
|
public float[] getAmbientDarkeningPercentagesIdle() {
|
||||||
|
return mAmbientDarkeningPercentagesIdle;
|
||||||
|
}
|
||||||
|
|
||||||
SensorData getAmbientLightSensor() {
|
SensorData getAmbientLightSensor() {
|
||||||
return mAmbientLightSensor;
|
return mAmbientLightSensor;
|
||||||
}
|
}
|
||||||
@@ -812,14 +1206,17 @@ public class DisplayDeviceConfig {
|
|||||||
+ ", mSdrToHdrRatioSpline=" + mSdrToHdrRatioSpline
|
+ ", mSdrToHdrRatioSpline=" + mSdrToHdrRatioSpline
|
||||||
+ ", mBrightnessThrottlingData=" + mBrightnessThrottlingData
|
+ ", mBrightnessThrottlingData=" + mBrightnessThrottlingData
|
||||||
+ ", mOriginalBrightnessThrottlingData=" + mOriginalBrightnessThrottlingData
|
+ ", mOriginalBrightnessThrottlingData=" + mOriginalBrightnessThrottlingData
|
||||||
|
+ "\n"
|
||||||
+ ", mBrightnessRampFastDecrease=" + mBrightnessRampFastDecrease
|
+ ", mBrightnessRampFastDecrease=" + mBrightnessRampFastDecrease
|
||||||
+ ", mBrightnessRampFastIncrease=" + mBrightnessRampFastIncrease
|
+ ", mBrightnessRampFastIncrease=" + mBrightnessRampFastIncrease
|
||||||
+ ", mBrightnessRampSlowDecrease=" + mBrightnessRampSlowDecrease
|
+ ", mBrightnessRampSlowDecrease=" + mBrightnessRampSlowDecrease
|
||||||
+ ", mBrightnessRampSlowIncrease=" + mBrightnessRampSlowIncrease
|
+ ", mBrightnessRampSlowIncrease=" + mBrightnessRampSlowIncrease
|
||||||
+ ", mBrightnessRampDecreaseMaxMillis=" + mBrightnessRampDecreaseMaxMillis
|
+ ", mBrightnessRampDecreaseMaxMillis=" + mBrightnessRampDecreaseMaxMillis
|
||||||
+ ", mBrightnessRampIncreaseMaxMillis=" + mBrightnessRampIncreaseMaxMillis
|
+ ", mBrightnessRampIncreaseMaxMillis=" + mBrightnessRampIncreaseMaxMillis
|
||||||
|
+ "\n"
|
||||||
+ ", mAmbientHorizonLong=" + mAmbientHorizonLong
|
+ ", mAmbientHorizonLong=" + mAmbientHorizonLong
|
||||||
+ ", mAmbientHorizonShort=" + mAmbientHorizonShort
|
+ ", mAmbientHorizonShort=" + mAmbientHorizonShort
|
||||||
|
+ "\n"
|
||||||
+ ", mScreenDarkeningMinThreshold=" + mScreenDarkeningMinThreshold
|
+ ", mScreenDarkeningMinThreshold=" + mScreenDarkeningMinThreshold
|
||||||
+ ", mScreenDarkeningMinThresholdIdle=" + mScreenDarkeningMinThresholdIdle
|
+ ", mScreenDarkeningMinThresholdIdle=" + mScreenDarkeningMinThresholdIdle
|
||||||
+ ", mScreenBrighteningMinThreshold=" + mScreenBrighteningMinThreshold
|
+ ", mScreenBrighteningMinThreshold=" + mScreenBrighteningMinThreshold
|
||||||
@@ -829,6 +1226,41 @@ public class DisplayDeviceConfig {
|
|||||||
+ ", mAmbientLuxBrighteningMinThreshold=" + mAmbientLuxBrighteningMinThreshold
|
+ ", mAmbientLuxBrighteningMinThreshold=" + mAmbientLuxBrighteningMinThreshold
|
||||||
+ ", mAmbientLuxBrighteningMinThresholdIdle="
|
+ ", mAmbientLuxBrighteningMinThresholdIdle="
|
||||||
+ mAmbientLuxBrighteningMinThresholdIdle
|
+ mAmbientLuxBrighteningMinThresholdIdle
|
||||||
|
+ "\n"
|
||||||
|
+ ", mScreenBrighteningLevels=" + Arrays.toString(
|
||||||
|
mScreenBrighteningLevels)
|
||||||
|
+ ", mScreenBrighteningPercentages=" + Arrays.toString(
|
||||||
|
mScreenBrighteningPercentages)
|
||||||
|
+ ", mScreenDarkeningLevels=" + Arrays.toString(
|
||||||
|
mScreenDarkeningLevels)
|
||||||
|
+ ", mScreenDarkeningPercentages=" + Arrays.toString(
|
||||||
|
mScreenDarkeningPercentages)
|
||||||
|
+ ", mAmbientBrighteningLevels=" + Arrays.toString(
|
||||||
|
mAmbientBrighteningLevels)
|
||||||
|
+ ", mAmbientBrighteningPercentages=" + Arrays.toString(
|
||||||
|
mAmbientBrighteningPercentages)
|
||||||
|
+ ", mAmbientDarkeningLevels=" + Arrays.toString(
|
||||||
|
mAmbientDarkeningLevels)
|
||||||
|
+ ", mAmbientDarkeningPercentages=" + Arrays.toString(
|
||||||
|
mAmbientDarkeningPercentages)
|
||||||
|
+ "\n"
|
||||||
|
+ ", mAmbientBrighteningLevelsIdle=" + Arrays.toString(
|
||||||
|
mAmbientBrighteningLevelsIdle)
|
||||||
|
+ ", mAmbientBrighteningPercentagesIdle=" + Arrays.toString(
|
||||||
|
mAmbientBrighteningPercentagesIdle)
|
||||||
|
+ ", mAmbientDarkeningLevelsIdle=" + Arrays.toString(
|
||||||
|
mAmbientDarkeningLevelsIdle)
|
||||||
|
+ ", mAmbientDarkeningPercentagesIdle=" + Arrays.toString(
|
||||||
|
mAmbientDarkeningPercentagesIdle)
|
||||||
|
+ ", mScreenBrighteningLevelsIdle=" + Arrays.toString(
|
||||||
|
mScreenBrighteningLevelsIdle)
|
||||||
|
+ ", mScreenBrighteningPercentagesIdle=" + Arrays.toString(
|
||||||
|
mScreenBrighteningPercentagesIdle)
|
||||||
|
+ ", mScreenDarkeningLevelsIdle=" + Arrays.toString(
|
||||||
|
mScreenDarkeningLevelsIdle)
|
||||||
|
+ ", mScreenDarkeningPercentagesIdle=" + Arrays.toString(
|
||||||
|
mScreenDarkeningPercentagesIdle)
|
||||||
|
+ "\n"
|
||||||
+ ", mAmbientLightSensor=" + mAmbientLightSensor
|
+ ", mAmbientLightSensor=" + mAmbientLightSensor
|
||||||
+ ", mProximitySensor=" + mProximitySensor
|
+ ", mProximitySensor=" + mProximitySensor
|
||||||
+ ", mRefreshRateLimitations= " + Arrays.toString(mRefreshRateLimitations.toArray())
|
+ ", mRefreshRateLimitations= " + Arrays.toString(mRefreshRateLimitations.toArray())
|
||||||
@@ -914,6 +1346,7 @@ public class DisplayDeviceConfig {
|
|||||||
loadBrightnessMapFromConfigXml();
|
loadBrightnessMapFromConfigXml();
|
||||||
loadBrightnessRampsFromConfigXml();
|
loadBrightnessRampsFromConfigXml();
|
||||||
loadAmbientLightSensorFromConfigXml();
|
loadAmbientLightSensorFromConfigXml();
|
||||||
|
loadBrightnessChangeThresholdsFromXml();
|
||||||
setProxSensorUnspecified();
|
setProxSensorUnspecified();
|
||||||
loadAutoBrightnessConfigsFromConfigXml();
|
loadAutoBrightnessConfigsFromConfigXml();
|
||||||
mLoadedFrom = "<config.xml>";
|
mLoadedFrom = "<config.xml>";
|
||||||
@@ -1454,91 +1887,287 @@ public class DisplayDeviceConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadBrightnessChangeThresholdsFromXml() {
|
||||||
|
loadBrightnessChangeThresholds(/* config= */ null);
|
||||||
|
}
|
||||||
|
|
||||||
private void loadBrightnessChangeThresholds(DisplayConfiguration config) {
|
private void loadBrightnessChangeThresholds(DisplayConfiguration config) {
|
||||||
Thresholds displayBrightnessThresholds = config.getDisplayBrightnessChangeThresholds();
|
loadDisplayBrightnessThresholds(config);
|
||||||
Thresholds ambientBrightnessThresholds = config.getAmbientBrightnessChangeThresholds();
|
loadAmbientBrightnessThresholds(config);
|
||||||
Thresholds displayBrightnessThresholdsIdle =
|
loadDisplayBrightnessThresholdsIdle(config);
|
||||||
config.getDisplayBrightnessChangeThresholdsIdle();
|
loadAmbientBrightnessThresholdsIdle(config);
|
||||||
Thresholds ambientBrightnessThresholdsIdle =
|
|
||||||
config.getAmbientBrightnessChangeThresholdsIdle();
|
|
||||||
|
|
||||||
loadDisplayBrightnessThresholds(displayBrightnessThresholds);
|
|
||||||
loadAmbientBrightnessThresholds(ambientBrightnessThresholds);
|
|
||||||
loadIdleDisplayBrightnessThresholds(displayBrightnessThresholdsIdle);
|
|
||||||
loadIdleAmbientBrightnessThresholds(ambientBrightnessThresholdsIdle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadDisplayBrightnessThresholds(Thresholds displayBrightnessThresholds) {
|
private void loadDisplayBrightnessThresholds(DisplayConfiguration config) {
|
||||||
if (displayBrightnessThresholds != null) {
|
BrightnessThresholds brighteningScreen = null;
|
||||||
BrightnessThresholds brighteningScreen =
|
BrightnessThresholds darkeningScreen = null;
|
||||||
displayBrightnessThresholds.getBrighteningThresholds();
|
if (config != null && config.getDisplayBrightnessChangeThresholds() != null) {
|
||||||
BrightnessThresholds darkeningScreen =
|
brighteningScreen =
|
||||||
displayBrightnessThresholds.getDarkeningThresholds();
|
config.getDisplayBrightnessChangeThresholds().getBrighteningThresholds();
|
||||||
|
darkeningScreen =
|
||||||
|
config.getDisplayBrightnessChangeThresholds().getDarkeningThresholds();
|
||||||
|
|
||||||
if (brighteningScreen != null && brighteningScreen.getMinimum() != null) {
|
}
|
||||||
mScreenBrighteningMinThreshold = brighteningScreen.getMinimum().floatValue();
|
|
||||||
}
|
// Screen bright/darkening threshold levels for active mode
|
||||||
if (darkeningScreen != null && darkeningScreen.getMinimum() != null) {
|
Pair<float[], float[]> screenBrighteningPair = getBrightnessLevelAndPercentage(
|
||||||
mScreenDarkeningMinThreshold = darkeningScreen.getMinimum().floatValue();
|
brighteningScreen,
|
||||||
}
|
com.android.internal.R.array.config_screenThresholdLevels,
|
||||||
|
com.android.internal.R.array.config_screenBrighteningThresholds,
|
||||||
|
DEFAULT_SCREEN_THRESHOLD_LEVELS, DEFAULT_SCREEN_BRIGHTENING_THRESHOLDS,
|
||||||
|
/* potentialOldBrightnessScale= */ true);
|
||||||
|
|
||||||
|
mScreenBrighteningLevels = screenBrighteningPair.first;
|
||||||
|
mScreenBrighteningPercentages = screenBrighteningPair.second;
|
||||||
|
|
||||||
|
Pair<float[], float[]> screenDarkeningPair = getBrightnessLevelAndPercentage(
|
||||||
|
darkeningScreen,
|
||||||
|
com.android.internal.R.array.config_screenThresholdLevels,
|
||||||
|
com.android.internal.R.array.config_screenDarkeningThresholds,
|
||||||
|
DEFAULT_SCREEN_THRESHOLD_LEVELS, DEFAULT_SCREEN_DARKENING_THRESHOLDS,
|
||||||
|
/* potentialOldBrightnessScale= */ true);
|
||||||
|
mScreenDarkeningLevels = screenDarkeningPair.first;
|
||||||
|
mScreenDarkeningPercentages = screenDarkeningPair.second;
|
||||||
|
|
||||||
|
// Screen bright/darkening threshold minimums for active mode
|
||||||
|
if (brighteningScreen != null && brighteningScreen.getMinimum() != null) {
|
||||||
|
mScreenBrighteningMinThreshold = brighteningScreen.getMinimum().floatValue();
|
||||||
|
}
|
||||||
|
if (darkeningScreen != null && darkeningScreen.getMinimum() != null) {
|
||||||
|
mScreenDarkeningMinThreshold = darkeningScreen.getMinimum().floatValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAmbientBrightnessThresholds(Thresholds ambientBrightnessThresholds) {
|
private void loadAmbientBrightnessThresholds(DisplayConfiguration config) {
|
||||||
if (ambientBrightnessThresholds != null) {
|
// Ambient Brightness Threshold Levels
|
||||||
BrightnessThresholds brighteningAmbientLux =
|
BrightnessThresholds brighteningAmbientLux = null;
|
||||||
ambientBrightnessThresholds.getBrighteningThresholds();
|
BrightnessThresholds darkeningAmbientLux = null;
|
||||||
BrightnessThresholds darkeningAmbientLux =
|
if (config != null && config.getAmbientBrightnessChangeThresholds() != null) {
|
||||||
ambientBrightnessThresholds.getDarkeningThresholds();
|
brighteningAmbientLux =
|
||||||
|
config.getAmbientBrightnessChangeThresholds().getBrighteningThresholds();
|
||||||
|
darkeningAmbientLux =
|
||||||
|
config.getAmbientBrightnessChangeThresholds().getDarkeningThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
final BigDecimal ambientBrighteningThreshold = brighteningAmbientLux.getMinimum();
|
// Ambient bright/darkening threshold levels for active mode
|
||||||
final BigDecimal ambientDarkeningThreshold = darkeningAmbientLux.getMinimum();
|
Pair<float[], float[]> ambientBrighteningPair = getBrightnessLevelAndPercentage(
|
||||||
|
brighteningAmbientLux,
|
||||||
|
com.android.internal.R.array.config_ambientThresholdLevels,
|
||||||
|
com.android.internal.R.array.config_ambientBrighteningThresholds,
|
||||||
|
DEFAULT_AMBIENT_THRESHOLD_LEVELS, DEFAULT_AMBIENT_BRIGHTENING_THRESHOLDS);
|
||||||
|
mAmbientBrighteningLevels = ambientBrighteningPair.first;
|
||||||
|
mAmbientBrighteningPercentages = ambientBrighteningPair.second;
|
||||||
|
|
||||||
if (ambientBrighteningThreshold != null) {
|
Pair<float[], float[]> ambientDarkeningPair = getBrightnessLevelAndPercentage(
|
||||||
mAmbientLuxBrighteningMinThreshold = ambientBrighteningThreshold.floatValue();
|
darkeningAmbientLux,
|
||||||
}
|
com.android.internal.R.array.config_ambientThresholdLevels,
|
||||||
if (ambientDarkeningThreshold != null) {
|
com.android.internal.R.array.config_ambientDarkeningThresholds,
|
||||||
mAmbientLuxDarkeningMinThreshold = ambientDarkeningThreshold.floatValue();
|
DEFAULT_AMBIENT_THRESHOLD_LEVELS, DEFAULT_AMBIENT_DARKENING_THRESHOLDS);
|
||||||
}
|
mAmbientDarkeningLevels = ambientDarkeningPair.first;
|
||||||
|
mAmbientDarkeningPercentages = ambientDarkeningPair.second;
|
||||||
|
|
||||||
|
// Ambient bright/darkening threshold minimums for active/idle mode
|
||||||
|
if (brighteningAmbientLux != null && brighteningAmbientLux.getMinimum() != null) {
|
||||||
|
mAmbientLuxBrighteningMinThreshold =
|
||||||
|
brighteningAmbientLux.getMinimum().floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (darkeningAmbientLux != null && darkeningAmbientLux.getMinimum() != null) {
|
||||||
|
mAmbientLuxDarkeningMinThreshold = darkeningAmbientLux.getMinimum().floatValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadIdleDisplayBrightnessThresholds(Thresholds idleDisplayBrightnessThresholds) {
|
private void loadDisplayBrightnessThresholdsIdle(DisplayConfiguration config) {
|
||||||
if (idleDisplayBrightnessThresholds != null) {
|
BrightnessThresholds brighteningScreenIdle = null;
|
||||||
BrightnessThresholds brighteningScreenIdle =
|
BrightnessThresholds darkeningScreenIdle = null;
|
||||||
idleDisplayBrightnessThresholds.getBrighteningThresholds();
|
if (config != null && config.getDisplayBrightnessChangeThresholdsIdle() != null) {
|
||||||
BrightnessThresholds darkeningScreenIdle =
|
brighteningScreenIdle =
|
||||||
idleDisplayBrightnessThresholds.getDarkeningThresholds();
|
config.getDisplayBrightnessChangeThresholdsIdle().getBrighteningThresholds();
|
||||||
|
darkeningScreenIdle =
|
||||||
|
config.getDisplayBrightnessChangeThresholdsIdle().getDarkeningThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
if (brighteningScreenIdle != null
|
Pair<float[], float[]> screenBrighteningPair = getBrightnessLevelAndPercentage(
|
||||||
&& brighteningScreenIdle.getMinimum() != null) {
|
brighteningScreenIdle,
|
||||||
mScreenBrighteningMinThresholdIdle =
|
com.android.internal.R.array.config_screenThresholdLevels,
|
||||||
brighteningScreenIdle.getMinimum().floatValue();
|
com.android.internal.R.array.config_screenBrighteningThresholds,
|
||||||
}
|
DEFAULT_SCREEN_THRESHOLD_LEVELS, DEFAULT_SCREEN_BRIGHTENING_THRESHOLDS,
|
||||||
if (darkeningScreenIdle != null && darkeningScreenIdle.getMinimum() != null) {
|
/* potentialOldBrightnessScale= */ true);
|
||||||
mScreenDarkeningMinThresholdIdle =
|
mScreenBrighteningLevelsIdle = screenBrighteningPair.first;
|
||||||
darkeningScreenIdle.getMinimum().floatValue();
|
mScreenBrighteningPercentagesIdle = screenBrighteningPair.second;
|
||||||
}
|
|
||||||
|
Pair<float[], float[]> screenDarkeningPair = getBrightnessLevelAndPercentage(
|
||||||
|
darkeningScreenIdle,
|
||||||
|
com.android.internal.R.array.config_screenThresholdLevels,
|
||||||
|
com.android.internal.R.array.config_screenDarkeningThresholds,
|
||||||
|
DEFAULT_SCREEN_THRESHOLD_LEVELS, DEFAULT_SCREEN_DARKENING_THRESHOLDS,
|
||||||
|
/* potentialOldBrightnessScale= */ true);
|
||||||
|
mScreenDarkeningLevelsIdle = screenDarkeningPair.first;
|
||||||
|
mScreenDarkeningPercentagesIdle = screenDarkeningPair.second;
|
||||||
|
|
||||||
|
if (brighteningScreenIdle != null
|
||||||
|
&& brighteningScreenIdle.getMinimum() != null) {
|
||||||
|
mScreenBrighteningMinThresholdIdle =
|
||||||
|
brighteningScreenIdle.getMinimum().floatValue();
|
||||||
|
}
|
||||||
|
if (darkeningScreenIdle != null && darkeningScreenIdle.getMinimum() != null) {
|
||||||
|
mScreenDarkeningMinThresholdIdle =
|
||||||
|
darkeningScreenIdle.getMinimum().floatValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadIdleAmbientBrightnessThresholds(Thresholds idleAmbientBrightnessThresholds) {
|
private void loadAmbientBrightnessThresholdsIdle(DisplayConfiguration config) {
|
||||||
if (idleAmbientBrightnessThresholds != null) {
|
BrightnessThresholds brighteningAmbientLuxIdle = null;
|
||||||
BrightnessThresholds brighteningAmbientLuxIdle =
|
BrightnessThresholds darkeningAmbientLuxIdle = null;
|
||||||
idleAmbientBrightnessThresholds.getBrighteningThresholds();
|
if (config != null && config.getAmbientBrightnessChangeThresholdsIdle() != null) {
|
||||||
BrightnessThresholds darkeningAmbientLuxIdle =
|
brighteningAmbientLuxIdle =
|
||||||
idleAmbientBrightnessThresholds.getDarkeningThresholds();
|
config.getAmbientBrightnessChangeThresholdsIdle().getBrighteningThresholds();
|
||||||
|
darkeningAmbientLuxIdle =
|
||||||
|
config.getAmbientBrightnessChangeThresholdsIdle().getDarkeningThresholds();
|
||||||
|
}
|
||||||
|
|
||||||
if (brighteningAmbientLuxIdle != null
|
Pair<float[], float[]> ambientBrighteningPair = getBrightnessLevelAndPercentage(
|
||||||
&& brighteningAmbientLuxIdle.getMinimum() != null) {
|
brighteningAmbientLuxIdle,
|
||||||
mAmbientLuxBrighteningMinThresholdIdle =
|
com.android.internal.R.array.config_ambientThresholdLevels,
|
||||||
brighteningAmbientLuxIdle.getMinimum().floatValue();
|
com.android.internal.R.array.config_ambientBrighteningThresholds,
|
||||||
|
DEFAULT_AMBIENT_THRESHOLD_LEVELS, DEFAULT_AMBIENT_BRIGHTENING_THRESHOLDS);
|
||||||
|
mAmbientBrighteningLevelsIdle = ambientBrighteningPair.first;
|
||||||
|
mAmbientBrighteningPercentagesIdle = ambientBrighteningPair.second;
|
||||||
|
|
||||||
|
Pair<float[], float[]> ambientDarkeningPair = getBrightnessLevelAndPercentage(
|
||||||
|
darkeningAmbientLuxIdle,
|
||||||
|
com.android.internal.R.array.config_ambientThresholdLevels,
|
||||||
|
com.android.internal.R.array.config_ambientDarkeningThresholds,
|
||||||
|
DEFAULT_AMBIENT_THRESHOLD_LEVELS, DEFAULT_AMBIENT_DARKENING_THRESHOLDS);
|
||||||
|
mAmbientDarkeningLevelsIdle = ambientDarkeningPair.first;
|
||||||
|
mAmbientDarkeningPercentagesIdle = ambientDarkeningPair.second;
|
||||||
|
|
||||||
|
if (brighteningAmbientLuxIdle != null
|
||||||
|
&& brighteningAmbientLuxIdle.getMinimum() != null) {
|
||||||
|
mAmbientLuxBrighteningMinThresholdIdle =
|
||||||
|
brighteningAmbientLuxIdle.getMinimum().floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (darkeningAmbientLuxIdle != null && darkeningAmbientLuxIdle.getMinimum() != null) {
|
||||||
|
mAmbientLuxDarkeningMinThresholdIdle =
|
||||||
|
darkeningAmbientLuxIdle.getMinimum().floatValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Pair<float[], float[]> getBrightnessLevelAndPercentage(BrightnessThresholds thresholds,
|
||||||
|
int configFallbackThreshold, int configFallbackPercentage, float[] defaultLevels,
|
||||||
|
float[] defaultPercentage) {
|
||||||
|
return getBrightnessLevelAndPercentage(thresholds, configFallbackThreshold,
|
||||||
|
configFallbackPercentage, defaultLevels, defaultPercentage, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns two float arrays, one of the brightness levels and one of the corresponding threshold
|
||||||
|
// percentages for brightness levels at or above the lux value.
|
||||||
|
// Historically, config.xml would have an array for brightness levels that was 1 shorter than
|
||||||
|
// the levels array. Now we prepend a 0 to this array so they can be treated the same in the
|
||||||
|
// rest of the framework. Values were also defined in different units (permille vs percent).
|
||||||
|
private Pair<float[], float[]> getBrightnessLevelAndPercentage(BrightnessThresholds thresholds,
|
||||||
|
int configFallbackThreshold, int configFallbackPermille,
|
||||||
|
float[] defaultLevels, float[] defaultPercentage,
|
||||||
|
boolean potentialOldBrightnessScale) {
|
||||||
|
if (thresholds != null
|
||||||
|
&& thresholds.getBrightnessThresholdPoints() != null
|
||||||
|
&& thresholds.getBrightnessThresholdPoints()
|
||||||
|
.getBrightnessThresholdPoint().size() != 0) {
|
||||||
|
|
||||||
|
// The level and percentages arrays are equal length in the ddc (new system)
|
||||||
|
List<ThresholdPoint> points =
|
||||||
|
thresholds.getBrightnessThresholdPoints().getBrightnessThresholdPoint();
|
||||||
|
final int size = points.size();
|
||||||
|
|
||||||
|
float[] thresholdLevels = new float[size];
|
||||||
|
float[] thresholdPercentages = new float[size];
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (ThresholdPoint point : points) {
|
||||||
|
thresholdLevels[i] = point.getThreshold().floatValue();
|
||||||
|
thresholdPercentages[i] = point.getPercentage().floatValue();
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
if (darkeningAmbientLuxIdle != null && darkeningAmbientLuxIdle.getMinimum() != null) {
|
return new Pair<>(thresholdLevels, thresholdPercentages);
|
||||||
mAmbientLuxDarkeningMinThresholdIdle =
|
} else {
|
||||||
darkeningAmbientLuxIdle.getMinimum().floatValue();
|
// The level and percentages arrays are unequal length in config.xml (old system)
|
||||||
|
// We prefix the array with a 0 value to ensure they can be handled consistently
|
||||||
|
// with the new system.
|
||||||
|
|
||||||
|
// Load levels array
|
||||||
|
int[] configThresholdArray = mContext.getResources().getIntArray(
|
||||||
|
configFallbackThreshold);
|
||||||
|
int configThresholdsSize;
|
||||||
|
if (configThresholdArray == null || configThresholdArray.length == 0) {
|
||||||
|
configThresholdsSize = 1;
|
||||||
|
} else {
|
||||||
|
configThresholdsSize = configThresholdArray.length + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Load percentage array
|
||||||
|
int[] configPermille = mContext.getResources().getIntArray(
|
||||||
|
configFallbackPermille);
|
||||||
|
|
||||||
|
// Ensure lengths match up
|
||||||
|
boolean emptyArray = configPermille == null || configPermille.length == 0;
|
||||||
|
if (emptyArray && configThresholdsSize == 1) {
|
||||||
|
return new Pair<>(defaultLevels, defaultPercentage);
|
||||||
|
}
|
||||||
|
if (emptyArray || configPermille.length != configThresholdsSize) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Brightness threshold arrays do not align in length");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate levels array
|
||||||
|
float[] configThresholdWithZeroPrefixed = new float[configThresholdsSize];
|
||||||
|
// Start at 1, so that 0 index value is 0.0f (default)
|
||||||
|
for (int i = 1; i < configThresholdsSize; i++) {
|
||||||
|
configThresholdWithZeroPrefixed[i] = (float) configThresholdArray[i - 1];
|
||||||
|
}
|
||||||
|
if (potentialOldBrightnessScale) {
|
||||||
|
configThresholdWithZeroPrefixed =
|
||||||
|
constraintInRangeIfNeeded(configThresholdWithZeroPrefixed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate percentages array
|
||||||
|
float[] configPercentage = new float[configThresholdsSize];
|
||||||
|
for (int i = 0; i < configPermille.length; i++) {
|
||||||
|
configPercentage[i] = configPermille[i] / 10.0f;
|
||||||
|
}
|
||||||
|
return new Pair<>(configThresholdWithZeroPrefixed, configPercentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This check is due to historical reasons, where screen thresholdLevels used to be
|
||||||
|
* integer values in the range of [0-255], but then was changed to be float values from [0,1].
|
||||||
|
* To accommodate both the possibilities, we first check if all the thresholdLevels are in
|
||||||
|
* [0,1], and if not, we divide all the levels with 255 to bring them down to the same scale.
|
||||||
|
*/
|
||||||
|
private float[] constraintInRangeIfNeeded(float[] thresholdLevels) {
|
||||||
|
if (isAllInRange(thresholdLevels, /* minValueInclusive= */ 0.0f,
|
||||||
|
/* maxValueInclusive= */ 1.0f)) {
|
||||||
|
return thresholdLevels;
|
||||||
|
}
|
||||||
|
|
||||||
|
Slog.w(TAG, "Detected screen thresholdLevels on a deprecated brightness scale");
|
||||||
|
float[] thresholdLevelsScaled = new float[thresholdLevels.length];
|
||||||
|
for (int index = 0; thresholdLevels.length > index; ++index) {
|
||||||
|
thresholdLevelsScaled[index] = thresholdLevels[index] / 255.0f;
|
||||||
|
}
|
||||||
|
return thresholdLevelsScaled;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAllInRange(float[] configArray, float minValueInclusive,
|
||||||
|
float maxValueInclusive) {
|
||||||
|
for (float v : configArray) {
|
||||||
|
if (v < minValueInclusive || v > maxValueInclusive) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean thermalStatusIsValid(ThermalStatus value) {
|
private boolean thermalStatusIsValid(ThermalStatus value) {
|
||||||
|
|||||||
@@ -956,53 +956,77 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
|
|||||||
com.android.internal.R.fraction.config_screenAutoBrightnessDozeScaleFactor,
|
com.android.internal.R.fraction.config_screenAutoBrightnessDozeScaleFactor,
|
||||||
1, 1);
|
1, 1);
|
||||||
|
|
||||||
int[] ambientBrighteningThresholds = resources.getIntArray(
|
// Ambient Lux - Active Mode Brightness Thresholds
|
||||||
com.android.internal.R.array.config_ambientBrighteningThresholds);
|
float[] ambientBrighteningThresholds =
|
||||||
int[] ambientDarkeningThresholds = resources.getIntArray(
|
mDisplayDeviceConfig.getAmbientBrighteningPercentages();
|
||||||
com.android.internal.R.array.config_ambientDarkeningThresholds);
|
float[] ambientDarkeningThresholds =
|
||||||
int[] ambientThresholdLevels = resources.getIntArray(
|
mDisplayDeviceConfig.getAmbientDarkeningPercentages();
|
||||||
com.android.internal.R.array.config_ambientThresholdLevels);
|
float[] ambientBrighteningLevels =
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningLevels();
|
||||||
|
float[] ambientDarkeningLevels =
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningLevels();
|
||||||
float ambientDarkeningMinThreshold =
|
float ambientDarkeningMinThreshold =
|
||||||
mDisplayDeviceConfig.getAmbientLuxDarkeningMinThreshold();
|
mDisplayDeviceConfig.getAmbientLuxDarkeningMinThreshold();
|
||||||
float ambientBrighteningMinThreshold =
|
float ambientBrighteningMinThreshold =
|
||||||
mDisplayDeviceConfig.getAmbientLuxBrighteningMinThreshold();
|
mDisplayDeviceConfig.getAmbientLuxBrighteningMinThreshold();
|
||||||
HysteresisLevels ambientBrightnessThresholds = new HysteresisLevels(
|
HysteresisLevels ambientBrightnessThresholds = new HysteresisLevels(
|
||||||
ambientBrighteningThresholds, ambientDarkeningThresholds,
|
ambientBrighteningThresholds, ambientDarkeningThresholds,
|
||||||
ambientThresholdLevels, ambientDarkeningMinThreshold,
|
ambientBrighteningLevels, ambientDarkeningLevels, ambientDarkeningMinThreshold,
|
||||||
ambientBrighteningMinThreshold);
|
ambientBrighteningMinThreshold);
|
||||||
|
|
||||||
int[] screenBrighteningThresholds = resources.getIntArray(
|
// Display - Active Mode Brightness Thresholds
|
||||||
com.android.internal.R.array.config_screenBrighteningThresholds);
|
float[] screenBrighteningThresholds =
|
||||||
int[] screenDarkeningThresholds = resources.getIntArray(
|
mDisplayDeviceConfig.getScreenBrighteningPercentages();
|
||||||
com.android.internal.R.array.config_screenDarkeningThresholds);
|
float[] screenDarkeningThresholds =
|
||||||
float[] screenThresholdLevels = BrightnessMappingStrategy.getFloatArray(resources
|
mDisplayDeviceConfig.getScreenDarkeningPercentages();
|
||||||
.obtainTypedArray(com.android.internal.R.array.config_screenThresholdLevels));
|
float[] screenBrighteningLevels =
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningLevels();
|
||||||
|
float[] screenDarkeningLevels =
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningLevels();
|
||||||
float screenDarkeningMinThreshold =
|
float screenDarkeningMinThreshold =
|
||||||
mDisplayDeviceConfig.getScreenDarkeningMinThreshold();
|
mDisplayDeviceConfig.getScreenDarkeningMinThreshold();
|
||||||
float screenBrighteningMinThreshold =
|
float screenBrighteningMinThreshold =
|
||||||
mDisplayDeviceConfig.getScreenBrighteningMinThreshold();
|
mDisplayDeviceConfig.getScreenBrighteningMinThreshold();
|
||||||
HysteresisLevels screenBrightnessThresholds = new HysteresisLevels(
|
HysteresisLevels screenBrightnessThresholds = new HysteresisLevels(
|
||||||
screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels,
|
screenBrighteningThresholds, screenDarkeningThresholds,
|
||||||
screenDarkeningMinThreshold, screenBrighteningMinThreshold);
|
screenBrighteningLevels, screenDarkeningLevels, screenDarkeningMinThreshold,
|
||||||
|
screenBrighteningMinThreshold);
|
||||||
|
|
||||||
// Idle screen thresholds
|
// Ambient Lux - Idle Screen Brightness Thresholds
|
||||||
float screenDarkeningMinThresholdIdle =
|
|
||||||
mDisplayDeviceConfig.getScreenDarkeningMinThresholdIdle();
|
|
||||||
float screenBrighteningMinThresholdIdle =
|
|
||||||
mDisplayDeviceConfig.getScreenBrighteningMinThresholdIdle();
|
|
||||||
HysteresisLevels screenBrightnessThresholdsIdle = new HysteresisLevels(
|
|
||||||
screenBrighteningThresholds, screenDarkeningThresholds, screenThresholdLevels,
|
|
||||||
screenDarkeningMinThresholdIdle, screenBrighteningMinThresholdIdle);
|
|
||||||
|
|
||||||
// Idle ambient thresholds
|
|
||||||
float ambientDarkeningMinThresholdIdle =
|
float ambientDarkeningMinThresholdIdle =
|
||||||
mDisplayDeviceConfig.getAmbientLuxDarkeningMinThresholdIdle();
|
mDisplayDeviceConfig.getAmbientLuxDarkeningMinThresholdIdle();
|
||||||
float ambientBrighteningMinThresholdIdle =
|
float ambientBrighteningMinThresholdIdle =
|
||||||
mDisplayDeviceConfig.getAmbientLuxBrighteningMinThresholdIdle();
|
mDisplayDeviceConfig.getAmbientLuxBrighteningMinThresholdIdle();
|
||||||
|
float[] ambientBrighteningThresholdsIdle =
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningPercentagesIdle();
|
||||||
|
float[] ambientDarkeningThresholdsIdle =
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningPercentagesIdle();
|
||||||
|
float[] ambientBrighteningLevelsIdle =
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningLevelsIdle();
|
||||||
|
float[] ambientDarkeningLevelsIdle =
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningLevelsIdle();
|
||||||
HysteresisLevels ambientBrightnessThresholdsIdle = new HysteresisLevels(
|
HysteresisLevels ambientBrightnessThresholdsIdle = new HysteresisLevels(
|
||||||
ambientBrighteningThresholds, ambientDarkeningThresholds,
|
ambientBrighteningThresholdsIdle, ambientDarkeningThresholdsIdle,
|
||||||
ambientThresholdLevels, ambientDarkeningMinThresholdIdle,
|
ambientBrighteningLevelsIdle, ambientDarkeningLevelsIdle,
|
||||||
ambientBrighteningMinThresholdIdle);
|
ambientDarkeningMinThresholdIdle, ambientBrighteningMinThresholdIdle);
|
||||||
|
|
||||||
|
// Display - Idle Screen Brightness Thresholds
|
||||||
|
float screenDarkeningMinThresholdIdle =
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningMinThresholdIdle();
|
||||||
|
float screenBrighteningMinThresholdIdle =
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningMinThresholdIdle();
|
||||||
|
float[] screenBrighteningThresholdsIdle =
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningPercentagesIdle();
|
||||||
|
float[] screenDarkeningThresholdsIdle =
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningPercentagesIdle();
|
||||||
|
float[] screenBrighteningLevelsIdle =
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningLevelsIdle();
|
||||||
|
float[] screenDarkeningLevelsIdle =
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningLevelsIdle();
|
||||||
|
HysteresisLevels screenBrightnessThresholdsIdle = new HysteresisLevels(
|
||||||
|
screenBrighteningThresholdsIdle, screenDarkeningThresholdsIdle,
|
||||||
|
screenBrighteningLevelsIdle, screenDarkeningLevelsIdle,
|
||||||
|
screenDarkeningMinThresholdIdle, screenBrighteningMinThresholdIdle);
|
||||||
|
|
||||||
long brighteningLightDebounce = mDisplayDeviceConfig
|
long brighteningLightDebounce = mDisplayDeviceConfig
|
||||||
.getAutoBrightnessBrighteningLightDebounce();
|
.getAutoBrightnessBrighteningLightDebounce();
|
||||||
|
|||||||
@@ -29,52 +29,38 @@ public class HysteresisLevels {
|
|||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
private final float[] mBrighteningThresholds;
|
private final float[] mBrighteningThresholdsPercentages;
|
||||||
private final float[] mDarkeningThresholds;
|
private final float[] mDarkeningThresholdsPercentages;
|
||||||
private final float[] mThresholdLevels;
|
private final float[] mBrighteningThresholdLevels;
|
||||||
|
private final float[] mDarkeningThresholdLevels;
|
||||||
private final float mMinDarkening;
|
private final float mMinDarkening;
|
||||||
private final float mMinBrightening;
|
private final float mMinBrightening;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@code HysteresisLevels} object for ambient brightness.
|
* Creates a {@code HysteresisLevels} object with the given equal-length
|
||||||
* @param brighteningThresholds an array of brightening hysteresis constraint constants.
|
* float arrays.
|
||||||
* @param darkeningThresholds an array of darkening hysteresis constraint constants.
|
* @param brighteningThresholdsPercentages 0-100 of thresholds
|
||||||
* @param thresholdLevels a monotonically increasing array of threshold levels.
|
* @param darkeningThresholdsPercentages 0-100 of thresholds
|
||||||
* @param minBrighteningThreshold the minimum value for which the brightening value needs to
|
* @param brighteningThresholdLevels float array of brightness values in the relevant units
|
||||||
* return.
|
* @param darkeningThresholdLevels float array of brightness values in the relevant units
|
||||||
* @param minDarkeningThreshold the minimum value for which the darkening value needs to return.
|
|
||||||
*/
|
|
||||||
HysteresisLevels(int[] brighteningThresholds, int[] darkeningThresholds,
|
|
||||||
int[] thresholdLevels, float minDarkeningThreshold, float minBrighteningThreshold) {
|
|
||||||
if (brighteningThresholds.length != darkeningThresholds.length
|
|
||||||
|| darkeningThresholds.length != thresholdLevels.length + 1) {
|
|
||||||
throw new IllegalArgumentException("Mismatch between hysteresis array lengths.");
|
|
||||||
}
|
|
||||||
mBrighteningThresholds = setArrayFormat(brighteningThresholds, 1000.0f);
|
|
||||||
mDarkeningThresholds = setArrayFormat(darkeningThresholds, 1000.0f);
|
|
||||||
mThresholdLevels = setArrayFormat(thresholdLevels, 1.0f);
|
|
||||||
mMinDarkening = minDarkeningThreshold;
|
|
||||||
mMinBrightening = minBrighteningThreshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a {@code HysteresisLevels} object for screen brightness.
|
|
||||||
* @param brighteningThresholds an array of brightening hysteresis constraint constants.
|
|
||||||
* @param darkeningThresholds an array of darkening hysteresis constraint constants.
|
|
||||||
* @param thresholdLevels a monotonically increasing array of threshold levels.
|
|
||||||
* @param minBrighteningThreshold the minimum value for which the brightening value needs to
|
* @param minBrighteningThreshold the minimum value for which the brightening value needs to
|
||||||
* return.
|
* return.
|
||||||
* @param minDarkeningThreshold the minimum value for which the darkening value needs to return.
|
* @param minDarkeningThreshold the minimum value for which the darkening value needs to return.
|
||||||
*/
|
*/
|
||||||
HysteresisLevels(int[] brighteningThresholds, int[] darkeningThresholds,
|
HysteresisLevels(float[] brighteningThresholdsPercentages,
|
||||||
float[] thresholdLevels, float minDarkeningThreshold, float minBrighteningThreshold) {
|
float[] darkeningThresholdsPercentages,
|
||||||
if (brighteningThresholds.length != darkeningThresholds.length
|
float[] brighteningThresholdLevels, float[] darkeningThresholdLevels,
|
||||||
|| darkeningThresholds.length != thresholdLevels.length + 1) {
|
float minDarkeningThreshold, float minBrighteningThreshold) {
|
||||||
|
if (brighteningThresholdsPercentages.length != brighteningThresholdLevels.length
|
||||||
|
|| darkeningThresholdsPercentages.length != darkeningThresholdLevels.length) {
|
||||||
throw new IllegalArgumentException("Mismatch between hysteresis array lengths.");
|
throw new IllegalArgumentException("Mismatch between hysteresis array lengths.");
|
||||||
}
|
}
|
||||||
mBrighteningThresholds = setArrayFormat(brighteningThresholds, 1000.0f);
|
mBrighteningThresholdsPercentages =
|
||||||
mDarkeningThresholds = setArrayFormat(darkeningThresholds, 1000.0f);
|
setArrayFormat(brighteningThresholdsPercentages, 100.0f);
|
||||||
mThresholdLevels = constraintInRangeIfNeeded(thresholdLevels);
|
mDarkeningThresholdsPercentages =
|
||||||
|
setArrayFormat(darkeningThresholdsPercentages, 100.0f);
|
||||||
|
mBrighteningThresholdLevels = setArrayFormat(brighteningThresholdLevels, 1.0f);
|
||||||
|
mDarkeningThresholdLevels = setArrayFormat(darkeningThresholdLevels, 1.0f);
|
||||||
mMinDarkening = minDarkeningThreshold;
|
mMinDarkening = minDarkeningThreshold;
|
||||||
mMinBrightening = minBrighteningThreshold;
|
mMinBrightening = minBrighteningThreshold;
|
||||||
}
|
}
|
||||||
@@ -83,7 +69,9 @@ public class HysteresisLevels {
|
|||||||
* Return the brightening hysteresis threshold for the given value level.
|
* Return the brightening hysteresis threshold for the given value level.
|
||||||
*/
|
*/
|
||||||
public float getBrighteningThreshold(float value) {
|
public float getBrighteningThreshold(float value) {
|
||||||
final float brightConstant = getReferenceLevel(value, mBrighteningThresholds);
|
final float brightConstant = getReferenceLevel(value,
|
||||||
|
mBrighteningThresholdLevels, mBrighteningThresholdsPercentages);
|
||||||
|
|
||||||
float brightThreshold = value * (1.0f + brightConstant);
|
float brightThreshold = value * (1.0f + brightConstant);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "bright hysteresis constant=" + brightConstant + ", threshold="
|
Slog.d(TAG, "bright hysteresis constant=" + brightConstant + ", threshold="
|
||||||
@@ -98,7 +86,8 @@ public class HysteresisLevels {
|
|||||||
* Return the darkening hysteresis threshold for the given value level.
|
* Return the darkening hysteresis threshold for the given value level.
|
||||||
*/
|
*/
|
||||||
public float getDarkeningThreshold(float value) {
|
public float getDarkeningThreshold(float value) {
|
||||||
final float darkConstant = getReferenceLevel(value, mDarkeningThresholds);
|
final float darkConstant = getReferenceLevel(value,
|
||||||
|
mDarkeningThresholdLevels, mDarkeningThresholdsPercentages);
|
||||||
float darkThreshold = value * (1.0f - darkConstant);
|
float darkThreshold = value * (1.0f - darkConstant);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "dark hysteresis constant=: " + darkConstant + ", threshold="
|
Slog.d(TAG, "dark hysteresis constant=: " + darkConstant + ", threshold="
|
||||||
@@ -111,60 +100,39 @@ public class HysteresisLevels {
|
|||||||
/**
|
/**
|
||||||
* Return the hysteresis constant for the closest threshold value from the given array.
|
* Return the hysteresis constant for the closest threshold value from the given array.
|
||||||
*/
|
*/
|
||||||
private float getReferenceLevel(float value, float[] referenceLevels) {
|
private float getReferenceLevel(float value, float[] thresholdLevels,
|
||||||
int index = 0;
|
float[] thresholdPercentages) {
|
||||||
while (mThresholdLevels.length > index && value >= mThresholdLevels[index]) {
|
if (thresholdLevels == null || thresholdLevels.length == 0 || value < thresholdLevels[0]) {
|
||||||
++index;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
return referenceLevels[index];
|
int index = 0;
|
||||||
|
while (index < thresholdLevels.length - 1 && value >= thresholdLevels[index + 1]) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
return thresholdPercentages[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a float array where each i-th element equals {@code configArray[i]/divideFactor}.
|
* Return a float array where each i-th element equals {@code configArray[i]/divideFactor}.
|
||||||
*/
|
*/
|
||||||
private float[] setArrayFormat(int[] configArray, float divideFactor) {
|
private float[] setArrayFormat(float[] configArray, float divideFactor) {
|
||||||
float[] levelArray = new float[configArray.length];
|
float[] levelArray = new float[configArray.length];
|
||||||
for (int index = 0; levelArray.length > index; ++index) {
|
for (int index = 0; levelArray.length > index; ++index) {
|
||||||
levelArray[index] = (float) configArray[index] / divideFactor;
|
levelArray[index] = configArray[index] / divideFactor;
|
||||||
}
|
}
|
||||||
return levelArray;
|
return levelArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This check is due to historical reasons, where screen thresholdLevels used to be
|
|
||||||
* integer values in the range of [0-255], but then was changed to be float values from [0,1].
|
|
||||||
* To accommodate both the possibilities, we first check if all the thresholdLevels are in [0,
|
|
||||||
* 1], and if not, we divide all the levels with 255 to bring them down to the same scale.
|
|
||||||
*/
|
|
||||||
private float[] constraintInRangeIfNeeded(float[] thresholdLevels) {
|
|
||||||
if (isAllInRange(thresholdLevels, /* minValueInclusive = */ 0.0f, /* maxValueInclusive = */
|
|
||||||
1.0f)) {
|
|
||||||
return thresholdLevels;
|
|
||||||
}
|
|
||||||
|
|
||||||
Slog.w(TAG, "Detected screen thresholdLevels on a deprecated brightness scale");
|
|
||||||
float[] thresholdLevelsScaled = new float[thresholdLevels.length];
|
|
||||||
for (int index = 0; thresholdLevels.length > index; ++index) {
|
|
||||||
thresholdLevelsScaled[index] = thresholdLevels[index] / 255.0f;
|
|
||||||
}
|
|
||||||
return thresholdLevelsScaled;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isAllInRange(float[] configArray, float minValueInclusive,
|
|
||||||
float maxValueInclusive) {
|
|
||||||
int configArraySize = configArray.length;
|
|
||||||
for (int index = 0; configArraySize > index; ++index) {
|
|
||||||
if (configArray[index] < minValueInclusive || configArray[index] > maxValueInclusive) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dump(PrintWriter pw) {
|
void dump(PrintWriter pw) {
|
||||||
pw.println("HysteresisLevels");
|
pw.println("HysteresisLevels");
|
||||||
pw.println(" mBrighteningThresholds=" + Arrays.toString(mBrighteningThresholds));
|
pw.println(" mBrighteningThresholdLevels=" + Arrays.toString(mBrighteningThresholdLevels));
|
||||||
pw.println(" mDarkeningThresholds=" + Arrays.toString(mDarkeningThresholds));
|
pw.println(" mBrighteningThresholdsPercentages="
|
||||||
pw.println(" mThresholdLevels=" + Arrays.toString(mThresholdLevels));
|
+ Arrays.toString(mBrighteningThresholdsPercentages));
|
||||||
|
pw.println(" mMinBrightening=" + mMinBrightening);
|
||||||
|
pw.println(" mDarkeningThresholdLevels=" + Arrays.toString(mDarkeningThresholdLevels));
|
||||||
|
pw.println(" mDarkeningThresholdsPercentages="
|
||||||
|
+ Arrays.toString(mDarkeningThresholdsPercentages));
|
||||||
|
pw.println(" mMinDarkening=" + mMinDarkening);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,6 +351,35 @@
|
|||||||
<xs:annotation name="nonnull"/>
|
<xs:annotation name="nonnull"/>
|
||||||
<xs:annotation name="final"/>
|
<xs:annotation name="final"/>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
<xs:sequence>
|
||||||
|
<!-- Thresholds as tenths of percent of current brightness level, at each level of
|
||||||
|
brightness -->
|
||||||
|
<xs:element name="brightnessThresholdPoints" type="thresholdPoints" maxOccurs="1" minOccurs="0">
|
||||||
|
<xs:annotation name="final"/>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="thresholdPoints">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="thresholdPoint" name="brightnessThresholdPoint" maxOccurs="unbounded" minOccurs="1">
|
||||||
|
<xs:annotation name="nonnull"/>
|
||||||
|
<xs:annotation name="final"/>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="thresholdPoint">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="nonNegativeDecimal" name="threshold">
|
||||||
|
<xs:annotation name="nonnull"/>
|
||||||
|
<xs:annotation name="final"/>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element type="nonNegativeDecimal" name="percentage">
|
||||||
|
<xs:annotation name="nonnull"/>
|
||||||
|
<xs:annotation name="final"/>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:complexType name="autoBrightness">
|
<xs:complexType name="autoBrightness">
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ package com.android.server.display.config {
|
|||||||
|
|
||||||
public class BrightnessThresholds {
|
public class BrightnessThresholds {
|
||||||
ctor public BrightnessThresholds();
|
ctor public BrightnessThresholds();
|
||||||
|
method public final com.android.server.display.config.ThresholdPoints getBrightnessThresholdPoints();
|
||||||
method @NonNull public final java.math.BigDecimal getMinimum();
|
method @NonNull public final java.math.BigDecimal getMinimum();
|
||||||
|
method public final void setBrightnessThresholdPoints(com.android.server.display.config.ThresholdPoints);
|
||||||
method public final void setMinimum(@NonNull java.math.BigDecimal);
|
method public final void setMinimum(@NonNull java.math.BigDecimal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,6 +206,19 @@ package com.android.server.display.config {
|
|||||||
method public final void setBrightnessThrottlingMap(@NonNull com.android.server.display.config.BrightnessThrottlingMap);
|
method public final void setBrightnessThrottlingMap(@NonNull com.android.server.display.config.BrightnessThrottlingMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ThresholdPoint {
|
||||||
|
ctor public ThresholdPoint();
|
||||||
|
method @NonNull public final java.math.BigDecimal getPercentage();
|
||||||
|
method @NonNull public final java.math.BigDecimal getThreshold();
|
||||||
|
method public final void setPercentage(@NonNull java.math.BigDecimal);
|
||||||
|
method public final void setThreshold(@NonNull java.math.BigDecimal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ThresholdPoints {
|
||||||
|
ctor public ThresholdPoints();
|
||||||
|
method @NonNull public final java.util.List<com.android.server.display.config.ThresholdPoint> getBrightnessThresholdPoint();
|
||||||
|
}
|
||||||
|
|
||||||
public class Thresholds {
|
public class Thresholds {
|
||||||
ctor public Thresholds();
|
ctor public Thresholds();
|
||||||
method @NonNull public final com.android.server.display.config.BrightnessThresholds getBrighteningThresholds();
|
method @NonNull public final com.android.server.display.config.BrightnessThresholds getBrighteningThresholds();
|
||||||
|
|||||||
@@ -422,13 +422,13 @@ public class AutomaticBrightnessControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHysteresisLevels() {
|
public void testHysteresisLevels() {
|
||||||
int[] ambientBrighteningThresholds = {100, 200};
|
float[] ambientBrighteningThresholds = {50, 100};
|
||||||
int[] ambientDarkeningThresholds = {400, 500};
|
float[] ambientDarkeningThresholds = {10, 20};
|
||||||
int[] ambientThresholdLevels = {500};
|
float[] ambientThresholdLevels = {0, 500};
|
||||||
float ambientDarkeningMinChangeThreshold = 3.0f;
|
float ambientDarkeningMinChangeThreshold = 3.0f;
|
||||||
float ambientBrighteningMinChangeThreshold = 1.5f;
|
float ambientBrighteningMinChangeThreshold = 1.5f;
|
||||||
HysteresisLevels hysteresisLevels = new HysteresisLevels(ambientBrighteningThresholds,
|
HysteresisLevels hysteresisLevels = new HysteresisLevels(ambientBrighteningThresholds,
|
||||||
ambientDarkeningThresholds, ambientThresholdLevels,
|
ambientDarkeningThresholds, ambientThresholdLevels, ambientThresholdLevels,
|
||||||
ambientDarkeningMinChangeThreshold, ambientBrighteningMinChangeThreshold);
|
ambientDarkeningMinChangeThreshold, ambientBrighteningMinChangeThreshold);
|
||||||
|
|
||||||
// test low, activate minimum change thresholds.
|
// test low, activate minimum change thresholds.
|
||||||
@@ -437,16 +437,17 @@ public class AutomaticBrightnessControllerTest {
|
|||||||
assertEquals(1f, hysteresisLevels.getDarkeningThreshold(4.0f), EPSILON);
|
assertEquals(1f, hysteresisLevels.getDarkeningThreshold(4.0f), EPSILON);
|
||||||
|
|
||||||
// test max
|
// test max
|
||||||
assertEquals(12000f, hysteresisLevels.getBrighteningThreshold(10000.0f), EPSILON);
|
// epsilon is x2 here, since the next floating point value about 20,000 is 0.0019531 greater
|
||||||
assertEquals(5000f, hysteresisLevels.getDarkeningThreshold(10000.0f), EPSILON);
|
assertEquals(20000f, hysteresisLevels.getBrighteningThreshold(10000.0f), EPSILON * 2);
|
||||||
|
assertEquals(8000f, hysteresisLevels.getDarkeningThreshold(10000.0f), EPSILON);
|
||||||
|
|
||||||
// test just below threshold
|
// test just below threshold
|
||||||
assertEquals(548.9f, hysteresisLevels.getBrighteningThreshold(499f), EPSILON);
|
assertEquals(748.5f, hysteresisLevels.getBrighteningThreshold(499f), EPSILON);
|
||||||
assertEquals(299.4f, hysteresisLevels.getDarkeningThreshold(499f), EPSILON);
|
assertEquals(449.1f, hysteresisLevels.getDarkeningThreshold(499f), EPSILON);
|
||||||
|
|
||||||
// test at (considered above) threshold
|
// test at (considered above) threshold
|
||||||
assertEquals(600f, hysteresisLevels.getBrighteningThreshold(500f), EPSILON);
|
assertEquals(1000f, hysteresisLevels.getBrighteningThreshold(500f), EPSILON);
|
||||||
assertEquals(250f, hysteresisLevels.getDarkeningThreshold(500f), EPSILON);
|
assertEquals(400f, hysteresisLevels.getDarkeningThreshold(500f), EPSILON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import android.platform.test.annotations.Presubmit;
|
|||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
import androidx.test.runner.AndroidJUnit4;
|
import androidx.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -48,6 +50,9 @@ import java.nio.file.Path;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public final class DisplayDeviceConfigTest {
|
public final class DisplayDeviceConfigTest {
|
||||||
private DisplayDeviceConfig mDisplayDeviceConfig;
|
private DisplayDeviceConfig mDisplayDeviceConfig;
|
||||||
|
private static final float ZERO_DELTA = 0.0f;
|
||||||
|
private static final float SMALL_DELTA = 0.0001f;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
@@ -69,26 +74,74 @@ public final class DisplayDeviceConfigTest {
|
|||||||
assertEquals(mDisplayDeviceConfig.getAmbientHorizonShort(), 50);
|
assertEquals(mDisplayDeviceConfig.getAmbientHorizonShort(), 50);
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessRampDecreaseMaxMillis(), 3000);
|
assertEquals(mDisplayDeviceConfig.getBrightnessRampDecreaseMaxMillis(), 3000);
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessRampIncreaseMaxMillis(), 2000);
|
assertEquals(mDisplayDeviceConfig.getBrightnessRampIncreaseMaxMillis(), 2000);
|
||||||
assertEquals(mDisplayDeviceConfig.getAmbientLuxBrighteningMinThreshold(), 10.0f, 0.0f);
|
assertEquals(mDisplayDeviceConfig.getBrightnessRampFastDecrease(), 0.01f, ZERO_DELTA);
|
||||||
assertEquals(mDisplayDeviceConfig.getAmbientLuxDarkeningMinThreshold(), 2.0f, 0.0f);
|
assertEquals(mDisplayDeviceConfig.getBrightnessRampFastIncrease(), 0.02f, ZERO_DELTA);
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessRampFastDecrease(), 0.01f, 0.0f);
|
assertEquals(mDisplayDeviceConfig.getBrightnessRampSlowIncrease(), 0.04f, ZERO_DELTA);
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessRampFastIncrease(), 0.02f, 0.0f);
|
assertEquals(mDisplayDeviceConfig.getBrightnessRampSlowDecrease(), 0.03f, ZERO_DELTA);
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessRampSlowIncrease(), 0.04f, 0.0f);
|
assertEquals(mDisplayDeviceConfig.getBrightnessDefault(), 0.5f, ZERO_DELTA);
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessRampSlowDecrease(), 0.03f, 0.0f);
|
|
||||||
assertEquals(mDisplayDeviceConfig.getBrightnessDefault(), 0.5f, 0.0f);
|
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getBrightness(), new float[]{0.0f, 0.62f, 1.0f},
|
assertArrayEquals(mDisplayDeviceConfig.getBrightness(), new float[]{0.0f, 0.62f, 1.0f},
|
||||||
0.0f);
|
ZERO_DELTA);
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getNits(), new float[]{2.0f, 500.0f, 800.0f}, 0.0f);
|
assertArrayEquals(mDisplayDeviceConfig.getNits(), new float[]{2.0f, 500.0f, 800.0f},
|
||||||
|
ZERO_DELTA);
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getBacklight(), new float[]{0.0f, 0.62f, 1.0f},
|
assertArrayEquals(mDisplayDeviceConfig.getBacklight(), new float[]{0.0f, 0.62f, 1.0f},
|
||||||
0.0f);
|
ZERO_DELTA);
|
||||||
assertEquals(mDisplayDeviceConfig.getScreenBrighteningMinThreshold(), 0.001, 0.000001f);
|
|
||||||
assertEquals(mDisplayDeviceConfig.getScreenDarkeningMinThreshold(), 0.002, 0.000001f);
|
|
||||||
assertEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLightDebounce(), 2000);
|
assertEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLightDebounce(), 2000);
|
||||||
assertEquals(mDisplayDeviceConfig.getAutoBrightnessDarkeningLightDebounce(), 1000);
|
assertEquals(mDisplayDeviceConfig.getAutoBrightnessDarkeningLightDebounce(), 1000);
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsLux(), new
|
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsLux(), new
|
||||||
float[]{0.0f, 50.0f, 80.0f}, 0.0f);
|
float[]{0.0f, 50.0f, 80.0f}, ZERO_DELTA);
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsNits(), new
|
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsNits(), new
|
||||||
float[]{45.32f, 75.43f}, 0.0f);
|
float[]{45.32f, 75.43f}, ZERO_DELTA);
|
||||||
|
|
||||||
|
// Test thresholds
|
||||||
|
assertEquals(10, mDisplayDeviceConfig.getAmbientLuxBrighteningMinThreshold(),
|
||||||
|
ZERO_DELTA);
|
||||||
|
assertEquals(20, mDisplayDeviceConfig.getAmbientLuxBrighteningMinThresholdIdle(),
|
||||||
|
ZERO_DELTA);
|
||||||
|
assertEquals(30, mDisplayDeviceConfig.getAmbientLuxDarkeningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(40, mDisplayDeviceConfig.getAmbientLuxDarkeningMinThresholdIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertEquals(0.1f, mDisplayDeviceConfig.getScreenBrighteningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(0.2f, mDisplayDeviceConfig.getScreenBrighteningMinThresholdIdle(), ZERO_DELTA);
|
||||||
|
assertEquals(0.3f, mDisplayDeviceConfig.getScreenDarkeningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(0.4f, mDisplayDeviceConfig.getScreenDarkeningMinThresholdIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 0.10f, 0.20f},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningLevels(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{9, 10, 11},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningPercentages(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 0.11f, 0.21f},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningLevels(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{11, 12, 13},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningPercentages(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 100, 200},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningLevels(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{13, 14, 15},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningPercentages(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 300, 400},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningLevels(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{15, 16, 17},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningPercentages(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 0.12f, 0.22f},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningLevelsIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{17, 18, 19},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 0.13f, 0.23f},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningLevelsIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{19, 20, 21},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 500, 600},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningLevelsIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{21, 22, 23},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 700, 800},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningLevelsIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{23, 24, 25},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
|
||||||
// Todo(brup): Add asserts for BrightnessThrottlingData, DensityMapping,
|
// Todo(brup): Add asserts for BrightnessThrottlingData, DensityMapping,
|
||||||
// HighBrightnessModeData AmbientLightSensor, RefreshRateLimitations and ProximitySensor.
|
// HighBrightnessModeData AmbientLightSensor, RefreshRateLimitations and ProximitySensor.
|
||||||
}
|
}
|
||||||
@@ -97,9 +150,60 @@ public final class DisplayDeviceConfigTest {
|
|||||||
public void testConfigValuesFromConfigResource() {
|
public void testConfigValuesFromConfigResource() {
|
||||||
setupDisplayDeviceConfigFromConfigResourceFile();
|
setupDisplayDeviceConfigFromConfigResourceFile();
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsNits(), new
|
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsNits(), new
|
||||||
float[]{2.0f, 200.0f, 600.0f}, 0.0f);
|
float[]{2.0f, 200.0f, 600.0f}, ZERO_DELTA);
|
||||||
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsLux(), new
|
assertArrayEquals(mDisplayDeviceConfig.getAutoBrightnessBrighteningLevelsLux(), new
|
||||||
float[]{0.0f, 0.0f, 110.0f, 500.0f}, 0.0f);
|
float[]{0.0f, 0.0f, 110.0f, 500.0f}, ZERO_DELTA);
|
||||||
|
|
||||||
|
// Test thresholds
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getAmbientLuxBrighteningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getAmbientLuxBrighteningMinThresholdIdle(),
|
||||||
|
ZERO_DELTA);
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getAmbientLuxDarkeningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getAmbientLuxDarkeningMinThresholdIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getScreenBrighteningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getScreenBrighteningMinThresholdIdle(), ZERO_DELTA);
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getScreenDarkeningMinThreshold(), ZERO_DELTA);
|
||||||
|
assertEquals(0, mDisplayDeviceConfig.getScreenDarkeningMinThresholdIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
// screen levels will be considered "old screen brightness scale"
|
||||||
|
// and therefore will divide by 255
|
||||||
|
assertArrayEquals(new float[]{0, 42 / 255f, 43 / 255f},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningLevels(), SMALL_DELTA);
|
||||||
|
assertArrayEquals(new float[]{35, 36, 37},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningPercentages(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 42 / 255f, 43 / 255f},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningLevels(), SMALL_DELTA);
|
||||||
|
assertArrayEquals(new float[]{37, 38, 39},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningPercentages(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 30, 31},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningLevels(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{27, 28, 29},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningPercentages(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 30, 31},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningLevels(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{29, 30, 31},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningPercentages(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 42 / 255f, 43 / 255f},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningLevelsIdle(), SMALL_DELTA);
|
||||||
|
assertArrayEquals(new float[]{35, 36, 37},
|
||||||
|
mDisplayDeviceConfig.getScreenBrighteningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 42 / 255f, 43 / 255f},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningLevelsIdle(), SMALL_DELTA);
|
||||||
|
assertArrayEquals(new float[]{37, 38, 39},
|
||||||
|
mDisplayDeviceConfig.getScreenDarkeningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
|
assertArrayEquals(new float[]{0, 30, 31},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningLevelsIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{27, 28, 29},
|
||||||
|
mDisplayDeviceConfig.getAmbientBrighteningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{0, 30, 31},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningLevelsIdle(), ZERO_DELTA);
|
||||||
|
assertArrayEquals(new float[]{29, 30, 31},
|
||||||
|
mDisplayDeviceConfig.getAmbientDarkeningPercentagesIdle(), ZERO_DELTA);
|
||||||
|
|
||||||
// Todo(brup): Add asserts for BrightnessThrottlingData, DensityMapping,
|
// Todo(brup): Add asserts for BrightnessThrottlingData, DensityMapping,
|
||||||
// HighBrightnessModeData AmbientLightSensor, RefreshRateLimitations and ProximitySensor.
|
// HighBrightnessModeData AmbientLightSensor, RefreshRateLimitations and ProximitySensor.
|
||||||
}
|
}
|
||||||
@@ -154,11 +258,126 @@ public final class DisplayDeviceConfigTest {
|
|||||||
+ "<ambientBrightnessChangeThresholds>\n"
|
+ "<ambientBrightnessChangeThresholds>\n"
|
||||||
+ "<brighteningThresholds>\n"
|
+ "<brighteningThresholds>\n"
|
||||||
+ "<minimum>10</minimum>\n"
|
+ "<minimum>10</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>13</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>100</threshold><percentage>14</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>200</threshold><percentage>15</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
+ "</brighteningThresholds>\n"
|
+ "</brighteningThresholds>\n"
|
||||||
+ "<darkeningThresholds>\n"
|
+ "<darkeningThresholds>\n"
|
||||||
+ "<minimum>2</minimum>\n"
|
+ "<minimum>30</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>15</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>300</threshold><percentage>16</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>400</threshold><percentage>17</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
+ "</darkeningThresholds>\n"
|
+ "</darkeningThresholds>\n"
|
||||||
+ "</ambientBrightnessChangeThresholds>\n"
|
+ "</ambientBrightnessChangeThresholds>\n"
|
||||||
|
+ "<displayBrightnessChangeThresholds>\n"
|
||||||
|
+ "<brighteningThresholds>\n"
|
||||||
|
+ "<minimum>0.1</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold>\n"
|
||||||
|
+ "<percentage>9</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.10</threshold>\n"
|
||||||
|
+ "<percentage>10</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.20</threshold>\n"
|
||||||
|
+ "<percentage>11</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
|
+ "</brighteningThresholds>\n"
|
||||||
|
+ "<darkeningThresholds>\n"
|
||||||
|
+ "<minimum>0.3</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>11</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.11</threshold><percentage>12</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.21</threshold><percentage>13</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
|
+ "</darkeningThresholds>\n"
|
||||||
|
+ "</displayBrightnessChangeThresholds>\n"
|
||||||
|
+ "<ambientBrightnessChangeThresholdsIdle>\n"
|
||||||
|
+ "<brighteningThresholds>\n"
|
||||||
|
+ "<minimum>20</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>21</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>500</threshold><percentage>22</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>600</threshold><percentage>23</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
|
+ "</brighteningThresholds>\n"
|
||||||
|
+ "<darkeningThresholds>\n"
|
||||||
|
+ "<minimum>40</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>23</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>700</threshold><percentage>24</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>800</threshold><percentage>25</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
|
+ "</darkeningThresholds>\n"
|
||||||
|
+ "</ambientBrightnessChangeThresholdsIdle>\n"
|
||||||
|
+ "<displayBrightnessChangeThresholdsIdle>\n"
|
||||||
|
+ "<brighteningThresholds>\n"
|
||||||
|
+ "<minimum>0.2</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>17</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.12</threshold><percentage>18</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.22</threshold><percentage>19</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
|
+ "</brighteningThresholds>\n"
|
||||||
|
+ "<darkeningThresholds>\n"
|
||||||
|
+ "<minimum>0.4</minimum>\n"
|
||||||
|
+ "<brightnessThresholdPoints>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0</threshold><percentage>19</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.13</threshold><percentage>20</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "<brightnessThresholdPoint>\n"
|
||||||
|
+ "<threshold>0.23</threshold><percentage>21</percentage>\n"
|
||||||
|
+ "</brightnessThresholdPoint>\n"
|
||||||
|
+ "</brightnessThresholdPoints>\n"
|
||||||
|
+ "</darkeningThresholds>\n"
|
||||||
|
+ "</displayBrightnessChangeThresholdsIdle>\n"
|
||||||
+ "<screenBrightnessRampFastDecrease>0.01</screenBrightnessRampFastDecrease> "
|
+ "<screenBrightnessRampFastDecrease>0.01</screenBrightnessRampFastDecrease> "
|
||||||
+ "<screenBrightnessRampFastIncrease>0.02</screenBrightnessRampFastIncrease> "
|
+ "<screenBrightnessRampFastIncrease>0.02</screenBrightnessRampFastIncrease> "
|
||||||
+ "<screenBrightnessRampSlowDecrease>0.03</screenBrightnessRampSlowDecrease>"
|
+ "<screenBrightnessRampSlowDecrease>0.03</screenBrightnessRampSlowDecrease>"
|
||||||
@@ -171,18 +390,6 @@ public final class DisplayDeviceConfigTest {
|
|||||||
+ "</screenBrightnessRampDecreaseMaxMillis>"
|
+ "</screenBrightnessRampDecreaseMaxMillis>"
|
||||||
+ "<ambientLightHorizonLong>5000</ambientLightHorizonLong>\n"
|
+ "<ambientLightHorizonLong>5000</ambientLightHorizonLong>\n"
|
||||||
+ "<ambientLightHorizonShort>50</ambientLightHorizonShort>\n"
|
+ "<ambientLightHorizonShort>50</ambientLightHorizonShort>\n"
|
||||||
+ "<displayBrightnessChangeThresholds>"
|
|
||||||
+ "<brighteningThresholds>"
|
|
||||||
+ "<minimum>"
|
|
||||||
+ "0.001"
|
|
||||||
+ "</minimum>"
|
|
||||||
+ "</brighteningThresholds>"
|
|
||||||
+ "<darkeningThresholds>"
|
|
||||||
+ "<minimum>"
|
|
||||||
+ "0.002"
|
|
||||||
+ "</minimum>"
|
|
||||||
+ "</darkeningThresholds>"
|
|
||||||
+ "</displayBrightnessChangeThresholds>"
|
|
||||||
+ "<screenBrightnessRampIncreaseMaxMillis>"
|
+ "<screenBrightnessRampIncreaseMaxMillis>"
|
||||||
+ "2000"
|
+ "2000"
|
||||||
+ "</screenBrightnessRampIncreaseMaxMillis>\n"
|
+ "</screenBrightnessRampIncreaseMaxMillis>\n"
|
||||||
@@ -241,8 +448,24 @@ public final class DisplayDeviceConfigTest {
|
|||||||
com.android.internal.R.array.config_autoBrightnessLevels))
|
com.android.internal.R.array.config_autoBrightnessLevels))
|
||||||
.thenReturn(screenBrightnessLevelLux);
|
.thenReturn(screenBrightnessLevelLux);
|
||||||
|
|
||||||
mDisplayDeviceConfig = DisplayDeviceConfig.create(mContext, true);
|
// Thresholds
|
||||||
|
// Config.xml requires the levels arrays to be of length N and the thresholds arrays to be
|
||||||
|
// of length N+1
|
||||||
|
when(mResources.getIntArray(com.android.internal.R.array.config_ambientThresholdLevels))
|
||||||
|
.thenReturn(new int[]{30, 31});
|
||||||
|
when(mResources.getIntArray(com.android.internal.R.array.config_screenThresholdLevels))
|
||||||
|
.thenReturn(new int[]{42, 43});
|
||||||
|
when(mResources.getIntArray(
|
||||||
|
com.android.internal.R.array.config_ambientBrighteningThresholds))
|
||||||
|
.thenReturn(new int[]{270, 280, 290});
|
||||||
|
when(mResources.getIntArray(com.android.internal.R.array.config_ambientDarkeningThresholds))
|
||||||
|
.thenReturn(new int[]{290, 300, 310});
|
||||||
|
when(mResources.getIntArray(R.array.config_screenBrighteningThresholds))
|
||||||
|
.thenReturn(new int[]{350, 360, 370});
|
||||||
|
when(mResources.getIntArray(R.array.config_screenDarkeningThresholds))
|
||||||
|
.thenReturn(new int[]{370, 380, 390});
|
||||||
|
|
||||||
|
mDisplayDeviceConfig = DisplayDeviceConfig.create(mContext, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TypedArray createFloatTypedArray(float[] vals) {
|
private TypedArray createFloatTypedArray(float[] vals) {
|
||||||
|
|||||||
Reference in New Issue
Block a user