Browse files

Keep keyboard lit until the screen is dimmed

Do not use button timeout for keyboard (which is intrusive on QWERTY
sliders). Keep it lit until the screen dims instead of turning it off
like the buttons after 5 seconds. Also consider setting keyboard
visibility as a user activity.
  • Loading branch information...
1 parent a1810ef commit 5e6c92e2fffd3406f2cbaa08f744e6189afcf484 @SkrilaxCZ SkrilaxCZ committed with Gerrit Code Review Apr 27, 2013
Showing with 9 additions and 6 deletions.
  1. +9 −6 services/java/com/android/server/power/PowerManagerService.java
View
15 services/java/com/android/server/power/PowerManagerService.java
@@ -915,11 +915,14 @@ public void setKeyboardVisibility(boolean visible) {
if (mKeyboardVisible != visible) {
mKeyboardVisible = visible;
if (!visible) {
- mKeyboardLight.turnOff();
// If hiding keyboard, turn off leds
setKeyboardLight(false, 1);
setKeyboardLight(false, 2);
}
+ synchronized (mLock) {
+ mDirty |= DIRTY_USER_ACTIVITY;
+ updatePowerStateLocked();
+ }
}
}
}
@@ -1361,15 +1364,14 @@ private void updateUserActivitySummaryLocked(long now, int dirty) {
nextTimeout = mLastUserActivityTime
+ screenOffTimeout - screenDimDuration;
if (now < nextTimeout) {
+ int brightness = mButtonBrightnessOverrideFromWindowManager >= 0
+ ? mButtonBrightnessOverrideFromWindowManager
+ : mDisplayPowerRequest.screenBrightness;
+ mKeyboardLight.setBrightness(mKeyboardVisible ? brightness : 0);
if (now > mLastUserActivityTime + BUTTON_ON_DURATION) {
mButtonsLight.setBrightness(0);
- mKeyboardLight.setBrightness(0);
} else {
- int brightness = mButtonBrightnessOverrideFromWindowManager >= 0
- ? mButtonBrightnessOverrideFromWindowManager
- : mDisplayPowerRequest.screenBrightness;
mButtonsLight.setBrightness(brightness);
- mKeyboardLight.setBrightness(mKeyboardVisible ? brightness : 0);
if (brightness != 0) {
nextTimeout = now + BUTTON_ON_DURATION;
}
@@ -1378,6 +1380,7 @@ private void updateUserActivitySummaryLocked(long now, int dirty) {
} else {
nextTimeout = mLastUserActivityTime + screenOffTimeout;
if (now < nextTimeout) {
+ mKeyboardLight.setBrightness(0);
mUserActivitySummary |= USER_ACTIVITY_SCREEN_DIM;
}
}

0 comments on commit 5e6c92e

Please sign in to comment.