Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7f9220a authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Frameworks/base: Extract packages after cache pruning

In case the runtime pruned the dalvik cache on boot, run the package
extraction logic, so we have working oat files.

As the system server only runs in the primary ABI, this is best effort
and won't hit if only the secondary ABI has been pruned.

Bug: 27618311
Change-Id: I178d18d731a9dce5cb11ed0874c9c9c9d36d7d8e
parent f8de70c7
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -6891,7 +6891,8 @@ public class PackageManagerService extends IPackageManager.Stub {
        // Extract pacakges only if profile-guided compilation is enabled because
        // Extract pacakges only if profile-guided compilation is enabled because
        // otherwise BackgroundDexOptService will not dexopt them later.
        // otherwise BackgroundDexOptService will not dexopt them later.
        if (!isUpgrade()) {
        boolean prunedCache = VMRuntime.didPruneDalvikCache();
        if (!isUpgrade() && !prunedCache) {
            return;
            return;
        }
        }
@@ -6919,8 +6920,11 @@ public class PackageManagerService extends IPackageManager.Stub {
            }
            }
            if (PackageDexOptimizer.canOptimizePackage(pkg)) {
            if (PackageDexOptimizer.canOptimizePackage(pkg)) {
                // If the cache was pruned, any compiled odex files will likely be out of date
                // and would have to be patched (would be SELF_PATCHOAT, which is deprecated).
                // Instead, force the extraction in this case.
                performDexOpt(pkg.packageName, null /* instructionSet */,
                performDexOpt(pkg.packageName, null /* instructionSet */,
                         false /* useProfiles */, true /* extractOnly */, false /* force */);
                         false /* useProfiles */, true /* extractOnly */, prunedCache);
            }
            }
        }
        }
    }
    }