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

Commit 9a8e23f8 authored by Ebru Kurnaz's avatar Ebru Kurnaz Committed by Android (Google) Code Review
Browse files

Merge "Add a min density dpi for external displays." into main

parents 6b20127d a50d9e30
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -87,6 +87,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
    private static final double DEFAULT_DISPLAY_SIZE = 24.0;
    private static final double DEFAULT_DISPLAY_SIZE = 24.0;
    // Touch target size 10.4mm in inches (divided by mm per inch 25.4)
    // Touch target size 10.4mm in inches (divided by mm per inch 25.4)
    private static final double EXTERNAL_DISPLAY_BASE_TOUCH_TARGET_SIZE_IN_INCHES = 10.4 / 25.4;
    private static final double EXTERNAL_DISPLAY_BASE_TOUCH_TARGET_SIZE_IN_INCHES = 10.4 / 25.4;
    private static final int EXTERNAL_DISPLAY_MIN_DENSITY_DPI = 100;


    private static final double BASE_TOUCH_TARGET_SIZE_DP = 48.0;
    private static final double BASE_TOUCH_TARGET_SIZE_DP = 48.0;


@@ -552,8 +553,12 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                    double pixels = ppi * EXTERNAL_DISPLAY_BASE_TOUCH_TARGET_SIZE_IN_INCHES;
                    double pixels = ppi * EXTERNAL_DISPLAY_BASE_TOUCH_TARGET_SIZE_IN_INCHES;
                    double dpi =
                    double dpi =
                            pixels * DisplayMetrics.DENSITY_DEFAULT / BASE_TOUCH_TARGET_SIZE_DP;
                            pixels * DisplayMetrics.DENSITY_DEFAULT / BASE_TOUCH_TARGET_SIZE_DP;
                    if (dpi < EXTERNAL_DISPLAY_MIN_DENSITY_DPI) {
                        return EXTERNAL_DISPLAY_MIN_DENSITY_DPI;
                    } else {
                        return (int) (dpi + 0.5);
                        return (int) (dpi + 0.5);
                    }
                    }
                }
                return (int) (mStaticDisplayInfo.density * 160 + 0.5);
                return (int) (mStaticDisplayInfo.density * 160 + 0.5);
            }
            }