Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 """Provides an interface to start and stop Android emulator. | 7 """Provides an interface to start and stop Android emulator. |
| 8 | 8 |
| 9 Assumes system environment ANDROID_NDK_ROOT has been set. | 9 Assumes system environment ANDROID_NDK_ROOT has been set. |
| 10 | 10 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 else: | 195 else: |
| 196 abi_option = 'x86' | 196 abi_option = 'x86' |
| 197 | 197 |
| 198 avd_command = [ | 198 avd_command = [ |
| 199 self.android, | 199 self.android, |
| 200 '--silent', | 200 '--silent', |
| 201 'create', 'avd', | 201 'create', 'avd', |
| 202 '--name', self.avd_name, | 202 '--name', self.avd_name, |
| 203 '--abi', abi_option, | 203 '--abi', abi_option, |
| 204 '--target', API_TARGET, | 204 '--target', API_TARGET, |
| 205 '--sdcard', '512M', | |
|
gkanwar
2013/06/21 01:20:00
It probably makes sense to make this value a const
navabi
2013/06/21 01:30:08
Done.
| |
| 205 '--force', | 206 '--force', |
| 206 ] | 207 ] |
| 207 avd_cmd_str = ' '.join(avd_command) | 208 avd_cmd_str = ' '.join(avd_command) |
| 208 logging.info('Create AVD command: %s', avd_cmd_str) | 209 logging.info('Create AVD command: %s', avd_cmd_str) |
| 209 avd_process = pexpect.spawn(avd_cmd_str) | 210 avd_process = pexpect.spawn(avd_cmd_str) |
| 210 | 211 |
| 211 # Instead of creating a custom profile, we overwrite config files. | 212 # Instead of creating a custom profile, we overwrite config files. |
| 212 avd_process.expect('Do you wish to create a custom hardware profile') | 213 avd_process.expect('Do you wish to create a custom hardware profile') |
| 213 avd_process.sendline('no\n') | 214 avd_process.sendline('no\n') |
| 214 avd_process.expect('Created AVD \'%s\'' % self.avd_name) | 215 avd_process.expect('Created AVD \'%s\'' % self.avd_name) |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 logging.critical('emulator _ShutdownOnSignal') | 360 logging.critical('emulator _ShutdownOnSignal') |
| 360 for sig in self._SIGNALS: | 361 for sig in self._SIGNALS: |
| 361 signal.signal(sig, signal.SIG_DFL) | 362 signal.signal(sig, signal.SIG_DFL) |
| 362 self.Shutdown() | 363 self.Shutdown() |
| 363 raise KeyboardInterrupt # print a stack | 364 raise KeyboardInterrupt # print a stack |
| 364 | 365 |
| 365 def _InstallKillHandler(self): | 366 def _InstallKillHandler(self): |
| 366 """Install a handler to kill the emulator when we exit unexpectedly.""" | 367 """Install a handler to kill the emulator when we exit unexpectedly.""" |
| 367 for sig in self._SIGNALS: | 368 for sig in self._SIGNALS: |
| 368 signal.signal(sig, self._ShutdownOnSignal) | 369 signal.signal(sig, self._ShutdownOnSignal) |
| OLD | NEW |