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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 logging.info('Create AVD command: %s', ' '.join(avd_command)) | 206 logging.info('Create AVD command: %s', ' '.join(avd_command)) |
207 return self.avd_name | 207 return self.avd_name |
208 | 208 |
209 def _DeleteAVD(self): | 209 def _DeleteAVD(self): |
210 """Delete the AVD of this emulator.""" | 210 """Delete the AVD of this emulator.""" |
211 avd_command = [ | 211 avd_command = [ |
212 self.android, | 212 self.android, |
213 '--silent', | 213 '--silent', |
214 'delete', | 214 'delete', |
215 'avd', | 215 'avd', |
216 '--name', self.avd, | 216 '--name', self.avd_name, |
navabi
2013/04/08 20:11:48
Good catch. thanks.
| |
217 ] | 217 ] |
218 avd_process = subprocess.Popen(args=avd_command, | 218 avd_process = subprocess.Popen(args=avd_command, |
219 stdout=subprocess.PIPE, | 219 stdout=subprocess.PIPE, |
220 stderr=subprocess.STDOUT) | 220 stderr=subprocess.STDOUT) |
221 logging.info('Delete AVD command: %s', ' '.join(avd_command)) | 221 logging.info('Delete AVD command: %s', ' '.join(avd_command)) |
222 avd_process.wait() | 222 avd_process.wait() |
223 | 223 |
224 def Launch(self, kill_all_emulators): | 224 def Launch(self, kill_all_emulators): |
225 """Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the | 225 """Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the |
226 emulator is ready for use. | 226 emulator is ready for use. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 logging.critical('emulator _ShutdownOnSignal') | 326 logging.critical('emulator _ShutdownOnSignal') |
327 for sig in self._SIGNALS: | 327 for sig in self._SIGNALS: |
328 signal.signal(sig, signal.SIG_DFL) | 328 signal.signal(sig, signal.SIG_DFL) |
329 self.Shutdown() | 329 self.Shutdown() |
330 raise KeyboardInterrupt # print a stack | 330 raise KeyboardInterrupt # print a stack |
331 | 331 |
332 def _InstallKillHandler(self): | 332 def _InstallKillHandler(self): |
333 """Install a handler to kill the emulator when we exit unexpectedly.""" | 333 """Install a handler to kill the emulator when we exit unexpectedly.""" |
334 for sig in self._SIGNALS: | 334 for sig in self._SIGNALS: |
335 signal.signal(sig, self._ShutdownOnSignal) | 335 signal.signal(sig, self._ShutdownOnSignal) |
OLD | NEW |