Prevent exceptions in pre-reboot verification from crashing system server
An unhandled exception during pre-reboot verification will cause system server to crash and restart. Instead of allowing the exception to crash the system server, we now catch it and fail the corresponding staged session with appropriate message. Bug: 170784748 Test: manual Test: verified that without this fix, any unhandled exception crashes the system server. Change-Id: If100796687906be67bc02ea63a78e1b6e291ce7a
This commit is contained in:
@@ -1059,19 +1059,26 @@ public class StagingManager {
|
||||
onPreRebootVerificationComplete(session);
|
||||
return;
|
||||
}
|
||||
switch (msg.what) {
|
||||
case MSG_PRE_REBOOT_VERIFICATION_START:
|
||||
handlePreRebootVerification_Start(session);
|
||||
break;
|
||||
case MSG_PRE_REBOOT_VERIFICATION_APEX:
|
||||
handlePreRebootVerification_Apex(session, rollbackId);
|
||||
break;
|
||||
case MSG_PRE_REBOOT_VERIFICATION_APK:
|
||||
handlePreRebootVerification_Apk(session);
|
||||
break;
|
||||
case MSG_PRE_REBOOT_VERIFICATION_END:
|
||||
handlePreRebootVerification_End(session);
|
||||
break;
|
||||
try {
|
||||
switch (msg.what) {
|
||||
case MSG_PRE_REBOOT_VERIFICATION_START:
|
||||
handlePreRebootVerification_Start(session);
|
||||
break;
|
||||
case MSG_PRE_REBOOT_VERIFICATION_APEX:
|
||||
handlePreRebootVerification_Apex(session, rollbackId);
|
||||
break;
|
||||
case MSG_PRE_REBOOT_VERIFICATION_APK:
|
||||
handlePreRebootVerification_Apk(session);
|
||||
break;
|
||||
case MSG_PRE_REBOOT_VERIFICATION_END:
|
||||
handlePreRebootVerification_End(session);
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Slog.e(TAG, "Pre-reboot verification failed due to unhandled exception", e);
|
||||
onPreRebootVerificationFailure(session,
|
||||
SessionInfo.STAGED_SESSION_ACTIVATION_FAILED,
|
||||
"Pre-reboot verification failed due to unhandled exception: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user