Merge "AudioDeviceInventory: do not clear a2dp/Le suspend on device connection" into udc-dev am: b3ea50636a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23601443

Change-Id: I1ad1296ee8262db874979ffb5356533b5ea6be6d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Eric Laurent
2023-06-12 19:20:15 +00:00
committed by Automerger Merge Worker
4 changed files with 14 additions and 11 deletions

View File

@@ -1018,13 +1018,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
} }
} }
/*package*/ void clearA2dpSuspended() { /*package*/ void clearA2dpSuspended(boolean internalOnly) {
if (AudioService.DEBUG_COMM_RTE) { if (AudioService.DEBUG_COMM_RTE) {
Log.v(TAG, "clearA2dpSuspended"); Log.v(TAG, "clearA2dpSuspended, internalOnly: " + internalOnly);
} }
synchronized (mBluetoothAudioStateLock) { synchronized (mBluetoothAudioStateLock) {
mBluetoothA2dpSuspendedInt = false; mBluetoothA2dpSuspendedInt = false;
mBluetoothA2dpSuspendedExt = false; if (!internalOnly) {
mBluetoothA2dpSuspendedExt = false;
}
updateAudioHalBluetoothState(); updateAudioHalBluetoothState();
} }
} }
@@ -1046,13 +1048,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
} }
} }
/*package*/ void clearLeAudioSuspended() { /*package*/ void clearLeAudioSuspended(boolean internalOnly) {
if (AudioService.DEBUG_COMM_RTE) { if (AudioService.DEBUG_COMM_RTE) {
Log.v(TAG, "clearLeAudioSuspended"); Log.v(TAG, "clearLeAudioSuspended, internalOnly: " + internalOnly);
} }
synchronized (mBluetoothAudioStateLock) { synchronized (mBluetoothAudioStateLock) {
mBluetoothLeSuspendedInt = false; mBluetoothLeSuspendedInt = false;
mBluetoothLeSuspendedExt = false; if (!internalOnly) {
mBluetoothLeSuspendedExt = false;
}
updateAudioHalBluetoothState(); updateAudioHalBluetoothState();
} }
} }

View File

@@ -1547,7 +1547,7 @@ public class AudioDeviceInventory {
} }
// Reset A2DP suspend state each time a new sink is connected // Reset A2DP suspend state each time a new sink is connected
mDeviceBroker.clearA2dpSuspended(); mDeviceBroker.clearA2dpSuspended(true /* internalOnly */);
// The convention for head tracking sensors associated with A2DP devices is to // The convention for head tracking sensors associated with A2DP devices is to
// use a UUID derived from the MAC address as follows: // use a UUID derived from the MAC address as follows:
@@ -1970,7 +1970,7 @@ public class AudioDeviceInventory {
"LE Audio device addr=" + address + " now available").printLog(TAG)); "LE Audio device addr=" + address + " now available").printLog(TAG));
} }
// Reset LEA suspend state each time a new sink is connected // Reset LEA suspend state each time a new sink is connected
mDeviceBroker.clearLeAudioSuspended(); mDeviceBroker.clearLeAudioSuspended(true /* internalOnly */);
UUID sensorUuid = UuidUtils.uuidFromAudioDeviceAttributes(ada); UUID sensorUuid = UuidUtils.uuidFromAudioDeviceAttributes(ada);
mConnectedDevices.put(DeviceInfo.makeDeviceListKey(device, address), mConnectedDevices.put(DeviceInfo.makeDeviceListKey(device, address),

View File

@@ -353,7 +353,6 @@ public class AudioService extends IAudioService.Stub
private static final int MSG_PLAY_SOUND_EFFECT = 5; private static final int MSG_PLAY_SOUND_EFFECT = 5;
private static final int MSG_LOAD_SOUND_EFFECTS = 7; private static final int MSG_LOAD_SOUND_EFFECTS = 7;
private static final int MSG_SET_FORCE_USE = 8; private static final int MSG_SET_FORCE_USE = 8;
private static final int MSG_BT_HEADSET_CNCT_FAILED = 9;
private static final int MSG_SET_ALL_VOLUMES = 10; private static final int MSG_SET_ALL_VOLUMES = 10;
private static final int MSG_UNLOAD_SOUND_EFFECTS = 15; private static final int MSG_UNLOAD_SOUND_EFFECTS = 15;
private static final int MSG_SYSTEM_READY = 16; private static final int MSG_SYSTEM_READY = 16;

View File

@@ -445,8 +445,8 @@ public class BtHelper {
/*package*/ synchronized void resetBluetoothSco() { /*package*/ synchronized void resetBluetoothSco() {
mScoAudioState = SCO_STATE_INACTIVE; mScoAudioState = SCO_STATE_INACTIVE;
broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED); broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED);
mDeviceBroker.clearA2dpSuspended(); mDeviceBroker.clearA2dpSuspended(false /* internalOnly */);
mDeviceBroker.clearLeAudioSuspended(); mDeviceBroker.clearLeAudioSuspended(false /* internalOnly */);
mDeviceBroker.setBluetoothScoOn(false, "resetBluetoothSco"); mDeviceBroker.setBluetoothScoOn(false, "resetBluetoothSco");
} }