diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2705c67..5305aa8 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1539,7 +1539,7 @@
         int subId = mSubscriptionController.getDefaultDataSubId();
         final Phone phone = getPhone(subId);
         if (phone != null) {
-            phone.setDataEnabled(true);
+            phone.setUserDataEnabled(true);
             return true;
         } else {
             return false;
@@ -1553,7 +1553,7 @@
         int subId = mSubscriptionController.getDefaultDataSubId();
         final Phone phone = getPhone(subId);
         if (phone != null) {
-            phone.setDataEnabled(false);
+            phone.setUserDataEnabled(false);
             return true;
         } else {
             return false;
@@ -2748,28 +2748,46 @@
      * @param enable {@code true} turn turn data on, else {@code false}
      */
     @Override
-    public void setDataEnabled(int subId, boolean enable) {
+    public void setUserDataEnabled(int subId, boolean enable) {
         enforceModifyPermissionOrCarrierPrivilege(subId);
         int phoneId = mSubscriptionController.getPhoneId(subId);
-        if (DBG) log("getDataEnabled: subId=" + subId + " phoneId=" + phoneId);
+        if (DBG) log("setUserDataEnabled: subId=" + subId + " phoneId=" + phoneId);
         Phone phone = PhoneFactory.getPhone(phoneId);
         if (phone != null) {
-            if (DBG) log("setDataEnabled: subId=" + subId + " enable=" + enable);
-            phone.setDataEnabled(enable);
+            if (DBG) log("setUserDataEnabled: subId=" + subId + " enable=" + enable);
+            phone.setUserDataEnabled(enable);
         } else {
-            loge("setDataEnabled: no phone for subId=" + subId);
+            loge("setUserDataEnabled: no phone for subId=" + subId);
         }
     }
 
     /**
-     * Get whether mobile data is enabled.
+     * Get the user enabled state of Mobile Data.
+     *
+     * TODO: remove and use isUserDataEnabled.
+     * This can't be removed now because some vendor codes
+     * calls through ITelephony directly while they should
+     * use TelephonyManager.
+     *
+     * @return true on enabled
+     */
+    @Override
+    public boolean getDataEnabled(int subId) {
+        return isUserDataEnabled(subId);
+    }
+
+    /**
+     * Get whether mobile data is enabled per user setting.
+     *
+     * There are other factors deciding whether mobile data is actually enabled, but they are
+     * not considered here. See {@link #isDataEnabled(int)} for more details.
      *
      * Accepts either ACCESS_NETWORK_STATE, MODIFY_PHONE_STATE or carrier privileges.
      *
      * @return {@code true} if data is enabled else {@code false}
      */
     @Override
-    public boolean getDataEnabled(int subId) {
+    public boolean isUserDataEnabled(int subId) {
         try {
             mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
                     null);
@@ -2777,14 +2795,45 @@
             enforceModifyPermissionOrCarrierPrivilege(subId);
         }
         int phoneId = mSubscriptionController.getPhoneId(subId);
-        if (DBG) log("getDataEnabled: subId=" + subId + " phoneId=" + phoneId);
+        if (DBG) log("isUserDataEnabled: subId=" + subId + " phoneId=" + phoneId);
         Phone phone = PhoneFactory.getPhone(phoneId);
         if (phone != null) {
-            boolean retVal = phone.getDataEnabled();
-            if (DBG) log("getDataEnabled: subId=" + subId + " retVal=" + retVal);
+            boolean retVal = phone.isUserDataEnabled();
+            if (DBG) log("isUserDataEnabled: subId=" + subId + " retVal=" + retVal);
             return retVal;
         } else {
-            if (DBG) loge("getDataEnabled: no phone subId=" + subId + " retVal=false");
+            if (DBG) loge("isUserDataEnabled: no phone subId=" + subId + " retVal=false");
+            return false;
+        }
+    }
+
+    /**
+     * Get whether mobile data is enabled.
+     *
+     * Comparable to {@link #isUserDataEnabled(int)}, this considers all factors deciding
+     * whether mobile data is actually enabled.
+     *
+     * Accepts either ACCESS_NETWORK_STATE, MODIFY_PHONE_STATE or carrier privileges.
+     *
+     * @return {@code true} if data is enabled else {@code false}
+     */
+    @Override
+    public boolean isDataEnabled(int subId) {
+        try {
+            mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
+                    null);
+        } catch (Exception e) {
+            enforceModifyPermissionOrCarrierPrivilege(subId);
+        }
+        int phoneId = mSubscriptionController.getPhoneId(subId);
+        if (DBG) log("isDataEnabled: subId=" + subId + " phoneId=" + phoneId);
+        Phone phone = PhoneFactory.getPhone(phoneId);
+        if (phone != null) {
+            boolean retVal = phone.isDataEnabled();
+            if (DBG) log("isDataEnabled: subId=" + subId + " retVal=" + retVal);
+            return retVal;
+        } else {
+            if (DBG) loge("isDataEnabled: no phone subId=" + subId + " retVal=false");
             return false;
         }
     }
@@ -3288,7 +3337,7 @@
             if (SubscriptionManager.isUsableSubIdValue(subId) && !mUserManager.hasUserRestriction(
                     UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
                 // Enable data
-                setDataEnabled(subId, true);
+                setUserDataEnabled(subId, true);
                 // Set network selection mode to automatic
                 setNetworkSelectionModeAutomatic(subId);
                 // Set preferred mobile network type to the best available
