Disable window corner rounding on some devices

Bug: 122347746
Test: visual; on taimen, marlin and walleye
Change-Id: If6ac1c75297dd25ad40d3ec61537e8793bceceb7
This commit is contained in:
Lucas Dupin 2019-01-09 10:21:49 -08:00 committed by Hyunyoung Song
parent 792fcc3aec
commit a2074857dc
5 changed files with 41 additions and 8 deletions

Binary file not shown.

View File

@ -20,6 +20,8 @@
<dimen name="task_thumbnail_half_top_margin">12dp</dimen> <dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen> <dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_corner_radius">8dp</dimen> <dimen name="task_corner_radius">8dp</dimen>
<!-- For screens without rounded corners -->
<dimen name="task_corner_radius_small">2dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen> <dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen> <dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
<dimen name="quickscrub_adjacent_visible_width">20dp</dimen> <dimen name="quickscrub_adjacent_visible_width">20dp</dimen>

View File

@ -615,9 +615,12 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
// Animate window corner radius from 100% to windowCornerRadius. // Animate window corner radius from 100% to windowCornerRadius.
float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher) float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher)
.getWindowCornerRadius(); .getWindowCornerRadius();
float circleRadius = iconWidth / 2f; float windowRadius = 0;
float windowRadius = Utilities.mapRange(easePercent, circleRadius, if (RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
windowCornerRadius); float circleRadius = iconWidth / 2f;
windowRadius = Utilities.mapRange(easePercent, circleRadius,
windowCornerRadius);
}
// Animate the window crop so that it starts off as a square, and then reveals // Animate the window crop so that it starts off as a square, and then reveals
// horizontally. // horizontally.

View File

@ -66,6 +66,7 @@ public class RecentsModel extends TaskStackChangeListener {
private final TaskThumbnailCache mThumbnailCache; private final TaskThumbnailCache mThumbnailCache;
private float mWindowCornerRadius = -1; private float mWindowCornerRadius = -1;
private Boolean mSupportsRoundedCornersOnWindows;
private RecentsModel(Context context) { private RecentsModel(Context context) {
mContext = context; mContext = context;
@ -199,6 +200,26 @@ public class RecentsModel extends TaskStackChangeListener {
return mWindowCornerRadius; return mWindowCornerRadius;
} }
public boolean supportsRoundedCornersOnWindows() {
if (mSupportsRoundedCornersOnWindows == null) {
if (mSystemUiProxy != null) {
try {
mSupportsRoundedCornersOnWindows =
mSystemUiProxy.supportsRoundedCornersOnWindows();
} catch (RemoteException e) {
Log.w(TAG, "Connection to ISystemUIProxy was lost, ignoring window corner "
+ "radius");
return false;
}
} else {
Log.w(TAG, "ISystemUIProxy is null, ignoring window corner radius");
return false;
}
}
return mSupportsRoundedCornersOnWindows;
}
public void onTrimMemory(int level) { public void onTrimMemory(int level) {
if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) { if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
mThumbnailCache.getHighResLoadingState().setVisible(false); mThumbnailCache.getHighResLoadingState().setVisible(false);

View File

@ -91,6 +91,8 @@ public class ClipAnimationHelper {
private final float mWindowCornerRadius; private final float mWindowCornerRadius;
// Corner radius of windows when they're in overview mode. // Corner radius of windows when they're in overview mode.
private final float mTaskCornerRadius; private final float mTaskCornerRadius;
// If windows can have real time rounded corners.
private final boolean mSupportsRoundedCornersOnWindows;
// Corner radius currently applied to transformed window. // Corner radius currently applied to transformed window.
private float mCurrentCornerRadius; private float mCurrentCornerRadius;
@ -107,8 +109,12 @@ public class ClipAnimationHelper {
(t, a1) -> a1; (t, a1) -> a1;
public ClipAnimationHelper(Context context) { public ClipAnimationHelper(Context context) {
mTaskCornerRadius = context.getResources().getDimension(R.dimen.task_corner_radius); mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius(); mSupportsRoundedCornersOnWindows = RecentsModel.INSTANCE.get(context)
.supportsRoundedCornersOnWindows();
int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ?
R.dimen.task_corner_radius : R.dimen.task_corner_radius_small;
mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes);
} }
private void updateSourceStack(RemoteAnimationTargetCompat target) { private void updateSourceStack(RemoteAnimationTargetCompat target) {
@ -197,9 +203,10 @@ public class ClipAnimationHelper {
mTmpMatrix.setRectToRect(mSourceRect, params.currentRect, ScaleToFit.FILL); mTmpMatrix.setRectToRect(mSourceRect, params.currentRect, ScaleToFit.FILL);
mTmpMatrix.postTranslate(app.position.x, app.position.y); mTmpMatrix.postTranslate(app.position.x, app.position.y);
mClipRectF.roundOut(crop); mClipRectF.roundOut(crop);
cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius, if (mSupportsRoundedCornersOnWindows) {
mTaskCornerRadius); cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius,
mCurrentCornerRadius = cornerRadius; mTaskCornerRadius);
}
} }
alpha = mTaskAlphaCallback.apply(app, params.targetAlpha); alpha = mTaskAlphaCallback.apply(app, params.targetAlpha);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { } else if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {