From 85ca8e003b3bd2b4c7e398f9efe49d181aaccc06 Mon Sep 17 00:00:00 2001 From: twyen Date: Fri, 23 Mar 2018 17:08:14 -0700 Subject: 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 --- .../android/dialer/commandline/impl/CallCommand.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'java/com/android/dialer/commandline') diff --git a/java/com/android/dialer/commandline/impl/CallCommand.java b/java/com/android/dialer/commandline/impl/CallCommand.java index a6d78f4de..b3ea8601f 100644 --- a/java/com/android/dialer/commandline/impl/CallCommand.java +++ b/java/com/android/dialer/commandline/impl/CallCommand.java @@ -53,7 +53,10 @@ public class CallCommand implements Command { @NonNull @Override public String getUsage() { - return "call number\n\nuse 'voicemail' to call voicemail"; + return "call [flags --] number\n" + + "\nuse 'voicemail' to call voicemail" + + "\n\nflags:" + + "\n--direct send intent to telecom instead of pre call"; } @Override @@ -73,11 +76,16 @@ public class CallCommand implements Command { } else { callIntentBuilder = new CallIntentBuilder(number, CallInitiationType.Type.DIALPAD); } - - Intent intent = PreCall.getIntent(appContext, callIntentBuilder); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - appContext.startActivity(intent); - + if (args.getBoolean("direct", false)) { + Intent intent = callIntentBuilder.build(); + appContext + .getSystemService(TelecomManager.class) + .placeCall(intent.getData(), intent.getExtras()); + } else { + Intent intent = PreCall.getIntent(appContext, callIntentBuilder); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + appContext.startActivity(intent); + } return Futures.immediateFuture("Calling " + number); } } -- cgit v1.2.3