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

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

Move task focusing activity task to the front when we focus on the stack

Fixes issue where we don't correctly set the current focus window since
the task isn't on top.

Change-Id: Ib541f2a8289571c716c182264f8ec4fccdae30a3
parent f9efa737
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -478,7 +478,15 @@ final class ActivityStack {
                mActivityContainer.mActivityDisplay.mDisplayId == Display.DEFAULT_DISPLAY;
    }

    final void moveToFront(String reason) {
    void moveToFront(String reason) {
        moveToFront(reason, null);
    }

    /**
     * @param reason The reason for moving the stack to the front.
     * @param task If non-null, the task will be moved to the top of the stack.
     * */
    void moveToFront(String reason, TaskRecord task) {
        if (isAttached()) {
            final boolean homeStack = isHomeStack()
                    || (mActivityContainer.mParentActivity != null
@@ -496,7 +504,11 @@ final class ActivityStack {
            if (isOnHomeDisplay()) {
                mStackSupervisor.moveHomeStack(homeStack, reason, lastFocusStack);
            }
            final TaskRecord task = topTask();
            if (task != null) {
                insertTaskAtTop(task, null);
            } else {
                task = topTask();
            }
            if (task != null) {
                mWindowManager.moveTaskToTop(task.taskId);
            }
+1 −1
Original line number Diff line number Diff line
@@ -1822,7 +1822,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
            Slog.w(TAG, "Can't set focus stack for r=" + r + " task=" + task);
            return false;
        }
        task.stack.moveToFront(reason);
        task.stack.moveToFront(reason, task);
        return true;
    }