Merge tag 'android-security-10.0.0_r53' into int/10/fp2

Android security 10.0.0 release 53

* tag 'android-security-10.0.0_r53':

Change-Id: I16c9c55ea492214e5469295372950a0ae49434c0
diff --git a/api/proc/KernelProcFileTestBase.py b/api/proc/KernelProcFileTestBase.py
index aeaac70..472961c 100644
--- a/api/proc/KernelProcFileTestBase.py
+++ b/api/proc/KernelProcFileTestBase.py
@@ -137,6 +137,9 @@
         self.parser = yacc.yacc(module=self, write_tables=False, \
                 errorlog=yacc.PlyLogger(sys.stderr)) #open(os.devnull, 'w')))
 
+    def set_api_level(self, dut):
+        self.api_level = dut.getLaunchApiLevel(strict=False)
+
     def parse_line(self, rule, line, custom={}):
         """Parse a line of text with the parse library.
 
diff --git a/api/proc/ProcSimpleFileTests.py b/api/proc/ProcSimpleFileTests.py
index e19600d..5bc9678 100644
--- a/api/proc/ProcSimpleFileTests.py
+++ b/api/proc/ProcSimpleFileTests.py
@@ -18,6 +18,7 @@
 
 from parse import with_pattern
 from vts.testcases.kernel.api.proc import KernelProcFileTestBase
+from vts.utils.python.android import api
 from vts.utils.python.file import target_file_utils
 
 # Test for /proc/sys/kernel/*.
@@ -439,9 +440,18 @@
     def get_path(self):
         return "/proc/sys/vm/drop_caches"
 
-    def get_permission_checker(self):
-        return target_file_utils.IsReadWrite
+    def IsReadWriteOrWriteOnly(self, permission_bits):
+        return (target_file_utils.IsReadWrite(permission_bits) or
+                target_file_utils.IsWriteOnly(permission_bits))
 
+    def get_permission_checker(self):
+        if self.api_level > api.PLATFORM_API_LEVEL_Q:
+            return target_file_utils.IsWriteOnly
+        else:
+            return self.IsReadWriteOrWriteOnly
+
+    def test_format(self):
+        return False
 
 class ProcExtraFreeKbytes(KernelProcFileTestBase.KernelProcFileTestBase):
     '''/proc/sys/vm/extra_free_kbytes tells the VM to keep extra free memory
diff --git a/api/proc/ProcUidConcurrentTimeTests.py b/api/proc/ProcUidConcurrentTimeTests.py
index e8c09f0..e142d23 100644
--- a/api/proc/ProcUidConcurrentTimeTests.py
+++ b/api/proc/ProcUidConcurrentTimeTests.py
@@ -49,6 +49,9 @@
     def get_path(self):
         return "/proc/uid_concurrent_active_time"
 
+    def file_optional(self, shell=None, dut=None):
+        return True
+
     def result_correct(self, result):
         cpus, times = result
         no_repeated_uids = len(set(x[0] for x in times)) == len(times)
@@ -91,6 +94,9 @@
     def get_path(self):
         return "/proc/uid_concurrent_policy_time"
 
+    def file_optional(self, shell=None, dut=None):
+        return True
+
     def result_correct(self, result):
         cpus, times = result
         no_repeated_uids = len(set(x[0] for x in times)) == len(times)
diff --git a/api/proc/ProcUidTimeInStateTest.py b/api/proc/ProcUidTimeInStateTest.py
index c3a1a71..62be07c 100644
--- a/api/proc/ProcUidTimeInStateTest.py
+++ b/api/proc/ProcUidTimeInStateTest.py
@@ -50,7 +50,6 @@
         return "/proc/uid_time_in_state"
 
     def file_optional(self, shell=None, dut=None):
-        # This file is optional until implemented in Android common kernel
         return True
 
     def result_correct(self, result):
diff --git a/api/proc/VtsKernelProcFileApiTest.py b/api/proc/VtsKernelProcFileApiTest.py
index 3451f5c..5a2b324 100644
--- a/api/proc/VtsKernelProcFileApiTest.py
+++ b/api/proc/VtsKernelProcFileApiTest.py
@@ -141,6 +141,7 @@
         """
         asserts.skipIf(test_object in TEST_OBJECTS_64 and not self.dut.is64Bit,
                        "Skip test for 64-bit kernel.")
