summaryrefslogtreecommitdiff
path: root/hardware_android.cc
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-10-30 11:59:45 -0700
committerdoc HD <doc.divxm@gmail.com>2020-03-31 23:21:04 +0300
commit2976ab2b5af70abcb6993b1a8f3421e49352f4e7 (patch)
tree0760640a9298a1f75376d856eb5c2cdd2c559fcd /hardware_android.cc
parentfb237888b7b99304fae05917f69074c1b9a0ac93 (diff)
Allow skipping timestamp check in certain debug conditionsq10.0
As proposed in go/ota-downgrade, the android auto team wants to install a full OTA with the older timestamp. We will only allow it on devices with userdebug build, and has the property "ro.ota.allow_downgrade" set. Data wipe is almost inevitable due to the probability of security patch level and database rollback. Test: set the property and install a full payload with older timestamp. Change-Id: I897bbb19bfec820340f791abf3c6d8138995fa90
Diffstat (limited to 'hardware_android.cc')
-rw-r--r--hardware_android.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/hardware_android.cc b/hardware_android.cc
index 21d46595..9611ba68 100644
--- a/hardware_android.cc
+++ b/hardware_android.cc
@@ -192,6 +192,13 @@ int64_t HardwareAndroid::GetBuildTimestamp() const {
return GetIntProperty<int64_t>(kPropBuildDateUTC, 0);
}
+// Returns true if the device runs an userdebug build, and explicitly allows OTA
+// downgrade.
+bool HardwareAndroid::AllowDowngrade() const {
+ return GetBoolProperty("ro.ota.allow_downgrade", false) &&
+ GetBoolProperty("ro.debuggable", false);
+}
+
bool HardwareAndroid::GetFirstActiveOmahaPingSent() const {
LOG(WARNING) << "STUB: Assuming first active omaha was never set.";
return false;