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

Commit 6b9b10ed authored by Nikita Ioffe's avatar Nikita Ioffe Committed by Android (Google) Code Review
Browse files

Merge "Abort apexd session only if staged session contains apex"

parents 6b6f5b6d e2d52f57
Loading
Loading
Loading
Loading
+12 −10
Original line number Original line Diff line number Diff line
@@ -498,19 +498,21 @@ public class StagingManager {
            Slog.w(TAG, "Cannot abort applied session!");
            Slog.w(TAG, "Cannot abort applied session!");
            return;
            return;
        }
        }
        if (isStagedSessionFinalized(session.sessionId)) {
        abortSession(session);
            Slog.w(TAG, "Cannot abort session because it is not active or APEXD is not reachable");

        boolean hasApex = sessionContainsApex(session);
        if (hasApex) {
            ApexSessionInfo apexSession = mApexManager.getStagedSessionInfo(session.sessionId);
            if (apexSession == null || isApexSessionFinalized(apexSession)) {
                Slog.w(TAG,
                        "Cannot abort session because it is not active or APEXD is not reachable");
                return;
                return;
            }
            }

            mApexManager.abortActiveSession();
            mApexManager.abortActiveSession();

        }
        abortSession(session);
    }
    }


    private boolean isStagedSessionFinalized(int sessionId) {
    private boolean isApexSessionFinalized(ApexSessionInfo session) {
        ApexSessionInfo session = mApexManager.getStagedSessionInfo(sessionId);

        /* checking if the session is in a final state, i.e., not active anymore */
        /* checking if the session is in a final state, i.e., not active anymore */
        return session.isUnknown || session.isActivationFailed || session.isSuccess
        return session.isUnknown || session.isActivationFailed || session.isSuccess
                || session.isRolledBack;
                || session.isRolledBack;