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

Commit 337e4026 authored by Geremy Condra's avatar Geremy Condra Committed by Android Git Automerger
Browse files

am c31f5a7e: Merge "Add error information to event logs." into jb-mr1-dev

* commit 'c31f5a7e':
  Add error information to event logs.
parents 87c86a93 c31f5a7e
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -89,12 +89,15 @@ public class ConfigUpdateInstallReceiver extends BroadcastReceiver {
                    // get the hash of the currently used value
                    String currentHash = getCurrentHash(getCurrentContent());
                    if (!verifyVersion(currentVersion, altVersion)) {
                        Slog.e(TAG, "New version is not greater than current version, aborting!");
                        EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
                                            "New version is not greater than current version");
                    } else if (!verifyPreviousHash(currentHash, altRequiredHash)) {
                        Slog.e(TAG, "Current hash did not match required value, aborting!");
                        EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
                                            "Current hash did not match required value");
                    } else if (!verifySignature(altContent, altVersion, altRequiredHash, altSig,
                               cert)) {
                        Slog.e(TAG, "Signature did not verify, aborting!");
                        EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
                                            "Signature did not verify");
                    } else {
                        // install the new content
                        Slog.i(TAG, "Found new update, installing...");
@@ -103,8 +106,12 @@ public class ConfigUpdateInstallReceiver extends BroadcastReceiver {
                    }
                } catch (Exception e) {
                    Slog.e(TAG, "Could not update content!", e);
                    EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED,
                                        updateDir.toString());
                    // keep the error message <= 100 chars
                    String errMsg = e.toString();
                    if (errMsg.length() > 100) {
                        errMsg = errMsg.substring(0, 99);
                    }
                    EventLog.writeEvent(EventLogTags.CONFIG_INSTALL_FAILED, errMsg);
                }
            }
        }.start();