Skip to content

fix(playscan): match Android XR by namespace instead of invented feature names - #24

Merged
ethanzhoucool merged 1 commit into
mainfrom
fix/xr-form-factor-names
Jul 28, 2026
Merged

fix(playscan): match Android XR by namespace instead of invented feature names#24
ethanzhoucool merged 1 commit into
mainfrom
fix/xr-form-factor-names

Conversation

@ethanzhoucool

@ethanzhoucool ethanzhoucool commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Fixes the issue Cursor Bugbot reported on #22, which was correct and which I merged without reading.

featureFormFactors mapped Android XR to android.software.xr.immersive and android.hardware.xr.head_tracking. Neither is a real feature constant, so no XR app ever matched and XR packages kept getting the phone track's blocking target API finding. That is the exact false CRITICAL the form-factor work was supposed to remove. The regression test used the same invented names, so it passed while the rule did nothing.

No XR constant appears in PackageManager's constant pool in android.jar for API 34, 35 or 36, so an exact name cannot be verified the way the others were. Rather than replace one unverifiable guess with another, XR is matched on its namespace: a required feature under android.software.xr. or android.hardware.xr. marks the app as XR. That covers api.spatial, api.openxr, the hardware.xr.* inputs, and anything added later.

The other four names are unchanged and were confirmed by reading PackageManager's constant pool out of android.jar on all three platform versions: android.hardware.type.watch, android.hardware.type.television, android.software.leanback, android.hardware.type.automotive.

Tests now use real XR feature names, and cover the namespace boundary (android.software.xrated and com.example.xr.custom stay on the phone track) and required="false". The new test was confirmed to fail against the shipped names.

Verified end to end against an aapt2-linked XR APK: targetSdk 33 with a required android.software.xr.api.spatial feature now reports WARN ... this is a Android XR app instead of CRITICAL.


Note

Low Risk
Localized playscan manifest classification fix with expanded tests; no auth, security, or data-path changes.

Overview
Fixes false CRITICAL target-API findings on real Android XR apps by detecting XR from required <uses-feature> names under android.software.xr. or android.hardware.xr. instead of two exact strings that never appear in real manifests or android.jar (API 34–36).

Manifest.FormFactor() now checks those prefixes after the verified Wear/TV/Automotive map, so XR apps get the non-phone WARN path in ruleTargetAPILevel rather than the phone track’s blocking rule. Wear, TV, and Automotive mappings are unchanged aside from comment/formatting.

Tests switch to real XR feature names, add TestFormFactorMatchesXRByNamespace (forward-compatible names, non-matches like android.software.xrated, and required="false").

Reviewed by Cursor Bugbot for commit a5c2cf9. Bugbot is set up for automated code reviews on this repo. Configure here.

featureFormFactors mapped XR to android.software.xr.immersive and
android.hardware.xr.head_tracking. Neither is a real feature constant. I
made them up, so no XR app ever matched and XR packages kept getting the
phone track's blocking target API finding, which is the exact false
CRITICAL the form-factor work was meant to remove. The regression test
used the same invented names, so it could not catch it.

No XR constant appears in PackageManager's constant pool in android.jar
for API 34, 35 or 36, so an exact name cannot be verified the way the
other four were. Rather than swap one unverifiable guess for another, XR
is now matched on its namespace: a required feature under
android.software.xr. or android.hardware.xr. marks the app as XR. That
covers api.spatial, api.openxr, the hardware.xr.* inputs, and anything
added later.

The other four names are unchanged and were confirmed by reading
PackageManager's constant pool out of android.jar on all three platform
versions: type.watch, type.television, software.leanback, type.automotive.

Tests now use real XR feature names, and cover the namespace boundary
(android.software.xrated and com.example.xr.custom stay phone) and
required="false". Verified against an aapt2-linked XR APK: targetSdk 33
with a required api.spatial feature reports WARN naming Android XR, not
CRITICAL.

Reported by Cursor Bugbot on #22.
@ethanzhoucool
ethanzhoucool merged commit 5af7309 into main Jul 28, 2026
4 checks passed
@ethanzhoucool
ethanzhoucool deleted the fix/xr-form-factor-names branch July 28, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant