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

Commit a50d9e30 authored by Ebru Kurnaz's avatar Ebru Kurnaz
Browse files

Add a min density dpi for external displays.

This CL introduces a minimum bound for the external display density which is currently set as 100. This means If the calculated external display density falls under 100 it will be set to 100.

Bug: 425944604
Flag: com.android.server.display.feature.flags.base_density_for_external_displays
Test: manually tested with low dpi display
Change-Id: I71b7d32c6a7bd6e11937e72b865af79105d6ee91
parent 3525c956
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
    private static final double DEFAULT_DISPLAY_SIZE = 24.0;
    // 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 int EXTERNAL_DISPLAY_MIN_DENSITY_DPI = 100;

    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 dpi =
                            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) (mStaticDisplayInfo.density * 160 + 0.5);
            }