From 89c80bb631d51e2d9947e9e1ccbe328b971d2476 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Thu, 2 Jun 2016 15:31:30 +0100 Subject: [PATCH] Do not update packages in encrypted state SystemServer used to run PMS.updatePackagesIfNeeded even when the device is booting in encrypted state only with core packages available. This is redundant because the packages are prebuilts (OAT files always up to date) and the data partition is not mounted yet, so we are only wasting time opening the OAT files and testing checksums. Additionally, the attempt to update these packages gets reported to TRON stats as time spent in the Optimizing Apps dialog and skews the results. This patch does not call updatePackagesIfNeeded when in the device is in encrypted state. Bug: 28833829 Change-Id: I8641d07a8840948ffe261dfb8f99f70de7341972 --- services/java/com/android/server/SystemServer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index eed4351b92872..476a559eaea3f 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -701,13 +701,15 @@ 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); + if (!mOnlyCore) { + 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.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER); Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "PerformFstrimIfNeeded"); try {