Merge "Add test cases for isOnlyNonTerrestrialNetwork() methoid" into main
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index e40aac9..2a25ded 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -598,7 +598,7 @@
     <string name="hac_mode_summary" msgid="7774989500136009881">"Activar compatibilidad con audífono"</string>
     <string name="rtt_mode_title" msgid="3075948111362818043">"Llamada de Texto en tiempo real (RTT)"</string>
     <string name="rtt_mode_summary" msgid="8631541375609989562">"Permitir la mensajería en las llamadas de voz"</string>
-    <string name="rtt_mode_more_information" msgid="587500128658756318">"El RTT brinda asistencia a las personas sordas o hipoacúsicas, que tienen algún trastorno del habla o necesitan una transcripción además de la voz.&lt;br&gt; &lt;a href=<xliff:g id="URL">http://support.google.com/mobile?p=telephony_rtt</xliff:g>&gt;Más información&lt;/a&gt;\n       &lt;br&gt;&lt;br&gt; - Las llamadas de RTT se guardan como las transcripciones de los mensajes\n       &lt;br&gt; - El RTT no está disponible para las videollamadas"</string>
+    <string name="rtt_mode_more_information" msgid="587500128658756318">"El RTT brinda asistencia en llamadas a las personas sordas o con hipoacusia, las que tienen algún trastorno del habla o las que necesitan una transcripción además de la voz.&lt;br&gt; &lt;a href=<xliff:g id="URL">http://support.google.com/mobile?p=telephony_rtt</xliff:g>&gt;Más información&lt;/a&gt;\n       &lt;br&gt;&lt;br&gt; - Las llamadas de RTT se guardan como las transcripciones de los mensajes\n       &lt;br&gt; - El RTT no está disponible para las videollamadas"</string>
     <string name="no_rtt_when_roaming" msgid="5268008247378355389">"Nota: La función RTT no está disponible en roaming"</string>
   <string-array name="tty_mode_entries">
     <item msgid="3238070884803849303">"TTY desactivado"</item>
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 651bbd1..b7bba84 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -18,6 +18,7 @@
 
 import static android.telephony.DomainSelectionService.SELECTOR_TYPE_CALLING;
 import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE;
+import static com.android.internal.telephony.PhoneConstants.PHONE_TYPE_GSM;
 
 import static com.android.internal.telephony.flags.Flags.carrierEnabledSatelliteFlag;
 
@@ -1088,7 +1089,7 @@
 
         if (needToTurnOnRadio || needToTurnOffSatellite) {
             final Uri resultHandle = handle;
-            final int originalPhoneType = phone.getPhoneType();
+            final int originalPhoneType = (phone == null) ? PHONE_TYPE_GSM : phone.getPhoneType();
             final Connection resultConnection = getTelephonyConnection(request, numberToDial,
                     isEmergencyNumber, resultHandle, phone);
             if (mRadioOnHelper == null) {
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 36513cf..f0d19f1 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -1483,6 +1483,40 @@
     }
 
     /**
+     * Test that the TelephonyConnectionService successfully turns radio on before placing the
+     * call when phone is null, radio off because bluetooth on and wifi calling is not enabled
+     */
+    @Test
+    @SmallTest
+    public void testCreateOutgoingCall_forWearWatch_whenPhoneIsNull() {
+        doReturn(-1).when(mPhoneUtilsProxy).getSubIdForPhoneAccountHandle(any());
+        doReturn(true).when(mDeviceState).isRadioPowerDownAllowedOnBluetooth(any());
+        doReturn(PhoneConstants.CELL_ON_FLAG).when(mDeviceState).getCellOnStatus(any());
+        Phone testPhone0 = makeTestPhone(0 /*phoneId*/, ServiceState.STATE_POWER_OFF,
+                false /*isEmergencyOnly*/);
+        Phone testPhone1 = makeTestPhone(1 /*phoneId*/, ServiceState.STATE_POWER_OFF,
+                false /*isEmergencyOnly*/);
+        doReturn(false).when(testPhone0).isRadioOn();
+        doReturn(false).when(testPhone0).isWifiCallingEnabled();
+        doReturn(false).when(testPhone1).isRadioOn();
+        doReturn(false).when(testPhone1).isWifiCallingEnabled();
+        List<Phone> phones = new ArrayList<>(2);
+        phones.add(testPhone0);
+        phones.add(testPhone1);
+        setPhones(phones);
+        setupHandleToPhoneMap(PHONE_ACCOUNT_HANDLE_1, testPhone0);
+        ConnectionRequest connectionRequest = new ConnectionRequest.Builder()
+                .setAccountHandle(PHONE_ACCOUNT_HANDLE_1)
+                .setAddress(TEST_ADDRESS)
+                .build();
+        mConnection = mTestConnectionService.onCreateOutgoingConnection(
+                PHONE_ACCOUNT_HANDLE_1, connectionRequest);
+
+        verify(mRadioOnHelper).triggerRadioOnAndListen(any(), eq(false),
+                eq(testPhone0), eq(false), eq(0));
+    }
+
+    /**
      * Test that the TelephonyConnectionService will not turns radio on before placing the
      * call when radio off because bluetooth on and wifi calling is enabled
      */