am 36e50968: Merge "Issue: turning on bluetooth headset in call doesn\'t change route (1/2)." into lmp-dev
* commit '36e50968e104037636b0898ec476944d72cf8b88':
Issue: turning on bluetooth headset in call doesn't change route (1/2).
diff --git a/src/com/android/server/telecom/BluetoothPhoneService.java b/src/com/android/server/telecom/BluetoothPhoneService.java
index 443e7c3..62f4f5a 100644
--- a/src/com/android/server/telecom/BluetoothPhoneService.java
+++ b/src/com/android/server/telecom/BluetoothPhoneService.java
@@ -299,7 +299,7 @@
case MSG_QUERY_PHONE_STATE:
try {
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(true /* force */);
} finally {
if (request != null) {
request.setResult(true);
@@ -317,28 +317,28 @@
private CallsManagerListener mCallsManagerListener = new CallsManagerListenerBase() {
@Override
public void onCallAdded(Call call) {
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(false /* force */);
}
@Override
public void onCallRemoved(Call call) {
mClccIndexMap.remove(call);
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(false /* force */);
}
@Override
public void onCallStateChanged(Call call, int oldState, int newState) {
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(false /* force */);
}
@Override
public void onForegroundCallChanged(Call oldForegroundCall, Call newForegroundCall) {
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(false /* force */);
}
@Override
public void onIsConferencedChanged(Call call) {
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(false /* force */);
}
};
@@ -412,7 +412,7 @@
registerReceiver(mBluetoothAdapterReceiver, intentFilter);
CallsManager.getInstance().addListener(mCallsManagerListener);
- updateHeadsetWithCallState();
+ updateHeadsetWithCallState(false /* force */);
}
@Override
@@ -614,7 +614,14 @@
return i;
}
- private void updateHeadsetWithCallState() {
+ /**
+ * Sends an update of the current call state to the current Headset.
+ *
+ * @param force {@code true} if the headset state should be sent regardless if no changes to the
+ * state have occurred, {@code false} if the state should only be sent if the state has
+ * changed.
+ */
+ private void updateHeadsetWithCallState(boolean force) {
CallsManager callsManager = getCallsManager();
Call activeCall = callsManager.getActiveCall();
Call ringingCall = callsManager.getRingingCall();
@@ -655,7 +662,8 @@
numHeldCalls != mNumHeldCalls ||
bluetoothCallState != mBluetoothCallState ||
!TextUtils.equals(ringingAddress, mRingingAddress) ||
- ringingAddressType != mRingingAddressType)) {
+ ringingAddressType != mRingingAddressType ||
+ force)) {
// If the call is transitioning into the alerting state, send DIALING first.
// Some devices expect to see a DIALING state prior to seeing an ALERTING state