From 2aa982583b2a8acf6ec05e4e0e2fe62f17624b21 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Wed, 3 Mar 2021 14:39:24 +0800 Subject: [PATCH] Populate fields for committed staged sessions Those fields are needed for pre-reboot verification and installation after reboot. Bug: 181731810 Test: atest StagedInstallTest StagedInstallInternalTest Test: 1. `adb install --staged SOMEAPP` 2. reboot the device before the session reaches READY 3. `adb shell pm list staged-sessions` after boot completed 4. check the session is READY instead of FAILED Change-Id: I3de3336cdfac9b925ba6ebb981db773e3a566047 --- .../com/android/server/pm/PackageInstallerSession.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java index 7bf3c5c1f4c93..2a0a487c9d78e 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerSession.java +++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java @@ -2086,15 +2086,16 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { try { sealLocked(); - // Session that are staged, ready and not multi package will be installed during - // this boot. As such, we need populate all the fields for successful installation. - if (isMultiPackage()) { + // Session that are staged, committed and not multi package will be installed or + // restart verification during this boot. As such, we need populate all the fields + // for successful installation. + if (isMultiPackage() || !isStaged() || !isCommitted()) { return; } final PackageInstallerSession root = hasParentSessionId() ? allSessions.get(getParentSessionId()) : this; - if (root != null && root.isStagedSessionReady()) { + if (root != null) { if (isApexSession()) { validateApexInstallLocked(); } else {