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

Change-Id: Iac87a11794736408401e6fb61c85e94c57118825
This commit is contained in:
Hongwei Wang
2020-05-29 17:32:22 +00:00
committed by Automerger Merge Worker

View File

@@ -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.
mPipBoundsHandler.setShelfHeight(false , 0); // We perform the resets if and only if this callback is due to screen rotation but
mPipBoundsHandler.onImeVisibilityChanged(false, 0); // not during the fixed rotation. In fixed rotation case, app is about to enter PiP
mTouchHandler.onShelfVisibilityChanged(false, 0); // and we need the offsets preserved to calculate the destination bounds.
mTouchHandler.onImeVisibilityChanged(false, 0); if (!mIsInFixedRotation) {
mPipBoundsHandler.setShelfHeight(false , 0);
mPipBoundsHandler.onImeVisibilityChanged(false, 0);
mTouchHandler.onShelfVisibilityChanged(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