OSDN Git Service

[wm] Fix smallestScreenWidthDp configuration on non default display (1/2)
authorGyeHun Jeon <gyehun.jeon@samsung.com>
Fri, 19 Apr 2019 18:30:56 +0000 (11:30 -0700)
committerVishnu Nair <vishnun@google.com>
Mon, 22 Apr 2019 15:32:45 +0000 (08:32 -0700)
smallestScreenWidthDp configuration should be set to smallest possible size.
This could cause unexpected resources to be loaded based on the incorrect configuration. So it
should be set as minimum size of screenWidthDp and screenHeightDp to account for rotation.

Test: reproduce test steps in bug
Test: atest CtsWindowManagerDeviceTestCases:DisplayTests
Bug: 129521230
Change-Id: I07403294e8fe6e6ad7aa718c8a5948aff4fafae1
(cherry picked from commit 7671d7042d60944813f36a03b74199c5a3d737ad)

core/java/android/app/ResourcesManager.java

index b93aaa2..40cb29f 100644 (file)
@@ -236,7 +236,7 @@ public class ResourcesManager {
             config.screenLayout = Configuration.reduceScreenLayout(sl,
                     config.screenHeightDp, config.screenWidthDp);
         }
-        config.smallestScreenWidthDp = config.screenWidthDp; // assume screen does not rotate
+        config.smallestScreenWidthDp = Math.min(config.screenWidthDp, config.screenHeightDp);
         config.compatScreenWidthDp = config.screenWidthDp;
         config.compatScreenHeightDp = config.screenHeightDp;
         config.compatSmallestScreenWidthDp = config.smallestScreenWidthDp;