Merge "Ensure connection extras set before connection start are passed through." into mnc-dr-dev
diff --git a/src/java/com/android/internal/telephony/Connection.java b/src/java/com/android/internal/telephony/Connection.java
index e727de5..51dfe60 100644
--- a/src/java/com/android/internal/telephony/Connection.java
+++ b/src/java/com/android/internal/telephony/Connection.java
@@ -129,6 +129,7 @@
     private int mCallSubstate;
     private android.telecom.Connection.VideoProvider mVideoProvider;
     public Call.State mPreHandoverState = Call.State.IDLE;
+    private Bundle mExtras;
 
     /* Instance Methods */
 
@@ -632,12 +633,21 @@
      * @param extras New connection extras.
      */
     public void setConnectionExtras(Bundle extras) {
+        mExtras = extras;
         for (Listener l : mListeners) {
             l.onExtrasChanged(extras);
         }
     }
 
     /**
+     * Retrieves the current connection extras.
+     * @return the connection extras.
+     */
+    public Bundle getConnectionExtras() {
+        return mExtras;
+    }
+
+    /**
      * Sets the call substate for the current connection and reports the changes to all listeners.
      * Valid call substates are defined in {@link android.telecom.Connection}.
      *
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java
index 4280c27..8b72a63 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneConnection.java
@@ -165,6 +165,11 @@
 
         updateWifiState();
 
+        // Ensure any extras set on the ImsCallProfile at the start of the call are cached locally
+        // in the ImsPhoneConnection.  This isn't going to inform any listeners (since the original
+        // connection is not likely to be associated with a TelephonyConnection yet).
+        updateExtras(imsCall);
+
         mParent = parent;
         mParent.attach(this,
                 (mIsIncoming? ImsPhoneCall.State.INCOMING: ImsPhoneCall.State.DIALING));