OSDN Git Service

When updating a split app, copy compiled files from base.apk only.
authorJeff Hao <jeffhao@google.com>
Tue, 13 Jun 2017 18:09:10 +0000 (11:09 -0700)
committerJeff Hao <jeffhao@google.com>
Tue, 13 Jun 2017 18:27:28 +0000 (11:27 -0700)
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

Change-Id: Id8e6dc59b16d4f10a6c2d9d81027012204e0f26b

services/core/java/com/android/server/pm/PackageInstallerSession.java

index c85e1d8..8936639 100644 (file)
@@ -834,8 +834,15 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
 
                         mResolvedInstructionSets.add(archSubDir.getName());
                         List<File> 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);
+                            }
                         }
                     }
                 }