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

Commit 24060272 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Do not reset shelf offset during fixed rotation" into rvc-dev

parents 34de8478 71eea489
Loading
Loading
Loading
Loading
+26 −10
Original line number Original line Diff line number Diff line
@@ -44,7 +44,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.pip.BasePipManager;
import com.android.systemui.pip.BasePipManager;
import com.android.systemui.pip.PipBoundsHandler;
import com.android.systemui.pip.PipBoundsHandler;
import com.android.systemui.pip.PipSnapAlgorithm;
import com.android.systemui.pip.PipSnapAlgorithm;
import com.android.systemui.pip.PipSurfaceTransactionHelper;
import com.android.systemui.pip.PipTaskOrganizer;
import com.android.systemui.pip.PipTaskOrganizer;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.recents.IPinnedStackAnimationListener;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -52,7 +51,6 @@ import com.android.systemui.shared.system.InputConsumerController;
import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener;
import com.android.systemui.shared.system.PinnedStackListenerForwarder.PinnedStackListener;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.stackdivider.Divider;
import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.util.FloatingContentCoordinator;
import com.android.systemui.util.FloatingContentCoordinator;
import com.android.systemui.wm.DisplayChangeController;
import com.android.systemui.wm.DisplayChangeController;
@@ -86,6 +84,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
    private PipTouchHandler mTouchHandler;
    private PipTouchHandler mTouchHandler;
    private PipAppOpsListener mAppOpsListener;
    private PipAppOpsListener mAppOpsListener;
    private IPinnedStackAnimationListener mPinnedStackAnimationRecentsListener;
    private IPinnedStackAnimationListener mPinnedStackAnimationRecentsListener;
    private boolean mIsInFixedRotation;


    protected PipTaskOrganizer mPipTaskOrganizer;
    protected PipTaskOrganizer mPipTaskOrganizer;


@@ -104,17 +103,35 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
                    mPipTaskOrganizer.getLastReportedBounds(), mTmpInsetBounds);
                    mPipTaskOrganizer.getLastReportedBounds(), mTmpInsetBounds);


            // The bounds are being applied to a specific snap fraction, so reset any known offsets
            // The bounds are being applied to a specific snap fraction, so reset any known offsets
            // for the previous orientation before updating the movement bounds
            // for the previous orientation before updating the movement bounds.
            // We perform the resets if and only if this callback is due to screen rotation but
            // not during the fixed rotation. In fixed rotation case, app is about to enter PiP
            // and we need the offsets preserved to calculate the destination bounds.
            if (!mIsInFixedRotation) {
                mPipBoundsHandler.setShelfHeight(false , 0);
                mPipBoundsHandler.setShelfHeight(false , 0);
                mPipBoundsHandler.onImeVisibilityChanged(false, 0);
                mPipBoundsHandler.onImeVisibilityChanged(false, 0);
                mTouchHandler.onShelfVisibilityChanged(false, 0);
                mTouchHandler.onShelfVisibilityChanged(false, 0);
                mTouchHandler.onImeVisibilityChanged(false, 0);
                mTouchHandler.onImeVisibilityChanged(false, 0);
            }


            updateMovementBounds(mTmpNormalBounds, true /* fromRotation */,
            updateMovementBounds(mTmpNormalBounds, true /* fromRotation */,
                    false /* fromImeAdjustment */, false /* fromShelfAdjustment */);
                    false /* fromImeAdjustment */, false /* fromShelfAdjustment */);
        }
        }
    };
    };


    private DisplayController.OnDisplaysChangedListener mFixedRotationListener =
            new DisplayController.OnDisplaysChangedListener() {
        @Override
        public void onFixedRotationStarted(int displayId, int newRotation) {
            mIsInFixedRotation = true;
        }

        @Override
        public void onFixedRotationFinished(int displayId) {
            mIsInFixedRotation = false;
        }
    };

    /**
    /**
     * Handler for system task stack changes.
     * Handler for system task stack changes.
     */
     */
@@ -212,9 +229,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
            DeviceConfigProxy deviceConfig,
            DeviceConfigProxy deviceConfig,
            PipBoundsHandler pipBoundsHandler,
            PipBoundsHandler pipBoundsHandler,
            PipSnapAlgorithm pipSnapAlgorithm,
            PipSnapAlgorithm pipSnapAlgorithm,
            PipTaskOrganizer pipTaskOrganizer,
            PipTaskOrganizer pipTaskOrganizer) {
            PipSurfaceTransactionHelper surfaceTransactionHelper,
            Divider divider) {
        mContext = context;
        mContext = context;
        mActivityManager = ActivityManager.getService();
        mActivityManager = ActivityManager.getService();


@@ -239,6 +254,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
        mAppOpsListener = new PipAppOpsListener(context, mActivityManager,
        mAppOpsListener = new PipAppOpsListener(context, mActivityManager,
                mTouchHandler.getMotionHelper());
                mTouchHandler.getMotionHelper());
        displayController.addDisplayChangingController(mRotationController);
        displayController.addDisplayChangingController(mRotationController);
        displayController.addDisplayWindowListener(mFixedRotationListener);


        // Ensure that we have the display info in case we get calls to update the bounds before the
        // Ensure that we have the display info in case we get calls to update the bounds before the
        // listener calls back
        // listener calls back