System Perf Hints in PiP
Use system perf hints during PiP
interactions to avoid animations at low refresh rates.
The latest patchset introduces a new wrapper around
HighPerfSession to make session management safer and easier
for PiP component.
Namely, we introduce the following two helper classes:
- PipPerfHintController:
A wrapper around SystemPerfHintController to start sessions
with an interface allowing registering optional timeouts with
timeout callbacks.
This should act as a safeguard, especially for complex interactions.
For now this safeguard is only used for logging as a preventative
measure against introducing any regressions to avoid
"high performance hint starvation".
- PipPerfHintController.PipHighPerfSession:
A wrapper around HighPerfSession that helps keep track of
active sessions present.
PipHighPerfSession also makes sure necessary updates are made
to cleanup if the session is either closed directly or
if it is garbage collected.
For example, if the session client loses all strong references
to the session returned by PipPerfHintController#startSession(),
the GC reclaims the memory, and we close the session internally.
Moreover, an internal WeakHashMap is updated to avoid calling
timeout callback if one was registered
(these callbacks pass in a reference to the session,
in case a client uses multiple).
As a side note, manual testing has shown so far that all PiP transition
animations are by default at maximum refresh rate of 120Hz; hence, this CL only
addresses non-Transitions related PiP CUJs, like double taps,
pinch-to-resize, drags, stashes and unstashes.
Bug: 304564014
Test: manually testing CUJs listed above
Change-Id: I5da7f4dad0d2934be4c44ea37e8027ad83506894
14 files changed