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 15// Build rules to build shim apks. 16 17//########################################################## 18// Variant: Privileged app upgrade 19 20package { 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 29android_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"], 46 47 uses_libs: ["android.test.runner"], 48} 49 50genrule { 51 name: "generate_priv_manifest", 52 srcs: [ 53 "shim_priv/AndroidManifest.xml", 54 ":CtsShimPrivUpgrade" 55 ], 56 out: ["AndroidManifest.xml"], 57 cmd: "sed -e s/__HASH__/`sha512sum -b $(location :CtsShimPrivUpgrade) | cut -d' ' -f1`/ $(location shim_priv/AndroidManifest.xml) > $(out)", 58} 59 60//########################################################## 61// Variant: Privileged app 62 63android_app { 64 name: "CtsShimPriv", 65 // this needs to be a privileged application 66 privileged: true, 67 68 sdk_version: "current", 69 optimize: { 70 enabled: false, 71 }, 72 dex_preopt: { 73 enabled: false, 74 }, 75 76 manifest: ":generate_priv_manifest", 77 78 compile_multilib: "both", 79 jni_libs: ["libshim_jni"], 80 // Explicitly uncompress native libs rather than letting the build system doing it and destroy the 81 // v2/v3 signature. 82 use_embedded_native_libs: true, 83 apex_available: [ 84 "//apex_available:platform", 85 "com.android.apex.cts.shim.v1", 86 "com.android.apex.cts.shim.v2", 87 "com.android.apex.cts.shim.v2_no_hashtree", 88 "com.android.apex.cts.shim.v2_legacy", 89 "com.android.apex.cts.shim.v2_sdk_target_p", 90 "com.android.apex.cts.shim.v2_unsigned_payload", 91 "com.android.apex.cts.shim.v3", 92 ], 93 min_sdk_version: "24", 94} 95 96//########################################################## 97// Variant: Privileged app upgrade w/ the wrong SHA 98 99android_app { 100 name: "CtsShimPrivUpgradeWrongSHA", 101 // this needs to be a privileged application 102 privileged: true, 103 104 sdk_version: "current", 105 optimize: { 106 enabled: false, 107 }, 108 dex_preopt: { 109 enabled: false, 110 }, 111 // anything to make this package's SHA different from CtsShimPrivUpgrade 112 aaptflags: [ 113 "--version-name", 114 "WrongSHA", 115 ], 116 117 manifest: "shim_priv_upgrade/AndroidManifest.xml", 118 119 compile_multilib: "both", 120 jni_libs: ["libshim_jni"], 121 122 uses_libs: ["android.test.runner"], 123} 124 125//########################################################## 126// Variant: Non Privileged app upgrade which is malformed 127android_app { 128 name: "CtsShimTargetPSdk", 129 sdk_version: "current", 130 optimize: { 131 enabled: false, 132 }, 133 dex_preopt: { 134 enabled: false, 135 }, 136 manifest: "shim/AndroidManifestTargetPSdk.xml", 137 apex_available: [ 138 "//apex_available:platform", 139 "com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p", 140 ], 141} 142 143//########################################################## 144// Variant: System app 145 146android_app { 147 name: "CtsShim", 148 149 sdk_version: "current", 150 optimize: { 151 enabled: false, 152 }, 153 dex_preopt: { 154 enabled: false, 155 }, 156 157 manifest: "shim/AndroidManifest.xml", 158 apex_available: [ 159 "//apex_available:platform", 160 "com.android.apex.cts.shim.v1", 161 "com.android.apex.cts.shim.v2", 162 "com.android.apex.cts.shim.v2_no_hashtree", 163 "com.android.apex.cts.shim.v2_legacy", 164 "com.android.apex.cts.shim.v2_sdk_target_p", 165 "com.android.apex.cts.shim.v2_unsigned_payload", 166 "com.android.apex.cts.shim.v3", 167 ], 168 min_sdk_version: "24", 169} 170