Revert "Only allow setting presigned without preprocessed on targetSdk < 30"

This reverts commit 6158528e15.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_udc-d1-dev-plus-aosp&target=aosp_bramble-trunk_staging-userdebug&lkgb=10771573&lkbb=10771600&fkbb=10771587, bug https://buganizer.corp.google.com/issues/299369971

BUG: 299369971

Change-Id: I6bf6eb5c0fb9e30197e145121adc7ed58871526f
This commit is contained in:
Karl Shaffer
2023-09-07 00:49:34 +00:00
parent 6158528e15
commit d293e28f52
7 changed files with 30 additions and 81 deletions

View File

@@ -1,30 +0,0 @@
#!/usr/bin/env python3
import subprocess
import argparse
import re
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument('aapt2', help = "the path to the aapt2 executable")
parser.add_argument('apk', help = "the apk to check")
parser.add_argument('stampfile', help = "a file to touch if successful")
args = parser.parse_args()
regex = re.compile(r"targetSdkVersion: *'([0-9]+)'")
output = subprocess.check_output([args.aapt2, "dump", "badging", args.apk], text=True)
targetSdkVersion = None
for line in output.splitlines():
match = regex.fullmatch(line.strip())
if match:
targetSdkVersion = int(match.group(1))
break
if targetSdkVersion is None or targetSdkVersion >= 30:
sys.exit(args.apk + ": Prebuilt, presigned apks with targetSdkVersion >= 30 (or a codename targetSdkVersion) must set preprocessed: true in the Android.bp definition (because they must be signed with signature v2, and the build system would wreck that signature otherwise)")
subprocess.check_call(["touch", args.stampfile])
if __name__ == "__main__":
main()