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:
@@ -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;
|
||||
|
||||
@@ -1150,7 +1150,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
||||
*/
|
||||
void sealAndValidateIfNecessary() {
|
||||
synchronized (mLock) {
|
||||
if (!mShouldBeSealed) {
|
||||
if (!mShouldBeSealed || isStagedAndInTerminalState()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user