diff options
author | 2021-02-11 12:31:46 -0800 | |
---|---|---|
committer | 2021-08-17 15:08:49 -0700 | |
commit | 460ee9429edf27dbac2d308ecc18354c8df9ab73 (patch) | |
tree | 0fe750939cee2f57a9370acd5318a4d177b0ba32 /rust/image.go | |
parent | 0dd067d30908d1cc6d4bfa5e68d6c1c197ecd1d7 (diff) |
Support Rust in Recovery
Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a recovery binary
Change-Id: I1c76e6204019443c567082730a4cf680f4a2a74a
Diffstat (limited to 'rust/image.go')
-rw-r--r-- | rust/image.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/rust/image.go b/rust/image.go index 3b54f12c7..6a8337692 100644 --- a/rust/image.go +++ b/rust/image.go @@ -50,7 +50,7 @@ func (mod *Module) AndroidModuleBase() *android.ModuleBase { } func (mod *Module) RecoveryAvailable() bool { - return false + return Bool(mod.Properties.Recovery_available) } func (mod *Module) ExtraVariants() []string { @@ -72,9 +72,7 @@ func (mod *Module) SetVendorRamdiskVariantNeeded(b bool) { } func (mod *Module) SetRecoveryVariantNeeded(b bool) { - if b { - panic("Setting recovery variant needed for Rust module is unsupported: " + mod.BaseModuleName()) - } + mod.Properties.RecoveryVariantNeeded = b } func (mod *Module) SetCoreVariantNeeded(b bool) { @@ -107,7 +105,7 @@ func (mod *Module) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool } func (mod *Module) RecoveryVariantNeeded(android.BaseModuleContext) bool { - return mod.InRecovery() + return mod.Properties.RecoveryVariantNeeded } func (mod *Module) ExtraImageVariations(android.BaseModuleContext) []string { @@ -144,8 +142,7 @@ func (ctx *moduleContext) ProductSpecific() bool { } func (mod *Module) InRecovery() bool { - // TODO(b/165791368) - return false + return mod.ModuleBase.InRecovery() || mod.ModuleBase.InstallInRecovery() } func (mod *Module) InVendorRamdisk() bool { @@ -193,6 +190,8 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri m := module.(*Module) if variant == android.VendorRamdiskVariation { m.MakeAsPlatform() + } else if variant == android.RecoveryVariation { + m.MakeAsPlatform() } else if strings.HasPrefix(variant, cc.VendorVariationPrefix) { m.Properties.ImageVariationPrefix = cc.VendorVariationPrefix m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix) |