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

Commit afb34c51 authored by Mohammad Islam's avatar Mohammad Islam Committed by Automerger Merge Worker
Browse files

Merge "Improve logging for why a staged session was reverted" am: 55103afd

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1486201

Change-Id: I06461e3778e20d8489ce5f030e0bbdc1b3a3abf1
parents 25c392d7 55103afd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1060,7 +1060,9 @@ class PackageManagerShellCommand extends ShellCommand {
                + "; isStaged = " + session.isStaged()
                + "; isReady = " + session.isStagedSessionReady()
                + "; isApplied = " + session.isStagedSessionApplied()
                + "; isFailed = " + session.isStagedSessionFailed() + ";");
                + "; isFailed = " + session.isStagedSessionFailed()
                + "; errorMsg = " + session.getStagedSessionErrorMessage()
                + ";");
    }

    private Intent parseIntentAndUser() throws URISyntaxException {
+17 −6
Original line number Diff line number Diff line
@@ -605,13 +605,14 @@ public class StagingManager {
            // If checkpoint is supported, then we only resume sessions if we are in checkpointing
            // mode. If not, we fail all sessions.
            if (supportsCheckpoint() && !needsCheckpoint()) {
                String errorMsg = "Reverting back to safe state. Marking " + session.sessionId
                        + " as failed";
                if (!TextUtils.isEmpty(mFailureReason)) {
                    errorMsg = errorMsg + ": " + mFailureReason;
                }
                Slog.d(TAG, errorMsg);
                session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_UNKNOWN, errorMsg);
                String revertMsg = "Reverting back to safe state. Marking "
                        + session.sessionId + " as failed.";
                final String reasonForRevert = getReasonForRevert();
                if (!TextUtils.isEmpty(reasonForRevert)) {
                    revertMsg += " Reason for revert: " + reasonForRevert;
                }
                Slog.d(TAG, revertMsg);
                session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_UNKNOWN, revertMsg);
                return;
            }
        } catch (RemoteException e) {
@@ -715,6 +716,16 @@ public class StagingManager {
        }
    }

    private String getReasonForRevert() {
        if (!TextUtils.isEmpty(mFailureReason)) {
            return mFailureReason;
        }
        if (!TextUtils.isEmpty(mNativeFailureReason)) {
            return "Session reverted due to crashing native process: " + mNativeFailureReason;
        }
        return "";
    }

    private List<String> findAPKsInDir(File stageDir) {
        List<String> ret = new ArrayList<>();
        if (stageDir != null && stageDir.exists()) {