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

Commit 4e2c25a7 authored by Alex Chau's avatar Alex Chau
Browse files

Ensure isTablet is only enable when simulated landscape is disabled

- Tablet UI (e.g. grid overview and two panel workspace) is built with assumption that simulated landscape is disabled, make sure this is the case in DeviceProfile
- This is usually true as swDPs is generally smaller than sw used to determine xml files

Bug: 174464656
Test: Try different combination of smallest width and Display Size, isTablet is only set when allow_rotation is true
Change-Id: I3ee1c76909f29b6f14c4032be812bb8c9ea7e827
parent d10b5870
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -168,8 +168,10 @@ public class DeviceProfile {
        // Constants from resources
        float swDPs = Utilities.dpiFromPx(
                Math.min(info.smallestSize.x, info.smallestSize.y), info.metrics);
        isTablet = swDPs >= TABLET_MIN_DPS;
        isLargeTablet = swDPs >= LARGE_TABLET_MIN_DPS;
        boolean allowRotation = context.getResources().getBoolean(R.bool.allow_rotation);
        // Tablet UI is built with assumption that simulated landscape is disabled.
        isTablet = allowRotation && swDPs >= TABLET_MIN_DPS;
        isLargeTablet = isTablet && swDPs >= LARGE_TABLET_MIN_DPS;
        isPhone = !isTablet && !isLargeTablet;
        aspectRatio = ((float) Math.max(widthPx, heightPx)) / Math.min(widthPx, heightPx);
        boolean isTallDevice = Float.compare(aspectRatio, TALL_DEVICE_ASPECT_RATIO_THRESHOLD) >= 0;