在 Android 中设置 autoBrightness 很容易,不是吗?
Settings.System.putInt(resolver,
Settings.System.SCREEN_BRIGHTNESS_MODE, 0); // 0 is manual, 1 is auto
但是,如果您要切换:
boolean isAuto = Settings.System.getInt(resolver,
Settings.System.SCREEN_BRIGHTNESS_MODE) == 1;
Settings.System.putInt(resolver,
Settings.System.SCREEN_BRIGHTNESS_MODE, isAuto ? 0 : 1);
在您锁定屏幕并再次锁定之前,它不会自动适应。