summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Maxwell <maxwelb@google.com>2016-02-19 03:17:05 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-19 03:17:05 +0000
commit0eceec1dcba3b158ab8d4529b7a8c6e5878ce232 (patch)
treeea3e463f6981b4e5a323f460cf0cc4fffe2045e8
parente48a21ac3555da836b5e594ec8444ff6cd5c8e42 (diff)
parentff3e825369e260b155d5d1865dacb8235ea7af19 (diff)
Merge "Checking for READ_CONTACTS permission" into nyc-dev am: 3072b0c6b2
am: ff3e825369 * commit 'ff3e825369e260b155d5d1865dacb8235ea7af19': Checking for READ_CONTACTS permission
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java9
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