Add WakeLock.setStateListener() API.
WakeLock uses this API to add listener of type WakelockStateListener,
whenever framework enable/disable this wake lock, the onStateChanged()
callback on this listener is called.
This API can be called before or afte acquiring the wakelock. It can be
called multiple times to change to another listener.
Add test cases testNotifyWakeLockCallback() and
testNotifyWakeLockCallbackChange() in PowerManagerServiceTest.java.
Bug: 213925462
Test: atest cts/tests/tests/os/src/android/os/cts/PowerManager_WakeLockTest.java.
Change-Id: Ic59303c59e53eb974e2765e3036002ac97ce8aa5
9 files changed