Merge "Create handle with correct scheme in MissedCallNotifier" into lmp-dev
diff --git a/src/com/android/server/telecom/BluetoothPhoneService.java b/src/com/android/server/telecom/BluetoothPhoneService.java
index 43be93a..51dbbdf 100644
--- a/src/com/android/server/telecom/BluetoothPhoneService.java
+++ b/src/com/android/server/telecom/BluetoothPhoneService.java
@@ -103,6 +103,7 @@
private int mBluetoothCallState = CALL_STATE_IDLE;
private String mRingingAddress = null;
private int mRingingAddressType = 0;
+ private Call mOldHeldCall = null;
/**
* Binder implementation of IBluetoothHeadsetPhone. Implements the command interface that the
@@ -643,7 +644,7 @@
}
int numActiveCalls = activeCall == null ? 0 : 1;
- int numHeldCalls = heldCall == null ? 0 : 1;
+ int numHeldCalls = callsManager.getNumHeldCalls();
// For conference calls which support swapping the active call within the conference
// (namely CDMA calls) we need to expose that as a held call in order for the BT device
@@ -664,6 +665,7 @@
bluetoothCallState != mBluetoothCallState ||
!TextUtils.equals(ringingAddress, mRingingAddress) ||
ringingAddressType != mRingingAddressType ||
+ heldCall != mOldHeldCall ||
force)) {
// If the call is transitioning into the alerting state, send DIALING first.
@@ -672,6 +674,7 @@
boolean sendDialingFirst = mBluetoothCallState != bluetoothCallState &&
bluetoothCallState == CALL_STATE_ALERTING;
+ mOldHeldCall = heldCall;
mNumActiveCalls = numActiveCalls;
mNumHeldCalls = numHeldCalls;
mBluetoothCallState = bluetoothCallState;
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index a70c427..05f4748 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -872,6 +872,16 @@
return getFirstCallWithState(CallState.ON_HOLD);
}
+ int getNumHeldCalls() {
+ int count = 0;
+ for (Call call : mCalls) {
+ if (call.getParentCall() == null && call.getState() == CallState.ON_HOLD) {
+ count++;
+ }
+ }
+ return count;
+ }
+
Call getFirstCallWithState(int... states) {
return getFirstCallWithState(null, states);
}
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 68c188b..5945306 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -140,12 +140,8 @@
private void onRespondedToIncomingCall(Call call) {
// Only stop the ringer if this call is the top-most incoming call.
if (getTopMostUnansweredCall() == call) {
- stopRinging();
- stopCallWaiting();
+ removeFromUnansweredCall(call);
}
-
- // We do not remove the call from mRingingCalls until the call state changes from
- // STATE_RINGING or the call is removed. see onCallStateChanged or onCallRemoved.
}
private Call getTopMostUnansweredCall() {