Prevent sessions from resuming once boot is completed

This will prevent sessions from resuming when system server crashes or
restarted.

Bug: 158283778
Test: staged a session and crashed system server to verify session stays
      unchanged
Test: atest StagedInstallInternalTest
Test: atest StagedInstallTest
Change-Id: I99337ea2898cfdf2cc515819b4f5b5db4b038f31
Merged-In: I99337ea2898cfdf2cc515819b4f5b5db4b038f31
This commit is contained in:
Mohammad Samiul Islam
2020-06-10 18:00:24 +01:00
parent 533c3deb7b
commit 739300762b

View File

@@ -44,6 +44,7 @@ import android.os.ParcelableException;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Slog;
import android.util.SparseArray;
import android.util.apk.ApkSignatureVerifier;
@@ -657,6 +658,11 @@ public class StagingManager {
}
private void checkStateAndResume(@NonNull PackageInstallerSession session) {
// Do not resume session if boot completed already
if (SystemProperties.getBoolean("sys.boot_completed", false)) {
return;
}
if (!session.isCommitted()) {
// Session hasn't been committed yet, ignore.
return;