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

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

Move correct stack to front when split-screen is dismissed

- In AMS.dismissSplitScreenMode move the split-screen secondary stack to
the front if the split-screen primary stack shouldn't be focused after
it goes fullscreen.
- In AD.onSplitScreenModeDismissed the the top-most fullscreen stack
regardless of windowing mode to determine if home stack should be moved.
We also want this movement for things like the recents activity.

Test: Manual steps from bug
Change-Id: If07abcd0d0d50c846bb282e65968c883717c6462
Fixes: 72044176
parent ac9a7c05
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
            }
        } finally {
            final ActivityStack topFullscreenStack =
                    getStack(WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
                    getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN);
            if (topFullscreenStack != null && mHomeStack != null && !isTopStack(mHomeStack)) {
                // Whenever split-screen is dismissed we want the home stack directly behind the
                // current top fullscreen stack so it shows up when the top stack is finished.
@@ -566,6 +566,16 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
        return false;
    }

    ActivityStack getTopStackInWindowingMode(int windowingMode) {
        for (int i = mStacks.size() - 1; i >= 0; --i) {
            final ActivityStack current = mStacks.get(i);
            if (windowingMode == current.getWindowingMode()) {
                return current;
            }
        }
        return null;
    }

    int getIndexOf(ActivityStack stack) {
        return mStacks.indexOf(stack);
    }
+13 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
@@ -10908,8 +10909,20 @@ public class ActivityManagerService extends IActivityManager.Stub
                }
                if (toTop) {
                    // Caller wants the current split-screen primary stack to be the top stack after
                    // it goes fullscreen, so move it to the front.
                    stack.moveToFront("dismissSplitScreenMode");
                } else if (mStackSupervisor.isFocusedStack(stack)) {
                    // In this case the current split-screen primary stack shouldn't be the top
                    // stack after it goes fullscreen, but it current has focus, so we move the
                    // focus to the top-most split-screen secondary stack next to it.
                    final ActivityStack otherStack = stack.getDisplay().getTopStackInWindowingMode(
                            WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
                    if (otherStack != null) {
                        otherStack.moveToFront("dismissSplitScreenMode_other");
                    }
                }
                stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
            }
        } finally {