diff options
author | Eric Laurent <elaurent@google.com> | 2014-05-20 21:39:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-20 21:39:23 +0000 |
commit | c0e439f1b7dcd937b6cc842eafc7a4e7c8abce9b (patch) | |
tree | d0d3c8974f1c30d3d49c1bc660050244771a80d4 /media | |
parent | 53dd1f7ffce9165889a7e0a42e58172c7e7d4dab (diff) | |
parent | 948d32748caaac5be06c991ebf00f74265a7849f (diff) | |
download | frameworks_base-c0e439f1b7dcd937b6cc842eafc7a4e7c8abce9b.zip frameworks_base-c0e439f1b7dcd937b6cc842eafc7a4e7c8abce9b.tar.gz frameworks_base-c0e439f1b7dcd937b6cc842eafc7a4e7c8abce9b.tar.bz2 |
Merge "AudioSystem: add new audio device definitions"
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioManager.java | 175 | ||||
-rw-r--r-- | media/java/android/media/AudioService.java | 8 | ||||
-rw-r--r-- | media/java/android/media/AudioSystem.java | 51 |
3 files changed, 206 insertions, 28 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 3a3f76d..575667d 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -2557,60 +2557,191 @@ public class AudioManager { // class is not used by other parts of the framework, which instead use definitions and methods // from AudioManager. AudioSystem is an internal class used by AudioManager and AudioService. - /** {@hide} The audio output device code for the small speaker at the front of the device used + /** @hide + * The audio output device code for the small speaker at the front of the device used * when placing calls. Does not refer to an in-ear headphone without attached microphone, * such as earbuds, earphones, or in-ear monitors (IEM). Those would be handled as a * {@link #DEVICE_OUT_WIRED_HEADPHONE}. */ public static final int DEVICE_OUT_EARPIECE = AudioSystem.DEVICE_OUT_EARPIECE; - /** {@hide} The audio output device code for the built-in speaker */ + /** @hide + * The audio output device code for the built-in speaker */ public static final int DEVICE_OUT_SPEAKER = AudioSystem.DEVICE_OUT_SPEAKER; - /** {@hide} The audio output device code for a wired headset with attached microphone */ + /** @hide + * The audio output device code for a wired headset with attached microphone */ public static final int DEVICE_OUT_WIRED_HEADSET = AudioSystem.DEVICE_OUT_WIRED_HEADSET; - /** {@hide} The audio output device code for a wired headphone without attached microphone */ + /** @hide + * The audio output device code for a wired headphone without attached microphone */ public static final int DEVICE_OUT_WIRED_HEADPHONE = AudioSystem.DEVICE_OUT_WIRED_HEADPHONE; - /** {@hide} The audio output device code for generic Bluetooth SCO, for voice */ + /** @hide + * The audio output device code for generic Bluetooth SCO, for voice */ public static final int DEVICE_OUT_BLUETOOTH_SCO = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO; - /** {@hide} The audio output device code for Bluetooth SCO Headset Profile (HSP) and - * Hands-Free Profile (HFP), for voice + /** @hide + * The audio output device code for Bluetooth SCO Headset Profile (HSP) and + * Hands-Free Profile (HFP), for voice */ public static final int DEVICE_OUT_BLUETOOTH_SCO_HEADSET = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_HEADSET; - /** {@hide} The audio output device code for Bluetooth SCO car audio, for voice */ + /** @hide + * The audio output device code for Bluetooth SCO car audio, for voice */ public static final int DEVICE_OUT_BLUETOOTH_SCO_CARKIT = AudioSystem.DEVICE_OUT_BLUETOOTH_SCO_CARKIT; - /** {@hide} The audio output device code for generic Bluetooth A2DP, for music */ + /** @hide + * The audio output device code for generic Bluetooth A2DP, for music */ public static final int DEVICE_OUT_BLUETOOTH_A2DP = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP; - /** {@hide} The audio output device code for Bluetooth A2DP headphones, for music */ + /** @hide + * The audio output device code for Bluetooth A2DP headphones, for music */ public static final int DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES; - /** {@hide} The audio output device code for Bluetooth A2DP external speaker, for music */ + /** @hide + * The audio output device code for Bluetooth A2DP external speaker, for music */ public static final int DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER; - /** {@hide} The audio output device code for S/PDIF or HDMI */ + /** @hide + * The audio output device code for S/PDIF (legacy) or HDMI + * Deprecated: replaced by {@link #DEVICE_OUT_HDMI} */ public static final int DEVICE_OUT_AUX_DIGITAL = AudioSystem.DEVICE_OUT_AUX_DIGITAL; - /** {@hide} The audio output device code for an analog wired headset attached via a + /** @hide + * The audio output device code for HDMI */ + public static final int DEVICE_OUT_HDMI = AudioSystem.DEVICE_OUT_HDMI; + /** @hide + * The audio output device code for an analog wired headset attached via a * docking station */ public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET; - /** {@hide} The audio output device code for a digital wired headset attached via a + /** @hide + * The audio output device code for a digital wired headset attached via a * docking station */ public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET; - /** {@hide} The audio output device code for a USB audio accessory. The accessory is in USB host + /** @hide + * The audio output device code for a USB audio accessory. The accessory is in USB host * mode and the Android device in USB device mode */ public static final int DEVICE_OUT_USB_ACCESSORY = AudioSystem.DEVICE_OUT_USB_ACCESSORY; - /** {@hide} The audio output device code for a USB audio device. The device is in USB device + /** @hide + * The audio output device code for a USB audio device. The device is in USB device * mode and the Android device in USB host mode */ public static final int DEVICE_OUT_USB_DEVICE = AudioSystem.DEVICE_OUT_USB_DEVICE; - /** {@hide} This is not used as a returned value from {@link #getDevicesForStream}, but could be + /** @hide + * The audio output device code for projection output. + */ + public static final int DEVICE_OUT_REMOTE_SUBMIX = AudioSystem.DEVICE_OUT_REMOTE_SUBMIX; + /** @hide + * The audio output device code the telephony voice TX path. + */ + public static final int DEVICE_OUT_TELEPHONY_TX = AudioSystem.DEVICE_OUT_TELEPHONY_TX; + /** @hide + * The audio output device code for an analog jack with line impedance detected. + */ + public static final int DEVICE_OUT_LINE = AudioSystem.DEVICE_OUT_LINE; + /** @hide + * The audio output device code for HDMI Audio Return Channel. + */ + public static final int DEVICE_OUT_HDMI_ARC = AudioSystem.DEVICE_OUT_HDMI_ARC; + /** @hide + * The audio output device code for S/PDIF digital connection. + */ + public static final int DEVICE_OUT_SPDIF = AudioSystem.DEVICE_OUT_SPDIF; + /** @hide + * The audio output device code for built-in FM transmitter. + */ + public static final int DEVICE_OUT_FM = AudioSystem.DEVICE_OUT_FM; + /** @hide + * This is not used as a returned value from {@link #getDevicesForStream}, but could be * used in the future in a set method to select whatever default device is chosen by the * platform-specific implementation. */ public static final int DEVICE_OUT_DEFAULT = AudioSystem.DEVICE_OUT_DEFAULT; + /** @hide + * The audio input device code for default built-in microphone + */ + public static final int DEVICE_IN_BUILTIN_MIC = AudioSystem.DEVICE_IN_BUILTIN_MIC; + /** @hide + * The audio input device code for a Bluetooth SCO headset + */ + public static final int DEVICE_IN_BLUETOOTH_SCO_HEADSET = + AudioSystem.DEVICE_IN_BLUETOOTH_SCO_HEADSET; + /** @hide + * The audio input device code for wired headset microphone + */ + public static final int DEVICE_IN_WIRED_HEADSET = + AudioSystem.DEVICE_IN_WIRED_HEADSET; + /** @hide + * The audio input device code for HDMI + */ + public static final int DEVICE_IN_HDMI = + AudioSystem.DEVICE_IN_HDMI; + /** @hide + * The audio input device code for telephony voice RX path + */ + public static final int DEVICE_IN_TELEPHONY_RX = + AudioSystem.DEVICE_IN_TELEPHONY_RX; + /** @hide + * The audio input device code for built-in microphone pointing to the back + */ + public static final int DEVICE_IN_BACK_MIC = + AudioSystem.DEVICE_IN_BACK_MIC; + /** @hide + * The audio input device code for analog from a docking station + */ + public static final int DEVICE_IN_ANLG_DOCK_HEADSET = + AudioSystem.DEVICE_IN_ANLG_DOCK_HEADSET; + /** @hide + * The audio input device code for digital from a docking station + */ + public static final int DEVICE_IN_DGTL_DOCK_HEADSET = + AudioSystem.DEVICE_IN_DGTL_DOCK_HEADSET; + /** @hide + * The audio input device code for a USB audio accessory. The accessory is in USB host + * mode and the Android device in USB device mode + */ + public static final int DEVICE_IN_USB_ACCESSORY = + AudioSystem.DEVICE_IN_USB_ACCESSORY; + /** @hide + * The audio input device code for a USB audio device. The device is in USB device + * mode and the Android device in USB host mode + */ + public static final int DEVICE_IN_USB_DEVICE = + AudioSystem.DEVICE_IN_USB_DEVICE; + /** @hide + * The audio input device code for a FM radio tuner + */ + public static final int DEVICE_IN_FM_TUNER = AudioSystem.DEVICE_IN_FM_TUNER; + /** @hide + * The audio input device code for a TV tuner + */ + public static final int DEVICE_IN_TV_TUNER = AudioSystem.DEVICE_IN_TV_TUNER; + /** @hide + * The audio input device code for an analog jack with line impedance detected + */ + public static final int DEVICE_IN_LINE = AudioSystem.DEVICE_IN_LINE; + /** @hide + * The audio input device code for a S/PDIF digital connection + */ + public static final int DEVICE_IN_SPDIF = AudioSystem.DEVICE_IN_SPDIF; + + /** + * Return true if the device code corresponds to an output device. + * @hide + */ + public static boolean isOutputDevice(int device) + { + return (device & AudioSystem.DEVICE_BIT_IN) == 0; + } + + /** + * Return true if the device code corresponds to an input device. + * @hide + */ + public static boolean isInputDevice(int device) + { + return (device & AudioSystem.DEVICE_BIT_IN) == AudioSystem.DEVICE_BIT_IN; + } + + /** * Return the enabled devices for the specified output stream type. * @@ -2635,9 +2766,17 @@ public class AudioManager { * {@link #DEVICE_OUT_BLUETOOTH_A2DP}, * {@link #DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES}, * {@link #DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER}, - * {@link #DEVICE_OUT_AUX_DIGITAL}, + * {@link #DEVICE_OUT_HDMI}, * {@link #DEVICE_OUT_ANLG_DOCK_HEADSET}, * {@link #DEVICE_OUT_DGTL_DOCK_HEADSET}. + * {@link #DEVICE_OUT_USB_ACCESSORY}. + * {@link #DEVICE_OUT_USB_DEVICE}. + * {@link #DEVICE_OUT_REMOTE_SUBMIX}. + * {@link #DEVICE_OUT_TELEPHONY_TX}. + * {@link #DEVICE_OUT_LINE}. + * {@link #DEVICE_OUT_HDMI_ARC}. + * {@link #DEVICE_OUT_SPDIF}. + * {@link #DEVICE_OUT_FM}. * {@link #DEVICE_OUT_DEFAULT} is not used here. * * The implementation may support additional device codes beyond those listed, so diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index bb8cfa6..6e623a5 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -423,7 +423,7 @@ public class AudioService extends IAudioService.Stub { public final static int STREAM_REMOTE_MUSIC = -200; // Devices for which the volume is fixed and VolumePanel slider should be disabled - final int mFixedVolumeDevices = AudioSystem.DEVICE_OUT_AUX_DIGITAL | + final int mFixedVolumeDevices = AudioSystem.DEVICE_OUT_HDMI | AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET | AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET | AudioSystem.DEVICE_OUT_ALL_USB; @@ -2895,7 +2895,7 @@ public class AudioService extends IAudioService.Stub { public String getSettingNameForDevice(int device) { String name = mVolumeIndexSettingName; - String suffix = AudioSystem.getDeviceName(device); + String suffix = AudioSystem.getOutputDeviceName(device); if (suffix.isEmpty()) { return name; } @@ -3935,7 +3935,7 @@ public class AudioService extends IAudioService.Stub { // sent if none of these devices is connected. int mBecomingNoisyIntentDevices = AudioSystem.DEVICE_OUT_WIRED_HEADSET | AudioSystem.DEVICE_OUT_WIRED_HEADPHONE | - AudioSystem.DEVICE_OUT_ALL_A2DP | AudioSystem.DEVICE_OUT_AUX_DIGITAL | + AudioSystem.DEVICE_OUT_ALL_A2DP | AudioSystem.DEVICE_OUT_HDMI | AudioSystem.DEVICE_OUT_ANLG_DOCK_HEADSET | AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET | AudioSystem.DEVICE_OUT_ALL_USB; @@ -3992,7 +3992,7 @@ public class AudioService extends IAudioService.Stub { } else if (device == AudioSystem.DEVICE_OUT_DGTL_DOCK_HEADSET) { connType = AudioRoutesInfo.MAIN_DOCK_SPEAKERS; intent.setAction(Intent.ACTION_DIGITAL_AUDIO_DOCK_PLUG); - } else if (device == AudioSystem.DEVICE_OUT_AUX_DIGITAL) { + } else if (device == AudioSystem.DEVICE_OUT_HDMI) { connType = AudioRoutesInfo.MAIN_HDMI; intent.setAction(Intent.ACTION_HDMI_AUDIO_PLUG); } diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java index 5ddb198..0c45443 100644 --- a/media/java/android/media/AudioSystem.java +++ b/media/java/android/media/AudioSystem.java @@ -234,11 +234,17 @@ public class AudioSystem public static final int DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100; public static final int DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200; public static final int DEVICE_OUT_AUX_DIGITAL = 0x400; + public static final int DEVICE_OUT_HDMI = DEVICE_OUT_AUX_DIGITAL; public static final int DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800; public static final int DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000; public static final int DEVICE_OUT_USB_ACCESSORY = 0x2000; public static final int DEVICE_OUT_USB_DEVICE = 0x4000; public static final int DEVICE_OUT_REMOTE_SUBMIX = 0x8000; + public static final int DEVICE_OUT_TELEPHONY_TX = 0x10000; + public static final int DEVICE_OUT_LINE = 0x20000; + public static final int DEVICE_OUT_HDMI_ARC = 0x40000; + public static final int DEVICE_OUT_SPDIF = 0x80000; + public static final int DEVICE_OUT_FM = 0x100000; public static final int DEVICE_OUT_DEFAULT = DEVICE_BIT_DEFAULT; @@ -252,12 +258,17 @@ public class AudioSystem DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | - DEVICE_OUT_AUX_DIGITAL | + DEVICE_OUT_HDMI | DEVICE_OUT_ANLG_DOCK_HEADSET | DEVICE_OUT_DGTL_DOCK_HEADSET | DEVICE_OUT_USB_ACCESSORY | DEVICE_OUT_USB_DEVICE | DEVICE_OUT_REMOTE_SUBMIX | + DEVICE_OUT_TELEPHONY_TX | + DEVICE_OUT_LINE | + DEVICE_OUT_HDMI_ARC | + DEVICE_OUT_SPDIF | + DEVICE_OUT_FM | DEVICE_OUT_DEFAULT); public static final int DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | @@ -275,13 +286,20 @@ public class AudioSystem public static final int DEVICE_IN_BLUETOOTH_SCO_HEADSET = DEVICE_BIT_IN | 0x8; public static final int DEVICE_IN_WIRED_HEADSET = DEVICE_BIT_IN | 0x10; public static final int DEVICE_IN_AUX_DIGITAL = DEVICE_BIT_IN | 0x20; + public static final int DEVICE_IN_HDMI = DEVICE_IN_AUX_DIGITAL; public static final int DEVICE_IN_VOICE_CALL = DEVICE_BIT_IN | 0x40; + public static final int DEVICE_IN_TELEPHONY_RX = DEVICE_IN_VOICE_CALL; public static final int DEVICE_IN_BACK_MIC = DEVICE_BIT_IN | 0x80; public static final int DEVICE_IN_REMOTE_SUBMIX = DEVICE_BIT_IN | 0x100; public static final int DEVICE_IN_ANLG_DOCK_HEADSET = DEVICE_BIT_IN | 0x200; public static final int DEVICE_IN_DGTL_DOCK_HEADSET = DEVICE_BIT_IN | 0x400; public static final int DEVICE_IN_USB_ACCESSORY = DEVICE_BIT_IN | 0x800; public static final int DEVICE_IN_USB_DEVICE = DEVICE_BIT_IN | 0x1000; + public static final int DEVICE_IN_FM_TUNER = DEVICE_BIT_IN | 0x2000; + public static final int DEVICE_IN_TV_TUNER = DEVICE_BIT_IN | 0x4000; + public static final int DEVICE_IN_LINE = DEVICE_BIT_IN | 0x8000; + public static final int DEVICE_IN_SPDIF = DEVICE_BIT_IN | 0x10000; + public static final int DEVICE_IN_DEFAULT = DEVICE_BIT_IN | DEVICE_BIT_DEFAULT; public static final int DEVICE_IN_ALL = (DEVICE_IN_COMMUNICATION | @@ -289,14 +307,18 @@ public class AudioSystem DEVICE_IN_BUILTIN_MIC | DEVICE_IN_BLUETOOTH_SCO_HEADSET | DEVICE_IN_WIRED_HEADSET | - DEVICE_IN_AUX_DIGITAL | - DEVICE_IN_VOICE_CALL | + DEVICE_IN_HDMI | + DEVICE_IN_TELEPHONY_RX | DEVICE_IN_BACK_MIC | DEVICE_IN_REMOTE_SUBMIX | DEVICE_IN_ANLG_DOCK_HEADSET | DEVICE_IN_DGTL_DOCK_HEADSET | DEVICE_IN_USB_ACCESSORY | DEVICE_IN_USB_DEVICE | + DEVICE_IN_FM_TUNER | + DEVICE_IN_TV_TUNER | + DEVICE_IN_LINE | + DEVICE_IN_SPDIF | DEVICE_IN_DEFAULT); public static final int DEVICE_IN_ALL_SCO = DEVICE_IN_BLUETOOTH_SCO_HEADSET; public static final int DEVICE_IN_ALL_USB = (DEVICE_IN_USB_ACCESSORY | @@ -318,13 +340,19 @@ public class AudioSystem public static final String DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES_NAME = "bt_a2dp_hp"; public static final String DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER_NAME = "bt_a2dp_spk"; public static final String DEVICE_OUT_AUX_DIGITAL_NAME = "aux_digital"; + public static final String DEVICE_OUT_HDMI_NAME = "hdmi"; public static final String DEVICE_OUT_ANLG_DOCK_HEADSET_NAME = "analog_dock"; public static final String DEVICE_OUT_DGTL_DOCK_HEADSET_NAME = "digital_dock"; public static final String DEVICE_OUT_USB_ACCESSORY_NAME = "usb_accessory"; public static final String DEVICE_OUT_USB_DEVICE_NAME = "usb_device"; public static final String DEVICE_OUT_REMOTE_SUBMIX_NAME = "remote_submix"; + public static final String DEVICE_OUT_TELEPHONY_TX_NAME = "telephony_tx"; + public static final String DEVICE_OUT_LINE_NAME = "line"; + public static final String DEVICE_OUT_HDMI_ARC_NAME = "hmdi_arc"; + public static final String DEVICE_OUT_SPDIF_NAME = "spdif"; + public static final String DEVICE_OUT_FM_NAME = "fm_transmitter"; - public static String getDeviceName(int device) + public static String getOutputDeviceName(int device) { switch(device) { case DEVICE_OUT_EARPIECE: @@ -347,8 +375,8 @@ public class AudioSystem return DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES_NAME; case DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER: return DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER_NAME; - case DEVICE_OUT_AUX_DIGITAL: - return DEVICE_OUT_AUX_DIGITAL_NAME; + case DEVICE_OUT_HDMI: + return DEVICE_OUT_HDMI_NAME; case DEVICE_OUT_ANLG_DOCK_HEADSET: return DEVICE_OUT_ANLG_DOCK_HEADSET_NAME; case DEVICE_OUT_DGTL_DOCK_HEADSET: @@ -359,12 +387,23 @@ public class AudioSystem return DEVICE_OUT_USB_DEVICE_NAME; case DEVICE_OUT_REMOTE_SUBMIX: return DEVICE_OUT_REMOTE_SUBMIX_NAME; + case DEVICE_OUT_TELEPHONY_TX: + return DEVICE_OUT_TELEPHONY_TX_NAME; + case DEVICE_OUT_LINE: + return DEVICE_OUT_LINE_NAME; + case DEVICE_OUT_HDMI_ARC: + return DEVICE_OUT_HDMI_ARC_NAME; + case DEVICE_OUT_SPDIF: + return DEVICE_OUT_SPDIF_NAME; + case DEVICE_OUT_FM: + return DEVICE_OUT_FM_NAME; case DEVICE_OUT_DEFAULT: default: return ""; } } + // phone state, match audio_mode??? public static final int PHONE_STATE_OFFCALL = 0; public static final int PHONE_STATE_RINGING = 1; |