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

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

Merge "Fixed focus adjustment issue with freeform stack."

parents 0f9f0189 61803ee5
Loading
Loading
Loading
Loading
+23 −15
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.am;

import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.HOME_STACK_ID;
import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
@@ -2671,6 +2672,12 @@ final class ActivityStack {
            ActivityRecord next = topRunningActivityLocked(null);
            final String myReason = reason + " adjustFocus";
            if (next != r) {
                if (next != null && mStackId == FREEFORM_WORKSPACE_STACK_ID) {
                    // For freeform stack we always keep the focus within the stack as long as
                    // there is a running activity in the stack that we can adjust focus to.
                    mService.setFocusedActivityLocked(next, myReason);
                    return;
                } else {
                    final TaskRecord task = r.task;
                    if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) {
                        // For non-fullscreen stack, we want to move the focus to the next visible
@@ -2689,6 +2696,7 @@ final class ActivityStack {
                        }
                    }
                }
            }

            final ActivityRecord top = mStackSupervisor.topRunningActivityLocked();
            if (top != null) {