我已经设法使用以下代码更改活动(以及整个应用程序的扩展)中的屏幕亮度:
Settings.System.putFloat(this.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, ((float)LocationService.settings.screenBrightness));
WindowManager.LayoutParams lp = getWindow().getAttributes();
float brightness = someValue;
lp.screenBrightness = brightness;
getWindow().setAttributes(lp);
但是,一旦我关闭应用程序,亮度就会恢复到以前的设置。有没有办法让这些更改在应用程序的生命周期之外持续存在?
谢谢!