As we know , the android system realizing logic of the auto-brightness is like this(By LightSensor):
frameworks/base/services/java/com/android/server/power/DisplayPowerController.java
public DisplayPowerController(Looper looper, Context context, Notifier notifier,
LightsService lights, TwilightService twilight,
DisplayBlanker displayBlanker,
Callbacks callbacks, Handler callbackHandler) {
if (mUseSoftwareAutoBrightnessConfig) {
int[] lux = resources.getIntArray(
com.android.internal.R.array.config_autoBrightnessLevels);
int[] screenBrightness = resources.getIntArray(
com.android.internal.R.array.config_autoBrightnessLcdBacklightValues);
}
}
private final SensorEventListener mLightSensorListener = new SensorEventListener() {
@Override
public void onSensorChanged(SensorEvent event) {
if (mLightSensorEnabled) {
final long time = SystemClock.uptimeMillis();
final float lux = event.values[0];
handleLightSensorEvent(time, lux);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// Not used.
}
};
frameworks/base/core/res/res/values/config.xml
<integer-array name="config_autoBrightnessLevels">
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
</integer-array>
I want to custom the config_autoBrightnessLevels in my own app(when launch the APP , make the LCD more brighter), So how to do it ? Must I copy the realizing logic into my APP and update the WindowManager.LayoutParams.screenBrightness value ?