| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 # Time to wait for a "wait for boot complete" (property set on device). | 164 # Time to wait for a "wait for boot complete" (property set on device). |
| 165 _WAITFORBOOT_TIMEOUT = 300 | 165 _WAITFORBOOT_TIMEOUT = 300 |
| 166 | 166 |
| 167 def __init__(self, avd_name, abi): | 167 def __init__(self, avd_name, abi): |
| 168 """Init an Emulator. | 168 """Init an Emulator. |
| 169 | 169 |
| 170 Args: | 170 Args: |
| 171 avd_name: name of the AVD to create | 171 avd_name: name of the AVD to create |
| 172 abi: target platform for emulator being created | 172 abi: target platform for emulator being created |
| 173 """ | 173 """ |
| 174 android_sdk_root = os.path.join(constants.EMULATOR_SDK_ROOT, | 174 android_sdk_root = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') |
| 175 'android_tools', 'sdk') | |
| 176 self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator') | 175 self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator') |
| 177 self.android = os.path.join(android_sdk_root, 'tools', 'android') | 176 self.android = os.path.join(android_sdk_root, 'tools', 'android') |
| 178 self.popen = None | 177 self.popen = None |
| 179 self.device = None | 178 self.device = None |
| 180 self.abi = abi | 179 self.abi = abi |
| 181 self.avd_name = avd_name | 180 self.avd_name = avd_name |
| 182 self._CreateAVD() | 181 self._CreateAVD() |
| 183 | 182 |
| 184 def _DeviceName(self): | 183 def _DeviceName(self): |
| 185 """Return our device name.""" | 184 """Return our device name.""" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 logging.critical('emulator _ShutdownOnSignal') | 361 logging.critical('emulator _ShutdownOnSignal') |
| 363 for sig in self._SIGNALS: | 362 for sig in self._SIGNALS: |
| 364 signal.signal(sig, signal.SIG_DFL) | 363 signal.signal(sig, signal.SIG_DFL) |
| 365 self.Shutdown() | 364 self.Shutdown() |
| 366 raise KeyboardInterrupt # print a stack | 365 raise KeyboardInterrupt # print a stack |
| 367 | 366 |
| 368 def _InstallKillHandler(self): | 367 def _InstallKillHandler(self): |
| 369 """Install a handler to kill the emulator when we exit unexpectedly.""" | 368 """Install a handler to kill the emulator when we exit unexpectedly.""" |
| 370 for sig in self._SIGNALS: | 369 for sig in self._SIGNALS: |
| 371 signal.signal(sig, self._ShutdownOnSignal) | 370 signal.signal(sig, self._ShutdownOnSignal) |
| OLD | NEW |