Merge "Fixing swipe-up form app in landspace, rotates the surface" into ub-launcher3-rvc-dev

This commit is contained in:
Sunny Goyal
2020-05-08 20:11:56 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 25 deletions
@@ -19,7 +19,6 @@ import static android.view.Surface.ROTATION_0;
import static com.android.launcher3.states.RotationHelper.deltaRotation;
import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE;
import static com.android.quickstep.util.RecentsOrientedState.isFixedRotationTransformEnabled;
import static com.android.quickstep.util.RecentsOrientedState.postDisplayRotation;
import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_FULLSCREEN;
@@ -67,7 +66,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
// Thumbnail view properties
private final Rect mThumbnailPosition = new Rect();
private final ThumbnailData mThumbnailData = new ThumbnailData();
private final PreviewPositionHelper mPositionHelper;
private final PreviewPositionHelper mPositionHelper = new PreviewPositionHelper();
private final Matrix mInversePositionMatrix = new Matrix();
// TaskView properties
@@ -87,7 +86,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
public TaskViewSimulator(Context context, WindowSizeStrategy sizeStrategy) {
mContext = context;
mSizeStrategy = sizeStrategy;
mPositionHelper = new PreviewPositionHelper(context);
mOrientationState = new RecentsOrientedState(context, sizeStrategy, i -> { });
// We do not need to attach listeners as the simulator is created just for the gesture
@@ -173,12 +171,12 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
mLayoutValid = true;
getFullScreenScale();
mThumbnailData.rotation = isFixedRotationTransformEnabled(mContext)
? mOrientationState.getDisplayRotation() : mPositionHelper.getCurrentRotation();
mPositionHelper.updateThumbnailMatrix(mThumbnailPosition, mThumbnailData,
mTaskRect.width(), mTaskRect.height(), mDp);
mThumbnailData.rotation = mOrientationState.getDisplayRotation();
mPositionHelper.updateThumbnailMatrix(
mThumbnailPosition, mThumbnailData,
mTaskRect.width(), mTaskRect.height(),
mDp, mOrientationState.getLauncherRotation());
mPositionHelper.getMatrix().invert(mInversePositionMatrix);
PagedOrientationHandler poh = mOrientationState.getOrientationHandler();
@@ -188,7 +186,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
mScrollValid = false;
}
if (!mScrollValid) {
mScrollValid = true;
int start = mOrientationState.getOrientationHandler()
@@ -90,7 +90,7 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
// Contains the portion of the thumbnail that is clipped when fullscreen progress = 0.
private final Rect mPreviewRect = new Rect();
private final PreviewPositionHelper mPreviewPositionHelper;
private final PreviewPositionHelper mPreviewPositionHelper = new PreviewPositionHelper();
// Initialize with dummy value. It is overridden later by TaskView
private TaskView.FullscreenDrawParams mFullscreenParams = TEMP_PARAMS;
@@ -122,7 +122,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
mPreviewPositionHelper = new PreviewPositionHelper(context);
}
/**
@@ -349,8 +348,11 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
if (mBitmapShader != null && mThumbnailData != null) {
mPreviewRect.set(0, 0, mThumbnailData.thumbnail.getWidth(),
mThumbnailData.thumbnail.getHeight());
int currentRotation = ConfigurationCompat.getWindowConfigurationRotation(
mActivity.getResources().getConfiguration());
mPreviewPositionHelper.updateThumbnailMatrix(mPreviewRect, mThumbnailData,
getMeasuredWidth(), getMeasuredHeight(), mActivity.getDeviceProfile());
getMeasuredWidth(), getMeasuredHeight(), mActivity.getDeviceProfile(),
currentRotation);
mBitmapShader.setLocalMatrix(mPreviewPositionHelper.mMatrix);
mPaint.setShader(mBitmapShader);
@@ -417,17 +419,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
private float mClipBottom = -1;
private boolean mIsOrientationChanged;
private final Context mContext;
public PreviewPositionHelper(Context context) {
mContext = context;
}
public int getCurrentRotation() {
return ConfigurationCompat.getWindowConfigurationRotation(
mContext.getResources().getConfiguration());
}
public Matrix getMatrix() {
return mMatrix;
}
@@ -436,7 +427,7 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
* Updates the matrix based on the provided parameters
*/
public void updateThumbnailMatrix(Rect thumbnailPosition, ThumbnailData thumbnailData,
int canvasWidth, int canvasHeight, DeviceProfile dp) {
int canvasWidth, int canvasHeight, DeviceProfile dp, int currentRotation) {
boolean isRotated = false;
boolean isOrientationDifferent;
mClipBottom = -1;
@@ -451,7 +442,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
final float thumbnailScale;
int thumbnailRotation = thumbnailData.rotation;
int currentRotation = getCurrentRotation();
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
Rect deviceInsets = dp.getInsets();