Bug 1462936 - Use QEMU 2 engine for android-emulator for x86-6.0 and x86-7.0 r=gbrown

Before this patch, the x86-6.0 and x86-7.0 Android emulators were
unusable on macOS (tested 10.13.4 High Sierra).
The emulator's UI appears (but with black screen), and the launcher
icon in the dock has a default folder icon instead of the emulator.

When I use "mach android-emulator --version=x86-6.0 --verbose",
then the full emulator command is printed. I discovered that
using the newer QEMU 2 engine ("-engine qemu2") fixes the issue, and
that the emulator launches as expected. This option is documented at:
https://developer.android.com/studio/run/emulator-commandline

However, when I modify the source of these commands, then the emulator
fails to start (as before). This is caused by the setpgid call via
preexec_fn in testing/mozbase/mozprocess/mozprocess/processhandler.py .
Passing ignore_children=True to ProcessHandler avoids the setpgid call
and allows the emulator to be used as expected on macOS.

The effect of not using setpgid is that the spawned process will not
be put in the process group of the "mach" Python script. This is not
a big deal. I can confirm that the emulator can still be killed by
quitting or force-quitting it, and did not experience other issues.

MozReview-Commit-ID: 4AKVqtwIoCj

--HG--
extra : rebase_source : df6615a32de666d0f9d4f27c1c6f462120364ee2
This commit is contained in:
Rob Wu 2018-05-19 21:48:50 +02:00
Родитель 8affe6e831
Коммит 90138813b0
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -90,7 +90,7 @@ AVD_DICT = {
'testing/config/tooltool-manifests/androidx86_6_0/mach-emulator.manifest',
['-skip-adb-auth', '-verbose', '-show-kernel',
'-ranchu',
# does not boot if '-engine', 'qemu2',
'-engine', 'qemu2',
'-memory', '3072', '-cores', '4',
'-qemu', '-enable-kvm'],
True),
@ -99,8 +99,8 @@ AVD_DICT = {
'testing/config/tooltool-manifests/androidx86_7_0/mach-emulator.manifest',
['-skip-adb-auth', '-verbose', '-show-kernel',
'-ranchu',
'-engine', 'qemu2',
'-selinux', 'permissive',
# does not boot if '-engine', 'qemu2',
'-memory', '3072', '-cores', '4',
'-qemu', '-enable-kvm'],
True)
@ -530,7 +530,7 @@ class AndroidEmulator(object):
log_path)
self.proc = ProcessHandler(
command, storeOutput=False, processOutputLine=outputHandler,
env=env)
env=env, ignore_children=True)
self.proc.run()
_log_debug("Emulator started with pid %d" %
int(self.proc.proc.pid))