Merge "Disable window corner rounding on some devices" into ub-launcher3-master

This commit is contained in:
TreeHugger Robot 2019-01-25 00:31:52 +00:00 committed by Android (Google) Code Review
commit 90048de773
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_icon_size">48dp</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_clear_all_deadzone_vertical_margin">70dp</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.
float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher)
.getWindowCornerRadius();
float circleRadius = iconWidth / 2f;
float windowRadius = Utilities.mapRange(easePercent, circleRadius,
windowCornerRadius);
float windowRadius = 0;
if (RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
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
// horizontally.

View File

@ -66,6 +66,7 @@ public class RecentsModel extends TaskStackChangeListener {
private final TaskThumbnailCache mThumbnailCache;
private float mWindowCornerRadius = -1;
private Boolean mSupportsRoundedCornersOnWindows;
private RecentsModel(Context context) {
mContext = context;
@ -199,6 +200,26 @@ public class RecentsModel extends TaskStackChangeListener {
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) {
if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
mThumbnailCache.getHighResLoadingState().setVisible(false);

View File

@ -91,6 +91,8 @@ public class ClipAnimationHelper {
private final float mWindowCornerRadius;
// Corner radius of windows when they're in overview mode.
private final float mTaskCornerRadius;
// If windows can have real time rounded corners.
private final boolean mSupportsRoundedCornersOnWindows;
// Corner radius currently applied to transformed window.
private float mCurrentCornerRadius;
@ -107,8 +109,12 @@ public class ClipAnimationHelper {
(t, a1) -> a1;
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) {
@ -197,9 +203,10 @@ public class ClipAnimationHelper {
mTmpMatrix.setRectToRect(mSourceRect, params.currentRect, ScaleToFit.FILL);
mTmpMatrix.postTranslate(app.position.x, app.position.y);
mClipRectF.roundOut(crop);
cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius,
mTaskCornerRadius);
mCurrentCornerRadius = cornerRadius;
if (mSupportsRoundedCornersOnWindows) {
cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius,
mTaskCornerRadius);
}
}
alpha = mTaskAlphaCallback.apply(app, params.targetAlpha);
} else if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {