Update Telephony to use new Extras APIs.

- Given the new extras APIs, updating Telephony to make use of these new
extras apis in place of the existing "setExtras".
- Updating ImsConference to handle transferring extras from host to
conference.

Bug: 27458894
Change-Id: I4a120ba17e8617d8821ba5b124a6e1354efc7d0a
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 857ba27..53e7289 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -187,7 +187,13 @@
         @Override
         public void onExtrasChanged(Connection c, Bundle extras) {
             Log.v(this, "onExtrasChanged: c=" + c + " Extras=" + extras);
-            setExtras(extras);
+            putExtras(extras);
+        }
+
+        @Override
+        public void onExtrasRemoved(Connection c, List<String> keys) {
+            Log.v(this, "onExtrasRemoved: c=" + c + " key=" + keys);
+            removeExtras(keys);
         }
     };
 
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 8f6c57e..d76281f 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -142,14 +142,13 @@
                         mSsNotification =
                                 (SuppServiceNotification)((AsyncResult) msg.obj).result;
                         if (mOriginalConnection != null && mSsNotification.history != null) {
-                            Bundle extras = getExtras();
-                            if (extras != null) {
-                                Log.v(TelephonyConnection.this,
-                                        "Updating call history info in extras.");
-                                extras.putStringArrayList(Connection.EXTRA_LAST_FORWARDED_NUMBER,
-                                        new ArrayList(Arrays.asList(mSsNotification.history)));
-                                setExtras(extras);
-                            }
+                            Bundle lastForwardedNumber = new Bundle();
+                            Log.v(TelephonyConnection.this,
+                                    "Updating call history info in extras.");
+                            lastForwardedNumber.putStringArrayList(
+                                Connection.EXTRA_LAST_FORWARDED_NUMBER,
+                                new ArrayList(Arrays.asList(mSsNotification.history)));
+                            putExtras(lastForwardedNumber);
                         }
                     }
                     break;
@@ -890,12 +889,7 @@
                     }
 
                     // Ensure extras are propagated to Telecom.
-                    Bundle connectionExtras = getExtras();
-                    if (connectionExtras == null) {
-                        connectionExtras = new Bundle();
-                    }
-                    connectionExtras.putAll(mOriginalConnectionExtras);
-                    setExtras(connectionExtras);
+                    putExtras(mOriginalConnectionExtras);
                 } else {
                     Log.d(this, "Extras update not required");
                 }