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

Đang mở
#144 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
15/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, kotlin
Lĩnh vực
api, authorization, mobile

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Java
Star
44
Fork
25
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
80

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của MDMesh-app/MDMesh

Tất cả issue của MDMesh-app/MDMesh

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.