diff options
-rw-r--r-- | src/com/android/server/telecom/CallAudioManager.java | 11 | ||||
-rw-r--r-- | src/com/android/server/telecom/CallAudioRouteStateMachine.java | 15 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java index bf4f1df0..8fd2705c 100644 --- a/src/com/android/server/telecom/CallAudioManager.java +++ b/src/com/android/server/telecom/CallAudioManager.java @@ -200,6 +200,10 @@ public class CallAudioManager extends CallsManagerListenerBase { @Override public void onIncomingCallAnswered(Call call) { + if (!mCalls.contains(call)) { + return; + } + // This is called after the UI answers the call, but before the connection service // sets the call to active. Only thing to handle for mode here is the audio speedup thing. @@ -408,6 +412,11 @@ public class CallAudioManager extends CallsManagerListenerBase { } void dump(IndentingPrintWriter pw) { + pw.println("All calls:"); + pw.increaseIndent(); + dumpCallsInCollection(pw, mCalls); + pw.decreaseIndent(); + pw.println("Active dialing, or connecting calls:"); pw.increaseIndent(); dumpCallsInCollection(pw, mActiveDialingOrConnectingCalls); @@ -538,6 +547,8 @@ public class CallAudioManager extends CallsManagerListenerBase { } if (mForegroundCall != oldForegroundCall) { + mCallAudioRouteStateMachine.sendMessageWithSessionInfo( + CallAudioRouteStateMachine.UPDATE_SYSTEM_AUDIO_ROUTE); mDtmfLocalTonePlayer.onForegroundCallChanged(oldForegroundCall, mForegroundCall); maybePlayHoldTone(); } diff --git a/src/com/android/server/telecom/CallAudioRouteStateMachine.java b/src/com/android/server/telecom/CallAudioRouteStateMachine.java index 5f722ddd..5234a820 100644 --- a/src/com/android/server/telecom/CallAudioRouteStateMachine.java +++ b/src/com/android/server/telecom/CallAudioRouteStateMachine.java @@ -92,6 +92,8 @@ public class CallAudioRouteStateMachine extends StateMachine { public static final int USER_SWITCH_SPEAKER = 1104; public static final int USER_SWITCH_BASELINE_ROUTE = 1105; + public static final int UPDATE_SYSTEM_AUDIO_ROUTE = 1201; + public static final int MUTE_ON = 3001; public static final int MUTE_OFF = 3002; public static final int TOGGLE_MUTE = 3003; @@ -1071,6 +1073,9 @@ public class CallAudioRouteStateMachine extends StateMachine { sendInternalMessage(MUTE_ON); } return; + case UPDATE_SYSTEM_AUDIO_ROUTE: + resendSystemAudioState(); + return; case RUN_RUNNABLE: java.lang.Runnable r = (java.lang.Runnable) msg.obj; r.run(); @@ -1151,12 +1156,20 @@ public class CallAudioRouteStateMachine extends StateMachine { } private void setSystemAudioState(CallAudioState newCallAudioState) { + setSystemAudioState(newCallAudioState, false); + } + + private void resendSystemAudioState() { + setSystemAudioState(mLastKnownCallAudioState, true); + } + + private void setSystemAudioState(CallAudioState newCallAudioState, boolean force) { Log.i(this, "setSystemAudioState: changing from %s to %s", mLastKnownCallAudioState, newCallAudioState); Log.event(mCallsManager.getForegroundCall(), Log.Events.AUDIO_ROUTE, CallAudioState.audioRouteToString(newCallAudioState.getRoute())); - if (!newCallAudioState.equals(mLastKnownCallAudioState)) { + if (force || !newCallAudioState.equals(mLastKnownCallAudioState)) { mCallsManager.onCallAudioStateChanged(mLastKnownCallAudioState, newCallAudioState); updateAudioForForegroundCall(newCallAudioState); mLastKnownCallAudioState = newCallAudioState; |