diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/commandline/impl/CallCommand.java | 20 | ||||
-rw-r--r-- | java/com/android/dialer/preferredsim/PreferredAccountWorker.java | 4 |
2 files changed, 18 insertions, 6 deletions
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); } } 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() |