diff --git a/api/system-current.txt b/api/system-current.txt index 993bc10e2640a..39dbd60c50f1b 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -10120,6 +10120,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean resetRadioConfig(); method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings(); method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setAlwaysAllowMmsData(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataActivationState(int); diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 7380b31fbc3c1..cc0ff33345768 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -3282,31 +3282,6 @@ public class SubscriptionManager { return subId; } - /** - * Set whether a subscription always allows MMS connection. If true, MMS network - * request will be accepted by telephony even if user turns "mobile data" off - * on this subscription. - * - * @param subId which subscription it's setting to. - * @param alwaysAllow whether Mms data is always allowed. - * @return whether operation is successful. - * - * @hide - */ - public boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow) { - try { - ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); - if (iSub != null) { - return iSub.setAlwaysAllowMmsData(subId, alwaysAllow); - } - } catch (RemoteException ex) { - if (!isSystemProcess()) { - ex.rethrowAsRuntimeException(); - } - } - return false; - } - private interface CallISubMethodHelper { int callMethod(ISub iSub) throws RemoteException; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index ba6e7e9d4b808..7c60095f3817d 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -12000,7 +12000,7 @@ public class TelephonyManager { * 1) User data is turned on, or * 2) APN is un-metered for this subscription, or * 3) APN type is whitelisted. E.g. MMS is whitelisted if - * {@link SubscriptionManager#setAlwaysAllowMmsData} is turned on. + * {@link #setAlwaysAllowMmsData(boolean)} is turned on. * * @param apnType Value indicating the apn type. Apn types are defined in {@link ApnSetting}. * @return whether data is enabled for a apn type. @@ -12124,4 +12124,30 @@ public class TelephonyManager { } return false; } + + /** + * Set whether the specific sim card always allows MMS connection. If true, MMS network + * request will be accepted by telephony even if user turns "mobile data" off + * on this specific sim card. + * + * @param alwaysAllow whether Mms data is always allowed. + * @return whether operation is successful. + * + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public boolean setAlwaysAllowMmsData(boolean alwaysAllow) { + try { + ITelephony service = getITelephony(); + if (service != null) { + return service.setAlwaysAllowMmsData(getSubId(), alwaysAllow); + } + } catch (RemoteException ex) { + if (!isSystemProcess()) { + ex.rethrowAsRuntimeException(); + } + } + return false; + } } diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index cc02a409c16db..571efcee0e15f 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -295,8 +295,6 @@ interface ISub { boolean isActiveSubId(int subId, String callingPackage, String callingFeatureId); - boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow); - int getActiveDataSubscriptionId(); boolean canDisablePhysicalSubscription(); diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 9d721fce32139..b846a1029c683 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2117,6 +2117,11 @@ interface ITelephony { */ boolean isDataAllowedInVoiceCall(int subId); + /** + * Set whether a subscription always allows MMS connection. + */ + boolean setAlwaysAllowMmsData(int subId, boolean allow); + /** * Command line command to enable or disable handling of CEP data for test purposes. */