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
This commit is contained in:
@@ -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());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user