| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Install *_incremental.apk targets as well as their dependent files.""" | 7 """Install *_incremental.apk targets as well as their dependent files.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import glob | 10 import glob |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 # Create 2 lock files: | 190 # Create 2 lock files: |
| 191 # * install.lock tells the app to pause on start-up (until we release it). | 191 # * install.lock tells the app to pause on start-up (until we release it). |
| 192 # * firstrun.lock is used by the app to pause all secondary processes until | 192 # * firstrun.lock is used by the app to pause all secondary processes until |
| 193 # the primary process finishes loading the .dex / .so files. | 193 # the primary process finishes loading the .dex / .so files. |
| 194 def create_lock_files(): | 194 def create_lock_files(): |
| 195 # Creates or zeros out lock files. | 195 # Creates or zeros out lock files. |
| 196 cmd = ('D="%s";' | 196 cmd = ('D="%s";' |
| 197 'mkdir -p $D &&' | 197 'mkdir -p $D &&' |
| 198 'echo -n >$D/install.lock 2>$D/firstrun.lock') | 198 'echo -n >$D/install.lock 2>$D/firstrun.lock') |
| 199 device.RunShellCommand(cmd % device_incremental_dir, check_return=True) | 199 device.RunShellCommand( |
| 200 cmd % device_incremental_dir, shell=True, check_return=True) |
| 200 | 201 |
| 201 # The firstrun.lock is released by the app itself. | 202 # The firstrun.lock is released by the app itself. |
| 202 def release_installer_lock(): | 203 def release_installer_lock(): |
| 203 device.RunShellCommand('echo > %s/install.lock' % device_incremental_dir, | 204 device.RunShellCommand('echo > %s/install.lock' % device_incremental_dir, |
| 204 check_return=True) | 205 check_return=True, shell=True) |
| 205 | 206 |
| 206 # Concurrency here speeds things up quite a bit, but DeviceUtils hasn't | 207 # Concurrency here speeds things up quite a bit, but DeviceUtils hasn't |
| 207 # been designed for multi-threading. Enabling only because this is a | 208 # been designed for multi-threading. Enabling only because this is a |
| 208 # developer-only tool. | 209 # developer-only tool. |
| 209 setup_timer = _Execute( | 210 setup_timer = _Execute( |
| 210 use_concurrency, create_lock_files, restore_cache, check_selinux) | 211 use_concurrency, create_lock_files, restore_cache, check_selinux) |
| 211 | 212 |
| 212 _Execute(use_concurrency, do_install, do_push_files) | 213 _Execute(use_concurrency, do_install, do_push_files) |
| 213 | 214 |
| 214 finalize_timer = _Execute(use_concurrency, release_installer_lock, save_cache) | 215 finalize_timer = _Execute(use_concurrency, release_installer_lock, save_cache) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 else: | 308 else: |
| 308 Install(device, apk, split_globs=args.splits, native_libs=args.native_libs, | 309 Install(device, apk, split_globs=args.splits, native_libs=args.native_libs, |
| 309 dex_files=args.dex_files, enable_device_cache=args.cache, | 310 dex_files=args.dex_files, enable_device_cache=args.cache, |
| 310 use_concurrency=args.threading, | 311 use_concurrency=args.threading, |
| 311 show_proguard_warning=args.show_proguard_warning, | 312 show_proguard_warning=args.show_proguard_warning, |
| 312 allow_downgrade=args.allow_downgrade) | 313 allow_downgrade=args.allow_downgrade) |
| 313 | 314 |
| 314 | 315 |
| 315 if __name__ == '__main__': | 316 if __name__ == '__main__': |
| 316 sys.exit(main()) | 317 sys.exit(main()) |
| OLD | NEW |