bug(device): Android web model is reported as K with reduced User-Agent; use Client Hints when available
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
- 領域
- backend, mobile-dev
調査の方向性
Start in device/src/web.ts and trace how Device.getInfo() derives the web model from the User-Agent. Add focused tests for a valid Client Hints model and the listed fallback cases, including other platforms. Done means Android web uses a valid hinted model when available while preserving the parsed model in fallback cases.
索引モデルが issue の本文から書いたものです。
説明
Bug Report
Plugin(s)
@capacitor/device (web implementation). Observed with version 8.0.3; the current default-branch implementation in device/src/web.ts also still relies on User-Agent parsing and does not request Client Hints.
Capacitor Version
Relevant package versions: @capacitor/core 8.6.0 and @capacitor/device 8.0.3. A complete cap doctor report is not included; this report concerns the browser implementation only.
Platform(s)
Web, specifically Chrome/Chromium on Android with User-Agent reduction enabled, on HTTPS.
Current Behavior
Device.getInfo() derives model from navigator.userAgent. A reduced Android User-Agent such as:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36
is parsed as model: "K". This is a generic value rather than the hardware model. On supported browsers, User-Agent Client Hints can expose a more accurate model, subject to browser policy.
Expected Behavior
Use the existing User-Agent parser as the baseline, and enhance the Android web model using navigator.userAgentData.getHighEntropyValues(["model"]) when available. Preserve the existing model if the API is unavailable, the request rejects, or the returned model is empty/invalid.
No native changes, public signature changes, or third-party dependencies should be needed: getInfo() already returns a Promise. Other fields could remain unchanged to keep the fix focused.
Code Reproduction
Run this in an HTTPS web application with @capacitor/device, using Chrome on an Android device:
import { Device } from "@capacitor/device";
const info = await Device.getInfo();
const hints = typeof navigator.userAgentData?.getHighEntropyValues === "function"
? await navigator.userAgentData.getHighEntropyValues(["model"])
: null;
console.log({ userAgent: navigator.userAgent, parsedModel: info.model, hintedModel: hints?.model });
When Chrome exposes the hardware model via Client Hints, parsedModel can be K while hintedModel contains the actual model. If the browser withholds the hint, the current result should remain the fallback.
This is an inline reproduction; no standalone reproduction repository is attached.
Other Technical Details
Suggested tests: nonempty hinted model overrides the parsed model; missing API, rejected request, empty/whitespace/non-string model preserve the parsed result; other platforms remain unchanged.
Client Hints do not provide a unique device identifier and should not be documented as such.
Additional Context
This revisits #509, which requested the same progressive enhancement and was closed during backlog cleanup. The maintainer comment invited opening a new issue if it remained relevant. The reduced User-Agent behavior is now a practical issue rather than only an anticipated change.
Chrome documentation: https://developer.chrome.com/docs/privacy-security/user-agent-client-hints
Would a narrowly scoped PR implementing this model enhancement with fallback and tests be welcome?
- 主要言語
- Java
- スター
- 688
- フォーク
- 691
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ionic-team/capacitor-plugins のほかの issue
-
platform: android
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ionic-team/capacitor-plugins#2635 ·
メンテナーはふだん 1 日以内に返信
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ionic-team/capacitor-plugins#2627 ·
メンテナーはふだん 1 日以内に返信
-
triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ionic-team/capacitor-plugins#2616 ·
メンテナーはふだん 1 日以内に返信
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageオープンtriage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
ionic-team/capacitor-plugins#2604 ·
メンテナーはふだん 1 日以内に返信
-
platform: android
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
ionic-team/capacitor-plugins#2636 ·
メンテナーはふだん 1 日以内に返信
ionic-team/capacitor-plugins の issue をすべて見る
似ている issue
-
Test: Verify vault unlock max failed attempts and PIN brute-force protection対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
wultra/powerauth-tests#980 ·
-
account bug communication lecture
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
line/centraldogma#1397 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: Fixed/recurring deposit accounts are treated as savings in ownership and listings対応中かも @Aana123 が今日担当しました。 オープンbug Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/fineract-consumer-facing#252 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
ShaftHQ/SHAFT_ENGINE#7946 ·
メンテナーはふだん 1 日以内に返信