Merge "[2/4] Use new Icon class in PhoneAccount." into mnc-dev
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index d8ebbc9..1b56e97 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -19,7 +19,7 @@
 import android.content.Context;
 import android.media.AudioManager;
 import android.os.Binder;
-import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 
 import com.android.internal.util.IndentingPrintWriter;
 import com.android.internal.util.Preconditions;
@@ -40,7 +40,7 @@
     private final DockManager mDockManager;
     private final CallsManager mCallsManager;
 
-    private AudioState mAudioState;
+    private CallAudioState mCallAudioState;
     private int mAudioFocusStreamType;
     private boolean mIsRinging;
     private boolean mIsTonePlaying;
@@ -68,8 +68,8 @@
         mAudioFocusStreamType = STREAM_NONE;
     }
 
-    AudioState getAudioState() {
-        return mAudioState;
+    CallAudioState getCallAudioState() {
+        return mCallAudioState;
     }
 
     @Override
@@ -79,8 +79,8 @@
         if (hasFocus() && getForegroundCall() == call) {
             if (!call.isIncoming()) {
                 // Unmute new outgoing call.
-                setSystemAudioState(false, mAudioState.getRoute(),
-                        mAudioState.getSupportedRouteMask());
+                setSystemAudioState(false, mCallAudioState.getRoute(),
+                        mCallAudioState.getSupportedRouteMask());
             }
         }
     }
@@ -105,7 +105,7 @@
 
     @Override
     public void onIncomingCallAnswered(Call call) {
-        int route = mAudioState.getRoute();
+        int route = mCallAudioState.getRoute();
 
         // We do two things:
         // (1) If this is the first call, then we can to turn on bluetooth if available.
@@ -113,10 +113,10 @@
         boolean isOnlyCall = mCallsManager.getCalls().size() == 1;
         if (isOnlyCall && mBluetoothManager.isBluetoothAvailable()) {
             mBluetoothManager.connectBluetoothAudio();
-            route = AudioState.ROUTE_BLUETOOTH;
+            route = CallAudioState.ROUTE_BLUETOOTH;
         }
 
-        setSystemAudioState(false /* isMute */, route, mAudioState.getSupportedRouteMask());
+        setSystemAudioState(false /* isMute */, route, mCallAudioState.getSupportedRouteMask());
 
         if (call.can(android.telecom.Call.Details.CAPABILITY_SPEED_UP_MT_AUDIO)) {
             Log.v(this, "Speed up audio setup for IMS MT call.");
@@ -148,11 +148,12 @@
             return;
         }
 
-        boolean isCurrentlyWiredHeadset = mAudioState.getRoute() == AudioState.ROUTE_WIRED_HEADSET;
+        boolean isCurrentlyWiredHeadset = mCallAudioState.getRoute()
+                == CallAudioState.ROUTE_WIRED_HEADSET;
 
-        int newRoute = mAudioState.getRoute();  // start out with existing route
+        int newRoute = mCallAudioState.getRoute();  // start out with existing route
         if (newIsPluggedIn) {
-            newRoute = AudioState.ROUTE_WIRED_HEADSET;
+            newRoute = CallAudioState.ROUTE_WIRED_HEADSET;
         } else if (isCurrentlyWiredHeadset) {
             Call call = getForegroundCall();
             boolean hasLiveCall = call != null && call.isAlive();
@@ -160,9 +161,9 @@
             if (hasLiveCall) {
                 // In order of preference when a wireless headset is unplugged.
                 if (mWasSpeakerOn) {
-                    newRoute = AudioState.ROUTE_SPEAKER;
+                    newRoute = CallAudioState.ROUTE_SPEAKER;
                 } else {
-                    newRoute = AudioState.ROUTE_EARPIECE;
+                    newRoute = CallAudioState.ROUTE_EARPIECE;
                 }
 
                 // We don't automatically connect to bluetooth when user unplugs their wired headset
@@ -177,7 +178,7 @@
 
         // We need to call this every time even if we do not change the route because the supported
         // routes changed either to include or not include WIRED_HEADSET.
-        setSystemAudioState(mAudioState.isMuted(), newRoute, calculateSupportedRoutes());
+        setSystemAudioState(mCallAudioState.isMuted(), newRoute, calculateSupportedRoutes());
     }
 
     @Override
@@ -190,19 +191,19 @@
         if (isDocked) {
             // Device just docked, turn to speakerphone. Only do so if the route is currently
             // earpiece so that we dont switch out of a BT headset or a wired headset.
-            if (mAudioState.getRoute() == AudioState.ROUTE_EARPIECE) {
-                setAudioRoute(AudioState.ROUTE_SPEAKER);
+            if (mCallAudioState.getRoute() == CallAudioState.ROUTE_EARPIECE) {
+                setAudioRoute(CallAudioState.ROUTE_SPEAKER);
             }
         } else {
             // Device just undocked, remove from speakerphone if possible.
-            if (mAudioState.getRoute() == AudioState.ROUTE_SPEAKER) {
-                setAudioRoute(AudioState.ROUTE_WIRED_OR_EARPIECE);
+            if (mCallAudioState.getRoute() == CallAudioState.ROUTE_SPEAKER) {
+                setAudioRoute(CallAudioState.ROUTE_WIRED_OR_EARPIECE);
             }
         }
     }
 
     void toggleMute() {
-        mute(!mAudioState.isMuted());
+        mute(!mCallAudioState.isMuted());
     }
 
     void mute(boolean shouldMute) {
@@ -218,16 +219,16 @@
             Log.v(this, "ignoring mute for emergency call");
         }
 
-        if (mAudioState.isMuted() != shouldMute) {
-            setSystemAudioState(shouldMute, mAudioState.getRoute(),
-                    mAudioState.getSupportedRouteMask());
+        if (mCallAudioState.isMuted() != shouldMute) {
+            setSystemAudioState(shouldMute, mCallAudioState.getRoute(),
+                    mCallAudioState.getSupportedRouteMask());
         }
     }
 
     /**
      * Changed the audio route, for example from earpiece to speaker phone.
      *
-     * @param route The new audio route to use. See {@link AudioState}.
+     * @param route The new audio route to use. See {@link CallAudioState}.
      */
     void setAudioRoute(int route) {
         // This can happen even when there are no calls and we don't have focus.
@@ -235,23 +236,23 @@
             return;
         }
 
-        Log.v(this, "setAudioRoute, route: %s", AudioState.audioRouteToString(route));
+        Log.v(this, "setAudioRoute, route: %s", CallAudioState.audioRouteToString(route));
 
         // Change ROUTE_WIRED_OR_EARPIECE to a single entry.
-        int newRoute = selectWiredOrEarpiece(route, mAudioState.getSupportedRouteMask());
+        int newRoute = selectWiredOrEarpiece(route, mCallAudioState.getSupportedRouteMask());
 
         // If route is unsupported, do nothing.
-        if ((mAudioState.getSupportedRouteMask() | newRoute) == 0) {
+        if ((mCallAudioState.getSupportedRouteMask() | newRoute) == 0) {
             Log.wtf(this, "Asking to set to a route that is unsupported: %d", newRoute);
             return;
         }
 
-        if (mAudioState.getRoute() != newRoute) {
+        if (mCallAudioState.getRoute() != newRoute) {
             // Remember the new speaker state so it can be restored when the user plugs and unplugs
             // a headset.
-            mWasSpeakerOn = newRoute == AudioState.ROUTE_SPEAKER;
-            setSystemAudioState(mAudioState.isMuted(), newRoute,
-                    mAudioState.getSupportedRouteMask());
+            mWasSpeakerOn = newRoute == CallAudioState.ROUTE_SPEAKER;
+            setSystemAudioState(mCallAudioState.isMuted(), newRoute,
+                    mCallAudioState.getSupportedRouteMask());
         }
     }
 
@@ -288,16 +289,17 @@
         }
 
         int supportedRoutes = calculateSupportedRoutes();
-        int newRoute = mAudioState.getRoute();
+        int newRoute = mCallAudioState.getRoute();
         if (bluetoothManager.isBluetoothAudioConnectedOrPending()) {
-            newRoute = AudioState.ROUTE_BLUETOOTH;
-        } else if (mAudioState.getRoute() == AudioState.ROUTE_BLUETOOTH) {
-            newRoute = selectWiredOrEarpiece(AudioState.ROUTE_WIRED_OR_EARPIECE, supportedRoutes);
+            newRoute = CallAudioState.ROUTE_BLUETOOTH;
+        } else if (mCallAudioState.getRoute() == CallAudioState.ROUTE_BLUETOOTH) {
+            newRoute = selectWiredOrEarpiece(CallAudioState.ROUTE_WIRED_OR_EARPIECE,
+                    supportedRoutes);
             // Do not switch to speaker when bluetooth disconnects.
             mWasSpeakerOn = false;
         }
 
-        setSystemAudioState(mAudioState.isMuted(), newRoute, supportedRoutes);
+        setSystemAudioState(mCallAudioState.isMuted(), newRoute, supportedRoutes);
     }
 
     boolean isBluetoothAudioOn() {
@@ -308,10 +310,11 @@
         return mBluetoothManager.isBluetoothAvailable();
     }
 
-    private void saveAudioState(AudioState audioState) {
-        mAudioState = audioState;
-        mStatusBarNotifier.notifyMute(mAudioState.isMuted());
-        mStatusBarNotifier.notifySpeakerphone(mAudioState.getRoute() == AudioState.ROUTE_SPEAKER);
+    private void saveAudioState(CallAudioState callAudioState) {
+        mCallAudioState = callAudioState;
+        mStatusBarNotifier.notifyMute(mCallAudioState.isMuted());
+        mStatusBarNotifier.notifySpeakerphone(mCallAudioState.getRoute()
+                == CallAudioState.ROUTE_SPEAKER);
     }
 
     private void onCallUpdated(Call call) {
@@ -338,35 +341,34 @@
             return;
         }
 
-        AudioState oldAudioState = mAudioState;
-        saveAudioState(new AudioState(isMuted, route, supportedRouteMask));
-        if (!force && Objects.equals(oldAudioState, mAudioState)) {
+        CallAudioState oldAudioState = mCallAudioState;
+        saveAudioState(new CallAudioState(isMuted, route, supportedRouteMask));
+        if (!force && Objects.equals(oldAudioState, mCallAudioState)) {
             return;
         }
-        Log.i(this, "changing audio state from %s to %s", oldAudioState, mAudioState);
+        Log.i(this, "changing audio state from %s to %s", oldAudioState, mCallAudioState);
 
         // Mute.
-        if (mAudioState.isMuted() != mAudioManager.isMicrophoneMute()) {
-            Log.i(this, "changing microphone mute state to: %b", mAudioState.isMuted());
-            mAudioManager.setMicrophoneMute(mAudioState.isMuted());
+        if (mCallAudioState.isMuted() != mAudioManager.isMicrophoneMute()) {
+            Log.i(this, "changing microphone mute state to: %b", mCallAudioState.isMuted());
+            mAudioManager.setMicrophoneMute(mCallAudioState.isMuted());
         }
 
         // Audio route.
-        if (mAudioState.getRoute() == AudioState.ROUTE_BLUETOOTH) {
+        if (mCallAudioState.getRoute() == CallAudioState.ROUTE_BLUETOOTH) {
             turnOnSpeaker(false);
             turnOnBluetooth(true);
-        } else if (mAudioState.getRoute() == AudioState.ROUTE_SPEAKER) {
+        } else if (mCallAudioState.getRoute() == CallAudioState.ROUTE_SPEAKER) {
             turnOnBluetooth(false);
             turnOnSpeaker(true);
-        } else if (mAudioState.getRoute() == AudioState.ROUTE_EARPIECE ||
-                mAudioState.getRoute() == AudioState.ROUTE_WIRED_HEADSET) {
+        } else if (mCallAudioState.getRoute() == CallAudioState.ROUTE_EARPIECE ||
+                mCallAudioState.getRoute() == CallAudioState.ROUTE_WIRED_HEADSET) {
             turnOnBluetooth(false);
             turnOnSpeaker(false);
         }
 
-        if (!oldAudioState.equals(mAudioState)) {
-            mCallsManager
-                    .onAudioStateChanged(oldAudioState, mAudioState);
+        if (!oldAudioState.equals(mCallAudioState)) {
+            mCallsManager.onCallAudioStateChanged(oldAudioState, mCallAudioState);
             updateAudioForForegroundCall();
         }
     }
@@ -490,37 +492,37 @@
         // Since they are mutually exclusive and one is ALWAYS valid, we allow a special input of
         // ROUTE_WIRED_OR_EARPIECE so that callers dont have to make a call to check which is
         // supported before calling setAudioRoute.
-        if (route == AudioState.ROUTE_WIRED_OR_EARPIECE) {
-            route = AudioState.ROUTE_WIRED_OR_EARPIECE & supportedRouteMask;
+        if (route == CallAudioState.ROUTE_WIRED_OR_EARPIECE) {
+            route = CallAudioState.ROUTE_WIRED_OR_EARPIECE & supportedRouteMask;
             if (route == 0) {
                 Log.wtf(this, "One of wired headset or earpiece should always be valid.");
                 // assume earpiece in this case.
-                route = AudioState.ROUTE_EARPIECE;
+                route = CallAudioState.ROUTE_EARPIECE;
             }
         }
         return route;
     }
 
     private int calculateSupportedRoutes() {
-        int routeMask = AudioState.ROUTE_SPEAKER;
+        int routeMask = CallAudioState.ROUTE_SPEAKER;
 
         if (mWiredHeadsetManager.isPluggedIn()) {
-            routeMask |= AudioState.ROUTE_WIRED_HEADSET;
+            routeMask |= CallAudioState.ROUTE_WIRED_HEADSET;
         } else {
-            routeMask |= AudioState.ROUTE_EARPIECE;
+            routeMask |= CallAudioState.ROUTE_EARPIECE;
         }
 
         if (mBluetoothManager.isBluetoothAvailable()) {
-            routeMask |=  AudioState.ROUTE_BLUETOOTH;
+            routeMask |=  CallAudioState.ROUTE_BLUETOOTH;
         }
 
         return routeMask;
     }
 
-    private AudioState getInitialAudioState(Call call) {
+    private CallAudioState getInitialAudioState(Call call) {
         int supportedRouteMask = calculateSupportedRoutes();
         int route = selectWiredOrEarpiece(
-                AudioState.ROUTE_WIRED_OR_EARPIECE, supportedRouteMask);
+                CallAudioState.ROUTE_WIRED_OR_EARPIECE, supportedRouteMask);
 
         // We want the UI to indicate that "bluetooth is in use" in two slightly different cases:
         // (a) The obvious case: if a bluetooth headset is currently in use for an ongoing call.
@@ -535,18 +537,18 @@
                 case CallState.DIALING:
                 case CallState.CONNECTING:
                 case CallState.RINGING:
-                    route = AudioState.ROUTE_BLUETOOTH;
+                    route = CallAudioState.ROUTE_BLUETOOTH;
                     break;
                 default:
                     break;
             }
         }
 
-        return new AudioState(false, route, supportedRouteMask);
+        return new CallAudioState(false, route, supportedRouteMask);
     }
 
     private void setInitialAudioState(Call call, boolean force) {
-        AudioState audioState = getInitialAudioState(call);
+        CallAudioState audioState = getInitialAudioState(call);
         Log.v(this, "setInitialAudioState %s, %s", audioState, call);
         setSystemAudioState(
                 force, audioState.isMuted(), audioState.getRoute(),
@@ -556,7 +558,7 @@
     private void updateAudioForForegroundCall() {
         Call call = mCallsManager.getForegroundCall();
         if (call != null && call.getConnectionService() != null) {
-            call.getConnectionService().onAudioStateChanged(call, mAudioState);
+            call.getConnectionService().onCallAudioStateChanged(call, mCallAudioState);
         }
     }
 
@@ -590,7 +592,7 @@
      * @param pw The {@code IndentingPrintWriter} to write the state to.
      */
     public void dump(IndentingPrintWriter pw) {
-        pw.println("mAudioState: " + mAudioState);
+        pw.println("mAudioState: " + mCallAudioState);
         pw.println("mBluetoothManager:");
         pw.increaseIndent();
         mBluetoothManager.dump(pw);
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index a638a3e..845fe7f 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -25,6 +25,7 @@
 import android.os.Trace;
 import android.provider.CallLog.Calls;
 import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 import android.telecom.Conference;
 import android.telecom.Connection;
 import android.telecom.DisconnectCause;
@@ -73,7 +74,7 @@
         void onIncomingCallAnswered(Call call);
         void onIncomingCallRejected(Call call, boolean rejectWithMessage, String textMessage);
         void onForegroundCallChanged(Call oldForegroundCall, Call newForegroundCall);
-        void onAudioStateChanged(AudioState oldAudioState, AudioState newAudioState);
+        void onCallAudioStateChanged(CallAudioState oldAudioState, CallAudioState newAudioState);
         void onRingbackRequested(Call call, boolean ringback);
         void onIsConferencedChanged(Call call);
         void onIsVoipAudioModeChanged(Call call);
@@ -406,8 +407,8 @@
         return false;
     }
 
-    AudioState getAudioState() {
-        return mCallAudioManager.getAudioState();
+    CallAudioState getAudioState() {
+        return mCallAudioManager.getCallAudioState();
     }
 
     boolean isTtySupported() {
@@ -891,10 +892,10 @@
     }
 
     /** Called when the audio state changes. */
-    void onAudioStateChanged(AudioState oldAudioState, AudioState newAudioState) {
+    void onCallAudioStateChanged(CallAudioState oldAudioState, CallAudioState newAudioState) {
         Log.v(this, "onAudioStateChanged, audioState: %s -> %s", oldAudioState, newAudioState);
         for (CallsManagerListener listener : mListeners) {
-            listener.onAudioStateChanged(oldAudioState, newAudioState);
+            listener.onCallAudioStateChanged(oldAudioState, newAudioState);
         }
     }
 
@@ -1450,7 +1451,7 @@
      */
     private void maybeMoveToSpeakerPhone(Call call) {
         if (call.getStartWithSpeakerphoneOn()) {
-            setAudioRoute(AudioState.ROUTE_SPEAKER);
+            setAudioRoute(CallAudioState.ROUTE_SPEAKER);
             call.setStartWithSpeakerphoneOn(false);
         }
     }
diff --git a/src/com/android/server/telecom/CallsManagerListenerBase.java b/src/com/android/server/telecom/CallsManagerListenerBase.java
index 6b54709..129f9ae 100644
--- a/src/com/android/server/telecom/CallsManagerListenerBase.java
+++ b/src/com/android/server/telecom/CallsManagerListenerBase.java
@@ -17,6 +17,7 @@
 package com.android.server.telecom;
 
 import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 
 /**
  * Provides a default implementation for listeners of CallsManager.
@@ -54,7 +55,8 @@
     }
 
     @Override
-    public void onAudioStateChanged(AudioState oldAudioState, AudioState newAudioState) {
+    public void onCallAudioStateChanged(CallAudioState oldAudioState,
+            CallAudioState newAudioState) {
     }
 
     @Override
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index 82b99cc..a6bac09 100644
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -25,6 +25,7 @@
 import android.os.RemoteException;
 import android.os.UserHandle;
 import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 import android.telecom.Connection;
 import android.telecom.ConnectionRequest;
 import android.telecom.ConnectionService;
@@ -714,13 +715,13 @@
         }
     }
 
-    /** @see IConnectionService#onAudioStateChanged(String,AudioState) */
-    void onAudioStateChanged(Call activeCall, AudioState audioState) {
+    /** @see IConnectionService#onCallAudioStateChanged(String,CallAudioState) */
+    void onCallAudioStateChanged(Call activeCall, CallAudioState audioState) {
         final String callId = mCallIdMapper.getCallId(activeCall);
-        if (callId != null && isServiceValid("onAudioStateChanged")) {
+        if (callId != null && isServiceValid("onCallAudioStateChanged")) {
             try {
-                logOutgoing("onAudioStateChanged %s %s", callId, audioState);
-                mServiceInterface.onAudioStateChanged(callId, audioState);
+                logOutgoing("onCallAudioStateChanged %s %s", callId, audioState);
+                mServiceInterface.onCallAudioStateChanged(callId, audioState);
             } catch (RemoteException e) {
             }
         }
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 0855659..ebbc673 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -31,6 +31,7 @@
 import android.os.Trace;
 import android.os.UserHandle;
 import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 import android.telecom.Connection;
 import android.telecom.DefaultDialerManager;
 import android.telecom.InCallService;
@@ -200,13 +201,14 @@
     }
 
     @Override
-    public void onAudioStateChanged(AudioState oldAudioState, AudioState newAudioState) {
+    public void onCallAudioStateChanged(CallAudioState oldCallAudioState,
+            CallAudioState newCallAudioState) {
         if (!mInCallServices.isEmpty()) {
-            Log.i(this, "Calling onAudioStateChanged, audioState: %s -> %s", oldAudioState,
-                    newAudioState);
+            Log.i(this, "Calling onAudioStateChanged, audioState: %s -> %s", oldCallAudioState,
+                    newCallAudioState);
             for (IInCallService inCallService : mInCallServices.values()) {
                 try {
-                    inCallService.onAudioStateChanged(newAudioState);
+                    inCallService.onCallAudioStateChanged(newCallAudioState);
                 } catch (RemoteException ignored) {
                 }
             }
@@ -381,7 +383,7 @@
                 } catch (RemoteException ignored) {
                 }
             }
-            onAudioStateChanged(
+            onCallAudioStateChanged(
                     null,
                     mCallsManager.getAudioState());
             onCanAddCallChanged(mCallsManager.canAddCall());
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
index a27be39..2982916 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionManager.java
@@ -18,6 +18,7 @@
 
 import android.net.Uri;
 import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 import android.telecom.Conference;
 import android.telecom.Connection;
 import android.telecom.ConnectionRequest;
@@ -172,8 +173,8 @@
         }
 
         @Override
-        public void onAudioStateChanged(AudioState state) {
-            mRemote.setAudioState(state);
+        public void onCallAudioStateChanged(CallAudioState state) {
+            mRemote.setCallAudioState(state);
         }
 
         private void setState(int state) {
diff --git a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
index b7682b4..72dae74 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestConnectionService.java
@@ -242,9 +242,6 @@
             setActive();
         }
 
-        @Override
-        public void onAudioStateChanged(AudioState state) { }
-
         public void setTestVideoCallProvider(TestVideoProvider testVideoCallProvider) {
             mTestVideoCallProvider = testVideoCallProvider;
         }
diff --git a/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java b/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java
index 3c4ff8d..2dd4b97 100644
--- a/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/InCallServiceFixture.java
@@ -25,6 +25,7 @@
 import android.os.IInterface;
 import android.os.RemoteException;
 import android.telecom.AudioState;
+import android.telecom.CallAudioState;
 import android.telecom.ParcelableCall;
 
 import java.util.HashMap;
@@ -37,7 +38,7 @@
 
     public String mLatestCallId;
     public IInCallAdapter mInCallAdapter;
-    public AudioState mAudioState;
+    public CallAudioState mCallAudioState;
     public final Map<String, ParcelableCall> mCallById = new HashMap<>();
     public final Map<String, String> mPostDialById = new HashMap<>();
     public final Map<String, String> mPostDialWaitById = new HashMap<>();
@@ -88,8 +89,8 @@
         }
 
         @Override
-        public void onAudioStateChanged(AudioState audioState) throws RemoteException {
-            mAudioState = audioState;
+        public void onCallAudioStateChanged(CallAudioState audioState) throws RemoteException {
+            mCallAudioState = audioState;
         }
 
         @Override