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

Commit ebb42e18 authored by Brian Carlstrom's avatar Brian Carlstrom
Browse files

Ensure that BackgroundDexOptService can still perform dexopt

Bug: 16696554
Change-Id: Id5877618ec9620112fa31dd69016c060bb26b2a7
parent 366390ce
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -4523,8 +4523,11 @@ public class PackageManagerService extends IPackageManager.Stub {
        return VMRuntime.getInstructionSet(info.primaryCpuAbi);
    }
    public boolean performDexOpt(String packageName, String instructionSet, boolean updateUsage) {
        if (!mLazyDexOpt) {
    public boolean performDexOpt(String packageName, String instructionSet, boolean backgroundDexopt) {
        boolean dexopt = mLazyDexOpt || backgroundDexopt;
        boolean updateUsage = !backgroundDexopt;  // Don't update usage if this is just a backgroundDexopt
        if (!dexopt && !updateUsage) {
            // We aren't going to dexopt or update usage, so bail early.
            return false;
        }
        PackageParser.Package p;
@@ -4538,6 +4541,10 @@ public class PackageManagerService extends IPackageManager.Stub {
                p.mLastPackageUsageTimeInMills = System.currentTimeMillis();
            }
            mPackageUsage.write(false);
            if (!dexopt) {
                // We aren't going to dexopt, so bail early.
                return false;
            }
            targetInstructionSet = instructionSet != null ? instructionSet :
                    getPrimaryInstructionSet(p.applicationInfo);