diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index beae63a..62faa45 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1611,6 +1611,7 @@
 
     @Override
     public boolean isDataConnectivityPossible(int subId) {
+        enforceReadPrivilegedPermission();
         final Phone phone = getPhone(subId);
         if (phone != null) {
             return phone.isDataAllowed();
@@ -1905,12 +1906,18 @@
 
     @Override
     public int getActivePhoneTypeForSlot(int slotIndex) {
-        final Phone phone = PhoneFactory.getPhone(slotIndex);
-        if (phone == null) {
-            return PhoneConstants.PHONE_TYPE_NONE;
-        } else {
-            return phone.getPhoneType();
+        enforceReadPrivilegedPermission();
+        return getPhoneTypeForSlot(slotIndex);
+    }
+
+    @Override
+    public int getVoiceCapableActivePhoneTypeForSlot(int slotIndex) {
+        // Check if the device is voice-capable
+        if (!mApp.getResources()
+                .getBoolean(com.android.internal.R.bool.config_voice_capable)) {
+            return TelephonyManager.PHONE_TYPE_NONE;
         }
+        return getPhoneTypeForSlot(slotIndex);
     }
 
     /**
@@ -2015,6 +2022,7 @@
      * Returns true if CDMA provisioning needs to run.
      */
     public boolean needsOtaServiceProvisioning() {
+        enforceReadPrivilegedPermission();
         return mPhone.needsOtaServiceProvisioning();
     }
 
@@ -3046,6 +3054,7 @@
 
     @Override
     public List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) {
+        enforceReadPrivilegedPermission();
         if (!SubscriptionManager.isValidPhoneId(phoneId)) {
             loge("phoneId " + phoneId + " is not valid.");
             return null;
@@ -3320,10 +3329,7 @@
 
     @Override
     public boolean isVideoCallingEnabled(String callingPackage) {
-        if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
-                mApp, mPhone.getSubId(), callingPackage, "isVideoCallingEnabled")) {
-            return false;
-        }
+        enforceReadPrivilegedPermission();
 
         // Check the user preference and the  system-level IMS setting. Even if the user has
         // enabled video calling, if IMS is disabled we aren't able to support video calling.
@@ -4179,4 +4185,17 @@
                         DEFAULT_NETWORK_MODE_PROPERTY_NAME,
                         String.valueOf(Phone.PREFERRED_NT_MODE)));
     }
+
+    /**
+     * Util function that returns the phone type.
+     * @param slotIndex - slot to query.
+     */
+    private int getPhoneTypeForSlot(int slotIndex) {
+        final Phone phone = PhoneFactory.getPhone(slotIndex);
+        if (phone == null) {
+            return PhoneConstants.PHONE_TYPE_NONE;
+        } else {
+            return phone.getPhoneType();
+        }
+    }
 }
