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
diff --git a/service/AndroidManifest.xml b/service/AndroidManifest.xml
index 8d37772..fac0789 100644
--- a/service/AndroidManifest.xml
+++ b/service/AndroidManifest.xml
@@ -228,6 +228,12 @@
android:description="@string/car_permission_desc_audio_settings" />
<permission
+ android:name="android.car.permission.RECEIVE_CAR_AUDIO_DUCKING_EVENTS"
+ android:protectionLevel="system|signature"
+ android:label="@string/car_permission_label_receive_ducking"
+ android:description="@string/car_permission_desc_receive_ducking" />
+
+ <permission
android:name="android.car.permission.BIND_INSTRUMENT_CLUSTER_RENDERER_SERVICE"
android:protectionLevel="signature"
android:label="@string/car_permission_label_bind_instrument_cluster_rendering"