From c16ea5ad67bf454158b364dec2f26c95a879c350 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 19 May 2015 15:51:01 -0700 Subject: Handle runtime permissions in Dialer Conditionally disable the following features if the required permissions are not available: 1) Display of all contacts 2) Display of speed dial 3) Caller ID in call log 4) Import/export contacts 5) Conversion of People.CONTENT_ITEM_TYPE and Phones.CONTENT_ITEM_TYPE into a phone number (via DIAL intent) 6) UndemoteOutgoingCallReceiver 7) Contact Search 8) Contact lookup in call detail activity 9) Nearby places search Bug: 20266292 Change-Id: I6d26902acb0eac407ae7bc18c11aa6ec57299506 --- src/com/android/dialer/database/DialerDatabaseHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/com/android/dialer/database') diff --git a/src/com/android/dialer/database/DialerDatabaseHelper.java b/src/com/android/dialer/database/DialerDatabaseHelper.java index 2177878c6..eec24f5bc 100644 --- a/src/com/android/dialer/database/DialerDatabaseHelper.java +++ b/src/com/android/dialer/database/DialerDatabaseHelper.java @@ -36,6 +36,7 @@ import android.provider.ContactsContract.Directory; import android.text.TextUtils; import android.util.Log; +import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.util.StopWatch; import com.android.dialer.R; import com.android.dialer.dialpad.SmartDialNameMatcher; @@ -485,7 +486,9 @@ public class DialerDatabaseHelper extends SQLiteOpenHelper { * Starts the database upgrade process in the background. */ public void startSmartDialUpdateThread() { - new SmartDialUpdateAsyncTask().execute(); + if (PermissionsUtil.hasContactsPermissions(mContext)) { + new SmartDialUpdateAsyncTask().execute(); + } } private class SmartDialUpdateAsyncTask extends AsyncTask { -- cgit v1.2.3