Skip to content

Commit e139c6d

Browse files
authored
[macOS] Skip Intel HAXM installation on BigSur (actions#3698)
* Remove HAXM installation as it doesn't work on Big Sur * Change test to validate successful kext load * Add HAXM to software report
1 parent a914ed2 commit e139c6d

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

images/macos/provision/core/android-toolsets.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ do
8585
done
8686

8787
# Intel x86 Emulator Accelerator (HAXM installer)
88-
# see Issue 31164 notes
89-
# Command needs to be run under sudo.
90-
chmod +x $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
91-
sudo $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
88+
# The Android Emulator uses the built-in Hypervisor.Framework by default, and falls back to using Intel HAXM if Hypervisor.Framework fails to initialize
89+
# https://developer.android.com/studio/run/emulator-acceleration#vm-mac
90+
# The installation doesn't work properly on macOS Big Sur, /dev/HAX is not created
91+
if is_Less_BigSur; then
92+
chmod +x $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
93+
sudo $ANDROID_HOME/extras/intel/Hardware_Accelerated_Execution_Manager/silent_install.sh
94+
fi
9295

9396
for addon_name in "${ANDROID_ADDON_LIST[@]}"
9497
do

images/macos/software-report/SoftwareReport.Android.psm1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,11 @@ function Get-AndroidNDKVersions {
187187

188188
return ($versions -Join "<br>")
189189
}
190+
191+
function Get-IntelHaxmVersion {
192+
kextstat | Where-Object { $_ -match "com.intel.kext.intelhaxm \((?<version>(\d+\.){1,}\d+)\)" } | Out-Null
193+
return [PSCustomObject] @{
194+
"Package Name" = "Intel HAXM"
195+
"Version" = $Matches.Version
196+
}
197+
}

images/macos/software-report/SoftwareReport.Generator.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,11 @@ $markdown += New-MDNewLine
276276

277277
# Android section
278278
$markdown += New-MDHeader "Android" -Level 3
279-
$markdown += Build-AndroidTable | New-MDTable
279+
$androidTable = Build-AndroidTable
280+
if ($os.IsLessThanBigSur) {
281+
$androidTable += Get-IntelHaxmVersion
282+
}
283+
$markdown += $androidTable | New-MDTable
280284
$markdown += New-MDNewLine
281285
$markdown += New-MDHeader "Environment variables" -Level 4
282286
$markdown += Build-AndroidEnvironmentTable | New-MDTable

images/macos/tests/Android.Tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ Describe "Android" {
8383
}
8484
}
8585

86-
It "HAXM is installed" {
87-
$haxmPath = Join-Path $ANDROID_SDK_DIR "extras" "intel" "Hardware_Accelerated_Execution_Manager" "silent_install.sh"
88-
"$haxmPath -v" | Should -ReturnZeroExitCode
86+
It "HAXM is installed" -Skip:($os.IsBigSur) {
87+
"kextstat | grep 'com.intel.kext.intelhaxm'" | Should -ReturnZeroExitCode
8988
}
9089
}

0 commit comments

Comments
 (0)