diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-05-15 23:21:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-05-15 23:21:06 +0000 |
commit | 0c9dbf507b53a12bdf577ff3e55c1686a2e089de (patch) | |
tree | 3849f2add85d7abe11151436b3f03f99783157a8 /java/com/android/contacts | |
parent | e724c7b6376be660abf2113f97c7cbfc34515da8 (diff) | |
parent | c857f90590e7d7fcffa89511982eb33afd34805f (diff) |
Merge "Update Dialer to v10 RC32" into oc-dev
Diffstat (limited to 'java/com/android/contacts')
5 files changed, 26 insertions, 9 deletions
diff --git a/java/com/android/contacts/common/ContactPhotoManager.java b/java/com/android/contacts/common/ContactPhotoManager.java index 652e93637..169348b25 100644 --- a/java/com/android/contacts/common/ContactPhotoManager.java +++ b/java/com/android/contacts/common/ContactPhotoManager.java @@ -191,7 +191,7 @@ public abstract class ContactPhotoManager implements ComponentCallbacks2 { Context applicationContext = context.getApplicationContext(); sInstance = createContactPhotoManager(applicationContext); applicationContext.registerComponentCallbacks(sInstance); - if (PermissionsUtil.hasContactsPermissions(context)) { + if (PermissionsUtil.hasContactsReadPermissions(context)) { sInstance.preloadPhotosInBackground(); } } diff --git a/java/com/android/contacts/common/compat/TelephonyManagerCompat.java b/java/com/android/contacts/common/compat/TelephonyManagerCompat.java index 84002256a..7e4803ca5 100644 --- a/java/com/android/contacts/common/compat/TelephonyManagerCompat.java +++ b/java/com/android/contacts/common/compat/TelephonyManagerCompat.java @@ -41,6 +41,9 @@ public class TelephonyManagerCompat { public static final String EVENT_CALL_REMOTELY_UNHELD = "android.telecom.event.CALL_REMOTELY_UNHELD"; + public static final String EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC = + "android.telephony.event.EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC"; + public static final String TELEPHONY_MANAGER_CLASS = "android.telephony.TelephonyManager"; private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE"; diff --git a/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java b/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java index e96496cda..751490a22 100644 --- a/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java +++ b/java/com/android/contacts/common/dialog/ClearFrequentsDialog.java @@ -48,7 +48,7 @@ public class ClearFrequentsDialog extends DialogFragment { new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - if (!PermissionsUtil.hasContactsPermissions(context)) { + if (!PermissionsUtil.hasContactsReadPermissions(context)) { return; } diff --git a/java/com/android/contacts/common/list/DirectoryListLoader.java b/java/com/android/contacts/common/list/DirectoryListLoader.java index 48b098c07..be62cc7a8 100644 --- a/java/com/android/contacts/common/list/DirectoryListLoader.java +++ b/java/com/android/contacts/common/list/DirectoryListLoader.java @@ -25,9 +25,10 @@ import android.net.Uri; import android.os.Handler; import android.provider.ContactsContract.Directory; import android.text.TextUtils; -import android.util.Log; import com.android.contacts.common.R; import com.android.contacts.common.compat.DirectoryCompat; +import com.android.dialer.common.LogUtil; +import com.android.dialer.util.PermissionsUtil; /** A specialized loader for the list of directories, see {@link Directory}. */ public class DirectoryListLoader extends AsyncTaskLoader<Cursor> { @@ -38,7 +39,6 @@ public class DirectoryListLoader extends AsyncTaskLoader<Cursor> { public static final int SEARCH_MODE_DATA_SHORTCUT = 3; // This is a virtual column created for a MatrixCursor. public static final String DIRECTORY_TYPE = "directoryType"; - private static final String TAG = "ContactEntryListAdapter"; private static final String[] RESULT_PROJECTION = { Directory._ID, DIRECTORY_TYPE, Directory.DISPLAY_NAME, Directory.PHOTO_SUPPORT, }; @@ -71,7 +71,13 @@ public class DirectoryListLoader extends AsyncTaskLoader<Cursor> { @Override protected void onStartLoading() { - getContext().getContentResolver().registerContentObserver(DirectoryQuery.URI, false, mObserver); + if (PermissionsUtil.hasContactsReadPermissions(getContext())) { + getContext() + .getContentResolver() + .registerContentObserver(DirectoryQuery.URI, false, mObserver); + } else { + LogUtil.w("DirectoryListLoader.onStartLoading", "contacts permission not available."); + } forceLoad(); } @@ -141,7 +147,9 @@ public class DirectoryListLoader extends AsyncTaskLoader<Cursor> { try { directoryType = pm.getResourcesForApplication(packageName).getString(typeResourceId); } catch (Exception e) { - Log.e(TAG, "Cannot obtain directory type from package: " + packageName); + LogUtil.e( + "ContactEntryListAdapter.loadInBackground", + "cannot obtain directory type from package: " + packageName); } } String displayName = cursor.getString(DirectoryQuery.DISPLAY_NAME); @@ -149,7 +157,8 @@ public class DirectoryListLoader extends AsyncTaskLoader<Cursor> { result.addRow(new Object[] {directoryId, directoryType, displayName, photoSupport}); } } catch (RuntimeException e) { - Log.w(TAG, "Runtime Exception when querying directory"); + LogUtil.w( + "ContactEntryListAdapter.loadInBackground", "runtime exception when querying directory"); } finally { if (cursor != null) { cursor.close(); diff --git a/java/com/android/contacts/common/model/ContactLoader.java b/java/com/android/contacts/common/model/ContactLoader.java index 8e9ef9429..55464b161 100644 --- a/java/com/android/contacts/common/model/ContactLoader.java +++ b/java/com/android/contacts/common/model/ContactLoader.java @@ -47,6 +47,7 @@ import com.android.contacts.common.util.ContactLoaderUtils; import com.android.contacts.common.util.UriUtils; import com.android.dialer.common.LogUtil; import com.android.dialer.location.GeoUtil; +import com.android.dialer.util.PermissionsUtil; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -688,11 +689,15 @@ public class ContactLoader extends AsyncTaskLoader<Contact> { mLookupUri = result.getLookupUri(); if (!result.isDirectoryEntry()) { - LogUtil.i(TAG, "Registering content observer for " + mLookupUri); if (mObserver == null) { mObserver = new ForceLoadContentObserver(); } - getContext().getContentResolver().registerContentObserver(mLookupUri, true, mObserver); + + if (PermissionsUtil.hasContactsReadPermissions(getContext())) { + getContext().getContentResolver().registerContentObserver(mLookupUri, true, mObserver); + } else { + LogUtil.w("ContactLoader.deliverResult", "contacts permission not available"); + } } if (mPostViewNotification) { |