Chromium Code Reviews| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 with build_utils.TempDir() as temp_dir: | 155 with build_utils.TempDir() as temp_dir: |
| 156 device_dex_dir = posixpath.join(device_incremental_dir, 'dex') | 156 device_dex_dir = posixpath.join(device_incremental_dir, 'dex') |
| 157 # Ensure no two files have the same name. | 157 # Ensure no two files have the same name. |
| 158 transformed_names = _TransformDexPaths(args.dex_files) | 158 transformed_names = _TransformDexPaths(args.dex_files) |
| 159 for src_path, dest_name in zip(args.dex_files, transformed_names): | 159 for src_path, dest_name in zip(args.dex_files, transformed_names): |
| 160 shutil.copyfile(src_path, os.path.join(temp_dir, dest_name)) | 160 shutil.copyfile(src_path, os.path.join(temp_dir, dest_name)) |
| 161 device.PushChangedFiles([(temp_dir, device_dex_dir)], | 161 device.PushChangedFiles([(temp_dir, device_dex_dir)], |
| 162 delete_device_stale=True) | 162 delete_device_stale=True) |
| 163 push_dex_timer.Stop(log=False) | 163 push_dex_timer.Stop(log=False) |
| 164 | 164 |
| 165 def check_sdk_version(): | 165 def check_sdk_version(): |
|
pkotwicz
2015/10/05 20:02:34
Perhaps rename this to check_selinux() ?
agrieve
2015/10/05 20:08:45
Done.
| |
| 166 if device.build_version_sdk >= version_codes.MARSHMALLOW: | 166 # Samsung started using SELinux before Marshmallow. There may be even more |
| 167 if apk_help.HasIsolatedProcesses(): | 167 # cases where this is required... |
| 168 raise Exception('Cannot use perform incremental installs on Android M+ ' | 168 has_selinux = (device.build_version_sdk >= version_codes.MARSHMALLOW or |
| 169 'without first disabling isolated processes.\n' | 169 device.GetProp('selinux.policy_version')) |
| 170 'To do so, use GN arg:\n' | 170 if has_selinux and apk_help.HasIsolatedProcesses(): |
| 171 ' disable_incremental_isolated_processes=true') | 171 raise Exception('Cannot use incremental installs on Android devices that ' |
| 172 'use using SELinux policies without first disabling ' | |
|
pkotwicz
2015/10/05 20:02:34
Nit: Remove 'using'
agrieve
2015/10/05 20:08:45
Done.
| |
| 173 'isolated processes.\n' | |
| 174 'To do so, use GN arg:\n' | |
| 175 ' disable_incremental_isolated_processes=true') | |
| 172 | 176 |
| 173 cache_path = '%s/files-cache.json' % device_incremental_dir | 177 cache_path = '%s/files-cache.json' % device_incremental_dir |
| 174 def restore_cache(): | 178 def restore_cache(): |
| 175 # Delete the cached file so that any exceptions cause the next attempt | 179 # Delete the cached file so that any exceptions cause the next attempt |
| 176 # to re-compute md5s. | 180 # to re-compute md5s. |
| 177 cmd = 'P=%s;cat $P 2>/dev/null && rm $P' % cache_path | 181 cmd = 'P=%s;cat $P 2>/dev/null && rm $P' % cache_path |
| 178 lines = device.RunShellCommand(cmd, check_return=False, large_output=True) | 182 lines = device.RunShellCommand(cmd, check_return=False, large_output=True) |
| 179 if lines: | 183 if lines: |
| 180 device.LoadCacheData(lines[0]) | 184 device.LoadCacheData(lines[0]) |
| 181 else: | 185 else: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 logging.info( | 218 logging.info( |
| 215 'Took %s seconds (setup=%s, install=%s, libs=%s, dex=%s, finalize=%s)', | 219 'Took %s seconds (setup=%s, install=%s, libs=%s, dex=%s, finalize=%s)', |
| 216 main_timer.GetDelta(), setup_timer.GetDelta(), install_timer.GetDelta(), | 220 main_timer.GetDelta(), setup_timer.GetDelta(), install_timer.GetDelta(), |
| 217 push_native_timer.GetDelta(), push_dex_timer.GetDelta(), | 221 push_native_timer.GetDelta(), push_dex_timer.GetDelta(), |
| 218 finalize_timer.GetDelta()) | 222 finalize_timer.GetDelta()) |
| 219 | 223 |
| 220 | 224 |
| 221 if __name__ == '__main__': | 225 if __name__ == '__main__': |
| 222 sys.exit(main()) | 226 sys.exit(main()) |
| 223 | 227 |
| OLD | NEW |