Move OTA package update before fstrim, hide "Optimizing apps" dialog

This patch moves the updating of packages before performing fstrim,
which runs asynchronously anyway, and stops showing the UI dialog.

Bug: 27350503
Change-Id: I6fceda10d7696f9badb97978fb9dc7927d698a4b
This commit is contained in:
David Brazdil
2016-03-30 11:45:52 +01:00
parent 6b69b12202
commit f5c444ffd4
3 changed files with 12 additions and 22 deletions

View File

@@ -437,10 +437,9 @@ interface IPackageManager {
void performFstrimIfNeeded();
/**
* Ask the package manager to extract packages if needed, to save
* the VM unzipping the APK in memory during launch.
* Ask the package manager to update packages if needed.
*/
void extractPackagesIfNeeded();
void updatePackagesIfNeeded();
/**
* Notify the package manager that a package is going to be used.

View File

@@ -6926,8 +6926,8 @@ public class PackageManagerService extends IPackageManager.Stub {
}
@Override
public void extractPackagesIfNeeded() {
enforceSystemOrRoot("Only the system can request package extraction");
public void updatePackagesIfNeeded() {
enforceSystemOrRoot("Only the system can request package update");
// We need to re-extract after an OTA.
boolean causeUpgrade = isUpgrade();
@@ -6958,15 +6958,6 @@ public class PackageManagerService extends IPackageManager.Stub {
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 the cache was pruned, any compiled odex files will likely be out of date
// and would have to be patched (would be SELF_PATCHOAT, which is deprecated).

View File

@@ -697,6 +697,14 @@ public final class SystemServer {
// as appropriate.
mSystemServiceManager.startService(UiModeManagerService.class);
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "UpdatePackagesIfNeeded");
try {
mPackageManagerService.updatePackagesIfNeeded();
} catch (Throwable e) {
reportWtf("update packages", e);
}
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "PerformFstrimIfNeeded");
try {
mPackageManagerService.performFstrimIfNeeded();
@@ -705,14 +713,6 @@ public final class SystemServer {
}
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "ExtractPackagesIfNeeded");
try {
mPackageManagerService.extractPackagesIfNeeded();
} catch (Throwable e) {
reportWtf("extract packages", e);
}
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
try {
ActivityManagerNative.getDefault().showBootMessage(
context.getResources().getText(