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

Commit 03270e1f authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Config to disable rounded corners"

parents d9e60a63 f36d0dcf
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -16,10 +16,10 @@

package com.android.internal.policy;

import com.android.internal.R;

import android.content.res.Resources;

import com.android.internal.R;

/**
 * Utility functions for screen decorations used by both window manager and System UI.
 */
@@ -31,15 +31,19 @@ public class ScreenDecorationsUtils {
     * scaling, this means that we don't have to reload them on config changes.
     */
    public static float getWindowCornerRadius(Resources resources) {
        if (!supportsRoundedCornersOnWindows(resources)) {
            return 0f;
        }

        // Radius that should be used in case top or bottom aren't defined.
        float defaultRadius = resources.getDimension(R.dimen.rounded_corner_radius);

        float topRadius = resources.getDimension(R.dimen.rounded_corner_radius_top);
        if (topRadius == 0) {
        if (topRadius == 0f) {
            topRadius = defaultRadius;
        }
        float bottomRadius = resources.getDimension(R.dimen.rounded_corner_radius_bottom);
        if (bottomRadius == 0) {
        if (bottomRadius == 0f) {
            bottomRadius = defaultRadius;
        }

@@ -47,4 +51,11 @@ public class ScreenDecorationsUtils {
        // completely cover the display.
        return Math.min(topRadius, bottomRadius);
    }

    /**
     * If live rounded corners are supported on windows.
     */
    public static boolean supportsRoundedCornersOnWindows(Resources resources) {
        return resources.getBoolean(R.bool.config_supportsRoundedCornersOnWindows);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -3648,4 +3648,8 @@
         set in AndroidManifest.
         {@see android.view.Display#FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS} -->
    <string name="config_secondaryHomeComponent" translatable="false">com.android.launcher3/com.android.launcher3.SecondaryDisplayLauncher</string>

    <!-- If device supports corner radius on windows.
         This should be turned off on low-end devices to improve animation performance. -->
    <bool name="config_supportsRoundedCornersOnWindows">true</bool>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -3515,6 +3515,7 @@
  <java-symbol type="dimen" name="rounded_corner_radius" />
  <java-symbol type="dimen" name="rounded_corner_radius_top" />
  <java-symbol type="dimen" name="rounded_corner_radius_bottom" />
  <java-symbol type="bool" name="config_supportsRoundedCornersOnWindows" />

  <java-symbol type="string" name="config_defaultModuleMetadataProvider" />

+6 −0
Original line number Diff line number Diff line
@@ -76,4 +76,10 @@ interface ISystemUiProxy {
     */
    float getWindowCornerRadius() = 10;

    /**
     * If device supports live rounded corners on windows.
     * This might be turned off for performance reasons
     */
    boolean supportsRoundedCornersOnWindows() = 11;

}
+15 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private float mBackButtonAlpha;
    private MotionEvent mStatusBarGestureDownEvent;
    private float mWindowCornerRadius;
    private boolean mSupportsRoundedCornersOnWindows;

    private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {

@@ -244,6 +245,18 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
            }
        }

        public boolean supportsRoundedCornersOnWindows() {
            if (!verifyCaller("supportsRoundedCornersOnWindows")) {
                return false;
            }
            long token = Binder.clearCallingIdentity();
            try {
                return mSupportsRoundedCornersOnWindows;
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        private boolean verifyCaller(String reason) {
            final int callerId = Binder.getCallingUserHandle().getIdentifier();
            if (callerId != mCurrentBoundedUserId) {
@@ -353,6 +366,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        mInteractionFlags = Prefs.getInt(mContext, Prefs.Key.QUICK_STEP_INTERACTION_FLAGS,
                getDefaultInteractionFlags());
        mWindowCornerRadius = ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources());
        mSupportsRoundedCornersOnWindows = ScreenDecorationsUtils
                .supportsRoundedCornersOnWindows(mContext.getResources());

        // Listen for the package update changes.
        if (mDeviceProvisionedController.getCurrentUser() == UserHandle.USER_SYSTEM) {