← Back to Pull requests

docs(architecture): Android の AR 表示の契約を書く #1703

Closed
unknown closed this pull request without merging on Nov 30, 2026 14:48 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 14:36 UTC
Author

  • 困りごと: ar の Android(#1569)は ARCore の使い方(可否の判定・GL が要る update・許可・背景・原点)の契約が base に無く、実装の PR で設計と実装が混ざる

  • 直し方: docs/architecture/android-ar.md に Android 固有の決定を書く。後に乗る ar-camera-view の Android(#1571)と共有する所も書く

  • 前提: 契約の正は crates/fandhe-cap-ar/src/contract.rs のまま変えない(Android は同じ座標・三値・守る範囲に合わせる)

  • やらないこと: コード・宣言・依存・対応表は触らない(実装は #1702、依存は承認の後)
  • Summary

  • ARCore(com.google.ar:core 1.57.0)を AR Optional で使い、checkAvailabilityAsync が SUPPORTED_INSTALLED 以外は Unsupported。導入・更新の画面は出さない(#335 の方針)

  • Session は機能 crate の Java のワーカー 1 本にオフスクリーンの EGL を持たせて全部ここで回す(update は GL コンテキストとテクスチャが要る)

  • 結果コードは iOS と同じ表を使い、Rust の写像を iOS と共有する。原点は (再)開始ごとに最初の TRACKING から位置と鉛直軸まわりの向きを取り直し、換算は Rust の純関数

  • ar-camera-view は同じ Session・ワーカー・読み取りに映像を足す(8 節)
  • 足す依存(実装の本 #1702 で、利用者の承認の後)

    | package | 版 | ライセンス | GMS |
    | --- | --- | --- | --- |
    | com.google.ar:core | 1.57.0 | ARCore Additional Terms of Service(OSS ではない) | play-services の Gradle 依存は無い。端末に Google Play Services for AR の APK が要り、無い・古い・非対応機は Unsupported |

  • POM の直接依存は androidx.annotation:annotation 1.3.0 だけ(アプリは既に新しい版を解決)。OSV で既知の勧告なし(2026-11-30)
  • Test plan

  • markdownlint 0 件

  • コードを触らないため試験・ビルドは無し
  • 契約表の自己点検

    docs のみのため各類型は「該当なし(実装の本 #1702 で点検する)」。設計で先に決めたのは類型 1(許可ダイアログの onPause)・2(世代・許可の直前の見直し)・3(単調時計)・4(再描画の契機)・5(定数を Rust から渡す・OS の画像を処理の中で閉じる)・6(PAUSED の位置を出さない)・9(Session の閉じる経路を 1 か所に)・11(直列のワーカー)。

    Closes #1701
    Refs #1569

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Low Risk

    Documentation-only change; no code, dependencies, or runtime behavior is modified.

    > Overview

    Adds docs/architecture/android-ar.md, a design-only architecture doc for Android AR (#1569 / #1701) so implementation PRs (#1702) can follow a fixed contract without mixing design and code.

    > The document specifies ARCore (com.google.ar:core 1.57.0) as AR Optional, availability via checkAvailabilityAsync (no install prompts; Unsupported when GMS AR is missing), and a single Java worker on a HandlerThread with offscreen EGL for all Session.update() calls—decoupled from the egui render thread. JNI ArHelper (start / read / stop) reuses the same result codes and Rust mapping as iOS, with planned extraction of shared mapping from ios.rs and read_result extended to Option position for PAUSED states.

    > It also defines epoch-based origin reset in Rust (first TRACKING pose → contract coordinates), lifecycle/concurrency (generation, permissions, background), future manifest/Gradle additions for the implementation PR, shared Session boundaries with ar-camera-view (#1571), scope/non-goals, and open validation items (EGL + emulator).

    > No runtime code, manifests, or dependencies change in this PR.

    > <sup>Reviewed by Cursor Bugbot for commit 8a262e5965c92c317062e8e83bcd13d76cce8d99. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    Diff: 378 lines (+283 / -95) across 4 files Reviewer: cursor[bot] Review duration: 11m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 378 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.355
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1703"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.9% (MEDIUM) · Higher = larger blast radius
    42.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.0% · Safe to merge
    17.0%