Skip to content

Commit 204be92

Browse files
steviecclaude
andcommitted
refactor(device): clarify emulatorImage path is a dir, not a tag
Rename imagePackageTag → imageDir and expand the comment to spell out that the 3rd path segment is the on-disk system-images directory, not the image's SystemImage.TagId. They coincide for single-tag images (≤36) but diverge for API 37's multi-tag 16KB image (dir "google_apis_ps16k" vs tag "google_apis"), which is why a fully-qualified --package is the sole source of truth and --tag/--abi are never passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 34febec commit 204be92

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

maestro-client/src/main/java/maestro/device/DeviceSpec.kt

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,23 @@ sealed class DeviceSpec {
5959
override val osVersion: Int get() = os.removePrefix("android-").toIntOrNull() ?: 0
6060
override val deviceName: String get() = "Maestro_ANDROID_${model}_${os}"
6161

62-
// API 37+ system images differ from the ≤36 form on two axes. (1) The platform id
63-
// carries a minor version ("android-37.0", not "android-37") — Google's permanent
64-
// minor-SDK scheme since Android 16 QPR2. (2) Only the 16 KB page-size image is
65-
// published, whose package-path segment is "google_apis_ps16k" rather than the plain
66-
// "google_apis". Both are encoded in this fully-qualified sdkmanager package path;
67-
// avdmanager derives the tag and ABI from the package itself, so neither is passed
68-
// separately when creating the AVD (the path segment "google_apis_ps16k" is NOT a
69-
// valid avdmanager --tag — the image's tag id is plain "google_apis").
62+
// emulatorImage is an sdkmanager "SDK-style path": system-images;<platform>;<dir>;<abi>.
63+
// The 3rd segment is the on-disk directory under system-images/<platform>/, NOT a "tag"
64+
// (the image's SystemImage.TagId). They coincided for single-tag images (≤36), but API 37's
65+
// multi-tag 16 KB image has dir "google_apis_ps16k" while its tag id is plain "google_apis",
66+
// so the dir name is rejected as an avdmanager --tag.
67+
//
68+
// CRITICAL: a fully-qualified --package makes avdmanager derive the tag and ABI from it, so
69+
// createAndroidDevice passes ONLY --package — never --tag/--abi. This path is the sole source
70+
// of truth; keep it that way.
71+
//
72+
// API 37+: platform carries a minor version ("android-37.0", not "android-37"; Google's
73+
// permanent minor-SDK scheme since Android 16 QPR2) and only the 16 KB ("…_ps16k") dir ships.
7074
// https://android-developers.googleblog.com/2025/12/android-16-qpr2-is-released.html
7175
// https://developer.android.com/guide/practices/page-sizes
7276
private val imagePlatform: String get() = if (osVersion >= 37) "$os.0" else os
73-
private val imagePackageTag: String get() = if (osVersion >= 37) "google_apis_ps16k" else "google_apis"
74-
val emulatorImage: String get() = "system-images;$imagePlatform;$imagePackageTag;${cpuArchitecture.value}"
77+
private val imageDir: String get() = if (osVersion >= 37) "google_apis_ps16k" else "google_apis"
78+
val emulatorImage: String get() = "system-images;$imagePlatform;$imageDir;${cpuArchitecture.value}"
7579

7680
companion object {
7781
val DEFAULT: Android = Android(model = "pixel_6", os = "android-33")

0 commit comments

Comments
 (0)