Ensure AlarmManager is brought out of device idle.
In certain cases, DeviceIdleController would come out of STATE_IDLE but
not properly tell AlarmManager (by removing the IDLE_UNTIL alarm). This
meant that alarms wouldn't go off even though the user may be using the
device.
Manual testing steps:
1. Turn on WAIT_FOR_UNLOCK ('adb shell settings put global device_idle_constants "wait_for_unlock=true"')
2. Enable screen lock
3. Unplug device ('adb shell dumpsys battery unplug')
3. Turn screen off
4. Enter IDLE state (repeat 'adb shell dumpsys deviceidle step' until IDLE)
5. Turn screen on
6. Shake device (or run 'adb shell dumpsys deviceidle motion')
7. Check dumpsys output:
- 'adb shell dumpsys deviceidle get deep' should say "INACTIVE"
- 'adb shell dumpsys alarm' should not have "Idle state mode" in the output
Bug: 118321869
Test: atest com.android.server.DeviceIdleControllerTest
Change-Id: Ie41b5a4bd9f2b386fe709108c39a443bd40fd573
4 files changed