OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Provides an interface to start and stop Android emulator. | 5 """Provides an interface to start and stop Android emulator. |
6 | 6 |
7 Emulator: The class provides the methods to launch/shutdown the emulator with | 7 Emulator: The class provides the methods to launch/shutdown the emulator with |
8 the android virtual device named 'avd_armeabi' . | 8 the android virtual device named 'avd_armeabi' . |
9 """ | 9 """ |
10 | 10 |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 (self.device_serial, port) = self._DeviceName() | 410 (self.device_serial, port) = self._DeviceName() |
411 self.ResizeAndWipeAvd(storage_size=self.storage_size) | 411 self.ResizeAndWipeAvd(storage_size=self.storage_size) |
412 emulator_command = [ | 412 emulator_command = [ |
413 self.emulator, | 413 self.emulator, |
414 # Speed up emulator launch by 40%. Really. | 414 # Speed up emulator launch by 40%. Really. |
415 '-no-boot-anim', | 415 '-no-boot-anim', |
416 ] | 416 ] |
417 if self.headless: | 417 if self.headless: |
418 emulator_command.extend([ | 418 emulator_command.extend([ |
419 '-no-skin', | 419 '-no-skin', |
420 '-no-audio', | |
421 '-no-window' | 420 '-no-window' |
422 ]) | 421 ]) |
423 else: | 422 else: |
424 emulator_command.extend([ | 423 emulator_command.extend([ |
425 '-gpu', 'on' | 424 '-gpu', 'on' |
426 ]) | 425 ]) |
427 emulator_command.extend([ | 426 emulator_command.extend([ |
428 # Use a familiar name and port. | 427 # Use a familiar name and port. |
429 '-avd', self.avd_name, | 428 '-avd', self.avd_name, |
430 '-port', str(port), | 429 '-port', str(port), |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 logging.critical('emulator _ShutdownOnSignal') | 510 logging.critical('emulator _ShutdownOnSignal') |
512 for sig in self._SIGNALS: | 511 for sig in self._SIGNALS: |
513 signal.signal(sig, signal.SIG_DFL) | 512 signal.signal(sig, signal.SIG_DFL) |
514 self.Shutdown() | 513 self.Shutdown() |
515 raise KeyboardInterrupt # print a stack | 514 raise KeyboardInterrupt # print a stack |
516 | 515 |
517 def _InstallKillHandler(self): | 516 def _InstallKillHandler(self): |
518 """Install a handler to kill the emulator when we exit unexpectedly.""" | 517 """Install a handler to kill the emulator when we exit unexpectedly.""" |
519 for sig in self._SIGNALS: | 518 for sig in self._SIGNALS: |
520 signal.signal(sig, self._ShutdownOnSignal) | 519 signal.signal(sig, self._ShutdownOnSignal) |
OLD | NEW |