Add 31.0 mapping files

Steps taken to produce the mapping files:

1. Add prebuilts/api/31.0/plat_pub_versioned.cil from the
/vendor/etc/selinux/plat_pub_versioned.cil file built on sc-dev with
lunch target aosp_arm64-eng. Add prebuilts/api/31.0/vendor_sepolicy.cil
as an empty file.

2. Add new file private/compat/31.0/31.0.cil by doing the following:
- copy /system/etc/selinux/mapping/31.0.cil from sc-dev aosp_arm64-eng
device to private/compat/31.0/31.0.cil
- remove all attribute declaration statement (typeattribute ...) and
sort lines alphabetically
- some selinux types were added/renamed/deleted w.r.t 31 sepolicy.
Find all such types using treble_sepolicy_tests_31.0 test.
- for all these types figure out where to map them by looking at
30.0.[ignore.]cil files and add approprite entries to 31.0.[ignore.]cil.

This change also enables treble_sepolicy_tests_31.0 and installs
31.0.cil mapping file onto the device.

Bug: 189161483
Test: m treble_sepolicy_tests_31.0
Test: m 31.0_compat_test
Test: m selinux_policy
Change-Id: I6264b9cf77b80543dfea93157b45b864157e2b14
diff --git a/Android.bp b/Android.bp
index a43a689..4d4fb99 100644
--- a/Android.bp
+++ b/Android.bp
@@ -80,6 +80,13 @@
 }
 
 se_filegroup {
+    name: "31.0.board.compat.map",
+    srcs: [
+        "compat/31.0/31.0.cil",
+    ],
+}
+
+se_filegroup {
     name: "26.0.board.compat.cil",
     srcs: [
         "compat/26.0/26.0.compat.cil",
@@ -115,6 +122,13 @@
 }
 
 se_filegroup {
+    name: "31.0.board.compat.cil",
+    srcs: [
+        "compat/31.0/31.0.compat.cil",
+    ],
+}
+
+se_filegroup {
     name: "26.0.board.ignore.map",
     srcs: [
         "compat/26.0/26.0.ignore.cil",
@@ -149,6 +163,13 @@
     ],
 }
 
+se_filegroup {
+    name: "31.0.board.ignore.map",
+    srcs: [
+        "compat/31.0/31.0.ignore.cil",
+    ],
+}
+
 se_cil_compat_map {
     name: "plat_26.0.cil",
     stem: "26.0.cil",
@@ -181,7 +202,14 @@
     name: "plat_30.0.cil",
     stem: "30.0.cil",
     bottom_half: [":30.0.board.compat.map"],
-    // top_half: "plat_31.0.cil",
+    top_half: "plat_31.0.cil",
+}
+
+se_cil_compat_map {
+    name: "plat_31.0.cil",
+    stem: "31.0.cil",
+    bottom_half: [":31.0.board.compat.map"],
+    // top_half: "plat_32.0.cil",
 }
 
 se_cil_compat_map {
@@ -220,7 +248,15 @@
     name: "system_ext_30.0.cil",
     stem: "30.0.cil",
     bottom_half: [":30.0.board.compat.map"],
-    // top_half: "system_ext_31.0.cil",
+    top_half: "system_ext_31.0.cil",
+    system_ext_specific: true,
+}
+
+se_cil_compat_map {
+    name: "system_ext_31.0.cil",
+    stem: "31.0.cil",
+    bottom_half: [":31.0.board.compat.map"],
+    // top_half: "system_ext_32.0.cil",
     system_ext_specific: true,
 }
 
@@ -260,7 +296,15 @@
     name: "product_30.0.cil",
     stem: "30.0.cil",
     bottom_half: [":30.0.board.compat.map"],
-    // top_half: "product_31.0.cil",
+    top_half: "product_31.0.cil",
+    product_specific: true,
+}
+
+se_cil_compat_map {
+    name: "product_31.0.cil",
+    stem: "31.0.cil",
+    bottom_half: [":31.0.board.compat.map"],
+    // top_half: "product_32.0.cil",
     product_specific: true,
 }
 
@@ -291,20 +335,40 @@
 se_cil_compat_map {
     name: "30.0.ignore.cil",
     bottom_half: [":30.0.board.ignore.map"],
-    // top_half: "31.0.ignore.cil",
+    top_half: "31.0.ignore.cil",
+}
+
+se_cil_compat_map {
+    name: "31.0.ignore.cil",
+    bottom_half: [":31.0.board.ignore.map"],
+    // top_half: "32.0.ignore.cil",
 }
 
 se_cil_compat_map {
     name: "system_ext_30.0.ignore.cil",
     bottom_half: [":30.0.board.ignore.map"],
-    // top_half: "system_ext_31.0.ignore.cil",
+    top_half: "system_ext_31.0.ignore.cil",
+    system_ext_specific: true,
+}
+
+se_cil_compat_map {
+    name: "system_ext_31.0.ignore.cil",
+    bottom_half: [":31.0.board.ignore.map"],
+    // top_half: "system_ext_32.0.ignore.cil",
     system_ext_specific: true,
 }
 
 se_cil_compat_map {
     name: "product_30.0.ignore.cil",
     bottom_half: [":30.0.board.ignore.map"],
-    // top_half: "product_31.0.ignore.cil",
+    top_half: "product_31.0.ignore.cil",
+    product_specific: true,
+}
+
+se_cil_compat_map {
+    name: "product_31.0.ignore.cil",
+    bottom_half: [":31.0.board.ignore.map"],
+    // top_half: "product_32.0.ignore.cil",
     product_specific: true,
 }
 
@@ -334,6 +398,11 @@
 }
 
 se_compat_cil {
+    name: "31.0.compat.cil",
+    srcs: [":31.0.board.compat.cil"],
+}
+
+se_compat_cil {
     name: "system_ext_26.0.compat.cil",
     srcs: [":26.0.board.compat.cil"],
     stem: "26.0.compat.cil",
@@ -368,6 +437,13 @@
     system_ext_specific: true,
 }
 
+se_compat_cil {
+    name: "system_ext_31.0.compat.cil",
+    srcs: [":31.0.board.compat.cil"],
+    stem: "31.0.compat.cil",
+    system_ext_specific: true,
+}
+
 se_filegroup {
     name: "file_contexts_files",
     srcs: ["file_contexts"],