Merge "Invalidate resized bounds on aspect ratio changes" into rvc-qpr-dev

This commit is contained in:
TreeHugger Robot
2020-08-19 05:36:18 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 1 deletions

View File

@@ -230,7 +230,10 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
@Override @Override
public void onAspectRatioChanged(float aspectRatio) { public void onAspectRatioChanged(float aspectRatio) {
mHandler.post(() -> mPipBoundsHandler.onAspectRatioChanged(aspectRatio)); mHandler.post(() -> {
mPipBoundsHandler.onAspectRatioChanged(aspectRatio);
mTouchHandler.onAspectRatioChanged();
});
} }
} }

View File

@@ -364,6 +364,10 @@ public class PipResizeGestureHandler {
mUserResizeBounds.set(bounds); mUserResizeBounds.set(bounds);
} }
void invalidateUserResizeBounds() {
mUserResizeBounds.setEmpty();
}
Rect getUserResizeBounds() { Rect getUserResizeBounds() {
return mUserResizeBounds; return mUserResizeBounds;
} }

View File

@@ -422,8 +422,21 @@ public class PipTouchHandler {
} }
} }
/**
* Responds to IPinnedStackListener on resetting aspect ratio for the pinned window.
*/
public void onAspectRatioChanged() {
mPipResizeGestureHandler.invalidateUserResizeBounds();
}
public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect curBounds, public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect curBounds,
boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation) { boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation) {
// Set the user resized bounds equal to the new normal bounds in case they were
// invalidated (e.g. by an aspect ratio change).
if (mPipResizeGestureHandler.getUserResizeBounds().isEmpty()) {
mPipResizeGestureHandler.setUserResizeBounds(normalBounds);
}
final int bottomOffset = mIsImeShowing ? mImeHeight : 0; final int bottomOffset = mIsImeShowing ? mImeHeight : 0;
final boolean fromDisplayRotationChanged = (mDisplayRotation != displayRotation); final boolean fromDisplayRotationChanged = (mDisplayRotation != displayRotation);
if (fromDisplayRotationChanged) { if (fromDisplayRotationChanged) {