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

Commit 730bf061 authored by Winson's avatar Winson Committed by Winson Chung
Browse files

Fixing issue where affiliated task last-active-times were inconsistent.

- We rely on the last-active-times of the task records to order tasks
  in Recents, but for affiliated tasks, their last-active-time was never
  set until the task was launched.  This change just ensures that all
  tasks have a valid last-active-time, and for affiliated tasks, ensures
  that the task that they were launched behind always has a later
  last-active-time.

Bug: 27597746
Change-Id: I9692c2b48ac6d12266de90bdf423f689402a94c2
parent dec4430d
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -2738,12 +2738,21 @@ public final class ActivityStackSupervisor implements DisplayListener {

    // Called when WindowManager has finished animating the launchingBehind activity to the back.
    void handleLaunchTaskBehindCompleteLocked(ActivityRecord r) {
        r.mLaunchTaskBehind = false;
        final TaskRecord task = r.task;
        task.setLastThumbnailLocked(task.stack.screenshotActivitiesLocked(r));
        final ActivityStack stack = task.stack;

        r.mLaunchTaskBehind = false;
        task.setLastThumbnailLocked(stack.screenshotActivitiesLocked(r));
        mRecentTasks.addLocked(task);
        mService.notifyTaskStackChangedLocked();
        mWindowManager.setAppVisibility(r.appToken, false);

        // When launching tasks behind, update the last active time of the top task after the new
        // task has been shown briefly
        final ActivityRecord top = stack.topActivity();
        if (top != null) {
            top.task.touchActiveTime();
        }
    }

    void scheduleLaunchTaskBehindComplete(IBinder token) {
+2 −0
Original line number Diff line number Diff line
@@ -285,6 +285,7 @@ final class TaskRecord {
        mCallingPackage = info.packageName;
        setIntent(_intent, info);
        setMinDimensions(info);
        touchActiveTime();
    }

    TaskRecord(ActivityManagerService service, int _taskId, ActivityInfo info, Intent _intent,
@@ -315,6 +316,7 @@ final class TaskRecord {
        taskType = APPLICATION_ACTIVITY_TYPE;
        mTaskToReturnTo = HOME_ACTIVITY_TYPE;
        lastTaskDescription = _taskDescription;
        touchActiveTime();
    }

    private TaskRecord(ActivityManagerService service, int _taskId, Intent _intent,