Loading core/java/android/bluetooth/BluetoothA2dp.java +2 −2 Original line number Diff line number Diff line Loading @@ -434,7 +434,7 @@ public final class BluetoothA2dp implements BluetoothProfile { * {@inheritDoc} */ @Override public int getConnectionState(BluetoothDevice device) { public @BtProfileState int getConnectionState(BluetoothDevice device) { if (VDBG) log("getState(" + device + ")"); try { mServiceLock.readLock().lock(); Loading Loading @@ -689,7 +689,7 @@ public final class BluetoothA2dp implements BluetoothProfile { * @hide */ @UnsupportedAppUsage public BluetoothCodecStatus getCodecStatus(BluetoothDevice device) { public @Nullable BluetoothCodecStatus getCodecStatus(BluetoothDevice device) { if (DBG) Log.d(TAG, "getCodecStatus(" + device + ")"); try { mServiceLock.readLock().lock(); Loading core/java/android/bluetooth/BluetoothCodecStatus.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.bluetooth; import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; Loading @@ -42,7 +43,7 @@ public final class BluetoothCodecStatus implements Parcelable { public static final String EXTRA_CODEC_STATUS = "android.bluetooth.codec.extra.CODEC_STATUS"; private final BluetoothCodecConfig mCodecConfig; private final @Nullable BluetoothCodecConfig mCodecConfig; private final BluetoothCodecConfig[] mCodecsLocalCapabilities; private final BluetoothCodecConfig[] mCodecsSelectableCapabilities; Loading Loading @@ -140,7 +141,7 @@ public final class BluetoothCodecStatus implements Parcelable { * @return the current codec configuration */ @UnsupportedAppUsage public BluetoothCodecConfig getCodecConfig() { public @Nullable BluetoothCodecConfig getCodecConfig() { return mCodecConfig; } Loading core/java/android/bluetooth/BluetoothProfile.java +13 −0 Original line number Diff line number Diff line Loading @@ -18,11 +18,14 @@ package android.bluetooth; import android.Manifest; import android.annotation.IntDef; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.UnsupportedAppUsage; import android.os.Build; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; /** Loading Loading @@ -60,6 +63,16 @@ public interface BluetoothProfile { /** The profile is in disconnecting state */ int STATE_DISCONNECTING = 3; /** @hide */ @IntDef({ STATE_DISCONNECTED, STATE_CONNECTING, STATE_CONNECTED, STATE_DISCONNECTING, }) @Retention(RetentionPolicy.SOURCE) public @interface BtProfileState {} /** * Headset and Handsfree profile */ Loading media/java/android/media/AudioManager.java +5 −26 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.ComponentName; import android.content.Context; import android.content.Intent; Loading Loading @@ -3988,34 +3989,12 @@ public class AudioManager { return delay; } /** * Indicate A2DP source or sink connection state change. * @param device Bluetooth device connected/disconnected * @param state new connection state (BluetoothProfile.STATE_xxx) * @param profile profile for the A2DP device * (either {@link android.bluetooth.BluetoothProfile.A2DP} or * {@link android.bluetooth.BluetoothProfile.A2DP_SINK}) * @return a delay in ms that the caller should wait before broadcasting * BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED intent. * {@hide} */ public int setBluetoothA2dpDeviceConnectionState(BluetoothDevice device, int state, int profile) { final IAudioService service = getService(); int delay = 0; try { delay = service.setBluetoothA2dpDeviceConnectionState(device, state, profile); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } return delay; } /** * Indicate A2DP source or sink connection state change and eventually suppress * the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent. * @param device Bluetooth device connected/disconnected * @param state new connection state (BluetoothProfile.STATE_xxx) * @param state new connection state, {@link BluetoothProfile#STATE_CONNECTED} * or {@link BluetoothProfile#STATE_DISCONNECTED} * @param profile profile for the A2DP device * @param a2dpVolume New volume for the connecting device. Does nothing if disconnecting. * (either {@link android.bluetooth.BluetoothProfile.A2DP} or Loading @@ -4027,8 +4006,8 @@ public class AudioManager { * {@hide} */ public int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent( BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent, int a2dpVolume) { BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent, int a2dpVolume) { final IAudioService service = getService(); int delay = 0; try { Loading media/java/android/media/AudioSystem.java +12 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ import java.util.Map; */ public class AudioSystem { private static final boolean DEBUG_VOLUME = true; private static final String TAG = "AudioSystem"; /* These values must be kept in sync with system/audio.h */ /* Loading Loading @@ -879,6 +881,15 @@ public class AudioSystem } } /** Wrapper for native methods called from AudioService */ public static int setStreamVolumeIndexAS(int stream, int index, int device) { if (DEBUG_VOLUME) { Log.i(TAG, "setStreamVolumeIndex: " + STREAM_NAMES[stream] + " dev=" + Integer.toHexString(device) + " idx=" + index); } return setStreamVolumeIndex(stream, index, device); } // usage for AudioRecord.startRecordingSync(), must match AudioSystem::sync_event_t public static final int SYNC_EVENT_NONE = 0; public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1; Loading Loading @@ -906,7 +917,7 @@ public class AudioSystem @UnsupportedAppUsage public static native int initStreamVolume(int stream, int indexMin, int indexMax); @UnsupportedAppUsage public static native int setStreamVolumeIndex(int stream, int index, int device); private static native int setStreamVolumeIndex(int stream, int index, int device); public static native int getStreamVolumeIndex(int stream, int device); public static native int setMasterVolume(float value); public static native float getMasterVolume(); Loading Loading
core/java/android/bluetooth/BluetoothA2dp.java +2 −2 Original line number Diff line number Diff line Loading @@ -434,7 +434,7 @@ public final class BluetoothA2dp implements BluetoothProfile { * {@inheritDoc} */ @Override public int getConnectionState(BluetoothDevice device) { public @BtProfileState int getConnectionState(BluetoothDevice device) { if (VDBG) log("getState(" + device + ")"); try { mServiceLock.readLock().lock(); Loading Loading @@ -689,7 +689,7 @@ public final class BluetoothA2dp implements BluetoothProfile { * @hide */ @UnsupportedAppUsage public BluetoothCodecStatus getCodecStatus(BluetoothDevice device) { public @Nullable BluetoothCodecStatus getCodecStatus(BluetoothDevice device) { if (DBG) Log.d(TAG, "getCodecStatus(" + device + ")"); try { mServiceLock.readLock().lock(); Loading
core/java/android/bluetooth/BluetoothCodecStatus.java +3 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.bluetooth; import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; import android.os.Parcel; import android.os.Parcelable; Loading @@ -42,7 +43,7 @@ public final class BluetoothCodecStatus implements Parcelable { public static final String EXTRA_CODEC_STATUS = "android.bluetooth.codec.extra.CODEC_STATUS"; private final BluetoothCodecConfig mCodecConfig; private final @Nullable BluetoothCodecConfig mCodecConfig; private final BluetoothCodecConfig[] mCodecsLocalCapabilities; private final BluetoothCodecConfig[] mCodecsSelectableCapabilities; Loading Loading @@ -140,7 +141,7 @@ public final class BluetoothCodecStatus implements Parcelable { * @return the current codec configuration */ @UnsupportedAppUsage public BluetoothCodecConfig getCodecConfig() { public @Nullable BluetoothCodecConfig getCodecConfig() { return mCodecConfig; } Loading
core/java/android/bluetooth/BluetoothProfile.java +13 −0 Original line number Diff line number Diff line Loading @@ -18,11 +18,14 @@ package android.bluetooth; import android.Manifest; import android.annotation.IntDef; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.UnsupportedAppUsage; import android.os.Build; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; /** Loading Loading @@ -60,6 +63,16 @@ public interface BluetoothProfile { /** The profile is in disconnecting state */ int STATE_DISCONNECTING = 3; /** @hide */ @IntDef({ STATE_DISCONNECTED, STATE_CONNECTING, STATE_CONNECTED, STATE_DISCONNECTING, }) @Retention(RetentionPolicy.SOURCE) public @interface BtProfileState {} /** * Headset and Handsfree profile */ Loading
media/java/android/media/AudioManager.java +5 −26 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.ComponentName; import android.content.Context; import android.content.Intent; Loading Loading @@ -3988,34 +3989,12 @@ public class AudioManager { return delay; } /** * Indicate A2DP source or sink connection state change. * @param device Bluetooth device connected/disconnected * @param state new connection state (BluetoothProfile.STATE_xxx) * @param profile profile for the A2DP device * (either {@link android.bluetooth.BluetoothProfile.A2DP} or * {@link android.bluetooth.BluetoothProfile.A2DP_SINK}) * @return a delay in ms that the caller should wait before broadcasting * BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED intent. * {@hide} */ public int setBluetoothA2dpDeviceConnectionState(BluetoothDevice device, int state, int profile) { final IAudioService service = getService(); int delay = 0; try { delay = service.setBluetoothA2dpDeviceConnectionState(device, state, profile); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } return delay; } /** * Indicate A2DP source or sink connection state change and eventually suppress * the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent. * @param device Bluetooth device connected/disconnected * @param state new connection state (BluetoothProfile.STATE_xxx) * @param state new connection state, {@link BluetoothProfile#STATE_CONNECTED} * or {@link BluetoothProfile#STATE_DISCONNECTED} * @param profile profile for the A2DP device * @param a2dpVolume New volume for the connecting device. Does nothing if disconnecting. * (either {@link android.bluetooth.BluetoothProfile.A2DP} or Loading @@ -4027,8 +4006,8 @@ public class AudioManager { * {@hide} */ public int setBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent( BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent, int a2dpVolume) { BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent, int a2dpVolume) { final IAudioService service = getService(); int delay = 0; try { Loading
media/java/android/media/AudioSystem.java +12 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ import java.util.Map; */ public class AudioSystem { private static final boolean DEBUG_VOLUME = true; private static final String TAG = "AudioSystem"; /* These values must be kept in sync with system/audio.h */ /* Loading Loading @@ -879,6 +881,15 @@ public class AudioSystem } } /** Wrapper for native methods called from AudioService */ public static int setStreamVolumeIndexAS(int stream, int index, int device) { if (DEBUG_VOLUME) { Log.i(TAG, "setStreamVolumeIndex: " + STREAM_NAMES[stream] + " dev=" + Integer.toHexString(device) + " idx=" + index); } return setStreamVolumeIndex(stream, index, device); } // usage for AudioRecord.startRecordingSync(), must match AudioSystem::sync_event_t public static final int SYNC_EVENT_NONE = 0; public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1; Loading Loading @@ -906,7 +917,7 @@ public class AudioSystem @UnsupportedAppUsage public static native int initStreamVolume(int stream, int indexMin, int indexMax); @UnsupportedAppUsage public static native int setStreamVolumeIndex(int stream, int index, int device); private static native int setStreamVolumeIndex(int stream, int index, int device); public static native int getStreamVolumeIndex(int stream, int device); public static native int setMasterVolume(float value); public static native float getMasterVolume(); Loading