Loading src/com/android/server/telecom/CallAudioRouteController.java +2 −15 Original line number Diff line number Diff line Loading @@ -533,14 +533,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { mIsScoAudioConnected); mIsActive = active; mPendingAudioRoute.evaluatePendingState(); postTimeoutMessage(); } private void postTimeoutMessage() { // reset timeout handler mHandler.removeMessages(PENDING_ROUTE_TIMEOUT); mHandler.postDelayed(() -> mHandler.sendMessage( Message.obtain(mHandler, PENDING_ROUTE_TIMEOUT)), TIMEOUT_LIMIT); } private void handleWiredHeadsetConnected() { Loading Loading @@ -657,9 +649,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { mPendingAudioRoute.onMessageReceived(new Pair<>(BT_AUDIO_CONNECTED, bluetoothDevice.getAddress()), null); } } else { // ignore, not triggered by telecom Log.i(this, "handleBtAudioActive: ignoring handling bt audio active."); } } Loading @@ -679,9 +668,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { mPendingAudioRoute.onMessageReceived(new Pair<>(BT_AUDIO_DISCONNECTED, bluetoothDevice.getAddress()), null); } } else { // ignore, not triggered by telecom Log.i(this, "handleBtAudioInactive: ignoring handling bt audio inactive."); } } Loading Loading @@ -1227,7 +1213,8 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { public AudioRoute getBaseRoute(boolean includeBluetooth, String btAddressToExclude) { AudioRoute destRoute = getPreferredAudioRouteFromStrategy(); if (destRoute == null || (destRoute.getBluetoothAddress() != null && !includeBluetooth)) { if (destRoute == null || (destRoute.getBluetoothAddress() != null && (!includeBluetooth || destRoute.getBluetoothAddress().equals(btAddressToExclude)))) { destRoute = getPreferredAudioRouteFromDefault(includeBluetooth, btAddressToExclude); } if (destRoute != null && !getCallSupportedRoutes().contains(destRoute)) { Loading src/com/android/server/telecom/bluetooth/BluetoothStateReceiver.java +15 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.server.telecom.CallAudioRouteAdapter.BT_AUDIO_DISCONNE import static com.android.server.telecom.CallAudioRouteAdapter.BT_DEVICE_ADDED; import static com.android.server.telecom.CallAudioRouteAdapter.BT_DEVICE_REMOVED; import static com.android.server.telecom.CallAudioRouteAdapter.PENDING_ROUTE_FAILED; import static com.android.server.telecom.CallAudioRouteAdapter.SWITCH_BASELINE_ROUTE; import static com.android.server.telecom.CallAudioRouteController.INCLUDE_BLUETOOTH_IN_BASELINE; import static com.android.server.telecom.bluetooth.BluetoothRouteManager.BT_AUDIO_IS_ON; import static com.android.server.telecom.bluetooth.BluetoothRouteManager.BT_AUDIO_LOST; Loading Loading @@ -153,8 +155,19 @@ public class BluetoothStateReceiver extends BroadcastReceiver { CallAudioRouteController audioRouteController = (CallAudioRouteController) mCallAudioRouteAdapter; audioRouteController.setIsScoAudioConnected(false); if (audioRouteController.isPending()) { mCallAudioRouteAdapter.sendMessageWithSessionInfo(BT_AUDIO_DISCONNECTED, 0, device); } else { // Handle case where BT stack signals SCO disconnected but Telecom isn't // processing any pending routes. This explicitly addresses cf instances // where a remote device disconnects SCO. Telecom should ensure that audio // is properly routed in the UI. audioRouteController.getPendingAudioRoute() .setCommunicationDeviceType(AudioRoute.TYPE_INVALID); mCallAudioRouteAdapter.sendMessageWithSessionInfo(SWITCH_BASELINE_ROUTE, INCLUDE_BLUETOOTH_IN_BASELINE, device.getAddress()); } } else { mBluetoothRouteManager.sendMessage(BT_AUDIO_LOST, args); } Loading Loading
src/com/android/server/telecom/CallAudioRouteController.java +2 −15 Original line number Diff line number Diff line Loading @@ -533,14 +533,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { mIsScoAudioConnected); mIsActive = active; mPendingAudioRoute.evaluatePendingState(); postTimeoutMessage(); } private void postTimeoutMessage() { // reset timeout handler mHandler.removeMessages(PENDING_ROUTE_TIMEOUT); mHandler.postDelayed(() -> mHandler.sendMessage( Message.obtain(mHandler, PENDING_ROUTE_TIMEOUT)), TIMEOUT_LIMIT); } private void handleWiredHeadsetConnected() { Loading Loading @@ -657,9 +649,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { mPendingAudioRoute.onMessageReceived(new Pair<>(BT_AUDIO_CONNECTED, bluetoothDevice.getAddress()), null); } } else { // ignore, not triggered by telecom Log.i(this, "handleBtAudioActive: ignoring handling bt audio active."); } } Loading @@ -679,9 +668,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { mPendingAudioRoute.onMessageReceived(new Pair<>(BT_AUDIO_DISCONNECTED, bluetoothDevice.getAddress()), null); } } else { // ignore, not triggered by telecom Log.i(this, "handleBtAudioInactive: ignoring handling bt audio inactive."); } } Loading Loading @@ -1227,7 +1213,8 @@ public class CallAudioRouteController implements CallAudioRouteAdapter { public AudioRoute getBaseRoute(boolean includeBluetooth, String btAddressToExclude) { AudioRoute destRoute = getPreferredAudioRouteFromStrategy(); if (destRoute == null || (destRoute.getBluetoothAddress() != null && !includeBluetooth)) { if (destRoute == null || (destRoute.getBluetoothAddress() != null && (!includeBluetooth || destRoute.getBluetoothAddress().equals(btAddressToExclude)))) { destRoute = getPreferredAudioRouteFromDefault(includeBluetooth, btAddressToExclude); } if (destRoute != null && !getCallSupportedRoutes().contains(destRoute)) { Loading
src/com/android/server/telecom/bluetooth/BluetoothStateReceiver.java +15 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import static com.android.server.telecom.CallAudioRouteAdapter.BT_AUDIO_DISCONNE import static com.android.server.telecom.CallAudioRouteAdapter.BT_DEVICE_ADDED; import static com.android.server.telecom.CallAudioRouteAdapter.BT_DEVICE_REMOVED; import static com.android.server.telecom.CallAudioRouteAdapter.PENDING_ROUTE_FAILED; import static com.android.server.telecom.CallAudioRouteAdapter.SWITCH_BASELINE_ROUTE; import static com.android.server.telecom.CallAudioRouteController.INCLUDE_BLUETOOTH_IN_BASELINE; import static com.android.server.telecom.bluetooth.BluetoothRouteManager.BT_AUDIO_IS_ON; import static com.android.server.telecom.bluetooth.BluetoothRouteManager.BT_AUDIO_LOST; Loading Loading @@ -153,8 +155,19 @@ public class BluetoothStateReceiver extends BroadcastReceiver { CallAudioRouteController audioRouteController = (CallAudioRouteController) mCallAudioRouteAdapter; audioRouteController.setIsScoAudioConnected(false); if (audioRouteController.isPending()) { mCallAudioRouteAdapter.sendMessageWithSessionInfo(BT_AUDIO_DISCONNECTED, 0, device); } else { // Handle case where BT stack signals SCO disconnected but Telecom isn't // processing any pending routes. This explicitly addresses cf instances // where a remote device disconnects SCO. Telecom should ensure that audio // is properly routed in the UI. audioRouteController.getPendingAudioRoute() .setCommunicationDeviceType(AudioRoute.TYPE_INVALID); mCallAudioRouteAdapter.sendMessageWithSessionInfo(SWITCH_BASELINE_ROUTE, INCLUDE_BLUETOOTH_IN_BASELINE, device.getAddress()); } } else { mBluetoothRouteManager.sendMessage(BT_AUDIO_LOST, args); } Loading