Fix check target files vintf test.

check_vintf now checks deprecation as well, which
requires matrix fragments to exist. Update tests to
reflect this.

The test also uses legacy vendor manifest path, which makes
it not combined with the ODM manifests, causing sku_compat
test to fail. Fix it by using the new vendor manifest path
(which libvintf correctly combines it with the ODM manifests.)

Fixes: 155131894
Test: python -m unittest test_check_target_files_vintf
Change-Id: Ib660f8796efc3465d9513688695dac29c63a7514
diff --git a/tools/releasetools/test_check_target_files_vintf.py b/tools/releasetools/test_check_target_files_vintf.py
index 79f9018..d326229 100644
--- a/tools/releasetools/test_check_target_files_vintf.py
+++ b/tools/releasetools/test_check_target_files_vintf.py
@@ -35,20 +35,20 @@
     'SYSTEM_EXT/etc/build.prop': '',
 
     # Non-empty files
-    'SYSTEM/compatibility_matrix.xml':"""
-        <compatibility-matrix version="1.0" type="framework">
+    'SYSTEM/etc/vintf/compatibility_matrix.1.xml':"""
+        <compatibility-matrix version="1.0" level="1" type="framework">
             <sepolicy>
                 <sepolicy-version>0.0</sepolicy-version>
                 <kernel-sepolicy-version>0</kernel-sepolicy-version>
             </sepolicy>
         </compatibility-matrix>""",
     'SYSTEM/manifest.xml':
-        '<manifest version="1.0" type="framework" />',
+        '<manifest version="1.0" type="framework"/>',
     'VENDOR/build.prop': 'ro.product.first_api_level=29\n',
     'VENDOR/compatibility_matrix.xml':
         '<compatibility-matrix version="1.0" type="device" />',
-    'VENDOR/manifest.xml':
-        '<manifest version="1.0" type="device"/>',
+    'VENDOR/etc/vintf/manifest.xml':
+        '<manifest version="1.0" target-level="1" type="device"/>',
     'META/misc_info.txt':
         'recovery_api_version=3\nfstab_version=2\nvintf_enforce=true\n',
 }
@@ -140,6 +140,6 @@
   def test_CheckVintf_bad_xml(self):
     test_dir = self.prepare_test_dir('does-not-exist')
     write_string_to_file('not an XML',
-                         os.path.join(test_dir, 'VENDOR/manifest.xml'))
+                         os.path.join(test_dir, 'VENDOR/etc/vintf/manifest.xml'))
     # Should raise an error because a file has invalid format.
     self.assertRaises(common.ExternalError, CheckVintf, test_dir)
diff --git a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 74%
rename from tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index ed46b6b..a92dd6e 100644
--- a/tools/releasetools/testdata/vintf/kernel/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/kernel/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
     <kernel version="4.14.1" />
     <sepolicy>
         <sepolicy-version>0.0</sepolicy-version>
diff --git a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 71%
rename from tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index 5d891fa..1700e21 100644
--- a/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/matrix_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
     <sepolicy>
         <sepolicy-version>1.0</sepolicy-version>
         <kernel-sepolicy-version>0</kernel-sepolicy-version>
diff --git a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 85%
rename from tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index 19a9b6a..22272fd 100644
--- a/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/sku_compat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
     <hal format="hidl" optional="false">
         <name>foo</name>
         <version>1.0</version>
diff --git a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
similarity index 85%
rename from tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml
rename to tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
index e0e0d6c..1a3fc43 100644
--- a/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/compatibility_matrix.xml
+++ b/tools/releasetools/testdata/vintf/sku_incompat/SYSTEM/etc/vintf/compatibility_matrix.1.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework">
+<compatibility-matrix version="1.0" level="1" type="framework">
     <hal format="hidl" optional="false">
         <name>foo</name>
         <version>1.1</version>