Merge "Revert "DO NOT MERGE: Make the tests permissive for OMR1"" into oreo-mr1-cts-dev
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 63b5a2d..4b1358a 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -193,6 +193,7 @@
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_device_admin" />
+            <meta-data android:name="test_excluded_features" android:value="android.hardware.type.automotive" />
             <meta-data android:name="test_required_features"
                     android:value="android.software.device_admin" />
         </activity>
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java
index 8a05594..32aa785 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java
@@ -92,7 +92,14 @@
         super.tearDown();
     }
 
+    /**
+     * Enables or disables persistent vr mode and the vr virtual display. For standalone vr devices,
+     * calls to enablePersistentVrMode() are ignored, because the device is already in persistent vr
+     * mode whenever it's on, and turning off persistent vr mode on a standalone vr device puts the
+     * device in a bad state.
+     */
     private void enablePersistentVrMode(boolean enabled) throws Exception {
+        if (mVrHeadset) { return; }
         if (enabled) {
             executeShellCommand("setprop vr_virtualdisplay true");
             executeShellCommand("vr set-persistent-vr-mode-enabled true");
@@ -290,6 +297,12 @@
             return;
         }
 
+        if (mVrHeadset) {
+            // This test doesn't apply to a standalone vr device, since vr is always enabled, and
+            // there is no "post vr" behavior to verify.
+            return;
+        }
+
         // Put the device in persistent vr mode.
         enablePersistentVrMode(true);
 
diff --git a/hostsidetests/theme/assets/26/280dpi.zip b/hostsidetests/theme/assets/26/280dpi.zip
index d5260d9..624830a 100755
--- a/hostsidetests/theme/assets/26/280dpi.zip
+++ b/hostsidetests/theme/assets/26/280dpi.zip
Binary files differ
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
old mode 100644
new mode 100755
index 65cd02b..9d5c5f2
--- a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
@@ -30,6 +30,7 @@
 import android.net.wifi.WifiManager;
 import android.os.SystemClock;
 import android.util.Log;
+import android.content.res.Resources;
 
 import com.android.compatibility.common.util.SystemUtil;
 
@@ -47,11 +48,15 @@
     public static final int BATTERY_JOB_ID = BatteryConstraintTest.class.hashCode();
 
     private JobInfo.Builder mBuilder;
+    private int mLowBatteryWarningLevel = 15;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
 
+        mLowBatteryWarningLevel = Resources.getSystem().getInteger(
+                     Resources.getSystem().getIdentifier(
+                             "config_lowBatteryWarningLevel", "integer", "android"));
         mBuilder = new JobInfo.Builder(BATTERY_JOB_ID, kJobServiceComponent);
         SystemUtil.runShellCommand(getInstrumentation(), "cmd jobscheduler monitor-battery on");
     }
@@ -232,7 +237,7 @@
      * the battery level is critical and not on power.
      */
     public void testBatteryNotLowConstraintFails_withoutPower() throws Exception {
-        setBatteryState(false, 15);
+        setBatteryState(false, mLowBatteryWarningLevel);
         verifyChargingState(false);
         verifyBatteryNotLowState(false);
 
@@ -262,8 +267,8 @@
                 kTestEnvironment.awaitExecution());
 
         // And check that the job is stopped if battery goes low again.
