From 8d86cf0bcc17e51c6fd303ec473ab91ea72af44f Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Mon, 29 Apr 2019 17:22:57 -0700 Subject: [PATCH] Fix some MW visual issues - Ensure that we don't apply apply crop from device coordinates (reset to surface coordinates) - Disable rounded window corners in MW Bug: 128364741 Change-Id: Ia91500ca97b44537829983945cd3d3cc82747aeb --- .../quickstep/AppToOverviewAnimationProvider.java | 2 +- .../src/com/android/quickstep/TaskViewUtils.java | 7 ++++++- .../quickstep/WindowTransformSwipeHandler.java | 2 +- .../quickstep/util/ClipAnimationHelper.java | 15 ++++++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java index e5747dc711..624b3dc779 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java @@ -137,7 +137,7 @@ final class AppToOverviewAnimationProvider imple Rect targetRect = new Rect(); mHelper.getSwipeUpDestinationAndLength(mActivity.getDeviceProfile(), mActivity, targetRect); clipHelper.updateTargetRect(targetRect); - clipHelper.prepareAnimation(false /* isOpening */); + clipHelper.prepareAnimation(mActivity.getDeviceProfile(), false /* isOpening */); ClipAnimationHelper.TransformParams params = new ClipAnimationHelper.TransformParams() .setSyncTransactionApplier(new SyncRtSurfaceTransactionApplierCompat(rootView)); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java index 4526d670d5..8bac1a48ba 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java @@ -24,8 +24,11 @@ import android.content.ComponentName; import android.graphics.RectF; import android.view.View; +import com.android.launcher3.BaseActivity; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.ItemInfo; +import com.android.launcher3.Launcher; +import com.android.launcher3.LauncherAppState; import com.android.launcher3.Utilities; import com.android.quickstep.util.ClipAnimationHelper; import com.android.quickstep.util.MultiValueUpdateListener; @@ -128,7 +131,9 @@ public final class TaskViewUtils { mTargetSet = new RemoteAnimationTargetSet(targets, MODE_OPENING); inOutHelper.setTaskAlphaCallback((t, alpha) -> mTaskAlpha.value); - inOutHelper.prepareAnimation(true /* isOpening */); + inOutHelper.prepareAnimation( + BaseActivity.fromContext(v.getContext()).getDeviceProfile(), + true /* isOpening */); inOutHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), mTargetSet.apps.length == 0 ? null : mTargetSet.apps[0]); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index afc4fcb594..46054c7dcc 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -729,7 +729,7 @@ public class WindowTransformSwipeHandler if (runningTaskTarget != null) { mClipAnimationHelper.updateSource(overviewStackBounds, runningTaskTarget); } - mClipAnimationHelper.prepareAnimation(false /* isOpening */); + mClipAnimationHelper.prepareAnimation(dp, false /* isOpening */); initTransitionEndpoints(dp); mRecentsAnimationWrapper.setController(targetSet); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java index 1242d79dc3..cb2bf1f79d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java @@ -81,6 +81,7 @@ public class ClipAnimationHelper { private final RectF mClipRectF = new RectF(); private final RectFEvaluator mRectFEvaluator = new RectFEvaluator(); private final Matrix mTmpMatrix = new Matrix(); + private final Rect mTmpRect = new Rect(); private final RectF mTmpRectF = new RectF(); private final RectF mCurrentRectWithInsets = new RectF(); // Corner radius of windows, in pixels @@ -89,6 +90,8 @@ public class ClipAnimationHelper { private final float mTaskCornerRadius; // If windows can have real time rounded corners. private final boolean mSupportsRoundedCornersOnWindows; + // Whether or not to actually use the rounded cornders on windows + private boolean mUseRoundedCornersOnWindows; // Corner radius currently applied to transformed window. private float mCurrentCornerRadius; @@ -103,6 +106,7 @@ public class ClipAnimationHelper { mWindowCornerRadius = getWindowCornerRadius(context.getResources()); mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources()); mTaskCornerRadius = TaskCornerRadius.get(context); + mUseRoundedCornersOnWindows = mSupportsRoundedCornersOnWindows; } private void updateSourceStack(RemoteAnimationTargetCompat target) { @@ -144,8 +148,9 @@ public class ClipAnimationHelper { mSourceRect.set(scaledTargetRect); } - public void prepareAnimation(boolean isOpening) { + public void prepareAnimation(DeviceProfile dp, boolean isOpening) { mBoostModeTargetLayers = isOpening ? MODE_OPENING : MODE_CLOSING; + mUseRoundedCornersOnWindows = mSupportsRoundedCornersOnWindows && !dp.isMultiWindowMode; } public RectF applyTransform(RemoteAnimationTargetSet targetSet, TransformParams params) { @@ -177,7 +182,9 @@ public class ClipAnimationHelper { for (int i = 0; i < targetSet.unfilteredApps.length; i++) { RemoteAnimationTargetCompat app = targetSet.unfilteredApps[i]; mTmpMatrix.setTranslate(app.position.x, app.position.y); - Rect crop = app.sourceContainerBounds; + Rect crop = mTmpRect; + crop.set(app.sourceContainerBounds); + crop.offsetTo(0, 0); float alpha = 1f; int layer = RemoteAnimationProvider.getLayer(app, mBoostModeTargetLayers); float cornerRadius = 0f; @@ -188,7 +195,9 @@ public class ClipAnimationHelper { mTmpMatrix.postTranslate(app.position.x, app.position.y); mClipRectF.roundOut(crop); if (mSupportsRoundedCornersOnWindows) { - cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius, + float windowCornerRadius = mUseRoundedCornersOnWindows + ? mWindowCornerRadius : 0; + cornerRadius = Utilities.mapRange(params.progress, windowCornerRadius, mTaskCornerRadius); mCurrentCornerRadius = cornerRadius; }