Keep track of the last sleep reason

This is needed to implement Doze for Android TV. The DeviceIdleController needs to know whether the screen turned off due to a timeout and adjust its own timeouts accordingly. This is particularly important if the screen off timeout is longer than 30 minutes which is how long the DeviceIdleController normally waits before going from STATE_INACTIVE to STATE_IDLE_PENDING.

Test: make -j
Bug: 111443261
Change-Id: Icd6a7ba43077fed3ac6ac9f77b5a017c42138337
3 files changed