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

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

Update dock divider during recents animation.

- Move all wrapper calls to the bg thread
- Account for position now that the task leash is in the app animation
  layer

Bug: 73118672
Change-Id: I5b680a688c0ad4ca34c76e22e1d5cee24133f40f
parent 8ad31511
Loading
Loading
Loading
Loading
+969 B (117 KiB)

File changed.

No diff preview for this file type.

+41 −1
Original line number Diff line number Diff line
@@ -28,7 +28,9 @@ public class RecentsAnimationWrapper {
    public RecentsAnimationControllerCompat controller;
    public RemoteAnimationTargetCompat[] targets;

    private boolean mInputConsumerEnabled;
    private boolean mInputConsumerEnabled = false;
    private boolean mBehindSystemBars = true;
    private boolean mSplitScreenMinimized = false;

    public synchronized void setController(
            RecentsAnimationControllerCompat controller, RemoteAnimationTargetCompat[] targets) {
@@ -75,4 +77,42 @@ public class RecentsAnimationWrapper {
            });
        }
    }

    public void setAnimationTargetsBehindSystemBars(boolean behindSystemBars) {
        if (mBehindSystemBars == behindSystemBars) {
            return;
        }
        mBehindSystemBars = behindSystemBars;
        BackgroundExecutor.get().submit(() -> {
            synchronized (this) {
                TraceHelper.partitionSection("RecentsController",
                        "Setting behind system bars on " + controller);
                if (controller != null) {
                    controller.setAnimationTargetsBehindSystemBars(behindSystemBars);
                }
            }
        });
    }

    /**
     * NOTE: As a workaround for conflicting animations (Launcher animating the task leash, and
     * SystemUI resizing the docked stack, which resizes the task), we currently only set the
     * minimized mode, and not the inverse.
     * TODO: Synchronize the minimize animation with the launcher animation
     */
    public void setSplitScreenMinimizedForTransaction(boolean minimized) {
        if (mSplitScreenMinimized || !minimized) {
            return;
        }
        mSplitScreenMinimized = minimized;
        BackgroundExecutor.get().submit(() -> {
            synchronized (this) {
                TraceHelper.partitionSection("RecentsController",
                        "Setting minimize dock on " + controller);
                if (controller != null) {
                    controller.setSplitScreenMinimized(minimized);
                }
            }
        });
    }
}
+4 −3
Original line number Diff line number Diff line
@@ -497,6 +497,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
                TransactionCompat transaction = new TransactionCompat();
                for (RemoteAnimationTargetCompat app : mRecentsAnimationWrapper.targets) {
                    if (app.mode == MODE_CLOSING) {
                        mTmpMatrix.postTranslate(app.position.x, app.position.y);
                        transaction.setMatrix(app.leash, mTmpMatrix)
                                .setWindowCrop(app.leash, mClipRect);

@@ -534,10 +535,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
                    }
                }
                if (mRecentsAnimationWrapper.controller != null) {

                    // TODO: This logic is spartanic!
                    mRecentsAnimationWrapper.controller.setAnimationTargetsBehindSystemBars(
                            shift < 0.12f);
                    boolean passedThreshold = shift > 0.12f;
                    mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold);
                    mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold);
                }
            };
            if (Looper.getMainLooper() == Looper.myLooper()) {