diff options
author | 2020-11-16 17:17:29 +0000 | |
---|---|---|
committer | 2020-11-16 17:17:29 +0000 | |
commit | 0066864a0235c7ce2bd57de775a39db2bc806cfa (patch) | |
tree | ef9552966203d5dd3e9f85e286d90adfb5e00610 /dexpreopt/class_loader_context.go | |
parent | adff039572f704156875d08e1bd159e43d645cd1 (diff) | |
parent | 18554243de2edc5350bbb8bc234a7c15141c30d3 (diff) |
Merge "Add nested class loader subcontext at the proper hierarchy level."
Diffstat (limited to 'dexpreopt/class_loader_context.go')
-rw-r--r-- | dexpreopt/class_loader_context.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/dexpreopt/class_loader_context.go b/dexpreopt/class_loader_context.go index 2b6ec79bb..77d6ee9e3 100644 --- a/dexpreopt/class_loader_context.go +++ b/dexpreopt/class_loader_context.go @@ -171,7 +171,23 @@ func (clcMap ClassLoaderContextMap) AddContextForSdk(ctx android.ModuleInstallPa } // Merge the other class loader context map into this one, do not override existing entries. -func (clcMap ClassLoaderContextMap) AddContextMap(otherClcMap ClassLoaderContextMap) { +// The implicitRootLib parameter is the name of the library for which the other class loader +// context map was constructed. If the implicitRootLib is itself a <uses-library>, it should be +// already present in the class loader context (with the other context as its subcontext) -- in +// that case do not re-add the other context. Otherwise add the other context at the top-level. +func (clcMap ClassLoaderContextMap) AddContextMap(otherClcMap ClassLoaderContextMap, implicitRootLib string) { + if otherClcMap == nil { + return + } + + // If the implicit root of the merged map is already present as one of top-level subtrees, do + // not merge it second time. + for _, clc := range clcMap[AnySdkVersion] { + if clc.Name == implicitRootLib { + return + } + } + for sdkVer, otherClcs := range otherClcMap { for _, otherClc := range otherClcs { alreadyHave := false |