Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ private void setScreenOn(boolean on) {
mNotifier.onScreenOn();
} else {
mLights.getLight(LightsService.LIGHT_ID_BUTTONS).setBrightness(0);
mLights.getLight(LightsService.LIGHT_ID_KEYBOARD).setBrightness(0);
mNotifier.onScreenOff();
}
}
Expand Down
12 changes: 12 additions & 0 deletions services/java/com/android/server/power/PowerManagerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.Uri;
Expand Down Expand Up @@ -147,6 +148,7 @@ public final class PowerManagerService extends IPowerManager.Stub
// minimum screen off timeout should be longer than this.
private static final int SCREEN_DIM_DURATION = 7 * 1000;
private static final int BUTTON_ON_DURATION = 5 * 1000;
private static final int KEYBOARD_ON_DURATION = 9 * 1000;

// The maximum screen dim time expressed as a ratio relative to the screen
// off timeout. If the screen off timeout is very short then we want the
Expand Down Expand Up @@ -187,6 +189,7 @@ public final class PowerManagerService extends IPowerManager.Stub
private DreamManagerService mDreamManager;
private LightsService.Light mAttentionLight;
private LightsService.Light mButtonsLight;
private LightsService.Light mKeyboardLight;

private final Object mLock = new Object();

Expand Down Expand Up @@ -444,6 +447,7 @@ public void systemReady(TwilightService twilight, DreamManagerService dreamManag
mSettingsObserver = new SettingsObserver(mHandler);
mAttentionLight = mLightsService.getLight(LightsService.LIGHT_ID_ATTENTION);
mButtonsLight = mLightsService.getLight(LightsService.LIGHT_ID_BUTTONS);
mKeyboardLight = mLightsService.getLight(LightsService.LIGHT_ID_KEYBOARD);

// Register for broadcasts from other components of the system.
IntentFilter filter = new IntentFilter();
Expand Down Expand Up @@ -1303,6 +1307,14 @@ private void updateUserActivitySummaryLocked(long now, int dirty) {
mButtonsLight.setBrightness(mDisplayPowerRequest.screenBrightness);
nextTimeout = now + BUTTON_ON_DURATION;
}
if (now > mLastUserActivityTime + KEYBOARD_ON_DURATION) {
mKeyboardLight.setBrightness(0);
} else if (mContext.getResources().getConfiguration().hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES){
mKeyboardLight.setBrightness(mDisplayPowerRequest.screenBrightness);
nextTimeout = now + KEYBOARD_ON_DURATION;
} else if (mContext.getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES){
mKeyboardLight.setBrightness(0);
}
mUserActivitySummary |= USER_ACTIVITY_SCREEN_BRIGHT;
} else {
nextTimeout = mLastUserActivityTime + screenOffTimeout;
Expand Down