Add new API to PhoneInterfaceManager
Bug:111453847
Test: build test
Change-Id: I71eb6e4aa67b3138e9128142294fb7fbbf3acf5b
Merged-In: I71eb6e4aa67b3138e9128142294fb7fbbf3acf5b
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 444eae0..a97c4b3 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -4987,6 +4987,54 @@
}
}
+ /**
+ * Checks if data roaming is enabled on the subscription with id {@code subId}.
+ *
+ * <p>Requires one of the following permissions:
+ * {@link android.Manifest.permission#ACCESS_NETWORK_STATE},
+ * {@link android.Manifest.permission#READ_PHONE_STATE} or that the calling app has carrier
+ * privileges.
+ *
+ * @param subId subscription id
+ * @return {@code true} if data roaming is enabled on this subscription, otherwise return
+ * {@code false}.
+ */
+ @Override
+ public boolean isDataRoamingEnabled(int subId) {
+ try {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
+ null);
+ } catch (Exception e) {
+ TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
+ mApp, subId, "isDataRoamingEnabled");
+ }
+
+ Phone phone = getPhone(subId);
+ return phone != null ? phone.getDataRoamingEnabled() : false;
+ }
+
+
+ /**
+ * Enables/Disables the data roaming on the subscription with id {@code subId}.
+ *
+ * <p> Requires permission:
+ * {@link android.Manifest.permission#MODIFY_PHONE_STATE} or that the calling app has carrier
+ * privileges.
+ *
+ * @param subId subscription id
+ * @param isEnabled {@code true} means enable, {@code false} means disable.
+ */
+ @Override
+ public void setDataRoamingEnabled(int subId, boolean isEnabled) {
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setDataRoamingEbaled");
+
+ Phone phone = getPhone(subId);
+ if (phone != null) {
+ phone.setDataRoamingEnabled(isEnabled);
+ }
+ }
+
@Override
public UiccSlotInfo[] getUiccSlotsInfo() {
enforceReadPrivilegedPermission();