Merge "[Mainline] Move the setAlwaysAllowMmsData from SubscriptionManager to TelephonyManager"

This commit is contained in:
Betty Chang
2020-01-07 02:41:52 +00:00
committed by Android (Google) Code Review
5 changed files with 33 additions and 28 deletions

View File

@@ -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<android.service.carrier.CarrierIdentifier>);
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);

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -295,8 +295,6 @@ interface ISub {
boolean isActiveSubId(int subId, String callingPackage, String callingFeatureId);
boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow);
int getActiveDataSubscriptionId();
boolean canDisablePhysicalSubscription();

View File

@@ -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.
*/