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

Commit 64079eab authored by Shawn Lin's avatar Shawn Lin Committed by Android (Google) Code Review
Browse files

Merge "Fix rounded corners not showing when only top and bottom radius are set."

parents 6b634145 bdb4d97d
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -317,10 +317,9 @@ public class ScreenDecorations extends SystemUI implements Tunable {
                        updateColorInversion(value);
                    }
                };

            }
            mColorInversionSetting.setListening(true);
            mColorInversionSetting.onChange(false);
            }

            IntentFilter filter = new IntentFilter();
            filter.addAction(Intent.ACTION_USER_SWITCHED);
@@ -640,8 +639,8 @@ public class ScreenDecorations extends SystemUI implements Tunable {
                com.android.internal.R.dimen.rounded_corner_radius_bottom);

        final boolean changed = mRoundedDefault.x != newRoundedDefault
                        || mRoundedDefaultTop.x != newRoundedDefault
                        || mRoundedDefaultBottom.x != newRoundedDefault;
                        || mRoundedDefaultTop.x != newRoundedDefaultTop
                        || mRoundedDefaultBottom.x != newRoundedDefaultBottom;

        if (changed) {
            // If config_roundedCornerMultipleRadius set as true, ScreenDecorations respect the
+38 −0
Original line number Diff line number Diff line
@@ -621,6 +621,44 @@ public class ScreenDecorationsTest extends SysuiTestCase {
        assertEquals(mScreenDecorations.mRoundedDefault, new Point(5, 5));
    }

    @Test
    public void testOnlyRoundedCornerRadiusTop() {
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.dimen.rounded_corner_radius, 0);
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.dimen.rounded_corner_radius_top, 10);
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.dimen.rounded_corner_radius_bottom, 0);
        mContext.getOrCreateTestableResources()
                .addOverride(R.bool.config_roundedCornerMultipleRadius, false);

        mScreenDecorations.start();
        assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
        assertEquals(new Point(10, 10), mScreenDecorations.mRoundedDefaultTop);
        assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefaultBottom);
    }

    @Test
    public void testOnlyRoundedCornerRadiusBottom() {
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.bool.config_fillMainBuiltInDisplayCutout, false);
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.dimen.rounded_corner_radius, 0);
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.dimen.rounded_corner_radius_top, 0);
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.dimen.rounded_corner_radius_bottom, 20);
        mContext.getOrCreateTestableResources()
                .addOverride(R.bool.config_roundedCornerMultipleRadius, false);

        mScreenDecorations.start();
        assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefault);
        assertEquals(new Point(0, 0), mScreenDecorations.mRoundedDefaultTop);
        assertEquals(new Point(20, 20), mScreenDecorations.mRoundedDefaultBottom);
    }


    @Test
    public void testBoundingRectsToRegion() throws Exception {