OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import collections | 6 import collections |
7 import logging | 7 import logging |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 | 11 |
12 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), | 12 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), |
13 os.pardir, | 13 os.pardir, |
14 os.pardir, | 14 os.pardir, |
15 'build', | 15 'build', |
16 'android') | 16 'android') |
17 sys.path.append(BUILD_ANDROID_DIR) | 17 sys.path.append(BUILD_ANDROID_DIR) |
18 from pylib import android_commands | 18 from pylib import android_commands |
19 from pylib import constants | 19 from pylib import constants |
20 from pylib import flag_changer | 20 from pylib import flag_changer |
21 from pylib.device import device_errors | 21 from pylib.device import device_errors |
22 from pylib.device import device_utils | 22 from pylib.device import device_utils |
| 23 from pylib.device import intent |
23 | 24 |
24 # Browser Constants | 25 # Browser Constants |
25 DEFAULT_BROWSER = 'chrome' | 26 DEFAULT_BROWSER = 'chrome' |
26 | 27 |
27 # Action Constants | 28 # Action Constants |
28 ACTION_PACKAGE = 'org.chromium.base' | 29 ACTION_PACKAGE = 'org.chromium.base' |
29 ACTION_TRIM = { | 30 ACTION_TRIM = { |
30 'moderate' : ACTION_PACKAGE + '.ACTION_TRIM_MEMORY_MODERATE', | 31 'moderate' : ACTION_PACKAGE + '.ACTION_TRIM_MEMORY_MODERATE', |
31 'critical' : ACTION_PACKAGE + '.ACTION_TRIM_MEMORY_RUNNING_CRITICAL', | 32 'critical' : ACTION_PACKAGE + '.ACTION_TRIM_MEMORY_RUNNING_CRITICAL', |
32 'complete' : ACTION_PACKAGE + '.ACTION_TRIM_MEMORY' | 33 'complete' : ACTION_PACKAGE + '.ACTION_TRIM_MEMORY' |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 logging.error(str(e)) | 104 logging.error(str(e)) |
104 flags = flag_changer.FlagChanger(device, package_info.cmdline_file) | 105 flags = flag_changer.FlagChanger(device, package_info.cmdline_file) |
105 if ENABLE_TEST_INTENTS_FLAG not in flags.Get(): | 106 if ENABLE_TEST_INTENTS_FLAG not in flags.Get(): |
106 flags.AddFlags([ENABLE_TEST_INTENTS_FLAG]) | 107 flags.AddFlags([ENABLE_TEST_INTENTS_FLAG]) |
107 | 108 |
108 device.StartActivity(intent.Intent(package=package, activity=activity, | 109 device.StartActivity(intent.Intent(package=package, activity=activity, |
109 action=action)) | 110 action=action)) |
110 | 111 |
111 if __name__ == '__main__': | 112 if __name__ == '__main__': |
112 sys.exit(main(sys.argv)) | 113 sys.exit(main(sys.argv)) |
OLD | NEW |