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
Loading
Please register or sign in to comment