[Mainline] Move the setAlwaysAllowMmsData from SubscriptionManager to TelephonyManager

Bug: 146309719
Test: make
Change-Id: Ibb68cd4e6a6ba49c56b313380ddf16734813459b
This commit is contained in:
changbetty
2019-12-24 15:37:01 +08:00
parent 44e5637c75
commit 8f823800d7
5 changed files with 33 additions and 28 deletions

View File

@@ -10065,6 +10065,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

@@ -11884,7 +11884,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.
@@ -12008,4 +12008,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

@@ -2153,6 +2153,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.
*/