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

Commit 7ce5ae04 authored by Chun-Wei Wang's avatar Chun-Wei Wang Committed by Android (Google) Code Review
Browse files

Merge "Skip APEX when doing dexopt"

parents 624b1ef3 85cfaad5
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -385,6 +385,11 @@ final class DexOptHelper {
        } else if (snapshot.isInstantApp(options.getPackageName(), UserHandle.getCallingUserId())) {
        } else if (snapshot.isInstantApp(options.getPackageName(), UserHandle.getCallingUserId())) {
            return false;
            return false;
        }
        }
        var pkg = snapshot.getPackage(options.getPackageName());
        if (pkg != null && pkg.isApex()) {
            // skip APEX
            return true;
        }


        if (options.isDexoptOnlySecondaryDex()) {
        if (options.isDexoptOnlySecondaryDex()) {
            return mPm.getDexManager().dexoptSecondaryDex(options);
            return mPm.getDexManager().dexoptSecondaryDex(options);
@@ -427,6 +432,10 @@ final class DexOptHelper {
                // Package could not be found. Report failure.
                // Package could not be found. Report failure.
                return PackageDexOptimizer.DEX_OPT_FAILED;
                return PackageDexOptimizer.DEX_OPT_FAILED;
            }
            }
            if (p.isApex()) {
                // APEX needs no dexopt
                return PackageDexOptimizer.DEX_OPT_SKIPPED;
            }
            mPm.getPackageUsage().maybeWriteAsync(mPm.mSettings.getPackagesLocked());
            mPm.getPackageUsage().maybeWriteAsync(mPm.mSettings.getPackagesLocked());
            mPm.mCompilerStats.maybeWriteAsync();
            mPm.mCompilerStats.maybeWriteAsync();
        }
        }
@@ -498,6 +507,9 @@ final class DexOptHelper {
        if (packageState == null || pkg == null) {
        if (packageState == null || pkg == null) {
            throw new IllegalArgumentException("Unknown package: " + packageName);
            throw new IllegalArgumentException("Unknown package: " + packageName);
        }
        }
        if (pkg.isApex()) {
            throw new IllegalArgumentException("Can't dexopt APEX package: " + packageName);
        }


        Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
        Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");


+5 −0
Original line number Original line Diff line number Diff line
@@ -189,6 +189,11 @@ public class PackageDexOptimizer {
            return false;
            return false;
        }
        }


        // We do not dexopt APEX packages.
        if (pkg.isApex()) {
            return false;
        }

        // We do not dexopt unused packages.
        // We do not dexopt unused packages.
        // It's possible for this to be called before app hibernation service is ready due to
        // It's possible for this to be called before app hibernation service is ready due to
        // an OTA dexopt. In this case, we ignore the hibernation check here. This is fine since
        // an OTA dexopt. In this case, we ignore the hibernation check here. This is fine since