summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuanQY <yuanqingyun@gmail.com>2013-02-08 10:59:22 +0800
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2013-02-10 21:10:18 -0800
commite8b4b3b9329ff85c6ece2076cfa1225769951c5c (patch)
tree800248d112efa6c567c5d7639c7f6325ef6f92a8
parentc83dd1143ae385823501b67b7ee4382e911478f5 (diff)
downloadframeworks_base-e8b4b3b9329ff85c6ece2076cfa1225769951c5c.zip
frameworks_base-e8b4b3b9329ff85c6ece2076cfa1225769951c5c.tar.gz
frameworks_base-e8b4b3b9329ff85c6ece2076cfa1225769951c5c.tar.bz2
Keyboard light: Fix the physical keyboard not light when it's visiable.
Change-Id: I595afd3cb6b422a17ae0f6ec20aa51979db13810
-rw-r--r--core/java/android/os/IPowerManager.aidl2
-rw-r--r--core/java/android/os/PowerManager.java13
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java2
-rw-r--r--services/java/com/android/server/power/DisplayPowerController.java1
-rw-r--r--services/java/com/android/server/power/PowerManagerService.java17
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java5
6 files changed, 40 insertions, 0 deletions
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index 8dabfb3..24849bd 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -53,4 +53,6 @@ interface IPowerManager
void setAttentionLight(boolean on, int color);
void cpuBoost(int duration);
+
+ void setKeyboardVisibility(boolean visible);
}
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 7a54102..4be3fd1 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -840,4 +840,17 @@ public final class PowerManager {
}
}
}
+
+ /**
+ * @hide
+ */
+ public void setKeyboardVisibility(boolean visible)
+ {
+ try {
+ if (mService != null) {
+ mService.setKeyboardVisibility(visible);
+ }
+ } catch (RemoteException e) {
+ }
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index ea2a524..7ff7720 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -4824,6 +4824,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
private void applyLidSwitchState() {
+ mPowerManager.setKeyboardVisibility(isBuiltInKeyboardVisible());
+
if (mLidState == LID_CLOSED && mLidControlsSleep) {
mPowerManager.goToSleep(SystemClock.uptimeMillis());
}
diff --git a/services/java/com/android/server/power/DisplayPowerController.java b/services/java/com/android/server/power/DisplayPowerController.java
index bbd2baa..96bdbc3 100644
--- a/services/java/com/android/server/power/DisplayPowerController.java
+++ b/services/java/com/android/server/power/DisplayPowerController.java
@@ -769,6 +769,7 @@ final class DisplayPowerController {
mNotifier.onScreenOn();
} else {
mLights.getLight(LightsService.LIGHT_ID_BUTTONS).setBrightness(0);
+ mLights.getLight(LightsService.LIGHT_ID_KEYBOARD).setBrightness(0);
mNotifier.onScreenOff();
}
}
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index 6604af6..d4fa948 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -187,6 +187,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();
@@ -376,6 +377,7 @@ public final class PowerManagerService extends IPowerManager.Stub
private static native void nativeSetInteractive(boolean enable);
private static native void nativeSetAutoSuspend(boolean enable);
private static native void nativeCpuBoost(int duration);
+ private boolean mKeyboardVisible = false;
public PowerManagerService() {
synchronized (mLock) {
@@ -449,6 +451,7 @@ public final class PowerManagerService extends IPowerManager.Stub
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();
@@ -877,6 +880,18 @@ public final class PowerManagerService extends IPowerManager.Stub
}
@Override // Binder call
+ public void setKeyboardVisibility(boolean visible) {
+ synchronized (mLock) {
+ if (DEBUG_SPEW) {
+ Slog.d(TAG, "setKeyboardVisibility: " + visible);
+ }
+ if (mKeyboardVisible != visible) {
+ mKeyboardVisible = visible;
+ }
+ }
+ }
+
+ @Override // Binder call
public void wakeUp(long eventTime) {
if (eventTime > SystemClock.uptimeMillis()) {
throw new IllegalArgumentException("event time must not be in the future");
@@ -1304,11 +1319,13 @@ public final class PowerManagerService extends IPowerManager.Stub
if (now < nextTimeout) {
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;
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
index c0151cf..b4dd542 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java
@@ -124,4 +124,9 @@ public class BridgePowerManager implements IPowerManager {
public void cpuBoost(int duration) throws RemoteException {
// pass for now
}
+
+ @Override
+ public void setKeyboardVisibility(boolean visible) {
+
+ }
}