Merge "Fix inattentive sleep reason"
This commit is contained in:
committed by
Android (Google) Code Review
commit
d7a973fc05
@@ -2861,7 +2861,7 @@ public final class PowerManagerService extends SystemService
|
||||
Slog.i(TAG, "Going to sleep now due to long user inactivity");
|
||||
}
|
||||
changed = sleepDisplayGroupNoUpdateLocked(id, time,
|
||||
PowerManager.GO_TO_SLEEP_REASON_TIMEOUT,
|
||||
PowerManager.GO_TO_SLEEP_REASON_INATTENTIVE,
|
||||
PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE, Process.SYSTEM_UID);
|
||||
} else if (shouldNapAtBedTimeLocked()) {
|
||||
changed = dreamDisplayGroupNoUpdateLocked(id, time, Process.SYSTEM_UID);
|
||||
|
||||
@@ -866,6 +866,8 @@ public class PowerManagerServiceTest {
|
||||
startSystem();
|
||||
advanceTime(20);
|
||||
assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
|
||||
assertThat(mService.getBinderServiceInstance().getLastSleepReason()).isEqualTo(
|
||||
PowerManager.GO_TO_SLEEP_REASON_INATTENTIVE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -886,6 +888,8 @@ public class PowerManagerServiceTest {
|
||||
assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_AWAKE);
|
||||
advanceTime(60);
|
||||
assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
|
||||
assertThat(mService.getBinderServiceInstance().getLastSleepReason()).isEqualTo(
|
||||
PowerManager.GO_TO_SLEEP_REASON_INATTENTIVE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -913,6 +917,8 @@ public class PowerManagerServiceTest {
|
||||
|
||||
advanceTime(520);
|
||||
assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
|
||||
assertThat(mService.getBinderServiceInstance().getLastSleepReason()).isEqualTo(
|
||||
PowerManager.GO_TO_SLEEP_REASON_INATTENTIVE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -934,6 +940,8 @@ public class PowerManagerServiceTest {
|
||||
|
||||
advanceTime(520);
|
||||
assertThat(mService.getWakefulnessLocked()).isEqualTo(WAKEFULNESS_ASLEEP);
|
||||
assertThat(mService.getBinderServiceInstance().getLastSleepReason()).isEqualTo(
|
||||
PowerManager.GO_TO_SLEEP_REASON_INATTENTIVE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user