AudioService: add missing audio becoming noisy intent

Add missing audio becoming noisy intent when the bluetooth
service is disconnected.

Bug: 21160886.
Change-Id: Idd96610a0ff824bd6337c37df60fa13f5bc6e54b
This commit is contained in:
Eric Laurent
2015-05-15 16:41:15 -07:00
parent 2a576d9ec1
commit d138e4e751

View File

@@ -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 {