Audio focus: fix focus loss notification for older SDKs
The feature of ducking enforced by the framework is gated by the
SDK version of the focus owner. The check was performed by
asking the SDK target level of the players to duck.
But if there were no players in the STARTED state at
the time, the check didn't report that the ducking
shouldn't be performed by the framework, and thus the
focus loss wasn't reported to the application.
The fix consists in moving the SDK check at the focus owner
level, so the check can happen regardless of whether there
are active players or not.
Add more informative logs where piids are logged (uid+pid).
In the FocusRequester class, initialize mFocusLossWasNotified
to true for the focus gain path, and don't set it to false
after gaining focus, it is properly updated instead in
the focus loss code path.
Test: launch Audible, play then pause, play a notification, verify in the logs Audible is notified of the focus loss
Bug: 37987086
Change-Id: I7c44d824b2563e71cf288ae1f256d001662a6a59
2 files changed