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

Commit f557c3b5 authored by Winson Chung's avatar Winson Chung
Browse files

Allow recents animation to override divider minimized state

- When swiping up while in split-screen, the animation should be able to
  adjust the docked divider minimized state so that we don't wait until
  launcher is repositioned to the front in order for the divider to
  update.

Bug: 73118672
Test: Enter split screen, swipe up and ensure the dock divider moves
      (Note, there are still unrelated clipping issues)

Change-Id: Id71f91eaf2f06b3c33628a2199cc94c82e235471
parent 6a38fca2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -59,4 +59,9 @@ interface IRecentsAnimationController {
    * taken.
    */
    void setAnimationTargetsBehindSystemBars(boolean behindSystemBars);

    /**
     * Informs the system that the primary split-screen stack should be minimized.
     */
    void setSplitScreenMinimized(boolean minimized);
}
+8 −0
Original line number Diff line number Diff line
@@ -61,6 +61,14 @@ public class RecentsAnimationControllerCompat {
        }
    }

    public void setSplitScreenMinimized(boolean minimized) {
        try {
            mAnimationController.setSplitScreenMinimized(minimized);
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to set minimize dock", e);
        }
    }

    public void finish(boolean toHome) {
        try {
            mAnimationController.finish(toHome);
+5 −0
Original line number Diff line number Diff line
@@ -186,6 +186,11 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
                    // No reason to wait for the pausing activity in this case, as the hiding of
                    // surfaces needs to be done immediately.
                    mWindowManager.executeAppTransition();

                    // After reordering the stacks, reset the minimized state. At this point, either
                    // home is now top-most and we will stay minimized (if in split-screen), or we
                    // will have returned to the app, and the minimized state should be reset
                    mWindowManager.checkSplitScreenMinimizedChanged(true /* animate */);
                } finally {
                    mWindowManager.continueSurfaceLayout();
                    Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
+4 −1
Original line number Diff line number Diff line
@@ -666,13 +666,16 @@ public class DockedStackDividerController {
        }
        final TaskStack topSecondaryStack = mDisplayContent.getTopStackInWindowingMode(
                WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
        final RecentsAnimationController recentsAnim = mService.getRecentsAnimationController();
        final boolean minimizedForRecentsAnimation = recentsAnim != null &&
                recentsAnim.isSplitScreenMinimized();
        boolean homeVisible = homeTask.getTopVisibleAppToken() != null;
        if (homeVisible && topSecondaryStack != null) {
            // Home should only be considered visible if it is greater or equal to the top secondary
            // stack in terms of z-order.
            homeVisible = homeStack.compareTo(topSecondaryStack) >= 0;
        }
        setMinimizedDockedStack(homeVisible, animate);
        setMinimizedDockedStack(homeVisible || minimizedForRecentsAnimation, animate);
    }

    private boolean isWithinDisplay(Task task) {
+32 −6
Original line number Diff line number Diff line
@@ -98,12 +98,16 @@ public class RecentsAnimationController implements DeathRecipient {
    private boolean mPendingStart = true;

    // Set when the animation has been canceled
    private boolean mCanceled = false;
    private boolean mCanceled;

    // Whether or not the input consumer is enabled. The input consumer must be both registered and
    // enabled for it to start intercepting touch events.
    private boolean mInputConsumerEnabled;

    // Whether or not the recents animation should cause the primary split-screen stack to be
    // minimized
    private boolean mSplitScreenMinimized;

    private Rect mTmpRect = new Rect();

    public interface RecentsAnimationCallbacks {
@@ -116,7 +120,7 @@ public class RecentsAnimationController implements DeathRecipient {
        @Override
        public TaskSnapshot screenshotTask(int taskId) {
            if (DEBUG) Log.d(TAG, "screenshotTask(" + taskId + "): mCanceled=" + mCanceled);
            long token = Binder.clearCallingIdentity();
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    if (mCanceled) {
@@ -145,7 +149,7 @@ public class RecentsAnimationController implements DeathRecipient {
        @Override
        public void finish(boolean moveHomeToTop) {
            if (DEBUG) Log.d(TAG, "finish(" + moveHomeToTop + "): mCanceled=" + mCanceled);
            long token = Binder.clearCallingIdentity();
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    if (mCanceled) {
@@ -166,7 +170,7 @@ public class RecentsAnimationController implements DeathRecipient {
        @Override
        public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars)
                throws RemoteException {
            long token = Binder.clearCallingIdentity();
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
@@ -183,7 +187,7 @@ public class RecentsAnimationController implements DeathRecipient {
        public void setInputConsumerEnabled(boolean enabled) {
            if (DEBUG) Log.d(TAG, "setInputConsumerEnabled(" + enabled + "): mCanceled="
                    + mCanceled);
            long token = Binder.clearCallingIdentity();
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    if (mCanceled) {
@@ -198,6 +202,23 @@ public class RecentsAnimationController implements DeathRecipient {
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
        public void setSplitScreenMinimized(boolean minimized) {
            final long token = Binder.clearCallingIdentity();
            try {
                synchronized (mService.getWindowManagerLock()) {
                    if (mCanceled) {
                        return;
                    }

                    mSplitScreenMinimized = minimized;
                    mService.checkSplitScreenMinimizedChanged(true /* animate */);
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }
    };

    /**
@@ -330,6 +351,7 @@ public class RecentsAnimationController implements DeathRecipient {
                Slog.e(TAG, "Failed to cancel recents animation", e);
            }
        }

        // Clean up and return to the previous app
        // Don't hold the WM lock here as it calls back to AM/RecentsAnimation
        mCallbacks.onAnimationFinished(reorderMode);
@@ -350,7 +372,7 @@ public class RecentsAnimationController implements DeathRecipient {
        mPendingAnimations.clear();

        mRunner.asBinder().unlinkToDeath(this, 0);

        // Clear associated input consumers
        mService.mInputMonitor.updateInputWindowsLw(true /*force*/);
        mService.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
    }
@@ -375,6 +397,10 @@ public class RecentsAnimationController implements DeathRecipient {
        }
    }

    boolean isSplitScreenMinimized() {
        return mSplitScreenMinimized;
    }

    boolean isWallpaperVisible(WindowState w) {
        return w != null && w.mAppToken != null && mHomeAppToken == w.mAppToken
                && isHomeAppOverWallpaper();