diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-06-26 14:34:54 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-06-26 14:44:08 -0700 |
commit | ea401541c51422ba76f8319927cca0f303c57a4e (patch) | |
tree | 4d29da07d4882eb124b9f74a2d3e5f8a6f29d5f2 | |
parent | 9e608c12186d308fb1711e8824901fdf931a3a96 (diff) | |
download | frameworks_base-ea401541c51422ba76f8319927cca0f303c57a4e.zip frameworks_base-ea401541c51422ba76f8319927cca0f303c57a4e.tar.gz frameworks_base-ea401541c51422ba76f8319927cca0f303c57a4e.tar.bz2 |
Fix issue #6730064: When turning off Nakasi, it very often...
...turns itself immediately back on.
The ON_AFTER_RELEASE flag is documented to not turn the screen on if
it is currently off.
Unfortunately, it didn't seem to actually do this -- it would just
cause a userActivity() call, which turns on the screen if it is
currently off.
Fix this by adding yet another boolean to that function to tell it
to not poke user activity if the screen is off. (Yes the number of
booleans on it is now insane, and should be cleaned up after we
get through JB.)
Bug: 6730064
Change-Id: I850dfbc777c7668d08b7d63f42a293e22b878256
-rw-r--r-- | services/java/com/android/server/PowerManagerService.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 01bb2bc..c32f1da 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1040,7 +1040,7 @@ public class PowerManagerService extends IPowerManager.Stub mWakeLockState = mLocks.gatherState(); // goes in the middle to reduce flicker if ((wl.flags & PowerManager.ON_AFTER_RELEASE) != 0) { - userActivity(SystemClock.uptimeMillis(), -1, false, OTHER_EVENT, false); + userActivity(SystemClock.uptimeMillis(), -1, false, OTHER_EVENT, false, true); } setPowerState(mWakeLockState | mUserState); } @@ -2489,7 +2489,7 @@ public class PowerManagerService extends IPowerManager.Stub public void userActivityWithForce(long time, boolean noChangeLights, boolean force) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null); - userActivity(time, -1, noChangeLights, OTHER_EVENT, force); + userActivity(time, -1, noChangeLights, OTHER_EVENT, force, false); } public void userActivity(long time, boolean noChangeLights) { @@ -2502,15 +2502,15 @@ public class PowerManagerService extends IPowerManager.Stub return; } - userActivity(time, -1, noChangeLights, OTHER_EVENT, false); + userActivity(time, -1, noChangeLights, OTHER_EVENT, false, false); } public void userActivity(long time, boolean noChangeLights, int eventType) { - userActivity(time, -1, noChangeLights, eventType, false); + userActivity(time, -1, noChangeLights, eventType, false, false); } public void userActivity(long time, boolean noChangeLights, int eventType, boolean force) { - userActivity(time, -1, noChangeLights, eventType, force); + userActivity(time, -1, noChangeLights, eventType, force, false); } /* @@ -2520,11 +2520,11 @@ public class PowerManagerService extends IPowerManager.Stub public void clearUserActivityTimeout(long now, long timeout) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null); Slog.i(TAG, "clearUserActivity for " + timeout + "ms from now"); - userActivity(now, timeout, false, OTHER_EVENT, false); + userActivity(now, timeout, false, OTHER_EVENT, false, false); } private void userActivity(long time, long timeoutOverride, boolean noChangeLights, - int eventType, boolean force) { + int eventType, boolean force, boolean ignoreIfScreenOff) { if (((mPokey & POKE_LOCK_IGNORE_TOUCH_EVENTS) != 0) && (eventType == TOUCH_EVENT)) { if (false) { @@ -2548,6 +2548,11 @@ public class PowerManagerService extends IPowerManager.Stub Slog.d(TAG, "ignoring user activity while turning off screen"); return; } + // ignore if the caller doesn't want this to allow the screen to turn + // on, and the screen is currently off. + if (ignoreIfScreenOff && (mPowerState & SCREEN_ON_BIT) == 0) { + return; + } // Disable proximity sensor if if user presses power key while we are in the // "waiting for proximity sensor to go negative" state. if (mProximitySensorActive && mProximityWakeLockCount == 0) { |