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

Commit 893fbf87 authored by Todd Kennedy's avatar Todd Kennedy Committed by android-build-merger
Browse files

Release mPackages lock earlier am: 94f9be2e

am: 2ee7053c

Change-Id: If18e59f7a4575f88d0f196b0a4fbe869644392a7
parents 18d95418 2ee7053c
Loading
Loading
Loading
Loading
+23 −22
Original line number Diff line number Diff line
@@ -93,17 +93,19 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
        if (mDexoptCommands != null) {
            throw new IllegalStateException("already called prepare()");
        }
        final List<PackageParser.Package> important;
        final List<PackageParser.Package> others;
        synchronized (mPackageManagerService.mPackages) {
            // Important: the packages we need to run with ab-ota compiler-reason.
            List<PackageParser.Package> important = PackageManagerServiceUtils.getPackagesForDexopt(
            important = PackageManagerServiceUtils.getPackagesForDexopt(
                    mPackageManagerService.mPackages.values(), mPackageManagerService);
            // Others: we should optimize this with the (first-)boot compiler-reason.
            List<PackageParser.Package> others =
                    new ArrayList<>(mPackageManagerService.mPackages.values());
            others = new ArrayList<>(mPackageManagerService.mPackages.values());
            others.removeAll(important);

            // Pre-size the array list by over-allocating by a factor of 1.5.
            mDexoptCommands = new ArrayList<>(3 * mPackageManagerService.mPackages.size() / 2);
        }

        for (PackageParser.Package p : important) {
            // Make sure that core apps are optimized according to their own "reason".
@@ -125,7 +127,6 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
            mDexoptCommands.addAll(
                    generatePackageDexopts(p, PackageManagerService.REASON_FIRST_BOOT));
        }
        }
        completeSize = mDexoptCommands.size();
    }