-        setBatteryState(false, 15);
-        setBatteryState(false, 14);
+        setBatteryState(false, mLowBatteryWarningLevel);
+        setBatteryState(false, mLowBatteryWarningLevel - 1);
         verifyChargingState(false);
         verifyBatteryNotLowState(false);
         assertTrue("Job with not low constraint did not stop when battery went low.",
diff --git a/tests/tests/security/src/android/security/cts/EncryptionTest.java b/tests/tests/security/src/android/security/cts/EncryptionTest.java
index 2c42243..07b39de 100644
--- a/tests/tests/security/src/android/security/cts/EncryptionTest.java
+++ b/tests/tests/security/src/android/security/cts/EncryptionTest.java
@@ -22,7 +22,6 @@
 import android.test.AndroidTestCase;
 import junit.framework.TestCase;
 
-import android.app.ActivityManager;
 import android.content.Context;
 import android.util.Log;
 import java.io.BufferedReader;
@@ -45,16 +44,9 @@
 
     private static native boolean aesIsFast();
 
-    private boolean hasLowRAM() {
-        ActivityManager activityManager =
-            (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
-
-        return activityManager.isLowRamDevice();
-    }
-
     private boolean isRequired() {
-        // Optional before MIN_API_LEVEL or if the device has low RAM
-        return PropertyUtil.getFirstApiLevel() >= MIN_API_LEVEL && !hasLowRAM();
+        // Optional before MIN_API_LEVEL
+        return PropertyUtil.getFirstApiLevel() >= MIN_API_LEVEL;
     }
 
     public void testEncryption() throws Exception {
diff --git a/tests/tests/text/src/android/text/format/cts/TimeTest.java b/tests/tests/text/src/android/text/format/cts/TimeTest.java
index e085a29..f43ad12 100644
--- a/tests/tests/text/src/android/text/format/cts/TimeTest.java
+++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java
@@ -2760,29 +2760,31 @@
         verifyNormalizeResult(false, t, expected, 57724200000L);
     }
 
-    @Test
-    public void testNormalize_stdToStdSkip() {
-        // In Kiritimati, 1st Jan 1995 10:00 - 10:40 was a skip from STD -> STD (plus they do not
-        // observe DST).
-        String timezone = "Pacific/Kiritimati";
-        Time t = new Time(timezone);
-        Time expected = new Time(timezone);
-
-        // isDst = 0, normalize(false)
-        Fields.set(t, 1995, 0, 1, 10, 20, 0, 0 /* isDst */, 9, 9, 9);
-        Fields.set(expected, 1995, 0, 1, 10, 20, 0, 0 /* isDst */, 9, 9, 9);
-        verifyNormalizeResult(false, t, expected, -1);
-
-        // isDst = 1, normalize(false)
-        Fields.set(t, 1995, 0, 1, 10, 20, 0, 1 /* isDst */, 9, 9, 9);
-        Fields.set(expected, 1995, 0, 1, 10, 20, 0, 1 /* isDst */, 9, 9, 9);
-        verifyNormalizeResult(false, t, expected, -1);
-
-        // isDst = -1, normalize(false)
-        Fields.set(t, 1995, 0, 1, 10, 20, 0, -1 /* isDst */, 9, 9, 9);
-        Fields.set(expected, 1995, 0, 1, 10, 20, 0, -1 /* isDst */, 9, 9, 9);
-        verifyNormalizeResult(false, t, expected, -1);
-    }
+    // Removal of test for CTS that is dependent on IANA rules data version. Fails >= 2018d
+    // http://b/76362687
+    // @Test
+    // public void testNormalize_stdToStdSkip() {
+    //     // In Kiritimati, 1st Jan 1995 10:00 - 10:40 was a skip from STD -> STD (plus they do not
+    //     // observe DST).
+    //     String timezone = "Pacific/Kiritimati";
+    //     Time t = new Time(timezone);
+    //     Time expected = new Time(timezone);
+    //
+    //     // isDst = 0, normalize(false)
+    //     Fields.set(t, 1995, 0, 1, 10, 20, 0, 0 /* isDst */, 9, 9, 9);
+    //     Fields.set(expected, 1995, 0, 1, 10, 20, 0, 0 /* isDst */, 9, 9, 9);
+    //     verifyNormalizeResult(false, t, expected, -1);
+    //
+    //     // isDst = 1, normalize(false)
+    //     Fields.set(t, 1995, 0, 1, 10, 20, 0, 1 /* isDst */, 9, 9, 9);
+    //     Fields.set(expected, 1995, 0, 1, 10, 20, 0, 1 /* isDst */, 9, 9, 9);
+    //     verifyNormalizeResult(false, t, expected, -1);
+    //
+    //     // isDst = -1, normalize(false)
+    //     Fields.set(t, 1995, 0, 1, 10, 20, 0, -1 /* isDst */, 9, 9, 9);
+    //     Fields.set(expected, 1995, 0, 1, 10, 20, 0, -1 /* isDst */, 9, 9, 9);
+    //     verifyNormalizeResult(false, t, expected, -1);
+    // }
 
     @Test
     public void testNormalize_utcWithDst() {