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

Commit dfbeed72 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Attempt to break down reset task codepath (71/n)

Was complicated and convoluted before with all the index tracking.
Now it is just mostly complicated as we try to leverage the hierarchy
more for processing.

Bug: 80414790
Test: Existing tests pass
Change-Id: I2f68187160e62fc6b64aba68f7f17368c939f2a2
parent c9dfbc5f
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -333,6 +333,9 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;

/**
 * An entry in the history stack, representing an activity.
@@ -1581,6 +1584,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return this;
    }

    @Override
    boolean hasActivity() {
        // I am an activity!
        return true;
    }

    void setProcess(WindowProcessController proc) {
        app = proc;
        final ActivityRecord root = task != null ? task.getRootActivity() : null;
@@ -3418,10 +3427,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    @Override
    boolean forAllActivities(ToBooleanFunction<ActivityRecord> callback) {
    boolean forAllActivities(Function<ActivityRecord, Boolean> callback) {
        return callback.apply(this);
    }

    @Override
    void forAllActivities(Consumer<ActivityRecord> callback, boolean traverseTopToBottom) {
        callback.accept(this);
    }

    @Override
    ActivityRecord getActivity(Predicate<ActivityRecord> callback, boolean traverseTopToBottom) {
        return callback.test(this) ? this : null;
    }

    @Override
    protected void setLayer(Transaction t, int layer) {
        if (!mSurfaceAnimator.hasLeash()) {
+11 −327

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -1812,7 +1812,7 @@ class ActivityStarter {
        final boolean resetTask =
                reusedActivity != null && (mLaunchFlags & FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) != 0;
        if (resetTask) {
            targetTaskTop = mTargetStack.resetTaskIfNeededLocked(targetTaskTop, mStartActivity);
            targetTaskTop = mTargetStack.resetTaskIfNeeded(targetTaskTop, mStartActivity);
        }

        if ((mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK))
+6 −0
Original line number Diff line number Diff line
@@ -4512,6 +4512,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            mName = name;
        }

        @Override
        boolean hasActivity() {
            // I am a non-app-window-container :P
            return false;
        }

        void addChild(WindowToken token) {
            addChild(token, mWindowComparator);
        }
+295 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading