Merge "Check CarrierPriviledge for getPhoneAccountHandleForSubscriptionId" into sc-dev
diff --git a/sip/res/values-gl/strings.xml b/sip/res/values-gl/strings.xml
index 1a40bf3..a6c15d5 100644
--- a/sip/res/values-gl/strings.xml
+++ b/sip/res/values-gl/strings.xml
@@ -57,7 +57,7 @@
     <string name="proxy_address_title" msgid="4120361943254795287">"Enderezo proxy saínte"</string>
     <string name="port_title" msgid="1703586046264385110">"Número de porto"</string>
     <string name="transport_title" msgid="1661659138226029178">"Tipo de transporte"</string>
-    <string name="send_keepalive_title" msgid="5319788151608946049">"Enviar sinal conexión"</string>
+    <string name="send_keepalive_title" msgid="5319788151608946049">"Enviar sinal de conexión permanente"</string>
     <string name="advanced_settings" msgid="2704644977548662872">"Configuración opcional"</string>
     <string name="auth_username_title" msgid="9002505242616662698">"Nome de usuario da autenticación"</string>
     <string name="auth_username_summary" msgid="6346313945275377230">"Nome de usuario utilizado para a autenticación"</string>
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 4905316..672f7c8 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -382,6 +382,7 @@
     private static final int MANUFACTURER_CODE_LENGTH = 8;
 
     private static final int SET_DATA_THROTTLING_MODEM_THREW_INVALID_PARAMS = -1;
+    private static final int MODEM_DOES_NOT_SUPPORT_DATA_THROTTLING_ERROR_CODE = -2;
 
     /**
      * Experiment flag to enable erase modem config on reset network, default value is false
@@ -1802,6 +1803,8 @@
                                 .THERMAL_MITIGATION_RESULT_MODEM_NOT_AVAILABLE;
                         } else if (error == CommandException.Error.INVALID_ARGUMENTS) {
                             request.result = SET_DATA_THROTTLING_MODEM_THREW_INVALID_PARAMS;
+                        } else if (error == CommandException.Error.REQUEST_NOT_SUPPORTED) {
+                            request.result = MODEM_DOES_NOT_SUPPORT_DATA_THROTTLING_ERROR_CODE;
                         } else {
                             request.result =
                                     TelephonyManager.THERMAL_MITIGATION_RESULT_MODEM_ERROR;
@@ -9606,6 +9609,13 @@
 
     private int handleDataThrottlingRequest(int subId,
             DataThrottlingRequest dataThrottlingRequest) {
+        boolean isDataThrottlingSupported = isRadioInterfaceCapabilitySupported(
+                TelephonyManager.CAPABILITY_THERMAL_MITIGATION_DATA_THROTTLING);
+        if (!isDataThrottlingSupported && dataThrottlingRequest.getDataThrottlingAction()
+                != DataThrottlingRequest.DATA_THROTTLING_ACTION_NO_DATA_THROTTLING) {
+            throw new IllegalArgumentException("modem does not support data throttling");
+        }
+
         // Ensure that radio is on. If not able to power on due to phone being unavailable, return
         // THERMAL_MITIGATION_RESULT_MODEM_NOT_AVAILABLE.
         if (!setRadioPowerForThermal(subId, true)) {
@@ -9614,12 +9624,19 @@
 
         setDataEnabledForReason(subId, TelephonyManager.DATA_ENABLED_REASON_THERMAL, true);
 
-        int thermalMitigationResult =
+        if (isDataThrottlingSupported) {
+            int thermalMitigationResult =
                 (int) sendRequest(CMD_SET_DATA_THROTTLING, dataThrottlingRequest, subId);
-        if (thermalMitigationResult == SET_DATA_THROTTLING_MODEM_THREW_INVALID_PARAMS) {
-            throw new IllegalArgumentException("modem returned INVALID_ARGUMENTS");
+            if (thermalMitigationResult == SET_DATA_THROTTLING_MODEM_THREW_INVALID_PARAMS) {
+                throw new IllegalArgumentException("modem returned INVALID_ARGUMENTS");
+            } else if (thermalMitigationResult
+                    == MODEM_DOES_NOT_SUPPORT_DATA_THROTTLING_ERROR_CODE) {
+                throw new IllegalArgumentException("modem does not support data throttling");
+            }
+            return thermalMitigationResult;
         }
-        return thermalMitigationResult;
+
+        return TelephonyManager.THERMAL_MITIGATION_RESULT_SUCCESS;
     }
 
     /**
diff --git a/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/protocol/msrp/MsrpSession.java b/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/protocol/msrp/MsrpSession.java
index 3a95a0a..1c461fe 100644
--- a/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/protocol/msrp/MsrpSession.java
+++ b/testapps/TestRcsApp/aosp_test_rcsclient/src/com/android/libraries/rcs/simpleclient/protocol/msrp/MsrpSession.java
@@ -107,7 +107,7 @@
     private void listenForBearer() {
         try {
             connectivityManager.registerQosCallback(new QosSocketInfo(network, socket),
-                    qosCallback, MoreExecutors.directExecutor());
+                    MoreExecutors.directExecutor(), qosCallback);
         } catch (IOException e) {
             throw new RuntimeException(e);
         }