audio: Clarify "bus" device type am: 467b81d597

Original change: https://android-review.googlesource.com/c/platform/system/hardware/interfaces/+/2858105

Change-Id: I3ec51f4883999b3c7241f13488dbae900590ebf5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl b/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl
index ac89ffc..002914f 100644
--- a/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl
+++ b/media/aidl/android/media/audio/common/AudioDeviceDescription.aidl
@@ -68,6 +68,9 @@
      */
     const @utf8InCpp String CONNECTION_BT_SCO = "bt-sco";
     /**
+     * @deprecated Bus devices are attached, and must be represented using
+     *             `{IN|OUT}_BUS` type + empty connection.
+     *
      * Bus connection. Mostly used in automotive scenarios.
      */
     const @utf8InCpp String CONNECTION_BUS = "bus";
diff --git a/media/aidl/android/media/audio/common/AudioDeviceType.aidl b/media/aidl/android/media/audio/common/AudioDeviceType.aidl
index 43b32d6..5a75da7 100644
--- a/media/aidl/android/media/audio/common/AudioDeviceType.aidl
+++ b/media/aidl/android/media/audio/common/AudioDeviceType.aidl
@@ -100,6 +100,19 @@
      */
     IN_DOCK = 14,
     /**
+     * An alias for "bus" devices. Must have an empty connection type.
+     *
+     * Note: Since bus devices are non-removable, they need to be represented by
+     * a dedicated type with an empty connection type. However, there has been a
+     * historic accident of defining them as an `{IN|OUT}_DEVICE` type with
+     * `CONNECTION_BUS`. It was fixed by reserving the pair of `{IN|OUT}_DEVICE`
+     * type + empty connection for bus devices. This alias is added for clarity.
+     *
+     * Important: since `{IN|OUT}_BUS` is an alias, always check the connection
+     * type, it must be empty.
+     */
+    IN_BUS = IN_DEVICE,
+    /**
      * The "default" device is used when the client does not have any
      * preference for a particular device.
      */
@@ -173,4 +186,10 @@
      * Output to a broadcast group.
      */
     OUT_BROADCAST = 146,
+    /**
+     * An alias for "bus" devices. Must have an empty connection type.
+     *
+     * See the note on `IN_BUS` for details.
+     */
+    OUT_BUS = OUT_DEVICE,
 }
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl
index a17f46d..d1bcfed 100644
--- a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceDescription.aidl
@@ -41,6 +41,9 @@
   const @utf8InCpp String CONNECTION_BT_A2DP = "bt-a2dp";
   const @utf8InCpp String CONNECTION_BT_LE = "bt-le";
   const @utf8InCpp String CONNECTION_BT_SCO = "bt-sco";
+  /**
+   * @deprecated Bus devices are attached, and must be represented using `{IN|OUT}_BUS` type + empty connection. Bus connection. Mostly used in automotive scenarios.
+   */
   const @utf8InCpp String CONNECTION_BUS = "bus";
   const @utf8InCpp String CONNECTION_HDMI = "hdmi";
   const @utf8InCpp String CONNECTION_HDMI_ARC = "hdmi-arc";
diff --git a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl
index 2617dfa..f7d1b77 100644
--- a/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl
+++ b/media/aidl_api/android.media.audio.common.types/current/android/media/audio/common/AudioDeviceType.aidl
@@ -50,6 +50,7 @@
   IN_TELEPHONY_RX = 12,
   IN_TV_TUNER = 13,
   IN_DOCK = 14,
+  IN_BUS = IN_DEVICE /* 4 */,
   OUT_DEFAULT = 129,
   OUT_ACCESSORY = 130,
   OUT_AFE_PROXY = 131,
@@ -68,4 +69,5 @@
   OUT_TELEPHONY_TX = 144,
   OUT_DOCK = 145,
   OUT_BROADCAST = 146,
+  OUT_BUS = OUT_DEVICE /* 133 */,
 }