Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Nikita Ioffe | e50da56 | 2019-04-01 17:22:39 +0100 | [diff] [blame] | 15 | // Build rules to build shim apexes. |
| 16 | |
| 17 | genrule { |
| 18 | name: "com.android.apex.cts.shim.pem", |
| 19 | out: ["com.android.apex.cts.shim.pem"], |
| 20 | cmd: "openssl genrsa -out $(out) 4096", |
| 21 | } |
| 22 | |
| 23 | genrule { |
| 24 | name: "com.android.apex.cts.shim.pubkey", |
| 25 | srcs: [":com.android.apex.cts.shim.pem"], |
| 26 | out: ["com.android.apex.cts.shim.pubkey"], |
| 27 | tools: ["avbtool"], |
| 28 | cmd: "$(location avbtool) extract_public_key --key $(in) --output $(out)", |
| 29 | } |
Nikita Ioffe | d9a25d4 | 2019-03-26 01:37:03 +0000 | [diff] [blame] | 30 | |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 31 | apex_key { |
| 32 | name: "com.android.apex.cts.shim.key", |
Nikita Ioffe | e50da56 | 2019-04-01 17:22:39 +0100 | [diff] [blame] | 33 | private_key: ":com.android.apex.cts.shim.pem", |
| 34 | public_key: ":com.android.apex.cts.shim.pubkey", |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 35 | installable: false, |
| 36 | } |
| 37 | |
| 38 | genrule { |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 39 | name: "generate_hash_of_dev_null", |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 40 | out: ["hash.txt"], |
| 41 | cmd: "sha512sum -b /dev/null | cut -d' ' -f1 | tee $(out)", |
| 42 | } |
| 43 | |
| 44 | prebuilt_etc { |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 45 | name: "hash_of_dev_null", |
| 46 | src: ":generate_hash_of_dev_null", |
Nikita Ioffe | d9a25d4 | 2019-03-26 01:37:03 +0000 | [diff] [blame] | 47 | filename: "hash.txt", |
| 48 | installable: false, |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | apex { |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 52 | name: "com.android.apex.cts.shim.v3", |
| 53 | manifest: "manifest_v3.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 54 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 55 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 56 | key: "com.android.apex.cts.shim.key", |
| 57 | prebuilts: ["hash_of_dev_null"], |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 58 | apps: ["CtsShim", "CtsShimPriv"], |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 59 | installable: false, |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 60 | allowed_files: "default_shim_allowed_list.txt", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | apex { |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 64 | name: "com.android.apex.cts.shim.v2", |
| 65 | manifest: "manifest_v2.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 66 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 67 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 68 | key: "com.android.apex.cts.shim.key", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 69 | prebuilts: ["hash_of_dev_null"], |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 70 | apps: ["CtsShim", "CtsShimPriv"], |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 71 | installable: false, |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 72 | allowed_files: "default_shim_allowed_list.txt", |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 73 | } |
| 74 | |
Nikita Ioffe | 3c586ea | 2020-01-02 23:03:27 +0000 | [diff] [blame] | 75 | apex { |
Mohammad Samiul Islam | 1103065 | 2020-05-04 15:16:04 +0100 | [diff] [blame] | 76 | name: "com.android.apex.cts.shim.v2_without_apk_in_apex", |
| 77 | manifest: "manifest_v2.json", |
| 78 | androidManifest: "AndroidManifest.xml", |
| 79 | file_contexts: ":apex.test-file_contexts", |
| 80 | key: "com.android.apex.cts.shim.key", |
| 81 | prebuilts: ["hash_of_dev_null"], |
| 82 | installable: false, |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 83 | allowed_files: "default_shim_allowed_list.txt", |
Mohammad Samiul Islam | 1103065 | 2020-05-04 15:16:04 +0100 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | apex { |
Nikita Ioffe | 3c586ea | 2020-01-02 23:03:27 +0000 | [diff] [blame] | 87 | name: "com.android.apex.cts.shim.v2_no_hashtree", |
| 88 | manifest: "manifest_v2.json", |
| 89 | androidManifest: "AndroidManifest.xml", |
| 90 | file_contexts: ":apex.test-file_contexts", |
| 91 | key: "com.android.apex.cts.shim.key", |
| 92 | prebuilts: ["hash_of_dev_null"], |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 93 | apps: ["CtsShim", "CtsShimPriv"], |
Nikita Ioffe | 3c586ea | 2020-01-02 23:03:27 +0000 | [diff] [blame] | 94 | installable: false, |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 95 | allowed_files: "default_shim_allowed_list.txt", |
Nikita Ioffe | 3c586ea | 2020-01-02 23:03:27 +0000 | [diff] [blame] | 96 | test_only_no_hashtree: true, |
| 97 | } |
| 98 | |
Dario Freni | 1cb5d2a | 2020-04-27 18:35:23 +0100 | [diff] [blame] | 99 | apex { |
| 100 | name: "com.android.apex.cts.shim.v2_unsigned_payload", |
| 101 | manifest: "manifest_v2.json", |
| 102 | androidManifest: "AndroidManifest.xml", |
| 103 | file_contexts: ":apex.test-file_contexts", |
| 104 | key: "com.android.apex.cts.shim.key", |
| 105 | prebuilts: ["hash_of_dev_null"], |
| 106 | apps: ["CtsShim", "CtsShimPriv"], |
| 107 | installable: false, |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 108 | allowed_files: "default_shim_allowed_list.txt", |
Dario Freni | 1cb5d2a | 2020-04-27 18:35:23 +0100 | [diff] [blame] | 109 | test_only_unsigned_payload: true, |
| 110 | } |
| 111 | |
Ivan Chiang | bb81242 | 2020-04-20 18:36:44 +0800 | [diff] [blame] | 112 | override_apex { |
| 113 | name: "com.android.apex.cts.shim.v2_different_package_name", |
| 114 | package_name: "com.android.apex.cts.shim.different", |
| 115 | base: "com.android.apex.cts.shim.v2", |
| 116 | } |
| 117 | |
Nikita Ioffe | df07441 | 2019-03-20 07:56:52 +0000 | [diff] [blame] | 118 | genrule { |
Nikita Ioffe | d9a25d4 | 2019-03-26 01:37:03 +0000 | [diff] [blame] | 119 | name: "generate_empty_hash", |
| 120 | out: ["hash.txt"], |
| 121 | cmd: "touch $(out)", |
| 122 | } |
| 123 | |
| 124 | prebuilt_etc { |
| 125 | name: "empty_hash", |
| 126 | src: ":generate_empty_hash", |
| 127 | filename: "hash.txt", |
| 128 | installable: false, |
| 129 | } |
| 130 | |
| 131 | // Use empty hash.txt to make sure that this apex has wrong SHA512, hence trying |
| 132 | // to stage it should fail. |
| 133 | apex { |
| 134 | name: "com.android.apex.cts.shim.v2_wrong_sha", |
| 135 | manifest: "manifest_v2.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 136 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 137 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | d9a25d4 | 2019-03-26 01:37:03 +0000 | [diff] [blame] | 138 | key: "com.android.apex.cts.shim.key", |
| 139 | prebuilts: ["empty_hash"], |
| 140 | installable: false, |
| 141 | } |
| 142 | |
Nikita Ioffe | 2cbca0e | 2019-03-27 19:12:11 +0000 | [diff] [blame] | 143 | prebuilt_etc { |
| 144 | name: "apex_shim_additional_file", |
| 145 | src: "additional_file", |
| 146 | filename: "additional_file", |
| 147 | installable: false, |
| 148 | } |
| 149 | |
| 150 | apex { |
| 151 | name: "com.android.apex.cts.shim.v2_additional_file", |
| 152 | manifest: "manifest_v2.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 153 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 154 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | 2cbca0e | 2019-03-27 19:12:11 +0000 | [diff] [blame] | 155 | key: "com.android.apex.cts.shim.key", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 156 | prebuilts: ["hash_of_dev_null", "apex_shim_additional_file"], |
Nikita Ioffe | 2cbca0e | 2019-03-27 19:12:11 +0000 | [diff] [blame] | 157 | installable: false, |
| 158 | } |
| 159 | |
| 160 | prebuilt_etc { |
| 161 | name: "apex_shim_additional_folder", |
| 162 | src: "additional_file", |
| 163 | filename: "additional_file", |
| 164 | sub_dir: "additional_folder", |
| 165 | installable: false, |
| 166 | } |
| 167 | |
| 168 | apex { |
| 169 | name: "com.android.apex.cts.shim.v2_additional_folder", |
| 170 | manifest: "manifest_v2.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 171 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 172 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | 2cbca0e | 2019-03-27 19:12:11 +0000 | [diff] [blame] | 173 | key: "com.android.apex.cts.shim.key", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 174 | prebuilts: ["hash_of_dev_null", "apex_shim_additional_folder"], |
Nikita Ioffe | 2cbca0e | 2019-03-27 19:12:11 +0000 | [diff] [blame] | 175 | installable: false, |
| 176 | } |
| 177 | |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 178 | apex { |
| 179 | name: "com.android.apex.cts.shim.v2_with_pre_install_hook", |
| 180 | manifest: "manifest_v2_with_pre_install_hook.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 181 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 182 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 183 | key: "com.android.apex.cts.shim.key", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 184 | prebuilts: ["hash_of_dev_null"], |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 185 | installable: false, |
| 186 | } |
| 187 | |
| 188 | apex { |
| 189 | name: "com.android.apex.cts.shim.v2_with_post_install_hook", |
| 190 | manifest: "manifest_v2_with_post_install_hook.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 191 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 192 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 193 | key: "com.android.apex.cts.shim.key", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 194 | prebuilts: ["hash_of_dev_null"], |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 195 | installable: false, |
| 196 | } |
| 197 | |
| 198 | genrule { |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 199 | name: "generate_hash_v1", |
| 200 | srcs: [ |
| 201 | ":com.android.apex.cts.shim.v2", |
Mohammad Samiul Islam | 1103065 | 2020-05-04 15:16:04 +0100 | [diff] [blame] | 202 | ":com.android.apex.cts.shim.v2_without_apk_in_apex", |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 203 | ":com.android.apex.cts.shim.v2_additional_file", |
| 204 | ":com.android.apex.cts.shim.v2_additional_folder", |
Mohammad Samiul Islam | ef118be | 2019-07-26 13:23:33 +0100 | [diff] [blame] | 205 | ":com.android.apex.cts.shim.v2_different_certificate", |
Ivan Chiang | bb81242 | 2020-04-20 18:36:44 +0800 | [diff] [blame] | 206 | ":com.android.apex.cts.shim.v2_different_package_name", |
Nikita Ioffe | 3c586ea | 2020-01-02 23:03:27 +0000 | [diff] [blame] | 207 | ":com.android.apex.cts.shim.v2_no_hashtree", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 208 | ":com.android.apex.cts.shim.v2_signed_bob", |
| 209 | ":com.android.apex.cts.shim.v2_signed_bob_rot", |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 210 | ":com.android.apex.cts.shim.v2_signed_bob_rot_rollback", |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 211 | ":com.android.apex.cts.shim.v2_with_pre_install_hook", |
| 212 | ":com.android.apex.cts.shim.v2_with_post_install_hook", |
Mohammad Samiul Islam | ed9eb7d | 2020-03-20 21:29:04 +0000 | [diff] [blame] | 213 | ":com.android.apex.cts.shim.v2_sdk_target_p", |
Mohammad Samiul Islam | 69b3dc1 | 2020-03-21 23:13:45 +0000 | [diff] [blame] | 214 | ":com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p", |
Nikita Ioffe | cdc88ff | 2019-04-23 11:22:38 +0100 | [diff] [blame] | 215 | ":com.android.apex.cts.shim.v3", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 216 | ":com.android.apex.cts.shim.v3_signed_bob", |
| 217 | ":com.android.apex.cts.shim.v3_signed_bob_rot", |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 218 | ], |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 219 | out: ["hash.txt"], |
| 220 | cmd: "sha512sum -b $(in) | cut -d' ' -f1 | tee $(out)", |
| 221 | } |
| 222 | |
| 223 | prebuilt_etc { |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 224 | name: "hash_v1", |
| 225 | src: ":generate_hash_v1", |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 226 | filename: "hash.txt", |
| 227 | installable: false, |
| 228 | } |
| 229 | |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 230 | apex { |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 231 | name: "com.android.apex.cts.shim.v1", |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 232 | manifest: "manifest.json", |
Jiyong Park | fce48c9 | 2019-06-07 14:58:41 +0900 | [diff] [blame] | 233 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 234 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 235 | key: "com.android.apex.cts.shim.key", |
Nikita Ioffe | 98054d7 | 2019-04-03 14:18:22 +0100 | [diff] [blame] | 236 | prebuilts: ["hash_v1"], |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 237 | apps: ["CtsShim", "CtsShimPriv"], |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 238 | allowed_files: "default_shim_allowed_list.txt", |
Nikita Ioffe | 69a1bc5 | 2019-03-29 14:55:29 +0000 | [diff] [blame] | 239 | } |
Nikita Ioffe | 7f73bd1 | 2019-04-23 20:51:46 +0100 | [diff] [blame] | 240 | |
Jooyung Han | 330e0c8 | 2020-06-19 19:56:41 +0900 | [diff] [blame] | 241 | // This is to install the flattened version of com.android.apex.cts.shim. |
| 242 | // Because com.android.apex.cts.shim is provided as prebuilt and the build system |
| 243 | // doesn't support install "flattened" version from "prebult" yet, GSI, which should |
| 244 | // have both "flatttened" and "unflattened" APEXes, is missing the flattened version |
| 245 | // of com.android.apex.cts.shim. |
| 246 | // TODO(b/159426728): When the build system can install "flattened" from "prebuilts", |
| 247 | // this can be removed. |
| 248 | override_apex { |
| 249 | name: "com.android.apex.cts.shim.v1_with_prebuilts", |
| 250 | base: "com.android.apex.cts.shim.v1", |
| 251 | apps: ["CtsShimPrebuilt", "CtsShimPrivPrebuilt"], |
| 252 | allowed_files: "prebuilts_shim_allowed_list.txt", |
| 253 | } |
| 254 | |
Nikita Ioffe | 7f73bd1 | 2019-04-23 20:51:46 +0100 | [diff] [blame] | 255 | genrule { |
| 256 | name: "com.android.apex.cts.shim_not_pre_installed.pem", |
| 257 | out: ["com.android.apex.cts.shim_not_pre_installed.pem"], |
| 258 | cmd: "openssl genrsa -out $(out) 4096", |
| 259 | } |
| 260 | |
| 261 | genrule { |
| 262 | name: "com.android.apex.cts.shim_not_pre_installed.pubkey", |
| 263 | srcs: [":com.android.apex.cts.shim_not_pre_installed.pem"], |
| 264 | out: ["com.android.apex.cts.shim_not_pre_installed.pubkey"], |
| 265 | tools: ["avbtool"], |
| 266 | cmd: "$(location avbtool) extract_public_key --key $(in) --output $(out)", |
| 267 | } |
| 268 | |
| 269 | apex_key { |
| 270 | name: "com.android.apex.cts.shim_not_pre_installed.key", |
| 271 | private_key: ":com.android.apex.cts.shim_not_pre_installed.pem", |
| 272 | public_key: ":com.android.apex.cts.shim_not_pre_installed.pubkey", |
| 273 | installable: false, |
| 274 | } |
| 275 | |
| 276 | apex { |
| 277 | name: "com.android.apex.cts.shim_not_pre_installed", |
| 278 | manifest: "manifest_not_pre_installed.json", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 279 | file_contexts: ":apex.test-file_contexts", |
Nikita Ioffe | 7f73bd1 | 2019-04-23 20:51:46 +0100 | [diff] [blame] | 280 | key: "com.android.apex.cts.shim_not_pre_installed.key", |
| 281 | prebuilts: ["hash_of_dev_null"], |
| 282 | installable: false, |
| 283 | } |
Mohammad Samiul Islam | ef118be | 2019-07-26 13:23:33 +0100 | [diff] [blame] | 284 | |
| 285 | apex { |
| 286 | name: "com.android.apex.cts.shim.v2_different_certificate", |
| 287 | manifest: "manifest_v2.json", |
| 288 | androidManifest: "AndroidManifest.xml", |
Jooyung Han | 8f1b3fa | 2019-11-20 17:53:54 +0900 | [diff] [blame] | 289 | file_contexts: ":apex.test-file_contexts", |
Mohammad Samiul Islam | ef118be | 2019-07-26 13:23:33 +0100 | [diff] [blame] | 290 | key: "com.android.apex.cts.shim.key", |
| 291 | prebuilts: ["hash_of_dev_null"], |
| 292 | installable: false, |
| 293 | certificate: ":com.android.apex.cts.shim.debug.cert", |
| 294 | } |
| 295 | |
| 296 | android_app_certificate { |
| 297 | name: "com.android.apex.cts.shim.debug.cert", |
| 298 | certificate: "com.android.apex.cts.shim.debug.cert", |
| 299 | } |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 300 | |
| 301 | // Build rules to build shim apex with rotated keys |
| 302 | |
| 303 | // We name the original key used to sign cts.shim.v1 package as alice. |
| 304 | // We then create a second key called bob. The second key bob is used to rotate the |
| 305 | // original key alice. |
| 306 | |
| 307 | // Create private key bob in pem format |
| 308 | genrule { |
| 309 | name: "com.android.apex.rotation.key.bob.pem", |
| 310 | out: ["bob.pem"], |
| 311 | cmd: "openssl req -x509 -newkey rsa:4096 -nodes -days 999999 -subj '/DN=/EMAILADDRESS=android@android.com/CN=Android/OU=Android/O=Android/L=Mountain View/ST=California/C=US' -keyout $(out)", |
| 312 | } |
| 313 | |
| 314 | // Converts bob's private key to pk8 format |
| 315 | genrule { |
| 316 | name: "com.android.apex.rotation.key.bob.pk8", |
| 317 | srcs: [":com.android.apex.rotation.key.bob.pem"], |
| 318 | out: ["bob.pk8"], |
| 319 | cmd: "openssl pkcs8 -topk8 -inform PEM -outform DER -in $(in) -out $(out) -nocrypt", |
| 320 | } |
| 321 | |
| 322 | // Extract bob's public key from its private key |
| 323 | genrule { |
| 324 | name: "com.android.apex.rotation.key.bob.x509.pem", |
| 325 | srcs: [":com.android.apex.rotation.key.bob.pem"], |
| 326 | out: ["bob.x509.pem"], |
| 327 | cmd: "openssl req -x509 -key $(in) -newkey rsa:4096 -nodes -days 999999 -subj '/DN=/EMAILADDRESS=android@android.com/CN=Android/OU=Android/O=Android/L=Mountain View/ST=California/C=US' -out $(out)", |
| 328 | } |
| 329 | |
| 330 | // Create lineage file for rotating alice to bob |
| 331 | genrule { |
| 332 | name: "com.android.apex.rotation.key.bob.rot", |
| 333 | srcs: [ |
| 334 | "alice.pk8", |
| 335 | "alice.x509.pem", |
| 336 | ":com.android.apex.rotation.key.bob.pk8", |
| 337 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 338 | ], |
| 339 | out: ["bob.rot"], |
| 340 | tools: [":apksigner"], |
| 341 | cmd: "$(location :apksigner) rotate --out $(out) --old-signer --key $(location alice.pk8) --cert $(location alice.x509.pem) --new-signer --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem)", |
| 342 | } |
| 343 | |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 344 | // Create lineage file for rotating alice to bob with rollback capability |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 345 | genrule { |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 346 | name: "com.android.apex.rotation.key.bob.rot.rollback", |
| 347 | srcs: [ |
| 348 | "alice.pk8", |
| 349 | "alice.x509.pem", |
| 350 | ":com.android.apex.rotation.key.bob.pk8", |
| 351 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 352 | ], |
| 353 | out: ["bob.rot"], |
| 354 | tools: [":apksigner"], |
| 355 | cmd: "$(location :apksigner) rotate --out $(out) --old-signer --key $(location alice.pk8) --cert $(location alice.x509.pem) --set-rollback true --new-signer --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem)", |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 356 | } |
| 357 | |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 358 | // v2 cts shim package signed by bob, without lineage |
| 359 | genrule { |
| 360 | name: "com.android.apex.cts.shim.v2_signed_bob", |
| 361 | out: ["com.android.apex.cts.shim.v2_signed_bob"], |
| 362 | tools: [":apksigner"], |
| 363 | srcs: [ |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 364 | ":com.android.apex.cts.shim.v2", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 365 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 366 | ":com.android.apex.rotation.key.bob.pk8", |
| 367 | ], |
Mohammad Samiul Islam | 399d1ce | 2019-08-09 14:43:28 +0100 | [diff] [blame] | 368 | dist: { |
| 369 | targets: ["com.android.apex.cts.shim.v2_signed_bob"], |
| 370 | dest: "com.android.apex.cts.shim.v2_signed_bob.apex", |
| 371 | }, |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 372 | cmd: "$(location :apksigner) sign --v1-signing-enabled false --v2-signing-enabled false --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem) --out $(out) $(location :com.android.apex.cts.shim.v2)", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | // v2 cts shim package signed by bob + lineage |
| 376 | genrule { |
| 377 | name: "com.android.apex.cts.shim.v2_signed_bob_rot", |
| 378 | out: ["com.android.apex.cts.shim.v2_signed_bob_rot"], |
| 379 | tools: [":apksigner"], |
| 380 | srcs: [ |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 381 | ":com.android.apex.cts.shim.v2", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 382 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 383 | ":com.android.apex.rotation.key.bob.pk8", |
| 384 | ":com.android.apex.rotation.key.bob.rot", |
| 385 | ], |
Mohammad Samiul Islam | 399d1ce | 2019-08-09 14:43:28 +0100 | [diff] [blame] | 386 | dist: { |
| 387 | targets: ["com.android.apex.cts.shim.v2_signed_bob_rot"], |
| 388 | dest: "com.android.apex.cts.shim.v2_signed_bob_rot.apex", |
| 389 | }, |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 390 | cmd: "$(location :apksigner) sign --v1-signing-enabled false --v2-signing-enabled false --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem) --lineage $(location :com.android.apex.rotation.key.bob.rot) --out $(out) $(location :com.android.apex.cts.shim.v2)", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 391 | } |
| 392 | |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 393 | // v2 cts shim package signed by bob + lineage + rollback capability |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 394 | genrule { |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 395 | name: "com.android.apex.cts.shim.v2_signed_bob_rot_rollback", |
| 396 | out: ["com.android.apex.cts.shim.v2_signed_bob_rot_rollback"], |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 397 | tools: [":apksigner"], |
| 398 | srcs: [ |
| 399 | ":com.android.apex.cts.shim.v2", |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 400 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 401 | ":com.android.apex.rotation.key.bob.pk8", |
| 402 | ":com.android.apex.rotation.key.bob.rot.rollback", |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 403 | ], |
| 404 | dist: { |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 405 | targets: ["com.android.apex.cts.shim.v2_signed_bob_rot_rollback"], |
| 406 | dest: "com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex", |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 407 | }, |
Mohammad Samiul Islam | 5e66ad7 | 2019-11-11 17:35:26 +0000 | [diff] [blame] | 408 | cmd: "$(location :apksigner) sign --v1-signing-enabled false --v2-signing-enabled false --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem) --lineage $(location :com.android.apex.rotation.key.bob.rot.rollback) --out $(out) $(location :com.android.apex.cts.shim.v2)", |
Mohammad Samiul Islam | 5ce257c | 2019-08-22 15:29:49 +0100 | [diff] [blame] | 409 | } |
| 410 | |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 411 | // v3 cts shim package signed by bob |
| 412 | genrule { |
| 413 | name: "com.android.apex.cts.shim.v3_signed_bob", |
| 414 | out: ["com.android.apex.cts.shim.v3_signed_bob"], |
| 415 | tools: [":apksigner"], |
| 416 | srcs: [ |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 417 | ":com.android.apex.cts.shim.v3", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 418 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 419 | ":com.android.apex.rotation.key.bob.pk8", |
| 420 | ], |
Mohammad Samiul Islam | 399d1ce | 2019-08-09 14:43:28 +0100 | [diff] [blame] | 421 | dist: { |
| 422 | targets: ["com.android.apex.cts.shim.v3_signed_bob"], |
| 423 | dest: "com.android.apex.cts.shim.v3_signed_bob.apex", |
| 424 | }, |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 425 | cmd: "$(location :apksigner) sign --v1-signing-enabled false --v2-signing-enabled false --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem) --out $(out) $(location :com.android.apex.cts.shim.v3)", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | // v3 cts shim package signed by bob + lineage |
| 429 | genrule { |
| 430 | name: "com.android.apex.cts.shim.v3_signed_bob_rot", |
| 431 | out: ["com.android.apex.cts.shim.v3_signed_bob_rot"], |
| 432 | tools: [":apksigner"], |
| 433 | srcs: [ |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 434 | ":com.android.apex.cts.shim.v3", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 435 | ":com.android.apex.rotation.key.bob.x509.pem", |
| 436 | ":com.android.apex.rotation.key.bob.pk8", |
| 437 | ":com.android.apex.rotation.key.bob.rot", |
| 438 | ], |
Mohammad Samiul Islam | 399d1ce | 2019-08-09 14:43:28 +0100 | [diff] [blame] | 439 | dist: { |
| 440 | targets: ["com.android.apex.cts.shim.v3_signed_bob_rot"], |
| 441 | dest: "com.android.apex.cts.shim.v3_signed_bob_rot.apex", |
| 442 | }, |
Mohammad Samiul Islam | bbbf8e5 | 2019-08-12 15:52:15 +0100 | [diff] [blame] | 443 | cmd: "$(location :apksigner) sign --v1-signing-enabled false --v2-signing-enabled false --key $(location :com.android.apex.rotation.key.bob.pk8) --cert $(location :com.android.apex.rotation.key.bob.x509.pem) --lineage $(location :com.android.apex.rotation.key.bob.rot) --out $(out) $(location :com.android.apex.cts.shim.v3)", |
Mohammad Samiul Islam | 7fcf8e4 | 2019-08-01 15:54:16 +0100 | [diff] [blame] | 444 | } |
Jooyung Han | a7983c0 | 2020-02-14 07:13:44 +0900 | [diff] [blame] | 445 | |
| 446 | // This one is only used in ApexdHostTest and not meant to be installed |
Colin Cross | 1726687 | 2020-06-11 11:06:14 -0700 | [diff] [blame] | 447 | // and hence shouldn't be allowed in hash.txt of v1 shim APEX. |
Jooyung Han | a7983c0 | 2020-02-14 07:13:44 +0900 | [diff] [blame] | 448 | apex { |
| 449 | name: "com.android.apex.cts.shim.v2_legacy", |
| 450 | manifest: "manifest_v2.json", |
| 451 | androidManifest: "AndroidManifest.xml", |
| 452 | file_contexts: ":apex.test-file_contexts", |
| 453 | key: "com.android.apex.cts.shim.key", |
| 454 | prebuilts: ["hash_of_dev_null"], |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 455 | apps: ["CtsShim", "CtsShimPriv"], |
Jooyung Han | a7983c0 | 2020-02-14 07:13:44 +0900 | [diff] [blame] | 456 | installable: false, |
Jooyung Han | 329d487 | 2020-03-12 18:43:01 +0900 | [diff] [blame] | 457 | min_sdk_version: "29", |
Jooyung Han | a7983c0 | 2020-02-14 07:13:44 +0900 | [diff] [blame] | 458 | } |
| 459 | |
| 460 | genrule { |
| 461 | name: "com.android.apex.cts.shim.v2_no_pb", |
| 462 | srcs: [":com.android.apex.cts.shim.v2_legacy"], |
| 463 | out: ["com.android.apex.cts.shim.v2_no_pb.apex"], |
| 464 | tools: ["zip2zip"], |
| 465 | cmd: "$(location zip2zip) -i $(in) -x apex_manifest.pb -o $(out)", |
Mohammad Samiul Islam | ed9eb7d | 2020-03-20 21:29:04 +0000 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | // Apex shim that targets an old sdk (P) |
| 469 | apex { |
| 470 | name: "com.android.apex.cts.shim.v2_sdk_target_p", |
| 471 | manifest: "manifest_v2.json", |
| 472 | androidManifest: "AndroidManifestSdkTargetP.xml", |
| 473 | file_contexts: ":apex.test-file_contexts", |
| 474 | key: "com.android.apex.cts.shim.key", |
| 475 | prebuilts: ["hash_of_dev_null"], |
| 476 | installable: false, |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 477 | apps: ["CtsShim", "CtsShimPriv"], |
Mohammad Samiul Islam | ed9eb7d | 2020-03-20 21:29:04 +0000 | [diff] [blame] | 478 | } |
Mohammad Samiul Islam | 69b3dc1 | 2020-03-21 23:13:45 +0000 | [diff] [blame] | 479 | |
| 480 | // Apex shim with apk-in-apex that targets sdk P |
| 481 | apex { |
| 482 | name: "com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p", |
| 483 | manifest: "manifest_v2.json", |
| 484 | androidManifest: "AndroidManifest.xml", |
| 485 | file_contexts: ":apex.test-file_contexts", |
| 486 | key: "com.android.apex.cts.shim.key", |
| 487 | prebuilts: ["hash_of_dev_null"], |
Dario Freni | 0dab4f3 | 2020-04-20 16:44:36 +0100 | [diff] [blame] | 488 | apps: ["CtsShimTargetPSdk"], |
Mohammad Samiul Islam | 69b3dc1 | 2020-03-21 23:13:45 +0000 | [diff] [blame] | 489 | installable: false, |
| 490 | } |
Dario Freni | 13e703a | 2020-04-27 11:08:21 +0100 | [diff] [blame] | 491 | |
| 492 | // Apex shim with unsigned apk |
| 493 | genrule { |
| 494 | name: "com.android.apex.cts.shim.v2_unsigned_apk_container", |
| 495 | srcs: [":com.android.apex.cts.shim.v2"], |
| 496 | out: ["com.android.apex.cts.shim.v2_unsigned_apk_container.apex"], |
| 497 | cmd: "cp -v $(in) $(out) && zip -d $(out) META-INF*", |
| 498 | dist: { |
| 499 | targets: ["apps_only"], |
| 500 | } |
| 501 | } |