Revert "Revert "releasetools: Support OTAs that have OEM properties changes.""

This CL fixes the bug in [1] (copy-paste error) and reenables it.

We need to handle a special case that an OTA goes from a source build
without OEM properties to a target build with those properties (or vice
versa). Add support in OTA scripts to deal the case properly, by a)
using two oem_props variables to handle source and target builds
respectively; b) adjusting the fingerprint/thumbprint assertions to
allow a mix of both.

[1] commit c086370440

Change-Id: I98118d77d5a0ff694fa1ee33602b5ee5e048599b
This commit is contained in:
Tao Bao
2016-03-15 13:20:19 -07:00
parent 3c37889299
commit 3e30d97dde
2 changed files with 67 additions and 40 deletions

View File

@@ -118,6 +118,17 @@ class EdifyGenerator(object):
" or ".join(fp))
self.script.append(cmd)
def AssertFingerprintOrThumbprint(self, fp, tp):
"""Assert that the current recovery build fingerprint is fp, or thumbprint
is tp."""
cmd = ('getprop("ro.build.fingerprint") == "{fp}" ||\n'
' getprop("ro.build.thumbprint") == "{tp}" ||\n'
' abort("Package expects build fingerprint of {fp} or '
'thumbprint of {tp}; this device has a fingerprint of " '
'+ getprop("ro.build.fingerprint") and a thumbprint of " '
'+ getprop("ro.build.thumbprint") + ".");').format(fp=fp, tp=tp)
self.script.append(cmd)
def AssertOlderBuild(self, timestamp, timestamp_text):
"""Assert that the build on the device is older (or the same as)
the given timestamp."""