Add --install option to apk-masseur.py
R=herhut@google.com
Change-Id: I455a346bc3e7afcd885e6dd0de3447bc089e90df
diff --git a/tools/apk-masseur.py b/tools/apk-masseur.py
index b0c990f..6e3528a 100755
--- a/tools/apk-masseur.py
+++ b/tools/apk-masseur.py
@@ -24,6 +24,10 @@
parser.add_option('--keystore',
help='keystore file (default ~/.android/app.keystore)',
default=None)
+ parser.add_option('--install',
+ help='install the generated apk with adb options -t -r -d',
+ default=False,
+ action='store_true')
(options, args) = parser.parse_args()
if len(args) != 1:
parser.error('Expected <apk> argument, got: ' + ' '.join(args))
@@ -102,6 +106,10 @@
aligned_apk = align(signed_apk, temp)
print 'Writing result to', options.out
shutil.copyfile(aligned_apk, options.out)
+ if options.install:
+ cmd = ['adb', 'install', '-t', '-r', '-d', options.out]
+ utils.PrintCmd(cmd)
+ subprocess.check_call(cmd)
return 0
if __name__ == '__main__':