Loading src/com/android/server/telecom/CallAudioManager.java +19 −2 Original line number Diff line number Diff line Loading @@ -576,9 +576,26 @@ public class CallAudioManager extends CallsManagerListenerBase { @VisibleForTesting public void setCallAudioRouteFocusState(int focusState) { if (mFeatureFlags.useRefactoredAudioRouteSwitching()) { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, focusState, 0); } else { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, focusState); } } public void setCallAudioRouteFocusStateForEndTone() { if (mFeatureFlags.useRefactoredAudioRouteSwitching()) { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, CallAudioRouteStateMachine.ACTIVE_FOCUS, 1); } else { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, CallAudioRouteStateMachine.ACTIVE_FOCUS); } } public void notifyAudioOperationsComplete() { mCallAudioModeStateMachine.sendMessageWithArgs( Loading src/com/android/server/telecom/CallAudioModeStateMachine.java +1 −1 Original line number Diff line number Diff line Loading @@ -824,7 +824,7 @@ public class CallAudioModeStateMachine extends StateMachine { } mAudioManager.setMode(mMostRecentMode); mLocalLog.log("Mode " + mMostRecentMode); mCallAudioManager.setCallAudioRouteFocusState(CallAudioRouteStateMachine.ACTIVE_FOCUS); mCallAudioManager.setCallAudioRouteFocusStateForEndTone(); } @Override Loading src/com/android/server/telecom/CallAudioRouteAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ public interface CallAudioRouteAdapter { void sendMessageWithSessionInfo(int message); void sendMessageWithSessionInfo(int message, int arg); void sendMessageWithSessionInfo(int message, int arg, String data); void sendMessageWithSessionInfo(int message, int arg, int data); void sendMessageWithSessionInfo(int message, int arg, BluetoothDevice bluetoothDevice); void sendMessage(int message, Runnable r); void setCallAudioManager(CallAudioManager callAudioManager); Loading src/com/android/server/telecom/CallAudioRouteController.java +24 −4 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { String address; BluetoothDevice bluetoothDevice; int focus; int handleEndTone; @AudioRoute.AudioRouteType int type; switch (msg.what) { case CONNECT_WIRED_HEADSET: Loading Loading @@ -305,11 +306,18 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { break; case SWITCH_FOCUS: focus = msg.arg1; handleSwitchFocus(focus); handleEndTone = (int) ((SomeArgs) msg.obj).arg2; handleSwitchFocus(focus, handleEndTone); break; case EXIT_PENDING_ROUTE: handleExitPendingRoute(); break; case UPDATE_SYSTEM_AUDIO_ROUTE: updateCallAudioState(new CallAudioState(mIsMute, mCallAudioState.getRoute(), mCallAudioState.getSupportedRouteMask(), mCallAudioState.getActiveBluetoothDevice(), mCallAudioState.getSupportedBluetoothDevices())); default: break; } Loading Loading @@ -397,6 +405,14 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { sendMessage(message, arg, 0, args); } @Override public void sendMessageWithSessionInfo(int message, int arg, int data) { SomeArgs args = SomeArgs.obtain(); args.arg1 = Log.createSubsession(); args.arg2 = data; sendMessage(message, arg, 0, args); } @Override public void sendMessageWithSessionInfo(int message, int arg, BluetoothDevice bluetoothDevice) { SomeArgs args = SomeArgs.obtain(); Loading Loading @@ -766,7 +782,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { onMuteStateChanged(mIsMute); } private void handleSwitchFocus(int focus) { private void handleSwitchFocus(int focus, int handleEndTone) { Log.i(this, "handleSwitchFocus: focus (%s)", focus); mFocusType = focus; switch (focus) { Loading @@ -782,9 +798,13 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { } case ACTIVE_FOCUS -> { // Route to active baseline route (we may need to change audio route in the case // when a video call is put on hold). // when a video call is put on hold). Ignore route changes if we're handling playing // the end tone. Otherwise, it's possible that we'll override the route a client has // previously requested. if (handleEndTone == 0) { routeTo(true, getBaseRoute(true, null)); } } case RINGING_FOCUS -> { if (!mIsActive) { AudioRoute route = getBaseRoute(true, null); Loading src/com/android/server/telecom/CallAudioRouteStateMachine.java +4 −0 Original line number Diff line number Diff line Loading @@ -1685,6 +1685,10 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi sendMessage(message, arg, 0, args); } public void sendMessageWithSessionInfo(int message, int arg, int data) { // ignore, only used in CallAudioRouteController } public void sendMessageWithSessionInfo(int message, int arg, BluetoothDevice bluetoothDevice) { // ignore, only used in CallAudioRouteController } Loading Loading
src/com/android/server/telecom/CallAudioManager.java +19 −2 Original line number Diff line number Diff line Loading @@ -576,9 +576,26 @@ public class CallAudioManager extends CallsManagerListenerBase { @VisibleForTesting public void setCallAudioRouteFocusState(int focusState) { if (mFeatureFlags.useRefactoredAudioRouteSwitching()) { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, focusState, 0); } else { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, focusState); } } public void setCallAudioRouteFocusStateForEndTone() { if (mFeatureFlags.useRefactoredAudioRouteSwitching()) { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, CallAudioRouteStateMachine.ACTIVE_FOCUS, 1); } else { mCallAudioRouteAdapter.sendMessageWithSessionInfo( CallAudioRouteStateMachine.SWITCH_FOCUS, CallAudioRouteStateMachine.ACTIVE_FOCUS); } } public void notifyAudioOperationsComplete() { mCallAudioModeStateMachine.sendMessageWithArgs( Loading
src/com/android/server/telecom/CallAudioModeStateMachine.java +1 −1 Original line number Diff line number Diff line Loading @@ -824,7 +824,7 @@ public class CallAudioModeStateMachine extends StateMachine { } mAudioManager.setMode(mMostRecentMode); mLocalLog.log("Mode " + mMostRecentMode); mCallAudioManager.setCallAudioRouteFocusState(CallAudioRouteStateMachine.ACTIVE_FOCUS); mCallAudioManager.setCallAudioRouteFocusStateForEndTone(); } @Override Loading
src/com/android/server/telecom/CallAudioRouteAdapter.java +1 −0 Original line number Diff line number Diff line Loading @@ -128,6 +128,7 @@ public interface CallAudioRouteAdapter { void sendMessageWithSessionInfo(int message); void sendMessageWithSessionInfo(int message, int arg); void sendMessageWithSessionInfo(int message, int arg, String data); void sendMessageWithSessionInfo(int message, int arg, int data); void sendMessageWithSessionInfo(int message, int arg, BluetoothDevice bluetoothDevice); void sendMessage(int message, Runnable r); void setCallAudioManager(CallAudioManager callAudioManager); Loading
src/com/android/server/telecom/CallAudioRouteController.java +24 −4 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { String address; BluetoothDevice bluetoothDevice; int focus; int handleEndTone; @AudioRoute.AudioRouteType int type; switch (msg.what) { case CONNECT_WIRED_HEADSET: Loading Loading @@ -305,11 +306,18 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { break; case SWITCH_FOCUS: focus = msg.arg1; handleSwitchFocus(focus); handleEndTone = (int) ((SomeArgs) msg.obj).arg2; handleSwitchFocus(focus, handleEndTone); break; case EXIT_PENDING_ROUTE: handleExitPendingRoute(); break; case UPDATE_SYSTEM_AUDIO_ROUTE: updateCallAudioState(new CallAudioState(mIsMute, mCallAudioState.getRoute(), mCallAudioState.getSupportedRouteMask(), mCallAudioState.getActiveBluetoothDevice(), mCallAudioState.getSupportedBluetoothDevices())); default: break; } Loading Loading @@ -397,6 +405,14 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { sendMessage(message, arg, 0, args); } @Override public void sendMessageWithSessionInfo(int message, int arg, int data) { SomeArgs args = SomeArgs.obtain(); args.arg1 = Log.createSubsession(); args.arg2 = data; sendMessage(message, arg, 0, args); } @Override public void sendMessageWithSessionInfo(int message, int arg, BluetoothDevice bluetoothDevice) { SomeArgs args = SomeArgs.obtain(); Loading Loading @@ -766,7 +782,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { onMuteStateChanged(mIsMute); } private void handleSwitchFocus(int focus) { private void handleSwitchFocus(int focus, int handleEndTone) { Log.i(this, "handleSwitchFocus: focus (%s)", focus); mFocusType = focus; switch (focus) { Loading @@ -782,9 +798,13 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { } case ACTIVE_FOCUS -> { // Route to active baseline route (we may need to change audio route in the case // when a video call is put on hold). // when a video call is put on hold). Ignore route changes if we're handling playing // the end tone. Otherwise, it's possible that we'll override the route a client has // previously requested. if (handleEndTone == 0) { routeTo(true, getBaseRoute(true, null)); } } case RINGING_FOCUS -> { if (!mIsActive) { AudioRoute route = getBaseRoute(true, null); Loading
src/com/android/server/telecom/CallAudioRouteStateMachine.java +4 −0 Original line number Diff line number Diff line Loading @@ -1685,6 +1685,10 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi sendMessage(message, arg, 0, args); } public void sendMessageWithSessionInfo(int message, int arg, int data) { // ignore, only used in CallAudioRouteController } public void sendMessageWithSessionInfo(int message, int arg, BluetoothDevice bluetoothDevice) { // ignore, only used in CallAudioRouteController } Loading