Merge "Update foreground calls with child-parent call changes." into lmp-dev
diff --git a/src/com/android/server/telecom/BluetoothPhoneService.java b/src/com/android/server/telecom/BluetoothPhoneService.java
index a2688a1..43be93a 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
@@ -615,7 +615,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();
@@ -656,7 +663,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