Loading src/java/com/android/internal/telephony/PhoneSubInfo.java +13 −4 Original line number Diff line number Diff line Loading @@ -386,9 +386,18 @@ public class PhoneSubInfo { * Besides READ_PHONE_STATE, WRITE_SMS also allows apps to get phone numbers. */ private boolean checkReadPhoneNumber(String callingPackage, String message) { // Note checkReadPhoneState() may throw, so we need to do the appops check first. return (mAppOps.noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED) || checkReadPhoneState(callingPackage, message); // Default SMS app can always read it. if (mAppOps.noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED) { return true; } try { return checkReadPhoneState(callingPackage, message); } catch (SecurityException e) { // Can be read with READ_SMS too. mContext.enforceCallingOrSelfPermission(android.Manifest.permission.READ_SMS, message); return mAppOps.noteOp(AppOpsManager.OP_READ_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED; } } } Loading
src/java/com/android/internal/telephony/PhoneSubInfo.java +13 −4 Original line number Diff line number Diff line Loading @@ -386,9 +386,18 @@ public class PhoneSubInfo { * Besides READ_PHONE_STATE, WRITE_SMS also allows apps to get phone numbers. */ private boolean checkReadPhoneNumber(String callingPackage, String message) { // Note checkReadPhoneState() may throw, so we need to do the appops check first. return (mAppOps.noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED) || checkReadPhoneState(callingPackage, message); // Default SMS app can always read it. if (mAppOps.noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED) { return true; } try { return checkReadPhoneState(callingPackage, message); } catch (SecurityException e) { // Can be read with READ_SMS too. mContext.enforceCallingOrSelfPermission(android.Manifest.permission.READ_SMS, message); return mAppOps.noteOp(AppOpsManager.OP_READ_SMS, Binder.getCallingUid(), callingPackage) == AppOpsManager.MODE_ALLOWED; } } }