Merge "Add API to set alwaysAllowMms" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f447240a0c
@@ -293,6 +293,19 @@ public class SubscriptionManager {
|
||||
/** @hide */
|
||||
public static final String SUBSCRIPTION_TYPE = "subscription_type";
|
||||
|
||||
/**
|
||||
* TelephonyProvider column name white_listed_apn_data.
|
||||
* It's a bitmask of APN types that will be allowed on this subscription even if it's metered
|
||||
* and mobile data is turned off by the user.
|
||||
* <P>Type: INTEGER (int)</P> For example, if TYPE_MMS is is true, Telephony will allow MMS
|
||||
* data connection to setup even if MMS is metered and mobile_data is turned off on that
|
||||
* subscription.
|
||||
*
|
||||
* Default value is 0.
|
||||
*/
|
||||
/** @hide */
|
||||
public static final String WHITE_LISTED_APN_DATA = "white_listed_apn_data";
|
||||
|
||||
/**
|
||||
* This constant is to designate a subscription as a Local-SIM Subscription.
|
||||
* <p> A Local-SIM can be a physical SIM inserted into a sim-slot in the device, or eSIM on the
|
||||
@@ -3086,6 +3099,31 @@ 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;
|
||||
}
|
||||
|
||||
@@ -10948,4 +10948,33 @@ public class TelephonyManager {
|
||||
}
|
||||
return new Pair<Integer, Integer>(-1, -1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return whether MMS data is enabled. This will tell if framework will accept a MMS network
|
||||
* request on a subId.
|
||||
*
|
||||
* Mms is enabled if:
|
||||
* 1) user data is turned on, or
|
||||
* 2) MMS is un-metered for this subscription, or
|
||||
* 3) alwaysAllowMms setting {@link SubscriptionManager#setAlwaysAllowMmsData} is turned on.
|
||||
*
|
||||
* @return whether MMS data is allowed.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isMmsDataEnabled() {
|
||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||
try {
|
||||
ITelephony service = getITelephony();
|
||||
if (service != null) {
|
||||
return service.isMmsDataEnabled(getSubId(), pkgForDebug);
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
if (!isSystemProcess()) {
|
||||
ex.rethrowAsRuntimeException();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public class DctConstants {
|
||||
public static final int EVENT_ROAMING_SETTING_CHANGE = BASE + 48;
|
||||
public static final int EVENT_DATA_SERVICE_BINDING_CHANGED = BASE + 49;
|
||||
public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 50;
|
||||
public static final int EVENT_APN_WHITE_LIST_CHANGE = BASE + 51;
|
||||
|
||||
/***** Constants *****/
|
||||
|
||||
|
||||
@@ -279,4 +279,6 @@ interface ISub {
|
||||
int getSimStateForSlotIndex(int slotIndex);
|
||||
|
||||
boolean isActiveSubId(int subId, String callingPackage);
|
||||
|
||||
boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow);
|
||||
}
|
||||
|
||||
@@ -1966,4 +1966,6 @@ interface ITelephony {
|
||||
int getRadioHalVersion();
|
||||
|
||||
boolean isModemEnabledForSlot(int slotIndex, String callingPackage);
|
||||
|
||||
boolean isMmsDataEnabled(int subId, String callingPackage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user