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

Commit 92acaf20 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Always position home stack either at the top or bottom of the list.

The current implementation was okay since we mostly had
2 stacks (the home stack and 1 application stack), so moving the
application stack to the top meant the home stack was automatically
moved to the bottom. This is no longer the case if you have multiple
application stacks.

Change-Id: I8ec7cfdc3650a73a00c4e8dad869fb2bec2a4eac
parent bf54a8af
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -417,13 +417,15 @@ public final class ActivityStackSupervisor implements DisplayListener {
        if (topNdx <= 0) {
            return;
        }
        ActivityStack topStack = stacks.get(topNdx);
        final boolean homeInFront = topStack == mHomeStack;
        if (homeInFront != toFront) {

        // The home stack should either be at the top or bottom of the stack list.
        if ((toFront && (stacks.get(topNdx) != mHomeStack))
                || (!toFront && (stacks.get(0) != mHomeStack))) {
            if (DEBUG_STACK) Slog.d(TAG, "moveHomeTask: topStack old="
                    + ((lastFocusedStack != null) ? lastFocusedStack : stacks.get(topNdx))
                    + " new=" + mFocusedStack);
            stacks.remove(mHomeStack);
            stacks.add(toFront ? topNdx : 0, mHomeStack);
            if (DEBUG_STACK) Slog.d(TAG, "moveHomeTask: topStack old=" + topStack + " new="
                    + mFocusedStack);
        }

        if (lastFocusedStack != null) {