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 runtime_resource_overlay and |
| 18 | // override_runtime_resource_overlay. |
| 19 | |
Cole Faust | b749347 | 2024-08-28 11:55:52 -0700 | [diff] [blame] | 20 | import ( |
| 21 | "android/soong/android" |
| 22 | |
Spandan Das | e2f98da | 2024-11-18 19:22:39 +0000 | [diff] [blame] | 23 | "github.com/google/blueprint" |
Cole Faust | b749347 | 2024-08-28 11:55:52 -0700 | [diff] [blame] | 24 | "github.com/google/blueprint/proptools" |
| 25 | ) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 26 | |
| 27 | func init() { |
| 28 | RegisterRuntimeResourceOverlayBuildComponents(android.InitRegistrationContext) |
| 29 | } |
| 30 | |
| 31 | func RegisterRuntimeResourceOverlayBuildComponents(ctx android.RegistrationContext) { |
| 32 | ctx.RegisterModuleType("runtime_resource_overlay", RuntimeResourceOverlayFactory) |
Spandan Das | e2f98da | 2024-11-18 19:22:39 +0000 | [diff] [blame] | 33 | ctx.RegisterModuleType("autogen_runtime_resource_overlay", AutogenRuntimeResourceOverlayFactory) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 34 | ctx.RegisterModuleType("override_runtime_resource_overlay", OverrideRuntimeResourceOverlayModuleFactory) |
| 35 | } |
| 36 | |
| 37 | type RuntimeResourceOverlay struct { |
| 38 | android.ModuleBase |
| 39 | android.DefaultableModuleBase |
| 40 | android.OverridableModuleBase |
| 41 | aapt |
| 42 | |
| 43 | properties RuntimeResourceOverlayProperties |
| 44 | overridableProperties OverridableRuntimeResourceOverlayProperties |
| 45 | |
| 46 | certificate Certificate |
| 47 | |
| 48 | outputFile android.Path |
| 49 | installDir android.InstallPath |
| 50 | } |
| 51 | |
| 52 | type RuntimeResourceOverlayProperties struct { |
| 53 | // the name of a certificate in the default certificate directory or an android_app_certificate |
| 54 | // module name in the form ":module". |
Cole Faust | eb9c148 | 2024-11-18 16:49:19 -0800 | [diff] [blame] | 55 | Certificate proptools.Configurable[string] `android:"replace_instead_of_append"` |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 56 | |
| 57 | // Name of the signing certificate lineage file. |
| 58 | Lineage *string |
| 59 | |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 60 | // For overriding the --rotation-min-sdk-version property of apksig |
| 61 | RotationMinSdkVersion *string |
| 62 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 63 | // optional theme name. If specified, the overlay package will be applied |
| 64 | // only when the ro.boot.vendor.overlay.theme system property is set to the same value. |
| 65 | Theme *string |
| 66 | |
Tobias Thierer | 1b3e949 | 2021-01-02 19:01:16 +0000 | [diff] [blame] | 67 | // If not blank, set to the version of the sdk to compile against. This |
| 68 | // can be either an API version (e.g. "29" for API level 29 AKA Android 10) |
| 69 | // or special subsets of the current platform, for example "none", "current", |
| 70 | // "core", "system", "test". See build/soong/java/sdk.go for the full and |
| 71 | // up-to-date list of possible values. |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 72 | // Defaults to compiling against the current platform. |
| 73 | Sdk_version *string |
| 74 | |
| 75 | // if not blank, set the minimum version of the sdk that the compiled artifacts will run against. |
| 76 | // Defaults to sdk_version if not set. |
| 77 | Min_sdk_version *string |
| 78 | |
| 79 | // list of android_library modules whose resources are extracted and linked against statically |
Cole Faust | b749347 | 2024-08-28 11:55:52 -0700 | [diff] [blame] | 80 | Static_libs proptools.Configurable[[]string] |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 81 | |
| 82 | // list of android_app modules whose resources are extracted and linked against |
| 83 | Resource_libs []string |
| 84 | |
| 85 | // Names of modules to be overridden. Listed modules can only be other overlays |
| 86 | // (in Make or Soong). |
| 87 | // This does not completely prevent installation of the overridden overlays, but if both |
| 88 | // overlays would be installed by default (in PRODUCT_PACKAGES) the other overlay will be removed |
| 89 | // from PRODUCT_PACKAGES. |
| 90 | Overrides []string |
| 91 | } |
| 92 | |
| 93 | // RuntimeResourceOverlayModule interface is used by the apex package to gather information from |
| 94 | // a RuntimeResourceOverlay module. |
| 95 | type RuntimeResourceOverlayModule interface { |
| 96 | android.Module |
| 97 | OutputFile() android.Path |
| 98 | Certificate() Certificate |
| 99 | Theme() string |
| 100 | } |
| 101 | |
Spandan Das | 5d1b929 | 2021-06-03 19:36:41 +0000 | [diff] [blame] | 102 | // RRO's partition logic is different from the partition logic of other modules defined in soong/android/paths.go |
| 103 | // The default partition for RRO is "/product" and not "/system" |
| 104 | func rroPartition(ctx android.ModuleContext) string { |
| 105 | var partition string |
| 106 | if ctx.DeviceSpecific() { |
| 107 | partition = ctx.DeviceConfig().OdmPath() |
| 108 | } else if ctx.SocSpecific() { |
| 109 | partition = ctx.DeviceConfig().VendorPath() |
| 110 | } else if ctx.SystemExtSpecific() { |
| 111 | partition = ctx.DeviceConfig().SystemExtPath() |
| 112 | } else { |
| 113 | partition = ctx.DeviceConfig().ProductPath() |
| 114 | } |
| 115 | return partition |
| 116 | } |
| 117 | |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 118 | func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) { |
Jiyong Park | f1691d2 | 2021-03-29 20:11:58 +0900 | [diff] [blame] | 119 | sdkDep := decodeSdkDep(ctx, android.SdkContext(r)) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 120 | if sdkDep.hasFrameworkLibs() { |
| 121 | r.aapt.deps(ctx, sdkDep) |
| 122 | } |
| 123 | |
Cole Faust | eb9c148 | 2024-11-18 16:49:19 -0800 | [diff] [blame] | 124 | cert := android.SrcIsModule(r.properties.Certificate.GetOrDefault(ctx, "")) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 125 | if cert != "" { |
| 126 | ctx.AddDependency(ctx.Module(), certificateTag, cert) |
| 127 | } |
| 128 | |
Cole Faust | b749347 | 2024-08-28 11:55:52 -0700 | [diff] [blame] | 129 | ctx.AddVariationDependencies(nil, staticLibTag, r.properties.Static_libs.GetOrDefault(ctx, nil)...) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 130 | ctx.AddVariationDependencies(nil, libTag, r.properties.Resource_libs...) |
Jihoon Kang | 9f442dc | 2024-03-20 22:09:04 +0000 | [diff] [blame] | 131 | |
| 132 | for _, aconfig_declaration := range r.aaptProperties.Flags_packages { |
| 133 | ctx.AddDependency(ctx.Module(), aconfigDeclarationTag, aconfig_declaration) |
| 134 | } |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 138 | // Compile and link resources |
| 139 | r.aapt.hasNoCode = true |
| 140 | // Do not remove resources without default values nor dedupe resource configurations with the same value |
| 141 | aaptLinkFlags := []string{"--no-resource-deduping", "--no-resource-removal"} |
| 142 | // Allow the override of "package name" and "overlay target package name" |
| 143 | manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(ctx.ModuleName()) |
| 144 | if overridden || r.overridableProperties.Package_name != nil { |
| 145 | // The product override variable has a priority over the package_name property. |
| 146 | if !overridden { |
| 147 | manifestPackageName = *r.overridableProperties.Package_name |
| 148 | } |
| 149 | aaptLinkFlags = append(aaptLinkFlags, generateAaptRenamePackageFlags(manifestPackageName, false)...) |
| 150 | } |
| 151 | if r.overridableProperties.Target_package_name != nil { |
| 152 | aaptLinkFlags = append(aaptLinkFlags, |
| 153 | "--rename-overlay-target-package "+*r.overridableProperties.Target_package_name) |
| 154 | } |
Jeremy Meyer | 7e67129 | 2022-10-07 18:21:34 +0000 | [diff] [blame] | 155 | if r.overridableProperties.Category != nil { |
| 156 | aaptLinkFlags = append(aaptLinkFlags, |
| 157 | "--rename-overlay-category "+*r.overridableProperties.Category) |
| 158 | } |
Jihoon Kang | 9aef777 | 2024-06-14 23:45:06 +0000 | [diff] [blame] | 159 | aconfigTextFilePaths := getAconfigFilePaths(ctx) |
Alix | f7a1027 | 2023-09-27 16:47:56 +0000 | [diff] [blame] | 160 | r.aapt.buildActions(ctx, |
| 161 | aaptBuildActionOptions{ |
| 162 | sdkContext: r, |
| 163 | enforceDefaultTargetSdkVersion: false, |
| 164 | extraLinkFlags: aaptLinkFlags, |
Jihoon Kang | 9aef777 | 2024-06-14 23:45:06 +0000 | [diff] [blame] | 165 | aconfigTextFiles: aconfigTextFilePaths, |
Alix | f7a1027 | 2023-09-27 16:47:56 +0000 | [diff] [blame] | 166 | }, |
| 167 | ) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 168 | |
| 169 | // Sign the built package |
Sam Delmerico | 8260249 | 2022-06-10 17:05:42 +0000 | [diff] [blame] | 170 | _, _, certificates := collectAppDeps(ctx, r, false, false) |
Cole Faust | eb9c148 | 2024-11-18 16:49:19 -0800 | [diff] [blame] | 171 | r.certificate, certificates = processMainCert(r.ModuleBase, r.properties.Certificate.GetOrDefault(ctx, ""), certificates, ctx) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 172 | signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk") |
| 173 | var lineageFile android.Path |
| 174 | if lineage := String(r.properties.Lineage); lineage != "" { |
| 175 | lineageFile = android.PathForModuleSrc(ctx, lineage) |
| 176 | } |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 177 | |
| 178 | rotationMinSdkVersion := String(r.properties.RotationMinSdkVersion) |
| 179 | |
| 180 | SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile, rotationMinSdkVersion) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 181 | |
| 182 | r.outputFile = signed |
Spandan Das | 5d1b929 | 2021-06-03 19:36:41 +0000 | [diff] [blame] | 183 | partition := rroPartition(ctx) |
| 184 | r.installDir = android.PathForModuleInPartitionInstall(ctx, partition, "overlay", String(r.properties.Theme)) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 185 | ctx.InstallFile(r.installDir, r.outputFile.Base(), r.outputFile) |
Jihoon Kang | 9aef777 | 2024-06-14 23:45:06 +0000 | [diff] [blame] | 186 | |
| 187 | android.SetProvider(ctx, FlagsPackagesProvider, FlagsPackages{ |
| 188 | AconfigTextFiles: aconfigTextFilePaths, |
| 189 | }) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 190 | } |
| 191 | |
Jiyong Park | 9231537 | 2021-04-02 08:45:46 +0900 | [diff] [blame] | 192 | func (r *RuntimeResourceOverlay) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec { |
| 193 | return android.SdkSpecFrom(ctx, String(r.properties.Sdk_version)) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 194 | } |
| 195 | |
Jiyong Park | f1691d2 | 2021-03-29 20:11:58 +0900 | [diff] [blame] | 196 | func (r *RuntimeResourceOverlay) SystemModules() string { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 197 | return "" |
| 198 | } |
| 199 | |
Spandan Das | 8c9ae7e | 2023-03-03 21:20:36 +0000 | [diff] [blame] | 200 | func (r *RuntimeResourceOverlay) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 201 | if r.properties.Min_sdk_version != nil { |
Spandan Das | 8c9ae7e | 2023-03-03 21:20:36 +0000 | [diff] [blame] | 202 | return android.ApiLevelFrom(ctx, *r.properties.Min_sdk_version) |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 203 | } |
Spandan Das | 8c9ae7e | 2023-03-03 21:20:36 +0000 | [diff] [blame] | 204 | return r.SdkVersion(ctx).ApiLevel |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 205 | } |
| 206 | |
Spandan Das | a26eda7 | 2023-03-02 00:56:06 +0000 | [diff] [blame] | 207 | func (r *RuntimeResourceOverlay) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.ApiLevel { |
| 208 | return android.SdkSpecPrivate.ApiLevel |
William Loh | 5a082f9 | 2022-05-17 20:21:50 +0000 | [diff] [blame] | 209 | } |
| 210 | |
Spandan Das | ca70fc4 | 2023-03-01 23:38:49 +0000 | [diff] [blame] | 211 | func (r *RuntimeResourceOverlay) TargetSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { |
| 212 | return r.SdkVersion(ctx).ApiLevel |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | func (r *RuntimeResourceOverlay) Certificate() Certificate { |
| 216 | return r.certificate |
| 217 | } |
| 218 | |
| 219 | func (r *RuntimeResourceOverlay) OutputFile() android.Path { |
| 220 | return r.outputFile |
| 221 | } |
| 222 | |
| 223 | func (r *RuntimeResourceOverlay) Theme() string { |
| 224 | return String(r.properties.Theme) |
| 225 | } |
| 226 | |
| 227 | // runtime_resource_overlay generates a resource-only apk file that can overlay application and |
| 228 | // system resources at run time. |
| 229 | func RuntimeResourceOverlayFactory() android.Module { |
| 230 | module := &RuntimeResourceOverlay{} |
| 231 | module.AddProperties( |
| 232 | &module.properties, |
| 233 | &module.aaptProperties, |
| 234 | &module.overridableProperties) |
| 235 | |
| 236 | android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon) |
| 237 | android.InitDefaultableModule(module) |
| 238 | android.InitOverridableModule(module, &module.properties.Overrides) |
| 239 | return module |
| 240 | } |
| 241 | |
| 242 | // runtime_resource_overlay properties that can be overridden by override_runtime_resource_overlay |
| 243 | type OverridableRuntimeResourceOverlayProperties struct { |
| 244 | // the package name of this app. The package name in the manifest file is used if one was not given. |
| 245 | Package_name *string |
| 246 | |
| 247 | // the target package name of this overlay app. The target package name in the manifest file is used if one was not given. |
| 248 | Target_package_name *string |
Jeremy Meyer | 7e67129 | 2022-10-07 18:21:34 +0000 | [diff] [blame] | 249 | |
| 250 | // the rro category of this overlay. The category in the manifest file is used if one was not given. |
| 251 | Category *string |
Jaewoong Jung | f9b4465 | 2020-12-21 12:29:12 -0800 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | type OverrideRuntimeResourceOverlay struct { |
| 255 | android.ModuleBase |
| 256 | android.OverrideModuleBase |
| 257 | } |
| 258 | |
| 259 | func (i *OverrideRuntimeResourceOverlay) GenerateAndroidBuildActions(_ android.ModuleContext) { |
| 260 | // All the overrides happen in the base module. |
| 261 | // TODO(jungjw): Check the base module type. |
| 262 | } |
| 263 | |
| 264 | // override_runtime_resource_overlay is used to create a module based on another |
| 265 | // runtime_resource_overlay module by overriding some of its properties. |
| 266 | func OverrideRuntimeResourceOverlayModuleFactory() android.Module { |
| 267 | m := &OverrideRuntimeResourceOverlay{} |
| 268 | m.AddProperties(&OverridableRuntimeResourceOverlayProperties{}) |
| 269 | |
| 270 | android.InitAndroidMultiTargetsArchModule(m, android.DeviceSupported, android.MultilibCommon) |
| 271 | android.InitOverrideModule(m) |
| 272 | return m |
| 273 | } |
Spandan Das | e2f98da | 2024-11-18 19:22:39 +0000 | [diff] [blame] | 274 | |
| 275 | var ( |
| 276 | generateOverlayManifestFile = pctx.AndroidStaticRule("generate_overlay_manifest", |
| 277 | blueprint.RuleParams{ |
| 278 | Command: "build/make/tools/generate-enforce-rro-android-manifest.py " + |
| 279 | "--package-info $in " + |
| 280 | "--partition ${partition} " + |
| 281 | "--priority ${priority} -o $out", |
| 282 | CommandDeps: []string{"build/make/tools/generate-enforce-rro-android-manifest.py"}, |
| 283 | }, "partition", "priority", |
| 284 | ) |
| 285 | ) |
| 286 | |
| 287 | type AutogenRuntimeResourceOverlay struct { |
| 288 | android.ModuleBase |
| 289 | aapt |
| 290 | |
| 291 | properties AutogenRuntimeResourceOverlayProperties |
| 292 | |
| 293 | outputFile android.Path |
| 294 | } |
| 295 | |
| 296 | type AutogenRuntimeResourceOverlayProperties struct { |
| 297 | Base *string |
| 298 | Sdk_version *string |
| 299 | Manifest *string `android:"path"` |
| 300 | } |
| 301 | |
| 302 | func AutogenRuntimeResourceOverlayFactory() android.Module { |
| 303 | m := &AutogenRuntimeResourceOverlay{} |
| 304 | m.AddProperties(&m.properties) |
| 305 | android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) |
| 306 | |
| 307 | return m |
| 308 | } |
| 309 | |
| 310 | type rroDependencyTag struct { |
| 311 | blueprint.DependencyTag |
| 312 | } |
| 313 | |
| 314 | // Autogenerated RROs should always depend on the source android_app that created it. |
| 315 | func (tag rroDependencyTag) ReplaceSourceWithPrebuilt() bool { |
| 316 | return false |
| 317 | } |
| 318 | |
| 319 | var rroDepTag = rroDependencyTag{} |
| 320 | |
| 321 | func (a *AutogenRuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 322 | sdkDep := decodeSdkDep(ctx, android.SdkContext(a)) |
| 323 | if sdkDep.hasFrameworkLibs() { |
| 324 | a.aapt.deps(ctx, sdkDep) |
| 325 | } |
| 326 | ctx.AddDependency(ctx.Module(), rroDepTag, proptools.String(a.properties.Base)) |
| 327 | } |
| 328 | |
| 329 | func (a *AutogenRuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 330 | if !a.Enabled(ctx) { |
| 331 | return |
| 332 | } |
| 333 | var rroDirs android.Paths |
| 334 | // Get rro dirs of the base app |
| 335 | ctx.VisitDirectDepsWithTag(rroDepTag, func(m android.Module) { |
| 336 | aarDep, _ := m.(AndroidLibraryDependency) |
| 337 | if ctx.InstallInProduct() { |
| 338 | rroDirs = filterRRO(aarDep.RRODirsDepSet(), product) |
| 339 | } else { |
| 340 | rroDirs = filterRRO(aarDep.RRODirsDepSet(), device) |
| 341 | } |
| 342 | }) |
| 343 | |
| 344 | if len(rroDirs) == 0 { |
| 345 | return |
| 346 | } |
| 347 | |
| 348 | // Generate a manifest file |
| 349 | genManifest := android.PathForModuleGen(ctx, "AndroidManifest.xml") |
| 350 | partition := "vendor" |
| 351 | priority := "0" |
| 352 | if ctx.InstallInProduct() { |
| 353 | partition = "product" |
| 354 | priority = "1" |
| 355 | } |
| 356 | ctx.Build(pctx, android.BuildParams{ |
| 357 | Rule: generateOverlayManifestFile, |
| 358 | Input: android.PathForModuleSrc(ctx, proptools.String(a.properties.Manifest)), |
| 359 | Output: genManifest, |
| 360 | Args: map[string]string{ |
| 361 | "partition": partition, |
| 362 | "priority": priority, |
| 363 | }, |
| 364 | }) |
| 365 | |
| 366 | // Compile and link resources into package-res.apk |
| 367 | a.aapt.hasNoCode = true |
| 368 | aaptLinkFlags := []string{"--auto-add-overlay", "--keep-raw-values", "--no-resource-deduping", "--no-resource-removal"} |
| 369 | |
| 370 | a.aapt.buildActions(ctx, |
| 371 | aaptBuildActionOptions{ |
| 372 | sdkContext: a, |
| 373 | extraLinkFlags: aaptLinkFlags, |
| 374 | rroDirs: &rroDirs, |
| 375 | manifestForAapt: genManifest, |
| 376 | }, |
| 377 | ) |
| 378 | |
| 379 | if a.exportPackage == nil { |
| 380 | return |
| 381 | } |
| 382 | // Sign the built package |
| 383 | _, certificates := processMainCert(a.ModuleBase, "", nil, ctx) |
| 384 | signed := android.PathForModuleOut(ctx, "signed", a.Name()+".apk") |
| 385 | SignAppPackage(ctx, signed, a.exportPackage, certificates, nil, nil, "") |
| 386 | a.outputFile = signed |
| 387 | |
| 388 | // Install the signed apk |
| 389 | installDir := android.PathForModuleInstall(ctx, "overlay") |
| 390 | ctx.InstallFile(installDir, signed.Base(), signed) |
| 391 | } |
| 392 | |
| 393 | func (a *AutogenRuntimeResourceOverlay) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec { |
| 394 | return android.SdkSpecFrom(ctx, String(a.properties.Sdk_version)) |
| 395 | } |
| 396 | |
| 397 | func (a *AutogenRuntimeResourceOverlay) SystemModules() string { |
| 398 | return "" |
| 399 | } |
| 400 | |
| 401 | func (a *AutogenRuntimeResourceOverlay) MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { |
| 402 | return a.SdkVersion(ctx).ApiLevel |
| 403 | } |
| 404 | |
| 405 | func (r *AutogenRuntimeResourceOverlay) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.ApiLevel { |
| 406 | return android.SdkSpecPrivate.ApiLevel |
| 407 | } |
| 408 | |
| 409 | func (a *AutogenRuntimeResourceOverlay) TargetSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel { |
| 410 | return a.SdkVersion(ctx).ApiLevel |
| 411 | } |
| 412 | |
| 413 | func (a *AutogenRuntimeResourceOverlay) InstallInProduct() bool { |
| 414 | return a.ProductSpecific() |
| 415 | } |