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

am: 65698a9638

* commit '65698a963822590180af3cd82a4e869f6aa94730':
  Revive the "Optimizing apps" dialog
This commit is contained in:
Nicolas Geoffray
2016-02-23 18:12:05 +00:00
committed by android-build-merger

View File

@@ -6829,17 +6829,37 @@ public class PackageManagerService extends IPackageManager.Stub {
// Extract pacakges only if profile-guided compilation is enabled because
// otherwise BackgroundDexOptService will not dexopt them later.
if (mUseJitProfiles) {
List<PackageParser.Package> pkgs;
synchronized (mPackages) {
pkgs = PackageManagerServiceUtils.getPackagesForDexopt(mPackages.values(), this);
if (!mUseJitProfiles || !isUpgrade()) {
return;
}
List<PackageParser.Package> pkgs;
synchronized (mPackages) {
pkgs = PackageManagerServiceUtils.getPackagesForDexopt(mPackages.values(), this);
}
int curr = 0;
int total = pkgs.size();
for (PackageParser.Package pkg : pkgs) {
curr++;
if (DEBUG_DEXOPT) {
Log.i(TAG, "Extracting app " + curr + " of " + total + ": " + pkg.packageName);
}
for (PackageParser.Package pkg : pkgs) {
if (PackageDexOptimizer.canOptimizePackage(pkg)) {
performDexOpt(pkg.packageName, null /* instructionSet */,
false /* useProfiles */, true /* extractOnly */, false /* force */);
if (!isFirstBoot()) {
try {
ActivityManagerNative.getDefault().showBootMessage(
mContext.getResources().getString(R.string.android_upgrading_apk,
curr, total), true);
} catch (RemoteException e) {
}
}
if (PackageDexOptimizer.canOptimizePackage(pkg)) {
performDexOpt(pkg.packageName, null /* instructionSet */,
false /* useProfiles */, true /* extractOnly */, false /* force */);
}
}
}