Merge "Improve logging for failed scenario in staged install flow" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
45019d2f93
@@ -331,7 +331,8 @@ public class StagingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reverts apex sessions and user data (if checkpoint is supported). Also reboots the device.
|
// Reverts apex sessions and user data (if checkpoint is supported). Also reboots the device.
|
||||||
private void abortCheckpoint() {
|
private void abortCheckpoint(String errorMsg) {
|
||||||
|
Slog.e(TAG, "Aborting checkpoint: " + errorMsg);
|
||||||
try {
|
try {
|
||||||
if (supportsCheckpoint() && needsCheckpoint()) {
|
if (supportsCheckpoint() && needsCheckpoint()) {
|
||||||
mApexManager.revertActiveSessions();
|
mApexManager.revertActiveSessions();
|
||||||
@@ -504,6 +505,8 @@ public class StagingManager {
|
|||||||
// mode. If not, we fail all sessions.
|
// mode. If not, we fail all sessions.
|
||||||
if (supportsCheckpoint() && !needsCheckpoint()) {
|
if (supportsCheckpoint() && !needsCheckpoint()) {
|
||||||
// TODO(b/146343545): Persist failure reason across checkpoint reboot
|
// TODO(b/146343545): Persist failure reason across checkpoint reboot
|
||||||
|
Slog.d(TAG, "Reverting back to safe state. Marking " + session.sessionId
|
||||||
|
+ " as failed.");
|
||||||
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_UNKNOWN,
|
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_UNKNOWN,
|
||||||
"Reverting back to safe state");
|
"Reverting back to safe state");
|
||||||
return;
|
return;
|
||||||
@@ -524,26 +527,29 @@ public class StagingManager {
|
|||||||
|
|
||||||
if (hasApex) {
|
if (hasApex) {
|
||||||
if (apexSessionInfo == null) {
|
if (apexSessionInfo == null) {
|
||||||
|
String errorMsg = "apexd did not know anything about a staged session supposed to"
|
||||||
|
+ " be activated";
|
||||||
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
||||||
"apexd did not know anything about a staged session supposed to be"
|
errorMsg);
|
||||||
+ "activated");
|
abortCheckpoint(errorMsg);
|
||||||
abortCheckpoint();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isApexSessionFailed(apexSessionInfo)) {
|
if (isApexSessionFailed(apexSessionInfo)) {
|
||||||
|
String errorMsg = "APEX activation failed. Check logcat messages from apexd for "
|
||||||
|
+ "more information.";
|
||||||
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
||||||
"APEX activation failed. Check logcat messages from apexd for "
|
errorMsg);
|
||||||
+ "more information.");
|
abortCheckpoint(errorMsg);
|
||||||
abortCheckpoint();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!apexSessionInfo.isActivated && !apexSessionInfo.isSuccess) {
|
if (!apexSessionInfo.isActivated && !apexSessionInfo.isSuccess) {
|
||||||
// Apexd did not apply the session for some unknown reason. There is no guarantee
|
// Apexd did not apply the session for some unknown reason. There is no guarantee
|
||||||
// that apexd will install it next time. Safer to proactively mark as failed.
|
// that apexd will install it next time. Safer to proactively mark as failed.
|
||||||
|
String errorMsg = "Staged session " + session.sessionId + "at boot didn't "
|
||||||
|
+ "activate nor fail. Marking it as failed anyway.";
|
||||||
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
||||||
"Staged session " + session.sessionId + "at boot didn't "
|
errorMsg);
|
||||||
+ "activate nor fail. Marking it as failed anyway.");
|
abortCheckpoint(errorMsg);
|
||||||
abortCheckpoint();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
snapshotAndRestoreForApexSession(session);
|
snapshotAndRestoreForApexSession(session);
|
||||||
@@ -556,7 +562,7 @@ public class StagingManager {
|
|||||||
installApksInSession(session);
|
installApksInSession(session);
|
||||||
} catch (PackageManagerException e) {
|
} catch (PackageManagerException e) {
|
||||||
session.setStagedSessionFailed(e.error, e.getMessage());
|
session.setStagedSessionFailed(e.error, e.getMessage());
|
||||||
abortCheckpoint();
|
abortCheckpoint(e.getMessage());
|
||||||
|
|
||||||
// If checkpoint is not supported, we have to handle failure for one staged session.
|
// If checkpoint is not supported, we have to handle failure for one staged session.
|
||||||
if (!hasApex) {
|
if (!hasApex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user