Revert "Check System permissions for some TelephonyManager System apis."
This reverts commit 9bb0ea132854945a35dbceecbfb6ad6f56ac956f.
Reason for revert: b/75998747
Bug: 75998747
Merged-in: Idb85db22d21feafedd4f88f2c53beba638f6dce6
Change-Id: I69abfa794b2ba6e943bd86b28d6d0c01de110f6e
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 62faa45..beae63a 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1611,7 +1611,6 @@
@Override
public boolean isDataConnectivityPossible(int subId) {
- enforceReadPrivilegedPermission();
final Phone phone = getPhone(subId);
if (phone != null) {
return phone.isDataAllowed();
@@ -1906,18 +1905,12 @@
@Override
public int getActivePhoneTypeForSlot(int slotIndex) {
- 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;
+ final Phone phone = PhoneFactory.getPhone(slotIndex);
+ if (phone == null) {
+ return PhoneConstants.PHONE_TYPE_NONE;
+ } else {
+ return phone.getPhoneType();
}
- return getPhoneTypeForSlot(slotIndex);
}
/**
@@ -2022,7 +2015,6 @@
* Returns true if CDMA provisioning needs to run.
*/
public boolean needsOtaServiceProvisioning() {
- enforceReadPrivilegedPermission();
return mPhone.needsOtaServiceProvisioning();
}
@@ -3054,7 +3046,6 @@
@Override
public List<String> getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) {
- enforceReadPrivilegedPermission();
if (!SubscriptionManager.isValidPhoneId(phoneId)) {
loge("phoneId " + phoneId + " is not valid.");
return null;
@@ -3329,7 +3320,10 @@
@Override
public boolean isVideoCallingEnabled(String callingPackage) {
- enforceReadPrivilegedPermission();
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, mPhone.getSubId(), callingPackage, "isVideoCallingEnabled")) {
+ return false;
+ }
// 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.
@@ -4185,17 +4179,4 @@
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();
- }
- }
}