Add window manager support for overriding button and keyboard backlight values.
The new backlightBrightness field works similarly as the existing WindowManager.LayoutParams.screenBrightness field
Needed for bugs:
b/2233655 (under low ambient light the touch keys remain illuminated during video playback and never timeout)
b/2221079 (Backlight for home/search/back/etc buttons should turn off when in dock in night mode)
Change-Id: I60dfecdc7bb653b0db38094464de651220b3d438
This commit is contained in:
@@ -9313,6 +9313,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
boolean orientationChangeComplete = true;
|
||||
Session holdScreen = null;
|
||||
float screenBrightness = -1;
|
||||
float buttonBrightness = -1;
|
||||
boolean focusDisplayed = false;
|
||||
boolean animating = false;
|
||||
|
||||
@@ -10072,6 +10073,10 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
&& screenBrightness < 0) {
|
||||
screenBrightness = w.mAttrs.screenBrightness;
|
||||
}
|
||||
if (!syswin && w.mAttrs.buttonBrightness >= 0
|
||||
&& buttonBrightness < 0) {
|
||||
buttonBrightness = w.mAttrs.buttonBrightness;
|
||||
}
|
||||
if (attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG
|
||||
|| attrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD
|
||||
|| attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_ERROR) {
|
||||
@@ -10318,6 +10323,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mPowerManager.setScreenBrightnessOverride((int)
|
||||
(screenBrightness * Power.BRIGHTNESS_ON));
|
||||
}
|
||||
if (buttonBrightness < 0 || buttonBrightness > 1.0f) {
|
||||
mPowerManager.setButtonBrightnessOverride(-1);
|
||||
} else {
|
||||
mPowerManager.setButtonBrightnessOverride((int)
|
||||
(buttonBrightness * Power.BRIGHTNESS_ON));
|
||||
}
|
||||
if (holdScreen != mHoldingScreenOn) {
|
||||
mHoldingScreenOn = holdScreen;
|
||||
Message m = mH.obtainMessage(H.HOLD_SCREEN_CHANGED, holdScreen);
|
||||
|
||||
Reference in New Issue
Block a user