Fix permission check for reading SMS on UICC.
Jake Hamby [Wed, 18 Sep 2013 19:26:53 +0000 (12:26 -0700)]
When accessing SMS stored on UICC via TelephonyProvider, we need to
use the com.android.phone UID for the call to IccSmsInterfaceManager
to avoid a UID mismatch failure in the app ops check. Change the
permission check method call from enforceCallingPermission() to
enforceCallingOrSelfPermission() so the check doesn't fail.

Bug: 10131077
Change-Id: I0d7e0925be1fc69a95298865a1632a1fd953add0

src/java/com/android/internal/telephony/IccSmsInterfaceManager.java

index 03ed244..ed518e4 100644 (file)
@@ -245,7 +245,7 @@ public abstract class IccSmsInterfaceManager extends ISms.Stub {
     public List<SmsRawData> getAllMessagesFromIccEf(String callingPackage) {
         if (DBG) log("getAllMessagesFromEF");
 
-        mContext.enforceCallingPermission(
+        mContext.enforceCallingOrSelfPermission(
                 Manifest.permission.RECEIVE_SMS,
                 "Reading messages from Icc");
         if (mAppOps.noteOp(AppOpsManager.OP_READ_ICC_SMS, Binder.getCallingUid(),