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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 """Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the | 141 """Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the |
142 emulator is ready for use. | 142 emulator is ready for use. |
143 | 143 |
144 If fails, an exception will be raised. | 144 If fails, an exception will be raised. |
145 """ | 145 """ |
146 if kill_all_emulators: | 146 if kill_all_emulators: |
147 _KillAllEmulators() # just to be sure | 147 _KillAllEmulators() # just to be sure |
148 if not self.fast_and_loose: | 148 if not self.fast_and_loose: |
149 self._AggressiveImageCleanup() | 149 self._AggressiveImageCleanup() |
150 (self.device, port) = self._DeviceName() | 150 (self.device, port) = self._DeviceName() |
| 151 abi = 'armeabi' |
| 152 if 'x86' in os.environ.get('TARGET_PRODUCT', ''): |
| 153 abi = 'x86' |
151 emulator_command = [ | 154 emulator_command = [ |
152 self.emulator, | 155 self.emulator, |
153 # Speed up emulator launch by 40%. Really. | 156 # Speed up emulator launch by 40%. Really. |
154 '-no-boot-anim', | 157 '-no-boot-anim', |
155 # The default /data size is 64M. | 158 # The default /data size is 64M. |
156 # That's not enough for 8 unit test bundles and their data. | 159 # That's not enough for 8 unit test bundles and their data. |
157 '-partition-size', '512', | 160 '-partition-size', '512', |
158 # Use a familiar name and port. | 161 # Use a familiar name and port. |
159 '-avd', 'avd_armeabi', | 162 '-avd', 'avd_' + abi, |
160 '-port', str(port)] | 163 '-port', str(port)] |
161 if not self.fast_and_loose: | 164 if not self.fast_and_loose: |
162 emulator_command.extend([ | 165 emulator_command.extend([ |
163 # Wipe the data. We've seen cases where an emulator | 166 # Wipe the data. We've seen cases where an emulator |
164 # gets 'stuck' if we don't do this (every thousand runs or | 167 # gets 'stuck' if we don't do this (every thousand runs or |
165 # so). | 168 # so). |
166 '-wipe-data', | 169 '-wipe-data', |
167 ]) | 170 ]) |
168 logging.info('Emulator launch command: %s', ' '.join(emulator_command)) | 171 logging.info('Emulator launch command: %s', ' '.join(emulator_command)) |
169 self.popen = subprocess.Popen(args=emulator_command, | 172 self.popen = subprocess.Popen(args=emulator_command, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 """Install a handler to kill the emulator when we exit unexpectedly.""" | 246 """Install a handler to kill the emulator when we exit unexpectedly.""" |
244 for sig in self._SIGNALS: | 247 for sig in self._SIGNALS: |
245 signal.signal(sig, self._ShutdownOnSignal) | 248 signal.signal(sig, self._ShutdownOnSignal) |
246 | 249 |
247 def main(argv): | 250 def main(argv): |
248 Emulator(True).Launch(True) | 251 Emulator(True).Launch(True) |
249 | 252 |
250 | 253 |
251 if __name__ == '__main__': | 254 if __name__ == '__main__': |
252 main(sys.argv) | 255 main(sys.argv) |
OLD | NEW |