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

Commit 3f520b19 authored by Winson's avatar Winson
Browse files

Null check package for DexOptHelper

A package can be null if the APK storage has been ejected
or the package install was orphaned via bad parse.

This might've been broken in the refactor when this was
moved to PackageState.

Bug: 217395249

Change-Id: I6353f1832abe502a448991cdb399f7d15c8e9d1f
parent 0891d4b3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -293,7 +293,8 @@ final class DexOptHelper {
    public ArraySet<String> getOptimizablePackages() {
        ArraySet<String> pkgs = new ArraySet<>();
        mPm.forEachPackageState(packageState -> {
            if (mPm.mPackageDexOptimizer.canOptimizePackage(packageState.getPkg())) {
            final AndroidPackage pkg = packageState.getPkg();
            if (pkg != null && mPm.mPackageDexOptimizer.canOptimizePackage(pkg)) {
                pkgs.add(packageState.getPackageName());
            }
        });
+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ public class PackageDexOptimizer {
        mInjector = injector;
    }

    boolean canOptimizePackage(AndroidPackage pkg) {
    boolean canOptimizePackage(@NonNull AndroidPackage pkg) {
        // We do not dexopt a package with no code.
        // Note that the system package is marked as having no code, however we can
        // still optimize it via dexoptSystemServerPath.