diff options
-rw-r--r-- | api/current.txt | 54 | ||||
-rw-r--r-- | api/system-current.txt | 54 | ||||
-rw-r--r-- | core/java/android/app/SystemServiceRegistry.java | 10 | ||||
-rw-r--r-- | core/java/android/content/Context.java | 10 | ||||
-rw-r--r-- | media/java/android/media/AudioDeviceInfo.java | 22 | ||||
-rw-r--r-- | media/java/android/media/AudioDevicesManager.java | 275 | ||||
-rw-r--r-- | media/java/android/media/AudioManager.java | 212 | ||||
-rw-r--r-- | media/java/android/media/AudioRecord.java | 34 | ||||
-rw-r--r-- | media/java/android/media/AudioTrack.java | 34 | ||||
-rw-r--r-- | media/java/android/media/OnAudioDeviceConnectionListener.java | 6 | ||||
-rw-r--r-- | media/java/android/media/OnAudioRecordRoutingListener.java | 29 | ||||
-rw-r--r-- | media/java/android/media/OnAudioTrackRoutingListener.java | 29 |
12 files changed, 321 insertions, 448 deletions
diff --git a/api/current.txt b/api/current.txt index 7df09a1..4af5a5a 100644 --- a/api/current.txt +++ b/api/current.txt @@ -7763,7 +7763,6 @@ package android.content { field public static final java.lang.String ALARM_SERVICE = "alarm"; field public static final java.lang.String APPWIDGET_SERVICE = "appwidget"; field public static final java.lang.String APP_OPS_SERVICE = "appops"; - field public static final java.lang.String AUDIO_DEVICES_SERVICE = "audio_devices_manager"; field public static final java.lang.String AUDIO_SERVICE = "audio"; field public static final java.lang.String BATTERY_SERVICE = "batterymanager"; field public static final int BIND_ABOVE_CLIENT = 8; // 0x8 @@ -14727,12 +14726,12 @@ package android.media { method public android.media.AudioAttributes.Builder setUsage(int); } - public class AudioDeviceInfo { - method public java.lang.String getAddress(); + public final class AudioDeviceInfo { method public int[] getChannelCounts(); method public int[] getChannelMasks(); method public int[] getFormats(); - method public java.lang.String getName(); + method public int getId(); + method public java.lang.CharSequence getName(); method public int[] getSampleRates(); method public int getType(); method public boolean isSink(); @@ -14759,15 +14758,6 @@ package android.media { field public static final int TYPE_WIRED_HEADSET = 3; // 0x3 } - public class AudioDevicesManager { - method public void addOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener, android.os.Handler); - method public android.media.AudioDeviceInfo[] listDevices(int); - method public void removeOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener); - field public static final int LIST_DEVICES_ALL = 3; // 0x3 - field public static final int LIST_DEVICES_INPUTS = 1; // 0x1 - field public static final int LIST_DEVICES_OUTPUTS = 2; // 0x2 - } - public class AudioFormat { method public int getChannelCount(); method public int getChannelIndexMask(); @@ -14838,11 +14828,13 @@ package android.media { public class AudioManager { method public int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener); + method public void addOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener, android.os.Handler); method public void adjustStreamVolume(int, int, int); method public void adjustSuggestedStreamVolume(int, int, int); method public void adjustVolume(int, int); method public void dispatchMediaKeyEvent(android.view.KeyEvent); method public int generateAudioSessionId(); + method public android.media.AudioDeviceInfo[] getDevices(int); method public int getMode(); method public java.lang.String getParameters(java.lang.String); method public java.lang.String getProperty(java.lang.String); @@ -14867,6 +14859,7 @@ package android.media { method public deprecated void registerMediaButtonEventReceiver(android.app.PendingIntent); method public deprecated void registerRemoteControlClient(android.media.RemoteControlClient); method public deprecated boolean registerRemoteController(android.media.RemoteController); + method public void removeOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener); method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int); method public deprecated void setBluetoothA2dpOn(boolean); method public void setBluetoothScoOn(boolean); @@ -14935,6 +14928,9 @@ package android.media { field public static final int FX_KEYPRESS_SPACEBAR = 6; // 0x6 field public static final int FX_KEYPRESS_STANDARD = 5; // 0x5 field public static final int FX_KEY_CLICK = 0; // 0x0 + field public static final int GET_DEVICES_ALL = 3; // 0x3 + field public static final int GET_DEVICES_INPUTS = 1; // 0x1 + field public static final int GET_DEVICES_OUTPUTS = 2; // 0x2 field public static final int MODE_CURRENT = -1; // 0xffffffff field public static final int MODE_INVALID = -2; // 0xfffffffe field public static final int MODE_IN_CALL = 2; // 0x2 @@ -14983,7 +14979,7 @@ package android.media { public class AudioRecord { ctor public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException; - method public void addOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener, android.os.Handler); + method public void addOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener, android.os.Handler); method public int getAudioFormat(); method public int getAudioSessionId(); method public int getAudioSource(); @@ -14994,7 +14990,7 @@ package android.media { method public int getNativeFrameCount() throws java.lang.IllegalStateException; method public int getNotificationMarkerPosition(); method public int getPositionNotificationPeriod(); - method public android.media.AudioDeviceInfo getPreferredInputDevice(); + method public android.media.AudioDeviceInfo getPreferredDevice(); method public int getRecordingState(); method public android.media.AudioDeviceInfo getRoutedDevice(); method public int getSampleRate(); @@ -15007,10 +15003,10 @@ package android.media { method public int read(java.nio.ByteBuffer, int); method public int read(java.nio.ByteBuffer, int, int); method public void release(); - method public void removeOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener); + method public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener); method public int setNotificationMarkerPosition(int); method public int setPositionNotificationPeriod(int); - method public boolean setPreferredInputDevice(android.media.AudioDeviceInfo); + method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); method public void startRecording() throws java.lang.IllegalStateException; @@ -15041,6 +15037,10 @@ package android.media { method public abstract void onPeriodicNotification(android.media.AudioRecord); } + public static abstract interface AudioRecord.OnRoutingChangedListener { + method public abstract void onRoutingChanged(android.media.AudioRecord); + } + public final class AudioTimestamp { ctor public AudioTimestamp(); field public long framePosition; @@ -15051,7 +15051,7 @@ package android.media { ctor public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException; ctor public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException; ctor public AudioTrack(android.media.AudioAttributes, android.media.AudioFormat, int, int, int) throws java.lang.IllegalArgumentException; - method public void addOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener, android.os.Handler); + method public void addOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener, android.os.Handler); method public int attachAuxEffect(int); method public void flush(); method public int getAudioFormat(); @@ -15070,7 +15070,7 @@ package android.media { method public int getPlaybackRate(); method public android.media.PlaybackSettings getPlaybackSettings(); method public int getPositionNotificationPeriod(); - method public android.media.AudioDeviceInfo getPreferredOutputDevice(); + method public android.media.AudioDeviceInfo getPreferredDevice(); method public android.media.AudioDeviceInfo getRoutedDevice(); method public int getSampleRate(); method public int getState(); @@ -15080,7 +15080,7 @@ package android.media { method public void play() throws java.lang.IllegalStateException; method public void release(); method public int reloadStaticData(); - method public void removeOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener); + method public void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener); method public int setAuxEffectSendLevel(float); method public int setLoopPoints(int, int, int); method public int setNotificationMarkerPosition(int); @@ -15090,7 +15090,7 @@ package android.media { method public int setPlaybackRate(int); method public void setPlaybackSettings(android.media.PlaybackSettings); method public int setPositionNotificationPeriod(int); - method public boolean setPreferredOutputDevice(android.media.AudioDeviceInfo); + method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method protected deprecated void setState(int); method public deprecated int setStereoVolume(float, float); method public int setVolume(float); @@ -15133,6 +15133,10 @@ package android.media { method public abstract void onPeriodicNotification(android.media.AudioTrack); } + public static abstract interface AudioTrack.OnRoutingChangedListener { + method public abstract void onRoutingChanged(android.media.AudioTrack); + } + public class CamcorderProfile { method public static android.media.CamcorderProfile get(int); method public static android.media.CamcorderProfile get(int, int); @@ -16500,14 +16504,6 @@ package android.media { method public abstract void onAudioDeviceConnection(); } - public abstract interface OnAudioRecordRoutingListener { - method public abstract void onAudioRecordRouting(android.media.AudioRecord); - } - - public abstract interface OnAudioTrackRoutingListener { - method public abstract void onAudioTrackRouting(android.media.AudioTrack); - } - public final class PlaybackSettings { ctor public PlaybackSettings(); method public android.media.PlaybackSettings allowDefaults(); diff --git a/api/system-current.txt b/api/system-current.txt index 0662d93..81c0ef6 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7978,7 +7978,6 @@ package android.content { field public static final java.lang.String ALARM_SERVICE = "alarm"; field public static final java.lang.String APPWIDGET_SERVICE = "appwidget"; field public static final java.lang.String APP_OPS_SERVICE = "appops"; - field public static final java.lang.String AUDIO_DEVICES_SERVICE = "audio_devices_manager"; field public static final java.lang.String AUDIO_SERVICE = "audio"; field public static final java.lang.String BACKUP_SERVICE = "backup"; field public static final java.lang.String BATTERY_SERVICE = "batterymanager"; @@ -15925,12 +15924,12 @@ package android.media { method public android.media.AudioAttributes.Builder setUsage(int); } - public class AudioDeviceInfo { - method public java.lang.String getAddress(); + public final class AudioDeviceInfo { method public int[] getChannelCounts(); method public int[] getChannelMasks(); method public int[] getFormats(); - method public java.lang.String getName(); + method public int getId(); + method public java.lang.CharSequence getName(); method public int[] getSampleRates(); method public int getType(); method public boolean isSink(); @@ -15957,15 +15956,6 @@ package android.media { field public static final int TYPE_WIRED_HEADSET = 3; // 0x3 } - public class AudioDevicesManager { - method public void addOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener, android.os.Handler); - method public android.media.AudioDeviceInfo[] listDevices(int); - method public void removeOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener); - field public static final int LIST_DEVICES_ALL = 3; // 0x3 - field public static final int LIST_DEVICES_INPUTS = 1; // 0x1 - field public static final int LIST_DEVICES_OUTPUTS = 2; // 0x2 - } - public final class AudioFocusInfo implements android.os.Parcelable { method public int describeContents(); method public android.media.AudioAttributes getAttributes(); @@ -16049,11 +16039,13 @@ package android.media { public class AudioManager { method public int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener); method public int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, android.media.AudioAttributes); + method public void addOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener, android.os.Handler); method public void adjustStreamVolume(int, int, int); method public void adjustSuggestedStreamVolume(int, int, int); method public void adjustVolume(int, int); method public void dispatchMediaKeyEvent(android.view.KeyEvent); method public int generateAudioSessionId(); + method public android.media.AudioDeviceInfo[] getDevices(int); method public int getMode(); method public java.lang.String getParameters(java.lang.String); method public java.lang.String getProperty(java.lang.String); @@ -16080,6 +16072,7 @@ package android.media { method public deprecated void registerMediaButtonEventReceiver(android.app.PendingIntent); method public deprecated void registerRemoteControlClient(android.media.RemoteControlClient); method public deprecated boolean registerRemoteController(android.media.RemoteController); + method public void removeOnAudioDeviceConnectionListener(android.media.OnAudioDeviceConnectionListener); method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int); method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, android.media.AudioAttributes, int, int) throws java.lang.IllegalArgumentException; method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, android.media.AudioAttributes, int, int, android.media.audiopolicy.AudioPolicy) throws java.lang.IllegalArgumentException; @@ -16154,6 +16147,9 @@ package android.media { field public static final int FX_KEYPRESS_SPACEBAR = 6; // 0x6 field public static final int FX_KEYPRESS_STANDARD = 5; // 0x5 field public static final int FX_KEY_CLICK = 0; // 0x0 + field public static final int GET_DEVICES_ALL = 3; // 0x3 + field public static final int GET_DEVICES_INPUTS = 1; // 0x1 + field public static final int GET_DEVICES_OUTPUTS = 2; // 0x2 field public static final int MODE_CURRENT = -1; // 0xffffffff field public static final int MODE_INVALID = -2; // 0xfffffffe field public static final int MODE_IN_CALL = 2; // 0x2 @@ -16203,7 +16199,7 @@ package android.media { public class AudioRecord { ctor public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException; ctor public AudioRecord(android.media.AudioAttributes, android.media.AudioFormat, int, int) throws java.lang.IllegalArgumentException; - method public void addOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener, android.os.Handler); + method public void addOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener, android.os.Handler); method public int getAudioFormat(); method public int getAudioSessionId(); method public int getAudioSource(); @@ -16214,7 +16210,7 @@ package android.media { method public int getNativeFrameCount() throws java.lang.IllegalStateException; method public int getNotificationMarkerPosition(); method public int getPositionNotificationPeriod(); - method public android.media.AudioDeviceInfo getPreferredInputDevice(); + method public android.media.AudioDeviceInfo getPreferredDevice(); method public int getRecordingState(); method public android.media.AudioDeviceInfo getRoutedDevice(); method public int getSampleRate(); @@ -16227,10 +16223,10 @@ package android.media { method public int read(java.nio.ByteBuffer, int); method public int read(java.nio.ByteBuffer, int, int); method public void release(); - method public void removeOnAudioRecordRoutingListener(android.media.OnAudioRecordRoutingListener); + method public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener); method public int setNotificationMarkerPosition(int); method public int setPositionNotificationPeriod(int); - method public boolean setPreferredInputDevice(android.media.AudioDeviceInfo); + method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener); method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler); method public void startRecording() throws java.lang.IllegalStateException; @@ -16263,6 +16259,10 @@ package android.media { method public abstract void onPeriodicNotification(android.media.AudioRecord); } + public static abstract interface AudioRecord.OnRoutingChangedListener { + method public abstract void onRoutingChanged(android.media.AudioRecord); + } + public final class AudioTimestamp { ctor public AudioTimestamp(); field public long framePosition; @@ -16273,7 +16273,7 @@ package android.media { ctor public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException; ctor public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException; ctor public AudioTrack(android.media.AudioAttributes, android.media.AudioFormat, int, int, int) throws java.lang.IllegalArgumentException; - method public void addOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener, android.os.Handler); + method public void addOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener, android.os.Handler); method public int attachAuxEffect(int); method public void flush(); method public int getAudioFormat(); @@ -16292,7 +16292,7 @@ package android.media { method public int getPlaybackRate(); method public android.media.PlaybackSettings getPlaybackSettings(); method public int getPositionNotificationPeriod(); - method public android.media.AudioDeviceInfo getPreferredOutputDevice(); + method public android.media.AudioDeviceInfo getPreferredDevice(); method public android.media.AudioDeviceInfo getRoutedDevice(); method public int getSampleRate(); method public int getState(); @@ -16302,7 +16302,7 @@ package android.media { method public void play() throws java.lang.IllegalStateException; method public void release(); method public int reloadStaticData(); - method public void removeOnAudioTrackRoutingListener(android.media.OnAudioTrackRoutingListener); + method public void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener); method public int setAuxEffectSendLevel(float); method public int setLoopPoints(int, int, int); method public int setNotificationMarkerPosition(int); @@ -16312,7 +16312,7 @@ package android.media { method public int setPlaybackRate(int); method public void setPlaybackSettings(android.media.PlaybackSettings); method public int setPositionNotificationPeriod(int); - method public boolean setPreferredOutputDevice(android.media.AudioDeviceInfo); + method public boolean setPreferredDevice(android.media.AudioDeviceInfo); method protected deprecated void setState(int); method public deprecated int setStereoVolume(float, float); method public int setVolume(float); @@ -16355,6 +16355,10 @@ package android.media { method public abstract void onPeriodicNotification(android.media.AudioTrack); } + public static abstract interface AudioTrack.OnRoutingChangedListener { + method public abstract void onRoutingChanged(android.media.AudioTrack); + } + public class CamcorderProfile { method public static android.media.CamcorderProfile get(int); method public static android.media.CamcorderProfile get(int, int); @@ -17725,14 +17729,6 @@ package android.media { method public abstract void onAudioDeviceConnection(); } - public abstract interface OnAudioRecordRoutingListener { - method public abstract void onAudioRecordRouting(android.media.AudioRecord); - } - - public abstract interface OnAudioTrackRoutingListener { - method public abstract void onAudioTrackRouting(android.media.AudioTrack); - } - public final class PlaybackSettings { ctor public PlaybackSettings(); method public android.media.PlaybackSettings allowDefaults(); diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 391131a..0d00908 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -55,7 +55,6 @@ import android.location.CountryDetector; import android.location.ICountryDetector; import android.location.ILocationManager; import android.location.LocationManager; -import android.media.AudioDevicesManager; import android.media.AudioManager; import android.media.MediaRouter; import android.media.midi.IMidiManager; @@ -701,13 +700,6 @@ final class SystemServiceRegistry { public RadioManager createService(ContextImpl ctx) { return new RadioManager(ctx); }}); - - registerService(Context.AUDIO_DEVICES_SERVICE, AudioDevicesManager.class, - new CachedServiceFetcher<AudioDevicesManager>() { - @Override - public AudioDevicesManager createService(ContextImpl ctx) { - return new AudioDevicesManager(ctx); - }}); } /** @@ -726,7 +718,7 @@ final class SystemServiceRegistry { } /** - * Gets the name of the system-level service that is represented by the specified class. + * Gets the name of the system-level service that is represented by the specified class. */ public static String getSystemServiceName(Class<?> serviceClass) { return SYSTEM_SERVICE_NAMES.get(serviceClass); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 8687c6b..6a98950 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3133,16 +3133,6 @@ public abstract class Context { public static final String RADIO_SERVICE = "radio"; /** - * Use with {@link #getSystemService} to retrieve a - * {@link android.media.AudioDevicesManager} for handling device enumeration & notification. - * - * @see #getSystemService - * @see android.media.AudioDevicesManager - */ - public static final String AUDIO_DEVICES_SERVICE = "audio_devices_manager"; - - - /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. * diff --git a/media/java/android/media/AudioDeviceInfo.java b/media/java/android/media/AudioDeviceInfo.java index d58b1d1..566f8dc 100644 --- a/media/java/android/media/AudioDeviceInfo.java +++ b/media/java/android/media/AudioDeviceInfo.java @@ -21,7 +21,7 @@ import android.util.SparseIntArray; /** * Class to provide information about the audio devices. */ -public class AudioDeviceInfo { +public final class AudioDeviceInfo { /** * A device type associated with an unknown or uninitialized device. @@ -112,7 +112,6 @@ public class AudioDeviceInfo { } /** - * @hide * @return The internal device ID. */ public int getId() { @@ -122,15 +121,15 @@ public class AudioDeviceInfo { /** * @return The human-readable name of the audio device. */ - public String getName() { + public CharSequence getName() { return mPort.name(); } /** + * @hide * @return The "address" string of the device. This generally contains device-specific * parameters. */ - // TODO Is there a compelling reason to expose this? public String getAddress() { return mPort.address(); } @@ -157,15 +156,18 @@ public class AudioDeviceInfo { } /** - * @return An array of channel masks supported by the audio device (defined in - * AudioFormat.java). + * @return An array of channel masks ({@link AudioFormat#CHANNEL_IN_STEREO}, + * {@link AudioFormat#CHANNEL_OUT_7POINT1) for which this audio device can be configured. + * + * @see AudioFormat */ public int[] getChannelMasks() { return mPort.channelMasks(); } /** - * @return An array of channel counts supported by the audio device. + * @return An array of channel counts (1, 2, 4....) for which this audio device + * can be configured. */ public int[] getChannelCounts() { int[] masks = getChannelMasks(); @@ -179,8 +181,10 @@ public class AudioDeviceInfo { } /** - * @return An array of audio format IDs supported by the audio device (defined in - * AudioFormat.java) + * @return An array of audio format IDs (@link AudioFormat#ENCODING_PCM_16BIT, + * {@link AudioFormat#ENCODING_PCM_FLOAT}...) supported by the audio device. + * + * @see AudioFormat */ public int[] getFormats() { return mPort.formats(); diff --git a/media/java/android/media/AudioDevicesManager.java b/media/java/android/media/AudioDevicesManager.java deleted file mode 100644 index 8b83c17..0000000 --- a/media/java/android/media/AudioDevicesManager.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.media; - -import android.content.Context; -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import android.util.ArrayMap; -import android.util.Pair; -import android.util.Slog; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.HashMap; -import java.util.Iterator; - -/** - * AudioDevicesManager implements the Android Media Audio device enumeration and notification - * functionality. This functionality is in two comlementary parts. - * <ol> - * <li>{@link AudioDevicesManager#listDevices(int)} gets the list of current audio devices - * </li> - * <li>{@link AudioDevicesManager#addOnAudioDeviceConnectionListener(OnAudioDeviceConnectionListener, android.os.Handler)} - * provides a mechanism for applications to be informed of audio device connect/disconnect events. - * </li> - * </ol> - */ -public class AudioDevicesManager { - - private static String TAG = "AudioDevicesManager"; - - private static boolean DEBUG = false; - - private AudioManager mAudioManager = null; - - private OnAmPortUpdateListener mPortListener = null; - - /** - * The message sent to apps when the contents of the device list changes if they provide - * a {#link Handler} object to addOnAudioDeviceConnectionListener(). - */ - private final static int MSG_DEVICES_LIST_CHANGE = 0; - - private ArrayMap<OnAudioDeviceConnectionListener, NativeEventHandlerDelegate> - mDeviceConnectionListeners = - new ArrayMap<OnAudioDeviceConnectionListener, NativeEventHandlerDelegate>(); - - /** - * @hide - * The AudioDevicesManager class is used to enumerate the physical audio devices connected - * to the system. See also {@link AudioDeviceInfo}. - */ - public AudioDevicesManager(Context context) { - mAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); - mPortListener = new OnAmPortUpdateListener(); - mAudioManager.registerAudioPortUpdateListener(mPortListener); - } - - /** - * Specifies to the {@link AudioDevicesManager#listDevices(int)} method to include - * source (i.e. input) audio devices. - */ - public static final int LIST_DEVICES_INPUTS = 0x0001; - - /** - * Specifies to the {@link AudioDevicesManager#listDevices(int)} method to include - * sink (i.e. output) audio devices. - */ - public static final int LIST_DEVICES_OUTPUTS = 0x0002; - - /** - * Specifies to the {@link AudioDevicesManager#listDevices(int)} method to include both - * source and sink devices. - */ - public static final int LIST_DEVICES_ALL = LIST_DEVICES_OUTPUTS | LIST_DEVICES_INPUTS; - - /** - * Determines if a given AudioDevicePort meets the specified filter criteria. - * @param port The port to test. - * @param flags A set of bitflags specifying the criteria to test. - * @see {@link LIST_DEVICES_OUTPUTS} and {@link LIST_DEVICES_INPUTS} - **/ - private static boolean checkFlags(AudioDevicePort port, int flags) { - return port.role() == AudioPort.ROLE_SINK && (flags & LIST_DEVICES_OUTPUTS) != 0 || - port.role() == AudioPort.ROLE_SOURCE && (flags & LIST_DEVICES_INPUTS) != 0; - } - - /** - * Generates a list of AudioDeviceInfo objects corresponding to the audio devices currently - * connected to the system and meeting the criteria specified in the <code>flags</code> - * parameter. - * @param flags A set of bitflags specifying the criteria to test. - * @see {@link LIST_DEVICES_OUTPUTS}, {@link LIST_DEVICES_INPUTS} and {@link LIST_DEVICES_ALL}. - * @return A (possibly zero-length) array of AudioDeviceInfo objects. - */ - public AudioDeviceInfo[] listDevices(int flags) { - return listDevicesStatic(flags); - } - - /** - * Generates a list of AudioDeviceInfo objects corresponding to the audio devices currently - * connected to the system and meeting the criteria specified in the <code>flags</code> - * parameter. - * @param flags A set of bitflags specifying the criteria to test. - * @see {@link LIST_DEVICES_OUTPUTS}, {@link LIST_DEVICES_INPUTS} and {@link LIST_DEVICES_ALL}. - * @return A (possibly zero-length) array of AudioDeviceInfo objects. - * @hide - */ - public static AudioDeviceInfo[] listDevicesStatic(int flags) { - ArrayList<AudioDevicePort> ports = new ArrayList<AudioDevicePort>(); - int status = AudioManager.listAudioDevicePorts(ports); - if (status != AudioManager.SUCCESS) { - // fail and bail! - return new AudioDeviceInfo[0]; - } - - // figure out how many AudioDeviceInfo we need space for - int numRecs = 0; - for (AudioDevicePort port : ports) { - if (checkFlags(port, flags)) { - numRecs++; - } - } - - // Now load them up - AudioDeviceInfo[] deviceList = new AudioDeviceInfo[numRecs]; - int slot = 0; - for (AudioDevicePort port : ports) { - if (checkFlags(port, flags)) { - deviceList[slot++] = new AudioDeviceInfo(port); - } - } - - return deviceList; - } - - /** - * Adds an {@link OnAudioDeviceConnectionListener} to receive notifications of changes - * to the set of connected audio devices. - */ - public void addOnAudioDeviceConnectionListener(OnAudioDeviceConnectionListener listener, - android.os.Handler handler) { - if (listener != null && !mDeviceConnectionListeners.containsKey(listener)) { - synchronized (mDeviceConnectionListeners) { - mDeviceConnectionListeners.put( - listener, new NativeEventHandlerDelegate(listener, handler)); - } - } - } - - /** - * Removes an {@link OnAudioDeviceConnectionListener} which has been previously registered - * to receive notifications of changes to the set of connected audio devices. - */ - public void removeOnAudioDeviceConnectionListener(OnAudioDeviceConnectionListener listener) { - synchronized (mDeviceConnectionListeners) { - if (mDeviceConnectionListeners.containsKey(listener)) { - mDeviceConnectionListeners.remove(listener); - } - } - } - - /** - * Sends device list change notification to all listeners. - */ - private void broadcastDeviceListChange() { - Collection<NativeEventHandlerDelegate> values; - synchronized (mDeviceConnectionListeners) { - values = mDeviceConnectionListeners.values(); - } - for(NativeEventHandlerDelegate delegate : values) { - Handler handler = delegate.getHandler(); - if (handler != null) { - handler.sendEmptyMessage(MSG_DEVICES_LIST_CHANGE); - } - } - } - - /** - * Handles Port list update notifications from the AudioManager - */ - private class OnAmPortUpdateListener implements AudioManager.OnAudioPortUpdateListener { - static final String TAG = "OnAmPortUpdateListener"; - public void onAudioPortListUpdate(AudioPort[] portList) { - broadcastDeviceListChange(); - } - - /** - * Callback method called upon audio patch list update. - * @param patchList the updated list of audio patches - */ - public void onAudioPatchListUpdate(AudioPatch[] patchList) { - if (DEBUG) { - Slog.d(TAG, "onAudioPatchListUpdate() " + patchList.length + " patches."); - } - } - - /** - * Callback method called when the mediaserver dies - */ - public void onServiceDied() { - if (DEBUG) { - Slog.i(TAG, "onServiceDied()"); - } - - broadcastDeviceListChange(); - } - } - - //--------------------------------------------------------- - // Inner classes - //-------------------- - /** - * Helper class to handle the forwarding of native events to the appropriate listener - * (potentially) handled in a different thread. - */ - private class NativeEventHandlerDelegate { - private final Handler mHandler; - - NativeEventHandlerDelegate(final OnAudioDeviceConnectionListener listener, - Handler handler) { - // find the looper for our new event handler - Looper looper; - if (handler != null) { - looper = handler.getLooper(); - } else { - // no given handler, use the looper the addListener call was called in - looper = Looper.getMainLooper(); - } - - // construct the event handler with this looper - if (looper != null) { - // implement the event handler delegate - mHandler = new Handler(looper) { - @Override - public void handleMessage(Message msg) { - switch(msg.what) { - case MSG_DEVICES_LIST_CHANGE: - // call the OnAudioDeviceConnectionListener - if (listener != null) { - listener.onAudioDeviceConnection(); - } - break; - default: - Slog.e(TAG, "Unknown native event type: " + msg.what); - break; - } - } - }; - } else { - mHandler = null; - } - } - - Handler getHandler() { - return mHandler; - } - } -} diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 19900d0..11841f4 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -42,10 +42,13 @@ import android.os.SystemProperties; import android.os.SystemClock; import android.os.ServiceManager; import android.provider.Settings; +import android.util.ArrayMap; import android.util.Log; +import android.util.Pair; import android.view.KeyEvent; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.Iterator; @@ -628,6 +631,9 @@ public class AudioManager { mUseFixedVolume = getContext().getResources().getBoolean( com.android.internal.R.bool.config_useFixedVolume); sAudioPortEventHandler.init(); + + mPortListener = new OnAmPortUpdateListener(); + registerAudioPortUpdateListener(mPortListener); } private Context getContext() { @@ -3655,4 +3661,210 @@ public class AudioManager { portCfg.format(), gainCfg); } + + private OnAmPortUpdateListener mPortListener = null; + + /** + * The message sent to apps when the contents of the device list changes if they provide + * a {#link Handler} object to addOnAudioDeviceConnectionListener(). + */ + private final static int MSG_DEVICES_LIST_CHANGE = 0; + + private ArrayMap<OnAudioDeviceConnectionListener, NativeEventHandlerDelegate> + mDeviceConnectionListeners = + new ArrayMap<OnAudioDeviceConnectionListener, NativeEventHandlerDelegate>(); + + /** + * Specifies to the {@link AudioManager#getDevices(int)} method to include + * source (i.e. input) audio devices. + */ + public static final int GET_DEVICES_INPUTS = 0x0001; + + /** + * Specifies to the {@link AudioManager#getDevices(int)} method to include + * sink (i.e. output) audio devices. + */ + public static final int GET_DEVICES_OUTPUTS = 0x0002; + + /** + * Specifies to the {@link AudioManager#getDevices(int)} method to include both + * source and sink devices. + */ + public static final int GET_DEVICES_ALL = GET_DEVICES_OUTPUTS | GET_DEVICES_INPUTS; + + /** + * Determines if a given AudioDevicePort meets the specified filter criteria. + * @param port The port to test. + * @param flags A set of bitflags specifying the criteria to test. + * @see {@link GET_DEVICES_OUTPUTS} and {@link GET_DEVICES_INPUTS} + **/ + private static boolean checkFlags(AudioDevicePort port, int flags) { + return port.role() == AudioPort.ROLE_SINK && (flags & GET_DEVICES_OUTPUTS) != 0 || + port.role() == AudioPort.ROLE_SOURCE && (flags & GET_DEVICES_INPUTS) != 0; + } + + /** + * Generates a list of AudioDeviceInfo objects corresponding to the audio devices currently + * connected to the system and meeting the criteria specified in the <code>flags</code> + * parameter. + * @param flags A set of bitflags specifying the criteria to test. + * @see {@link GET_DEVICES_OUTPUTS}, {@link GET_DEVICES_INPUTS} and {@lGET_DEVICES_CES_ALL}. + * @return A (possibly zero-length) array of AudioDeviceInfo objects. + */ + public AudioDeviceInfo[] getDevices(int flags) { + return getDevicesStatic(flags); + } + + /** + * Generates a list of AudioDeviceInfo objects corresponding to the audio devices currently + * connected to the system and meeting the criteria specified in the <code>flags</code> + * parameter. + * @param flags A set of bitflags specifying the criteria to test. + * @see {@link GET_DEVICES_OUTPUTS}, {@link GET_DEVICES_INPUTS} and {@link GET_DEVICES_ALL}. + * @return A (possibly zero-length) array of AudioDeviceInfo objects. + * @hide + */ + public static AudioDeviceInfo[] getDevicesStatic(int flags) { + ArrayList<AudioDevicePort> ports = new ArrayList<AudioDevicePort>(); + int status = AudioManager.listAudioDevicePorts(ports); + if (status != AudioManager.SUCCESS) { + // fail and bail! + return new AudioDeviceInfo[0]; + } + + // figure out how many AudioDeviceInfo we need space for + int numRecs = 0; + for (AudioDevicePort port : ports) { + if (checkFlags(port, flags)) { + numRecs++; + } + } + + // Now load them up + AudioDeviceInfo[] deviceList = new AudioDeviceInfo[numRecs]; + int slot = 0; + for (AudioDevicePort port : ports) { + if (checkFlags(port, flags)) { + deviceList[slot++] = new AudioDeviceInfo(port); + } + } + + return deviceList; + } + + /** + * Adds an {@link OnAudioDeviceConnectionListener} to receive notifications of changes + * to the set of connected audio devices. + */ + public void addOnAudioDeviceConnectionListener(OnAudioDeviceConnectionListener listener, + android.os.Handler handler) { + if (listener != null && !mDeviceConnectionListeners.containsKey(listener)) { + synchronized (mDeviceConnectionListeners) { + mDeviceConnectionListeners.put( + listener, new NativeEventHandlerDelegate(listener, handler)); + } + } + } + + /** + * Removes an {@link OnAudioDeviceConnectionListener} which has been previously registered + * to receive notifications of changes to the set of connected audio devices. + */ + public void removeOnAudioDeviceConnectionListener(OnAudioDeviceConnectionListener listener) { + synchronized (mDeviceConnectionListeners) { + if (mDeviceConnectionListeners.containsKey(listener)) { + mDeviceConnectionListeners.remove(listener); + } + } + } + + /** + * Sends device list change notification to all listeners. + */ + private void broadcastDeviceListChange() { + Collection<NativeEventHandlerDelegate> values; + synchronized (mDeviceConnectionListeners) { + values = mDeviceConnectionListeners.values(); + } + for (NativeEventHandlerDelegate delegate : values) { + Handler handler = delegate.getHandler(); + if (handler != null) { + handler.sendEmptyMessage(MSG_DEVICES_LIST_CHANGE); + } + } + } + + /** + * Handles Port list update notifications from the AudioManager + */ + private class OnAmPortUpdateListener implements AudioManager.OnAudioPortUpdateListener { + static final String TAG = "OnAmPortUpdateListener"; + public void onAudioPortListUpdate(AudioPort[] portList) { + broadcastDeviceListChange(); + } + + /** + * Callback method called upon audio patch list update. + * @param patchList the updated list of audio patches + */ + public void onAudioPatchListUpdate(AudioPatch[] patchList) {} + + /** + * Callback method called when the mediaserver dies + */ + public void onServiceDied() { + broadcastDeviceListChange(); + } + } + + //--------------------------------------------------------- + // Inner classes + //-------------------- + /** + * Helper class to handle the forwarding of native events to the appropriate listener + * (potentially) handled in a different thread. + */ + private class NativeEventHandlerDelegate { + private final Handler mHandler; + + NativeEventHandlerDelegate(final OnAudioDeviceConnectionListener listener, + Handler handler) { + // find the looper for our new event handler + Looper looper; + if (handler != null) { + looper = handler.getLooper(); + } else { + // no given handler, use the looper the addListener call was called in + looper = Looper.getMainLooper(); + } + + // construct the event handler with this looper + if (looper != null) { + // implement the event handler delegate + mHandler = new Handler(looper) { + @Override + public void handleMessage(Message msg) { + switch(msg.what) { + case MSG_DEVICES_LIST_CHANGE: + // call the OnAudioDeviceConnectionListener + if (listener != null) { + listener.onAudioDeviceConnection(); + } + break; + default: + Log.e(TAG, "Unknown native event type: " + msg.what); + break; + } + } + }; + } else { + mHandler = null; + } + } + + Handler getHandler() { + return mHandler; + } + } + } diff --git a/media/java/android/media/AudioRecord.java b/media/java/android/media/AudioRecord.java index 11671d8..c720e2a 100644 --- a/media/java/android/media/AudioRecord.java +++ b/media/java/android/media/AudioRecord.java @@ -1202,6 +1202,14 @@ public class AudioRecord //-------------------------------------------------------------------------- // (Re)Routing Info //-------------------- + public interface OnRoutingChangedListener { + /** + * Called when the routing of an AudioRecord changes from either and explicit or + * policy rerouting. + */ + public void onRoutingChanged(AudioRecord audioRecord); + } + /** * Returns an {@link AudioDeviceInfo} identifying the current routing of this AudioRecord. */ @@ -1211,7 +1219,7 @@ public class AudioRecord return null; } AudioDeviceInfo[] devices = - AudioDevicesManager.listDevicesStatic(AudioDevicesManager.LIST_DEVICES_INPUTS); + AudioManager.getDevicesStatic(AudioManager.GET_DEVICES_INPUTS); for (int i = 0; i < devices.length; i++) { if (devices[i].getId() == deviceId) { return devices[i]; @@ -1222,17 +1230,17 @@ public class AudioRecord /** * The message sent to apps when the routing of this AudioRecord changes if they provide - * a {#link Handler} object to addOnAudioRecordRoutingListener(). + * a {#link Handler} object to addOnRoutingChangeListener(). */ - private ArrayMap<OnAudioRecordRoutingListener, NativeRoutingEventHandlerDelegate> + private ArrayMap<OnRoutingChangedListener, NativeRoutingEventHandlerDelegate> mRoutingChangeListeners = - new ArrayMap<OnAudioRecordRoutingListener, NativeRoutingEventHandlerDelegate>(); + new ArrayMap<OnRoutingChangedListener, NativeRoutingEventHandlerDelegate>(); /** - * Adds an {@link OnAudioRecordRoutingListener} to receive notifications of routing changes + * Adds an {@link OnRoutingChangedListener} to receive notifications of routing changes * on this AudioRecord. */ - public void addOnAudioRecordRoutingListener(OnAudioRecordRoutingListener listener, + public void addOnRoutingChangedListener(OnRoutingChangedListener listener, android.os.Handler handler) { if (listener != null && !mRoutingChangeListeners.containsKey(listener)) { synchronized (mRoutingChangeListeners) { @@ -1246,10 +1254,10 @@ public class AudioRecord } /** - * Removes an {@link OnAudioRecordRoutingListener} which has been previously added + * Removes an {@link OnRoutingChangedListener} which has been previously added * to receive notifications of changes to the set of connected audio devices. */ - public void removeOnAudioRecordRoutingListener(OnAudioRecordRoutingListener listener) { + public void removeOnRoutingChangedListener(OnRoutingChangedListener listener) { synchronized (mRoutingChangeListeners) { if (mRoutingChangeListeners.containsKey(listener)) { mRoutingChangeListeners.remove(listener); @@ -1268,7 +1276,7 @@ public class AudioRecord private final Handler mHandler; NativeRoutingEventHandlerDelegate(final AudioRecord record, - final OnAudioRecordRoutingListener listener, + final OnRoutingChangedListener listener, Handler handler) { // find the looper for our new event handler Looper looper; @@ -1291,7 +1299,7 @@ public class AudioRecord switch(msg.what) { case AudioSystem.NATIVE_EVENT_ROUTING_CHANGE: if (listener != null) { - listener.onAudioRecordRouting(record); + listener.onRoutingChanged(record); } break; default: @@ -1354,7 +1362,7 @@ public class AudioRecord * @return true if successful, false if the specified {@link AudioDeviceInfo} is non-null and * does not correspond to a valid audio input device. */ - public boolean setPreferredInputDevice(AudioDeviceInfo deviceInfo) { + public boolean setPreferredDevice(AudioDeviceInfo deviceInfo) { // Do some validation.... if (deviceInfo != null && !deviceInfo.isSource()) { return false; @@ -1371,10 +1379,10 @@ public class AudioRecord } /** - * Returns the selected input specified by {@link #setPreferredInputDevice}. Note that this + * Returns the selected input specified by {@link #setPreferredDevice}. Note that this * is not guarenteed to correspond to the actual device being used for recording. */ - public AudioDeviceInfo getPreferredInputDevice() { + public AudioDeviceInfo getPreferredDevice() { synchronized (this) { return mPreferredDevice; } diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java index a66a1e5..1134d30 100644 --- a/media/java/android/media/AudioTrack.java +++ b/media/java/android/media/AudioTrack.java @@ -2046,7 +2046,7 @@ public class AudioTrack * @return true if succesful, false if the specified {@link AudioDeviceInfo} is non-null and * does not correspond to a valid audio output device. */ - public boolean setPreferredOutputDevice(AudioDeviceInfo deviceInfo) { + public boolean setPreferredDevice(AudioDeviceInfo deviceInfo) { // Do some validation.... if (deviceInfo != null && !deviceInfo.isSink()) { return false; @@ -2062,10 +2062,10 @@ public class AudioTrack } /** - * Returns the selected output specified by {@link #setPreferredOutputDevice}. Note that this + * Returns the selected output specified by {@link #setPreferredDevice}. Note that this * is not guaranteed to correspond to the actual device being used for playback. */ - public AudioDeviceInfo getPreferredOutputDevice() { + public AudioDeviceInfo getPreferredDevice() { synchronized (this) { return mPreferredDevice; } @@ -2074,6 +2074,14 @@ public class AudioTrack //-------------------------------------------------------------------------- // (Re)Routing Info //-------------------- + public interface OnRoutingChangedListener { + /** + * Called when the routing of an AudioTrack changes from either and explicit or + * policy rerouting. + */ + public void onRoutingChanged(AudioTrack audioTrack); + } + /** * Returns an {@link AudioDeviceInfo} identifying the current routing of this AudioTrack. */ @@ -2083,7 +2091,7 @@ public class AudioTrack return null; } AudioDeviceInfo[] devices = - AudioDevicesManager.listDevicesStatic(AudioDevicesManager.LIST_DEVICES_OUTPUTS); + AudioManager.getDevicesStatic(AudioManager.GET_DEVICES_OUTPUTS); for (int i = 0; i < devices.length; i++) { if (devices[i].getId() == deviceId) { return devices[i]; @@ -2094,17 +2102,17 @@ public class AudioTrack /** * The message sent to apps when the routing of this AudioTrack changes if they provide - * a {#link Handler} object to addOnAudioTrackRoutingListener(). + * a {#link Handler} object to addOnRoutingChangedListener(). */ - private ArrayMap<OnAudioTrackRoutingListener, NativeRoutingEventHandlerDelegate> + private ArrayMap<OnRoutingChangedListener, NativeRoutingEventHandlerDelegate> mRoutingChangeListeners = - new ArrayMap<OnAudioTrackRoutingListener, NativeRoutingEventHandlerDelegate>(); + new ArrayMap<OnRoutingChangedListener, NativeRoutingEventHandlerDelegate>(); /** - * Adds an {@link OnAudioTrackRoutingListener} to receive notifications of routing changes + * Adds an {@link OnRoutingChangedListener} to receive notifications of routing changes * on this AudioTrack. */ - public void addOnAudioTrackRoutingListener(OnAudioTrackRoutingListener listener, + public void addOnRoutingChangedListener(OnRoutingChangedListener listener, android.os.Handler handler) { if (listener != null && !mRoutingChangeListeners.containsKey(listener)) { synchronized (mRoutingChangeListeners) { @@ -2118,10 +2126,10 @@ public class AudioTrack } /** - * Removes an {@link OnAudioTrackRoutingListener} which has been previously added + * Removes an {@link OnRoutingChangedListener} which has been previously added * to receive notifications of changes to the set of connected audio devices. */ - public void removeOnAudioTrackRoutingListener(OnAudioTrackRoutingListener listener) { + public void removeOnRoutingChangedListener(OnRoutingChangedListener listener) { synchronized (mRoutingChangeListeners) { if (mRoutingChangeListeners.containsKey(listener)) { mRoutingChangeListeners.remove(listener); @@ -2236,7 +2244,7 @@ public class AudioTrack private final Handler mHandler; NativeRoutingEventHandlerDelegate(final AudioTrack track, - final OnAudioTrackRoutingListener listener, + final OnRoutingChangedListener listener, Handler handler) { // find the looper for our new event handler Looper looper; @@ -2259,7 +2267,7 @@ public class AudioTrack switch(msg.what) { case AudioSystem.NATIVE_EVENT_ROUTING_CHANGE: if (listener != null) { - listener.onAudioTrackRouting(track); + listener.onRoutingChanged(track); } break; default: diff --git a/media/java/android/media/OnAudioDeviceConnectionListener.java b/media/java/android/media/OnAudioDeviceConnectionListener.java index 71c135a..57e9e17 100644 --- a/media/java/android/media/OnAudioDeviceConnectionListener.java +++ b/media/java/android/media/OnAudioDeviceConnectionListener.java @@ -18,13 +18,13 @@ package android.media; /** * OnAudioDeviceConnectionListener defines the interface for notification listeners in the - * {@link AudioDevicesManager} + * {@link AudioManager} */ public interface OnAudioDeviceConnectionListener { /** - * Called by the {@link AudioDevicesManager} to indicate that an audio device has been + * Called by the {@link AudioManager} to indicate that an audio device has been * connected or disconnected. A listener will probably call the - * {@link AudioDevicesManager#listDevices} method to retrieve the current list of audio + * {@link AudioManager#getDevices} method to retrieve the current list of audio * devices. */ public void onAudioDeviceConnection(); diff --git a/media/java/android/media/OnAudioRecordRoutingListener.java b/media/java/android/media/OnAudioRecordRoutingListener.java deleted file mode 100644 index 8ff41c5..0000000 --- a/media/java/android/media/OnAudioRecordRoutingListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.media; - -/** - * OnAudioDeviceConnectionListener defines the interface for notification listeners in the - * {@link AudioDevicesManager} - */ -public interface OnAudioRecordRoutingListener { - /** - * Called when the routing of an AudioRecord changes from either and explicit or - * policy rerouting. - */ - public void onAudioRecordRouting(AudioRecord audioRecord); -} diff --git a/media/java/android/media/OnAudioTrackRoutingListener.java b/media/java/android/media/OnAudioTrackRoutingListener.java deleted file mode 100644 index 18c72ef..0000000 --- a/media/java/android/media/OnAudioTrackRoutingListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.media; - -/** - * OnAudioDeviceConnectionListener defines the interface for notification listeners in the - * {@link AudioDevicesManager} - */ -public interface OnAudioTrackRoutingListener { - /** - * Called when the routing of an AudioTrack changes from either and explicit or - * policy rerouting. - */ - public void onAudioTrackRouting(AudioTrack audioTrack); -} |