Fix str/bytes type error in ReplaceOtaKeys
ZipFile.read() returns byte sequence, while re.match expects str.
Decode the bytes read first.
Test: th
Bug: 315855025
Change-Id: Id2da071f3caeab56cfac845a9e4f842c4e102f49
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 9573148..96e9a32 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -1156,9 +1156,9 @@
common.ZipWriteStr(output_zip, filename, temp_file.getvalue())
-def ReplaceOtaKeys(input_tf_zip, output_tf_zip, misc_info):
+def ReplaceOtaKeys(input_tf_zip: zipfile.ZipFile, output_tf_zip, misc_info):
try:
- keylist = input_tf_zip.read("META/otakeys.txt").split()
+ keylist = input_tf_zip.read("META/otakeys.txt").decode().split()
except KeyError:
raise common.ExternalError("can't read META/otakeys.txt from input")