Loading android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java +9 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,9 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac private BluetoothDevice mClassicDeviceToBeActivated = null; private BluetoothDevice mClassicDeviceNotToBeActivated = null; // Timeout for state machine thread join, to prevent potential ANR. private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000; @Override public void onBluetoothStateChange(int prevState, int newState) { mHandler.post(() -> handleAdapterStateChanged(newState)); Loading Loading @@ -849,7 +852,12 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac mAudioManager.unregisterAudioDeviceCallback(mAudioManagerAudioDeviceCallback); mAdapterService.unregisterBluetoothStateCallback(this); if (mHandlerThread != null) { mHandlerThread.quit(); mHandlerThread.quitSafely(); try { mHandlerThread.join(SM_THREAD_JOIN_TIMEOUT_MS); } catch (InterruptedException e) { // Do not rethrow as we are shutting down anyway } mHandlerThread = null; } resetState(); Loading Loading
android/app/src/com/android/bluetooth/btservice/ActiveDeviceManager.java +9 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,9 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac private BluetoothDevice mClassicDeviceToBeActivated = null; private BluetoothDevice mClassicDeviceNotToBeActivated = null; // Timeout for state machine thread join, to prevent potential ANR. private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000; @Override public void onBluetoothStateChange(int prevState, int newState) { mHandler.post(() -> handleAdapterStateChanged(newState)); Loading Loading @@ -849,7 +852,12 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac mAudioManager.unregisterAudioDeviceCallback(mAudioManagerAudioDeviceCallback); mAdapterService.unregisterBluetoothStateCallback(this); if (mHandlerThread != null) { mHandlerThread.quit(); mHandlerThread.quitSafely(); try { mHandlerThread.join(SM_THREAD_JOIN_TIMEOUT_MS); } catch (InterruptedException e) { // Do not rethrow as we are shutting down anyway } mHandlerThread = null; } resetState(); Loading