| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 device_dex_dir = posixpath.join(device_incremental_dir, 'dex') | 114 device_dex_dir = posixpath.join(device_incremental_dir, 'dex') |
| 115 # Ensure no two files have the same name. | 115 # Ensure no two files have the same name. |
| 116 transformed_names = _TransformDexPaths(dex_files) | 116 transformed_names = _TransformDexPaths(dex_files) |
| 117 for src_path, dest_name in zip(dex_files, transformed_names): | 117 for src_path, dest_name in zip(dex_files, transformed_names): |
| 118 shutil.copyfile(src_path, os.path.join(temp_dir, dest_name)) | 118 shutil.copyfile(src_path, os.path.join(temp_dir, dest_name)) |
| 119 device.PushChangedFiles([(temp_dir, device_dex_dir)], | 119 device.PushChangedFiles([(temp_dir, device_dex_dir)], |
| 120 delete_device_stale=True) | 120 delete_device_stale=True) |
| 121 push_dex_timer.Stop(log=False) | 121 push_dex_timer.Stop(log=False) |
| 122 | 122 |
| 123 def check_selinux(): | 123 def check_selinux(): |
| 124 # Samsung started using SELinux before Marshmallow. There may be even more | 124 # Marshmallow has no filesystem access whatsoever. It might be possible to |
| 125 # cases where this is required... | 125 # get things working on Lollipop, but attempts so far have failed. |
| 126 has_selinux = (device.build_version_sdk >= version_codes.MARSHMALLOW or | 126 # http://crbug.com/558818 |
| 127 device.GetProp('selinux.policy_version')) | 127 has_selinux = device.build_version_sdk >= version_codes.LOLLIPOP |
| 128 if has_selinux and apk.HasIsolatedProcesses(): | 128 if has_selinux and apk.HasIsolatedProcesses(): |
| 129 raise Exception('Cannot use incremental installs on versions of Android ' | 129 raise Exception('Cannot use incremental installs on Android L+ without ' |
| 130 'where isoloated processes cannot access the filesystem ' | |
| 131 '(this includes Android M+, and Samsung L+) without ' | |
| 132 'first disabling isoloated processes.\n' | 130 'first disabling isoloated processes.\n' |
| 133 'To do so, use GN arg:\n' | 131 'To do so, use GN arg:\n' |
| 134 ' disable_incremental_isolated_processes=true') | 132 ' disable_incremental_isolated_processes=true') |
| 135 | 133 |
| 136 cache_path = '%s/files-cache.json' % device_incremental_dir | 134 cache_path = '%s/files-cache.json' % device_incremental_dir |
| 137 def restore_cache(): | 135 def restore_cache(): |
| 138 if not enable_device_cache: | 136 if not enable_device_cache: |
| 139 logging.info('Ignoring device cache') | 137 logging.info('Ignoring device cache') |
| 140 return | 138 return |
| 141 # Delete the cached file so that any exceptions cause the next attempt | 139 # Delete the cached file so that any exceptions cause the next attempt |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if args.uninstall: | 256 if args.uninstall: |
| 259 Uninstall(device, apk.GetPackageName()) | 257 Uninstall(device, apk.GetPackageName()) |
| 260 else: | 258 else: |
| 261 Install(device, apk, split_globs=args.splits, lib_dir=args.lib_dir, | 259 Install(device, apk, split_globs=args.splits, lib_dir=args.lib_dir, |
| 262 dex_files=args.dex_files, enable_device_cache=args.cache, | 260 dex_files=args.dex_files, enable_device_cache=args.cache, |
| 263 use_concurrency=args.threading) | 261 use_concurrency=args.threading) |
| 264 | 262 |
| 265 | 263 |
| 266 if __name__ == '__main__': | 264 if __name__ == '__main__': |
| 267 sys.exit(main()) | 265 sys.exit(main()) |
| OLD | NEW |