blob: 2667984b7b0e70ec4dfe15fa0a1ebaa6121977ef [file] [log] [blame]
Nikita Ioffedf074412019-03-20 07:56:52 +00001// 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 Ioffee50da562019-04-01 17:22:39 +010015// Build rules to build shim apexes.
16
17genrule {
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
23genrule {
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 Ioffed9a25d42019-03-26 01:37:03 +000030
Nikita Ioffedf074412019-03-20 07:56:52 +000031apex_key {
32 name: "com.android.apex.cts.shim.key",
Nikita Ioffee50da562019-04-01 17:22:39 +010033 private_key: ":com.android.apex.cts.shim.pem",
34 public_key: ":com.android.apex.cts.shim.pubkey",
Nikita Ioffedf074412019-03-20 07:56:52 +000035 installable: false,
36}
37
38genrule {
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010039 name: "generate_hash_of_dev_null",
Nikita Ioffedf074412019-03-20 07:56:52 +000040 out: ["hash.txt"],
41 cmd: "sha512sum -b /dev/null | cut -d' ' -f1 | tee $(out)",
42}
43
44prebuilt_etc {
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010045 name: "hash_of_dev_null",
46 src: ":generate_hash_of_dev_null",
Nikita Ioffed9a25d42019-03-26 01:37:03 +000047 filename: "hash.txt",
48 installable: false,
Nikita Ioffedf074412019-03-20 07:56:52 +000049}
50
51apex {
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010052 name: "com.android.apex.cts.shim.v3",
53 manifest: "manifest_v3.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +090054 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +090055 file_contexts: ":apex.test-file_contexts",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010056 key: "com.android.apex.cts.shim.key",
57 prebuilts: ["hash_of_dev_null"],
Dario Freni0dab4f32020-04-20 16:44:36 +010058 apps: ["CtsShim", "CtsShimPriv"],
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010059 installable: false,
Colin Cross17266872020-06-11 11:06:14 -070060 allowed_files: "default_shim_allowed_list.txt",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010061}
62
63apex {
Nikita Ioffedf074412019-03-20 07:56:52 +000064 name: "com.android.apex.cts.shim.v2",
65 manifest: "manifest_v2.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +090066 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +090067 file_contexts: ":apex.test-file_contexts",
Nikita Ioffedf074412019-03-20 07:56:52 +000068 key: "com.android.apex.cts.shim.key",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +010069 prebuilts: ["hash_of_dev_null"],
Dario Freni0dab4f32020-04-20 16:44:36 +010070 apps: ["CtsShim", "CtsShimPriv"],
Nikita Ioffedf074412019-03-20 07:56:52 +000071 installable: false,
Colin Cross17266872020-06-11 11:06:14 -070072 allowed_files: "default_shim_allowed_list.txt",
Nikita Ioffedf074412019-03-20 07:56:52 +000073}
74
Nikita Ioffe3c586ea2020-01-02 23:03:27 +000075apex {
Mohammad Samiul Islam11030652020-05-04 15:16:04 +010076 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 Cross17266872020-06-11 11:06:14 -070083 allowed_files: "default_shim_allowed_list.txt",
Mohammad Samiul Islam11030652020-05-04 15:16:04 +010084}
85
86apex {
Nikita Ioffe3c586ea2020-01-02 23:03:27 +000087 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 Freni0dab4f32020-04-20 16:44:36 +010093 apps: ["CtsShim", "CtsShimPriv"],
Nikita Ioffe3c586ea2020-01-02 23:03:27 +000094 installable: false,
Colin Cross17266872020-06-11 11:06:14 -070095 allowed_files: "default_shim_allowed_list.txt",
Nikita Ioffe3c586ea2020-01-02 23:03:27 +000096 test_only_no_hashtree: true,
97}
98
Dario Freni1cb5d2a2020-04-27 18:35:23 +010099apex {
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 Cross17266872020-06-11 11:06:14 -0700108 allowed_files: "default_shim_allowed_list.txt",
Dario Freni1cb5d2a2020-04-27 18:35:23 +0100109 test_only_unsigned_payload: true,
110}
111
Ivan Chiangbb812422020-04-20 18:36:44 +0800112override_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 Ioffedf074412019-03-20 07:56:52 +0000118genrule {
Nikita Ioffed9a25d42019-03-26 01:37:03 +0000119 name: "generate_empty_hash",
120 out: ["hash.txt"],
121 cmd: "touch $(out)",
122}
123
124prebuilt_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.
133apex {
134 name: "com.android.apex.cts.shim.v2_wrong_sha",
135 manifest: "manifest_v2.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +0900136 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900137 file_contexts: ":apex.test-file_contexts",
Nikita Ioffed9a25d42019-03-26 01:37:03 +0000138 key: "com.android.apex.cts.shim.key",
139 prebuilts: ["empty_hash"],
140 installable: false,
141}
142
Nikita Ioffe2cbca0e2019-03-27 19:12:11 +0000143prebuilt_etc {
144 name: "apex_shim_additional_file",
145 src: "additional_file",
146 filename: "additional_file",
147 installable: false,
148}
149
150apex {
151 name: "com.android.apex.cts.shim.v2_additional_file",
152 manifest: "manifest_v2.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +0900153 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900154 file_contexts: ":apex.test-file_contexts",
Nikita Ioffe2cbca0e2019-03-27 19:12:11 +0000155 key: "com.android.apex.cts.shim.key",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +0100156 prebuilts: ["hash_of_dev_null", "apex_shim_additional_file"],
Nikita Ioffe2cbca0e2019-03-27 19:12:11 +0000157 installable: false,
158}
159
160prebuilt_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
168apex {
169 name: "com.android.apex.cts.shim.v2_additional_folder",
170 manifest: "manifest_v2.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +0900171 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900172 file_contexts: ":apex.test-file_contexts",
Nikita Ioffe2cbca0e2019-03-27 19:12:11 +0000173 key: "com.android.apex.cts.shim.key",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +0100174 prebuilts: ["hash_of_dev_null", "apex_shim_additional_folder"],
Nikita Ioffe2cbca0e2019-03-27 19:12:11 +0000175 installable: false,
176}
177
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000178apex {
179 name: "com.android.apex.cts.shim.v2_with_pre_install_hook",
180 manifest: "manifest_v2_with_pre_install_hook.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +0900181 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900182 file_contexts: ":apex.test-file_contexts",
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000183 key: "com.android.apex.cts.shim.key",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +0100184 prebuilts: ["hash_of_dev_null"],
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000185 installable: false,
186}
187
188apex {
189 name: "com.android.apex.cts.shim.v2_with_post_install_hook",
190 manifest: "manifest_v2_with_post_install_hook.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +0900191 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900192 file_contexts: ":apex.test-file_contexts",
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000193 key: "com.android.apex.cts.shim.key",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +0100194 prebuilts: ["hash_of_dev_null"],
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000195 installable: false,
196}
197
198genrule {
Nikita Ioffe98054d72019-04-03 14:18:22 +0100199 name: "generate_hash_v1",
200 srcs: [
201 ":com.android.apex.cts.shim.v2",
Mohammad Samiul Islam11030652020-05-04 15:16:04 +0100202 ":com.android.apex.cts.shim.v2_without_apk_in_apex",
Nikita Ioffe98054d72019-04-03 14:18:22 +0100203 ":com.android.apex.cts.shim.v2_additional_file",
204 ":com.android.apex.cts.shim.v2_additional_folder",
Mohammad Samiul Islamef118be2019-07-26 13:23:33 +0100205 ":com.android.apex.cts.shim.v2_different_certificate",
Ivan Chiangbb812422020-04-20 18:36:44 +0800206 ":com.android.apex.cts.shim.v2_different_package_name",
Nikita Ioffe3c586ea2020-01-02 23:03:27 +0000207 ":com.android.apex.cts.shim.v2_no_hashtree",
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100208 ":com.android.apex.cts.shim.v2_signed_bob",
209 ":com.android.apex.cts.shim.v2_signed_bob_rot",
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000210 ":com.android.apex.cts.shim.v2_signed_bob_rot_rollback",
Nikita Ioffe98054d72019-04-03 14:18:22 +0100211 ":com.android.apex.cts.shim.v2_with_pre_install_hook",
212 ":com.android.apex.cts.shim.v2_with_post_install_hook",
Mohammad Samiul Islamed9eb7d2020-03-20 21:29:04 +0000213 ":com.android.apex.cts.shim.v2_sdk_target_p",
Mohammad Samiul Islam69b3dc12020-03-21 23:13:45 +0000214 ":com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p",
Nikita Ioffecdc88ff2019-04-23 11:22:38 +0100215 ":com.android.apex.cts.shim.v3",
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100216 ":com.android.apex.cts.shim.v3_signed_bob",
217 ":com.android.apex.cts.shim.v3_signed_bob_rot",
Nikita Ioffe98054d72019-04-03 14:18:22 +0100218 ],
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000219 out: ["hash.txt"],
220 cmd: "sha512sum -b $(in) | cut -d' ' -f1 | tee $(out)",
221}
222
223prebuilt_etc {
Nikita Ioffe98054d72019-04-03 14:18:22 +0100224 name: "hash_v1",
225 src: ":generate_hash_v1",
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000226 filename: "hash.txt",
227 installable: false,
228}
229
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000230apex {
Nikita Ioffe98054d72019-04-03 14:18:22 +0100231 name: "com.android.apex.cts.shim.v1",
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000232 manifest: "manifest.json",
Jiyong Parkfce48c92019-06-07 14:58:41 +0900233 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900234 file_contexts: ":apex.test-file_contexts",
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000235 key: "com.android.apex.cts.shim.key",
Nikita Ioffe98054d72019-04-03 14:18:22 +0100236 prebuilts: ["hash_v1"],
Dario Freni0dab4f32020-04-20 16:44:36 +0100237 apps: ["CtsShim", "CtsShimPriv"],
Colin Cross17266872020-06-11 11:06:14 -0700238 allowed_files: "default_shim_allowed_list.txt",
Nikita Ioffe69a1bc52019-03-29 14:55:29 +0000239}
Nikita Ioffe7f73bd12019-04-23 20:51:46 +0100240
Jooyung Han330e0c82020-06-19 19:56:41 +0900241// 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.
248override_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 Ioffe7f73bd12019-04-23 20:51:46 +0100255genrule {
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
261genrule {
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
269apex_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
276apex {
277 name: "com.android.apex.cts.shim_not_pre_installed",
278 manifest: "manifest_not_pre_installed.json",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900279 file_contexts: ":apex.test-file_contexts",
Nikita Ioffe7f73bd12019-04-23 20:51:46 +0100280 key: "com.android.apex.cts.shim_not_pre_installed.key",
281 prebuilts: ["hash_of_dev_null"],
282 installable: false,
283}
Mohammad Samiul Islamef118be2019-07-26 13:23:33 +0100284
285apex {
286 name: "com.android.apex.cts.shim.v2_different_certificate",
287 manifest: "manifest_v2.json",
288 androidManifest: "AndroidManifest.xml",
Jooyung Han8f1b3fa2019-11-20 17:53:54 +0900289 file_contexts: ":apex.test-file_contexts",
Mohammad Samiul Islamef118be2019-07-26 13:23:33 +0100290 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
296android_app_certificate {
297 name: "com.android.apex.cts.shim.debug.cert",
298 certificate: "com.android.apex.cts.shim.debug.cert",
299}
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100300
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
308genrule {
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
315genrule {
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
323genrule {
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
331genrule {
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 Islam5e66ad72019-11-11 17:35:26 +0000344// Create lineage file for rotating alice to bob with rollback capability
Mohammad Samiul Islam5ce257c2019-08-22 15:29:49 +0100345genrule {
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000346 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 Islam5ce257c2019-08-22 15:29:49 +0100356}
357
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100358// v2 cts shim package signed by bob, without lineage
359genrule {
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 Islambbbf8e52019-08-12 15:52:15 +0100364 ":com.android.apex.cts.shim.v2",
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100365 ":com.android.apex.rotation.key.bob.x509.pem",
366 ":com.android.apex.rotation.key.bob.pk8",
367 ],
Mohammad Samiul Islam399d1ce2019-08-09 14:43:28 +0100368 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 Islambbbf8e52019-08-12 15:52:15 +0100372 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 Islam7fcf8e42019-08-01 15:54:16 +0100373}
374
375// v2 cts shim package signed by bob + lineage
376genrule {
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 Islambbbf8e52019-08-12 15:52:15 +0100381 ":com.android.apex.cts.shim.v2",
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100382 ":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 Islam399d1ce2019-08-09 14:43:28 +0100386 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 Islambbbf8e52019-08-12 15:52:15 +0100390 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 Islam7fcf8e42019-08-01 15:54:16 +0100391}
392
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000393// v2 cts shim package signed by bob + lineage + rollback capability
Mohammad Samiul Islam5ce257c2019-08-22 15:29:49 +0100394genrule {
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000395 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 Islam5ce257c2019-08-22 15:29:49 +0100397 tools: [":apksigner"],
398 srcs: [
399 ":com.android.apex.cts.shim.v2",
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000400 ":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 Islam5ce257c2019-08-22 15:29:49 +0100403 ],
404 dist: {
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000405 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 Islam5ce257c2019-08-22 15:29:49 +0100407 },
Mohammad Samiul Islam5e66ad72019-11-11 17:35:26 +0000408 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 Islam5ce257c2019-08-22 15:29:49 +0100409}
410
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100411// v3 cts shim package signed by bob
412genrule {
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 Islambbbf8e52019-08-12 15:52:15 +0100417 ":com.android.apex.cts.shim.v3",
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100418 ":com.android.apex.rotation.key.bob.x509.pem",
419 ":com.android.apex.rotation.key.bob.pk8",
420 ],
Mohammad Samiul Islam399d1ce2019-08-09 14:43:28 +0100421 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 Islambbbf8e52019-08-12 15:52:15 +0100425 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 Islam7fcf8e42019-08-01 15:54:16 +0100426}
427
428// v3 cts shim package signed by bob + lineage
429genrule {
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 Islambbbf8e52019-08-12 15:52:15 +0100434 ":com.android.apex.cts.shim.v3",
Mohammad Samiul Islam7fcf8e42019-08-01 15:54:16 +0100435 ":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 Islam399d1ce2019-08-09 14:43:28 +0100439 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 Islambbbf8e52019-08-12 15:52:15 +0100443 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 Islam7fcf8e42019-08-01 15:54:16 +0100444}
Jooyung Hana7983c02020-02-14 07:13:44 +0900445
446// This one is only used in ApexdHostTest and not meant to be installed
Colin Cross17266872020-06-11 11:06:14 -0700447// and hence shouldn't be allowed in hash.txt of v1 shim APEX.
Jooyung Hana7983c02020-02-14 07:13:44 +0900448apex {
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 Freni0dab4f32020-04-20 16:44:36 +0100455 apps: ["CtsShim", "CtsShimPriv"],
Jooyung Hana7983c02020-02-14 07:13:44 +0900456 installable: false,
Jooyung Han329d4872020-03-12 18:43:01 +0900457 min_sdk_version: "29",
Jooyung Hana7983c02020-02-14 07:13:44 +0900458}
459
460genrule {
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 Islamed9eb7d2020-03-20 21:29:04 +0000466}
467
468// Apex shim that targets an old sdk (P)
469apex {
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 Freni0dab4f32020-04-20 16:44:36 +0100477 apps: ["CtsShim", "CtsShimPriv"],
Mohammad Samiul Islamed9eb7d2020-03-20 21:29:04 +0000478}
Mohammad Samiul Islam69b3dc12020-03-21 23:13:45 +0000479
480// Apex shim with apk-in-apex that targets sdk P
481apex {
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 Freni0dab4f32020-04-20 16:44:36 +0100488 apps: ["CtsShimTargetPSdk"],
Mohammad Samiul Islam69b3dc12020-03-21 23:13:45 +0000489 installable: false,
490}
Dario Freni13e703a2020-04-27 11:08:21 +0100491
492// Apex shim with unsigned apk
493genrule {
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}