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 1f6b99d5fa
commit a922531124

View File

@@ -53,6 +53,7 @@ import android.os.ParcelableException;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManagerInternal;
import android.os.storage.IStorageManager;
@@ -1155,6 +1156,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;