PowerManager: Don't poke user activity in setKeyboardVisibility unless the state actually changed.
Fixes bug b/2158297 (lock screen should time out after 7 seconds)
Change-Id: Ia3f7ef6464129ab78283923dbfd7f7472136e676
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 29a5ba8..b0c5950 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2007,12 +2007,14 @@
if (mSpew) {
Log.d(TAG, "setKeyboardVisibility: " + visible);
}
- mKeyboardVisible = visible;
- // don't signal user activity if the screen is off; other code
- // will take care of turning on due to a true change to the lid
- // switch and synchronized with the lock screen.
- if ((mPowerState & SCREEN_ON_BIT) != 0) {
- userActivity(SystemClock.uptimeMillis(), false, BUTTON_EVENT, true);
+ if (mKeyboardVisible != visible) {
+ mKeyboardVisible = visible;
+ // don't signal user activity if the screen is off; other code
+ // will take care of turning on due to a true change to the lid
+ // switch and synchronized with the lock screen.
+ if ((mPowerState & SCREEN_ON_BIT) != 0) {
+ userActivity(SystemClock.uptimeMillis(), false, BUTTON_EVENT, true);
+ }
}
}
}