metrics: Emit kAbnormalTermination if last update attempt failed.

This allows us to track how many update attempts terminates
abnormally, for example if the device is rebooted in the middle of an
update or if update_engine crashes. We use a marker state variable
(aka a "prefs" file) to keep track of this.

Note that we don't currently report any of the other metrics in the
UpdateEngine.Attempt.* namespace. If necessary, this can be changed in
the future - I left a TODO item in the code with more details.

BUG=chromium:357676
TEST=New unit tests + Unit tests pass + Manual tests.

Change-Id: I83fe284c7c46917c0c55b92314c58098e2fd1789
Reviewed-on: https://chromium-review.googlesource.com/197175
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
diff --git a/constants.cc b/constants.cc
index f094016..eec9144 100644
--- a/constants.cc
+++ b/constants.cc
@@ -21,6 +21,7 @@
 const char kSystemRebootedMarkerFile[] = "/tmp/update_engine_update_recorded";
 
 // Constants defining keys for the persisted state of update engine.
+const char kPrefsAttemptInProgress[] = "attempt-in-progress";
 const char kPrefsBackoffExpiryTime[] = "backoff-expiry-time";
 const char kPrefsCertificateReportToSendDownload[] =
     "certificate-report-to-send-download";