update_engine: Added ability to retrieve old version via DBus
Now it is possible to retrieve an old OS version that was in use
before the last reboot, provided that we are now booted into
an updated version. This is to be used by crash reporter in case
the reboot was caused by a crash in kernel while reboot was pending
for an update. In such a scenario, the crash would be attributed
to the current (updated) version, which is wrong.
Also added additional parameter, --old_version, to
update_engine_client to retrieve the old version number, if any,
from the update engine.
BUG=chrome-os-partner:26518
TEST=cros deploy and tested via update_engine_client
Change-Id: I84e2322c5698b44b4c77f25c8f4211cdb367e5dc
Reviewed-on: https://chromium-review.googlesource.com/190149
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/update_attempter.h b/update_attempter.h
index 216d3c1..425d8ed 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -187,6 +187,11 @@
// successful update. Returns false if the device has not updated.
bool GetBootTimeAtUpdate(base::Time *out_boot_time);
+ // Returns a version OS version that was being used before the last reboot,
+ // and if that reboot happended to be into an update (current version).
+ // This will return an empty string otherwise.
+ std::string const& GetPrevVersion() const { return prev_version_; }
+
private:
// Update server URL for automated lab test.
static const char* const kTestUpdateUrl;
@@ -395,6 +400,7 @@
UpdateStatus status_;
double download_progress_;
int64_t last_checked_time_;
+ std::string prev_version_;
std::string new_version_;
int64_t new_payload_size_;