summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jean-Michel Trivi <jmtrivi@google.com> 2019-05-30 12:48:25 -0700
committer android-build-merger <android-build-merger@google.com> 2019-05-30 12:48:25 -0700
commite0cc30bcb8f41faa32c922e1af326ca453a95c14 (patch)
tree61240aece6c54863d91862473c2988b32c7a5491
parentd6d018e3dc9c58eec4fe11d04b822db2d7ebe811 (diff)
parent3de2438d5ca9041dd2be32cdea9eb3fb3c210724 (diff)
Merge "AudioService: remove dead BT code" into qt-dev
am: 3de2438d5c Change-Id: Id3c951bff43330450e53439d68634d96a3a64802
-rw-r--r--media/java/android/media/AudioManager.java32
-rw-r--r--media/java/android/media/IAudioService.aidl3
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceBroker.java30
-rw-r--r--services/core/java/com/android/server/audio/AudioDeviceInventory.java43
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java21
5 files changed, 1 insertions, 128 deletions
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 2541982e5a5a..2d6cd242c702 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -4274,38 +4274,6 @@ public class AudioManager {
}
}
- /**
- * Indicate A2DP source or sink active device change and eventually suppress
- * the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent.
- * This operation is asynchronous but its execution will still be sequentially scheduled
- * relative to calls to {@link #setBluetoothHearingAidDeviceConnectionState(BluetoothDevice,
- * int, boolean, int)} and
- * {@link #handleBluetoothA2dpDeviceConfigChange(BluetoothDevice)}.
- * @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})
- * @param a2dpVolume New volume for the connecting device. Does nothing if
- * disconnecting. Pass value -1 in case you want this field to be ignored
- * @param suppressNoisyIntent if true the
- * {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent will not be sent.
- * @return a delay in ms that the caller should wait before broadcasting
- * BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED intent.
- * {@hide}
- */
- public void handleBluetoothA2dpActiveDeviceChange(
- BluetoothDevice device, int state, int profile,
- boolean suppressNoisyIntent, int a2dpVolume) {
- final IAudioService service = getService();
- try {
- service.handleBluetoothA2dpActiveDeviceChange(device,
- state, profile, suppressNoisyIntent, a2dpVolume);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
-
/** {@hide} */
public IRingtonePlayer getRingtonePlayer() {
try {
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index a790441aa36e..71f52a1b7d8e 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -178,9 +178,6 @@ interface IAudioService {
void handleBluetoothA2dpDeviceConfigChange(in BluetoothDevice device);
- void handleBluetoothA2dpActiveDeviceChange(in BluetoothDevice device,
- int state, int profile, boolean suppressNoisyIntent, int a2dpVolume);
-
@UnsupportedAppUsage
AudioRoutesInfo startWatchingRoutes(in IAudioRoutesObserver observer);
diff --git a/services/core/java/com/android/server/audio/AudioDeviceBroker.java b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
index a0522e3971e7..fcd6a0aacd92 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceBroker.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceBroker.java
@@ -241,15 +241,6 @@ import com.android.internal.annotations.GuardedBy;
sendLMsgNoDelay(MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT, SENDMSG_QUEUE, info);
}
- /*package*/ void postBluetoothA2dpDeviceConfigChangeExt(
- @NonNull BluetoothDevice device,
- @AudioService.BtProfileConnectionState int state, int profile,
- boolean suppressNoisyIntent, int a2dpVolume) {
- final BtDeviceConnectionInfo info = new BtDeviceConnectionInfo(device, state, profile,
- suppressNoisyIntent, a2dpVolume);
- sendLMsgNoDelay(MSG_L_A2DP_ACTIVE_DEVICE_CHANGE_EXT, SENDMSG_QUEUE, info);
- }
-
private static final class HearingAidDeviceConnectionInfo {
final @NonNull BluetoothDevice mDevice;
final @AudioService.BtProfileConnectionState int mState;
@@ -862,22 +853,6 @@ import com.android.internal.annotations.GuardedBy;
info.mDevice, info.mState, info.mSupprNoisy, info.mMusicDevice);
}
} break;
- case MSG_L_A2DP_ACTIVE_DEVICE_CHANGE_EXT: {
- final BtDeviceConnectionInfo info = (BtDeviceConnectionInfo) msg.obj;
- AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent(
- "handleBluetoothA2dpActiveDeviceChangeExt "
- + " state=" + info.mState
- // only querying address as this is the only readily available
- // field on the device
- + " addr=" + info.mDevice.getAddress()
- + " prof=" + info.mProfile + " supprNoisy=" + info.mSupprNoisy
- + " vol=" + info.mVolume)).printLog(TAG));
- synchronized (mDeviceStateLock) {
- mDeviceInventory.handleBluetoothA2dpActiveDeviceChangeExt(
- info.mDevice, info.mState, info.mProfile,
- info.mSupprNoisy, info.mVolume);
- }
- } break;
default:
Log.wtf(TAG, "Invalid message " + msg.what);
}
@@ -925,10 +900,8 @@ import com.android.internal.annotations.GuardedBy;
private static final int MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT = 27;
// process external command to (dis)connect a hearing aid device
private static final int MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT = 28;
- // process external command to (dis)connect or change active A2DP device
- private static final int MSG_L_A2DP_ACTIVE_DEVICE_CHANGE_EXT = 29;
// a ScoClient died in BtHelper
- private static final int MSG_L_SCOCLIENT_DIED = 30;
+ private static final int MSG_L_SCOCLIENT_DIED = 29;
private static boolean isMessageHandledUnderWakelock(int msgId) {
@@ -943,7 +916,6 @@ import com.android.internal.annotations.GuardedBy;
case MSG_L_A2DP_ACTIVE_DEVICE_CHANGE:
case MSG_L_A2DP_DEVICE_CONNECTION_CHANGE_EXT:
case MSG_L_HEARING_AID_DEVICE_CONNECTION_CHANGE_EXT:
- case MSG_L_A2DP_ACTIVE_DEVICE_CHANGE_EXT:
return true;
default:
return false;
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index 887c90873bdd..99b97cbf7dbc 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -570,49 +570,6 @@ public final class AudioDeviceInventory {
}
}
- /*package*/ void handleBluetoothA2dpActiveDeviceChangeExt(
- @NonNull BluetoothDevice device,
- @AudioService.BtProfileConnectionState int state, int profile,
- boolean suppressNoisyIntent, int a2dpVolume) {
- if (state == BluetoothProfile.STATE_DISCONNECTED) {
- mDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
- device, state, profile, suppressNoisyIntent, a2dpVolume);
- return;
- }
- // state == BluetoothProfile.STATE_CONNECTED
- synchronized (mConnectedDevices) {
- final String address = device.getAddress();
- final int a2dpCodec = mDeviceBroker.getA2dpCodec(device);
- final String deviceKey = DeviceInfo.makeDeviceListKey(
- AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address);
- DeviceInfo deviceInfo = mConnectedDevices.get(deviceKey);
- if (deviceInfo != null) {
- // Device config change for matching A2DP device
- mDeviceBroker.postBluetoothA2dpDeviceConfigChange(device);
- return;
- }
- for (int i = 0; i < mConnectedDevices.size(); i++) {
- deviceInfo = mConnectedDevices.valueAt(i);
- if (deviceInfo.mDeviceType != AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
- continue;
- }
- // A2DP device exists, handle active device change
- final String existingDevicekey = mConnectedDevices.keyAt(i);
- mConnectedDevices.remove(existingDevicekey);
- mConnectedDevices.put(deviceKey, new DeviceInfo(
- AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, BtHelper.getName(device),
- address, a2dpCodec));
- mDeviceBroker.postA2dpActiveDeviceChange(
- new BtHelper.BluetoothA2dpDeviceInfo(
- device, a2dpVolume, a2dpCodec));
- return;
- }
- }
- // New A2DP device connection
- mDeviceBroker.postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent(
- device, state, profile, suppressNoisyIntent, a2dpVolume);
- }
-
/*package*/ int setWiredDeviceConnectionState(int type, @AudioService.ConnectionState int state,
String address, String name, String caller) {
synchronized (mConnectedDevices) {
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 15e8851a6a2b..30035c8c365b 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -4382,27 +4382,6 @@ public class AudioService extends IAudioService.Stub
mDeviceBroker.postBluetoothA2dpDeviceConfigChange(device);
}
- /**
- * @see AudioManager#handleBluetoothA2dpActiveDeviceChange(BluetoothDevice, int, int,
- * boolean, int)
- */
- public void handleBluetoothA2dpActiveDeviceChange(
- BluetoothDevice device, int state, int profile, boolean suppressNoisyIntent,
- int a2dpVolume) {
- if (device == null) {
- throw new IllegalArgumentException("Illegal null device");
- }
- if (profile != BluetoothProfile.A2DP && profile != BluetoothProfile.A2DP_SINK) {
- throw new IllegalArgumentException("invalid profile " + profile);
- }
- if (state != BluetoothProfile.STATE_CONNECTED
- && state != BluetoothProfile.STATE_DISCONNECTED) {
- throw new IllegalArgumentException("Invalid state " + state);
- }
- mDeviceBroker.postBluetoothA2dpDeviceConfigChangeExt(device, state, profile,
- suppressNoisyIntent, a2dpVolume);
- }
-
private static final int DEVICE_MEDIA_UNMUTED_ON_PLUG =
AudioSystem.DEVICE_OUT_WIRED_HEADSET | AudioSystem.DEVICE_OUT_WIRED_HEADPHONE |
AudioSystem.DEVICE_OUT_LINE |