Add nested class loader subcontext at the proper hierarchy level.
When adding a subcontext in a class loader context tree, there are two possible cases: 1) the root of the subcontext is itself a <uses-library> and should be present as a node in the tree, or 2) the root is not a <uses-library>, but some of its dependencies are -- in that case they should be disconnected from the root, and the resulting forrest should be added at the top-level. Example: 1) C is a <uses-library>: A ├── B └── C ├── D └── E └── F 2) C is not a <uses-library>: A ├── B ├── D └── E └── F Before the patch subcontexts for transitive dependencies were added before the subcontext for the direct dependency (even if it was a <uses-library>, resulting in case-2 hierarchy when case-1 should have been used. Previosuly this didn't matter because class loader context was a flat set of libraries, but now it matters because class loader context is a tree. This patch changes the order in which libraries are added, so that direct dependencies are added before transitive ones. The context adding method now accepts an "implicit root" parameter, so that when adding transitive dependencies it can check if the corresponding direct dependency is a <uses-library> and already present in the context. Partially constructed class loader context is now propagated top-down into aapt.buildActions, so that the method can use existing part of the context to decide where the missing part should be connected. Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: I649aff9e27494306885a4f4fc90226c399636b57
This commit is contained in:
@@ -80,7 +80,12 @@ func TestCLC(t *testing.T) {
|
||||
// from conditional context.
|
||||
m.AddContextForSdk(ctx, 42, "f", buildPath(ctx, "f"), installPath(ctx, "f"), nil)
|
||||
m.AddContextForSdk(ctx, AnySdkVersion, "f", buildPath(ctx, "f"), installPath(ctx, "f"), nil)
|
||||
m.AddContextMap(m3)
|
||||
|
||||
// Merge map with implicit root library that is among toplevel contexts => does nothing.
|
||||
m.AddContextMap(m1, "c")
|
||||
// Merge map with implicit root library that is not among toplevel contexts => all subcontexts
|
||||
// of the other map are added as toplevel contexts.
|
||||
m.AddContextMap(m3, "m_g")
|
||||
|
||||
// Compatibility libraries with unknown install paths get default paths.
|
||||
m.AddContextForSdk(ctx, 29, AndroidHidlManager, buildPath(ctx, AndroidHidlManager), nil, nil)
|
||||
|
Reference in New Issue
Block a user