Merge "Change the order of permission checks for READ_PHONE_STATE." into mnc-dev
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index ea44511..359535e 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2651,19 +2651,15 @@
}
private boolean canReadPhoneState(String callingPackage, String message) {
- boolean failReadPhoneState = false;
try {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
- message);
- } catch (SecurityException e) {
- failReadPhoneState = true;
- }
- if (failReadPhoneState) {
mApp.enforceCallingOrSelfPermission(
android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, message);
- // SKIP checking for run-time permission since obtained PRIVILEDGED
+ // SKIP checking for run-time permission since self or obtained PRIVILEDGED
return true;
+ } catch (SecurityException e) {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.READ_PHONE_STATE,
+ message);
}
if (mAppOps.noteOp(AppOpsManager.OP_READ_PHONE_STATE, Binder.getCallingUid(),