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

Commit 24bd3c32 authored by Yasin Kilicdere's avatar Yasin Kilicdere
Browse files

Prevent mPendingTargetUserIds queue breaking when a switch fails.

Prevent `mPendingTargetUserIds` queue breaking when a switch in
the queue fails.

This command chain will leave user 10 in foreground. And user 11
in `mPendingTargetUserIds`. Because the 3rd command fails and
re-iteration breaks.

```
adb shell am switch-user -w 0
adb shell am switch-user 10
adb shell am switch-user 10
adb shell am switch-user 11
```

Bug: 411340343

Test: atest UserControllerTest

Test: adb shell am switch-user -w 0
      adb shell am switch-user 10
      adb shell am switch-user 10
      adb shell am switch-user 11

Test: adb shell am switch-user -w 0
      adb shell am switch-user 10
      adb shell am switch-user 11
      adb shell am switch-user 11
      adb shell am switch-user 10

Flag: EXEMPT bugfix

Change-Id: I6a562af0c9b975b9e328cd3308885df4b6b17796
parent 22fde246
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -2316,6 +2316,7 @@ class UserController implements Handler.Callback {
        synchronized (mLock) {
        synchronized (mLock) {
            if (targetUserId == currentUserId && mTargetUserId == UserHandle.USER_NULL) {
            if (targetUserId == currentUserId && mTargetUserId == UserHandle.USER_NULL) {
                Slogf.i(TAG, "user #" + targetUserId + " is already the current user");
                Slogf.i(TAG, "user #" + targetUserId + " is already the current user");
                mHandler.post(this::endUserSwitch);
                return true;
                return true;
            }
            }
            if (targetUserInfo == null) {
            if (targetUserInfo == null) {