feat: local, offline Wi-Fi API for the pinned kiosk app

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

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
android, kotlin

調査の方向性

Read ADR-0009 and the agent's kiosk configuration handling around pinPackage and config.apply before anything else. The open questions (naming, authority, the optional consent toggle, and the installer-of-record guard) need a maintainer decision before any code is written. Done means a maintainer has settled those points and a reviewed PR adds the ${applicationId}.localapi provider with its authorization checks.

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

説明

Area

Device agent (Android)

The problem

We run a single-app kiosk on fully managed tablets: the MDMesh agent is Device Owner, and our app is pinned (kioskMode single). The tablets sit in people's homes, and the kiosk app has its own Wi-Fi screen. When a household changes its router or Wi-Fi password, the person at the tablet has to join the new network from inside the kiosk.

Since Android 10, only the Device Owner (or the system) can add, enable, disable or remove saved networks, or switch the radio. addNetwork, enableNetwork, disableNetwork, removeNetwork and setWifiEnabled all fail for any other app targeting Q or later. No delegation scope covers Wi-Fi. So under MDMesh the pinned app can't manage Wi-Fi at all.

It also has to work offline. The moment Wi-Fi needs changing is usually the moment the device has no connectivity, so a policy or command from the server can't help. Today the wifi and wifiRadio policies lock the Wi-Fi settings and switch the radio, and the enrollment QR code's Wi-Fi fields only cover first contact. Nothing in the agent adds a network after enrollment.

Proposed solution

A small local API in the agent that works offline, usable only by the app the kiosk is pinned to:

  • Transport: an exported ContentProvider at ${applicationId}.localapi, implementing call() only.

  • Methods:

    • describe
    • wifi.connect {ssid, password, security: open|wep|psk|sae}
    • wifi.saved
    • wifi.forget {ssid}
    • wifi.setAutoJoin {ssid, enabled}
    • wifi.disconnect
    • wifi.setRadio {enabled}

    Every reply carries ok, code, message and apiVersion.

  • Authorization, checked in the agent on every call, offline:

    • the agent is Device Owner;
    • the persisted kiosk is single-app, and its pinPackage equals getCallingPackage(), which the platform verifies;
    • the caller's installer of record is the agent.

    Anything else gets UNAUTHORIZED with a reason. describe always answers, so the app can tell whether it may use the API.

  • Logging: no passwords or SSIDs in logs. The five calls that change something go to the event log as localApi <method> <code>.

  • No protocol change: it's local to the device, so /agent/v1 is untouched (ADR-0009).

If you'd rather have explicit consent than the implicit "pinned app" rule, I'm happy to gate it behind a configuration toggle, say "Let the kiosk app manage Wi-Fi", off by default. That would add one field to config.apply.

We have this implemented on an agent-only branch with unit tests, and ./gradlew detekt assembleDebug lintDebug testDebugUnitTest passes: https://github.com/MDMesh-app/MDMesh/compare/main...nexi-space:MDMesh:feat/local-wifi-bridge. We're testing it on a Lenovo Tab running Android 16 now. We'd much rather stay on main than carry a fork, so if the direction fits, I'll open a PR, split however you prefer.

Open questions for you:

  • the naming and the authority;
  • whether you want the toggle;
  • whether the installer-of-record check is the right extra guard. It also rejects an app that has updated itself through its own PackageInstaller session, until MDMesh reinstalls it.
Alternatives considered
  • WifiNetworkSpecifier: the connection is bound to the requesting app's process and lost when it restarts. It isn't a saved network.
  • Network suggestions: best-effort, need user approval, and can't be removed or listed reliably.
  • ACTION_WIFI_ADD_NETWORKS: a system "Save network?" dialog, Settings must be allowed in lock task, and the app can't forget a network.
  • A helper app targeting API 28, for the legacy addNetwork path: it relies on a compatibility exception Google could remove.
  • Pushing Wi-Fi from the server: doesn't help a device that's offline.
  • Being our own DPC: what we're moving away from by adopting MDMesh.
Before submitting
  • I searched existing issues and discussions for the same idea.
主要言語
Java
スター
44
フォーク
25
平均マージ
1日 13時間
マージ済み PR(30日)
80

環境構築

はじめの一歩

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

MDMesh-app/MDMesh のほかの issue

MDMesh-app/MDMesh の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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