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

Commit 661a9db9 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Merge "Don't allow focus on activity in minimized split-screen." into pi-dev

am: 5a8deab6

Change-Id: I65db000108edf8f20119a8de11fbcaac28cc7efd
parents 53938a9e 5a8deab6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1193,6 +1193,9 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
    }

    boolean isFocusable() {
        if (inSplitScreenPrimaryWindowingMode() && mStackSupervisor.mIsDockMinimized) {
            return false;
        }
        return getWindowConfiguration().canReceiveKeys() || isAlwaysFocusable();
    }

+1 −1
Original line number Diff line number Diff line
@@ -3420,7 +3420,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
    }

    /** Find next proper focusable stack and make it focused. */
    private boolean adjustFocusToNextFocusableStack(String reason) {
    boolean adjustFocusToNextFocusableStack(String reason) {
        return adjustFocusToNextFocusableStack(reason, false /* allowFocusSelf */);
    }

+17 −8
Original line number Diff line number Diff line
@@ -2455,19 +2455,20 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D

                if (currentWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
                        && candidate == null && stack.inSplitScreenPrimaryWindowingMode()) {
                    // If the currently focused stack is in split-screen secondary we would prefer
                    // the focus to move to another split-screen secondary stack or fullscreen stack
                    // over the primary split screen stack to avoid:
                    // - Moving the focus to the primary split-screen stack when it can't be focused
                    //   because it will be minimized, but AM doesn't know that yet
                    // - primary split-screen stack overlapping with a fullscreen stack when a
                    //   fullscreen stack is higher in z than the next split-screen stack. Assistant
                    //   stack, I am looking at you...
                    // If the currently focused stack is in split-screen secondary we save off the
                    // top primary split-screen stack as a candidate for focus because we might
                    // prefer focus to move to an other stack to avoid primary split-screen stack
                    // overlapping with a fullscreen stack when a fullscreen stack is higher in z
                    // than the next split-screen stack. Assistant stack, I am looking at you...
                    // We only move the focus to the primary-split screen stack if there isn't a
                    // better alternative.
                    candidate = stack;
                    continue;
                }
                if (candidate != null && stack.inSplitScreenSecondaryWindowingMode()) {
                    // Use the candidate stack since we are now at the secondary split-screen.
                    return candidate;
                }
                return stack;
            }
        }
@@ -4413,6 +4414,14 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D

    void setDockedStackMinimized(boolean minimized) {
        mIsDockMinimized = minimized;
        if (mIsDockMinimized) {
            final ActivityStack current = getFocusedStack();
            if (current.inSplitScreenPrimaryWindowingMode()) {
                // The primary split-screen stack can't be focused while it is minimize, so move
                // focus to something else.
                current.adjustFocusToNextFocusableStack("setDockedStackMinimized");
            }
        }
    }

    void wakeUp(String reason) {