Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bf077de authored by Mohammad Samiul Islam's avatar Mohammad Samiul Islam
Browse files

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
parent 98f012c3
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -350,13 +350,19 @@ public class StagingManager {
        Slog.e(TAG, "Aborting checkpoint: " + errorMsg);
        try {
            if (supportsCheckpoint() && needsCheckpoint()) {
                // 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);
            // Only revert apex sessions if device supports updating apex
            if (mApexManager.isApexSupported()) {
                mApexManager.revertActiveSessions();
            }
            mPowerManager.reboot(null);
        }
    }