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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 hw.device.manufacturer=Google | 42 hw.device.manufacturer=Google |
43 hw.sdCard=yes | 43 hw.sdCard=yes |
44 hw.mainKeys=no | 44 hw.mainKeys=no |
45 hw.accelerometer=yes | 45 hw.accelerometer=yes |
46 skin.name=720x1280 | 46 skin.name=720x1280 |
47 abi.type={abi.type} | 47 abi.type={abi.type} |
48 hw.trackBall=no | 48 hw.trackBall=no |
49 hw.device.name=Galaxy Nexus | 49 hw.device.name=Galaxy Nexus |
50 hw.battery=yes | 50 hw.battery=yes |
51 hw.sensors.proximity=yes | 51 hw.sensors.proximity=yes |
52 image.sysdir.1=system-images/android-{api.level}/{abi.type}/ | 52 image.sysdir.1=system-images/android-{api.level}/default/{abi.type}/ |
53 hw.sensors.orientation=yes | 53 hw.sensors.orientation=yes |
54 hw.audioInput=yes | 54 hw.audioInput=yes |
55 hw.camera.front=none | 55 hw.camera.front=none |
56 hw.gps=yes | 56 hw.gps=yes |
57 vm.heapSize=128 | 57 vm.heapSize=128 |
58 {extras}""" | 58 {extras}""" |
59 | 59 |
60 CONFIG_REPLACEMENTS = { | 60 CONFIG_REPLACEMENTS = { |
61 'x86': { | 61 'x86': { |
62 '{hw.cpu.arch}': 'x86', | 62 '{hw.cpu.arch}': 'x86', |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 # Time to wait for a "wait for boot complete" (property set on device). | 227 # Time to wait for a "wait for boot complete" (property set on device). |
228 _WAITFORBOOT_TIMEOUT = 300 | 228 _WAITFORBOOT_TIMEOUT = 300 |
229 | 229 |
230 def __init__(self, avd_name, abi): | 230 def __init__(self, avd_name, abi): |
231 """Init an Emulator. | 231 """Init an Emulator. |
232 | 232 |
233 Args: | 233 Args: |
234 avd_name: name of the AVD to create | 234 avd_name: name of the AVD to create |
235 abi: target platform for emulator being created, defaults to x86 | 235 abi: target platform for emulator being created, defaults to x86 |
236 """ | 236 """ |
237 android_sdk_root = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') | 237 android_sdk_root = constants.ANDROID_SDK_ROOT |
238 self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator') | 238 self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator') |
239 self.android = os.path.join(android_sdk_root, 'tools', 'android') | 239 self.android = os.path.join(android_sdk_root, 'tools', 'android') |
240 self.popen = None | 240 self.popen = None |
241 self.device_serial = None | 241 self.device_serial = None |
242 self.abi = abi | 242 self.abi = abi |
243 self.avd_name = avd_name | 243 self.avd_name = avd_name |
244 | 244 |
245 @staticmethod | 245 @staticmethod |
246 def _DeviceName(): | 246 def _DeviceName(): |
247 """Return our device name.""" | 247 """Return our device name.""" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 logging.critical('emulator _ShutdownOnSignal') | 433 logging.critical('emulator _ShutdownOnSignal') |
434 for sig in self._SIGNALS: | 434 for sig in self._SIGNALS: |
435 signal.signal(sig, signal.SIG_DFL) | 435 signal.signal(sig, signal.SIG_DFL) |
436 self.Shutdown() | 436 self.Shutdown() |
437 raise KeyboardInterrupt # print a stack | 437 raise KeyboardInterrupt # print a stack |
438 | 438 |
439 def _InstallKillHandler(self): | 439 def _InstallKillHandler(self): |
440 """Install a handler to kill the emulator when we exit unexpectedly.""" | 440 """Install a handler to kill the emulator when we exit unexpectedly.""" |
441 for sig in self._SIGNALS: | 441 for sig in self._SIGNALS: |
442 signal.signal(sig, self._ShutdownOnSignal) | 442 signal.signal(sig, self._ShutdownOnSignal) |
OLD | NEW |