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

Commit 37474509 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Set correct focus activity when using FLAG_ACTIVITY_REORDER_TO_FRONT"

parents 20b581c7 6d42df6d
Loading
Loading
Loading
Loading
+15 −3
Original line number Original line Diff line number Diff line
@@ -572,9 +572,18 @@ final class TaskRecord {
        return null;
        return null;
    }
    }


    void setFrontOfTask() {
        setFrontOfTask(null);
    }

    /** Call after activity movement or finish to make sure that frontOfTask is set correctly */
    /** Call after activity movement or finish to make sure that frontOfTask is set correctly */
    final void setFrontOfTask() {
    void setFrontOfTask(ActivityRecord newTop) {
        boolean foundFront = false;
        // If a top candidate is suggested by the caller, go ahead and use it and mark all others
        // as not front. This is needed in situations where the current front activity in the
        // task isn't finished yet and we want to set the front to the activity moved to the front
        // of the task.
        boolean foundFront = newTop != null ? true : false;

        final int numActivities = mActivities.size();
        final int numActivities = mActivities.size();
        for (int activityNdx = 0; activityNdx < numActivities; ++activityNdx) {
        for (int activityNdx = 0; activityNdx < numActivities; ++activityNdx) {
            final ActivityRecord r = mActivities.get(activityNdx);
            final ActivityRecord r = mActivities.get(activityNdx);
@@ -591,6 +600,9 @@ final class TaskRecord {
            // activity, make the bottom activity front.
            // activity, make the bottom activity front.
            mActivities.get(0).frontOfTask = true;
            mActivities.get(0).frontOfTask = true;
        }
        }
        if (newTop != null) {
            newTop.frontOfTask = true;
        }
    }
    }


    /**
    /**
@@ -605,7 +617,7 @@ final class TaskRecord {
        mActivities.add(newTop);
        mActivities.add(newTop);
        updateEffectiveIntent();
        updateEffectiveIntent();


        setFrontOfTask();
        setFrontOfTask(newTop);
    }
    }


    void addActivityAtBottom(ActivityRecord r) {
    void addActivityAtBottom(ActivityRecord r) {