+        test_object.set_api_level(self.dut)
         filepath = test_object.get_path()
         asserts.skipIf(not target_file_utils.Exists(filepath, self.shell) and
                        test_object.file_optional(shell=self.shell, dut=self.dut),
diff --git a/checkpoint/Android.bp b/checkpoint/Android.bp
index 5d4c36f..2fdd165 100644
--- a/checkpoint/Android.bp
+++ b/checkpoint/Android.bp
@@ -17,7 +17,3 @@
 vts_config {
     name: "VtsKernelCheckpointTest",
 }
-
-vts_config {
-    name: "VtsKernelCheckpointDTFstabTest",
-}
diff --git a/checkpoint/AndroidTest.xml b/checkpoint/AndroidTest.xml
index 53c8daa..d66c0ea 100644
--- a/checkpoint/AndroidTest.xml
+++ b/checkpoint/AndroidTest.xml
@@ -20,11 +20,6 @@
         <option name="cleanup" value="true" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
-        <option name="test-module-name" value="VtsKernelCheckpointDTFstabTest" />
-        <option name="test-case-path" value="vts/testcases/kernel/checkpoint/VtsKernelCheckpointDTFstabTest" />
-        <option name="precondition-first-api-level" value="29" />
-    </test>
-    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
         <option name="test-module-name" value="VtsKernelCheckpointTest" />
         <option name="test-case-path" value="vts/testcases/kernel/checkpoint/VtsKernelCheckpointTest" />
         <option name="test-timeout" value="6m" />
diff --git a/checkpoint/VtsKernelCheckpointDTFstabTest.py b/checkpoint/VtsKernelCheckpointDTFstabTest.py
deleted file mode 100644
index 7556528..0000000
--- a/checkpoint/VtsKernelCheckpointDTFstabTest.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-"""A test to check if dynamic partitions is enabled for new devices in Q."""
-
-import logging
-
-from vts.runners.host import asserts
-from vts.runners.host import base_test
-from vts.runners.host import test_runner
-from vts.utils.python.file import target_file_utils
-
-class VtsKernelCheckpointDTFstabTest(base_test.BaseTestClass):
-    """A test class to verify dynamic partitions are enabled."""
-
-    def setUpClass(self):
-        """Initializes device and shell."""
-        self.dut = self.android_devices[0]
-        self.shell = self.dut.shell
-
-    def testMetadataEarlyMounted(self):
-        """Checks metadata exists in device tree based fstab.
-
-        Userdata checkpoint requires metadata to be early mounted.
-        """
-        fstab = "/proc/device-tree/firmware/android/fstab"
-        if target_file_utils.Exists(fstab, self.shell):
-            asserts.assertTrue(target_file_utils.Exists(fstab + "/metadata",
-                                                        self.shell))
-        else:
-            logging.info("device is not using device tree fstab")
-
-if __name__ == "__main__":
-    test_runner.main()
diff --git a/ltp/configs/stable_tests.py b/ltp/configs/stable_tests.py
index c260b60..ba160f8 100644
--- a/ltp/configs/stable_tests.py
+++ b/ltp/configs/stable_tests.py
@@ -767,8 +767,8 @@
     ('syscalls.fork03_64bit', True),
     ('syscalls.fork04_32bit', True),
     ('syscalls.fork04_64bit', True),
-    ('syscalls.fork05_32bit', True),
-    ('syscalls.fork05_64bit', True),
+    ('syscalls.fork05_32bit', False),
+    ('syscalls.fork05_64bit', False),
     ('syscalls.fork06_32bit', True),
     ('syscalls.fork06_64bit', True),
     ('syscalls.fork07_32bit', True),
@@ -2076,8 +2076,8 @@
     ('syscalls.sync02_64bit', True),
     ('syscalls.sync_file_range01_32bit', True),
     ('syscalls.sync_file_range01_64bit', True),
-    ('syscalls.syncfs01_32bit', True),
-    ('syscalls.syncfs01_64bit', True),
+    ('syscalls.syncfs01_32bit', False),
+    ('syscalls.syncfs01_64bit', False),
     ('syscalls.syscall01_32bit', False),
     ('syscalls.syscall01_64bit', False),
     ('syscalls.sysconf01_32bit', False),