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

Commit 83584cc3 authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Fix rounded corners in transitions on non-internal displays

Currently getWindowCornerRaduis always returns the default display's
rounded corners because this is what is returned by
RoundedCorners#getRoundedCornerRadius etc.

This should only be done for displays that have their corner radii
in the resources, i.e. built-in internal displays - this is what
DisplayPolicy#getWindowCornerRadius checks and returns 0 otherwise.

Adding this check directly to ScreenDecorationsUtils.

Fix: 365846717
Test: presubmit
Flag: EXEMPT trivial bugfix
Change-Id: I2133917df504af1467db706918db2b6050b5067c
parent 1c6f1389
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ public class ScreenDecorationsUtils {
     *
     * Note that if the context is not an UI context(not associated with Display), it will use
     * default display.
     *
     * If the associated display is not internal, will return 0.
     */
    public static float getWindowCornerRadius(Context context) {
        final Resources resources = context.getResources();
@@ -44,7 +46,13 @@ public class ScreenDecorationsUtils {
            return 0f;
        }
        // Use Context#getDisplayNoVerify() in case the context is not an UI context.
        final String displayUniqueId = context.getDisplayNoVerify().getUniqueId();
        final Display display = context.getDisplayNoVerify();
        // The radius is only valid for internal displays, since the corner radius of external or
        // virtual displays is not known when window corners are configured or are not supported.
        if (display.getType() != Display.TYPE_INTERNAL) {
            return 0f;
        }
        final String displayUniqueId = display.getUniqueId();
        // Radius that should be used in case top or bottom aren't defined.
        float defaultRadius = RoundedCorners.getRoundedCornerRadius(resources, displayUniqueId)
                - RoundedCorners.getRoundedCornerRadiusAdjustment(resources, displayUniqueId);