Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2074857 authored by Lucas Dupin's avatar Lucas Dupin Committed by Hyunyoung Song
Browse files

Disable window corner rounding on some devices

Bug: 122347746
Test: visual; on taimen, marlin and walleye
Change-Id: If6ac1c75297dd25ad40d3ec61537e8793bceceb7
parent 792fcc3a
Loading
Loading
Loading
Loading
+401 B (143 KiB)

File changed.

No diff preview for this file type.

+2 −0
Original line number Diff line number Diff line
@@ -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>
+6 −3
Original line number Diff line number Diff line
@@ -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 windowRadius = 0;
                if (RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
                    float circleRadius = iconWidth / 2f;
                float windowRadius = Utilities.mapRange(easePercent, circleRadius,
                    windowRadius = Utilities.mapRange(easePercent, circleRadius,
                            windowCornerRadius);
                }

                // Animate the window crop so that it starts off as a square, and then reveals
                // horizontally.
+21 −0
Original line number Diff line number Diff line
@@ -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);
+12 −5
Original line number Diff line number Diff line
@@ -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();
        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);
                    if (mSupportsRoundedCornersOnWindows) {
                        cornerRadius = Utilities.mapRange(params.progress, mWindowCornerRadius,
                                mTaskCornerRadius);
                    mCurrentCornerRadius = cornerRadius;
                    }
                }
                alpha = mTaskAlphaCallback.apply(app, params.targetAlpha);
            } else if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {