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/incallui/legacyblocking/BlockedNumberContentObserver.java | |
parent | e724c7b6376be660abf2113f97c7cbfc34515da8 (diff) | |
parent | c857f90590e7d7fcffa89511982eb33afd34805f (diff) |
Merge "Update Dialer to v10 RC32" into oc-dev
Diffstat (limited to 'java/com/android/incallui/legacyblocking/BlockedNumberContentObserver.java')
-rw-r--r-- | java/com/android/incallui/legacyblocking/BlockedNumberContentObserver.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/java/com/android/incallui/legacyblocking/BlockedNumberContentObserver.java b/java/com/android/incallui/legacyblocking/BlockedNumberContentObserver.java index 33e133d7f..d774fc3d4 100644 --- a/java/com/android/incallui/legacyblocking/BlockedNumberContentObserver.java +++ b/java/com/android/incallui/legacyblocking/BlockedNumberContentObserver.java @@ -24,6 +24,7 @@ import android.support.annotation.NonNull; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.AsyncTaskExecutor; import com.android.dialer.common.concurrent.AsyncTaskExecutors; +import com.android.dialer.util.PermissionsUtil; import java.util.Objects; /** @@ -93,8 +94,13 @@ public class BlockedNumberContentObserver extends ContentObserver */ public void register() { LogUtil.i("BlockedNumberContentObserver.register", null); - context.getContentResolver().registerContentObserver(CallLog.CONTENT_URI, true, this); - handler.postDelayed(timeoutRunnable, TIMEOUT_MS); + if (PermissionsUtil.hasCallLogReadPermissions(context) + && PermissionsUtil.hasCallLogWritePermissions(context)) { + context.getContentResolver().registerContentObserver(CallLog.CONTENT_URI, true, this); + handler.postDelayed(timeoutRunnable, TIMEOUT_MS); + } else { + LogUtil.w("BlockedNumberContentObserver.register", "no call log read/write permissions."); + } } private void unregister() { |