blob: bd892637a5eb64de084ed5dc5f48a0fd3aa9b12d [file] [log] [blame]
Dario Frenifa548122019-10-25 21:41:57 +01001// 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
15// Build rules to build shim apks.
16
17//##########################################################
18// Variant: Privileged app upgrade
19
Bob Badoure539dba2021-02-12 17:07:05 -080020package {
21 // See: http://go/android-license-faq
22 // A large-scale-change added 'default_applicable_licenses' to import
23 // all of the 'license_kinds' from "frameworks_base_license"
24 // to get the below license kinds:
25 // SPDX-license-identifier-Apache-2.0
26 default_applicable_licenses: ["frameworks_base_license"],
27}
28
Dario Frenifa548122019-10-25 21:41:57 +010029android_app {
30 name: "CtsShimPrivUpgrade",
31 // this needs to be a privileged application
32 privileged: true,
33
34 sdk_version: "current",
35 optimize: {
36 enabled: false,
37 },
38 dex_preopt: {
39 enabled: false,
40 },
41
42 manifest: "shim_priv_upgrade/AndroidManifest.xml",
43
44 compile_multilib: "both",
45 jni_libs: ["libshim_jni"],
Winson Chiu888e4dd2023-05-09 00:10:52 +000046 // Explicitly uncompress native libs rather than letting the build system doing it and destroy the
47 // v2/v3 signature.
48 use_embedded_native_libs: true,
Diego Vela51800d22020-12-14 22:05:04 +000049
50 uses_libs: ["android.test.runner"],
Nikita Ioffebd2af082022-04-27 14:04:38 +010051
52 apex_available: [
Nikita Ioffe6b44aca2022-05-11 10:44:29 +000053 "//apex_available:platform",
Nikita Ioffebd2af082022-04-27 14:04:38 +010054 "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
55 ],
Dario Frenifa548122019-10-25 21:41:57 +010056}
57
Cole Faust5aeb9fd2024-10-22 16:30:57 -070058java_genrule {
John Wu4123ccf2021-10-05 14:03:54 -070059 name: "generate_priv_manifest",
60 srcs: [
61 "shim_priv/AndroidManifest.xml",
62 ":CtsShimPrivUpgrade",
63 ],
64 out: ["AndroidManifest.xml"],
65 cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimPrivUpgrade) | cut -d' ' -f1`/ $(location shim_priv/AndroidManifest.xml) > $(out)",
Dario Frenifa548122019-10-25 21:41:57 +010066}
67
68//##########################################################
69// Variant: Privileged app
70
71android_app {
72 name: "CtsShimPriv",
73 // this needs to be a privileged application
74 privileged: true,
75
76 sdk_version: "current",
77 optimize: {
78 enabled: false,
79 },
80 dex_preopt: {
81 enabled: false,
82 },
83
84 manifest: ":generate_priv_manifest",
85
86 compile_multilib: "both",
87 jni_libs: ["libshim_jni"],
88 // Explicitly uncompress native libs rather than letting the build system doing it and destroy the
89 // v2/v3 signature.
90 use_embedded_native_libs: true,
Dario Frenif2e402d2020-04-20 16:47:43 +010091 apex_available: [
Dario Freni27fff592020-04-21 20:29:07 +010092 "//apex_available:platform",
Dario Frenif2e402d2020-04-20 16:47:43 +010093 "com.android.apex.cts.shim.v1",
94 "com.android.apex.cts.shim.v2",
Nikita Ioffebd2af082022-04-27 14:04:38 +010095 "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
Dario Frenif2e402d2020-04-20 16:47:43 +010096 "com.android.apex.cts.shim.v2_legacy",
97 "com.android.apex.cts.shim.v2_sdk_target_p",
Dario Freni7109f5e2020-04-27 18:38:07 +010098 "com.android.apex.cts.shim.v2_unsigned_payload",
Dario Frenif2e402d2020-04-20 16:47:43 +010099 "com.android.apex.cts.shim.v3",
100 ],
Jooyung Hana5ae1022020-04-30 03:24:19 +0900101 min_sdk_version: "24",
Dario Frenifa548122019-10-25 21:41:57 +0100102}
103
104//##########################################################
105// Variant: Privileged app upgrade w/ the wrong SHA
106
107android_app {
108 name: "CtsShimPrivUpgradeWrongSHA",
109 // this needs to be a privileged application
110 privileged: true,
111
112 sdk_version: "current",
113 optimize: {
114 enabled: false,
115 },
116 dex_preopt: {
117 enabled: false,
118 },
119 // anything to make this package's SHA different from CtsShimPrivUpgrade
120 aaptflags: [
121 "--version-name",
122 "WrongSHA",
123 ],
124
125 manifest: "shim_priv_upgrade/AndroidManifest.xml",
126
127 compile_multilib: "both",
128 jni_libs: ["libshim_jni"],
Winson Chiu888e4dd2023-05-09 00:10:52 +0000129 // Explicitly uncompress native libs rather than letting the build system doing it and destroy the
130 // v2/v3 signature.
131 use_embedded_native_libs: true,
Dario Frenifa548122019-10-25 21:41:57 +0100132
Diego Vela51800d22020-12-14 22:05:04 +0000133 uses_libs: ["android.test.runner"],
Dario Frenifa548122019-10-25 21:41:57 +0100134}
135
136//##########################################################
Mohammad Samiul Islam57c68c72020-03-27 19:46:26 +0000137// Variant: Non Privileged app upgrade which is malformed
138android_app {
139 name: "CtsShimTargetPSdk",
140 sdk_version: "current",
141 optimize: {
142 enabled: false,
143 },
144 dex_preopt: {
145 enabled: false,
146 },
Dario Frenif2e402d2020-04-20 16:47:43 +0100147 manifest: "shim/AndroidManifestTargetPSdk.xml",
148 apex_available: [
Dario Freni7e3234d2020-04-21 13:52:33 +0100149 "//apex_available:platform",
Dario Frenif2e402d2020-04-20 16:47:43 +0100150 "com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p",
151 ],
Mohammad Samiul Islam57c68c72020-03-27 19:46:26 +0000152}
153
154//##########################################################
John Wu4123ccf2021-10-05 14:03:54 -0700155// Variant: System app upgrade
156
157android_app {
158 name: "CtsShimUpgrade",
159
160 sdk_version: "current",
161 optimize: {
162 enabled: false,
163 },
164 dex_preopt: {
165 enabled: false,
166 },
167
168 manifest: "shim/AndroidManifestUpgrade.xml",
169 min_sdk_version: "24",
170}
171
Cole Faust5aeb9fd2024-10-22 16:30:57 -0700172java_genrule {
John Wu4123ccf2021-10-05 14:03:54 -0700173 name: "generate_shim_manifest",
174 srcs: [
175 "shim/AndroidManifest.xml",
176 ":CtsShimUpgrade",
177 ],
178 out: ["AndroidManifest.xml"],
179 cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimUpgrade) | cut -d' ' -f1`/ $(location shim/AndroidManifest.xml) > $(out)",
180}
181
182//##########################################################
Dario Frenifa548122019-10-25 21:41:57 +0100183// Variant: System app
184
185android_app {
186 name: "CtsShim",
187
188 sdk_version: "current",
189 optimize: {
190 enabled: false,
191 },
192 dex_preopt: {
193 enabled: false,
194 },
195
John Wu4123ccf2021-10-05 14:03:54 -0700196 manifest: ":generate_shim_manifest",
Dario Frenif2e402d2020-04-20 16:47:43 +0100197 apex_available: [
Dario Freni27fff592020-04-21 20:29:07 +0100198 "//apex_available:platform",
Dario Frenif2e402d2020-04-20 16:47:43 +0100199 "com.android.apex.cts.shim.v1",
200 "com.android.apex.cts.shim.v2",
Nikita Ioffebd2af082022-04-27 14:04:38 +0100201 "com.android.apex.cts.shim.v2_apk_in_apex_upgrades",
Dario Frenif2e402d2020-04-20 16:47:43 +0100202 "com.android.apex.cts.shim.v2_legacy",
203 "com.android.apex.cts.shim.v2_sdk_target_p",
Dario Freni7109f5e2020-04-27 18:38:07 +0100204 "com.android.apex.cts.shim.v2_unsigned_payload",
Dario Frenif2e402d2020-04-20 16:47:43 +0100205 "com.android.apex.cts.shim.v3",
206 ],
Jooyung Hana5ae1022020-04-30 03:24:19 +0900207 min_sdk_version: "24",
Dario Frenifa548122019-10-25 21:41:57 +0100208}
Hassan Aliee92f922023-08-17 15:28:22 +0000209
210//##########################################################
211// Variant: Add apk to an apex
212android_app {
213 name: "CtsShimAddApkToApex",
214 sdk_version: "current",
215 srcs: ["shim_add_apk_to_apex/src/android/addapktoapex/app/AddApkToApexDeviceActivity.java"],
216 optimize: {
217 enabled: false,
218 },
219 dex_preopt: {
220 enabled: false,
221 },
222 manifest: "shim_add_apk_to_apex/AndroidManifestAddApkToApex.xml",
223 apex_available: [
224 "//apex_available:platform",
225 "com.android.apex.cts.shim.v2_add_apk_to_apex",
226 ],
227}