Supported data enabled override for different scenarios
Added override rules support for always allowing mms and internet data during voice call. Test: Manual + unit tests Bug: 132113695 Change-Id: I2266d7f428901ccbba6bf538a7c7696e6566b96c
This commit is contained in:
@@ -302,10 +302,26 @@ public class SubscriptionManager {
|
|||||||
* subscription.
|
* subscription.
|
||||||
*
|
*
|
||||||
* Default value is 0.
|
* 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";
|
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.
|
* 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
|
* <p> A Local-SIM can be a physical SIM inserted into a sim-slot in the device, or eSIM on the
|
||||||
|
|||||||
@@ -11141,4 +11141,52 @@ public class TelephonyManager {
|
|||||||
}
|
}
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1310,6 +1310,9 @@ public class ApnSetting implements Parcelable {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static String getApnTypeString(int apnType) {
|
public static String getApnTypeString(int apnType) {
|
||||||
|
if (apnType == TYPE_ALL) {
|
||||||
|
return "*";
|
||||||
|
}
|
||||||
String apnTypeString = APN_TYPE_INT_MAP.get(apnType);
|
String apnTypeString = APN_TYPE_INT_MAP.get(apnType);
|
||||||
return apnTypeString == null ? "Unknown" : apnTypeString;
|
return apnTypeString == null ? "Unknown" : apnTypeString;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class DctConstants {
|
|||||||
public static final int EVENT_ROAMING_SETTING_CHANGE = BASE + 48;
|
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_DATA_SERVICE_BINDING_CHANGED = BASE + 49;
|
||||||
public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 50;
|
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 *****/
|
/***** Constants *****/
|
||||||
|
|
||||||
|
|||||||
@@ -1996,4 +1996,15 @@ interface ITelephony {
|
|||||||
* Returns the MMS user agent profile URL.
|
* Returns the MMS user agent profile URL.
|
||||||
*/
|
*/
|
||||||
String getMmsUAProfUrl(int subId);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user