| 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 |
| 11 import logging | 11 import logging |
| 12 import os | 12 import os |
| 13 import signal | 13 import signal |
| 14 import subprocess | 14 import subprocess |
| 15 import time | 15 import time |
| 16 | 16 |
| 17 # TODO(craigdh): Move these pylib dependencies to pylib/utils/. | 17 from devil.android import device_errors |
| 18 from pylib import cmd_helper | 18 from devil.android import device_utils |
| 19 from devil.android.sdk import adb_wrapper |
| 20 from devil.utils import cmd_helper |
| 19 from pylib import constants | 21 from pylib import constants |
| 20 from pylib import pexpect | 22 from pylib import pexpect |
| 21 from pylib.device import adb_wrapper | |
| 22 from pylib.device import device_errors | |
| 23 from pylib.device import device_utils | |
| 24 from pylib.utils import time_profile | 23 from pylib.utils import time_profile |
| 25 | 24 |
| 26 import errors | 25 import errors |
| 27 import run_command | 26 import run_command |
| 28 | 27 |
| 29 # SD card size | 28 # SD card size |
| 30 SDCARD_SIZE = '512M' | 29 SDCARD_SIZE = '512M' |
| 31 | 30 |
| 32 # Template used to generate config.ini files for the emulator | 31 # Template used to generate config.ini files for the emulator |
| 33 CONFIG_TEMPLATE = """avd.ini.encoding=ISO-8859-1 | 32 CONFIG_TEMPLATE = """avd.ini.encoding=ISO-8859-1 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 logging.critical('emulator _ShutdownOnSignal') | 436 logging.critical('emulator _ShutdownOnSignal') |
| 438 for sig in self._SIGNALS: | 437 for sig in self._SIGNALS: |
| 439 signal.signal(sig, signal.SIG_DFL) | 438 signal.signal(sig, signal.SIG_DFL) |
| 440 self.Shutdown() | 439 self.Shutdown() |
| 441 raise KeyboardInterrupt # print a stack | 440 raise KeyboardInterrupt # print a stack |
| 442 | 441 |
| 443 def _InstallKillHandler(self): | 442 def _InstallKillHandler(self): |
| 444 """Install a handler to kill the emulator when we exit unexpectedly.""" | 443 """Install a handler to kill the emulator when we exit unexpectedly.""" |
| 445 for sig in self._SIGNALS: | 444 for sig in self._SIGNALS: |
| 446 signal.signal(sig, self._ShutdownOnSignal) | 445 signal.signal(sig, self._ShutdownOnSignal) |
| OLD | NEW |