Rename AudioState to CallAudioState

Deprecate AudioState class and make methods @SystemApi where
necessary to minimize impact to SystemApi
Replace usages of AudioState inside Telecom sub-systems
Fire both onCallAudioStateChanged and onAudioStateChanged callbacks
for backward compatibility
Support both setAudioState and setCallAudioState for all classes

Bug: 21040387
Bug: 21088300
Change-Id: I3ec7b3afdaa344c6d639d1c421f1842d67f7d0f7
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 19bb3f1..08485a3 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -20,6 +20,7 @@
 import com.android.internal.telecom.IVideoCallback;
 import com.android.internal.telecom.IVideoProvider;
 
+import android.annotation.SystemApi;
 import android.net.Uri;
 import android.os.Handler;
 import android.os.IBinder;
@@ -776,11 +777,24 @@
      * Set the audio state of this {@code RemoteConnection}.
      *
      * @param state The audio state of this {@code RemoteConnection}.
+     * @hide
+     * @deprecated Use {@link #setCallAudioState(CallAudioState) instead.
      */
+    @SystemApi
+    @Deprecated
     public void setAudioState(AudioState state) {
+        setCallAudioState(new CallAudioState(state));
+    }
+
+    /**
+     * Set the audio state of this {@code RemoteConnection}.
+     *
+     * @param state The audio state of this {@code RemoteConnection}.
+     */
+    public void setCallAudioState(CallAudioState state) {
         try {
             if (mConnected) {
-                mConnectionService.onAudioStateChanged(mConnectionId, state);
+                mConnectionService.onCallAudioStateChanged(mConnectionId, state);
             }
         } catch (RemoteException ignored) {
         }