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

Commit d664269d authored by Winson Chung's avatar Winson Chung
Browse files

Fix call to get the current user id from a secondary SystemUI process.

- The secondary SystemUI process's KeyguardUpdateMonitor is not updated
  so we can't rely on it to get the current user id.

Bug: 38372598
Test: Switch users, launch some tasks, and switch back. Ensure that original
      tasks still exist

Change-Id: I26a7c70b5f7032a106dc1342c8b366e4797e8fa0
parent 7415a594
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1023,7 +1023,12 @@ public class SystemServicesProxy {
     * Returns the current user id.
     */
    public int getCurrentUser() {
        return KeyguardUpdateMonitor.getCurrentUser();
        if (mAm == null) return 0;

        // This must call through ActivityManager, as the SystemServicesProxy can be called in a
        // secondary user's SystemUI process, and KeyguardUpdateMonitor is only updated in the
        // primary user's SystemUI process
        return mAm.getCurrentUser();
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ public class RecentsTaskLoadPlan {
        mCurrentQuietProfiles.clear();

        if (currentUserId == UserHandle.USER_CURRENT) {
            currentUserId = KeyguardUpdateMonitor.getCurrentUser();
            currentUserId = SystemServicesProxy.getInstance(mContext).getCurrentUser();
        }
        UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        List<UserInfo> profiles = userManager.getProfiles(currentUserId);