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