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

Commit 7d3f73c8 authored by vadimt's avatar vadimt
Browse files

Excluding corner radius from quick switch gesture.

Test: forrest on new devices
Bug: 190638716

Change-Id: Iefa89e040ab77869db7022d7c535a5546e03ae3c
parent ce7084f4
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -177,33 +177,34 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                    final int startY;
                    final int endX;
                    final int endY;
                    final int cornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
                    if (toRight) {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                            // Swipe from the bottom left to the bottom right of the screen.
                            startX = 0;
                            startX = cornerRadius;
                            startY = getSwipeStartY();
                            endX = mLauncher.getDevice().getDisplayWidth();
                            endX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
                            endY = startY;
                        } else {
                            // Swipe from the bottom right to the top right of the screen.
                            startX = getSwipeStartX();
                            startY = mLauncher.getRealDisplaySize().y - 1;
                            startY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
                            endX = startX;
                            endY = 0;
                            endY = cornerRadius;
                        }
                    } else {
                        if (mLauncher.getDevice().isNaturalOrientation() || !transposeInLandscape) {
                            // Swipe from the bottom right to the bottom left of the screen.
                            startX = mLauncher.getDevice().getDisplayWidth();
                            startX = mLauncher.getDevice().getDisplayWidth() - cornerRadius;
                            startY = getSwipeStartY();
                            endX = 0;
                            endX = cornerRadius;
                            endY = startY;
                        } else {
                            // Swipe from the bottom left to the top left of the screen.
                            startX = getSwipeStartX();
                            startY = 0;
                            startY = cornerRadius;
                            endX = startX;
                            endY = mLauncher.getRealDisplaySize().y - 1;
                            endY = mLauncher.getRealDisplaySize().y - 1 - cornerRadius;
                        }
                    }

+29 −0
Original line number Diff line number Diff line
@@ -1450,4 +1450,33 @@ public final class LauncherInstrumentation {
            return null;
        }
    }

    float getWindowCornerRadius() {
        final Resources resources = getResources();
        if (!supportsRoundedCornersOnWindows(resources)) {
            return 0f;
        }

        // Radius that should be used in case top or bottom aren't defined.
        float defaultRadius = ResourceUtils.getDimenByName("rounded_corner_radius", resources, 0);

        float topRadius = ResourceUtils.getDimenByName("rounded_corner_radius_top", resources, 0);
        if (topRadius == 0f) {
            topRadius = defaultRadius;
        }
        float bottomRadius = ResourceUtils.getDimenByName(
                "rounded_corner_radius_bottom", resources, 0);
        if (bottomRadius == 0f) {
            bottomRadius = defaultRadius;
        }

        // Always use the smallest radius to make sure the rounded corners will
        // completely cover the display.
        return Math.min(topRadius, bottomRadius);
    }

    private static boolean supportsRoundedCornersOnWindows(Resources resources) {
        return ResourceUtils.getBoolByName(
                "config_supportsRoundedCornersOnWindows", resources, false);
    }
}
 No newline at end of file
+1 −31
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.launcher3.testing.TestProtocol.SPRING_LOADED_STATE_ORD

import static junit.framework.TestCase.assertTrue;

import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.SystemClock;
@@ -61,34 +60,6 @@ public final class Workspace extends Home {
        mHotseat = launcher.waitForLauncherObject("hotseat");
    }

    private static boolean supportsRoundedCornersOnWindows(Resources resources) {
        return ResourceUtils.getBoolByName(
                "config_supportsRoundedCornersOnWindows", resources, false);
    }

    private 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 = ResourceUtils.getDimenByName("rounded_corner_radius", resources, 0);

        float topRadius = ResourceUtils.getDimenByName("rounded_corner_radius_top", resources, 0);
        if (topRadius == 0f) {
            topRadius = defaultRadius;
        }
        float bottomRadius = ResourceUtils.getDimenByName(
                "rounded_corner_radius_bottom", resources, 0);
        if (bottomRadius == 0f) {
            bottomRadius = defaultRadius;
        }

        // Always use the smallest radius to make sure the rounded corners will
        // completely cover the display.
        return Math.min(topRadius, bottomRadius);
    }

    /**
     * Swipes up to All Apps.
     *
@@ -103,8 +74,7 @@ public final class Workspace extends Home {
            final int deviceHeight = mLauncher.getDevice().getDisplayHeight();
            final int bottomGestureMargin = ResourceUtils.getNavbarSize(
                    ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mLauncher.getResources());
            final int windowCornerRadius = (int) Math.ceil(getWindowCornerRadius(
                    mLauncher.getResources()));
            final int windowCornerRadius = (int) Math.ceil(mLauncher.getWindowCornerRadius());
            final int startY = deviceHeight - Math.max(bottomGestureMargin, windowCornerRadius) - 1;
            final int swipeHeight = mLauncher.getTestInfo(
                    TestProtocol.REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT).