Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 1 | // Copyright 2020 Google Inc. All rights reserved. |
| 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 | package java |
| 16 | |
| 17 | // This file contains the module implementations for android_app_import and android_test_import. |
| 18 | |
| 19 | import ( |
Colin Cross | 5368d0b | 2023-07-07 11:32:32 -0700 | [diff] [blame] | 20 | "fmt" |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 21 | "reflect" |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 22 | "strings" |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 23 | |
Cole Faust | d580613 | 2023-04-13 15:43:53 -0700 | [diff] [blame] | 24 | "github.com/google/blueprint" |
| 25 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 26 | "github.com/google/blueprint/proptools" |
| 27 | |
| 28 | "android/soong/android" |
Wei Li | 340ee8e | 2022-03-18 17:33:24 -0700 | [diff] [blame] | 29 | "android/soong/provenance" |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 30 | ) |
| 31 | |
| 32 | func init() { |
| 33 | RegisterAppImportBuildComponents(android.InitRegistrationContext) |
| 34 | |
| 35 | initAndroidAppImportVariantGroupTypes() |
| 36 | } |
| 37 | |
Cole Faust | 4ec178c | 2023-01-13 12:03:38 -0800 | [diff] [blame] | 38 | var ( |
| 39 | uncompressEmbeddedJniLibsRule = pctx.AndroidStaticRule("uncompress-embedded-jni-libs", blueprint.RuleParams{ |
| 40 | Command: `if (zipinfo $in 'lib/*.so' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then ` + |
| 41 | `${config.Zip2ZipCmd} -i $in -o $out -0 'lib/**/*.so'` + |
| 42 | `; else cp -f $in $out; fi`, |
| 43 | CommandDeps: []string{"${config.Zip2ZipCmd}"}, |
| 44 | Description: "Uncompress embedded JNI libs", |
| 45 | }) |
| 46 | |
| 47 | uncompressDexRule = pctx.AndroidStaticRule("uncompress-dex", blueprint.RuleParams{ |
| 48 | Command: `if (zipinfo $in '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then ` + |
| 49 | `${config.Zip2ZipCmd} -i $in -o $out -0 'classes*.dex'` + |
| 50 | `; else cp -f $in $out; fi`, |
| 51 | CommandDeps: []string{"${config.Zip2ZipCmd}"}, |
| 52 | Description: "Uncompress dex files", |
| 53 | }) |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 54 | |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 55 | checkPresignedApkRule = pctx.AndroidStaticRule("check-presigned-apk", blueprint.RuleParams{ |
| 56 | Command: "build/soong/scripts/check_prebuilt_presigned_apk.py --aapt2 ${config.Aapt2Cmd} --zipalign ${config.ZipAlign} $extraArgs $in $out", |
| 57 | CommandDeps: []string{"build/soong/scripts/check_prebuilt_presigned_apk.py", "${config.Aapt2Cmd}", "${config.ZipAlign}"}, |
| 58 | Description: "Check presigned apk", |
| 59 | }, "extraArgs") |
Cole Faust | 4ec178c | 2023-01-13 12:03:38 -0800 | [diff] [blame] | 60 | ) |
| 61 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 62 | func RegisterAppImportBuildComponents(ctx android.RegistrationContext) { |
| 63 | ctx.RegisterModuleType("android_app_import", AndroidAppImportFactory) |
| 64 | ctx.RegisterModuleType("android_test_import", AndroidTestImportFactory) |
| 65 | } |
| 66 | |
| 67 | type AndroidAppImport struct { |
| 68 | android.ModuleBase |
| 69 | android.DefaultableModuleBase |
| 70 | android.ApexModuleBase |
| 71 | prebuilt android.Prebuilt |
| 72 | |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 73 | properties AndroidAppImportProperties |
| 74 | dpiVariants interface{} |
| 75 | archVariants interface{} |
| 76 | arch_dpiVariants interface{} |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 77 | |
| 78 | outputFile android.Path |
| 79 | certificate Certificate |
| 80 | |
| 81 | dexpreopter |
| 82 | |
| 83 | usesLibrary usesLibrary |
| 84 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 85 | installPath android.InstallPath |
| 86 | |
| 87 | hideApexVariantFromMake bool |
Wei Li | 340ee8e | 2022-03-18 17:33:24 -0700 | [diff] [blame] | 88 | |
| 89 | provenanceMetaDataFile android.OutputPath |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 90 | |
| 91 | // Single aconfig "cache file" merged from this module and all dependencies. |
| 92 | mergedAconfigFiles map[string]android.Paths |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | type AndroidAppImportProperties struct { |
| 96 | // A prebuilt apk to import |
Jooyung Han | f05ca9c | 2021-06-28 21:48:51 +0900 | [diff] [blame] | 97 | Apk *string `android:"path"` |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 98 | |
| 99 | // The name of a certificate in the default certificate directory or an android_app_certificate |
| 100 | // module name in the form ":module". Should be empty if presigned or default_dev_cert is set. |
| 101 | Certificate *string |
| 102 | |
Jaewoong Jung | 25ae8de | 2021-03-08 17:37:46 -0800 | [diff] [blame] | 103 | // Names of extra android_app_certificate modules to sign the apk with in the form ":module". |
| 104 | Additional_certificates []string |
| 105 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 106 | // Set this flag to true if the prebuilt apk is already signed. The certificate property must not |
| 107 | // be set for presigned modules. |
| 108 | Presigned *bool |
| 109 | |
Jaewoong Jung | 1c1b6e6 | 2021-03-09 15:02:31 -0800 | [diff] [blame] | 110 | // Name of the signing certificate lineage file or filegroup module. |
| 111 | Lineage *string `android:"path"` |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 112 | |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 113 | // For overriding the --rotation-min-sdk-version property of apksig |
| 114 | RotationMinSdkVersion *string |
| 115 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 116 | // Sign with the default system dev certificate. Must be used judiciously. Most imported apps |
| 117 | // need to either specify a specific certificate or be presigned. |
| 118 | Default_dev_cert *bool |
| 119 | |
| 120 | // Specifies that this app should be installed to the priv-app directory, |
| 121 | // where the system will grant it additional privileges not available to |
| 122 | // normal apps. |
| 123 | Privileged *bool |
| 124 | |
| 125 | // Names of modules to be overridden. Listed modules can only be other binaries |
| 126 | // (in Make or Soong). |
| 127 | // This does not completely prevent installation of the overridden binaries, but if both |
| 128 | // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed |
| 129 | // from PRODUCT_PACKAGES. |
| 130 | Overrides []string |
| 131 | |
| 132 | // Optional name for the installed app. If unspecified, it is derived from the module name. |
| 133 | Filename *string |
Bill Peckham | a036da9 | 2021-01-08 16:09:09 -0800 | [diff] [blame] | 134 | |
| 135 | // If set, create package-export.apk, which other packages can |
| 136 | // use to get PRODUCT-agnostic resource data like IDs and type definitions. |
| 137 | Export_package_resources *bool |
Spandan Das | d1fac64 | 2021-05-18 17:01:41 +0000 | [diff] [blame] | 138 | |
| 139 | // Optional. Install to a subdirectory of the default install path for the module |
| 140 | Relative_install_path *string |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 141 | |
| 142 | // Whether the prebuilt apk can be installed without additional processing. Default is false. |
| 143 | Preprocessed *bool |
| 144 | |
| 145 | // Whether or not to skip checking the preprocessed apk for proper alignment and uncompressed |
| 146 | // JNI libs and dex files. Default is false |
| 147 | Skip_preprocessed_apk_checks *bool |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 148 | } |
| 149 | |
| 150 | func (a *AndroidAppImport) IsInstallable() bool { |
| 151 | return true |
| 152 | } |
| 153 | |
| 154 | // Updates properties with variant-specific values. |
Cole Faust | 97494b1 | 2024-01-12 14:02:47 -0800 | [diff] [blame] | 155 | // This happens as a DefaultableHook instead of a LoadHook because we want to run it after |
| 156 | // soong config variables are applied. |
| 157 | func (a *AndroidAppImport) processVariants(ctx android.DefaultableHookContext) { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 158 | config := ctx.Config() |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 159 | dpiProps := reflect.ValueOf(a.dpiVariants).Elem().FieldByName(DpiGroupName) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 160 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 161 | // Try DPI variant matches in the reverse-priority order so that the highest priority match |
| 162 | // overwrites everything else. |
| 163 | // TODO(jungjw): Can we optimize this by making it priority order? |
| 164 | for i := len(config.ProductAAPTPrebuiltDPI()) - 1; i >= 0; i-- { |
| 165 | MergePropertiesFromVariant(ctx, &a.properties, dpiProps, config.ProductAAPTPrebuiltDPI()[i]) |
| 166 | } |
| 167 | if config.ProductAAPTPreferredConfig() != "" { |
| 168 | MergePropertiesFromVariant(ctx, &a.properties, dpiProps, config.ProductAAPTPreferredConfig()) |
| 169 | } |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 170 | archProps := reflect.ValueOf(a.archVariants).Elem().FieldByName(ArchGroupName) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 171 | archType := ctx.Config().AndroidFirstDeviceTarget.Arch.ArchType |
| 172 | MergePropertiesFromVariant(ctx, &a.properties, archProps, archType.Name) |
| 173 | |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 174 | // Process "arch" includes "dpi_variants" |
| 175 | archStructPtr := reflect.ValueOf(a.arch_dpiVariants).Elem().FieldByName(ArchGroupName) |
| 176 | if archStruct := archStructPtr.Elem(); archStruct.IsValid() { |
| 177 | archPartPropsPtr := archStruct.FieldByName(proptools.FieldNameForProperty(archType.Name)) |
| 178 | if archPartProps := archPartPropsPtr.Elem(); archPartProps.IsValid() { |
| 179 | archDpiPropsPtr := archPartProps.FieldByName(DpiGroupName) |
| 180 | if archDpiProps := archDpiPropsPtr.Elem(); archDpiProps.IsValid() { |
| 181 | for i := len(config.ProductAAPTPrebuiltDPI()) - 1; i >= 0; i-- { |
| 182 | MergePropertiesFromVariant(ctx, &a.properties, archDpiProps, config.ProductAAPTPrebuiltDPI()[i]) |
| 183 | } |
| 184 | if config.ProductAAPTPreferredConfig() != "" { |
| 185 | MergePropertiesFromVariant(ctx, &a.properties, archDpiProps, config.ProductAAPTPreferredConfig()) |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 191 | if String(a.properties.Apk) == "" { |
| 192 | // Disable this module since the apk property is still empty after processing all matching |
| 193 | // variants. This likely means there is no matching variant, and the default variant doesn't |
| 194 | // have an apk property value either. |
| 195 | a.Disable() |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | func MergePropertiesFromVariant(ctx android.EarlyModuleContext, |
| 200 | dst interface{}, variantGroup reflect.Value, variant string) { |
| 201 | src := variantGroup.FieldByName(proptools.FieldNameForProperty(variant)) |
| 202 | if !src.IsValid() { |
| 203 | return |
| 204 | } |
| 205 | |
| 206 | err := proptools.ExtendMatchingProperties([]interface{}{dst}, src.Interface(), nil, proptools.OrderAppend) |
| 207 | if err != nil { |
| 208 | if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { |
| 209 | ctx.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) |
| 210 | } else { |
| 211 | panic(err) |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 217 | cert := android.SrcIsModule(String(a.properties.Certificate)) |
| 218 | if cert != "" { |
| 219 | ctx.AddDependency(ctx.Module(), certificateTag, cert) |
| 220 | } |
| 221 | |
Jaewoong Jung | 25ae8de | 2021-03-08 17:37:46 -0800 | [diff] [blame] | 222 | for _, cert := range a.properties.Additional_certificates { |
| 223 | cert = android.SrcIsModule(cert) |
| 224 | if cert != "" { |
| 225 | ctx.AddDependency(ctx.Module(), certificateTag, cert) |
| 226 | } else { |
| 227 | ctx.PropertyErrorf("additional_certificates", |
| 228 | `must be names of android_app_certificate modules in the form ":module"`) |
| 229 | } |
| 230 | } |
| 231 | |
Cole Faust | d580613 | 2023-04-13 15:43:53 -0700 | [diff] [blame] | 232 | a.usesLibrary.deps(ctx, true) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | func (a *AndroidAppImport) uncompressEmbeddedJniLibs( |
| 236 | ctx android.ModuleContext, inputPath android.Path, outputPath android.OutputPath) { |
| 237 | // Test apps don't need their JNI libraries stored uncompressed. As a matter of fact, messing |
| 238 | // with them may invalidate pre-existing signature data. |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 239 | if ctx.InstallInTestcases() && (Bool(a.properties.Presigned) || Bool(a.properties.Preprocessed)) { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 240 | ctx.Build(pctx, android.BuildParams{ |
| 241 | Rule: android.Cp, |
| 242 | Output: outputPath, |
| 243 | Input: inputPath, |
| 244 | }) |
| 245 | return |
| 246 | } |
Cole Faust | 4ec178c | 2023-01-13 12:03:38 -0800 | [diff] [blame] | 247 | |
| 248 | ctx.Build(pctx, android.BuildParams{ |
| 249 | Rule: uncompressEmbeddedJniLibsRule, |
| 250 | Input: inputPath, |
| 251 | Output: outputPath, |
| 252 | }) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | // Returns whether this module should have the dex file stored uncompressed in the APK. |
| 256 | func (a *AndroidAppImport) shouldUncompressDex(ctx android.ModuleContext) bool { |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 257 | if ctx.Config().UnbundledBuild() || proptools.Bool(a.properties.Preprocessed) { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 258 | return false |
| 259 | } |
| 260 | |
Ulya Trafimovich | 0061c0d | 2021-09-01 15:40:38 +0100 | [diff] [blame] | 261 | // Uncompress dex in APKs of priv-apps if and only if DONT_UNCOMPRESS_PRIV_APPS_DEXS is false. |
| 262 | if a.Privileged() { |
| 263 | return ctx.Config().UncompressPrivAppDex() |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 264 | } |
| 265 | |
Spandan Das | e21a8d4 | 2024-01-23 23:56:29 +0000 | [diff] [blame] | 266 | return shouldUncompressDex(ctx, android.RemoveOptionalPrebuiltPrefix(ctx.ModuleName()), &a.dexpreopter) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 267 | } |
| 268 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 269 | func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 270 | a.generateAndroidBuildActions(ctx) |
| 271 | } |
| 272 | |
| 273 | func (a *AndroidAppImport) InstallApkName() string { |
| 274 | return a.BaseModuleName() |
| 275 | } |
| 276 | |
| 277 | func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext) { |
Cole Faust | d580613 | 2023-04-13 15:43:53 -0700 | [diff] [blame] | 278 | if a.Name() == "prebuilt_framework-res" { |
| 279 | ctx.ModuleErrorf("prebuilt_framework-res found. This used to have special handling in soong, but was removed due to prebuilt_framework-res no longer existing. This check is to ensure it doesn't come back without readding the special handling.") |
| 280 | } |
| 281 | |
Colin Cross | ff694a8 | 2023-12-13 15:54:49 -0800 | [diff] [blame] | 282 | apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 283 | if !apexInfo.IsForPlatform() { |
| 284 | a.hideApexVariantFromMake = true |
| 285 | } |
| 286 | |
Cole Faust | 6158528 | 2023-07-14 16:23:39 -0700 | [diff] [blame] | 287 | if Bool(a.properties.Preprocessed) { |
| 288 | if a.properties.Presigned != nil && !*a.properties.Presigned { |
| 289 | ctx.ModuleErrorf("Setting preprocessed: true implies presigned: true, so you cannot set presigned to false") |
| 290 | } |
| 291 | t := true |
| 292 | a.properties.Presigned = &t |
| 293 | } |
| 294 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 295 | numCertPropsSet := 0 |
| 296 | if String(a.properties.Certificate) != "" { |
| 297 | numCertPropsSet++ |
| 298 | } |
| 299 | if Bool(a.properties.Presigned) { |
| 300 | numCertPropsSet++ |
| 301 | } |
| 302 | if Bool(a.properties.Default_dev_cert) { |
| 303 | numCertPropsSet++ |
| 304 | } |
| 305 | if numCertPropsSet != 1 { |
Cole Faust | 6158528 | 2023-07-14 16:23:39 -0700 | [diff] [blame] | 306 | ctx.ModuleErrorf("One and only one of certficate, presigned (implied by preprocessed), and default_dev_cert properties must be set") |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 307 | } |
| 308 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 309 | // TODO: LOCAL_EXTRACT_APK/LOCAL_EXTRACT_DPI_APK |
| 310 | // TODO: LOCAL_PACKAGE_SPLITS |
| 311 | |
| 312 | srcApk := a.prebuilt.SingleSourcePath(ctx) |
| 313 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 314 | // TODO: Install or embed JNI libraries |
| 315 | |
| 316 | // Uncompress JNI libraries in the apk |
| 317 | jnisUncompressed := android.PathForModuleOut(ctx, "jnis-uncompressed", ctx.ModuleName()+".apk") |
| 318 | a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed.OutputPath) |
| 319 | |
Spandan Das | d1fac64 | 2021-05-18 17:01:41 +0000 | [diff] [blame] | 320 | var pathFragments []string |
| 321 | relInstallPath := String(a.properties.Relative_install_path) |
Bill Peckham | a036da9 | 2021-01-08 16:09:09 -0800 | [diff] [blame] | 322 | |
Cole Faust | d580613 | 2023-04-13 15:43:53 -0700 | [diff] [blame] | 323 | if Bool(a.properties.Privileged) { |
Spandan Das | d1fac64 | 2021-05-18 17:01:41 +0000 | [diff] [blame] | 324 | pathFragments = []string{"priv-app", relInstallPath, a.BaseModuleName()} |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 325 | } else if ctx.InstallInTestcases() { |
Spandan Das | d1fac64 | 2021-05-18 17:01:41 +0000 | [diff] [blame] | 326 | pathFragments = []string{relInstallPath, a.BaseModuleName(), ctx.DeviceConfig().DeviceArch()} |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 327 | } else { |
Spandan Das | d1fac64 | 2021-05-18 17:01:41 +0000 | [diff] [blame] | 328 | pathFragments = []string{"app", relInstallPath, a.BaseModuleName()} |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 329 | } |
| 330 | |
Spandan Das | d1fac64 | 2021-05-18 17:01:41 +0000 | [diff] [blame] | 331 | installDir := android.PathForModuleInstall(ctx, pathFragments...) |
Ulya Trafimovich | 76b0852 | 2021-01-14 17:52:43 +0000 | [diff] [blame] | 332 | a.dexpreopter.isApp = true |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 333 | a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk") |
| 334 | a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned) |
| 335 | a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx) |
| 336 | |
| 337 | a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries() |
| 338 | a.dexpreopter.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx) |
| 339 | |
Ulya Trafimovich | fe927a2 | 2021-02-26 14:36:48 +0000 | [diff] [blame] | 340 | if a.usesLibrary.enforceUsesLibraries() { |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 341 | a.usesLibrary.verifyUsesLibrariesAPK(ctx, srcApk) |
Ulya Trafimovich | fe927a2 | 2021-02-26 14:36:48 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Spandan Das | e21a8d4 | 2024-01-23 23:56:29 +0000 | [diff] [blame] | 344 | a.dexpreopter.dexpreopt(ctx, android.RemoveOptionalPrebuiltPrefix(ctx.ModuleName()), jnisUncompressed) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 345 | if a.dexpreopter.uncompressedDex { |
| 346 | dexUncompressed := android.PathForModuleOut(ctx, "dex-uncompressed", ctx.ModuleName()+".apk") |
Cole Faust | 4ec178c | 2023-01-13 12:03:38 -0800 | [diff] [blame] | 347 | ctx.Build(pctx, android.BuildParams{ |
| 348 | Rule: uncompressDexRule, |
| 349 | Input: jnisUncompressed, |
| 350 | Output: dexUncompressed, |
| 351 | }) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 352 | jnisUncompressed = dexUncompressed |
| 353 | } |
| 354 | |
| 355 | apkFilename := proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+".apk") |
| 356 | |
| 357 | // TODO: Handle EXTERNAL |
| 358 | |
| 359 | // Sign or align the package if package has not been preprocessed |
Bill Peckham | a036da9 | 2021-01-08 16:09:09 -0800 | [diff] [blame] | 360 | |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 361 | if proptools.Bool(a.properties.Preprocessed) { |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 362 | validationStamp := a.validatePresignedApk(ctx, srcApk) |
| 363 | output := android.PathForModuleOut(ctx, apkFilename) |
| 364 | ctx.Build(pctx, android.BuildParams{ |
| 365 | Rule: android.Cp, |
| 366 | Input: srcApk, |
| 367 | Output: output, |
| 368 | Validation: validationStamp, |
| 369 | }) |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 370 | a.outputFile = output |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 371 | a.certificate = PresignedCertificate |
| 372 | } else if !Bool(a.properties.Presigned) { |
| 373 | // If the certificate property is empty at this point, default_dev_cert must be set to true. |
| 374 | // Which makes processMainCert's behavior for the empty cert string WAI. |
Cole Faust | 6158528 | 2023-07-14 16:23:39 -0700 | [diff] [blame] | 375 | _, _, certificates := collectAppDeps(ctx, a, false, false) |
Colin Cross | bc2c8a7 | 2022-09-14 12:45:42 -0700 | [diff] [blame] | 376 | a.certificate, certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 377 | signed := android.PathForModuleOut(ctx, "signed", apkFilename) |
| 378 | var lineageFile android.Path |
| 379 | if lineage := String(a.properties.Lineage); lineage != "" { |
| 380 | lineageFile = android.PathForModuleSrc(ctx, lineage) |
| 381 | } |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 382 | |
| 383 | rotationMinSdkVersion := String(a.properties.RotationMinSdkVersion) |
| 384 | |
| 385 | SignAppPackage(ctx, signed, jnisUncompressed, certificates, nil, lineageFile, rotationMinSdkVersion) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 386 | a.outputFile = signed |
| 387 | } else { |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 388 | validationStamp := a.validatePresignedApk(ctx, srcApk) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 389 | alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 390 | TransformZipAlign(ctx, alignedApk, jnisUncompressed, []android.Path{validationStamp}) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 391 | a.outputFile = alignedApk |
| 392 | a.certificate = PresignedCertificate |
| 393 | } |
| 394 | |
| 395 | // TODO: Optionally compress the output apk. |
| 396 | |
| 397 | if apexInfo.IsForPlatform() { |
| 398 | a.installPath = ctx.InstallFile(installDir, apkFilename, a.outputFile) |
Wei Li | 340ee8e | 2022-03-18 17:33:24 -0700 | [diff] [blame] | 399 | artifactPath := android.PathForModuleSrc(ctx, *a.properties.Apk) |
| 400 | a.provenanceMetaDataFile = provenance.GenerateArtifactProvenanceMetaData(ctx, artifactPath, a.installPath) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 401 | } |
LaMont Jones | afe7baf | 2024-01-09 22:47:39 +0000 | [diff] [blame] | 402 | android.CollectDependencyAconfigFiles(ctx, &a.mergedAconfigFiles) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 403 | |
| 404 | // TODO: androidmk converter jni libs |
| 405 | } |
| 406 | |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 407 | func (a *AndroidAppImport) validatePresignedApk(ctx android.ModuleContext, srcApk android.Path) android.Path { |
| 408 | stamp := android.PathForModuleOut(ctx, "validated-prebuilt", "check.stamp") |
| 409 | var extraArgs []string |
Cole Faust | 93b89b4 | 2023-07-20 17:31:16 -0700 | [diff] [blame] | 410 | if a.Privileged() { |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 411 | extraArgs = append(extraArgs, "--privileged") |
| 412 | } |
| 413 | if proptools.Bool(a.properties.Skip_preprocessed_apk_checks) { |
| 414 | extraArgs = append(extraArgs, "--skip-preprocessed-apk-checks") |
| 415 | } |
| 416 | if proptools.Bool(a.properties.Preprocessed) { |
| 417 | extraArgs = append(extraArgs, "--preprocessed") |
Cole Faust | 93b89b4 | 2023-07-20 17:31:16 -0700 | [diff] [blame] | 418 | } |
| 419 | |
Cole Faust | 2f1da16 | 2023-04-17 15:06:56 -0700 | [diff] [blame] | 420 | ctx.Build(pctx, android.BuildParams{ |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 421 | Rule: checkPresignedApkRule, |
Cole Faust | 6158528 | 2023-07-14 16:23:39 -0700 | [diff] [blame] | 422 | Input: srcApk, |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 423 | Output: stamp, |
| 424 | Args: map[string]string{ |
| 425 | "extraArgs": strings.Join(extraArgs, " "), |
| 426 | }, |
Cole Faust | 6158528 | 2023-07-14 16:23:39 -0700 | [diff] [blame] | 427 | }) |
Cole Faust | 9c5c09f | 2023-09-06 16:11:44 -0700 | [diff] [blame] | 428 | return stamp |
Cole Faust | 6158528 | 2023-07-14 16:23:39 -0700 | [diff] [blame] | 429 | } |
| 430 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 431 | func (a *AndroidAppImport) Prebuilt() *android.Prebuilt { |
| 432 | return &a.prebuilt |
| 433 | } |
| 434 | |
| 435 | func (a *AndroidAppImport) Name() string { |
| 436 | return a.prebuilt.Name(a.ModuleBase.Name()) |
| 437 | } |
| 438 | |
| 439 | func (a *AndroidAppImport) OutputFile() android.Path { |
| 440 | return a.outputFile |
| 441 | } |
| 442 | |
Colin Cross | 5368d0b | 2023-07-07 11:32:32 -0700 | [diff] [blame] | 443 | func (a *AndroidAppImport) OutputFiles(tag string) (android.Paths, error) { |
| 444 | switch tag { |
| 445 | case "": |
| 446 | return []android.Path{a.outputFile}, nil |
| 447 | default: |
| 448 | return nil, fmt.Errorf("unsupported module reference tag %q", tag) |
| 449 | } |
| 450 | } |
| 451 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 452 | func (a *AndroidAppImport) JacocoReportClassesFile() android.Path { |
| 453 | return nil |
| 454 | } |
| 455 | |
| 456 | func (a *AndroidAppImport) Certificate() Certificate { |
| 457 | return a.certificate |
| 458 | } |
| 459 | |
Wei Li | 340ee8e | 2022-03-18 17:33:24 -0700 | [diff] [blame] | 460 | func (a *AndroidAppImport) ProvenanceMetaDataFile() android.OutputPath { |
| 461 | return a.provenanceMetaDataFile |
| 462 | } |
| 463 | |
Andrei Onea | 580636b | 2022-08-17 16:53:46 +0000 | [diff] [blame] | 464 | func (a *AndroidAppImport) PrivAppAllowlist() android.OptionalPath { |
| 465 | return android.OptionalPath{} |
| 466 | } |
| 467 | |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 468 | const ( |
| 469 | ArchGroupName = "Arch" |
| 470 | DpiGroupName = "Dpi_variants" |
| 471 | ) |
| 472 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 473 | var dpiVariantGroupType reflect.Type |
| 474 | var archVariantGroupType reflect.Type |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 475 | var archdpiVariantGroupType reflect.Type |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 476 | var supportedDpis = []string{"ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"} |
| 477 | |
| 478 | func initAndroidAppImportVariantGroupTypes() { |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 479 | dpiVariantGroupType = createVariantGroupType(supportedDpis, DpiGroupName) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 480 | |
| 481 | archNames := make([]string, len(android.ArchTypeList())) |
| 482 | for i, archType := range android.ArchTypeList() { |
| 483 | archNames[i] = archType.Name |
| 484 | } |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 485 | archVariantGroupType = createVariantGroupType(archNames, ArchGroupName) |
| 486 | archdpiVariantGroupType = createArchDpiVariantGroupType(archNames, supportedDpis) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 487 | } |
| 488 | |
| 489 | // Populates all variant struct properties at creation time. |
| 490 | func (a *AndroidAppImport) populateAllVariantStructs() { |
| 491 | a.dpiVariants = reflect.New(dpiVariantGroupType).Interface() |
| 492 | a.AddProperties(a.dpiVariants) |
| 493 | |
| 494 | a.archVariants = reflect.New(archVariantGroupType).Interface() |
| 495 | a.AddProperties(a.archVariants) |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 496 | |
| 497 | a.arch_dpiVariants = reflect.New(archdpiVariantGroupType).Interface() |
| 498 | a.AddProperties(a.arch_dpiVariants) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | func (a *AndroidAppImport) Privileged() bool { |
| 502 | return Bool(a.properties.Privileged) |
| 503 | } |
| 504 | |
| 505 | func (a *AndroidAppImport) DepIsInSameApex(_ android.BaseModuleContext, _ android.Module) bool { |
| 506 | // android_app_import might have extra dependencies via uses_libs property. |
| 507 | // Don't track the dependency as we don't automatically add those libraries |
| 508 | // to the classpath. It should be explicitly added to java_libs property of APEX |
| 509 | return false |
| 510 | } |
| 511 | |
Jiyong Park | 9231537 | 2021-04-02 08:45:46 +0900 | [diff] [blame] | 512 | func (a *AndroidAppImport) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec { |
| 513 | return android.SdkSpecPrivate |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 514 | } |
| 515 | |
Spandan Das | 8c9ae7e | 2023-03-03 21:20:36 +0000 | [diff] [blame] | 516 | func (a *AndroidAppImport) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { |
| 517 | return android.SdkSpecPrivate.ApiLevel |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 518 | } |
| 519 | |
Colin Cross | 8355c15 | 2021-08-10 19:24:07 -0700 | [diff] [blame] | 520 | func (a *AndroidAppImport) LintDepSets() LintDepSets { |
| 521 | return LintDepSets{} |
| 522 | } |
| 523 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 524 | var _ android.ApexModule = (*AndroidAppImport)(nil) |
| 525 | |
| 526 | // Implements android.ApexModule |
| 527 | func (j *AndroidAppImport) ShouldSupportSdkVersion(ctx android.BaseModuleContext, |
| 528 | sdkVersion android.ApiLevel) error { |
| 529 | // Do not check for prebuilts against the min_sdk_version of enclosing APEX |
| 530 | return nil |
| 531 | } |
| 532 | |
| 533 | func createVariantGroupType(variants []string, variantGroupName string) reflect.Type { |
| 534 | props := reflect.TypeOf((*AndroidAppImportProperties)(nil)) |
| 535 | |
| 536 | variantFields := make([]reflect.StructField, len(variants)) |
| 537 | for i, variant := range variants { |
| 538 | variantFields[i] = reflect.StructField{ |
| 539 | Name: proptools.FieldNameForProperty(variant), |
| 540 | Type: props, |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | variantGroupStruct := reflect.StructOf(variantFields) |
| 545 | return reflect.StructOf([]reflect.StructField{ |
| 546 | { |
| 547 | Name: variantGroupName, |
| 548 | Type: variantGroupStruct, |
| 549 | }, |
| 550 | }) |
| 551 | } |
| 552 | |
Herbert Xue | 04354ae | 2024-01-29 13:57:51 +0800 | [diff] [blame^] | 553 | func createArchDpiVariantGroupType(archNames []string, dpiNames []string) reflect.Type { |
| 554 | props := reflect.TypeOf((*AndroidAppImportProperties)(nil)) |
| 555 | |
| 556 | dpiVariantFields := make([]reflect.StructField, len(dpiNames)) |
| 557 | for i, variant_dpi := range dpiNames { |
| 558 | dpiVariantFields[i] = reflect.StructField{ |
| 559 | Name: proptools.FieldNameForProperty(variant_dpi), |
| 560 | Type: props, |
| 561 | } |
| 562 | } |
| 563 | dpiVariantGroupStruct := reflect.StructOf(dpiVariantFields) |
| 564 | dpi_struct := reflect.StructOf([]reflect.StructField{ |
| 565 | { |
| 566 | Name: DpiGroupName, |
| 567 | Type: reflect.PointerTo(dpiVariantGroupStruct), |
| 568 | }, |
| 569 | }) |
| 570 | |
| 571 | archVariantFields := make([]reflect.StructField, len(archNames)) |
| 572 | for i, variant_arch := range archNames { |
| 573 | archVariantFields[i] = reflect.StructField{ |
| 574 | Name: proptools.FieldNameForProperty(variant_arch), |
| 575 | Type: reflect.PointerTo(dpi_struct), |
| 576 | } |
| 577 | } |
| 578 | archVariantGroupStruct := reflect.StructOf(archVariantFields) |
| 579 | |
| 580 | return_struct := reflect.StructOf([]reflect.StructField{ |
| 581 | { |
| 582 | Name: ArchGroupName, |
| 583 | Type: reflect.PointerTo(archVariantGroupStruct), |
| 584 | }, |
| 585 | }) |
| 586 | return return_struct |
| 587 | } |
| 588 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 589 | // android_app_import imports a prebuilt apk with additional processing specified in the module. |
| 590 | // DPI-specific apk source files can be specified using dpi_variants. Example: |
| 591 | // |
Colin Cross | d079e0b | 2022-08-16 10:27:33 -0700 | [diff] [blame] | 592 | // android_app_import { |
| 593 | // name: "example_import", |
| 594 | // apk: "prebuilts/example.apk", |
| 595 | // dpi_variants: { |
| 596 | // mdpi: { |
| 597 | // apk: "prebuilts/example_mdpi.apk", |
| 598 | // }, |
| 599 | // xhdpi: { |
| 600 | // apk: "prebuilts/example_xhdpi.apk", |
| 601 | // }, |
| 602 | // }, |
| 603 | // presigned: true, |
| 604 | // } |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 605 | func AndroidAppImportFactory() android.Module { |
| 606 | module := &AndroidAppImport{} |
| 607 | module.AddProperties(&module.properties) |
| 608 | module.AddProperties(&module.dexpreoptProperties) |
| 609 | module.AddProperties(&module.usesLibrary.usesLibraryProperties) |
| 610 | module.populateAllVariantStructs() |
Cole Faust | 97494b1 | 2024-01-12 14:02:47 -0800 | [diff] [blame] | 611 | module.SetDefaultableHook(func(ctx android.DefaultableHookContext) { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 612 | module.processVariants(ctx) |
| 613 | }) |
| 614 | |
| 615 | android.InitApexModule(module) |
| 616 | android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 617 | android.InitDefaultableModule(module) |
| 618 | android.InitSingleSourcePrebuiltModule(module, &module.properties, "Apk") |
| 619 | |
Ulya Trafimovich | 22890c4 | 2021-01-05 12:04:17 +0000 | [diff] [blame] | 620 | module.usesLibrary.enforce = true |
| 621 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 622 | return module |
| 623 | } |
| 624 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 625 | type AndroidTestImport struct { |
| 626 | AndroidAppImport |
| 627 | |
Jiyong Park | 2f83b31 | 2022-10-20 20:18:35 +0900 | [diff] [blame] | 628 | testProperties struct { |
| 629 | // list of compatibility suites (for example "cts", "vts") that the module should be |
| 630 | // installed into. |
| 631 | Test_suites []string `android:"arch_variant"` |
| 632 | |
| 633 | // list of files or filegroup modules that provide data that should be installed alongside |
| 634 | // the test |
| 635 | Data []string `android:"path"` |
| 636 | |
| 637 | // Install the test into a folder named for the module in all test suites. |
| 638 | Per_testcase_directory *bool |
| 639 | } |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 640 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 641 | data android.Paths |
| 642 | } |
| 643 | |
| 644 | func (a *AndroidTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 645 | a.generateAndroidBuildActions(ctx) |
| 646 | |
| 647 | a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data) |
| 648 | } |
| 649 | |
| 650 | func (a *AndroidTestImport) InstallInTestcases() bool { |
| 651 | return true |
| 652 | } |
| 653 | |
| 654 | // android_test_import imports a prebuilt test apk with additional processing specified in the |
| 655 | // module. DPI or arch variant configurations can be made as with android_app_import. |
| 656 | func AndroidTestImportFactory() android.Module { |
| 657 | module := &AndroidTestImport{} |
| 658 | module.AddProperties(&module.properties) |
| 659 | module.AddProperties(&module.dexpreoptProperties) |
| 660 | module.AddProperties(&module.testProperties) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 661 | module.populateAllVariantStructs() |
Cole Faust | 97494b1 | 2024-01-12 14:02:47 -0800 | [diff] [blame] | 662 | module.SetDefaultableHook(func(ctx android.DefaultableHookContext) { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 663 | module.processVariants(ctx) |
| 664 | }) |
| 665 | |
| 666 | module.dexpreopter.isTest = true |
| 667 | |
| 668 | android.InitApexModule(module) |
| 669 | android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 670 | android.InitDefaultableModule(module) |
| 671 | android.InitSingleSourcePrebuiltModule(module, &module.properties, "Apk") |
| 672 | |
| 673 | return module |
| 674 | } |