am 6a64a9cd: Merge "Prevent AudioService dead lock issue."
* commit '6a64a9cd26cb8096f1ea67f7c7eee788370752b0': Prevent AudioService dead lock issue.
This commit is contained in:
@@ -508,6 +508,7 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
|
|
||||||
// Reference to BluetoothA2dp to query for AbsoluteVolume.
|
// Reference to BluetoothA2dp to query for AbsoluteVolume.
|
||||||
private BluetoothA2dp mA2dp;
|
private BluetoothA2dp mA2dp;
|
||||||
|
// lock always taken synchronized on mConnectedDevices
|
||||||
private final Object mA2dpAvrcpLock = new Object();
|
private final Object mA2dpAvrcpLock = new Object();
|
||||||
// If absolute volume is supported in AVRCP device
|
// If absolute volume is supported in AVRCP device
|
||||||
private boolean mAvrcpAbsVolSupported = false;
|
private boolean mAvrcpAbsVolSupported = false;
|
||||||
@@ -2731,12 +2732,12 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
List<BluetoothDevice> deviceList;
|
List<BluetoothDevice> deviceList;
|
||||||
switch(profile) {
|
switch(profile) {
|
||||||
case BluetoothProfile.A2DP:
|
case BluetoothProfile.A2DP:
|
||||||
synchronized (mA2dpAvrcpLock) {
|
synchronized (mConnectedDevices) {
|
||||||
mA2dp = (BluetoothA2dp) proxy;
|
synchronized (mA2dpAvrcpLock) {
|
||||||
deviceList = mA2dp.getConnectedDevices();
|
mA2dp = (BluetoothA2dp) proxy;
|
||||||
if (deviceList.size() > 0) {
|
deviceList = mA2dp.getConnectedDevices();
|
||||||
btDevice = deviceList.get(0);
|
if (deviceList.size() > 0) {
|
||||||
synchronized (mConnectedDevices) {
|
btDevice = deviceList.get(0);
|
||||||
int state = mA2dp.getConnectionState(btDevice);
|
int state = mA2dp.getConnectionState(btDevice);
|
||||||
int delay = checkSendBecomingNoisyIntent(
|
int delay = checkSendBecomingNoisyIntent(
|
||||||
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
|
AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
|
||||||
@@ -2831,9 +2832,9 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
public void onServiceDisconnected(int profile) {
|
public void onServiceDisconnected(int profile) {
|
||||||
switch(profile) {
|
switch(profile) {
|
||||||
case BluetoothProfile.A2DP:
|
case BluetoothProfile.A2DP:
|
||||||
synchronized (mA2dpAvrcpLock) {
|
synchronized (mConnectedDevices) {
|
||||||
mA2dp = null;
|
synchronized (mA2dpAvrcpLock) {
|
||||||
synchronized (mConnectedDevices) {
|
mA2dp = null;
|
||||||
if (mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP)) {
|
if (mConnectedDevices.containsKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP)) {
|
||||||
makeA2dpDeviceUnavailableNow(
|
makeA2dpDeviceUnavailableNow(
|
||||||
mConnectedDevices.get(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP));
|
mConnectedDevices.get(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP));
|
||||||
|
|||||||
Reference in New Issue
Block a user