summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/preferredsim
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-03-23 17:08:14 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-26 22:19:44 -0700
commit85ca8e003b3bd2b4c7e398f9efe49d181aaccc06 (patch)
tree892c40f887b8ada65dbaacca86b9648e97206fe8 /java/com/android/dialer/preferredsim
parent23923139d2538ed2718fe26f82f6f0a43cef582f (diff)
Check empty number before querying data ID for preferred account
In call UI might use PreferredAccountWorker with a voicemail URI that has no numbers. Bug: 76205637 Test: Unit tests PiperOrigin-RevId: 190298082 Change-Id: I9949de5499958c408d6e1bf18cab6e77852d2487
Diffstat (limited to 'java/com/android/dialer/preferredsim')
-rw-r--r--java/com/android/dialer/preferredsim/PreferredAccountWorker.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
index aa617889e..df743c342 100644
--- a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
+++ b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java
@@ -34,6 +34,7 @@ import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.support.annotation.WorkerThread;
import android.telecom.PhoneAccountHandle;
+import android.text.TextUtils;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.common.concurrent.DialerExecutor.Worker;
@@ -128,6 +129,9 @@ public class PreferredAccountWorker implements Worker<Context, Result> {
private static Optional<String> getDataId(
@NonNull Context context, @Nullable String phoneNumber) {
Assert.isWorkerThread();
+ if (TextUtils.isEmpty(phoneNumber)) {
+ return Optional.absent();
+ }
try (Cursor cursor =
context
.getContentResolver()