diff options
author | Brandon Maxwell <maxwelb@google.com> | 2016-02-18 17:49:50 -0800 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2016-02-18 18:41:20 -0800 |
commit | 7566cd716e33ee61047e431974c6d4a1ef8aa385 (patch) | |
tree | 593531de091adfbd7280e72c2e89699be0e8facf | |
parent | d1f0d576021248cc8aac4cd9845f01c572874f0b (diff) |
Checking for READ_CONTACTS permission
+ When starting a call, we attempt to look up the ContactInfo. This
lookup needs to be guarded by a check to ensure we have permission to
read the contacts.
Bug=27078247
Change-Id: Id68de80d3acd721642b79ff81fda5d9decd67e7b
-rw-r--r-- | InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java index bf5e1a311..590afafca 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java +++ b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java @@ -18,13 +18,13 @@ package com.android.incallui; import com.google.common.primitives.Longs; +import android.Manifest; import android.content.AsyncQueryHandler; import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.net.Uri; -import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -35,6 +35,7 @@ import android.text.TextUtils; import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.compat.DirectoryCompat; +import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.util.TelephonyManagerUtils; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.service.CachedNumberLookupService; @@ -339,6 +340,12 @@ public class CallerInfoAsyncQuery { Log.d(LOG_TAG, "##### CallerInfoAsyncQuery startContactProviderQuery()... #####"); Log.d(LOG_TAG, "- number: " + info.phoneNumber); Log.d(LOG_TAG, "- cookie: " + cookie); + if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_CONTACTS)) { + Log.w(LOG_TAG, "Dialer doesn't have permission to read contacts."); + listener.onQueryComplete(token, cookie, info); + return; + } + OnQueryCompleteListener contactsProviderQueryCompleteListener = new OnQueryCompleteListener() { @Override |