From 393c0df6a01bf6890a944284e6d62a482b5d62ae Mon Sep 17 00:00:00 2001 From: erfanian Date: Mon, 14 Aug 2017 14:58:46 -0700 Subject: Register call initiated from a known contact in Dialer. This additional metadata will be used by the telephony system to determine if an outgoing call is eligible for assisted dialing. Bug: 63995025 Test: some new unit tests PiperOrigin-RevId: 165233878 Change-Id: Idee6491e3396b0798ae6c72da53d51367f9fd7ee --- java/com/android/dialer/callintent/CallIntentBuilder.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'java/com/android/dialer/callintent/CallIntentBuilder.java') diff --git a/java/com/android/dialer/callintent/CallIntentBuilder.java b/java/com/android/dialer/callintent/CallIntentBuilder.java index 36ea907ff..87de0f0ec 100644 --- a/java/com/android/dialer/callintent/CallIntentBuilder.java +++ b/java/com/android/dialer/callintent/CallIntentBuilder.java @@ -28,6 +28,7 @@ import android.telecom.TelecomManager; import android.telecom.VideoProfile; import android.text.TextUtils; import com.android.dialer.common.Assert; +import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.performancereport.PerformanceReport; import com.android.dialer.util.CallUtil; @@ -38,6 +39,7 @@ public class CallIntentBuilder { @Nullable private PhoneAccountHandle phoneAccountHandle; private boolean isVideoCall; private String callSubject; + private boolean allowAssistedDial; private static int lightbringerButtonAppearInExpandedCallLogItemCount = 0; private static int lightbringerButtonAppearInCollapsedCallLogItemCount = 0; @@ -100,6 +102,11 @@ public class CallIntentBuilder { return this; } + public CallIntentBuilder setAllowAssistedDial(boolean allowAssistedDial) { + this.allowAssistedDial = allowAssistedDial; + return this; + } + public CallIntentBuilder setCallSubject(String callSubject) { this.callSubject = callSubject; return this; @@ -114,6 +121,11 @@ public class CallIntentBuilder { Bundle extras = new Bundle(); extras.putLong(Constants.EXTRA_CALL_CREATED_TIME_MILLIS, SystemClock.elapsedRealtime()); CallIntentParser.putCallSpecificAppData(extras, callSpecificAppData); + + if (allowAssistedDial) { + extras.putBoolean(TelephonyManagerCompat.ALLOW_ASSISTED_DIAL, true); + } + intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, extras); if (phoneAccountHandle != null) { -- cgit v1.2.3