About privilege tiers and adb
Most of Tetheron works as soon as the phone and the desktop are paired. A few features need a one-time set-up with Android’s debugging tool, adb. This page explains where the line runs, why it is there, and what you hand over when you cross it. The steps are in Set up the enhanced tier.
Two tiers
The normal tier is everything the app on the phone can do as an ordinary app with the permissions you grant it: notifications with actions and replies, messages, calls, the call log, contacts, photos, file transfer, media controls, Do Not Disturb, ringing the phone, battery and signal, and the clipboard from the desktop to the phone.
The enhanced tier adds what Android does not allow an ordinary app:
- showing the whole screen and controlling it with mouse and keyboard, also with the phone’s own screen off
- opening single apps on displays of their own, shown as windows on the desktop
- capturing the phone’s audio and playing it on the desktop
- using the phone’s camera as a webcam (next release, 0.5.0)
- reading the phone’s clipboard in the background
- switching on permissions for the app that Android otherwise hides behind several settings screens, or does not offer to the user at all
The webcam exists in the enhanced tier only. The feature list gives the tier of every feature.
When the phone is reachable over adb, the daemon uses it. When it is not, the enhanced features are unavailable and the normal tier carries on unchanged. Nothing in the normal tier depends on adb.
What Android withholds from ordinary apps
- Displays for apps. Creating a display that apps can be started on, with input, needs permissions that only system apps and holders of particular system roles get.
- Screen capture. An ordinary app can capture the screen through Android’s screen-sharing dialog. The user must agree at every session, and the app cannot inject touches or keys, cannot switch the screen off while capturing, and sees only the physical screen.
- Input. Injecting touches and keys into other apps needs a permission that ordinary apps cannot hold.
- Clipboard. Since Android 10, only the app in the foreground and the keyboard can read the clipboard.
- Audio. Capturing what the phone plays, without each app’s cooperation, is reserved for the system.
- Granting permissions. Commands that grant a permission to an app without the user tapping through settings exist, but only the system and the debugging shell may run them.
These limits protect you. An app that could read the screen, type and grant itself permissions would be indistinguishable from spyware. Android gives such powers only to code that the phone’s maker vouches for, or to a developer who has enabled debugging on the phone.
Why adb
Tetheron uses the second of those two doors. adb gives a connected computer
a command line on the phone that runs as a special user called shell. The
shell user may do most of what the list above withholds: capture and create
displays, inject input, read and write the clipboard, capture audio, open
the camera and run the commands that grant permissions.
The open-source tool scrcpy has mirrored Android screens this way for years, and its public source documents the many details that differ between Android versions and phone makers. Since Android 11, adb also works over Wi-Fi (“Wireless debugging”) after a pairing step, so a cable is not required after set-up.
The alternatives were rejected for these reasons:
| Alternative | Why not |
|---|---|
| Normal tier only | It leaves out screen mirroring and app windows. |
| Screen-sharing dialog (MediaProjection) | View only, consent at every session, no input, no screen-off, no app displays. |
| Accessibility service as remote control | Slow, cannot type efficiently, sits behind a restricted-settings warning, and resembles malware behaviour. |
| Root | Very few users have it, and on Samsung phones it trips Knox permanently. |
| Shizuku | It is the same adb-shell model behind a second app maintained by someone else, which makes the set-up longer and adds a party to trust. |
| Device owner mode | Needs a factory reset to provision. It is meant for company-managed phones. |
| A partnership with a phone maker | Not available to an open-source project. |
ADR-0007 is the decision record.
The shell helper
The daemon does not send a stream of shell commands to do its work. It uses adb to start one program on the phone, the shell helper, and then talks to that program.
The helper is a second entry point inside the app’s own package, so there is
no second download. The daemon asks Android where the package is installed
and starts the helper from it with app_process, Android’s launcher for
Java programs. The helper therefore always matches the version of the
installed app.
The helper and the app are two processes with different identities:
phone desktop
┌──────────────────────────┐ Tether session ┌──────────────┐
│ Tether app (app user) │◄──────────────────►│ │
│ notifications, calls … │ TLS, paired │ │
├──────────────────────────┤ │ tetherd │
│ shell helper (shell user)│◄──────────────────►│ │
│ screen, input, audio … │ adb tunnel, │ │
└──────────────────────────┘ one-time token └──────────────┘
The helper runs as the shell user. It cannot read the app’s private data, and the app cannot turn itself into the helper, because only a computer with adb access can start it. The helper has no part in pairing, holds no long-lived identity, and exits when its connection to the daemon closes.
When it starts, the helper tests each of its abilities against the Android build it is running on and reports the list. The desktop hides whatever is missing. Hidden parts of Android change between releases, sometimes in monthly updates, and with this probing a broken part costs one feature and the rest of the tier keeps working.
The helper does a fixed set of things on request of the daemon and does not run arbitrary commands for it. The permission grants are a fixed table inside the helper. The daemon names an item, and the helper runs the command that belongs to it; Android permissions and grants has the list. The helper also has limits of its own. It has no root rights, it cannot read other apps’ private data, and screens that an app marks as protected stay black.
ADR-0017 records the design of the helper.
How the daemon talks to adb and the helper
adb knows the phone by a serial, and Tetheron knows it by the identity from pairing. Before the daemon starts a helper, it makes sure the two are the same phone. It sends a one-time token through adb to a receiver in the app that only the shell and the system may call, and the app returns the token over the encrypted session. The daemon then stores the phone’s serial with the paired device.
The daemon runs the ordinary adb program. Developers also use adb, and
they expect adb devices and adb kill-server to concern only their own
work. By default the daemon therefore runs a second adb server for its Wi-Fi
connections, on its own port and with its own key in its data directory.
Your adb server and key are not touched. USB is the exception: only one adb
server can own the USB connection, so a phone on a cable is reached through
your normal adb server and your key. The setting adb_server switches
everything to your own server; see
Configuration and files.
The helper connects back to the daemon through a tunnel that adb provides, ending at a listener on the desktop that accepts local connections only. Other programs on the desktop could connect to that listener too. Each helper start therefore gets a fresh random token, and every connection the helper opens must present it. The daemon passes the token to the helper on its standard input. It does not put the token on the command line, because command lines are visible to other processes on the phone.
ADR-0016 records the adb integration.
What this means for your security
The limits of the helper are limits of Tetheron’s own code. They are not limits of what you grant. Authorising a computer for adb gives that computer a full shell on the phone. Any program running under your account on the desktop that can use the authorised key could see the screen, type, install apps and change settings on the phone, with or without Tetheron.
The set-up wizard says so before it begins. Set up the enhanced tier only on a computer you trust and keep to yourself, and weigh these points:
- Pairing lets the desktop use the features of the app. adb authorisation lets it act as a developer on the phone.
- Developer options and debugging stay switched on for as long as you use the enhanced tier.
- You can revoke the authorisation at any time on the phone: switch debugging off, or choose Revoke USB debugging authorisations in Developer options. The normal tier keeps working.
About the security model covers pairing, encryption and the trust between the paired devices.
What survives a restart
| After | What stays | What is lost |
|---|---|---|
| The helper exits or adb disconnects | The link, the authorisation, the grants | Open phone screen and app windows end. The daemon starts the helper again, waiting longer between attempts if it keeps failing. |
| The desktop or the daemon restarts | The link (stored in the configuration), the adb keys, the switches for phone audio and webcam | The helper, until the phone is connected and reachable again |
| The phone restarts | Pairing, the adb authorisation of the desktop, the grants applied to the app | The helper. On Samsung phones, Wireless debugging is switched off. |
A Samsung phone that restarts stops accepting adb over Wi-Fi until Wireless debugging is switched on again. One of the grants lets the app do that itself when the daemon asks, so that the enhanced tier comes back without you opening Developer options. One UI permits it only on Wi-Fi networks that you allowed for Wireless debugging, and elsewhere it switches the setting straight back off. A USB cable is not affected.