Per-display group PowerManager APIs by default
- Make PowerManager#isInteractive return the interactivity of the
power group for the context's display instead of the global state.
Apps can query the interactivity of any power group by getting a
PowerManager instance with createDisplayContext
- Make PowerManager#newWakeLock by default per power group. Wake locks
for all groups can still be created by passing INVALID_DISPLAY to
the hidden newWakeLock override that takes a displayId. Apps can
still create wake locks for any display via createDisplayContext
- Make PowerManager#isWakeLockLevelSupported display aware. Proximity
locks shouldn't be supported on displays without an associated
proximity sensor.
Context#getDisplayId() will return the associated displayId for
activities and the displayId of the top activity if this is a non-UI
context. DEFAULT_DISPLAY if no such activity.
The interactivity cache needs to be update whenever any group's
wakefulness changes, not only the global one.
Fix: 365042486
Bug: 237547400
Test: presubmit
Flag: android.companion.virtualdevice.flags.device_aware_display_power
Change-Id: If6974774c6423623a0871e01b344d0696ef75eb1
7 files changed