Merge "move NfcHidlBasicTest to testcases/hal"
diff --git a/testcases/host/reboot/RebootRootRemountTest/RebootRootRemountTest.py b/testcases/host/reboot/RebootRootRemountTest/RebootRootRemountTest.py
index 9e17332..5d48e9d 100644
--- a/testcases/host/reboot/RebootRootRemountTest/RebootRootRemountTest.py
+++ b/testcases/host/reboot/RebootRootRemountTest/RebootRootRemountTest.py
@@ -15,6 +15,8 @@
 # limitations under the License.
 #
 
+import logging
+
 from vts.runners.host import asserts
 from vts.runners.host import base_test_with_webdb
 from vts.runners.host import test_runner
@@ -23,18 +25,25 @@
 from vts.utils.python.controllers import android_device
 
 
-class RootRemountAfterRebootTest(base_test_with_webdb.BaseTestWithWebDbClass):
+class RebootRootRemountTest(base_test_with_webdb.BaseTestWithWebDbClass):
     """Tests if device can root and remount /system partition after reboot.
 
     Attributes:
-        dut: AndroidDevice, the device under test as config
+        dut: AndroidDevice, the device under test as config.
+        verity: boolean, True if verity was enabled before test,
+            False otherwise.
     """
     def setUpClass(self):
         self.dut = self.registerController(android_device)[0]
+        self.verity = self.dut.verityEnabled
 
-    def testRootRemountAfterReboot(self):
+    def testRebootRootRemount(self):
         """Tests if /system partition can be remounted as r/w after reboot."""
-        self.dut.adb.disable_verity()
+        # Disable verity if it's enabled.
+        if self.verity:
+            logging.info("Disable verity.")
+            self.dut.adb.disable_verity()
+
         try:
             self.dut.reboot()
             self.dut.waitForBootCompletion()
@@ -50,6 +59,18 @@
         except adb.AdbError():
             asserts.fail("Root/remount failed.")
 
+        # Restore verity to its original state.
+        if self.verity:
+            logging.info("Enable verity.")
+            self.dut.adb.enable_verity()
+            try:
+                self.dut.reboot()
+                self.dut.waitForBootCompletion()
+            except utils.TimeoutError:
+                asserts.fail("Reboot failed after re-enabling verity.")
+
+        asserts.assertEqual(self.verity, self.dut.verityEnabled,
+            "Verity state was successfully restored.")
 
 if __name__ == "__main__":
     test_runner.main()
diff --git a/tools/vts-tradefed/res/config/vts-serving-staging-kselftest.xml b/tools/vts-tradefed/res/config/vts-serving-staging-kselftest.xml
index 36147af..11ca9ca 100644
--- a/tools/vts-tradefed/res/config/vts-serving-staging-kselftest.xml
+++ b/tools/vts-tradefed/res/config/vts-serving-staging-kselftest.xml
@@ -16,6 +16,7 @@
 <configuration description="Run New VTS Tests for Linux Kernel Selftest in the Staging environment">
     <include name="everything" />
     <option name="plan" value="vts" />
+    <option name="compatibility:include-filter" value="LinuxKselftestTest" />
     <option name="compatibility:include-filter" value="LinuxKselftestTestStaging" />
     <template-include name="reporters" default="basic-reporters" />
 </configuration>
diff --git a/utils/python/controllers/android_device.py b/utils/python/controllers/android_device.py
index dbef29a..3f096f5 100644
--- a/utils/python/controllers/android_device.py
+++ b/utils/python/controllers/android_device.py
@@ -405,6 +405,16 @@
         return "root" in id_str
 
     @property
+    def verityEnabled(self):
+        """True if verity is enabled for this device."""
+        try:
+            self.adb.shell('getprop | grep partition.system.verified').decode("utf-8")
+        except adb.AdbError:
+            # If verity is disabled, there is no property 'partition.system.verified'
+            return False
+        return True
+
+    @property
     def model(self):
         """The Android code name for the device."""
         # If device is in bootloader mode, get mode name from fastboot.