summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-04-30 14:58:40 -0700
committerJeff Brown <jeffbrown@google.com>2012-04-30 15:48:42 -0700
commitc458ce98ce42c00b98afe00670f822814f3da572 (patch)
treec993b6f8b3361f2ee1116f76709427e6106bd875 /services
parent3ea8761974a530218a246dc73583c8820b12bf0b (diff)
downloadframeworks_base-c458ce98ce42c00b98afe00670f822814f3da572.zip
frameworks_base-c458ce98ce42c00b98afe00670f822814f3da572.tar.gz
frameworks_base-c458ce98ce42c00b98afe00670f822814f3da572.tar.bz2
Add support for using the lid switch to turn off the screen.
Added a config option to allow the lid switch to turn off the screen. This is a closer match to what a lid switch should be doing. Removed an old feature to bypass keyguard when keyboard is visible because the way it was plumbed in made bad assumptions about the meaning of the lid switch. Also, the last product we shipped that had a physical keyboard turned this config option off. So away it goes. We can bring it back someday if we really want it. It's questionable how useful the feature is anyhow, since it only works when the keyguard is unsecure and when the lid switch is unlikely to be jostled in the user's pocket. Fixed a bug where we would tell the power manager that the keyboard was visible even if the lid switch did not control the keyboard. This used to cause the power manager to try to set the keyboard brightness, which doesn't work. Bug: 6377115 Bug: 6406726 Change-Id: Ic84b71d09563d51c92cd1cf132fa8bdee6509103
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PowerManagerService.java3
-rw-r--r--services/java/com/android/server/input/InputManagerService.java9
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java7
3 files changed, 14 insertions, 5 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 9a371c6..bd50e22 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2521,7 +2521,8 @@ public class PowerManagerService extends IPowerManager.Stub
return val;
} catch (Exception e) {
// guard against null pointer or index out of bounds errors
- Slog.e(TAG, "getAutoBrightnessValue", e);
+ Slog.e(TAG, "Values array must be non-empty and must be the same length "
+ + "as the auto-brightness levels array. Check config.xml.", e);
return 255;
}
}
diff --git a/services/java/com/android/server/input/InputManagerService.java b/services/java/com/android/server/input/InputManagerService.java
index 189a9c7..aece7d2 100644
--- a/services/java/com/android/server/input/InputManagerService.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -199,6 +199,15 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
/** The key is down but is a virtual key press that is being emulated by the system. */
public static final int KEY_STATE_VIRTUAL = 2;
+ /** Scan code: Mouse / trackball button. */
+ public static final int BTN_MOUSE = 0x110;
+
+ /** Switch code: Lid switch. When set, lid is shut. */
+ public static final int SW_LID = 0x00;
+
+ /** Switch code: Keypad slide. When set, keyboard is exposed. */
+ public static final int SW_KEYPAD_SLIDE = 0x0a;
+
public InputManagerService(Context context, Callbacks callbacks) {
this.mContext = context;
this.mCallbacks = callbacks;
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 1dce5dd..ae1cc7f 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -4963,8 +4963,8 @@ public class WindowManagerService extends IWindowManager.Stub
// Called by window manager policy. Not exposed externally.
@Override
public int getLidState() {
- final int SW_LID = 0x00;
- int sw = mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_LID);
+ int sw = mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY,
+ InputManagerService.SW_LID);
if (sw > 0) {
// Switch state: AKEY_STATE_DOWN or AKEY_STATE_VIRTUAL.
return LID_CLOSED;
@@ -6510,14 +6510,13 @@ public class WindowManagerService extends IWindowManager.Stub
+ " milliseconds before attempting to detect safe mode.");
}
- final int BTN_MOUSE = 0x110;
int menuState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY,
KeyEvent.KEYCODE_MENU);
int sState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY, KeyEvent.KEYCODE_S);
int dpadState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_DPAD,
KeyEvent.KEYCODE_DPAD_CENTER);
int trackballState = mInputManager.getScanCodeState(-1, InputDevice.SOURCE_TRACKBALL,
- BTN_MOUSE);
+ InputManagerService.BTN_MOUSE);
int volumeDownState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY,
KeyEvent.KEYCODE_VOLUME_DOWN);
mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0