CarAudioFocus: Send LOSS_TRANSIENT_CAN_DUCK to certain clients.

Some audio focus clients may need to be notified when another app starts
playing audio, so they can do actions beyond the normal pausing or
ducking that would be handled directly by the platform and audio HAL.
For example, projection clients may need those callbacks in order to
notify the projecting phone to pause or duck playback on the phone side.

This change introduces a signature|system permission named
RECEIVE_CAR_AUDIO_DUCKING_EVENTS, as well as an extra named
AUDIOFOCUS_EXTRA_RECEIVE_DUCKING_EVENTS that can be attached to the
AudioAttributes of an AudioFocusRequest. For requests with that extra,
coming from clients that hold that permission, the car audio focus
engine sends LOSS_TRANSIENT_CAN_DUCK when another app requests
AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK, instead of the full LOSS_TRANSIENT
(or, for apps that don't set the PAUSES_ON_DUCKABLE_LOSS flag, no AF
loss at all) that those clients would otherwise receive.

Bug: 129165914
Test: Manual tests with projection app and KitchenSink
Change-Id: Icab92f5fc22dba26c6b331478addc4ebb57a90a2
7 files changed