Use getRealMetrics for screen configuration tests
The tests in ConfigurationTest as part of test module CtsDpiTestCases
fail on small screen devices due to usage of Display#getMetrics()
instead of Display#getRealMetrics().
As per documentation getRealMetrics() "gets display metrics based on the
real size of this display" while getMetrics() may "not necessarily
represent the actual raw size (native resolution) of the display".
Test: run cts -m CtsDpiTestCases \
-t android.dpi.cts.ConfigurationTest#testScreenConfiguration
Bug: 147247314
Change-Id: Ifc5a42f1b9f6b4ee727b30aa6dae910765179909
Signed-off-by: Daniel Kutik <daniel.kutik@lavawerk.com>
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index 8fdc701..e3b198b 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -44,7 +44,7 @@
(WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
mMetrics = new DisplayMetrics();
- display.getMetrics(mMetrics);
+ display.getRealMetrics(mMetrics);
}
@Presubmit