update_engine: Powerwash based on version

Powerwash after an update is currently enforced based on the channel: If
the new channel is more stable, powerwash happens. This may cause
unnecessary powerwash if the currently installed Chrome OS version is
old enough so that a normal update (e.g. 12817.68.0 -> 12817.76.0) can
take place.

Additionally decide whether a powerwash should take place based on the
new and old version number. Only powerwash if the new version number is
older than old version number.

BUG=chromium:1070563
TEST=FEATURES=test emerge-amd64-generic update_engine
channel change and update on test device

Change-Id: Ib211cf87711bde9f9c912395548124dcbb1194bb
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2162986
Tested-by: Miriam Polzer <mpolzer@google.com>
Commit-Queue: Miriam Polzer <mpolzer@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/omaha_request_params.h b/omaha_request_params.h
index d29ce70..3452965 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -266,8 +266,10 @@
   // or Init is called again.
   virtual void UpdateDownloadChannel();
 
-  // Returns whether we should powerwash for this update.
-  virtual bool ShouldPowerwash() const;
+  // Returns whether we should powerwash for this update. Note that this is
+  // just an indication, the final decision to powerwash or not is made in the
+  // response handler.
+  bool ShouldPowerwash() const;
 
   // Check if the provided update URL is official, meaning either the default
   // autoupdate server or the autoupdate autotest server.