Cloud provider `ddp`: Google Developer Device Platform Device Streaming (Android, preview) — implementation plan

オープン
#443 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
android, go, google-cloud, grpc

調査の方向性

Start with the internal/cloud provider interface and the existing direct cloud path (ForwardPort → DialWithOptions → handshake), then read the research and spike result in #434. The plan spans a new gRPC provider, CLI wiring, catalog lookup, token reading, tests, and docs, so it needs substantial project context. Done means all three phases are complete; live verification requires the owner’s request for a specific project.

索引モデルが issue の本文から書いたものです。

説明

area/cloud enhancement parked

Follows the research and spike result in #434. Replaces nothing yet: the firebase provider stays until Google's shutdown on September 30, 2027. This is the plan; no code is written.

Scope

A new provider ddp that runs the existing Android flow on a remote device from Google's Device Streaming API, without a relay. Preview (the APIs are v1 and v1alpha, preview) and Android only (the catalog lists no iOS device with the streaming product). Documented as "implemented, tested against a fake server, not yet verified end to end on a live account" until a live run is recorded.

Why it fits

The spike showed that over one DirectAccessService/AdbConnect stream a client can Open{service:"tcp:<port>"} to a process on the device, run shell: / exec: services, and upload bytes (3 MiB, hash matched). So the provider only has to turn that stream into a local TCP port, and the current direct cloud path (ForwardPort -> DialWithOptions -> handshake) works.

Design

  1. Transport: gRPC only. Create/Get/Cancel and AdbConnect are all RPCs of DirectAccessService (devicestreaming.googleapis.com:443), so one transport. Use the generated devicestreamingpb types with grpc directly (not the full client library) to keep the dependency footprint small; check each new module against the repository's license-compliance job before adding it.
  2. Auth: Application Default Credentials (gcloud auth application-default login or GOOGLE_APPLICATION_CREDENTIALS), through golang.org/x/oauth2/google. The only configured value is the Google Cloud project id (cloud.credentials.project_id); no key or token is ever stored in probe.yaml, printed, or logged. The quota project is that project.
  3. Interface fit (internal/cloud):
    • UploadApp(path) only records the local APK path (nothing can be pushed before a session exists); appID is that path.
    • StartSession creates the session (MediumPhone.arm-style modelCode + version id; a TTL; clientInfo.client = "flutter-probe"), polls until ACTIVE (13 to 19 s in the spike; timeout configurable, default 3 min), opens AdbConnect with the X-Omnilab-Session-Name header, pushes the APK with an exec: stream (16 KiB chunks) and installs it with pm install -r, then launches the app (monkey-free: am start of the launcher activity, as the local path does).
    • ForwardPort(devicePort) starts a loopback listener on a free port; each accepted connection gets a new stream id and Open{service:"tcp:<devicePort>"}; two pumps copy bytes both ways; closes propagate as StreamData{close}. One shared gRPC stream, a send mutex, a receive loop that demultiplexes by stream id.
    • StopSession cancels the session (idempotent) and is also called from a signal handler and on context cancel, so an interrupted run does not leave a billed session behind.
  4. Agent token. The direct cloud path connects without a token today. Add an optional interface AgentTokenReader (ReadAgentToken(ctx, session) (string, error)) that ddp implements with the same run-as/file read the local Android path uses, over a shell: stream; the CLI uses it when the provider offers it. Never logged.
  5. Devices. ListDevices reads the Device Run catalog (devicerun.googleapis.com/v1alpha/.../devices, REST) and keeps Android entries whose supportedProducts include deviceStreaming; --cloud-device takes the display model plus version and maps it to the modelCode (a physical model's lower-case catalog id was refused by the API; modelCode worked).
  6. Safety. Default TTL short (for example 30 minutes, cloud.ttl), a visible message with the session id and a cancel hint, a documented cloud.max_session cap, and a probe cloud sessions listing/cancel command in a later step. Billing is the user's; the docs say device time is billed and link the vendor's pricing page.
  7. Registration and docs. ValidProviders, --cloud-provider help, probe.yaml.example, README farm table (support level "implemented, fake-server tested, not verified live"), the Cloud device farms page, VS Code surfaces, llms.txt, CHANGELOG, migration note from firebase.

Tests (all in CI, no network, no credentials)

  • A fake DirectAccessService over bufconn that implements Create/Get/Cancel and an AdbConnect that serves: StatusUpdate, shell:/exec: echo and a hash-checked upload, tcp:<port> backed by an in-process TCP echo server, Fail status for an unavailable port, stream close, and an abrupt stream error.
  • Unit tests: state machine (REQUESTED -> PENDING -> ACTIVE, timeout, unexpected state), cancel on StopSession / context cancel / signal, bridge with 20 concurrent connections, large transfer (several MiB) through the bridge, token read parsing, catalog filtering and name -> modelCode mapping with an httptest server, and a check that no token or credential appears in errors or logs.
  • A test that the CLI uses the provider's token reader and the direct path (not the relay).

Phases and acceptance

  1. Transport + fake-server tests (internal/cloud/ddp*), no CLI wiring. Done when the bridge tests pass under -race.
  2. CLI wiring and docs, preview and Android-only wording, a deprecation cross-link from firebase.
  3. Live verification, only when the owner asks for it in chat for a specific project: one session, the real agent APK, one .probe file; record device, API versions and timings in docs/evidence/ without account details, then update the support level.

Out of scope

iOS (not offered by the API), the Device Run (batch) API, session reuse across runs, the hosted relay.

Risks

Preview APIs may change; pricing is not published in the pages read; the default session expiry seen was 5 minutes and idle behaviour (inactivityTimeout) is unknown; quotas unknown; a dependency on google.golang.org/grpc and protobuf enlarges the binary.

主要言語
Go
スター
6
フォーク
3
平均マージ
6時間 28分
マージ済み PR(30日)
362

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AlphaWaveSystems/flutter-probe のほかの issue

AlphaWaveSystems/flutter-probe の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。