deep sleep cleanup
- keep holding partial wakelock while in sleep
- add goToSleep call which is supposed to enter sleep
regardless of wakelock
Change-Id: I042664387a9c81f87684a7739277d4bf7d86594e
diff --git a/service/src/com/android/car/CarPowerManagementService.java b/service/src/com/android/car/CarPowerManagementService.java
index c6d0191..1563dee 100644
--- a/service/src/com/android/car/CarPowerManagementService.java
+++ b/service/src/com/android/car/CarPowerManagementService.java
@@ -403,6 +403,9 @@
}
private void doHandleDeepSleep() {
+ // keep holding partial wakelock to prevent entering sleep before enterDeepSleep call
+ // enterDeepSleep should force sleep entry even if wake lock is kept.
+ mSystemInterface.switchToPartialWakeLock();
mHandler.cancelProcessingComplete();
for (PowerServiceEventListener listener : mListeners) {
listener.onSleepEntry();
@@ -415,8 +418,6 @@
if (!shouldDoFakeShutdown()) { // if it is mocked, do not enter sleep.
mSystemInterface.enterDeepSleep(wakeupTimeSec);
}
- mSystemInterface.releaseAllWakeLocks();
- mSystemInterface.switchToPartialWakeLock();
mHal.sendSleepExit();
for (PowerServiceEventListener listener : mListeners) {
listener.onSleepExit();
@@ -671,7 +672,10 @@
@Override
public void enterDeepSleep(int wakeupTimeSec) {
- //TODO
+ //TODO set wake up time
+ mPowerManager.goToSleep(SystemClock.uptimeMillis(),
+ PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN,
+ PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE);
}
@Override