From f7bbd2fe40e43f7fda7e08d08eeb9c2a93552ad9 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 5 Dec 2024 13:57:10 -0800 Subject: Split DepIsInSameApex into outgoing and incoming Prepare for calling DepIsInSameApex from the apex transition mutator by splitting all the implementations in two, one that is called on the outgoing module and only takes the depTag, and one that is called on the incoming module and only takes the depTag. apexBundle.depVisitor was passing the child into android.IsDepInSameApex for both the parent and child paramters. The parent field was only used to find the type on which to call DepIsInSameApex, so this effectively used the child's implementation of DepIsInSameApex. That used to be necessary when the parent and child were of different module types, as the parent module type may not have been aware of the rules for the child module type, but is no longer necessary with split outgoing and incoming DepIsInSameApex. Bug: 372543712 Test: all soong tests pass Change-Id: If7c81ec3f7b1ea69d77e9ad7694e238820194e59 --- java/app.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'java/app.go') diff --git a/java/app.go b/java/app.go index 276e9606d..b8c85fb62 100644 --- a/java/app.go +++ b/java/app.go @@ -1209,7 +1209,10 @@ func collectJniDeps(ctx android.ModuleContext, func (a *AndroidApp) WalkPayloadDeps(ctx android.BaseModuleContext, do android.PayloadDepsCallback) { ctx.WalkDeps(func(child, parent android.Module) bool { - isExternal := !a.DepIsInSameApex(ctx, child) + // TODO(ccross): Should this use android.DepIsInSameApex? Right now it is applying the android app + // heuristics to every transitive dependency, when it should probably be using the heuristics of the + // immediate parent. + isExternal := !a.OutgoingDepIsInSameApex(ctx.OtherModuleDependencyTag(child)) if am, ok := child.(android.ApexModule); ok { if !do(ctx, parent, am, isExternal) { return false @@ -1286,11 +1289,11 @@ func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string { return a.overridableAppProperties.Certificate.GetOrDefault(ctx, "") } -func (a *AndroidApp) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool { - if IsJniDepTag(ctx.OtherModuleDependencyTag(dep)) { +func (a *AndroidApp) OutgoingDepIsInSameApex(tag blueprint.DependencyTag) bool { + if IsJniDepTag(tag) { return true } - return a.Library.DepIsInSameApex(ctx, dep) + return a.Library.OutgoingDepIsInSameApex(tag) } func (a *AndroidApp) Privileged() bool { -- cgit v1.2.3-59-g8ed1b