Always restore staged sessions on boot.

The current logic doesn't restore sessions unless they are "in flight".
We want staged session to stick around until they expire after
MAX_TIME_SINCE_UPDATE_MILLIS.

Bug: 131290871
Test: atest CtsStagedInstallHostTestCases (with modifications coming in
a separate CL)

Change-Id: Ifaccf50e744a97e30a4fda0e47b88d7dc71adcf8
This commit is contained in:
Dario Freni
2019-05-02 15:46:03 +01:00
parent 60d2586b2c
commit f2449f7c5c
2 changed files with 2 additions and 3 deletions

View File

@@ -363,8 +363,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
System.currentTimeMillis() - session.getUpdatedMillis();
final boolean valid;
if (session.isStaged()) {
if (timeSinceUpdate >= MAX_TIME_SINCE_UPDATE_MILLIS
&& session.isStagedAndInTerminalState()) {
if (timeSinceUpdate >= MAX_TIME_SINCE_UPDATE_MILLIS) {
valid = false;
} else {
valid = true;

View File

@@ -1150,7 +1150,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
*/
void sealAndValidateIfNecessary() {
synchronized (mLock) {
if (!mShouldBeSealed) {
if (!mShouldBeSealed || isStagedAndInTerminalState()) {
return;
}
}