Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 074a1681 authored by William Escande's avatar William Escande
Browse files

Remove impossible to reach code during user switch

Bug: 285046954
Bug: 262605980
Test: None yet
Change-Id: I2992e603f996ec6668f0199c7209179b5a108216
parent 496f28ad
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
@@ -2353,7 +2353,7 @@ class BluetoothManagerService {
                    UserHandle userTo = (UserHandle) msg.obj;

                    /* disable and enable BT when detect a user switch */
                    if (mAdapter != null && isEnabled()) {
                    if (mAdapter != null && mState.oneOf(STATE_ON)) {
                        restartForNewUser(userTo);
                    } else if (isBinding() || mAdapter != null) {
                        Message userMsg = Message.obtain(msg);
@@ -2408,24 +2408,8 @@ class BluetoothManagerService {
                mAdapterLock.readLock().unlock();
            }

            if (mState.oneOf(STATE_TURNING_OFF)) {
                // MESSAGE_USER_SWITCHED happened right after MESSAGE_ENABLE
                bluetoothStateChangeHandler(STATE_TURNING_OFF, STATE_OFF);
                mState.set(STATE_OFF);
            }
            if (mState.oneOf(STATE_OFF)) {
                bluetoothStateChangeHandler(STATE_OFF, STATE_TURNING_ON);
                mState.set(STATE_TURNING_ON);
            }

            // TODO(b/285046954): We call unregisterCallback, and yet the code is calling
            // waitForState(STATE_ON)
            // This is a non-sense
            waitForState(STATE_ON);

            if (mState.oneOf(STATE_TURNING_ON)) {
                bluetoothStateChangeHandler(STATE_TURNING_ON, STATE_ON);
            }
            // This method is always called while bluetooth is in STATE_ON
            assert (mState.oneOf(STATE_ON));

            unbindAllBluetoothProfileServices();
            // disable