diff options
author | Ye Wen <ywen@google.com> | 2014-07-31 17:15:30 -0700 |
---|---|---|
committer | Ye Wen <ywen@google.com> | 2014-08-01 09:13:02 -0700 |
commit | fa58ac09df51ddc7710a7b2837170dd3780aaf3a (patch) | |
tree | ff4b56be7e0beed33cc826205916c5bd5023feef /services/core/java/com/android/server/MmsServiceBroker.java | |
parent | 1a66bdb9a6026be4918af263e1160e1bd4919e72 (diff) | |
download | frameworks_base-fa58ac09df51ddc7710a7b2837170dd3780aaf3a.zip frameworks_base-fa58ac09df51ddc7710a7b2837170dd3780aaf3a.tar.gz frameworks_base-fa58ac09df51ddc7710a7b2837170dd3780aaf3a.tar.bz2 |
Return fake URI for AppOps permission failure check
Change-Id: Ib7adcce0827a90a49e317a5434fb1abfa91a51d5
Diffstat (limited to 'services/core/java/com/android/server/MmsServiceBroker.java')
-rw-r--r-- | services/core/java/com/android/server/MmsServiceBroker.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/MmsServiceBroker.java b/services/core/java/com/android/server/MmsServiceBroker.java index 2fad73e..898b6f1 100644 --- a/services/core/java/com/android/server/MmsServiceBroker.java +++ b/services/core/java/com/android/server/MmsServiceBroker.java @@ -49,6 +49,11 @@ public class MmsServiceBroker extends SystemService { private static final int MSG_TRY_CONNECTING = 1; + private static final Uri FAKE_SMS_SENT_URI = Uri.parse("content://sms/sent/0"); + private static final Uri FAKE_MMS_SENT_URI = Uri.parse("content://mms/sent/0"); + private static final Uri FAKE_SMS_DRAFT_URI = Uri.parse("content://sms/draft/0"); + private static final Uri FAKE_MMS_DRAFT_URI = Uri.parse("content://mms/draft/0"); + private Context mContext; // The actual MMS service instance to invoke private volatile IMms mService; @@ -275,7 +280,9 @@ public class MmsServiceBroker extends SystemService { mContext.enforceCallingPermission(Manifest.permission.WRITE_SMS, "Import SMS message"); if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPkg) != AppOpsManager.MODE_ALLOWED) { - return null; + // Silently fail AppOps failure due to not being the default SMS app + // while writing the TelephonyProvider + return FAKE_SMS_SENT_URI; } return getServiceGuarded().importTextMessage( callingPkg, address, type, text, timestampMillis, seen, read); @@ -287,7 +294,9 @@ public class MmsServiceBroker extends SystemService { mContext.enforceCallingPermission(Manifest.permission.WRITE_SMS, "Import MMS message"); if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPkg) != AppOpsManager.MODE_ALLOWED) { - return null; + // Silently fail AppOps failure due to not being the default SMS app + // while writing the TelephonyProvider + return FAKE_MMS_SENT_URI; } return getServiceGuarded().importMultimediaMessage( callingPkg, pdu, messageId, timestampSecs, seen, read); @@ -340,7 +349,9 @@ public class MmsServiceBroker extends SystemService { mContext.enforceCallingPermission(Manifest.permission.WRITE_SMS, "Add SMS draft"); if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPkg) != AppOpsManager.MODE_ALLOWED) { - return null; + // Silently fail AppOps failure due to not being the default SMS app + // while writing the TelephonyProvider + return FAKE_SMS_DRAFT_URI; } return getServiceGuarded().addTextMessageDraft(callingPkg, address, text); } @@ -350,7 +361,9 @@ public class MmsServiceBroker extends SystemService { mContext.enforceCallingPermission(Manifest.permission.WRITE_SMS, "Add MMS draft"); if (getAppOpsManager().noteOp(AppOpsManager.OP_WRITE_SMS, Binder.getCallingUid(), callingPkg) != AppOpsManager.MODE_ALLOWED) { - return null; + // Silently fail AppOps failure due to not being the default SMS app + // while writing the TelephonyProvider + return FAKE_MMS_DRAFT_URI; } return getServiceGuarded().addMultimediaMessageDraft(callingPkg, pdu); } |