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
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index f681d75..4d5bd5d 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -168,8 +168,10 @@
// 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;