Skip to content

Commit c31f5a7

Browse files
gcondraAndroid (Google) Code Review
authored andcommitted
Merge "Add error information to event logs." into jb-mr1-dev
2 parents 417e267 + beb9d53 commit c31f5a7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

services/java/com/android/server/updatable/ConfigUpdateInstallReceiver.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,15 @@ public void run() {
8989
// get the hash of the currently used value
9090
String currentHash = getCurrentHash(getCurrentContent());
9191
if (!verifyVersion(currentVersion, altVersion)) {
92-
Slog.e(TAG, "New version is not greater than current version, aborting!");
92+
EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
93+
"New version is not greater than current version");
9394
} else if (!verifyPreviousHash(currentHash, altRequiredHash)) {
94-
Slog.e(TAG, "Current hash did not match required value, aborting!");
95+
EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
96+
"Current hash did not match required value");
9597
} else if (!verifySignature(altContent, altVersion, altRequiredHash, altSig,
9698
cert)) {
97-
Slog.e(TAG, "Signature did not verify, aborting!");
99+
EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
100+
"Signature did not verify");
98101
} else {
99102
// install the new content
100103
Slog.i(TAG, "Found new update, installing...");
@@ -103,8 +106,12 @@ public void run() {
103106
}
104107
} catch (Exception e) {
105108
Slog.e(TAG, "Could not update content!", e);
106-
EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
107-
updateDir.toString());
109+
// keep the error message <= 100 chars
110+
String errMsg = e.toString();
111+
if (errMsg.length() > 100) {
112+
errMsg = errMsg.substring(0, 99);
113+
}
114+
EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED, errMsg);
108115
}
109116
}
110117
}.start();

0 commit comments

Comments
 (0)