From: Jeff Hao Date: Tue, 13 Jun 2017 18:09:10 +0000 (-0700) Subject: When updating a split app, copy compiled files from base.apk only. X-Git-Tag: android-x86-9.0-r1~1044^2~138^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=be649a4ba1014a22ccb7d98319b26472b0e0076d;p=android-x86%2Fframeworks-base.git When updating a split app, copy compiled files from base.apk only. This fixes issues with some splits failing to be recompiled if they haven't changed, but the dex files they depend on have. The real fix will be for frameworks to generate the new expected classpath and check in DexFile.getDexOptNeeded. Then we can undo this change and copy over all the compiled split files again. Bug: 62269291 Test: cts-tradefed run singleCommand cts -d --module CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests (cherry-picked from commit d1235f54d4943a0a3a920013a5875b5193bd0490) Change-Id: I6e640a966ef3b43054d163326878adebe2329693 --- diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index 4540d2dfd692..f111db1434c3 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -856,8 +856,15 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { mResolvedInstructionSets.add(archSubDir.getName()); List oatFiles = Arrays.asList(archSubDir.listFiles()); - if (!oatFiles.isEmpty()) { - mResolvedInheritedFiles.addAll(oatFiles); + + // Only add compiled files associated with the base. + // Once b/62269291 is resolved, we can add all compiled files again. + for (File oatFile : oatFiles) { + if (oatFile.getName().equals("base.art") + || oatFile.getName().equals("base.odex") + || oatFile.getName().equals("base.vdex")) { + mResolvedInheritedFiles.add(oatFile); + } } } }