ADR-0007: Privilege tiers: normal vs enhanced (adb shell helper)
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
android,architecture,security
Context
Phone Link’s headline features (whole-screen mirroring with the phone screen off, per-app streaming windows, cross-device clipboard, drag and drop, Instant Hotspot) exist only on OEMs where Link to Windows ships as a privileged system app (Samsung, HONOR, OPPO, ASUS ROG, Surface Duo). Our research into what a normal, sideloaded app can do on Android 14/15 found hard walls:
- CompanionDeviceManager device profiles. The
APP_STREAMINGandCOMPUTERprofiles (what Link to Windows uses for streaming) requireREQUEST_COMPANION_PROFILE_APP_STREAMING/..._COMPUTER, which aresignature|privileged(role-holder only). LikewiseVirtualDeviceManager(trusted virtual displays with input) needsCREATE_VIRTUAL_DEVICE, also privileged. A normal app cannot create a display that apps may be launched onto with injected input. - MediaProjection lets a normal app capture the screen, but: consent is a per-session system dialog (Android 14 removed the ability to persist the token, and defaults to “single app”), it cannot inject touches or keys, it cannot turn the screen off while capturing, it captures the physical display only (no per-app virtual display), and audio capture is limited to apps that opt in. That is a screen viewer, not remote control.
- AccessibilityService can
dispatchGestureand read the UI tree, so one could fake “remote control” with it. It is slow (one gesture at a time, hundreds of ms), cannot type efficiently, is gated behind the same “restricted settings” flow plus a scary warning, is treated as malware behaviour by Play Protect heuristics, and reading the clipboard from the background is blocked anyway. Rejected as a foundation. - Clipboard: since Android 10 only the foreground app or the default IME can read the clipboard. A normal app can set the clipboard (PC → phone) and can read it only while its own UI is in the foreground (Quick Settings tile or share sheet), which is what Phone Link does on non-OEM phones too.
- Permission grants:
pm grant,appops set,cmd notification allow_listener,settings put,dumpsys deviceidle whitelistare shell-only. - Audio: phone audio to PC without the app’s cooperation requires
CAPTURE_AUDIO_OUTPUT(system) or shell’sREMOTE_SUBMIXaccess.
Everything else Phone Link does (notifications with actions and reply, SMS/MMS, Bluetooth calls, photos, files, media controls, DND, battery) is reachable from a normal app with runtime permissions.
The one route to the privileged tier that does not require root or an OEM
partnership is the shell uid (2000) via adb, the model scrcpy has used
successfully for years: adb shell can run app_process with our APK on the
classpath, and as shell it holds INJECT_EVENTS, display capture via
SurfaceControl, virtual display creation (scrcpy’s --new-display),
READ_CLIPBOARD/WRITE_CLIPBOARD for the shell package, display power control
(SurfaceControl.setDisplayPowerMode, scrcpy’s --turn-screen-off), REMOTE_SUBMIX
audio, and all the pm/appops/settings/cmd grants. Since Android 11,
wireless debugging (adb pair with a 6-digit code) lets the desktop obtain
adb access over Wi-Fi without a cable, which our daemon can drive end to end.
Known costs: Samsung resets the Wireless Debugging toggle on reboot and One UI 6+
“Auto Blocker” blocks adb until disabled; a desktop with adb authorisation has a
full shell on the phone.
Decision
Tether defines two tiers and every feature in docs/reference/feature-parity.md
declares which one it needs.
- Normal tier (default, no adb): everything a normal app with runtime permissions and a CDM association can do. Notifications (incl. OTPs via CDM), SMS/MMS as non-default app (ADR-0011), calls over Bluetooth HFP, photos and media files, file send/receive, media controls, DND, ring, battery/signal, clipboard PC → phone, clipboard phone → PC via tile/share sheet, phone as webcam (foreground camera stream).
- Enhanced tier (opportunistic, requires adb): the desktop launches a shell
helper on the phone:
adb shell CLASSPATH=$(pm path org.tether.android) app_process / org.tether.shell.Main --token <one-time>. The helper is a second entry point inside our own APK’s dex (no separate download), runs asshell, and connects back to the daemon (viaadb reverseor LAN TLS with the one-time token) speaking aShell*message family. It unlocks: whole-screen mirroring with input and screen-off, per-app streaming on virtual displays, phone audio to PC, clipboard phone → PC without interaction, permission auto-grants (notification access,RECEIVE_SENSITIVE_NOTIFICATIONS, battery allowlist,MANAGE_EXTERNAL_STORAGE), and later hotspot experiments. - Opportunistic: the desktop (re)launches the helper whenever the phone is
reachable over adb (wireless or USB) and degrades silently to the normal tier
when it is not. Enhanced setup is a one-time wizard (M4): enable Developer
options → Wireless debugging, disable Samsung Auto Blocker,
adb pairdriven from the desktop. The daemon detects the post-reboot toggle reset and prompts. - Security boundaries: the helper authenticates to the daemon with a one-time
token minted per launch; the helper runs as
shell, not as our app, so it cannot read our app’s private data and we never ship a path that lets the app escalate to shell on its own. The UI labels Enhanced features and explains that adb authorisation grants the desktop broad control of the phone. - Root is never required and never used even if present.
Consequences
Positive
- The full Phone Link “Samsung tier” becomes reachable on any Android 14+ phone, not only OEM-partnered ones, and the normal tier still covers everything most users use daily.
- Reusing our APK as the helper means one artefact to install and version-match.
- scrcpy’s public, GPL-compatible (Apache-2.0) implementation documents every
SurfaceControl/InputManagerreflection quirk per Android version, including Samsung Knoxapp_processworkarounds.
Negative / risks
- Hidden-API reflection breaks across Android releases and OEM forks.
Mitigation: capability probing in
ShellHello, per-feature fallbacks, tracking scrcpy’s fixes. - Wireless debugging state resets on Samsung after reboot; Auto Blocker must be off. Mitigation: detection + guided prompt; USB cable always works.
- adb authorisation is a large trust grant from phone to desktop. Mitigation: explicit consent screen, revocable via “Revoke USB debugging authorisations”, and the normal tier never needs it.
- The
adbpackage becomes a desktop dependency (Debian/Ubuntu ship it; Flatpak will bundle it). - Two tiers double the test matrix for features that exist in both (clipboard, OTP notifications). Mitigation: feature registry with explicit tier and tests per tier.
Alternatives considered
- Normal tier only (what every other Linux attempt does): leaves out the features users mean when they say “Phone Link”. Rejected as the ceiling.
- MediaProjection-based mirroring: viewer only, per-session consent, no input, no screen-off. Rejected; may be offered as a fallback viewer later.
- AccessibilityService remote control: slow, abusive, gated. Rejected.
- Root (Magisk/KernelSU): tiny audience, trips Knox permanently. Rejected.
- Shizuku / Sui as the privileged launcher: Shizuku is the same adb-shell model behind an app other people maintain; depending on it for core features makes onboarding worse and adds a trust party. We may add “launch via Shizuku” as an optional path later; its API is a good reference.
- Device owner / Dhizuku (device policy controller): requires factory reset provisioning; enterprise-only. Rejected.
- Ask an OEM for a partnership: not available to an open-source project.
Amendment (2026-12-04): what later decisions changed
Three statements in the decision above were overtaken by later records and by the code. The tier model itself stands.
- The helper’s one-time token is not a command-line argument. The daemon
starts
org.tether.shell.Mainwith the name of its socket as the only argument and writes the token to the helper’s standard input, because arguments are visible inps(ADR-0016, ADR-0017). The helper connects back through anadb reversesocket. - Phone as webcam is an enhanced-tier feature. It was listed under the normal tier as a foreground camera stream. As built, the camera is captured by the shell helper (ADR-0019); a camera stream from the ordinary app was considered there and left for later.
- Automatic clipboard sync from the phone does not need the helper. It needs two one-time grants made over adb (ADR-0013, amendment of 2026-11-11).