Merge "Add a default error code when updater script aborts"

am: 89394632b1

Change-Id: Iceebf87fb62b1c2a23e20c2b4966606c0c7b0a72
This commit is contained in:
Tianjie Xu
2017-05-03 17:40:41 +00:00
committed by android-build-merger
2 changed files with 10 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ enum ErrorCode {
kZipOpenFailure,
kBootreasonInBlacklist,
kPackageCompatibilityFailure,
kScriptExecutionFailure,
};
enum CauseCode {

View File

@@ -193,13 +193,15 @@ int main(int argc, char** argv) {
}
}
if (state.error_code != kNoError) {
fprintf(cmd_pipe, "log error: %d\n", state.error_code);
// Cause code should provide additional information about the abort;
// report only when an error exists.
if (state.cause_code != kNoCause) {
fprintf(cmd_pipe, "log cause: %d\n", state.cause_code);
}
// Installation has been aborted. Set the error code to kScriptExecutionFailure unless
// a more specific code has been set in errmsg.
if (state.error_code == kNoError) {
state.error_code = kScriptExecutionFailure;
}
fprintf(cmd_pipe, "log error: %d\n", state.error_code);
// Cause code should provide additional information about the abort.
if (state.cause_code != kNoCause) {
fprintf(cmd_pipe, "log cause: %d\n", state.cause_code);
}
if (updater_info.package_zip) {