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

Commit c9e4372f authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Save off foreground user id before passing the message to the handler on am: eda5120b

parents fd8f9ca7 eda5120b
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1548,7 +1548,14 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
        if (DBG) {
            Log.d(TAG, "User " + userHandle + " switched");
        }
        mHandler.obtainMessage(MESSAGE_USER_SWITCHED, userHandle.getIdentifier(), 0).sendToTarget();

        // Save the foreground user id and propagate to BT process after it's restarted
        int toUserId = userHandle.getIdentifier();
        if (mForegroundUserId != toUserId) {
            mForegroundUserId = toUserId;
        }

        mHandler.obtainMessage(MESSAGE_USER_SWITCHED, toUserId, 0).sendToTarget();
    }

    /**
@@ -2377,12 +2384,6 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
                    }
                    mHandler.removeMessages(MESSAGE_USER_SWITCHED);

                    // Save the foreground user id and propagate to BT process after it's restarted
                    int toUserId = msg.arg1;
                    if (mForegroundUserId != toUserId) {
                        mForegroundUserId = toUserId;
                    }

                    /* disable and enable BT when detect a user switch */
                    if (mBluetooth != null && isEnabled()) {
                        restartForReason(BluetoothProtoEnums.ENABLE_DISABLE_REASON_USER_SWITCH);