如何自定义Android默认自动亮度数组值?

时间:2013-12-27 02:47:57

标签: android android-sensors lcd screen-brightness

众所周知,实现自动亮度逻辑的android系统是这样的(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.
    }
};

框架/碱/核心/ RES / RES /值/ config.xml中

<integer-array name="config_autoBrightnessLevels">
</integer-array>

<integer-array name="config_autoBrightnessLcdBacklightValues">
</integer-array>

我想在我自己的应用程序中自定义config_autoBrightnessLevels(启动APP时,让LCD更亮),那么怎么做呢?我必须将实现逻辑复制到我的APP中并更新WindowManager.LayoutParams.screenBrightness值吗?

0 个答案:

没有答案