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

Commit 76880870 authored by Eunae Kim's avatar Eunae Kim Committed by Android Git Automerger
Browse files

am 218a0666: Fix a bug that the RecentTask list of other’s may show up to non-primary users.

* commit '218a0666a5235bc76f2950684bbfcb500e89972c':
  Fix a bug that the RecentTask list of other’s may show up to non-primary users.
parents 635e039a ad3aa32f
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -3638,6 +3638,27 @@ public final class ActivityManagerService extends ActivityManagerNative
        return ret;
    }
    //explicitly remove thd old information in mRecentTasks when removing existing user.
    private void removeRecentTasksForUser(int userId) {
        if(userId <= 0) {
            Slog.i(TAG, "Can't remove recent task on user " + userId);
            return;
        }
        for (int i = mRecentTasks.size() - 1; i >= 0; --i) {
            TaskRecord tr = mRecentTasks.get(i);
            if (tr.userId == userId) {
                if(DEBUG_TASKS) Slog.i(TAG, "remove RecentTask " + tr
                        + " when finishing user" + userId);
                tr.disposeThumbnail();
                mRecentTasks.remove(i);
            }
        }
        // Remove tasks from persistent storage.
        mTaskPersister.wakeup(null, true);
    }
    final void addRecentTaskLocked(TaskRecord task) {
        int N = mRecentTasks.size();
        // Quick case: check if the top-most recent task is the same.
@@ -17642,6 +17663,9 @@ public final class ActivityManagerService extends ActivityManagerNative
            }
        }
        // Explicitly remove the old information in mRecentTasks.
        removeRecentTasksForUser(userId);
        for (int i=0; i<callbacks.size(); i++) {
            try {
                if (stopped) callbacks.get(i).userStopped(userId);