Add extras to Connections/Calls. (1/3)

Two major changes:
1) Add the notion of extras to a Connection.  These extras will be
parceled through to InCallService as Call.getExtras()
2) The previously existing Call.getExtras() has been renamed to
getIntentExtras(). This name better describes the fact that these
particular extras are from the original CALL or INCOMING_CALL intents.

Change-Id: I08c1baf4f08d54757f98012f0c08b423a707c53d
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 1d6e15c..9003ed1 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -20,8 +20,10 @@
 import com.android.internal.telecom.IVideoCallback;
 import com.android.internal.telecom.IVideoProvider;
 
+import android.annotation.Nullable;
 import android.annotation.SystemApi;
 import android.net.Uri;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.RemoteException;
@@ -197,9 +199,17 @@
         public void onConferenceChanged(
                 RemoteConnection connection,
                 RemoteConference conference) {}
+
+        /**
+         * Handles changes to the {@code RemoteConference} extras.
+         *
+         * @param connection The {@code RemoteConnection} invoking this method.
+         * @param extras The extras containing other information associated with the connection.
+         */
+        public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {}
     }
 
-    /** {@hide} */
+    /** @hide */
     public static class VideoProvider {
 
         public abstract static class Listener {
@@ -415,6 +425,7 @@
     private String mCallerDisplayName;
     private int mCallerDisplayNamePresentation;
     private RemoteConference mConference;
+    private Bundle mExtras;
 
     /**
      * @hide
@@ -614,6 +625,15 @@
     }
 
     /**
+     * Obtain the extras associated with this {@code RemoteConnection}.
+     *
+     * @return The extras for this connection.
+     */
+    public final Bundle getExtras() {
+        return mExtras;
+    }
+
+    /**
      * Determines whether this {@code RemoteConnection} is requesting ringback.
      *
      * @return Whether the {@code RemoteConnection} is requesting that the framework play a
@@ -1097,6 +1117,21 @@
         }
     }
 
+    /** @hide */
+    void setExtras(final Bundle extras) {
+        mExtras = extras;
+        for (CallbackRecord record : mCallbackRecords) {
+            final RemoteConnection connection = this;
+            final Callback callback = record.getCallback();
+            record.getHandler().post(new Runnable() {
+                @Override
+                public void run() {
+                    callback.onExtrasChanged(connection, extras);
+                }
+            });
+        }
+    }
+
     /**
      * Create a RemoteConnection represents a failure, and which will be in
      * {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost