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

Commit 9e963584 authored by Bill Lin's avatar Bill Lin
Browse files

Reset windows bounds when stop one handed mode

So far OHM reset windows bounds when
1) Rotate
2) Unregister(Settings disabled)
We want to add 1 more policy:
3) Reset windows when stop one handed mode(animation end/cancel)

Test: manual trigger OHM, stop OHM and check visual
Test: atest WMShellUnitTests
Bug: 178553230
Change-Id: Iba95fa11107fd0fa910685112ca962bca4adde80
parent ecb4816e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer {
                        OneHandedAnimationController.OneHandedTransitionAnimator animator) {
                    mAnimationController.removeAnimator(animator.getToken());
                    if (mAnimationController.isAnimatorsConsumed()) {
                        resetWindowsOffsetInternal(animator.getTransitionDirection());
                        finishOffset(animator.getDestinationOffset(),
                                animator.getTransitionDirection());
                    }
@@ -99,6 +100,7 @@ public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer {
                        OneHandedAnimationController.OneHandedTransitionAnimator animator) {
                    mAnimationController.removeAnimator(animator.getToken());
                    if (mAnimationController.isAnimatorsConsumed()) {
                        resetWindowsOffsetInternal(animator.getTransitionDirection());
                        finishOffset(animator.getDestinationOffset(),
                                animator.getTransitionDirection());
                    }
@@ -205,6 +207,16 @@ public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer {
        applyTransaction(wct);
    }

    private void resetWindowsOffsetInternal(
            @OneHandedAnimationController.TransitionDirection int td) {
        if (td == TRANSITION_DIRECTION_TRIGGER) {
            return;
        }
        final WindowContainerTransaction wct = new WindowContainerTransaction();
        resetWindowsOffset(wct);
        applyTransaction(wct);
    }

    private void resetWindowsOffset(WindowContainerTransaction wct) {
        final SurfaceControl.Transaction tx =
                mSurfaceControlTransactionFactory.getTransaction();