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

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

Move home stack behind top stack when split-screen is dismissed

Whenever split-screen is dismissed we were returning to whatever stack
was on the other side since that is the next thing in terms of z-order.
However, visually to the user we should be returning home. This CL makes
it so.

Also,
- Fixed issue were FLAG_ACTIVITY_LAUNCH_ADJACENT might not work due to
early return in ActivityStarter.getLaunchStack since the stack return by
mSupervisor.getLaunchStack() is never null.
- Just set windowing mode when AMS.setTaskWindowingMode is called vs.
creating a stack to re-parent to.
- Fixed issue with reporting multi-window mode changed to be based on
onConfigurationChanged() for the activity record.
- Corrected a few issues with order of sending pip mode changed and
multi-window mode changed due to now sending multi-window mode
changed in onConfigurationChanged().
Change-Id: I4893937853968bfd0b437dc646a82ead8f127f2e
Fixes: 69378933
Fixes: 68953884
Test: ActivityManagerSplitScreenTests.onSplitScreenModeDismissed
parent 7e35c55f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -399,6 +399,16 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
                otherStack.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
            }
        } finally {
            if (mHomeStack != null && !isTopStack(mHomeStack)) {
                // Whenever split-screen is dismissed we want the home stack directly behind the
                // currently top stack so it shows up when the top stack is finished.
                final ActivityStack topStack = getTopStack();
                // TODO: Would be better to use ActivityDisplay.positionChildAt() for this, however
                // ActivityDisplay doesn't have a direct controller to WM side yet. We can switch
                // once we have that.
                mHomeStack.moveToFront("onSplitScreenModeDismissed");
                topStack.moveToFront("onSplitScreenModeDismissed");
            }
            mSupervisor.mWindowManager.continueSurfaceLayout();
        }
    }
+6 −6
Original line number Diff line number Diff line
@@ -10522,12 +10522,12 @@ public class ActivityManagerService extends IActivityManager.Stub
                            + " non-standard task " + taskId + " to windowing mode="
                            + windowingMode);
                }
                final ActivityDisplay display = task.getStack().getDisplay();
                final ActivityStack stack = display.getOrCreateStack(windowingMode,
                        task.getStack().getActivityType(), toTop);
                // TODO: Use ActivityStack.setWindowingMode instead of re-parenting.
                task.reparent(stack, toTop, REPARENT_KEEP_STACK_AT_FRONT, ANIMATE, !DEFER_RESUME,
                        "moveTaskToStack");
                final ActivityStack stack = task.getStack();
                if (toTop) {
                    stack.moveToFront("setTaskWindowingMode", task);
                }
                stack.setWindowingMode(windowingMode);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
+7 −2
Original line number Diff line number Diff line
@@ -647,8 +647,13 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
            return;
        }

        if (task.getStack().deferScheduleMultiWindowModeChanged()) {
            // Don't do anything if we are currently deferring multi-window mode change.
            return;
        }

        // An activity is considered to be in multi-window mode if its task isn't fullscreen.
        final boolean inMultiWindowMode = task.inMultiWindowMode();
        final boolean inMultiWindowMode = inMultiWindowMode();
        if (inMultiWindowMode != mLastReportedMultiWindowMode) {
            mLastReportedMultiWindowMode = inMultiWindowMode;
            scheduleMultiWindowModeChanged(getConfiguration());
@@ -675,7 +680,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
            // Picture-in-picture mode changes also trigger a multi-window mode change as well, so
            // update that here in order
            mLastReportedPictureInPictureMode = inPictureInPictureMode;
            mLastReportedMultiWindowMode = inPictureInPictureMode;
            mLastReportedMultiWindowMode = inMultiWindowMode();
            final Configuration newConfig = task.computeNewOverrideConfigurationForBounds(
                    targetStackBounds, null);
            schedulePictureInPictureModeChanged(newConfig);
+1 −1
Original line number Diff line number Diff line
@@ -494,7 +494,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai

        // Need to make sure windowing mode is supported.
        int windowingMode = display.resolveWindowingMode(
                null /* ActivityRecord */, mTmpOptions, topTask, getActivityType());;
                null /* ActivityRecord */, mTmpOptions, topTask, getActivityType());
        if (splitScreenStack == this && windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
            // Resolution to split-screen secondary for the primary split-screen stack means we want
            // to go fullscreen.
+4 −0
Original line number Diff line number Diff line
@@ -4308,6 +4308,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            final ActivityRecord r = task.mActivities.get(i);
            if (r.app != null && r.app.thread != null) {
                mPipModeChangedActivities.add(r);
                // If we are scheduling pip change, then remove this activity from multi-window
                // change list as the processing of pip change will make sure multi-window changed
                // message is processed in the right order relative to pip changed.
                mMultiWindowModeChangedActivities.remove(r);
            }
        }
        mPipModeChangedTargetStackBounds = targetStackBounds;
Loading