From 2cf2c3484c5f8dd11e6ad32633f7254119525413 Mon Sep 17 00:00:00 2001 From: erfanian Date: Thu, 21 Dec 2017 12:01:33 -0800 Subject: Update assisted dialing extras in preparation for platform implementation. * Use only one extra as if we were going to make a request of the Platform. * Modify the incallui to handle instances where the platform may not supply TransformationInfo. This should accommodate instances where the platform "used" assisted dialing, but did not provide the necessary TransformationInfo. Test: unit tests PiperOrigin-RevId: 179841752 Change-Id: I06411dc00812dba8978a2a090d8769dcce9b2ad6 --- .../dialer/compat/telephony/TelephonyManagerCompat.java | 14 ++++---------- .../android/dialer/precall/impl/AssistedDialAction.java | 6 ++++-- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'java/com/android/dialer') diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index 6bed818da..b01689da4 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -57,22 +57,16 @@ public class TelephonyManagerCompat { * *

This signals to the telephony platform that an outgoing call qualifies for assisted dialing. */ - public static final String ALLOW_ASSISTED_DIAL = "android.telecom.extra.ALLOW_ASSISTED_DIAL"; - - // TODO(erfanian): a bug Replace with the platform/telecom constant when available. - /** - * Indicates that an outgoing call has undergone assisted dialing. - * - *

Unlike {@link ALLOW_ASSISTED_DIAL}, the presence of this key further indicates that a call - * has undergone Assisted Dialing -- not just that it qualified for Assisted Dialing. - */ - public static final String IS_ASSISTED_DIALED = "android.telecom.extra.IS_ASSISTED_DIALED"; + public static final String USE_ASSISTED_DIALING = "android.telecom.extra.USE_ASSISTED_DIALING"; // TODO(erfanian): a bug Replace with the platform/telecom API when available. /** Additional information relating to the assisted dialing transformation. */ public static final String ASSISTED_DIALING_EXTRAS = "android.telecom.extra.ASSISTED_DIALING_EXTRAS"; + /** Indicates the Connection/Call used assisted dialing. */ + public static final int PROPERTY_ASSISTED_DIALING_USED = 0x00000200; + public static final String EXTRA_IS_REFRESH = BuildCompat.isAtLeastOMR1() ? "android.telephony.extra.IS_REFRESH" : "is_refresh"; diff --git a/java/com/android/dialer/precall/impl/AssistedDialAction.java b/java/com/android/dialer/precall/impl/AssistedDialAction.java index c4f61d2dd..dc2510960 100644 --- a/java/com/android/dialer/precall/impl/AssistedDialAction.java +++ b/java/com/android/dialer/precall/impl/AssistedDialAction.java @@ -51,10 +51,12 @@ public class AssistedDialAction implements PreCallAction { AssistedDialingMediator assistedDialingMediator = ConcreteCreator.createNewAssistedDialingMediator( context.getSystemService(TelephonyManager.class), context); + if (Build.VERSION.SDK_INT > ConcreteCreator.BUILD_CODE_CEILING) { + builder.getOutgoingCallExtras().putBoolean(TelephonyManagerCompat.USE_ASSISTED_DIALING, true); + } if (!assistedDialingMediator.isPlatformEligible()) { return; } - builder.getOutgoingCallExtras().putBoolean(TelephonyManagerCompat.ALLOW_ASSISTED_DIAL, true); String phoneNumber = builder.getUri().getScheme().equals(PhoneAccount.SCHEME_TEL) ? builder.getUri().getSchemeSpecificPart() @@ -62,8 +64,8 @@ public class AssistedDialAction implements PreCallAction { Optional transformedNumber = assistedDialingMediator.attemptAssistedDial(phoneNumber); if (transformedNumber.isPresent()) { + builder.getOutgoingCallExtras().putBoolean(TelephonyManagerCompat.USE_ASSISTED_DIALING, true); Bundle assistedDialingExtras = transformedNumber.get().toBundle(); - builder.getOutgoingCallExtras().putBoolean(TelephonyManagerCompat.IS_ASSISTED_DIALED, true); builder .getOutgoingCallExtras() .putBundle(TelephonyManagerCompat.ASSISTED_DIALING_EXTRAS, assistedDialingExtras); -- cgit v1.2.3