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

Commit f3b5f6d2 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Updates destination bounds upon rotation change" into rvc-dev am: bfdc6696 am: fb92fcce

Change-Id: I275a64a2494aa7358514e4ac0b8f0fd111650d6f
parents 875e32bf fb92fcce
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -99,6 +99,10 @@ public class PipAnimationController {
        return mCurrentAnimator;
        return mCurrentAnimator;
    }
    }


    PipTransitionAnimator getCurrentAnimator() {
        return mCurrentAnimator;
    }

    private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
    private PipTransitionAnimator setupPipTransitionAnimator(PipTransitionAnimator animator) {
        animator.setInterpolator(mFastOutSlowInInterpolator);
        animator.setInterpolator(mFastOutSlowInInterpolator);
        animator.setFloatValues(FRACTION_START, FRACTION_END);
        animator.setFloatValues(FRACTION_START, FRACTION_END);
+16 −1
Original line number Original line Diff line number Diff line
@@ -166,7 +166,22 @@ public class PipTaskOrganizer extends ITaskOrganizer.Stub {
     * Updates the display dimension with given {@link DisplayInfo}
     * Updates the display dimension with given {@link DisplayInfo}
     */
     */
    public void onDisplayInfoChanged(DisplayInfo displayInfo) {
    public void onDisplayInfoChanged(DisplayInfo displayInfo) {
        mDisplayBounds.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
        final Rect newDisplayBounds = new Rect(0, 0,
                displayInfo.logicalWidth, displayInfo.logicalHeight);
        if (!mDisplayBounds.equals(newDisplayBounds)) {
            // Updates the exiting PiP animation in case the screen rotation changes in the middle.
            // It's a legit case that PiP window is in portrait mode on home screen and
            // the application requests landscape onces back to fullscreen mode.
            final PipAnimationController.PipTransitionAnimator animator =
                    mPipAnimationController.getCurrentAnimator();
            if (animator != null
                    && animator.getAnimationType() == ANIM_TYPE_BOUNDS
                    && animator.getDestinationBounds().equals(mDisplayBounds)) {
                animator.updateEndValue(newDisplayBounds);
                animator.setDestinationBounds(newDisplayBounds);
            }
        }
        mDisplayBounds.set(newDisplayBounds);
    }
    }


    /**
    /**
+3 −3
Original line number Original line Diff line number Diff line
@@ -69,7 +69,6 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    private IActivityManager mActivityManager;
    private IActivityManager mActivityManager;
    private Handler mHandler = new Handler();
    private Handler mHandler = new Handler();


    private final PinnedStackListener mPinnedStackListener = new PipManagerPinnedStackListener();
    private final DisplayInfo mTmpDisplayInfo = new DisplayInfo();
    private final DisplayInfo mTmpDisplayInfo = new DisplayInfo();
    private final Rect mTmpInsetBounds = new Rect();
    private final Rect mTmpInsetBounds = new Rect();
    private final Rect mTmpNormalBounds = new Rect();
    private final Rect mTmpNormalBounds = new Rect();
@@ -211,7 +210,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
        mActivityManager = ActivityManager.getService();
        mActivityManager = ActivityManager.getService();


        try {
        try {
            WindowManagerWrapper.getInstance().addPinnedStackListener(mPinnedStackListener);
            WindowManagerWrapper.getInstance().addPinnedStackListener(
                    new PipManagerPinnedStackListener());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "Failed to register pinned stack listener", e);
            Log.e(TAG, "Failed to register pinned stack listener", e);
        }
        }
@@ -341,7 +341,6 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio


    private void updateMovementBounds(Rect animatingBounds, boolean fromImeAdjustment,
    private void updateMovementBounds(Rect animatingBounds, boolean fromImeAdjustment,
            boolean fromShelfAdjustment) {
            boolean fromShelfAdjustment) {
        mPipTaskOrganizer.onDisplayInfoChanged(mTmpDisplayInfo);
        // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before
        // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before
        // passing to mTouchHandler, mTouchHandler would rely on the bounds calculated by
        // passing to mTouchHandler, mTouchHandler would rely on the bounds calculated by
        // mPipBoundsHandler with up-to-dated information
        // mPipBoundsHandler with up-to-dated information
@@ -350,6 +349,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
        mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
        mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds,
                animatingBounds, fromImeAdjustment, fromShelfAdjustment,
                animatingBounds, fromImeAdjustment, fromShelfAdjustment,
                mTmpDisplayInfo.rotation);
                mTmpDisplayInfo.rotation);
        mPipTaskOrganizer.onDisplayInfoChanged(mTmpDisplayInfo);
    }
    }


    public void dump(PrintWriter pw) {
    public void dump(PrintWriter pw) {