Now #mStagedSessions stores only parent sessions (4/n)
1. Don't store sessions until #commitSession or #restoreSession is called. 2. The stored sessions will be used by pre-reboot verification to check overlapping later. Bug: 168268518 Test: atest StagedInstallTest Change-Id: I945d2b92d9194f89493adf616231f8438b1c10b6
This commit is contained in:
@@ -746,9 +746,6 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
||||
synchronized (mSessions) {
|
||||
mSessions.put(sessionId, session);
|
||||
}
|
||||
if (params.isStaged) {
|
||||
mStagingManager.createSession(session);
|
||||
}
|
||||
|
||||
mCallbacks.notifySessionCreated(session.sessionId, session.userId);
|
||||
|
||||
|
||||
@@ -828,6 +828,8 @@ public class StagingManager {
|
||||
}
|
||||
|
||||
void commitSession(@NonNull PackageInstallerSession session) {
|
||||
// Store this parent session which will be used to check overlapping later
|
||||
createSession(session);
|
||||
mPreRebootVerificationHandler.startPreRebootVerification(session);
|
||||
}
|
||||
|
||||
@@ -930,7 +932,7 @@ public class StagingManager {
|
||||
}
|
||||
}
|
||||
|
||||
void createSession(@NonNull PackageInstallerSession sessionInfo) {
|
||||
private void createSession(@NonNull PackageInstallerSession sessionInfo) {
|
||||
synchronized (mStagedSessions) {
|
||||
mStagedSessions.append(sessionInfo.sessionId, sessionInfo);
|
||||
}
|
||||
@@ -1006,16 +1008,15 @@ public class StagingManager {
|
||||
}
|
||||
|
||||
void restoreSession(@NonNull PackageInstallerSession session, boolean isDeviceUpgrading) {
|
||||
PackageInstallerSession sessionToResume = session;
|
||||
synchronized (mStagedSessions) {
|
||||
mStagedSessions.append(session.sessionId, session);
|
||||
if (session.hasParentSessionId()) {
|
||||
// Only parent sessions can be restored
|
||||
return;
|
||||
}
|
||||
if (session.hasParentSessionId()) {
|
||||
// Only parent sessions can be restored
|
||||
return;
|
||||
}
|
||||
// Store this parent session which will be used to check overlapping later
|
||||
createSession(session);
|
||||
// The preconditions used during pre-reboot verification might have changed when device
|
||||
// is upgrading. Updated staged sessions to activation failed before we resume the session.
|
||||
PackageInstallerSession sessionToResume = session;
|
||||
if (isDeviceUpgrading && !sessionToResume.isStagedAndInTerminalState()) {
|
||||
sessionToResume.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
||||
"Build fingerprint has changed");
|
||||
|
||||
Reference in New Issue
Block a user