Avoid reverting apex on devices that do not support updating apex

Bug: 151402767
Test: built with OVERRIDE_TARGET_FLATTEN_APEX=true and then ran
atest StagedInstallTest#testInstallMultipleStagedSession_PartialFail_ApkOnly

Change-Id: Ice0cf48cbea87b3aec1906cb42e1739487fcc19f
This commit is contained in:
Mohammad Samiul Islam
2020-05-04 16:36:01 +01:00
parent 98f012c304
commit 5bf077de26

View File

@@ -350,13 +350,19 @@ public class StagingManager {
Slog.e(TAG, "Aborting checkpoint: " + errorMsg);
try {
if (supportsCheckpoint() && needsCheckpoint()) {
mApexManager.revertActiveSessions();
// Only revert apex sessions if device supports updating apex
if (mApexManager.isApexSupported()) {
mApexManager.revertActiveSessions();
}
PackageHelper.getStorageManager().abortChanges(
"StagingManager initiated", false /*retry*/);
}
} catch (Exception e) {
Slog.wtf(TAG, "Failed to abort checkpoint", e);
mApexManager.revertActiveSessions();
// Only revert apex sessions if device supports updating apex
if (mApexManager.isApexSupported()) {
mApexManager.revertActiveSessions();
}
mPowerManager.reboot(null);
}
}