Add assisted dialing logic to Telephony Connections.

Currently, we propogate the assisted dialing property
if we detect that the client requested assisted dialing. This
is because the client is currently responsible for assisted dialing
and only passes along the request if it was successful.

Test: manual
Bug: 35963245
Merged-In: I6897554761b43449b3619747663866ff79b504ec
Change-Id: I122fa1075f70095733368ed19a725f2c820a4f82
(cherry picked from commit 2ae8daaa622cefa0b9e643145b74c75d26430039)
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index d41a8f0..f63ac4c 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -501,6 +501,11 @@
     protected final boolean mIsOutgoing;
 
     /**
+     * Indicates whether this call is using assisted dialing.
+     */
+    private boolean mIsUsingAssistedDialing;
+
+    /**
      * Listeners to our TelephonyConnection specific callbacks
      */
     private final Set<TelephonyConnectionListener> mTelephonyListeners = Collections.newSetFromMap(
@@ -802,6 +807,8 @@
                 isExternalConnection());
         newProperties = changeBitmask(newProperties, PROPERTY_HAS_CDMA_VOICE_PRIVACY,
                 mIsCdmaVoicePrivacyEnabled);
+        newProperties = changeBitmask(newProperties, PROPERTY_ASSISTED_DIALING_USED,
+                mIsUsingAssistedDialing);
 
         if (getConnectionProperties() != newProperties) {
             setConnectionProperties(newProperties);
@@ -1642,6 +1649,15 @@
         return mWasImsConnection;
     }
 
+    boolean getIsUsingAssistedDialing() {
+        return mIsUsingAssistedDialing;
+    }
+
+    void setIsUsingAssistedDialing(Boolean isUsingAssistedDialing) {
+        mIsUsingAssistedDialing = isUsingAssistedDialing;
+        updateConnectionProperties();
+    }
+
     private static Uri getAddressFromNumber(String number) {
         // Address can be null for blocked calls.
         if (number == null) {
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index ac3e50a..464b836 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -440,7 +440,11 @@
                     isEmergencyNumber, handle, phone);
             // If there was a failure, the resulting connection will not be a TelephonyConnection,
             // so don't place the call!
-            if(resultConnection instanceof TelephonyConnection) {
+            if (resultConnection instanceof TelephonyConnection) {
+                if (request.getExtras() != null && request.getExtras().getBoolean(
+                        TelecomManager.EXTRA_USE_ASSISTED_DIALING, false)) {
+                    ((TelephonyConnection) resultConnection).setIsUsingAssistedDialing(true);
+                }
                 placeOutgoingConnection((TelephonyConnection) resultConnection, phone, request);
             }
             return resultConnection;