BluetoothDeviceManager.java: add null check before call mBluetoothAdapter.getActiveDevices
As the bluetoothAdapter might be null, we need to check first before
we call mBluetoothAdapter.getActiveDevices like before.
Otherwise we would get following crash errors when there is no bluetooth feature
with the platform.
10-09 16:12:33.654 953 953 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
10-09 16:12:33.654 953 953 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List android.bluetooth.BluetoothAdapter.getActiveDevices(int)' on a null object reference
10-09 16:12:33.654 953 953 E AndroidRuntime: at com.android.server.telecom.bluetooth.BluetoothDeviceManager.getUniqueConnectedDevices(BluetoothDeviceManager.java:160)
10-09 16:12:33.654 953 953 E AndroidRuntime: at com.android.server.telecom.bluetooth.BluetoothRouteManager.getConnectedDevices(BluetoothRouteManager.java:611)
10-09 16:12:33.654 953 953 E AndroidRuntime: at com.android.server.telecom.CallAudioRouteStateMachine.getInitialAudioState(CallAudioRouteStateMachine.java:1810)
10-09 16:12:33.654 953 953 E AndroidRuntime: at com.android.server.telecom.CallAudioRouteStateMachine.initialize(CallAudioRouteStateMachine.java:1524)
10-09 16:12:33.654 953 953 E AndroidRuntime: at com.android.server.telecom.CallsManager.<init>(CallsManager.java:524)
10-09 16:12:33.654 953 953 E AndroidRuntime: at com.android.server.telecom.TelecomSystem.<init>(TelecomSystem.java:322)
Test: boot tested with x15 build
Signed-off-by:
Yongqin Liu <yongqin.liu@linaro.org>
Change-Id: Ib42ba98211dc74dcc59fab8171e6a41795161334
Loading
Please register or sign in to comment