A devices.xml profile's device type, API range, Play Store and screen size decide its class and images
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- android, typescript
- Ambito
- backend-api-design, devtools
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 19
- Fork
- 1
- Merge medio
- 7h 57m
- PR unite (30g)
- 213
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di callstackincubator/simlock
-
Lint does not enforce index.ts boundaries for cleanup/, routing/, warm-pool/ and contract/ helpersApertabug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
callstackincubator/simlock#445 ·
I maintainer di solito rispondono entro 1 giorno
-
bug:new
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
callstackincubator/simlock#424 ·
I maintainer di solito rispondono entro 1 giorno
-
daemon-lifecycle e2e: the it.fails status test passes for the wrong reasonForse già presa @V3RON l’ha presa 7 giorni fa. Apertabug:triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
callstackincubator/simlock#422 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
feature:spec
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
callstackincubator/simlock#602 ·
I maintainer di solito rispondono entro 1 giorno
-
agent-device's gateway side runs as an optional moduleForse già presa @V3RON l’ha presa oggi. Apertatask:ready
callstackincubator/simlock#598 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di callstackincubator/simlock
Issue simili
-
documentation good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
sujithputta02/Esapay#13 ·
-
Share dialog: the address book's contact count reads "1 contacts" (no singular form in any language)Forse già presa @chibenwa l’ha presa oggi. Apertaai-driven-qa bug claude Cosmetic
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
linagora/twake-contacts-frontend#271 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Koenkk/zigbee2mqtt#33402 ·
I maintainer di solito rispondono entro 1 giorno
-
dx P2 platform Stellar Wave Wave 10
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
winsznx/routedock#579 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:ui effort:S enhancement priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno