From 59f482764e346a5c5ac118ee1f7b24da645c2559 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 5 Apr 2012 19:42:21 -0700 Subject: [PATCH] Added support for USB audio devices Two types of USB audio devices are defined: - USB audio device: the audio device in USB device mode while the Android device is in USB host mode. - USB audio accessory: the audio device in USB host mode while the Android device is in USB device mode. Renamed intents for analog and digital docks to avoid confusion: - ACTION_USB_ANLG_HEADSET_PLUG to ACTION_ANALOG_AUDIO_DOCK_PLUG - ACTION_USB_DGTL_HEADSET_PLUG to ACTION_DIGITAL_AUDIO_DOCK_PLUG Factorized code in AudioService broadcast receiver. Change-Id: I1b6d0257a9d68ecb9495c78c98bac8c67fec7891 --- core/java/android/content/Intent.java | 40 ++-- media/java/android/media/AudioManager.java | 8 + media/java/android/media/AudioService.java | 189 +++++++----------- media/java/android/media/AudioSystem.java | 11 + .../server/WiredAccessoryObserver.java | 4 +- 5 files changed, 112 insertions(+), 140 deletions(-) diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 736dd2411e341..18d682dd588ef 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -2000,8 +2000,8 @@ public class Intent implements Parcelable, Cloneable { * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_USB_ANLG_HEADSET_PLUG = - "android.intent.action.USB_ANLG_HEADSET_PLUG"; + public static final String ACTION_ANALOG_AUDIO_DOCK_PLUG = + "android.intent.action.ANALOG_AUDIO_DOCK_PLUG"; /** * Broadcast Action: A digital audio speaker/headset plugged in or unplugged. @@ -2015,8 +2015,8 @@ public class Intent implements Parcelable, Cloneable { * @hide */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_USB_DGTL_HEADSET_PLUG = - "android.intent.action.USB_DGTL_HEADSET_PLUG"; + public static final String ACTION_DIGITAL_AUDIO_DOCK_PLUG = + "android.intent.action.DIGITAL_AUDIO_DOCK_PLUG"; /** * Broadcast Action: A HMDI cable was plugged or unplugged @@ -2033,22 +2033,6 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_HDMI_AUDIO_PLUG = "android.intent.action.HDMI_AUDIO_PLUG"; - /** - * Broadcast Action: A USB audio device was plugged in or unplugged. - * - *

The intent will have the following extra values: - *

- * - * @hide - */ - @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) - public static final String ACTION_USB_AUDIO_DEVICE_PLUG = - "android.intent.action.USB_AUDIO_DEVICE_PLUG"; - /** * Broadcast Action: A USB audio accessory was plugged in or unplugged. * @@ -2065,6 +2049,22 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_USB_AUDIO_ACCESSORY_PLUG = "android.intent.action.USB_AUDIO_ACCESSORY_PLUG"; + /** + * Broadcast Action: A USB audio device was plugged in or unplugged. + * + *

The intent will have the following extra values: + *

+ * + * @hide + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_USB_AUDIO_DEVICE_PLUG = + "android.intent.action.USB_AUDIO_DEVICE_PLUG"; + /** *

Broadcast Action: The user has switched on advanced settings in the settings app:

*