diff options
| author | Jake Hamby <jhamby@google.com> | 2013-10-09 17:39:11 -0700 |
|---|---|---|
| committer | Jake Hamby <jhamby@google.com> | 2013-10-09 17:39:11 -0700 |
| commit | deb745d6ce5e2315acbd0b1028041ca08cc6fc5d (patch) | |
| tree | 592414f70d43e9b9a537eb3c07491c2c0d303aef | |
| parent | 2f3815dd9ccf6042bc2d19b2d3da4aefbd5bc05e (diff) | |
| download | platform_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 | |
Fix AppOps exception for SMS quick reply feature.android-sdk-4.4.2_r1.0.1android-sdk-4.4.2_r1android-cts-4.4_r4android-cts-4.4_r1android-4.4w_r1android-4.4_r1.2.0.1android-4.4_r1.2android-4.4_r1.1.0.1android-4.4_r1.1android-4.4_r1.0.1android-4.4_r1android-4.4_r0.9android-4.4.4_r2.0.1android-4.4.4_r2android-4.4.4_r1.0.1android-4.4.4_r1android-4.4.3_r1.1.0.1android-4.4.3_r1.1android-4.4.3_r1.0.1android-4.4.3_r1android-4.4.2_r2.0.1android-4.4.2_r2android-4.4.2_r1.0.1android-4.4.2_r1android-4.4.1_r1.0.1android-4.4.1_r1kitkat-wearkitkat-releasekitkat-mr2.2-releasekitkat-mr2.1-releasekitkat-mr2-releasekitkat-mr1.1-releasekitkat-mr1-releasekitkat-devkitkat-cts-releasekitkat-cts-dev
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.java | 9 |
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; |
