WSL2, Android Studio and Intel HAXM

Solution 1:

So, if I disable Hyper-V completely, then install HAXM (Android Studio), then install WSL2 (this will enable Hyper-V), what happens? HAXM fails to work properly?

That is my understanding, yes.

The "Virtual Machine Platform" and the WSL kernel are the two key components that have to be provided in order to enable WSL2. As you are aware, the Virtual Machine Platform for WSL2, "uses Hyper-V architecture to enable its virtualization.". And "Some 3rd party applications cannot work when Hyper-V is in use, which means they will not be able to run when WSL 2 is enabled, such as VMware and VirtualBox."

That is, of course, also true for HAXM. "In order to install HAXM properly, both Hyper-V and WSL2 features have to be disabled."

Up to this point, I think I'm just recapping what you already know, since there seemed to be some confusion on the topic in the comments.

But to get back to your question, because Hyper-V (even in its WSL2 subset) is a Type 1 Hypervisor, it runs before Windows even starts. Once it is enabled, Windows runs on top of Hyper-V rather than the other way around.

So yes, once you turn back on the Virtual Machine Platform and reboot, HAXM will no longer run. There's no way for a Type 2 hypervisor to "win the race", since the Type 1 will always start first.

Note that some virtualization technologies support Nested Virtualization and can now run alongside (on top of) Hyper-V and/or WSL2's VMP. VMWare, VirtualBox, and KVM all have nested virtualization enabled now.

Unfortunately, it seems from that Github issue that HAXM is not one of them, and the issue was closed without any seeming intent to add that feature.