Merge "Add pending intent immutability to Call block disabled notification." into sc-dev
diff --git a/res/values-fr-rCA/strings.xml b/res/values-fr-rCA/strings.xml
index 74faab9..5061eda 100644
--- a/res/values-fr-rCA/strings.xml
+++ b/res/values-fr-rCA/strings.xml
@@ -104,7 +104,7 @@
<string name="alert_redirect_outgoing_call_or_not" msgid="665409645789521636">"Choisissez comment passer cet appel"</string>
<string name="alert_place_outgoing_call_with_redirection" msgid="5221065030959024121">"Rediriger l\'appel en utilisant <xliff:g id="OTHER_APP">%1$s</xliff:g>"</string>
<string name="alert_place_unredirect_outgoing_call" msgid="2467608535225764006">"Appeler en utilisant mon numéro de téléphone"</string>
- <string name="alert_redirect_outgoing_call_timeout" msgid="5568101425637373060">"Impossible de passer l\'appel au moyen de l\'application <xliff:g id="OTHER_APP">%1$s</xliff:g>. Essayez d\'utiliser une autre application de redirection d\'appels ou de communiquer avec le concepteur de l\'application pour obtenir de l\'aide."</string>
+ <string name="alert_redirect_outgoing_call_timeout" msgid="5568101425637373060">"Impossible de passer l\'appel au moyen de l\'application <xliff:g id="OTHER_APP">%1$s</xliff:g>. Essayez d\'utiliser une autre application de redirection d\'appels ou de communiquer avec le développeur de l\'application pour obtenir de l\'aide."</string>
<string name="phone_settings_call_blocking_txt" msgid="7311523114822507178">"Blocage des appels"</string>
<string name="phone_settings_number_not_in_contact_txt" msgid="2602249106007265757">"Numéros non répertoriés dans les contacts"</string>
<string name="phone_settings_number_not_in_contact_summary_txt" msgid="963327038085718969">"Bloquer les numéros non répertoriés dans vos contacts"</string>
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index ccce777..575873b 100755
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1288,8 +1288,8 @@
if (call.isSelfManaged()) {
// Self managed calls will always be voip audio mode.
call.setIsVoipAudioMode(true);
- call.setVisibleToInCallService(phoneAccountExtras != null
- && phoneAccountExtras.getBoolean(
+ call.setVisibleToInCallService(phoneAccountExtras == null
+ || phoneAccountExtras.getBoolean(
PhoneAccount.EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE, true));
} else {
// Incoming call is managed, the active call is self-managed and can't be held.
@@ -1554,8 +1554,8 @@
if (isSelfManaged) {
// Self-managed calls will ALWAYS use voip audio mode.
call.setIsVoipAudioMode(true);
- call.setVisibleToInCallService(phoneAccountExtra != null
- && phoneAccountExtra.getBoolean(
+ call.setVisibleToInCallService(phoneAccountExtra == null
+ || phoneAccountExtra.getBoolean(
PhoneAccount.EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE, true));
}
call.setInitiatingUser(initiatingUser);
@@ -4299,7 +4299,8 @@
return false;
}
- private boolean makeRoomForOutgoingCall(Call call) {
+ @VisibleForTesting
+ public boolean makeRoomForOutgoingCall(Call call) {
// Already room!
if (!hasMaximumLiveCalls(call)) return true;
@@ -4316,6 +4317,13 @@
return true;
}
+ // If the live call is stuck in a connecting state, then we should disconnect it in favor
+ // of the new outgoing call.
+ if (liveCall.getState() == CallState.CONNECTING) {
+ liveCall.disconnect("Force disconnect CONNECTING call.");
+ return true;
+ }
+
if (hasMaximumOutgoingCalls(call)) {
Call outgoingCall = getFirstCallWithState(OUTGOING_CALL_STATES);
if (outgoingCall.getState() == CallState.SELECT_PHONE_ACCOUNT) {
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
index eccbecb..00549cb 100644
--- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
@@ -1253,6 +1253,21 @@
verify(ringingCall).reject(anyBoolean(), any(), any());
}
+ @SmallTest
+ @Test
+ public void testMakeRoomForOutgoingCallConnecting() {
+ Call ongoingCall = addSpyCall(SIM_2_HANDLE, CallState.CONNECTING);
+
+ Call newCall = createCall(SIM_1_HANDLE, CallState.NEW);
+ when(mComponentContextFixture.getTelephonyManager().isEmergencyNumber(any()))
+ .thenReturn(false);
+ newCall.setHandle(Uri.fromParts("tel", "5551213", null),
+ TelecomManager.PRESENTATION_ALLOWED);
+
+ assertTrue(mCallsManager.makeRoomForOutgoingCall(newCall));
+ verify(ongoingCall).disconnect(anyLong(), anyString());
+ }
+
/**
* Verifies that changes to a {@link PhoneAccount}'s
* {@link PhoneAccount#CAPABILITY_VIDEO_CALLING} capability will be reflected on a call.