summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hamby <jhamby@google.com>2013-10-09 17:39:11 -0700
committerJake Hamby <jhamby@google.com>2013-10-09 17:39:11 -0700
commitdeb745d6ce5e2315acbd0b1028041ca08cc6fc5d (patch)
tree592414f70d43e9b9a537eb3c07491c2c0d303aef
parent2f3815dd9ccf6042bc2d19b2d3da4aefbd5bc05e (diff)
downloadplatform_packages_providers_TelephonyProvider-kitkat-mr2.1-release.tar.gz
platform_packages_providers_TelephonyProvider-kitkat-mr2.1-release.tar.bz2
platform_packages_providers_TelephonyProvider-kitkat-mr2.1-release.zip
Sending a quick SMS reply to an incoming phone call was failing with a SecurityException due to new AppOps code. The root cause was the insert() call in SmsProvider was calling back into itself using the UID of the caller (com.android.mms) but the package name for the callee (com.android.phone). Wrapped the insert() method of SmsProvider with a helper function to save the Binder identity and restore it on completion. This allows the quick response to make its own provider queries using its own UID as well as package name. Read/write security checks will be performed by the content provider framework based on the manifest file, before insert() is called. Bug: 11006277 Change-Id: I4c0c8041a2505c5aad8db9b2dbab5402728f9221
-rw-r--r--src/com/android/providers/telephony/SmsProvider.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/providers/telephony/SmsProvider.java b/src/com/android/providers/telephony/SmsProvider.java
index d547d59c..c36a0d2d 100644
--- a/src/com/android/providers/telephony/SmsProvider.java
+++ b/src/com/android/providers/telephony/SmsProvider.java
@@ -347,6 +347,15 @@ public class SmsProvider extends ContentProvider {
@Override
public Uri insert(Uri url, ContentValues initialValues) {
+ long token = Binder.clearCallingIdentity();
+ try {
+ return insertInner(url, initialValues);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ private Uri insertInner(Uri url, ContentValues initialValues) {
ContentValues values;
long rowID;
int type = Sms.MESSAGE_TYPE_ALL;