summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-02-01 11:22:10 -0800
committerCopybara-Service <copybara-piper@google.com>2018-02-01 12:35:51 -0800
commit90297d3e9814645f3aff4dd365b523695e26448f (patch)
tree01eb0ed4b77394044c88492330a5e0871c44f071 /java
parent2ac2b7cbf95576efed02b54fbde53ed939397b56 (diff)
Handle missing contact permission for preferred SIM
Bug: 72163953,72749906 Test: Unit tests PiperOrigin-RevId: 184167756 Change-Id: I19f4a71fb443fbb31960be486c3c5e996535fc32
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index d5ee0f278..e92832947 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -62,6 +62,7 @@ import com.android.dialer.preferredsim.PreferredSimFallbackContract.PreferredSim
import com.android.dialer.preferredsim.suggestion.SimSuggestionComponent;
import com.android.dialer.preferredsim.suggestion.SuggestionProvider.Suggestion;
import com.android.dialer.telecom.TelecomUtil;
+import com.android.dialer.util.PermissionsUtil;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
@@ -311,6 +312,12 @@ public class CallingAccountSelector implements PreCallAction {
if (!isPreferredSimEnabled(context)) {
return result;
}
+ if (!PermissionsUtil.hasContactsReadPermissions(context)) {
+ LogUtil.i(
+ "CallingAccountSelector.PreferredAccountWorker.doInBackground",
+ "missing READ_CONTACTS permission");
+ return result;
+ }
result.dataId = getDataId(context, phoneNumber);
if (result.dataId.isPresent()) {
result.phoneAccountHandle = getPreferredAccount(context, result.dataId.get());