Relax startup scripts to devices not supporting nfc
This also extends apk_masseur.py with an option to store the dex compressed.
Change-Id: I4695acc9d7f41f4020225f54cdea93de384dce72
diff --git a/tools/apk_masseur.py b/tools/apk_masseur.py
index 51e9366..487cb7c 100755
--- a/tools/apk_masseur.py
+++ b/tools/apk_masseur.py
@@ -23,6 +23,10 @@
'assets/dexopt/',
default=False,
action='store_true')
+ parser.add_option('--compress-dex',
+ help='Whether the dex should be stored compressed',
+ action='store_true',
+ default=False)
parser.add_option('--dex',
help='Directory or archive with dex files to use instead '
'of those in the apk',
@@ -67,8 +71,8 @@
return file.endswith('.zip') or file.endswith('.jar')
-def repack(apk, clear_profile, processed_out, desugared_library_dex, resources,
- temp, quiet, logging):
+def repack(apk, clear_profile, processed_out, desugared_library_dex,
+ compress_dex, resources, temp, quiet, logging):
processed_apk = os.path.join(temp, 'processed.apk')
shutil.copyfile(apk, processed_apk)
@@ -119,7 +123,12 @@
dex_files = glob.glob('*.dex')
dex_files.sort()
resource_files = glob.glob(resources) if resources else []
- cmd = ['zip', '-u', '-0', processed_apk] + dex_files + resource_files
+ cmd = ['zip', '-u']
+ if not compress_dex:
+ cmd.append('-0')
+ cmd.append(processed_apk)
+ cmd.extend(dex_files)
+ cmd.extend(resource_files)
utils.RunCmd(cmd, quiet=quiet, logging=logging)
return processed_apk
@@ -143,6 +152,7 @@
clear_profile=False,
dex=None,
desugared_library_dex=None,
+ compress_dex=False,
resources=None,
out=None,
adb_options=None,
@@ -159,8 +169,8 @@
processed_apk = None
if dex or clear_profile:
processed_apk = repack(apk, clear_profile, dex,
- desugared_library_dex, resources, temp,
- quiet, logging)
+ desugared_library_dex, compress_dex,
+ resources, temp, quiet, logging)
else:
assert not desugared_library_dex
utils.Print('Signing original APK without modifying apk',