releasetools: Sanity check the build fingerprint.
Bug: 140298338 Test: python -m unittest test_ota_from_target_files Change-Id: I4add5f82d5b684c441b0484732da6991f8e7301a
This commit is contained in:
@@ -299,6 +299,9 @@ class BuildInfo(object):
|
||||
that it always uses the first dict to calculate the fingerprint or the
|
||||
device name. The rest would be used for asserting OEM properties only
|
||||
(e.g. one package can be installed on one of these devices).
|
||||
|
||||
Raises:
|
||||
ValueError: On invalid inputs.
|
||||
"""
|
||||
self.info_dict = info_dict
|
||||
self.oem_dicts = oem_dicts
|
||||
@@ -313,6 +316,13 @@ class BuildInfo(object):
|
||||
self._device = self.GetOemProperty("ro.product.device")
|
||||
self._fingerprint = self.CalculateFingerprint()
|
||||
|
||||
# Sanity check the build fingerprint.
|
||||
if (' ' in self._fingerprint or
|
||||
any(ord(ch) > 127 for ch in self._fingerprint)):
|
||||
raise ValueError(
|
||||
'Invalid build fingerprint: "{}". See the requirement in Android CDD '
|
||||
'3.2.2. Build Parameters.'.format(self._fingerprint))
|
||||
|
||||
@property
|
||||
def is_ab(self):
|
||||
return self._is_ab
|
||||
|
Reference in New Issue
Block a user