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

Commit 1384a6cc authored by Craig Mautner's avatar Craig Mautner Committed by Android (Google) Code Review
Browse files

Revert "Update histories simultaneously."

Moving to master where it can be cherry-picked.

This reverts commit ce361f5f

Change-Id: I0880a28c6fa5588ff2cab7995c90528f36bffd2e
parent ce361f5f
Loading
Loading
Loading
Loading
+37 −32
Original line number Diff line number Diff line
@@ -4850,38 +4850,10 @@ final class ActivityStack {
     * @return Returns true if the move completed, false if not.
     */
    final boolean moveTaskToBackLocked(int task, ActivityRecord reason) {
        Slog.i(TAG, "moveTaskToBack: " + task);

        // If we have a watcher, preflight the move before committing to it.  First check
        // for *other* available tasks, but if none are available, then try again allowing the
        // current task to be selected.
        if (mMainStack && mService.mController != null) {
            ActivityRecord next = topRunningActivityLocked(null, task);
            if (next == null) {
                next = topRunningActivityLocked(null, 0);
            }
            if (next != null) {
                // ask watcher if this is allowed
                boolean moveOK = true;
                try {
                    moveOK = mService.mController.activityResuming(next.packageName);
                } catch (RemoteException e) {
                    mService.mController = null;
                }
                if (!moveOK) {
        if (!newMoveTaskToBackLocked(task, reason)) {
            return false;
        }
            }
        }

        if (DEBUG_TRANSITION) Slog.v(TAG,
                "Prepare to back transition: task=" + task);

        final TaskRecord tr = mTaskIdToTaskRecord.get(task);
        mTaskHistory.remove(tr);
        mTaskHistory.add(0, tr);

        // BEGIN REGION TO REMOVE.
        final int N = mHistory.size();
        int bottom = 0;
        int pos = 0;
@@ -4909,7 +4881,41 @@ final class ActivityStack {
        if (VALIDATE_TASK_REPLACE) {
            verifyActivityRecords(true);
        }
        // END REGION TO REMOVE

        return true;
    }

    final boolean newMoveTaskToBackLocked(int task, ActivityRecord reason) {
        Slog.i(TAG, "moveTaskToBack: " + task);
        
        // If we have a watcher, preflight the move before committing to it.  First check
        // for *other* available tasks, but if none are available, then try again allowing the
        // current task to be selected.
        if (mMainStack && mService.mController != null) {
            ActivityRecord next = topRunningActivityLocked(null, task);
            if (next == null) {
                next = topRunningActivityLocked(null, 0);
            }
            if (next != null) {
                // ask watcher if this is allowed
                boolean moveOK = true;
                try {
                    moveOK = mService.mController.activityResuming(next.packageName);
                } catch (RemoteException e) {
                    mService.mController = null;
                }
                if (!moveOK) {
                    return false;
                }
            }
        }

        if (DEBUG_TRANSITION) Slog.v(TAG,
                "Prepare to back transition: task=" + task);

        final TaskRecord tr = mTaskIdToTaskRecord.get(task);
        mTaskHistory.remove(tr);
        mTaskHistory.add(0, tr);

        if (reason != null &&
                (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
@@ -4923,7 +4929,6 @@ final class ActivityStack {
                    AppTransition.TRANSIT_TASK_TO_BACK, false);
        }
        mService.mWindowManager.moveTaskToBottom(task);

        if (VALIDATE_TOKENS) {
            validateAppTokensLocked();
        }
+0 −1
Original line number Diff line number Diff line
@@ -3158,7 +3158,6 @@ public class WindowManagerService extends IWindowManager.Stub
            if (mismatch || iterator.hasNext()) {
                Slog.w(TAG, "validateAppTokens: Mismatch! ActivityManager=" + tasks);
                Slog.w(TAG, "validateAppTokens: Mismatch! WindowManager=" + iterator);
                Slog.w(TAG, "validateAppTokens: Mismatch! Callers=" + Debug.getCallers(4));
            }
        }
    }