A devices.xml profile's device type, API range, Play Store and screen size decide its class and images
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- android, typescript
調査の方向性
Start with src/drivers/android/device-profile-source.ts and its tests to see how devices.xml profiles are parsed, then trace how DeviceProfileRegistry merges them and how src/drivers/android/image-fit.ts applies the profile rules. Run the named parser and Android driver tests, then check the catalog pairing for a profile with API range 31- against images at API 30 and 31. Done means only API 31 is paired and docs/CLI.md describes the profile settings.
索引モデルが issue の本文から書いたものです。
説明
Part of #485.
Scope
A profile made in Android Studio's device manager is fitted to images by everything Android Studio saved for it: its API range, its Play Store setting and its screen size, besides the device type #489 already uses. After this PR a custom profile that needs API 31 or newer is never created on API 30, as in Android Studio.
In short
Android Studio saves a custom profile in ~/.android/devices.xml. avdmanager list device reads that file too and lists the profile with OEM : User, but prints only its name, id and device type (Tag :). Simlock now reads the rest from devices.xml itself and adds it to that entry by name. The device is still created by avdmanager -d <id>, as today.
flowchart LR
A[avdmanager list device:<br/>My TV, OEM User, Tag android-tv] --> M[custom profile]:::changed
X[devices.xml: My TV<br/>api-level 31-, playstore-enabled, diagonal] --> M
M --> F[fits rule]
classDef changed stroke-width:3px
Custom profile in devices.xml |
Images after #489 | Images after this PR |
|---|---|---|
"My TV", type TV, api-level 31- |
TV images, any level | TV images, 31 and newer |
"My Phone", no type, api-level 33- |
phone images, any level | phone images, 33 and newer |
"My Phone", playstore-enabled false |
phone images | phone images, no Play Store image |
"My Watch", type Wear, playstore-enabled false |
Wear images | Wear images, Play Store too (every Wear profile allows it) |
| "My Tablet", no type, 10.1-inch screen | phone images, no tablet image |
phone images and tablet images |
| "My Phone", no type, no diagonal | phone images, no tablet image |
phone images, no tablet image |
"My Phone", api-level - |
any level | any level |
| "Old", nothing but a name | phone images | phone images |
Classes of custom profiles avdmanager lists do not change: they still come from the device type it prints. A devices.xml profile avdmanager does not list (rare: a different .android directory) gets its class from its tag-id by the same map, phone without one (ADR 0025 §5).
If this goes wrong, a custom profile loses images it used to get, or gets ones Android Studio would not offer.
Technical spec
Modules touched
flowchart LR
U[parseDevicesXml / UserDeviceProfileSource<br/>device-profile-source.ts]:::changed --> R[DeviceProfileRegistry]:::changed
B[BuiltinDeviceProfileSource] --> R
F[image-fit.ts fits]:::changed --> R
D[AndroidDriver listCatalog, resolveSpec] --> F
classDef changed stroke-width:3px
src/drivers/android/device-profile-source.ts:parseDevicesXmlalso reads, per<d:device>:<d:tag-id>: 1 to 64 characters ofa-z,0-9,-; anything else is ignored.- the first
<d:software><d:api-level>:-or empty is no range;N-is N and newer;N-Mis N to M;-Mis M and older;Nis exactly N. N and M are integers from 1 to 999, and N ≤ M. Anything else is ignored (no range). <d:playstore-enabled>:trueorfalse; anything else is ignored (allowed).- the first
<d:screen><d:diagonal-length>: a decimal from 0.1 to 100 (inches); anything else is ignored (not a tablet). - foldable: the first
<d:screen>has<d:x-folded-dimension>and<d:y-folded-dimension>both above 0, as sdklib'sScreen.isFoldable().
- The
propertiesprofile gainsimageKind(fromtag-id),apiRange,playStoreandtablet.tabletis true when the profile has notag-id, a diagonal of 7 or more, and does not fold, as sdklib'sDevice.isTablet(). A profile withtag-idandroid-wearalways allows Play Store, as sdklib does. - The CR/LF/NUL refusal applies to every new field first, through the parser's existing unreadable-file diagnostic: a line break or NUL inside a value rejects the file even where the value would otherwise be ignored.
DeviceProfileRegistrygives abuiltinprofile markedcustomtheapiRange,playStoreandtabletof thedevices.xmlprofile with the same name, ignoring case, when there is one, on both paths:resolveandcatalog. Its kind and class stay from itsTag :line. Which profile a name resolves to, the order and the catalog's model list do not change. Soresolvenow also reads thedevices.xmlsource after a custombuiltinmatch (a file read; an unreadable file reports its diagnostic and adds nothing); for a model that is not custom it still stops at the first source, as today.- The
devices.xmlpath follows the same orderavdmanageruses to find.android, read from the environment the driver passes toavdmanager:$ANDROID_USER_HOME/devices.xml, else$ANDROID_PREFS_ROOT/.android/devices.xml, else$ANDROID_SDK_HOME/.android/devices.xml, else<home>/.android/devices.xml. Today it reads onlyANDROID_SDK_HOMEand home, so both sources now read the same file. DeviceProfileRegistry.catalogclasses apropertiesprofile by itsimageKindthroughclassOfTag; with none it isphone, as today.
src/drivers/android/image-fit.ts:fitsreadsapiRange,playStoreandtabletfor a custombuiltinprofile and for apropertiesprofile; apropertiesprofile's kind is itsimageKind, none when it has notag-id.
Contract and event changes
None.
Other code on the same state
BuiltinDeviceProfileSource: lists everydevices.xmlprofile withOEM : User(avdmanagerreads the file itself); it comes beforeUserDeviceProfileSource, so a custom name resolves to that entry, as today. The merge above adds details to that entry; it does not change which entry wins.- The existing test "does not read a later source once an earlier one resolves the model" (
device-profile-source.test.ts) still holds for a model that is not custom; for a custom one it changes to expect thedevices.xmlread. UserDeviceProfileSource: itspropertiesprofiles still answer for adevices.xmlprofileavdmanagerdoes not list, and are created with#applyHardwarePropertiesas today. The new fields are not written toconfig.ini.- #341 (open): a model's class comes from the profile it was listed from. Not touched here; classes do not change.
customModels: still lists these profiles as custom.
Rules in play
safety.md:devices.xmlis read only, and its values are claims; every new field is bounded as above and checked for line breaks before use.architecture.md: the registry stays the only place that matches names; the merge goes throughmatchProfile.
Tests
Seam: parseDevicesXml and UserDeviceProfileSource in src/drivers/android/device-profile-source.test.ts; AndroidDriver listCatalog and resolveSpec through createDriver in src/drivers/android/index.test.ts (model on "device-profile sources", which writes devices.xml with writeDevicesXml), with the fake avdmanager list device printing the profile with OEM : User, as a real SDK does.
- reads
tag-id,api-level,playstore-enabled, the diagonal and the fold from adevices.xmlprofile - parses
-, empty,33-,24-33,-30and33as the ranges above, and40-30,abc,0-and1000-as no range - ignores a
tag-idoutside the allowed characters or length, a diagonal outside 0.1 to 100, and aplaystore-enabledother thantrue/false - a CR, LF or NUL inside a new field rejects the file through the unreadable-file diagnostic, even when the field's value would otherwise be ignored
- a profile with a
tag-idand a 10-inch screen is not a tablet - reads
devices.xmlfromANDROID_USER_HOME, thenANDROID_PREFS_ROOT, thenANDROID_SDK_HOME, then home - a custom profile listed by
avdmanagergets the API range of itsdevices.xmlentry:api-level31-drops levels below 31 from itsmodelRuntimes - a custom profile with
playstore-enabledfalsedrops Play Store images; a custom Wear profile withfalsekeeps an image taggedandroid-wear,google_apis_playstore, listed byavdmanagerordevices.xml-only resolveSpecwith--os 30andprovisionrefuse a custom profile whoseapi-levelis31-- a custom profile with no type and a 10.1-inch screen that does not fold fits
tabletimages; a 6-inch one, one with folded dimensions and one with no diagonal do not - a custom profile with nothing but a name pairs as after #489
- a custom profile's class still comes from
avdmanager'sTag :line - a
devices.xmlprofileavdmanagerdoes not list fits by its owntag-id, range, Play Store flag and screen, and is classed by itstag-id config.inifor adevices.xmlprofile holds the same keys as before this PR
Done when
- With a custom
devices.xmlprofile whoseapi-levelis31-, and images at 30 and 31,simlock catalog --platform android --jsonpairs it only with 31. docs/CLI.md("Where Android models come from") says a custom profile's API range, Play Store setting and screen size from Android Studio decide which images it gets.
Out of scope
- #341.
- Changing a custom profile's class.
- Writing any of these values to
config.ini. doctorreporting adevices.xmlprofile hidden by a library name (#491).
Depends on
- #489
Approval
- Approved for delivery
Written by an agent.
- 主要言語
- TypeScript
- スター
- 20
- フォーク
- 2
- 平均マージ
- 7時間 21分
- マージ済み PR(30日)
- 247
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
callstackincubator/simlock のほかの issue
-
bug:new
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
callstackincubator/simlock#673 ·
メンテナーはふだん 1 日以内に返信
-
bug:needs-info
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
callstackincubator/simlock#657 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
callstackincubator/simlock#639 ·
メンテナーはふだん 1 日以内に返信
-
bug:new
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
callstackincubator/simlock#672 ·
メンテナーはふだん 1 日以内に返信
-
Flaky console lane: CLI auto-launch's fixed 5 s deadline expires while a daemon starts on a loaded runner (ENOENT daemon.sock)対応中かも @V3RON が今日担当しました。 オープンbug:ready flaky-test
callstackincubator/simlock#663 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
callstackincubator/simlock の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
auth: agent-bearer --manager-call is told to use the MCP instance argument on an ambiguous managerオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
bug module: playback
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chthollyphile/folia-major#739 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agilepathway/label-checker#773 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信