am aee3ea8f: am 55fa5332: am 03698e68: Merge "Change the test case about SCREENLAYOUT_LONG  depending whether the navigation bar is displayed or not."

* commit 'aee3ea8f0c8cfa5ea4cff3425c525b575cc06916':
  Change the test case about SCREENLAYOUT_LONG  depending whether the navigation bar is displayed or not.
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
index d4c3611..f0372e9 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
@@ -24,6 +24,7 @@
 import android.test.ActivityInstrumentationTestCase2;
 import android.util.DisplayMetrics;
 import android.view.Display;
+import android.view.ViewConfiguration;
 import android.view.WindowManager;
 
 public class ConfigurationScreenLayoutTest
@@ -45,6 +46,9 @@
         int expectedSize = expectedScreenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
         int expectedLong = expectedScreenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
 
+        // Check if the device has the navigation bar.
+        boolean navigationBar = hasNavigationBar();
+
         // Check that all four orientations report the same configuration value.
         for (int i = 0; i < ORIENTATIONS.length; i++) {
             Activity activity = startOrientationActivity(ORIENTATIONS[i]);
@@ -52,6 +56,15 @@
             int actualSize = mConfig.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
             int actualLong = mConfig.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
 
+            if (navigationBar) {
+                // Update screenLayout value if the device has the navigation bar.
+                expectedScreenLayout = reduceScreenLayout(activity,
+                        Configuration.SCREENLAYOUT_SIZE_XLARGE
+                        | Configuration.SCREENLAYOUT_LONG_YES);
+                expectedSize = expectedScreenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
+                expectedLong = expectedScreenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
+            }
+
             assertEquals("Expected screen size value of " + expectedSize + " but got " + actualSize
                     + " for orientation " + ORIENTATIONS[i], expectedSize, actualSize);
             assertEquals("Expected screen long value of " + expectedLong + " but got " + actualLong
@@ -80,6 +93,11 @@
         return screenLayout;
     }
 
+    private boolean hasNavigationBar() {
+        // Check if the device has a permanent menu key available.
+        return !ViewConfiguration.get(getActivity()).hasPermanentMenuKey();
+    }
+
     private Activity startOrientationActivity(int orientation) {
         Intent intent = new Intent();
         intent.putExtra(OrientationActivity.EXTRA_ORIENTATION, orientation);