Merge "Skip _oem_props if oem_dicts is None."

This commit is contained in:
Treehugger Robot 2020-05-04 18:54:35 +00:00 committed by Gerrit Code Review
commit 6464edbf3e
2 changed files with 6 additions and 7 deletions

View file

@ -361,10 +361,13 @@ class BuildInfo(object):
self.oem_dicts = oem_dicts
self._is_ab = info_dict.get("ab_update") == "true"
self._oem_props = info_dict.get("oem_fingerprint_properties")
if self._oem_props:
assert oem_dicts, "OEM source required for this build"
# Skip _oem_props if oem_dicts is None to use BuildInfo in
# sign_target_files_apks
if self.oem_dicts:
self._oem_props = info_dict.get("oem_fingerprint_properties")
else:
self._oem_props = None
def check_fingerprint(fingerprint):
if (" " in fingerprint or any(ord(ch) > 127 for ch in fingerprint)):

View file

@ -176,10 +176,6 @@ class BuildInfoTest(test_utils.ReleaseToolsTestCase):
self.assertEqual('brand3/product-name/device3:build-thumbprint',
target_info.fingerprint)
# Missing oem_dict should be rejected.
self.assertRaises(AssertionError, common.BuildInfo,
self.TEST_INFO_DICT_USES_OEM_PROPS, None)
def test_init_badFingerprint(self):
info_dict = copy.deepcopy(self.TEST_INFO_DICT)
info_dict['build.prop']['ro.build.fingerprint'] = 'bad fingerprint'