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

Commit 2cbf51ce authored by Nicolas Geoffray's avatar Nicolas Geoffray Committed by android-build-merger
Browse files

Merge "Revive the "Optimizing apps" dialog" into nyc-dev

am: 65698a96

* commit '65698a96':
  Revive the "Optimizing apps" dialog
parents 40eb552b 65698a96
Loading
Loading
Loading
Loading
+28 −8
Original line number Original line Diff line number Diff line
@@ -6829,19 +6829,39 @@ public class PackageManagerService extends IPackageManager.Stub {
        // Extract pacakges only if profile-guided compilation is enabled because
        // Extract pacakges only if profile-guided compilation is enabled because
        // otherwise BackgroundDexOptService will not dexopt them later.
        // otherwise BackgroundDexOptService will not dexopt them later.
        if (mUseJitProfiles) {
        if (!mUseJitProfiles || !isUpgrade()) {
            return;
        }
        List<PackageParser.Package> pkgs;
        List<PackageParser.Package> pkgs;
        synchronized (mPackages) {
        synchronized (mPackages) {
            pkgs = PackageManagerServiceUtils.getPackagesForDexopt(mPackages.values(), this);
            pkgs = PackageManagerServiceUtils.getPackagesForDexopt(mPackages.values(), this);
        }
        }
        int curr = 0;
        int total = pkgs.size();
        for (PackageParser.Package pkg : pkgs) {
        for (PackageParser.Package pkg : pkgs) {
            curr++;
            if (DEBUG_DEXOPT) {
                Log.i(TAG, "Extracting app " + curr + " of " + total + ": " + pkg.packageName);
            }
            if (!isFirstBoot()) {
                try {
                    ActivityManagerNative.getDefault().showBootMessage(
                            mContext.getResources().getString(R.string.android_upgrading_apk,
                                    curr, total), true);
                } catch (RemoteException e) {
                }
            }
            if (PackageDexOptimizer.canOptimizePackage(pkg)) {
            if (PackageDexOptimizer.canOptimizePackage(pkg)) {
                performDexOpt(pkg.packageName, null /* instructionSet */,
                performDexOpt(pkg.packageName, null /* instructionSet */,
                         false /* useProfiles */, true /* extractOnly */, false /* force */);
                         false /* useProfiles */, true /* extractOnly */, false /* force */);
            }
            }
        }
        }
    }
    }
    }
    @Override
    @Override
    public void notifyPackageUse(String packageName) {
    public void notifyPackageUse(String packageName) {