Merge "Supported data enabled override for different scenarios"

This commit is contained in:
Jack Yu
2019-06-07 23:58:15 +00:00
committed by Gerrit Code Review
5 changed files with 81 additions and 3 deletions

View File

@@ -302,10 +302,26 @@ public class SubscriptionManager {
* subscription.
*
* Default value is 0.
*
* @deprecated Replaced by {@link #DATA_ENABLED_OVERRIDE_RULES}
* @hide
*/
/** @hide */
@Deprecated
public static final String WHITE_LISTED_APN_DATA = "white_listed_apn_data";
/**
* TelephonyProvider column name data_enabled_override_rules.
* It's a list of rules for overriding data enabled settings. The syntax is
* For example, "mms=nonDefault" indicates enabling data for mms in non-default subscription.
* "default=nonDefault&inVoiceCall" indicates enabling data for internet in non-default
* subscription and while is in voice call.
*
* Default value is empty string.
*
* @hide
*/
public static final String DATA_ENABLED_OVERRIDE_RULES = "data_enabled_override_rules";
/**
* 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

View File

@@ -10975,4 +10975,52 @@ public class TelephonyManager {
}
return true;
}
/**
* Set allowing mobile data during voice call.
*
* @param allow {@code true} if allowing using data during voice call, {@code false} if
* disallowed
*
* @return {@code false} if the setting is changed.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public boolean setDataAllowedDuringVoiceCall(boolean allow) {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.setDataAllowedDuringVoiceCall(getSubId(), allow);
}
} catch (RemoteException ex) {
if (!isSystemProcess()) {
ex.rethrowAsRuntimeException();
}
}
return false;
}
/**
* Check whether data is allowed during voice call. Note this is for dual sim device that
* data might be disabled on non-default data subscription but explicitly turned on by settings.
*
* @return {@code true} if data is allowed during voice call.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isDataAllowedInVoiceCall() {
try {
ITelephony service = getITelephony();
if (service != null) {
return service.isDataAllowedInVoiceCall(getSubId());
}
} catch (RemoteException ex) {
if (!isSystemProcess()) {
ex.rethrowAsRuntimeException();
}
}
return false;
}
}

View File

@@ -1310,6 +1310,9 @@ public class ApnSetting implements Parcelable {
* @hide
*/
public static String getApnTypeString(int apnType) {
if (apnType == TYPE_ALL) {
return "*";
}
String apnTypeString = APN_TYPE_INT_MAP.get(apnType);
return apnTypeString == null ? "Unknown" : apnTypeString;
}

View File

@@ -94,7 +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;
public static final int EVENT_DATA_ENABLED_OVERRIDE_RULES_CHANGED = BASE + 51;
/***** Constants *****/

View File

@@ -1612,7 +1612,7 @@ interface ITelephony {
* <p>
* See {@link UiccCardInfo} for more details on the kind of information available.
*
* @param callingPackage package making the call, used to evaluate carrier privileges
* @param callingPackage package making the call, used to evaluate carrier privileges
* @return a list of UiccCardInfo objects, representing information on the currently inserted
* UICCs and eUICCs. Each UiccCardInfo in the list will have private information filtered out if
* the caller does not have adequate permissions for that card.
@@ -1983,4 +1983,15 @@ interface ITelephony {
* Returns the MMS user agent profile URL.
*/
String getMmsUAProfUrl(int subId);
/**
* Set allowing mobile data during voice call.
*/
boolean setDataAllowedDuringVoiceCall(int subId, boolean allow);
/**
* Check whether data is allowed during voice call. Note this is for dual sim device that
* data might be disabled on non-default data subscription but explicitly turned on by settings.
*/
boolean isDataAllowedInVoiceCall(int subId);
}