diff options
| author | 2017-04-05 17:09:59 -0700 | |
|---|---|---|
| committer | 2017-04-18 17:08:34 -0700 | |
| commit | 7da652fd43fcbeb3d62093259970f458c20ee076 (patch) | |
| tree | 7f5a2a3f9d9743d64ce295f4804c4be9f23ace7b | |
| parent | af5f00ee5e6eda69584d90ba96dc4e726cd2e8a2 (diff) | |
Handle shared libraries for split apks.
As we dexopt all the code paths of a package, we now append the code
paths to the list of shared libraries. These paths are passed as
relative paths since the apks are staged during installation, and are
not where they will be at runtime.
Part of a multi-project change.
Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests
Merged-In: I73823ca575560cbd445d78a6cfbfc72031943265
(cherry-picked from commit 16d4843433e024100b4ecd183f827ad5bd8772a6)
Change-Id: I943bf8234899e1b25d4eb5e98af15d9150a7a842
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageDexOptimizer.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java index d9ea7284616d..d696f49173fc 100644 --- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java +++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java @@ -150,10 +150,14 @@ public class PackageDexOptimizer { // TODO(calin,jeffhao): shared library paths should be adjusted to include previous code // paths (b/34169257). - final String sharedLibrariesPath = getSharedLibrariesPath(sharedLibraries); + String sharedLibrariesPath = getSharedLibrariesPath(sharedLibraries); + // Get the dexopt flags after getRealCompilerFilter to make sure we get the correct flags. final int dexoptFlags = getDexFlags(pkg, compilerFilter); int result = DEX_OPT_SKIPPED; + // TODO: Iterate based on dependency hierarchy (currently alphabetically by name) + // (b/37480811). + String basePathCheck = null; for (String path : paths) { for (String dexCodeIsa : dexCodeInstructionSets) { int newResult = dexOptPath(pkg, path, dexCodeIsa, compilerFilter, profileUpdated, @@ -165,6 +169,22 @@ public class PackageDexOptimizer { if ((result != DEX_OPT_FAILED) && (newResult != DEX_OPT_SKIPPED)) { result = newResult; } + // Add the relative path of code we just compiled to the shared libraries. + int slashIndex = path.lastIndexOf('/') + 1; + String relativePath = path.substring(slashIndex); + if (sharedLibrariesPath == null) { + sharedLibrariesPath = relativePath; + } else { + sharedLibrariesPath += ":" + relativePath; + } + // Sanity check that the base paths are all the same. + String basePath = path.substring(0, slashIndex); + if (basePathCheck == null) { + basePathCheck = basePath; + } else if (!basePath.equals(basePathCheck)) { + Slog.wtf(TAG, "Split paths have different base paths: " + basePath + " and " + + basePathCheck); + } } } return result; |