From d138e4e751b821ea6918faf870580f4f7a9b138a Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 15 May 2015 16:41:15 -0700 Subject: AudioService: add missing audio becoming noisy intent Add missing audio becoming noisy intent when the bluetooth service is disconnected. Bug: 21160886. Change-Id: Idd96610a0ff824bd6337c37df60fa13f5bc6e54b --- services/core/java/com/android/server/audio/AudioService.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'services/core/java/com/android/server/audio/AudioService.java') diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 6c83192..9f35843 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -2862,8 +2862,11 @@ public class AudioService extends IAudioService.Stub { } } if (toRemove != null) { + int delay = checkSendBecomingNoisyIntent( + AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, + 0); for (int i = 0; i < toRemove.size(); i++) { - makeA2dpDeviceUnavailableNow(toRemove.valueAt(i)); + makeA2dpDeviceUnavailableLater(toRemove.valueAt(i), delay); } } } @@ -4426,7 +4429,7 @@ public class AudioService extends IAudioService.Stub { } // must be called synchronized on mConnectedDevices - private void makeA2dpDeviceUnavailableLater(String address) { + private void makeA2dpDeviceUnavailableLater(String address, int delayMs) { // prevent any activity on the A2DP audio output to avoid unwanted // reconnection of the sink. AudioSystem.setParameters("A2dpSuspended=true"); @@ -4435,7 +4438,7 @@ public class AudioService extends IAudioService.Stub { makeDeviceListKey(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, address)); // send the delayed message to make the device unavailable later Message msg = mAudioHandler.obtainMessage(MSG_BTA2DP_DOCK_TIMEOUT, address); - mAudioHandler.sendMessageDelayed(msg, BTA2DP_DOCK_TIMEOUT_MILLIS); + mAudioHandler.sendMessageDelayed(msg, delayMs); } @@ -4492,7 +4495,7 @@ public class AudioService extends IAudioService.Stub { // introduction of a delay for transient disconnections of docks when // power is rapidly turned off/on, this message will be canceled if // we reconnect the dock under a preset delay - makeA2dpDeviceUnavailableLater(address); + makeA2dpDeviceUnavailableLater(address, BTA2DP_DOCK_TIMEOUT_MILLIS); // the next time isConnected is evaluated, it will be false for the dock } } else { -- cgit v1.1