diff options
author | Jeff Brown <jeffbrown@google.com> | 2014-05-21 08:40:33 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-21 08:40:33 +0000 |
commit | fcc4fed3c16a57ef713a96b7298ed43aaeef2df4 (patch) | |
tree | 6c6307b9e734caed7bdeb3c983bba895fc2900f9 /services/core/java/com/android/server/power | |
parent | 1d265716954122f79d5fdd9d953a98e303d298c9 (diff) | |
parent | 6fb904bfd1f943547d6e5bc6f199ffec2290da01 (diff) | |
download | frameworks_base-fcc4fed3c16a57ef713a96b7298ed43aaeef2df4.zip frameworks_base-fcc4fed3c16a57ef713a96b7298ed43aaeef2df4.tar.gz frameworks_base-fcc4fed3c16a57ef713a96b7298ed43aaeef2df4.tar.bz2 |
am 6fb904bf: Merge "Make power button behavior configurable." into klp-modular-dev
* commit '6fb904bfd1f943547d6e5bc6f199ffec2290da01':
Make power button behavior configurable.
Diffstat (limited to 'services/core/java/com/android/server/power')
-rw-r--r-- | services/core/java/com/android/server/power/PowerManagerService.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java index 75ed204..90d33e7 100644 --- a/services/core/java/com/android/server/power/PowerManagerService.java +++ b/services/core/java/com/android/server/power/PowerManagerService.java @@ -898,9 +898,9 @@ public final class PowerManagerService extends com.android.server.SystemService return true; } - private void goToSleepInternal(long eventTime, int reason) { + private void goToSleepInternal(long eventTime, int reason, int flags) { synchronized (mLock) { - if (goToSleepNoUpdateLocked(eventTime, reason)) { + if (goToSleepNoUpdateLocked(eventTime, reason, flags)) { updatePowerStateLocked(); } } @@ -909,9 +909,10 @@ public final class PowerManagerService extends com.android.server.SystemService // This method is called goToSleep for historical reasons but we actually start // dozing before really going to sleep. @SuppressWarnings("deprecation") - private boolean goToSleepNoUpdateLocked(long eventTime, int reason) { + private boolean goToSleepNoUpdateLocked(long eventTime, int reason, int flags) { if (DEBUG_SPEW) { - Slog.d(TAG, "goToSleepNoUpdateLocked: eventTime=" + eventTime + ", reason=" + reason); + Slog.d(TAG, "goToSleepNoUpdateLocked: eventTime=" + eventTime + + ", reason=" + reason + ", flags=" + flags); } if (eventTime < mLastWakeTime @@ -954,6 +955,11 @@ public final class PowerManagerService extends com.android.server.SystemService } } EventLog.writeEvent(EventLogTags.POWER_SLEEP_REQUESTED, numWakeLocksCleared); + + // Skip dozing if requested. + if ((flags & PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE) != 0) { + reallyGoToSleepNoUpdateLocked(eventTime); + } return true; } @@ -1357,7 +1363,7 @@ public final class PowerManagerService extends com.android.server.SystemService changed = napNoUpdateLocked(time); } else { changed = goToSleepNoUpdateLocked(time, - PowerManager.GO_TO_SLEEP_REASON_TIMEOUT); + PowerManager.GO_TO_SLEEP_REASON_TIMEOUT, 0); } } } @@ -1504,7 +1510,7 @@ public final class PowerManagerService extends com.android.server.SystemService // Dream has ended or will be stopped. Update the power state. if (isItBedTimeYetLocked()) { goToSleepNoUpdateLocked(SystemClock.uptimeMillis(), - PowerManager.GO_TO_SLEEP_REASON_TIMEOUT); + PowerManager.GO_TO_SLEEP_REASON_TIMEOUT, 0); updatePowerStateLocked(); } else { wakeUpNoUpdateLocked(SystemClock.uptimeMillis()); @@ -2630,7 +2636,7 @@ public final class PowerManagerService extends com.android.server.SystemService } @Override // Binder call - public void goToSleep(long eventTime, int reason) { + public void goToSleep(long eventTime, int reason, int flags) { if (eventTime > SystemClock.uptimeMillis()) { throw new IllegalArgumentException("event time must not be in the future"); } @@ -2640,7 +2646,7 @@ public final class PowerManagerService extends com.android.server.SystemService final long ident = Binder.clearCallingIdentity(); try { - goToSleepInternal(eventTime, reason); + goToSleepInternal(eventTime, reason, flags); } finally { Binder.restoreCallingIdentity(ident); } |