Resign apks contained in apex

Some apex payload images contain apk files. And these apks need to be
signed during the signing processed when sign_target_files_apks is
called. To support the signing, we can extract the payload and repack
the apex file with the (de)apexer tool. Add the signing support in the
apex_util.

Bug: 146508800
Test: unit tests pass, run sign_apex, sign_target_files_apks
Change-Id: If6d58975248709a144b07dbabf47c27916e5695e
This commit is contained in:
Tianjie Xu
2020-01-23 10:47:54 -08:00
parent eb8a0a0036
commit 88a759d651
7 changed files with 213 additions and 10 deletions

View File

@@ -41,3 +41,19 @@ class SignApexTest(test_utils.ReleaseToolsTestCase):
container_key,
False)
self.assertTrue(os.path.exists(signed_foo_apex))
@test_utils.SkipIfExternalToolsUnavailable()
def test_SignApexWithApk(self):
test_apex = os.path.join(self.testdata_dir, 'has_apk.apex')
payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
container_key = os.path.join(self.testdata_dir, 'testkey')
apk_keys = {'wifi-service-resources.apk': os.path.join(
self.testdata_dir, 'testkey')}
signed_test_apex = sign_apex.SignApexFile(
'avbtool',
test_apex,
payload_key,
container_key,
False,
apk_keys)
self.assertTrue(os.path.exists(signed_test_apex))