Merge "Make changes to Connection in Telecomm API (1/4)" into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index f03e2f3..6746770 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28257,16 +28257,15 @@
     method public final boolean isRequestingRingback();
     method public void onAbort();
     method public void onAnswer();
+    method public void onAudioStateChanged(android.telecomm.AudioState);
     method public void onConferenceWith(android.telecomm.Connection);
     method public void onDisconnect();
     method public void onHold();
-    method public void onPhoneAccountClicked();
     method public void onPlayDtmfTone(char);
     method public void onPostDialContinue(boolean);
     method public void onReject();
     method public void onSeparate();
-    method public void onSetAudioState(android.telecomm.AudioState);
-    method public void onSetState(int);
+    method public void onStateChanged(int);
     method public void onStopDtmfTone();
     method public void onUnhold();
     method public final void setActive();
@@ -28499,8 +28498,8 @@
     field public static final java.lang.String EXTRA_CALL_DISCONNECT_CAUSE = "android.telecomm.extra.CALL_DISCONNECT_CAUSE";
     field public static final java.lang.String EXTRA_CALL_DISCONNECT_MESSAGE = "android.telecomm.extra.CALL_DISCONNECT_MESSAGE";
     field public static final java.lang.String EXTRA_CONNECTION_SERVICE = "android.telecomm.extra.CONNECTION_SERVICE";
-    field public static final java.lang.String EXTRA_PHONE_ACCOUNT_HANDLE = "android.intent.extra.PHONE_ACCOUNT_HANDLE";
-    field public static final java.lang.String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.intent.extra.START_CALL_WITH_SPEAKERPHONE";
+    field public static final java.lang.String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telecomm.extra.PHONE_ACCOUNT_HANDLE";
+    field public static final java.lang.String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.telecomm.extra.START_CALL_WITH_SPEAKERPHONE";
     field public static final int PRESENTATION_ALLOWED = 1; // 0x1
     field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
     field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
diff --git a/telecomm/java/android/telecomm/Call.java b/telecomm/java/android/telecomm/Call.java
index 129880f..7ada9b1 100644
--- a/telecomm/java/android/telecomm/Call.java
+++ b/telecomm/java/android/telecomm/Call.java
@@ -482,13 +482,6 @@
     }
 
     /**
-     * Notifies this {@code Call} that the phone account user interface element was touched.
-     */
-    public void phoneAccountClicked() {
-        mInCallAdapter.phoneAccountClicked(mTelecommCallId);
-    }
-
-    /**
      * Notifies this {@code Call} that an account has been selected and to proceed with placing
      * an outgoing call.
      */
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index c8426ae..729686d 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -625,7 +625,7 @@
     final void setAudioState(AudioState state) {
         Log.d(this, "setAudioState %s", state);
         mAudioState = state;
-        onSetAudioState(state);
+        onAudioStateChanged(state);
     }
 
     /**
@@ -946,7 +946,7 @@
      *
      * @param state The new call audio state.
      */
-    public void onSetAudioState(AudioState state) {}
+    public void onAudioStateChanged(AudioState state) {}
 
     /**
      * Notifies this Connection of an internal state change. This method is called after the
@@ -954,7 +954,7 @@
      *
      * @param state The new state, one of the {@code STATE_*} constants.
      */
-    public void onSetState(int state) {}
+    public void onStateChanged(int state) {}
 
     /**
      * Notifies this Connection of a request to play a DTMF tone.
@@ -1022,11 +1022,6 @@
     public void onPostDialContinue(boolean proceed) {}
 
     /**
-     * Called when the phone account UI was clicked.
-     */
-    public void onPhoneAccountClicked() {}
-
-    /**
      * Merge this connection and the specified connection into a conference call.  Once the
      * connections are merged, the calls should be added to the an existing or new
      * {@code Conference} instance. For new {@code Conference} instances, use
@@ -1069,7 +1064,7 @@
         if (mState != state) {
             Log.d(this, "setState: %s", stateToString(state));
             mState = state;
-            onSetState(state);
+            onStateChanged(state);
             for (Listener l : mListeners) {
                 l.onStateChanged(this, state);
             }
diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java
index 39365b6..76e208b 100644
--- a/telecomm/java/android/telecomm/ConnectionService.java
+++ b/telecomm/java/android/telecomm/ConnectionService.java
@@ -69,7 +69,6 @@
     private static final int MSG_CONFERENCE = 12;
     private static final int MSG_SPLIT_FROM_CONFERENCE = 13;
     private static final int MSG_ON_POST_DIAL_CONTINUE = 14;
-    private static final int MSG_ON_PHONE_ACCOUNT_CLICKED = 15;
     private static final int MSG_REMOVE_CONNECTION_SERVICE_ADAPTER = 16;
     private static final int MSG_ANSWER_VIDEO = 17;
     private static final int MSG_MERGE_CONFERENCE = 18;
@@ -200,11 +199,6 @@
             args.argi1 = proceed ? 1 : 0;
             mHandler.obtainMessage(MSG_ON_POST_DIAL_CONTINUE, args).sendToTarget();
         }
-
-        @Override
-        public void onPhoneAccountClicked(String callId) {
-            mHandler.obtainMessage(MSG_ON_PHONE_ACCOUNT_CLICKED, callId).sendToTarget();
-        }
     };
 
     private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -327,9 +321,6 @@
                     }
                     break;
                 }
-                case MSG_ON_PHONE_ACCOUNT_CLICKED:
-                    onPhoneAccountHandleClicked((String) msg.obj);
-                    break;
                 default:
                     break;
             }
@@ -678,11 +669,6 @@
         findConnectionForAction(callId, "stopDtmfTone").onPostDialContinue(proceed);
     }
 
-    private void onPhoneAccountHandleClicked(String callId) {
-        Log.d(this, "onPhoneAccountClicked %s", callId);
-        findConnectionForAction(callId, "onPhoneAccountClicked").onPhoneAccountClicked();
-    }
-
     private void onAdapterAttached() {
         if (mAreAccountsInitialized) {
             // No need to query again if we already did it.
diff --git a/telecomm/java/android/telecomm/InCallAdapter.java b/telecomm/java/android/telecomm/InCallAdapter.java
index 96ea5a6..899f35e 100644
--- a/telecomm/java/android/telecomm/InCallAdapter.java
+++ b/telecomm/java/android/telecomm/InCallAdapter.java
@@ -189,18 +189,6 @@
     }
 
     /**
-     * Instructs Telecomm that the phone account UI was clicked.
-     *
-     * @param callId The identifier of the call.
-     */
-    public void phoneAccountClicked(String callId) {
-        try {
-            mAdapter.phoneAccountClicked(callId);
-        } catch (RemoteException e) {
-        }
-    }
-
-    /**
      * Instructs Telecomm to add a PhoneAccountHandle to the specified call
      *
      * @param callId The identifier of the call
diff --git a/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl b/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl
index a673733..3af4ed3 100644
--- a/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IConnectionService.aidl
@@ -70,6 +70,4 @@
     void swapConference(String conferenceCallId);
 
     void onPostDialContinue(String callId, boolean proceed);
-
-    void onPhoneAccountClicked(String callId);
 }
diff --git a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl
index 626bb91..808a410 100644
--- a/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecomm/IInCallAdapter.aidl
@@ -46,8 +46,6 @@
 
     void postDialContinue(String callId, boolean proceed);
 
-    void phoneAccountClicked(String callId);
-
     void phoneAccountSelected(String callId, in PhoneAccountHandle accountHandle);
 
     void conference(String callId, String otherCallId);