About Tetheron
Tetheron connects an Android phone to a Linux desktop over your own network. There is no account and no cloud service: the two devices pair once and then talk to each other directly over an encrypted connection. Tetheron is free software, licensed GPL-3.0-or-later.
What it does
With the phone paired, the desktop gets:
- the phone’s notifications, with their action buttons and inline reply
- SMS and MMS conversations, with history, search and sending
- calls: answer, decline and dial, with the call audio on the computer over Bluetooth
- file transfer in both directions and a gallery of the phone’s photos
- a shared clipboard
- media controls, phone volume, Do Not Disturb, find my phone, battery and signal
After a one-time set-up over adb, the enhanced tier adds the phone’s screen in a window with mouse and keyboard, phone apps in windows of their own, and the phone’s audio on the desktop. The phone’s camera as a webcam comes with the next release, 0.5.0.
The current release is 0.4.1. The feature list says what each feature needs.
What you need
- A desktop running Ubuntu 24.04 or newer, Linux Mint 22 or newer, or Debian 13 or newer. From release 0.5.0 there is also a tarball with an install script for Fedora, Arch Linux and other distributions. See Supported platforms.
- A phone running Android 14 or newer.
- Both devices on the same network, or on the same VPN.
- Bluetooth on both devices, if you want call audio on the computer.
- USB debugging or Wireless debugging on the phone, for the enhanced tier.
The Android app and the Debian package are on the
releases page. The programs
in the package are still named tether (the desktop app), tetherd (the
daemon) and tether-cli. They keep those names until a later release.
Where to go
| If you want to | Read |
|---|---|
| get a phone connected for the first time | Tutorials, starting with Connect your phone for the first time |
| do one particular thing, or fix a problem | How-to guides and Troubleshoot |
| look up a command, a file or a permission | Reference |
| know why Tetheron works the way it does | Explanation |
Bugs and feature requests go to the issue tracker, questions to the discussions. The roadmap shows what is planned, and Contributing is the place to start if you want to help.
Tutorials
Each tutorial takes one path from the first step to a working result and says what you should see after every step. Do them in order: the second uses the pairing that the first creates.
| Tutorial | You end with | You need |
|---|---|---|
| Connect your phone for the first time | Tetheron installed on both devices, the phone paired, and a phone notification answered from the desktop | A desktop with Ubuntu 24.04, Linux Mint 22 or Debian 13 (or newer), a phone with Android 14 or newer, a USB data cable, both devices on the same network |
| Mirror your phone screen | The phone’s screen in a window on the desktop, controlled with mouse and keyboard | The first tutorial completed |
For a specific goal, such as sending a file or fixing a connection, go to the how-to guides.
Connect your phone for the first time
In this tutorial we install Tetheron on a Linux desktop and on an Android phone, pair the two with a QR code, and answer a phone notification from the desktop. It takes about twenty minutes.
What you need
- A desktop running Ubuntu 24.04, Linux Mint 22 or Debian 13, or a newer version of one of them, on a 64-bit Intel or AMD processor. On Fedora or Arch Linux, do step 1 with Install Tetheron on Linux and continue here with step 2.
- A phone running Android 14 or newer.
- A USB data cable between the phone and the desktop.
- Both devices on the same Wi-Fi or wired network. A guest Wi-Fi network does not work, because it keeps devices apart.
- A password that lets you run
sudoon the desktop.
1. Install Tetheron on the desktop
-
On the desktop, open the releases page in a browser. Under the latest release, download two files: the one whose name starts with
tether_and ends with_amd64.deb, and the one whose name starts withtether-android-and ends with.apk. The browser saves them to~/Downloads. -
Open a terminal and install the package:
cd ~/Downloads sudo apt install ./tether_*_amd64.debaptlists the packages it adds and asks you to confirm. Near the end of its output you see two lines that start withtether:. -
Start the daemon, the background service that talks to the phone:
systemctl --user daemon-reload systemctl --user enable --now tetherd.serviceThe commands print nothing when they succeed.
-
Allow Tetheron through the firewall:
sudo ufw allow Tether sudo ufw allow mdnsEach command answers with
Rules updatedorRule added. If the terminal saysufw: command not found, your desktop has noufwfirewall and there is nothing to allow. Go on. -
Open Tetheron from the applications menu (Tether in 0.4.1 and earlier, on the phone as well).
The window shows No devices yet and a Show pairing QR… button. Leave the window open. We come back to it in step 4.
2. Install Tetheron on the phone
Tetheron is not on Google Play. We install it from the desktop over the USB
cable, with the adb tool that the desktop package brought along. The names
of the phone’s settings below are Samsung’s. Other phones name them slightly
differently.
-
On the phone, open Settings → About phone → Software information. Tap Build number seven times and enter the phone’s PIN when it asks.
Go back to the first page of Settings. There is a new entry, Developer options.
-
Open Settings → Developer options, switch USB debugging on and confirm the phone’s question.
The switch stays on.
-
Connect the phone to the desktop with the USB cable and unlock the phone.
-
In the terminal on the desktop, run:
adb devicesThe first time, the phone asks whether to allow USB debugging from this computer. Tick Always allow from this computer and allow it. Run the command again.
List of devices attached <serial> device<serial>is your phone’s serial number. The word after it must bedevice. -
Install the app:
adb install tether-android-*.apkAfter a few seconds the command prints
Success. If the phone asks about scanning or blocking the app, choose to install it. -
On the phone, open Tetheron from the list of apps.
The app shows Welcome to Tether.
You can unplug the cable now.
3. Grant the permissions
The phone app starts with a set-up wizard. We grant the three permissions that notifications need and skip the rest.
-
Tap Get started.
-
On Show a status notification, tap Allow notifications, then Allow in the system dialog.
The screen says Granted. Tap Continue.
-
On Notification access, tap Open notification access settings.
Android opens its list of apps with notification access. Tap Tetheron, switch it on and confirm the warning.
-
If Android refuses and shows a Restricted setting message, lift the restriction and try again. Otherwise go to step 5.
- Open the phone’s Settings → Apps → Tetheron.
- Tap the ⋮ menu in the top-right corner.
- Choose Allow restricted settings and confirm with your PIN or fingerprint.
- Go back to the app and tap Open notification access settings again. Tap Tetheron, switch it on and confirm the warning.
-
Go back to the app.
The screen says Notification access is on. Tap Continue.
-
On Stay connected in the background, tap Allow unrestricted battery use, then Allow in the system dialog.
The screen says Battery optimisation is off for Tether. Tap Continue.
-
On a Samsung phone, the wizard now shows One more step on Samsung. Follow the four lines on the screen: open the phone’s Settings → Battery → Background usage limits → Never sleeping apps, tap +, select Tetheron and tap Add. Return to the app and tap Continue. Other phones do not show this screen.
-
On Messages and contacts, tap Skip for now. Do the same on Photos and files and on Calls.
The wizard shows Find your PC, with a Scan QR button.
4. Pair by QR code
-
On the desktop, in the Tetheron window, click Show pairing QR….
A Pair by QR dialog opens with a QR code. Below it, the dialog says Valid for 5 minutes. Keep this window open while scanning.
-
On the phone, tap Scan QR. Allow the app to use the camera when Android asks, and point the camera at the code on the desktop’s screen.
The phone shows Paired with followed by the name of your desktop. The desktop shows the same message with the phone’s name, and the phone appears in the sidebar of the window.
-
On the phone, tap Continue.
-
On Register … as a companion, tap Register companion device and tap Allow in the system dialog. On some phones the screen says that the step is skipped and offers only Continue. Tap that.
-
On You’re all set, tap Open Tether.
The phone shows the app’s home screen. Under Paired PCs, the card for your desktop says Connected. A silent Connected to notification stays in the phone’s notification shade for as long as the link is up.
-
On the desktop, click the phone in the sidebar.
The Overview tab shows the phone’s battery level and, further down, a Notifications group.
5. See a notification arrive
-
Ask someone to send you a message in a chat app, or send one to yourself from another device.
-
Watch the desktop.
Within about a second, a desktop notification pops up with the sender and the text. The same notification appears as a row in the Notifications group on the Overview tab.
6. Reply to it, then dismiss it
-
In the Notifications group, type a short answer into the reply field of the row and click the Send reply button next to it.
The window shows Reply sent. On the phone, the chat app sends your answer as if you had typed it into the notification there.
-
Click the Dismiss on phone button of the row.
The row disappears from the desktop, and the notification disappears from the phone’s notification shade.
From now on the phone reconnects by itself when it comes back to the network, after a restart of either device, and when you log in to the desktop.
Where to go next
- Mirror your phone screen, the second tutorial. USB debugging is already on, so its steps 2 and 3 are done.
- Grant Android permissions to switch on what we skipped: messages, contacts, photos and calls.
- Security model for what pairing protects you from.
Mirror your phone screen
In this tutorial we show the phone’s screen in a window on the desktop, click and type in it, and close it again. On the way we set up the enhanced tier, which is done once per phone. We use a USB cable.
We start where Connect your phone for the first time ended: the phone is paired and connected, and because we installed the Android app with adb, Developer options and USB debugging are on and the phone already allows this computer. If you installed the app another way, do the adb preparation in Install Tetheron on Android first.
You also need a USB data cable and about five minutes.
Important
The set-up lets the desktop see the phone’s screen, type, install apps and change settings on the phone. Do this only on a computer you trust and keep to yourself. About privilege tiers and adb explains what is granted and how to take it back.
1. Find the Phone screen row
- Connect the phone to the desktop with the USB cable and unlock it. Keep it unlocked for the next steps.
- Open Tetheron (Tether in 0.4.1 and earlier) on the desktop and select your phone.
- On the Overview tab, look for the group Phone screen.
We see a row titled Not set up with a Set up button.
2. Run the set-up wizard
-
Press Set up.
A dialog titled Phone screen opens. Its first page is headed See and control your phone from here and lists What you are allowing.
-
Read the page, then press Continue.
The page On the phone appears, headed Get the phone ready. Its numbered steps describe Wireless debugging, which we do not need with a cable.
-
Press The phone is connected by USB.
The page Connecting appears and says Connecting to the phone…. The text changes to Starting the helper on the phone…, and a few seconds later the wizard moves on.
If the page shows Waiting for permission on the phone, look at the phone. Tick Always allow from this computer, allow USB debugging, and press Try again.
-
The wizard now shows the page Permissions, headed Permissions for the Tether app. None of them is needed to mirror the screen. Press Continue.
We see the last page, The phone screen is ready.
3. Open the phone screen
Press Open phone screen.
The wizard closes and a new window opens with the phone’s name as its title. It says Opening the phone screen… and then shows the phone’s screen. The first picture can take a few seconds.
Note
The window shows whatever is on the phone’s screen, including notifications and messages. Screens that an app has protected, such as some banking apps, stay black.
4. Click and type
- Click an app icon in the window. The app opens, on the phone and in the window.
- Hold the left button and drag to swipe. Turn the wheel to scroll.
- Click a text field, for example a search box, and type a few words on the desktop keyboard. The words appear in the field.
- Click with the right mouse button. The phone goes back one step.
- Press the middle one of the three buttons at the left of the window’s header bar. Its tooltip starts with Home. The phone shows its home screen.
5. Close the window
Close the window with its close button.
The mirroring stops. In the main Tetheron window the Phone screen row now reads Phone screen is ready with Connected over USB. underneath, and its button is Open. Press it whenever you want the phone screen back. The set-up does not have to be repeated.
Where to go next
- Mirror the screen and open phone apps: keyboard shortcuts, phone apps in their own windows, and the phone’s audio on the desktop.
- Set up the enhanced tier: work without the cable, and apply the permissions we skipped.
How-to guides
Each guide lists the steps that reach one goal. If you have never used Tetheron, start with the tutorial Connect your phone for the first time.
Set up
- Install Tetheron on Linux: install, update or remove
the
.debor the tarball, open the firewall, start the daemon. - Install Tetheron on Android: install the phone app with adb or from the phone’s browser, verify, update or remove it.
- Grant Android permissions: give the phone app the access each feature needs and keep Android from putting it to sleep.
- Pair and unpair devices: pair by QR code or six-digit code, disconnect, unpair.
- Connect across networks: reach the phone by address, or over a VPN or mesh network.
Everyday features
- Handle notifications and messages: answer and dismiss notifications, choose which apps appear, read and send SMS and MMS.
- Transfer files and photos: send files in both directions and browse the phone’s gallery.
- Sync the clipboard: copy on one device and paste on the other.
- Control media and the phone: use media keys, change the volume, switch Do not disturb, ring a lost phone.
- Make and receive calls: answer, decline and dial from the desktop, and talk through the desktop over Bluetooth.
Enhanced tier
These features need a one-time developer connection (adb) between the desktop and the phone. Privilege tiers and adb explains what that connection allows.
- Set up the enhanced tier: connect the desktop to the phone’s USB debugging or Wireless debugging.
- Mirror the screen and open phone apps: show and control the phone’s screen, open phone apps in their own windows, play the phone’s audio.
- Use the phone as a webcam: use the phone’s camera in call apps on the desktop (next release, 0.5.0).
Command line and problems
- Script Tetheron from the command line: drive every
feature with
tether-cli. - Troubleshoot: find the cause of a problem from its symptom and fix it.
- Report a bug: collect versions and logs, remove personal data, file an issue.
Install Tetheron on Linux
Tetheron for the desktop is published on the
releases page as a Debian
package and, from release 0.5.0, as a tarball with an install script for
other distributions. Both contain the daemon tetherd, the app tether and
the command-line tool tether-cli.
Before you begin
- You need a 64-bit Intel or AMD processor (
x86_64,amd64) andsudorights. - For the Debian package you need Ubuntu 24.04, Linux Mint 22 or Debian 13, or a newer version of one of them.
- For the tarball you need a distribution with systemd, glibc 2.39, GTK 4.14 and libadwaita 1.5, or newer versions. Fedora 40 and newer and Arch Linux have them. See Supported platforms.
On a system that fits neither, build from source.
Install the package on Debian, Ubuntu and Linux Mint
-
Download
tether_<version>-1_amd64.debfrom the releases page.<version>is the release number, for example0.4.1. -
Install it with
apt, which also installs the packages it depends on (among themavahi-daemonfor discovery andadbfor installing the phone app and for the enhanced tier):sudo apt install ./tether_<version>-1_amd64.deb
Phone as webcam, which ships with the next release (0.5.0), also needs the
v4l2loopback kernel module. The package suggests it but does not install
it. Use the phone as a webcam has the steps.
Install from the tarball on Fedora, Arch Linux and others
The tarball is published from release 0.5.0. Its install script copies the
programs to /usr/local and does not install distribution packages, so you
install those first.
-
Install the packages Tetheron needs.
On Fedora:
sudo dnf install gtk4 libadwaita avahi android-tools pipewire pipewire-utils \ wireplumber bluez gstreamer1-plugins-base gstreamer1-plugins-good \ gstreamer1-plugins-bad-free gstreamer1-plugin-openh264gstreamer1-plugin-openh264is the H.264 decoder for the phone screen. It comes from the repositoryfedora-cisco-openh264, which Fedora Workstation enables by default. Ifdnfdoes not find the package, enable that repository first.On Arch Linux, and on distributions based on it:
sudo pacman -S --needed gtk4 libadwaita avahi android-tools pipewire pipewire-audio \ wireplumber bluez gst-plugins-base gst-plugins-good gst-plugins-bad gst-libavOn another distribution, install its packages for the same components. Supported platforms lists what each one is for.
-
Start Avahi and Bluetooth if they are not running. Fedora Workstation starts both by default. Arch Linux does not:
sudo systemctl enable --now avahi-daemon.service bluetooth.service -
Download
tether-<version>-linux-x86_64.tar.gzfrom the releases page and unpack it:tar -xzf tether-<version>-linux-x86_64.tar.gz cd tether-<version>-linux-x86_64 -
Run the install script:
sudo ./install.shThe script first checks that the libraries and programs from step 1 are there. It stops if a program in the tarball could not start, and prints the install command for anything else that is missing.
./install.sh --checkruns the check alone, withoutsudo.
The script enables the daemon for every user, as the Debian package does.
./install.sh --help lists its options. The reference page
Configuration and files
lists the files it installs.
These packages are optional:
| Used for | Fedora | Arch Linux |
|---|---|---|
| Clipboard sync while the app is closed | xclip (X11) or wl-clipboard (Wayland) | xclip or wl-clipboard |
| Stay on top and the call banner above other windows, on X11 | wmctrl | wmctrl |
| The ringtone for incoming calls | sound-theme-freedesktop | sound-theme-freedesktop |
| Phone as webcam | akmod-v4l2loopback, from RPM Fusion Free | v4l2loopback-dkms, v4l2loopback-utils and the headers of your kernel, such as linux-headers |
Start the daemon
The installation enables the daemon for every user. It starts when you log in, and
on demand when the app or tether-cli needs it. A session that was already
running during the installation does not know about the daemon yet.
-
Reload the user service manager and start the daemon:
systemctl --user daemon-reload systemctl --user enable --now tetherd.serviceLogging out and back in has the same effect.
-
Check that it answers:
tether-cli selfThe command prints the daemon’s name, identity and settings.
If the app shows Tether service is not running, click Start service.
Open the firewall
The phone connects to the desktop on TCP port 7360. Discovery uses UDP port 7360 and UDP port 5353. If no firewall is active, skip this section.
If ufw is enabled, allow the application profile that Tetheron installs,
and local network discovery:
sudo ufw allow Tether
sudo ufw allow mdns
If firewalld is running, as on Fedora, open the ports in the active zone:
sudo firewall-cmd --permanent --add-port=7360/tcp --add-port=7360/udp --add-service=mdns
sudo firewall-cmd --reload
With another firewall, allow inbound TCP 7360, UDP 7360 and UDP 5353 from your local network.
Open the app
Start Tetheron from the applications menu (Tether in 0.4.1 and
earlier), or run tether in a terminal. With no phone paired, the window
shows No devices yet. Continue with
Install Tetheron on Android and
Pair and unpair devices.
Show the tray icon
The tray icon shows the phone’s battery level, offers quick actions and keeps the app running when you close the window. It is on by default. To change it, open the main menu of the window, choose Preferences and change Show tray icon under Desktop integration.
GNOME has no tray. The icon appears there only when an AppIndicator extension is installed and enabled, such as AppIndicator and KStatusNotifierItem Support. Everything else works without it. Cinnamon, KDE Plasma and other desktops with a tray need nothing extra.
Start the app in the background at login
The daemon starts at login by itself. The app does not. Start it at login as well if you want the tray icon and clipboard sync without opening the window.
- Open Preferences.
- Under Desktop integration, switch on Start Tether in background at login.
This adds an autostart entry that runs tether --background, which starts
the app with the tray icon and no window. Switch the row off to remove the
entry.
Find received files
Files that the phone sends are saved to ~/Downloads/Tether. To change the
folder, open Preferences and choose another Download folder under
Files, or run:
tether-cli config download-dir <folder>
<folder> is the full path of the folder.
Configuration and files lists every setting
and path.
Update
-
Download the newer
.debor tarball from the releases page. -
Install it over the old one. With the Debian package:
sudo apt install ./tether_<version>-1_amd64.debWith the tarball, unpack it and run its install script:
sudo ./install.sh -
Restart the daemon:
systemctl --user daemon-reload systemctl --user restart tetherd.service -
Quit the app (Quit in the main menu or in the tray menu) and open it again.
Pairings and settings are kept. Update the phone app to the same release.
Uninstall
-
Unpair each phone first, so that the phone forgets this desktop too: see Pair and unpair devices.
-
If you switched on Start Tether in background at login, switch it off in Preferences. This removes the autostart entry.
-
Remove the programs. With the Debian package:
sudo apt remove tetherAfter an installation from the tarball:
systemctl --user stop tetherd.service sudo /usr/local/bin/tether-uninstall -
If you allowed Tetheron in the firewall, delete the rule. For
ufw:sudo ufw delete allow TetherFor
firewalld:sudo firewall-cmd --permanent --remove-port=7360/tcp --remove-port=7360/udp sudo firewall-cmd --reload
Your data stays in place. To delete this desktop’s identity, the list of paired phones and the cached messages and photos as well, remove the three directories:
rm -r ~/.local/share/tether ~/.config/tether ~/.cache/tether
Warning
Deleting
~/.local/share/tetherdeletes this desktop’s identity. Every phone must be paired again if you reinstall.
Files you received stay in ~/Downloads/Tether.
Install Tetheron on Android
The phone app is an APK file published on the releases page. Tetheron is not on Google Play. You install the file either from the desktop with adb or from the phone’s browser.
The phone must run Android 14 or newer.
Install with adb from the desktop (recommended)
The desktop package already depends on adb, nothing has to be downloaded or
allowed in the phone’s browser, and the USB debugging set-up is the same one
the enhanced tier needs later for screen
mirroring.
You need a USB data cable and the desktop package installed. The menu names below are Samsung’s. Other phones name them slightly differently.
-
On the phone, open Settings → About phone → Software information. Tap Build number seven times and enter the phone’s PIN. Developer options now appears in Settings.
-
Open Settings → Developer options and switch USB debugging on.
-
Connect the phone to the desktop with the cable and unlock it.
-
On the desktop, download
tether-android-<version>.apkfrom the releases page.<version>is the release number, for example0.4.1. -
In a terminal, check that adb sees the phone:
adb devicesThe first time, the phone asks whether to allow USB debugging. Tick Always allow from this computer and allow it. Run the command again. The phone’s line must end in
device. -
Install the app:
adb install tether-android-<version>.apkThe command prints
Success. If Play Protect shows a warning about an unknown app or offers to scan it, choose to install anyway. -
Open Tetheron on the phone (Tether in 0.4.1 and earlier). The set-up wizard starts. Continue with Grant Android permissions. Android may still ask you to allow restricted settings before it grants notification access. That guide has the steps.
Once the app is installed and paired, the enhanced tier can also reach the phone without a cable. Set up the enhanced tier covers Wireless debugging.
On a Samsung phone, Auto Blocker blocks adb and can block installing an APK. If a step is refused, switch it off under Settings → Security and privacy → Auto Blocker. Leave it off if you use the enhanced tier.
Install from the phone’s browser
-
On the phone, open the releases page in a browser and download
tether-android-<version>.apk. -
Open the download. Android asks whether the browser may install unknown apps. Tap Settings, switch on Allow from this source, go back and tap Install.
-
If Play Protect shows a warning about an unknown app or offers to scan it, choose to install anyway.
-
Open the app and continue with Grant Android permissions.
Verify the download
Release APKs are signed with the project key. The SHA-256 fingerprint of the signing certificate is:
dd87db65274499ba7aab364bce0bf70662dca61de6e2119ba4f97b56288c57cf
Check the file on the desktop. If you downloaded it on the phone, copy it over or download it again.
-
Compare the checksum of the file with the
SHA256SUMSfile attached to the same release:sha256sum tether-android-<version>.apkThe printed value must equal the one in
SHA256SUMS. -
Check who signed it.
apksigneris part of the Android SDK build tools:apksigner verify --print-certs tether-android-<version>.apkThe line
Signer #1 certificate SHA-256 digestmust show the fingerprint above. If it differs, do not install the file.
Update
Download the newer APK on the desktop, connect the phone and run:
adb install -r tether-android-<version>.apk
Without adb, download the newer APK on the phone, open it and tap Update.
Either way Android keeps the pairing, the permissions, the settings and the grants that were made over adb. The app starts its background service again after the update when Run on boot is on in the app’s Settings (the default).
Update the desktop package to the same release.
Switch between a debug build and a release build
A debug build is one you
built from source. It has the same
package name as a release, org.tether.android, and a different signing key,
so Android refuses to install one over the other.
- On the desktop, unpair the phone.
- Uninstall the build that is on the phone.
- Install the other build.
- Run the set-up wizard and pair again.
Uninstalling deletes the phone’s identity, so the desktop sees the new installation as a new phone. Permissions and adb grants must be given again.
Find the installed version
Open the phone app, tap the Settings icon and scroll to the bottom. The last line shows the version, protocol v1 and the licence.
Uninstall
- Unpair first, so that the desktop forgets the phone: on the phone app’s home screen, tap Unpair on the card of each PC.
- Uninstall the app like any other, for example from Settings → Apps → Tetheron → Uninstall.
Android removes the app’s identity, its settings, its permissions and the
grants made over adb. Files that the app received stay in Download/Tether
on the phone.
Developer options, USB debugging and Wireless debugging stay on. Switch them off in the phone’s settings if you no longer need them.
Grant Android permissions
The phone app asks for its permissions in a set-up wizard when you first open it. This guide follows the wizard’s order. Notifications need only the first three steps: the status notification, notification access and battery optimisation. Every later step switches on one more feature and can be skipped. Android permissions and grants lists every permission and what it is used for.
Before you begin
- The app is installed on the phone: see Install Tetheron on Android.
- Paths in the phone’s settings use the wording of stock Android and of Samsung One UI. Other manufacturers use slightly different names.
- In Android’s own lists the app is called Tetheron (Tether in 0.4.1 and earlier).
Allow the status notification
- On Welcome to Tether, tap Get started.
- On Show a status notification, tap Allow notifications and then Allow in the system dialog.
- Tap Continue.
Android requires a visible notification while an app keeps a connection open in the background. This one is silent and reads Connected to followed by the name of your desktop.
Allow notification access
Notification access lets the app read the phone’s notifications and show them on the desktop. Media controls need it as well.
- On Notification access, tap Open notification access settings.
- In the list that Android opens, tap Tetheron and switch on Allow notification access. Confirm the warning.
- Return to the app. The screen says Notification access is on. Tap Continue.
If the switch is greyed out: allow restricted settings
On Android 13 and newer, an app that did not come from an app store may be refused notification access until you allow restricted settings for it. Android then shows a Restricted setting message when you tap the switch.
- Try to switch on notification access once, as described above. On some phones the menu entry of step 3 appears only after this attempt.
- Open the phone’s Settings → Apps → Tetheron. Long-pressing the app’s icon and tapping App info leads to the same screen.
- Tap the ⋮ menu in the top-right corner and choose Allow restricted settings. Confirm with your PIN or fingerprint.
- Return to the app, tap Open notification access settings again and switch on notification access.
If the ⋮ menu is missing, the restriction does not apply to your installation and the switch already works.
Turn off battery optimisation
Android pauses background apps when the screen is off. That delays notifications and drops the connection.
- On Stay connected in the background, tap Allow unrestricted battery use.
- In the system dialog, tap Allow.
- The screen says Battery optimisation is off for Tether. Tap Continue.
If the dialog does not appear, or you declined it, open the phone’s Settings → Apps → Tetheron → Battery and choose Unrestricted.
On Samsung: add the app to the never sleeping apps
One UI has its own mechanism that puts apps to sleep and ignores the setting above. On a Samsung phone the wizard shows One more step on Samsung with these instructions.
- Open the phone’s Settings → Battery. On some versions the path is Settings → Battery and device care → Battery.
- Tap Background usage limits.
- Open Never sleeping apps and tap +.
- Select Tetheron and tap Add.
- Check that the app is not listed under Sleeping apps or Deep sleeping apps on the same screen.
- Return to the app and tap Continue.
A system update can move apps back to the sleeping list. If notifications stop arriving after an update, check this list again.
Allow messages and contacts
This step switches on the Messages tab of the desktop app and gives callers and senders their names. Tap Skip for now to leave it off.
- On Messages and contacts, tap Allow messages and contacts.
- Allow each request that Android shows: SMS, contacts and phone.
- The three lines Messages (SMS/MMS), Contacts and Phone state (SIM and signal) show Granted. Tap Continue.
Your Messages app stays the default SMS app. Tetheron reads the conversations and sends what you type on the desktop. It does not mark messages as read on the phone and does not delete them.
Allow photos and files
This step switches on the Photos tab of the desktop app. Sending and receiving files needs no permission.
- On Photos and files, tap Allow photo and video access.
- In the system dialog, allow access to all photos and videos.
- Photos and videos shows Granted. Tap Continue.
When you delete a photo from the desktop, the phone asks you to confirm. To delete without the question, open Settings → All files access in the phone app and switch it on. The enhanced tier can apply the same grant from the desktop.
Allow calls
- On Calls, tap Allow calls, or Skip for now to leave calls off.
- Allow each request that Android shows: phone, call logs and nearby devices.
- Tap Continue.
Make and receive calls covers the Bluetooth set-up for call audio.
Register the desktop as a companion device
This step comes after pairing. The wizard shows Register, the name of your desktop and as a companion.
- Tap Register companion device.
- In the system dialog, tap Allow.
- The screen says Linked as a companion device. Tap Continue.
With the registration, Android runs the app in the background more reliably. On Android 15 and newer it also lets the app see one-time codes in notifications, which Android otherwise hides.
Tap Skip to go on without it. The step is offered again each time you pair.
If the step says it is skipped
On some Android builds, including Android 16 with One UI 8.5, this registration is reserved for system apps. The wizard says so and shows only Continue. The one effect is that Android 15 and newer may hide one-time codes from notifications on the desktop. The enhanced tier has a grant for sensitive notifications that lifts this.
Grant a permission later
Open the phone app and tap the Settings icon in the top bar.
- Features synced to your PC has one switch per feature: Messages, Contacts, Media controls, Photos, Accept files automatically, Clipboard, Calls, Call history and Bluetooth for calls. A feature whose permission is missing says Permission missing – tap to grant. Tap the row and allow the request.
- Special access opens the system screens for Do Not Disturb access (needed to switch Do not disturb from the desktop), Full-screen alerts (needed so that find my phone shows over the lock screen), All files access and Notification access.
A change here reaches the desktop at the next connection. To apply it at once, tap Disconnect and then Connect on the PC’s card on the home screen.
If notification access is lost, the home screen of the phone app shows Notification access is off. Notifications are not mirrored to your PC. Tap Fix.
Grants that need adb
Android does not offer two things to normal apps: clipboard sync from the phone while the app is in the background, and switching the audio of a call from the desktop. They are granted once from the desktop over adb. Sync the clipboard and Make and receive calls have the individual grants, and Set up the enhanced tier applies all of them from the desktop app.
Pair and unpair devices
Pairing is done once per phone and desktop. Afterwards the two devices recognise each other by their keys and connect by themselves. Security model explains what pairing protects against.
Before you begin
- Tetheron is installed on both devices and the daemon is running on the desktop: see Install Tetheron on Linux and Install Tetheron on Android.
- Both devices are on the same network. If they are not, or they do not find each other, see Connect across networks.
- On the phone, the pairing screen is Find your PC at the end of the set-up wizard. Later, tap Add PC on the home screen of the phone app to reach the same screen, which is then titled Add a PC.
Pair by QR code
The QR code carries the desktop’s addresses and a single-use secret, so there is no code to compare and the devices need not discover each other first.
-
On the desktop, open the app and click Add device (the + button in the sidebar), then Show pairing QR…. With no device in the list, the Show pairing QR… button is in the middle of the window.
The Pair by QR dialog shows the code. It is valid for five minutes. New code creates a fresh one, and the previous one stops working.
-
On the phone, tap Scan QR and point the camera at the code. Allow the camera permission if Android asks.
-
The phone shows Paired with and the desktop’s name. Tap Continue. The desktop closes the dialog and shows the same message.
-
Complete the companion device step on the phone.
If the phone says The PC rejected the QR code (it may have expired), click New code on the desktop and scan again.
Pair by six-digit code
Both devices show a six-digit code that is derived from their keys. You compare the two and confirm on both. Either device can start.
-
Start the pairing on one device:
- On the phone, wait for the desktop to appear under Nearby PCs and tap Pair next to it.
- On the desktop, open the app on the phone first, so that the desktop can see it. Select the phone in the sidebar, where its status is Available to pair, and click Pair on the Overview tab.
-
Look at both screens. The phone shows the code under Pair with or wants to pair. The desktop shows it on the phone’s Overview tab, or in a dialog titled Pair with … ? when the phone started.
-
If the two codes are the same, tap The codes match on the phone and click Codes match on the desktop. You have 60 seconds. The phone shows the time that is left.
-
The phone shows Paired with and the desktop’s name. Tap Continue and complete the companion device step.
Warning
If the codes differ, choose Reject on both devices. Different codes mean that another device on the network is answering in place of yours. Try again with the QR code.
When the phone app is in the background, a pairing request from the desktop arrives as a notification, Pairing request from and the desktop’s name. Tap it to open the code.
Pair from the command line
To pair by QR code, print the code in the terminal and scan it with the
phone. On a terminal with a light background, add --invert.
tether-cli qr
To pair by six-digit code:
-
Open the app on the phone and list the devices that the daemon sees:
tether-cli devices -
Request pairing.
<device-id>is the phone’s id from the list. A prefix that matches only one device is enough.tether-cli pair <device-id>The command prints the six-digit code and asks you to confirm.
-
Compare the code with the one on the phone. If they are the same, confirm in the terminal and tap The codes match on the phone.
When the phone started the pairing, confirm shows the code and asks you to
confirm it. reject refuses a pairing in progress.
tether-cli confirm <device-id>
tether-cli reject <device-id>
Command-line tools lists every option.
Disconnect without unpairing
Disconnect closes the connection and keeps the pairing. Neither device reconnects until you ask for it.
-
On the desktop, open the phone’s Overview tab and click Disconnect. On the phone, tap Disconnect on the PC’s card.
The desktop shows Disconnected — press Connect to resume.
-
To resume, click Connect on the desktop or tap Connect on the phone. Either device can resume, whichever one disconnected.
From the command line:
tether-cli disconnect <device-id>
tether-cli connect <device-id>
The hold is not stored. Restarting the daemon, the phone or the phone app’s background service ends it, and the devices connect again.
Unpair
Unpairing makes each device forget the other’s key. You can start on either device, and it tells the other one.
-
On the desktop: open the phone’s Overview tab, click Unpair and confirm in the Unpair … ? dialog.
-
On the phone: tap Unpair on the PC’s card on the home screen and confirm.
-
From the command line:
tether-cli unpair <device-id>
If the other device was switched off or out of reach at that moment, it may still list the pairing. Unpair there as well. A phone in this state shows The PC no longer trusts this phone – unpair and pair again on the PC’s card.
Pair again
Pair again after you have unpaired, reinstalled the phone app, or deleted the desktop’s data directory.
- Check that neither device still lists the old pairing. Unpair on any device that does.
- Pair by QR code or by six-digit code as described above.
A reinstalled phone app has a new identity, so the desktop treats it as a new phone. Grants made over adb are lost with the old installation and must be applied again.
Pair more than one device
A phone can be paired with several desktops: tap Add PC on the phone for each one. A desktop can be paired with several phones, and each has its own entry in the sidebar.
Connect across networks
A phone and a desktop find each other only inside one local network. The connection itself is an ordinary TCP connection to port 7360, so it works over any path on which one device can reach the other by address. Discovery and connectivity has the background.
| Situation | Works | How |
|---|---|---|
| Same Wi-Fi or wired network | Yes | Devices find each other |
| Same network, discovery blocked by the router | Yes | Manual address or QR code |
| Different networks joined by a VPN or mesh network (WireGuard, Tailscale, ZeroTier and similar) | Yes | Manual address |
| Phone on mobile data with no VPN, desktop at home | No | A self-hosted relay is on the roadmap and has not shipped |
| Guest Wi-Fi or a network with client isolation | No | The network keeps the devices apart. Use another network |
Tetheron has no account and no cloud service, so nothing connects the two devices when neither can reach the other’s address.
Before you begin
- Tetheron is installed on both devices.
- The desktop’s firewall allows TCP port 7360: see Install Tetheron on Linux.
Connect by address on the same network
Use this when both devices are on one network and still do not see each other, for example because the router drops multicast traffic. Pairing by QR code gets round the same problem, because the code contains the desktop’s addresses.
-
Find the desktop’s address. In a terminal on the desktop, run:
hostname -IThe command prints the desktop’s IP addresses. On a home network the one you need usually starts with
192.168.or10.. -
On the phone, open Find your PC (in the wizard) or tap Add PC on the home screen. Tap Enter address.
-
Type the address, for example
192.168.1.20, and tap Connect. Add the port ashost:portonly if you changed it from 7360. -
If the devices are already paired, the phone app goes to its home screen and shows the desktop as Connected. If they are not, both devices show the six-digit code: continue with Pair by six-digit code.
You can also give the desktop the phone’s address:
- Find the phone’s address in the phone’s Wi-Fi settings, in the details of the connected network.
- On the desktop, click Add device (the + button in the sidebar), then Add device by address….
- Enter the address and click Add. The desktop dials the address at once and remembers it.
From the command line, where <address> is host or host:port:
tether-cli add <address>
Tip
Reserve a fixed address for the desktop in your router’s DHCP settings. A manual address stops working when the desktop gets a different one.
Connect over a VPN or mesh network
A VPN or mesh network that gives both devices an address on a shared private network carries the connection across the internet. Discovery does not cross such a network, so you enter the address once.
-
Install and connect the VPN or mesh client on both devices. Check that the phone can reach the desktop, for example by opening another service on the desktop from the phone.
-
Find the desktop’s address on that network. The VPN or mesh client shows it, and
hostname -Ilists it next to the local addresses. -
On the phone, tap Add PC, then Enter address, type that address and tap Connect.
-
If the devices are not paired yet, both now show the six-digit code. Compare and confirm it as described in Pair and unpair devices.
If the firewall on the desktop filters the VPN interface separately, allow TCP port 7360 on it as well.
Limits:
- A phone VPN that does not lead to your desktop routes traffic away from the local network, and the phone cannot reach a desktop on the same Wi-Fi. Some ad blockers work as a local VPN and have the same effect. Exclude the app from the VPN, or switch the VPN off.
- Call audio travels over Bluetooth and needs the phone within Bluetooth range of the desktop. Answering, declining and dialling from the desktop work at any distance.
- The enhanced tier uses the phone’s Wireless debugging, which Android ties to the Wi-Fi network the phone is on. Expect it to work only with both devices on the same network.
- Photos, files and screen mirroring use the same connection, and so the same data allowance on a metered path.
Stop announcing the desktop
The desktop announces itself on the local network so that phones can find it. To stop that, open Preferences in the desktop app and switch off Discoverable, or run:
tether-cli config discoverable false
A phone that is not paired yet then needs the QR code or the desktop’s address.
Handle notifications and messages
This guide covers phone notifications on the desktop, and reading, searching and sending SMS and MMS messages.
Before you begin:
- The phone is paired and connected.
- The Tetheron app on the phone has notification access for notifications, and the SMS, Phone and Contacts permissions for messages. See Grant Android permissions.
The tether-cli examples use 5b7a as the device id. Any unique prefix of
the id from tether-cli devices works.
See and answer notifications
- Open the Tetheron app on the desktop and select the phone in the sidebar.
- On the Overview tab, scroll to Notifications. The list follows the phone: a notification that appears or disappears there does the same here.
Each row has:
- one button for every action the phone app offers, for example “Mark as read”
- Open on phone, which opens the notification on the phone
- a reply box, when the phone app accepts a typed reply. Type into it and
press
Enter. The app shows Reply sent. - a × button (tooltip Dismiss on phone), which removes the notification on the phone too
Each phone notification also appears as a desktop notification. Click it to open the notification on the phone, or click one of its action buttons. Reply opens the Tetheron window with that notification’s reply box focused. On KDE Plasma you type the reply into the desktop notification itself. Dismissing the desktop notification dismisses it on the phone.
If an action does nothing, the notification is probably gone from the phone.
From the command line
tether-cli notifications 5b7a
[0|com.example.chat|12|null|10123] Chat — Ada (conversation)
See you at six
action 0: Reply [reply]
action 1: Mark as read
action -1: open on phone
The text in square brackets is the notification key. Quote it in the other
commands, because keys contain |:
tether-cli notify-act 5b7a '<key>' 1
tether-cli notify-act 5b7a '<key>' -1
tether-cli notify-act 5b7a '<key>' 0 "On my way"
tether-cli dismiss 5b7a '<key>'
The number is the action index. -1 opens the notification on the phone.
Text after the index of the action marked [reply] is sent as the reply.
Change what the desktop shows
To stop one phone app from sending notifications to this desktop:
- On the phone’s Overview tab, click Notification settings….
- In the Notifications from dialog, switch the app off under Apps. An app appears in the list once the phone has sent a notification from it.
The phone then filters that app’s notifications and they never reach the desktop.
To keep notifications in the Tetheron window only, open the main menu, choose
Preferences (Ctrl+,) and switch off Show phone notifications on this
desktop under Notifications, or run:
tether-cli config desktop-notifications false
The main screen of the Tetheron app on the phone has Sync notifications, which switches notifications off for every paired desktop, and an Apps list that excludes single apps. Include ongoing notifications in the phone app’s Settings adds persistent notifications such as downloads and navigation.
Read and search messages
- Select the phone and open the Messages tab. The conversations are on the left, newest first.
- Click a conversation. Scroll up to load older messages.
- Click an image to open it. Other attachments open with the default application.
- To search, type into Search conversations and messages. Matching conversations appear, and matching message texts under Messages. Click a result to open it.
The first sync after pairing copies the whole SMS and MMS history to the desktop and can take a minute. After that you can read the messages while the phone is away.
Tetheron is not the phone’s default SMS app. Opening a conversation marks it read on the desktop only, and the desktop cannot delete messages.
tether-cli conversations 5b7a
tether-cli messages 5b7a <thread>
tether-cli search 5b7a "boarding pass"
tether-cli attachment 5b7a <part-id>
<thread> is the thread id in the first column of conversations.
messages lists attachments with a part_id. attachment downloads one
into the daemon’s cache and prints its path.
Send a message
To answer in an existing conversation, open it, type into the box at the
bottom and press Enter. Shift+Enter starts a new line.
To start a new conversation:
- Click the New message button above the conversation list.
- In the To: field, type a name or a number. Pick the contact from the suggestions, or pick the row marked Send to this number. Add several recipients to send a group MMS.
- Write the message and press
Enter.
To attach files, click the paper-clip button (tooltip Attach files (sent as MMS)) or drop files onto the message box. The message goes out as an MMS. Sending MMS has not been confirmed on a carrier network yet. If an MMS fails, send it from the phone.
On a phone with two SIMs, a SIM selector (tooltip SIM used for sending) appears next to the send button.
A message that fails shows Not sent and a Retry button.
tether-cli send 5b7a +15550100 "Running ten minutes late"
tether-cli send 5b7a +15550100 "The photo" --attach ~/Pictures/photo.jpg
tether-cli send 5b7a +15550100 --to +15550101 --to +15550102 "Dinner at eight?"
tether-cli send 5b7a +15550100 --sim 2 "Sent from the second SIM"
The command waits for the phone’s result. Add --no-wait to return as soon
as the message is queued. Repeat --attach for several files. --sim takes
the SIM’s subscription id, and tether-cli status 5b7a prints one
sim <id>: line per SIM.
Reply to a new message from its desktop notification
An incoming message raises a desktop notification with the sender and the start of the text, unless that conversation is open in the app.
- Click Reply on the notification. The Tetheron window opens on that conversation with the message box focused.
- Type the reply and press
Enter.
To switch these notifications off, open Preferences and switch off Notify about new messages under Notifications, or run:
tether-cli config message-notifications false
While messages sync, the daemon hides the notification from the phone’s own SMS app, so you do not see each message twice.
RCS chats
RCS chats (“chat features” in Google Messages and Samsung Messages) do not appear on the Messages tab, because Android gives other apps no access to them. An incoming RCS message still arrives as a notification from the phone’s messaging app, and you can reply to it there. A message sent from the Messages tab is always an SMS or an MMS.
Related pages
- Command-line tools lists every option of the commands used here.
- Troubleshoot covers notifications that stop arriving.
Transfer files and photos
This guide covers sending files between the desktop and the phone, and browsing the phone’s photos and videos from the desktop.
Before you begin:
- The phone is paired and connected.
- For photos, the Tetheron app on the phone has the Photos and videos permission. See Grant Android permissions.
The tether-cli examples use 5b7a as the device id. Any unique prefix of
the id from tether-cli devices works.
Send files from the desktop to the phone
Use any of these:
- Drag files from a file manager onto the phone’s page in the Tetheron app. Any tab of the page accepts the drop.
- Open the Files tab and click Send files….
- In the tray icon’s menu, open the phone’s entry and choose Send files to followed by the phone’s name.
The transfer appears on the Files tab with its progress. To stop it, click
the cancel button on its row (tooltip Cancel transfer). The phone saves
the files to Download/Tether.
If Accept files automatically is off in the phone app’s Settings, the phone first shows a notification with Accept and Decline. An offer that is not answered within 60 seconds fails.
From the command line:
tether-cli send-file 5b7a ~/Documents/report.pdf ~/Pictures/photo.jpg
offered as 3f9c2a
running 1048576/5242880 bytes
done 5242880/5242880 bytes
The command follows the transfer until it ends. Add --no-wait to return as
soon as the files are offered. To cancel a transfer, find its id and pass it
to cancel-transfer:
tether-cli transfers 5b7a
tether-cli cancel-transfer 5b7a <transfer-id>
Send files from the phone to the desktop
- On the phone, select the files in any app and tap Share.
- Choose Send to PC in the share sheet.
- If more than one desktop is connected, pick the desktop.
The Send files button on the desktop’s card in the Tetheron app on the phone does the same.
The desktop saves the files to ~/Downloads/Tether. A file whose name already
exists there is saved as name (2).ext. When a file has arrived, the Tetheron
app shows a message with an Open folder button, or a desktop notification
with Open folder and Open when its window is hidden.
Sharing text or a link to Send to PC does not create a file. The text lands in the desktop clipboard. See Sync the clipboard.
Be asked before a file is accepted
By default the desktop accepts files from paired phones without asking.
- Open the main menu and choose Preferences (
Ctrl+,). - Under Files, switch off Accept files from paired phones automatically.
An incoming transfer then opens a dialog in the Tetheron app that lists the files, with Accept and Decline.
From the command line, switch the setting off, watch for the offer and answer it by its transfer id:
tether-cli config auto-accept-files false
tether-cli watch
FileOffered from 5b7a19c04e2d: 3f9c2a report.pdf (5242880 bytes) (accept with `tether-cli accept-file 5b7a19c04e2d 3f9c2a`)
tether-cli accept-file 5b7a 3f9c2a
tether-cli accept-file 5b7a 3f9c2a --reject
Change the download directory
- Open Preferences.
- Under Files, click the folder button on the Download folder row and choose a directory.
tether-cli config download-dir ~/Documents/FromPhone
tether-cli config download-dir
The second command prints the current value. The folder button at the top of the Files tab opens the directory.
Browse the phone’s photos
- Select the phone and open the Photos tab. Thumbnails load as you scroll.
- Narrow the list with All, Photos, Videos or Screenshots, or with the album selector (All albums).
- If something recent is missing, click the reload button (tooltip Reload the photo index from the phone).
Then:
- Click a photo to download the original and open it with the default application.
- Right-click a photo and choose Save as… or Copy. Copy puts the image on the desktop clipboard.
- For several photos, click the selection button (tooltip Select photos), click the photos you want, then use the buttons in the bar that appears. Select all is in the right-click menu.
- Drag a photo onto a file manager window or into an application that accepts files. The original is downloaded when you drop it.
From the command line:
tether-cli photos 5b7a screenshot --limit 20
tether-cli albums 5b7a
tether-cli photos 5b7a --album Camera
cp "$(tether-cli fetch 5b7a <media-id> | tail -n 1)" ~/Pictures/
The first column of photos is the item’s id. fetch downloads the original
into the daemon’s cache and prints the path of the file on its last line.
tether-cli thumb 5b7a <media-id> does the same for a thumbnail.
Delete photos from the phone
Warning
Deleting removes the photo from the phone’s storage. Tetheron has no trash to restore it from.
- Right-click a photo and choose Delete from phone, or select several photos and click the delete button (tooltip Delete from the phone).
- Confirm with Delete.
- If the Tetheron window shows Confirm the deletion on your phone to finish, unlock the phone and confirm Android’s prompt.
tether-cli delete-photo 5b7a <media-id> <media-id>
Android asks for the confirmation on the phone unless the Tetheron app has all-files access. To give it, open the app on the phone, go to Settings and tap All files access under Special access. With adb set up, you can run this on the desktop instead:
adb shell appops set org.tether.android MANAGE_EXTERNAL_STORAGE allow
The grant survives app updates but not an uninstall.
Related pages
- Command-line tools lists every option of the commands used here.
- Configuration and files describes
download_dir,auto_accept_filesand where the daemon caches photos. - Android permissions and grants lists every grant.
Sync the clipboard
Tetheron shares copied text between the desktop and the phone. It syncs text only.
Before you begin: the phone is paired and connected.
| Direction | X11 session | Wayland session |
|---|---|---|
| Desktop to phone | Automatic, also while the Tetheron app is closed. | Automatic only while the Tetheron window is focused. |
| Phone to desktop, sent by hand on the phone | Works. | Works. If the Tetheron window is not focused, click Copy on the message it shows. |
| Phone to desktop, automatic | Needs the adb grants or the enhanced tier. | Same, with the Copy step above. |
Copy on the desktop, paste on the phone
Copy text on the desktop, then paste on the phone.
On Wayland this works only while the Tetheron window is focused, because a
Wayland program cannot read the clipboard without focus. The desktop app has
no button that sends the clipboard by hand. To send text at any other time,
use the command line, where 5b7a is a unique prefix of the device id from
tether-cli devices:
tether-cli clipboard 5b7a send "text for the phone"
wl-paste | tether-cli clipboard 5b7a send
Without text, the command reads standard input. The second line sends the
current Wayland clipboard. send fails when Sync clipboard does not allow
the desktop-to-phone direction.
On X11, sync continues while the app is closed if xclip is installed
(package xclip on Debian, Fedora and Arch Linux). The daemon uses it in
place of the app.
Send the phone’s clipboard to the desktop
Android does not let a normal app read the clipboard in the background, so this direction needs an action on the phone. Copy the text on the phone, then use one of these:
- Tap the Send clipboard tile in the phone’s Quick Settings panel. Add the tile to the panel once.
- Tap Send clipboard on the persistent “Connected to” notification.
- Select text in any app, tap Share and choose Send to PC.
If more than one desktop is connected, the phone asks which one.
The text lands in the desktop clipboard. On Wayland, when the Tetheron window
is not focused, the app shows a “Clipboard from” message in its window, or a
desktop notification when the window is hidden. Click Copy on it. While
the app is closed, the daemon sets the clipboard with wl-copy (package
wl-clipboard). To keep the app running in the tray, switch on Start
Tether in background at login in Preferences.
The Clipboard sync row on the phone’s Overview tab in the desktop app
shows the last text from the phone, with a button that copies it again.
tether-cli clipboard 5b7a get prints the same text. It does not ask the
phone for its current clipboard.
Make phone-to-desktop sync automatic
With two one-time grants, text you copy on the phone reaches the desktop within about a second.
-
Connect the phone with adb. Set up the enhanced tier shows how.
-
Run on the desktop:
adb shell pm grant org.tether.android android.permission.READ_LOGS adb shell appops set org.tether.android SYSTEM_ALERT_WINDOW allow -
Copy text on the phone and paste on the desktop to check.
Android may show a short “pasted from your clipboard” message on the phone for each copy. The grants survive app updates but not an uninstall.
While the enhanced tier’s helper runs, you do not need the two grants. The helper reports the phone’s clipboard itself.
Switch clipboard sync off
On the desktop:
- Open the main menu and choose Preferences (
Ctrl+,). - Under Clipboard, set Sync clipboard to Off, Desktop to phone, Phone to desktop or Both directions.
tether-cli config clipboard-sync off
The values are off, to_phone, from_phone and both. Without a value,
the command prints the current setting.
On the phone, switch off Clipboard in the Tetheron app’s Settings. The desktop stops offering the feature for that phone after the next connection.
Related pages
- Android permissions and grants lists every grant and what it allows.
- Privilege tiers and adb explains why some features need a grant.
- Configuration and files describes
clipboard_sync.
Control media and the phone
This guide covers playback and volume on the phone, Do Not Disturb, ringing the phone to find it, and its battery, SIM and Wi-Fi status.
Before you begin: the phone is paired and connected. Media controls need notification access on the phone. See Grant Android permissions.
The tether-cli examples use 5b7a as the device id. Any unique prefix of
the id from tether-cli devices works.
Control playback
- Start playback in any media app on the phone.
- In the desktop app, select the phone. The Overview tab shows a card with the title, artist and album art.
- Use the Previous, Play / pause and Next buttons, and drag the position slider to seek.
The card follows the phone’s active media session and disappears when nothing is playing.
The keyboard’s play/pause, next and previous keys and the desktop’s media applet work too, without set-up and without the Tetheron app open. The phone appears in the applet under its own name. If a media player on the desktop is also running, the desktop decides which player the keys control.
From the command line:
tether-cli media 5b7a
tether-cli media 5b7a toggle
tether-cli media 5b7a next
tether-cli media 5b7a seek 90000
Without an action, media lists the phone’s media sessions and marks the
active one with *. The actions are play, pause, toggle, next,
prev, stop and seek with a position in milliseconds.
playerctl works as well. The player’s name is tether_ followed by the
first eight characters of the device id, and it exists only while the phone is
connected and has a media session:
playerctl --list-all
playerctl --player=tether_5b7a19c0 play-pause
playerctl --player=tether_5b7a19c0 metadata
Change the phone’s volume
The volume slider on the media card (tooltip Phone media volume) sets the media volume. The other streams are available from the command line:
tether-cli volume 5b7a
music 7/15
ring 5/15
call 3/5
notification 5/15
alarm 9/15
Set a stream with its name and a level between 0 and the maximum shown:
tether-cli volume 5b7a ring 0
tether-cli volume 5b7a music 10
Switch Do Not Disturb
The phone must allow Tetheron to change the setting. Once, on the phone, open the Tetheron app, go to Settings and tap Do Not Disturb access under Special access. Until then the switch on the desktop is greyed out.
- On the Overview tab, under Phone, switch Do not disturb on.
- Optional: choose the Mode: Priority only, Alarms only or Total silence.
A change made on the phone shows on the desktop too.
tether-cli dnd 5b7a
tether-cli dnd 5b7a priority
tether-cli dnd 5b7a all
The values are all (Do Not Disturb off), priority, alarms and none
(total silence). Without a value, the command prints the current state.
Find the phone
- On the Overview tab, under Phone, click Ring phone on the Find my phone row. The phone plays an alarm at full volume, also in silent mode.
- To stop it, tap Stop on the phone or click Stop ringing on the desktop. The alarm stops by itself after 60 seconds.
tether-cli ring 5b7a
tether-cli ring 5b7a stop
To let the phone show the alert over the lock screen, tap Full-screen alerts under Special access in the phone app’s Settings once.
Check battery, SIM and Wi-Fi
The top of the Overview tab shows:
- the battery level, and Charging while the phone charges
- one entry per SIM with the carrier and the network type. Hover for the signal strength.
- the Wi-Fi network name
- Airplane mode while it is on
If the SIM entries are missing, grant Signal and SIM status in the phone app’s Settings.
The tray icon’s tooltip shows the connected phone and its battery level. The daemon posts a desktop notification once per discharge when the phone drops to 15 % or below while it is not charging.
From the command line, devices has the battery level (a + marks charging)
and status has the rest:
tether-cli devices
ID NAME KIND PAIRED CONNECTED BATTERY STATE
5b7a19c04e2d Example Phone phone yes yes 82%+ paired
tether-cli status 5b7a
name: Example Phone
connected: true (held: false)
capabilities: notifications messages media volume dnd ring connectivity clipboard
wifi: "HomeNetwork" level 3
airplane mode: false
sim 1: ExampleTel LTE 3/4 (data)
dnd: all (can change: true)
ringing: false
Related pages
- Command-line tools lists every option of the commands used here.
- D-Bus API describes the media player and the status properties.
- Make and receive calls covers pausing desktop media during calls.
Make and receive calls
This guide covers answering and placing phone calls from the desktop, and talking through the desktop’s speakers and microphone.
Answering, declining, dialling and the call log work as soon as the phone is connected. Hearing the caller on the desktop needs Bluetooth as well, which you set up once.
Before you begin:
- The phone is paired and connected.
- In the Tetheron app on the phone, under Settings, the Calls and Call history features have their permissions. For call audio on the desktop, Bluetooth for calls needs its permission too. A row that says “Permission missing – tap to grant” still needs a tap.
Answer, decline or silence an incoming call
When the phone rings, the desktop shows a call window with the caller’s name, and a desktop notification with Answer and Decline.
In the call window:
- Answer on PC answers and puts the audio on the desktop. The button reads Answer when call audio on the desktop is not available, and the audio then stays on the phone.
- Answer on phone answers and keeps the audio on the phone.
- Decline rejects the call.
- The muted-speaker button silences the ringer on the phone and the desktop. The call keeps ringing silently.
- The close button or
Eschides the window. The phone keeps ringing.
The buttons react to the mouse only, so typing in another window cannot answer a call by accident.
A call you did not answer leaves a “Missed call from” notification with Call back.
Mute or hang up during a call
A call that rang on the desktop or was dialled from it opens the in-call window.
- Mute mutes the phone’s microphone. Click it again to unmute.
- The hang-up button (tooltip Hang up) ends the call.
- A second incoming call appears in the same window with its own answer and decline buttons. Answering it puts the current call on hold.
If you close the window, the Return to Call button in the banner on the phone’s page and the Return to call entry in the tray menu reopen it.
Dial a number
- Select the phone and open the Calls tab.
- Type a name or a number into Name or number, or click the keypad. Hold
0for+. Typing a name suggests matching contacts. - On a phone with two SIMs, choose the SIM (tooltip SIM card to call from).
- Click the call button.
The phone places the call and the in-call window opens on the desktop.
Use the call log
The Calls tab lists the phone’s calls under Recent calls, newest first. Scroll down to load older entries. Each row has a call button, and a message button (tooltip Send a message) that opens a new message to that number.
Unseen missed calls are counted in a badge on the Calls tab and in a Missed calls row on the Overview tab. Opening the Calls tab marks them seen on the desktop. The phone’s own call log does not change.
Set up call audio on the desktop
For call audio the desktop connects to the phone as a Bluetooth hands-free device, the way a headset does. You pair the two over Bluetooth once.
You need a Bluetooth adapter in the desktop and Bluetooth switched on on both devices. Keep the phone unlocked and nearby.
- Open the Calls tab. The row under Call audio reads Call audio not set up.
- Click Set Up, then Start in the Set up call audio dialog.
- On the phone, tap the “Pair with … over Bluetooth” notification if one appears, and accept Android’s pairing request.
- Compare the six-digit code in the dialog with the one on the phone. If they match, confirm on the phone.
- Wait for Call audio is set up and click Done.
The row now reads Call audio through this PC. Calls you answer on the desktop play through its default speakers and microphone.
What the row can read later:
| Row | What to do |
|---|---|
| Call audio disconnected | Click Connect. |
| Bluetooth is off | Switch Bluetooth on in the desktop’s settings. |
| Bluetooth not available | The desktop has no usable adapter. Call control still works and the audio stays on the phone. |
To stop using the desktop for calls without unpairing, click Disconnect.
If earbuds or another headset are connected to the phone, Android may send the call there. Disconnect them for calls on the desktop.
Move the audio during a call
The Audio buttons in the in-call window show where the audio is and move it:
| Button | Audio plays on |
|---|---|
| PC | the desktop’s speakers and microphone |
| Phone | the phone’s earpiece |
| Speaker | the phone’s loudspeaker |
The selection also follows a switch that you make on the phone.
Moving the audio from the desktop needs a one-time grant on the phone. Without it, only Phone works from the desktop. To bring the audio to the desktop you then pick the desktop on the phone’s own call screen, under Bluetooth.
To give the grant:
-
Connect the phone with adb. Set up the enhanced tier shows how.
-
Run on the desktop:
adb shell appops set org.tether.android MANAGE_ONGOING_CALLS allow
The grant survives app updates but not an uninstall. Android permissions and grants lists every grant.
Change the call settings
-
Open the main menu and choose Preferences (
Ctrl+,). -
Under Calls, set:
Switch Effect when on Answer calls on this PC a call you answer on the desktop moves its audio to the desktop Ring on this PC the desktop plays a ringtone for incoming calls Pause media during calls music and videos on the desktop pause while a call rings or is active, and resume afterwards
Echo cancellation has no switch in the app. It is the call_echo_cancel key
in the daemon’s configuration file. See
Configuration and files.
Do the same from the command line
5b7a stands for the device id. Any unique prefix of the id from
tether-cli devices works.
tether-cli answer 5b7a
tether-cli decline 5b7a
tether-cli silence 5b7a
tether-cli mute 5b7a on
tether-cli hangup 5b7a
tether-cli dial 5b7a +15550100 --sim 2
tether-cli calls 5b7a
tether-cli calllog 5b7a --missed --limit 10
tether-cli bt 5b7a pair
tether-cli audio 5b7a pc
tether-cli config call-ringtone false
calls prints the current calls, where the audio is, and the Bluetooth
state. --sim takes the SIM’s subscription id, and tether-cli status 5b7a
prints one sim <id>: line per SIM. calllog --seen marks the missed calls
seen after listing them. bt also takes status, connect and
disconnect, and audio takes pc, phone or speaker. The settings are
call-audio-on-pc, call-ringtone and pause-media-on-call.
Command-line tools has every option.
Known limits
- There is no in-call keypad, because Android lets only the phone’s own dialler send touch tones. For menus and PIN codes, use the keypad on the phone.
- No conference calls (merge or swap) and no video calls.
- Echo cancellation starts a few seconds into a call on the desktop.
- Occasional short static-like noises can occur during calls on the desktop.
- The phone’s ringtone may play on the desktop next to the desktop’s own.
Related pages
- About calls and call audio gives the reasons behind these limits.
- Troubleshoot covers calls without audio.
Set up the enhanced tier
The enhanced tier gives the desktop adb access to the phone, so that Tetheron can start its helper there. The phone screen, phone apps in windows, phone audio on the desktop and the webcam need it. You set it up once per phone and desktop.
For a guided first run over USB, follow the tutorial Mirror your phone screen.
Warning
A desktop with adb access has a full shell on the phone: it can see the screen, type, install apps and change settings. Set this up only on a computer you trust and keep to yourself. About privilege tiers and adb explains what is granted.
Before you begin
You need:
- The phone paired and connected to this desktop.
adbversion 34.0.0 or newer on the desktop. The Tetheron.debdepends on theadbpackage. On Fedora and Arch Linux it is inandroid-tools. To check, open Preferences from the main menu of the Tetheron app and look at Developer connection tool (adb) in the group Phone screen.- For USB: a USB data cable.
- For Wi-Fi: the phone and the desktop on the same Wi-Fi network, and Android 11 or later.
The menu names below are Samsung’s. Other phones name them slightly differently.
In the commands, replace <id> with the device id, or a unique prefix of it,
from tether-cli devices.
Turn on Developer options
If you installed the Android app with adb, Developer options and USB debugging are already on. Otherwise:
- On the phone, open Settings → About phone → Software information.
- Tap Build number seven times and enter the phone’s PIN.
Developer options now appears in Settings.
Set up over USB
- On the phone, open Settings → Developer options and switch USB debugging on.
- Connect the phone to the desktop with the cable and unlock it.
- In the Tetheron app, select the phone. On the Overview tab, press Set up in the group Phone screen.
- Press Continue, then The phone is connected by USB.
- If the phone asks whether to allow USB debugging, tick Always allow from this computer and allow it.
- Wait for the page Permissions. Continue with Apply and check grants, or press Continue to skip them.
From the command line, do steps 1, 2 and 5 and run:
tether-cli enhance <id> setup
The command prints the status when the helper has started.
A phone on a cable is reached through your own adb server and key. See
adb_server in Configuration and files.
Set up over Wireless debugging
- On the phone, open Settings → Developer options → Wireless debugging and switch it on. If the phone asks, choose Always allow on this network. Without it, Tetheron cannot switch Wireless debugging back on after the phone restarts.
- Keep the Wireless debugging screen open.
- In the Tetheron app, press Set up in the group Phone screen, then Continue, then Pair over Wi-Fi. The page Pair shows a QR code.
- On the phone, tap Pair device with QR code and point the camera at the code.
- Watch the line under the code. It goes from Waiting for the phone to scan the code… to Paired with the phone., and the wizard moves on to Connecting and then Permissions.
If the phone cannot scan the code:
- On the page Pair, press Use a pairing code instead.
- On the phone, tap Pair device with pairing code. The phone shows six digits.
- Type the digits into Pairing code and confirm.
From the command line:
tether-cli enhance <id> pair
tether-cli enhance <id> code <6 digits>
pair prints the QR code in the terminal and waits. Add --invert on a
terminal with a light background. Ctrl+C cancels. Run code while the
phone shows the pairing code.
A pairing attempt ends by itself after five minutes. After an update of the phone to a new Android version, you may have to pair again.
Apply and check grants
With adb access, the desktop can switch on permissions for the Tetheron app on the phone that otherwise need a walk through Android’s settings, and a few that cannot be granted on the phone at all. All of them are optional. Android permissions and grants lists each one and what it enables.
- Open the page Permissions. It is the wizard’s page after connecting. Later, open the More menu of the row in the group Phone screen and choose Permissions….
- Switch on the ones you want, or press Allow all.
- Read the line above the list. It says how many permissions are not allowed yet. A permission that the phone refused shows Could not be allowed: and the reason.
A switch that is on cannot be switched off here. Take a permission back in the phone’s settings.
From the command line:
tether-cli enhance <id> grants
tether-cli enhance <id> grants apply
The first command lists every grant as granted or missing. The second
applies all of them and prints the list again.
Re-arm after a phone reboot
Samsung phones switch Wireless debugging off when they restart. The row in the group Phone screen then reads Wireless debugging is off.
-
If you applied the grant Change protected settings (
write_secure_settings), Tetheron asks the phone app to switch Wireless debugging back on, once, when the phone reconnects. If that did not happen, press Turn on in the row, or run:tether-cli enhance <id> rearm -
Without that grant, switch Wireless debugging on again under Settings → Developer options on the phone.
One UI switches Wireless debugging straight back off on a Wi-Fi network that you did not allow with Always allow on this network. On such a network, switch it on by hand on the phone and choose that option.
A USB cable does not depend on Wireless debugging. Plug the phone in and use
Try again, or tether-cli enhance <id> setup.
Restart the helper
The daemon starts the helper whenever the phone is connected to Tetheron and
reachable over adb, and starts it again when it exits. To restart it
yourself, open the More menu of the row in the group Phone screen and
choose Restart, or run tether-cli enhance <id> restart.
Open phone-screen and app windows end when the helper restarts. Use Reconnect in the window.
Check the status from the command line
tether-cli enhance <id> status
adb: ready (34.0.4)
state: ready
serial: <adb serial of the phone>
transport: usb
can re-arm: false
abilities: mirror.main mirror.input mirror.screen_off …
| Line | Meaning |
|---|---|
adb | ready, missing or too_old, and the version found |
state | unavailable, not_set_up, debugging_off, offline, unauthorized, starting, ready or error, with a reason in brackets where there is one |
serial | the adb device linked to this phone, - if none |
transport | usb, wifi or - |
can re-arm | whether the phone app may switch Wireless debugging on |
abilities | what the helper can do on this phone. Features without their ability are hidden. |
mirror | one line per open phone-screen or app window |
Remove the set-up
Tetheron has no command that removes the link. Take the access back on the phone:
- Open Settings → Developer options.
- Switch Wireless debugging and USB debugging off.
- Choose Revoke USB debugging authorisations, so that no computer keeps its permission to connect.
The features of the enhanced tier stop. Everything else in Tetheron keeps working.
Permissions that were applied as grants stay with the Tetheron app on the
phone. Take them back in the phone’s settings. The desktop keeps the phone’s
adb serial as adb_serial in its configuration file. See
Configuration and files.
If something does not work
| What you see | Cause and remedy |
|---|---|
| Phone screen is not available, or the wizard’s Continue is greyed out under a banner about adb | adb is missing or older than 34. Install or update the adb package, then press Check again. If adb is installed in an unusual place, set adb_path (Configuration and files). |
| Waiting for permission on the phone | The phone has not authorised this desktop. Unlock the phone and accept the debugging question with Always allow from this computer. If no question appears, run the set-up again. The authorisation can drop after you replug the cable or toggle debugging. |
| Wireless debugging is off | See Re-arm after a phone reboot. |
| Phone screen cannot reach the phone | The phone is not connected to Tetheron at the moment, or adb cannot reach it. Put both devices on the same Wi-Fi network or plug in the cable, then press Try again. |
| Phone screen stopped working | The helper stopped or could not be started. The text underneath gives the reason. Press Try again. |
| That paired … Scan the code with the right phone. | Another paired phone scanned the QR code. Scan it with the phone the wizard was opened for. |
| The QR code could not be made. Use the pairing code below. | Use the pairing code. |
| Pairing did not work | Check that the Wireless debugging screen is still open on the phone and that both devices are on the same network, then press Try again. |
| Debugging cannot be switched on, or the set-up is refused, on a Samsung phone | Samsung’s Auto Blocker can stop debugging, above all over USB. Turn off Settings → Security and privacy → Auto Blocker and try again. |
To see why the helper fails, read the daemon’s log at debug level. See
Troubleshoot. Every action of tether-cli enhance is
listed in Command-line tools.
Mirror the screen and open phone apps
This guide covers the phone’s screen in a window on the desktop, single phone apps in windows of their own, and the phone’s audio on the desktop.
All of this needs the enhanced tier. If the row in the group Phone screen on the phone’s Overview tab does not read Phone screen is ready, set up the enhanced tier first.
In the commands, replace <id> with the device id, or a unique prefix of it,
from tether-cli devices.
Open the phone screen
- In the Tetheron app, select the phone.
- On the Overview tab, press Open in the group Phone screen.
A window with the phone’s name opens and shows the screen. The header bar shows the size of the picture in pixels.
Close the window to stop. If the connection is lost, the window says why and offers Reconnect. While the window is open, the phone does not go to sleep.
From the command line:
tether-cli mirror <id>
The command starts the Tetheron app with only that window, or asks a running app to open it. It refuses unless the enhanced tier is ready.
Use the mouse and the keyboard
| Input | Effect on the phone |
|---|---|
| Left click | Tap |
| Left button held and moved | Swipe or drag |
| Right click | Back |
| Middle click | Home |
| Wheel | Scroll, vertically and horizontally |
| “Back” side button of the mouse | Back |
| “Forward” side button of the mouse | Recent apps |
| Typing | Text goes to the focused field on the phone, through the desktop’s input method, so dead keys and compose sequences work |
Keys with Ctrl, and keys such as arrows, Enter, Tab, Esc, F1 to F12 | Sent as key presses, so shortcuts inside Android apps such as Ctrl+C and Ctrl+A work |
| Volume and media keys of the keyboard | Sent to the phone |
The header bar has buttons for Back, Home and Recent apps.
The window keeps these shortcuts for itself:
| Shortcut | Action |
|---|---|
Alt+H | Home |
Alt+B or Alt+Backspace | Back |
Alt+S | Recent apps |
Alt+M | Menu key |
Alt+P | Power button |
Alt+Up, Alt+Down | Volume up, volume down |
Alt+O | Switch the phone’s own screen off or on |
Alt+W | Fit the window to the picture |
Alt+F or F11 | Full screen |
Ctrl+V | Paste the desktop’s clipboard on the phone |
Ctrl+Shift+V | Type the desktop’s clipboard as text |
Ctrl+V sets the phone’s clipboard to the desktop’s text and pastes it.
Ctrl+Shift+V types the text, for fields that refuse a paste. Both are also
in the window’s menu as Paste the clipboard and
Type the clipboard as text.
Shortcuts with the Super key are left to the desktop.
When the phone rotates, the window resizes to the new shape. A maximised or
full-screen window keeps its size and shows the picture with bars. To bring a
window back to the picture’s shape, choose Fit the window to the screen
in its menu or press Alt+W.
Switch the phone’s screen off while mirroring
The phone’s own screen can stay dark while its picture is shown on the desktop.
- In the phone screen window, press the toggle button at the right of the
header bar (tooltip Turn the phone’s own screen off while it is shown
here), or press
Alt+O. - To start every phone screen window that way, open Preferences in the Tetheron app and switch on Turn the phone’s screen off while it is shown here in the group Phone screen.
- From the command line:
tether-cli mirror <id> --screen-off.
The phone’s screen comes back when the window closes. The button is missing on a phone whose Android build does not support it.
Open a phone app in its own window
An app window shows one app on a separate display that the phone creates for it. The phone’s own screen stays free.
- Select the phone and open the Apps tab.
- Find the app. Type in Search apps to filter by name or package. Switch on System apps to include the apps that came with the phone.
- Click the app.
The app opens in a window titled with its name. Mouse and keyboard work as in the phone screen window, with these differences:
- The header bar has Back and a paste button only. Home, Recent apps and Power are not sent to an app window.
- The phone’s on-screen keyboard does not appear. Type on the desktop
keyboard, or paste with
Ctrl+V.
To open the app on the phone’s own screen, right-click it on the Apps tab and choose Open on the phone screen, or choose the same entry in the app window’s menu.
Limits:
- Closing the window closes the app on that display. There is no option to keep it running on the phone.
- When the app is closed on the phone, the window closes.
- Up to eight windows can be open for one phone, the phone screen included.
- Apps opened this way appear in the phone’s Recents.
- Protected screens, such as those of some banking apps, stay black.
From the command line:
tether-cli apps <id>
tether-cli app <id> <package>
apps lists package names and labels. Add --system to include preinstalled
apps. app opens the window for one package name from that list.
Change the size of an app window
Resize the window as usual. After a moment the phone changes the size of the app’s display to match, and the app lays itself out again. Text in the app is about as large as text on the desktop.
The window’s menu has Window size with three presets:
| Preset | Size of the app area |
|---|---|
| Phone | 450 × 800 |
| Tablet | 960 × 720 |
| Wide | 1280 × 720 |
A new app window opens at the Phone size. Tetheron remembers the last size of each app’s window.
Full screen and Stay on top are in the same menu. Stay on top
works on X11 only and needs the wmctrl program.
Pin an app to the desktop
- On the Apps tab, right-click the app.
- Choose Pin to desktop.
The app gets an entry in the desktop’s app menu, with its own icon and the phone’s name in its description. Starting it opens the app’s window, provided the phone is connected and the enhanced tier is ready. Pinned apps are listed first on the Apps tab and carry a pin mark.
To remove the entry, right-click the app and choose Unpin.
Play the phone’s audio on the desktop
- Select the phone and open the Overview tab.
- In the group Phone screen, switch on Play phone audio on this PC.
The line under the switch says what is happening, for example Playing here; the phone itself is silent. or Playing here and on the phone., depending on how the phone lets its sound be captured. The same switch is in the menu of every phone screen and app window. The sound appears in the desktop’s volume mixer as a stream named “Tether:” followed by the phone’s name.
- The audio does not need an open window.
- It pauses while a call exists on the phone, ringing included, and resumes afterwards.
- Depending on the capture method, ringtones, alarms, notification sounds
and calls stay on the phone, and a few apps do not allow their sound to be
passed on.
phone_audio_sourcechooses the method. See Configuration and files.
From the command line:
tether-cli phone-audio <id> on
tether-cli phone-audio <id> off
tether-cli phone-audio <id>
Without on or off the command prints the state.
If something does not work
| What you see | Remedy |
|---|---|
| A banner in the window says that a video parser or decoder is not installed, or The video cannot be shown | Install the package the banner names. The Tetheron .deb recommends gstreamer1.0-plugins-bad and gstreamer1.0-libav for this. On Fedora and Arch Linux the banner names that distribution’s package (Supported platforms). |
| The picture is garbled or missing | Open Preferences and switch on Decode video without the graphics card in the group Phone screen, then open the window again. |
| This phone cannot show apps in their own windows. | The phone’s Android build cannot create extra displays for the helper. Use Open on the phone screen. |
| A banner on the Apps tab asks for the set-up | The enhanced tier is not set up or not ready. See Set up the enhanced tier. |
| The window ends with Reconnect greyed out | The helper is not running. Check the row in the group Phone screen on the Overview tab. |
Related pages
- Command-line tools lists every option of the commands used here.
- Configuration and files says where the entries of pinned apps are stored.
- About screen mirroring, app windows and the webcam describes how the picture reaches the window.
Use the phone as a webcam
Note
This feature is not in a release yet. It is planned for Tetheron 0.5.0. The latest release, 0.4.1, does not have it.
The phone’s camera becomes available to video call apps and browsers on the desktop as a camera named Tether Phone Camera.
Before you begin
You need:
- The enhanced tier set up and ready for the phone. See Set up the enhanced tier. The group Webcam appears on the phone’s Overview tab only then.
- Administrator rights on the desktop, once, to create the virtual camera.
- The kernel module
v4l2loopback. The Tetheron package suggests it but does not install it, because it brings a compiler and kernel headers with it. The tarball’s install script does not install it either.
In the commands, replace <id> with the device id, or a unique prefix of it,
from tether-cli devices.
Set up the virtual camera
The virtual camera is a device on the desktop that Tetheron feeds with the phone’s picture. You set it up once per desktop.
-
Install the kernel module:
sudo apt install v4l2loopback-dkms v4l2loopback-utilsOn Fedora, enable RPM Fusion Free and run
sudo dnf install akmod-v4l2loopback. On Arch Linux, runsudo pacman -S --needed v4l2loopback-dkms v4l2loopback-utils linux-headers, with the headers package of the kernel you run. The Virtual camera dialog shows the command for your distribution. -
In the Tetheron app, select the phone and open the Overview tab.
-
In the group Webcam, press Set up… in the row Virtual camera. The dialog Virtual camera opens.
-
If the dialog says One package is missing, do step 1 and press Check again.
-
Switch on Create it at every start if the camera should survive a restart of the desktop. Otherwise it is gone after a restart and you repeat this set-up.
-
Press Set up. Nothing is loaded into the kernel before that.
-
Enter your password in the system’s prompt. It reads “Authentication is required to set up the virtual camera that shows your phone’s camera”.
The dialog now says The virtual camera is ready and names the device,
for example /dev/video42.
Later, the same dialog offers Always create when the camera exists only until the next restart, and Stop when it is created at every start. Both ask for the password again.
From the command line:
tether-cli webcam-setup status
tether-cli webcam-setup load
tether-cli webcam-setup persist
tether-cli webcam-setup remove
| Action | Effect |
|---|---|
status | Prints the state: unsupported, not_installed, not_loaded, no_device or ready, the device, and whether it is created at every boot. The default action. |
load | Creates the virtual camera now. It lasts until the desktop restarts. |
persist | Like load, and creates the camera at every boot. Writes /etc/modprobe.d/tether-webcam.conf and /etc/modules-load.d/tether-webcam.conf. |
remove | Deletes those two files. The camera that exists now stays until the desktop restarts. |
load, persist and remove ask for an administrator password.
Start and stop the webcam
- On the phone’s Overview tab, switch on Use as webcam in the group Webcam. If the virtual camera is not set up yet, the Virtual camera dialog opens first.
- Wait for the line under the switch to read On. Choose “Tether Phone Camera” as the camera in the call app.
- In the call app or the browser page, open the camera list and choose Tether Phone Camera. Call apps list the camera only while the switch is on. If the app was open before, open its camera list again.
The phone’s camera stays on until you switch Use as webcam off, even when no app on the desktop looks at the picture. The phone shows its camera indicator and uses more battery. Switch it off when the call is over.
From the command line:
tether-cli webcam <id> on
tether-cli webcam <id> off
tether-cli webcam <id>
Without an action the command prints the state, what is streaming and the settings.
The picture is 1280 × 720 at 30 frames per second by default. To change
that, set webcam_size and webcam_fps. See
Configuration and files.
The webcam uses whichever adb connection the enhanced tier has. When USB and Wireless debugging are both available as the helper starts, Tetheron uses USB. A cable that is plugged in later does not move a running helper. To switch, restart the helper.
Adjust the picture
While the switch is on, the group Webcam shows these controls. They take effect at once, also during a call.
| Control | What it does | Command |
|---|---|---|
| Camera | Chooses the front or the back camera, or one of several on phones that have more. Shown when the phone has more than one camera. | tether-cli webcam <id> camera front, camera back or camera <camera id> |
| Rotation | Turns the picture a quarter turn anticlockwise or clockwise per press. | tether-cli webcam <id> rotate <0, 90, 180 or 270> |
| Mirror the picture | Swaps left and right. | tether-cli webcam <id> flip on or flip off |
| Torch | Switches the light next to the camera. Shown when the chosen camera has one. Off again every time the webcam is switched on. | tether-cli webcam <id> torch on or torch off |
| Zoom | Zooms in, up to what the chosen camera allows. Shown when the camera can zoom. | tether-cli webcam <id> zoom <factor, 1.0 or more> |
Tetheron does not follow how the phone is held. If the picture lies on its side, use Rotation. The picture is fitted into the fixed frame with bars where needed.
Camera, rotation, mirroring and zoom are remembered per phone. The row
Streaming now shows which camera is in use, what the phone sends and what
call apps get. tether-cli webcam <id> cameras lists the phone’s cameras
with their ids, sizes and frame rates.
Remove the virtual camera
- Switch Use as webcam off.
- If the camera is created at every start, open the Virtual camera
dialog and press Stop, or run
tether-cli webcam-setup remove. - Restart the desktop. The camera device disappears with the restart.
To remove the kernel module as well, uninstall the packages from step 1 of the set-up.
If something does not work
| What you see | Cause and remedy |
|---|---|
| No group Webcam on the Overview tab | The enhanced tier is not ready, or the helper cannot use the camera on this phone. Check the group Phone screen. |
| One package is missing | v4l2loopback is not installed for the running kernel. Install it and press Check again. After a kernel update, the module may need to be rebuilt by DKMS first. |
| A message that Secure Boot rejected the virtual camera driver | The module’s signing key is not enrolled. Follow the command in the message to enrol the machine owner key, restart, confirm, and try again. Tetheron cannot do this for you. |
A message that v4l2loopback is already loaded without a “Tether Phone Camera” device | Another program, such as OBS, loaded the module first, and the installed version cannot add a device. Close the programs that use it, run sudo modprobe -r v4l2loopback and try again. |
persist refuses because another file already sets options for v4l2loopback | Add a device with the label Tether Phone Camera in that file. |
| Not available on this computer | The daemon was built without webcam support, or GStreamer’s v4l2sink is missing. |
| Tether Phone Camera is not in the call app’s list | Switch Use as webcam on before you open the list. |
| The camera is in use on the phone | Another app on the phone opened the camera, which takes it away from the webcam. Close that app. Tetheron tries again a few times, then waits until you toggle the switch. |
| The camera is switched off on the phone (privacy switch or device policy) | Switch camera access back on on the phone, then toggle Use as webcam. |
| A message that another phone is the webcam | One phone at a time feeds the virtual camera. Switch the webcam off on the other phone first. |
Every option of tether-cli webcam and tether-cli webcam-setup is listed
in Command-line tools. Why the feature needs a kernel
module is explained in
About screen mirroring, app windows and the webcam.
Script Tetheron from the command line
tether-cli is installed with the desktop package. It talks to the daemon
over the session bus, so run it as your own user inside your desktop session.
This page has recipes. Command-line tools lists every
command and option.
Find the device id
Every command that acts on a phone takes its device id:
tether-cli devices
ID NAME KIND PAIRED CONNECTED BATTERY STATE
5b7a19c04e2d Example Phone phone yes yes 82%+ paired
Any prefix of the id that matches one device only is enough. If the prefix
matches several devices, the command stops and lists them. In a script, use
the twelve characters that devices prints. The examples below use 5b7a.
Check the result in a script
A command that fails prints the reason on standard error and exits with a
non-zero status. Commands that wait for the phone (send, send-file,
dial) report the phone’s answer:
if tether-cli send 5b7a +15550100 "Backup finished"; then
echo "sent"
else
echo "not sent" >&2
fi
send and send-file take --no-wait to return as soon as the request is
queued.
pair and confirm ask a question on the terminal and refuse to run without
one. Pass --yes only in a script where you have checked the six-digit code
another way.
Follow events with watch
tether-cli watch prints one line for each event from the daemon until you
press Ctrl+C:
watching org.tether.Daemon (Ctrl-C to stop)
device 5b7a19c04e2d Example Phone paired=true connected=true
5b7a19c04e2d changed: BatteryLevel=81
5b7a19c04e2d notification: [0|com.example.chat|12|null|10123] Chat — Ada: See you at six
5b7a19c04e2d message 4211 [t17] inbox +15550100: Are you there?
5b7a19c04e2d FileReceived: /home/you/Downloads/Tether/report.pdf
5b7a19c04e2d INCOMING CALL [7] ringing incoming Ada <+15550100> route=phone (answer with `tether-cli answer 5b7a19c04e2d`)
5b7a19c04e2d calls: none
Each event line starts with the first twelve characters of the device id,
followed by the kind of event. Property changes read changed: and then
Name=value pairs, with the property names from the
D-Bus API.
Warning
The output of
watchcontains message texts, notification texts and phone numbers. Do not write it to a file that others can read.
React to events
watch writes each line as it happens, so you can pipe it into a loop and
match on the event:
#!/bin/sh
# Opens every PDF the phone sends, and logs incoming calls.
tether-cli watch | while read -r id event rest; do
case "$event" in
FileReceived:)
case "$rest" in
*.pdf) xdg-open "$rest" ;;
esac
;;
INCOMING)
logger -t tether "phone $id: incoming call"
;;
esac
done
read -r id event rest splits each line into the device id, the first word of
the event and the remainder. For FileReceived: the remainder is the path of
the file.
To act on a property, match the changed: lines. This shows a desktop
notification when the phone is fully charged:
tether-cli watch | while read -r id event rest; do
case "$event $rest" in
"changed: "*BatteryLevel=100*) notify-send "Phone charged" ;;
esac
done
To keep a script like this running, start it with your desktop session, for example from a systemd user unit.
Ring the phone from a keyboard shortcut
Open the desktop’s keyboard settings, add a custom shortcut and set its command to:
tether-cli ring 5b7a
The phone rings for at most 60 seconds. tether-cli ring 5b7a stop ends it
earlier.
Send files from the file manager
In Nemo (Cinnamon), create
~/.local/share/nemo/actions/send-to-phone.nemo_action:
[Nemo Action]
Name=Send to phone
Comment=Send the selected files to the phone with Tetheron
Exec=tether-cli send-file --no-wait 5b7a %F
Icon-Name=document-send-symbolic
Selection=notnone
Extensions=nodirs;
In Files (Nautilus), create the script
~/.local/share/nautilus/scripts/Send to phone:
#!/bin/sh
# Sends the selected files to the phone with Tetheron.
printf '%s\n' "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" |
while IFS= read -r path; do
[ -f "$path" ] && tether-cli send-file --no-wait 5b7a "$path"
done
Make it executable:
chmod +x ~/.local/share/nautilus/scripts/"Send to phone"
Right-click a file and choose Send to phone, in Nautilus under Scripts. The transfers appear on the Files tab of the Tetheron app, where you can follow or cancel them.
Send text to the phone’s clipboard
clipboard send reads standard input when you give it no text:
tether-cli clipboard 5b7a send "https://example.org/a-long-link"
hostname -I | tether-cli clipboard 5b7a send
tether-cli clipboard 5b7a get prints the last text that the phone sent.
Send a text message when a job ends
make backup && tether-cli send 5b7a +15550100 "Backup finished on $(hostname)"
The message goes out as an SMS from the phone’s default SIM. Add --sim with
a subscription id from tether-cli status 5b7a to choose another.
Silence the phone for a meeting
tether-cli dnd 5b7a priority
tether-cli media 5b7a pause
tether-cli volume 5b7a music 0
tether-cli dnd 5b7a all switches Do Not Disturb off again. playerctl can
control the phone’s playback too. See
Control media and the phone.
Save the newest screenshot from the phone
id=$(tether-cli photos 5b7a screenshot --limit 1 | grep -v '^index' | awk 'NR==1 {print $1}')
cp "$(tether-cli fetch 5b7a "$id" | tail -n 1)" ~/Pictures/
photos prints the newest items first, with the item id in the first column.
The grep drops the notice that photos prints when it has to ask the phone
first. fetch downloads the original into the daemon’s cache and prints its
path on the last line. Copy the file and leave the original where it is,
because the cache belongs to the daemon.
Beyond tether-cli
Everything tether-cli does goes through the daemon’s interface on the
session bus, under the name org.tether.Daemon. busctl --user reaches the
parts that have no command. The D-Bus API
describes every method, property and signal.
To address a daemon that runs under another bus name, set TETHER_BUS_NAME.
See Debug Tetheron.
Troubleshoot
Find the symptom you see and check the causes in the order given. Problems with one feature are covered in that feature’s guide, linked from Other features. If nothing here helps, report a bug.
Installing
The phone refuses to install the APK
| Cause | Fix |
|---|---|
adb install finds no device, or says unauthorized | Switch on USB debugging, unlock the phone and accept its debugging question with Always allow from this computer. adb devices must list the phone as device: see Install Tetheron on Android |
| The browser may not install unknown apps | In the dialog, tap Settings, switch on Allow from this source, go back and tap Install |
| Play Protect warns about an unknown app | Choose to install anyway. To be sure of the file, verify the download |
| Samsung Auto Blocker blocks the installation or adb | Switch it off under Settings → Security and privacy → Auto Blocker |
| A build signed with a different key is installed (a debug build and a release build) | Uninstall the installed build first, then pair again: see Install Tetheron on Android |
| The phone runs Android 13 or older | The app needs Android 14 or newer |
The desktop app says “Tether service is not running”
The daemon tetherd is not running in your session.
-
Click Start service.
-
If that does not help, start it in a terminal and read the error:
systemctl --user daemon-reload systemctl --user start tetherd.service systemctl --user status tetherd.service -
Read the daemon’s log:
journalctl --user -u tetherd.service -e
Right after installing the package, a session that was already open does not
know the service yet. systemctl --user daemon-reload, or logging out and in
again, fixes that.
There is no tray icon
| Cause | Fix |
|---|---|
| GNOME has no tray of its own | Install and enable an AppIndicator extension |
| The tray icon is switched off | Open Preferences and switch on Show tray icon under Desktop integration |
| The app is not running after login | Switch on Start Tether in background at login in the same place |
See Install Tetheron on Linux.
Finding and pairing
The phone and the desktop do not find each other
On the phone, Nearby PCs stays empty. On the desktop, the phone does not appear in the sidebar.
| Cause | Fix |
|---|---|
| The devices are on different networks. A phone on mobile data, or on the router’s guest network, does not find the desktop | Put both on the same Wi-Fi or wired network |
| The router isolates wireless clients from each other (“AP isolation”, “client isolation”, guest Wi-Fi) | Switch the isolation off for your network, or use a network without it |
| The firewall on the desktop blocks the connection | Run sudo ufw allow Tether and sudo ufw allow mdns. With another firewall, open TCP 7360, UDP 7360 and UDP 5353 inbound |
| The router or mesh system drops multicast and broadcast traffic | Pair by QR code, or enter the address by hand: see Connect across networks |
| A VPN on the phone routes traffic away from the local network. Some ad blockers work as a VPN | Exclude the app from the VPN, or switch it off while you pair |
| The phone app is closed. The phone announces itself only while the app is on screen | Open the app on the phone |
| The daemon is not running on the desktop | See the section above |
| The Avahi service is not running on the desktop | Run systemctl status avahi-daemon. It must be active |
| Discoverable is switched off in the desktop’s Preferences | Switch it on, or pair by QR code |
To see what is announced on the local network, install avahi-utils and
run:
avahi-browse -rt _tether._tcp
The list must contain the desktop itself and, while the phone app is open, the phone. The phone’s private DNS setting has no effect.
Pairing does not complete
The phone shows Pairing did not complete and a reason.
| Reason on the phone | Fix |
|---|---|
| The pairing timed out after 60 seconds. | Start again and confirm on both devices within a minute |
| The PC rejected the QR code (it may have expired). | A QR code is valid for five minutes and works once. Click New code on the desktop and scan again |
| … is already pairing with another device. | Finish or reject the other pairing on the desktop, then try again |
| … rejected the pairing. | Someone chose Reject on the desktop. Start again |
| The connection to … was lost. | Check the network and the firewall, then start again |
| Could not reach … | The phone cannot open a connection to the desktop’s address. Check the firewall on the desktop (TCP 7360) and that both devices are on the same network |
The six-digit codes do not match
Choose Reject on both devices and pair by QR code. If the codes differ again and again, another device on the network is answering in place of your desktop. Do not confirm.
The phone says “The PC no longer trusts this phone”
The desktop has removed the pairing, for example because you unpaired while the phone was out of reach, or deleted the desktop’s data. On the phone, tap Unpair on the PC’s card, then pair again.
Permissions on the phone
The notification access switch is greyed out
Android shows Restricted setting, which it can do on Android 13 and newer for an app that did not come from an app store. Allow restricted settings for the app. If Allow restricted settings is not in the ⋮ menu, try to switch on notification access once and look again.
The companion device step says it is skipped
On some Android builds the registration is reserved for system apps, and the wizard goes on without it. See Grant Android permissions.
A tab on the desktop is missing or empty
Each feature appears on the desktop only while its permission is granted on the phone and its switch is on.
- On the phone, open the app and tap the Settings icon.
- Under Features synced to your PC, find the feature. If it says Permission missing – tap to grant, tap it and allow the request. If its switch is off, switch it on.
- Tap Disconnect and then Connect on the PC’s card. The change takes effect at the next connection.
Right after pairing, messages and photos take up to a minute to fill in.
The Do not disturb switch on the desktop is disabled
The row says Grant Tether notification-policy access on the phone to change this. On the phone, open the app’s Settings, tap Do Not Disturb access under Special access and allow the app.
Find my phone does not show over the lock screen
On the phone, open the app’s Settings, tap Full-screen alerts under Special access and allow the app.
Connection
The phone stays disconnected
| What you see | Cause | Fix |
|---|---|---|
| Desktop: Disconnected — press Connect to resume. Phone: Disconnected by you or Disconnected by the PC | Someone chose Disconnect. Both devices hold until asked (Disconnect without unpairing) | Click Connect on either device |
| Phone: The PC’s Tether was closed – reconnects when it is back | The daemon on the desktop stopped | Start the daemon. The phone reconnects |
| Phone home screen: The background service is stopped. | The phone app’s service was stopped | Tap Start |
| Desktop: Paired · offline | The phone is off, out of range or on another network | Bring it back to the network. See also the next two sections |
The phone reconnects slowly
After a long interruption the devices wait longer between attempts, up to a minute. To connect at once, click Connect on the desktop or tap Connect on the phone.
The connection drops when the phone’s screen is off
Android or the manufacturer’s battery saver is stopping the app. Grant Android permissions has the steps for the first two checks.
- Check that battery optimisation is off for the app.
- On a Samsung phone, check that the app is in Never sleeping apps and not in Sleeping apps or Deep sleeping apps. A system update can move it back.
- Check that the phone keeps Wi-Fi on while it sleeps. On a Samsung phone, look under Settings → Connections → Wi-Fi → Advanced.
- Check that Run on boot is on in the phone app’s Settings, so that the service starts again after a restart or an update.
Notifications
No notifications arrive on the desktop
| Cause | Fix |
|---|---|
| Notification access is off. The phone app’s home screen says Notification access is off. Notifications are not mirrored to your PC. | Tap Fix and switch it on |
| Sync notifications is off on the phone app’s home screen | Switch it on |
| Show phone notifications on this desktop is off in the desktop’s Preferences | Switch it on. The notifications still appear on the phone’s Overview tab while it is off |
| The devices are not connected | See Connection |
Notifications from one app are missing
| Cause | Fix |
|---|---|
| The app is switched off in the Apps list on the phone app’s home screen | Switch it on |
| The app is blocked on the desktop | Open the phone’s Overview tab, click Notification settings… and allow the app |
| The notification is a persistent one, such as a download, navigation or a running service | Switch on Include ongoing notifications in the phone app’s Settings |
Notifications stop arriving after a while
- Work through The connection drops when the phone’s screen is off.
- Switch notification access for the app off and on again in the phone’s settings. Android sometimes stops delivering notifications to an app after the app was updated.
One-time codes are missing from notifications
On Android 15 and newer, Android hides one-time codes from apps with notification access. Complete the companion device step. If your phone skips that step, the enhanced tier has a grant for sensitive notifications.
A reply or an action does nothing
The notification must still be present on the phone, and the app that posted it must still be installed. Some apps, such as banking apps and apps in a work profile, post notifications without actions. The desktop then offers only Open on phone.
Other features
| Problem with | Guide |
|---|---|
| Messages, SMS and MMS | Handle notifications and messages |
| File transfers and the gallery | Transfer files and photos |
| Clipboard sync, also on Wayland | Sync the clipboard |
| Media keys, volume, Do not disturb | Control media and the phone |
| Calls, Bluetooth pairing, call audio | Make and receive calls |
| Wireless debugging, USB debugging, adb | Set up the enhanced tier |
| Phone screen, app windows, phone audio | Mirror the screen and open phone apps |
| Phone as webcam (next release, 0.5.0) | Use the phone as a webcam |
The frequently asked questions answer what Tetheron can and cannot do.
Report a bug
A maintainer needs the versions, a description of both devices and the logs to reproduce a problem. Collect them, remove personal data, then file the issue.
Important
Do not file a security problem in the public tracker. Anything that could let someone read or inject phone data, pair without consent, or run code on either device goes through the private process in
SECURITY.md: on the repository page, Security → Report a vulnerability.
Before you begin
- Look for the symptom in Troubleshoot.
- Check that both devices run the latest release. Fixes are made for the latest release only.
- Search the existing issues for the same problem.
Collect the versions
-
The desktop package:
tether-cli --version -
The phone app: open it, tap the Settings icon and read the last line of the screen. The phone’s Settings → Apps → Tetheron (Tether in 0.4.1 and earlier) shows the same version.
Both should be the same release.
Describe the two devices
-
The desktop: distribution and version, desktop environment, and session type. The session type is printed by:
echo $XDG_SESSION_TYPEThe answer is
x11orwayland. Several features behave differently on the two. -
The phone: model, Android version and the manufacturer’s version of Android (for example One UI and its version). Find them in the phone’s Settings → About phone.
Collect the daemon’s log
The daemon writes its log to the journal of your user session.
-
Reproduce the problem and note the time.
-
Save the log of the last ten minutes to a file. Change the time span so that it covers the moment of the problem.
journalctl --user -u tetherd.service --since "10 minutes ago" > tetherd.log
If the problem is in the desktop app’s window, also capture the app’s own log. Quit the app (Quit in the main menu or the tray menu), start it from a terminal, reproduce the problem and quit again:
RUST_LOG=tether=debug tether 2> tether-app.log
Collect the phone’s log
The phone app has no log export yet. Its log is read from the desktop over adb, which needs USB debugging or Wireless debugging switched on on the phone: see Install Tetheron on Android or Set up the enhanced tier. If you have not set this up, leave the phone’s log out and say so in the issue.
-
Connect the phone so that
adb deviceslists it. -
Reproduce the problem, then save the app’s lines of the phone’s log:
adb logcat -d -v time | grep -E "Tether\." > tether-phone.log
Remove personal data
Read the logs before you share them. Message text is kept out of the logs at the normal level, but names and identifiers do appear.
Open each file in a text editor and replace:
- names of people and of your devices,
- phone numbers and e-mail addresses,
- text of messages and notifications, if any is present,
- device ids (64 hexadecimal characters, usually shortened to the first eight) and adb serial numbers,
- IP addresses, Wi-Fi network names and Bluetooth addresses,
- file names and paths that reveal something about you.
Use a placeholder such as <phone-number-1>, and the same placeholder for
the same value throughout, so that the log can still be followed. In
screenshots, crop or blur names, numbers, messages, photos and notifications.
Warning
Do not attach
~/.local/share/tether/identity.keyor any other file from the data directory. The key is this desktop’s identity.
File the issue
-
Open a new issue and choose Bug report.
-
Fill in the form:
Field What to enter What happened What you did, what you expected, and what happened instead Steps to reproduce Numbered steps from a known state, such as “phone paired and connected” Area The feature the problem belongs to Tether versions Both versions from above Desktop Distribution, desktop environment, X11 or Wayland Phone Model, Android version, manufacturer’s version Logs The cleaned logs -
Say how often the problem occurs: every time, sometimes, or once.
-
Submit the issue.
For a question or an idea, use the discussions. For a missing feature, check the feature list and the roadmap first. If it is not planned, choose Feature request in place of Bug report.
Reference
Reference pages describe Tetheron as it is and are checked against the code. Entries marked 0.5.0 ship with the next release. The latest release is 0.4.1.
For users
- Features and Phone Link parity: each feature, its tier and its status.
- Supported platforms: distributions, session types, package dependencies, Android versions, and what has been tested.
- Command-line tools: the subcommands of
tether-cli, the options oftetherandtetherd, and the environment variables they read. - Configuration and files: settings, files and directories, the systemd unit, the D-Bus service, network ports and the firewall profile.
- Android permissions and grants: the permissions of the Android app, the special accesses and the grants over adb.
- Glossary: the terms this documentation uses.
- Changelog: what changed in each release.
For developers
- D-Bus API: the interfaces
org.tether.Daemon1andorg.tether.Device1of the daemon. - Wire protocol: transport, discovery, pairing and the messages between phone and desktop, including the shell helper protocol.
Feature parity: Phone Link vs Tetheron
Status legend: planned (not started), in progress (being built in the
current milestone), partial (shipped with documented gaps), done,
n/a (not planned, with reason). Tier is defined in
ADR-0007: normal = any Android 14+ phone with
runtime permissions and a CompanionDeviceManager association; enhanced = the
adb shell helper is running. Milestones are defined in roadmap.md.
“OEM-gated” means Phone Link only offers the feature when Link to Windows ships as a privileged system app (Samsung, HONOR, OPPO, ASUS ROG, Surface Duo at the time of writing). Where Tetheron lists normal for an OEM-gated feature, Tetheron reaches it on any phone; where it lists enhanced, Tetheron needs adb but still works on any phone.
Notifications
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Notification mirroring | All active notifications appear in the PC app and as Windows toasts; per-app filter; ongoing/system ones hidden | no | Phone notifications become freedesktop notifications and appear in the GTK app; per-app blocklist; filter rules in protocol.md | normal | M1 | done (verified 2026-11-08) |
| Notification actions | Action buttons forwarded (e.g. “Mark as read”, “Archive”) | no | NotificationActionRequest{index} fires the Android action’s PendingIntent | normal | M1 | done (verified 2026-11-08) |
| Inline reply | Reply from the toast/app for messaging apps | no | RemoteInput actions exposed as “Reply”; reply box in the GTK app (freedesktop popups have no inline-reply standard); conversation history shown from MessagingStyle | normal | M1 | done (verified 2026-11-08) |
| Dismiss sync | Dismiss on PC removes on phone and vice versa | no | NotificationDismiss both ways via NotificationClosed and NotificationRemoved | normal | M1 | done (verified 2026-11-08) |
| Open on phone | Clicking a notification opens the app on the phone (or in mirroring when available) | partly (mirroring part) | index = -1 fires the content intent; opens in mirror window in enhanced tier | normal (open on phone) / enhanced (open in mirror) | M1 / M4 | done (verified 2026-11-08) / planned |
| Notification icons and app icons | App icon and large icon shown | no | Icons sent as PNG blobs by SHA-256 hash, cached on desktop | normal | M1 | done (verified 2026-11-08) |
| Badges / unread counts | Unread badge counts on the Phone Link taskbar icon and per app | no | Tray icon badge (SNI tooltip/overlay) and per-device unread count in the app | normal | M1 (count) / M2 (per app) | done (verified 2026-11-08) / planned |
| OTP / 2FA codes on Android 15+ | Delivered (Link to Windows is CDM-associated) | no | CDM association exempts Tetheron from OTP redaction; enhanced tier can additionally grant RECEIVE_SENSITIVE_NOTIFICATIONS | normal | M1 | done (verified 2026-11-08) |
| Do-not-disturb aware delivery | Quiet when phone DND is on | no | Honour phone DND flag; desktop-side quiet hours | normal | M2 | planned (deferred from M2) |
Messages
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| SMS threads and history | Thread list, conversation view, ~30 days of history initially | no | Full history (configurable, default unlimited) from the SMS/MMS providers; SQLite cache on desktop | normal | M2 | done (verified 2026-11-11) |
| Send/receive SMS | Yes, non-default SMS app, multi-SIM selection | no | SmsManager multipart send per SIM; receive via providers + broadcasts (ADR-0011) | normal | M2 | done (verified 2026-11-11) |
| MMS with attachments | Send/receive images, group MMS | no | PDU encode/decode, attachments via secondary streams | normal | M2 | partial (0.2.0: receive and attachment fetch verified; send untested on a carrier) |
| Contact names and photos | Resolved from phone contacts | no | vCard delta sync with photo blobs; autocomplete in composer | normal | M2 | done (verified 2026-11-11) |
| Mark read / delete from PC | Not synced back to phone (non-default app) | no | Same limitation; desktop keeps its own read state | normal | M2 | done (documented gap) |
| RCS chats | Only Samsung Messages RCS via partnership | yes | No third-party RCS API; RCS reaches the desktop as notifications with inline reply only | n/a | - | n/a |
| Emoji / GIF picker | Emoji and GIF (Tenor) picker | no | GTK emoji chooser; no GIF service (no cloud) | normal | M2 | done (0.2.0, emoji; no GIF service) |
Calls
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Incoming call banner, answer/decline | Yes, requires Bluetooth pairing with the PC | no | CallState events + TelecomManager answer/reject; banner window + notification actions | normal (+Bluetooth) | M3 | done (0.3.0) |
| Call audio on PC | Over Bluetooth HFP (PC as hands-free) | no | PipeWire’s native HFP hands-free role; guided BT pairing from the exchanged MAC; WebRTC echo cancellation on the PC microphone; default sink/source left unchanged | normal (+Bluetooth) | M3 | done (0.3.0; verified on one setup, occasional static-like noise open) |
| Dialer with contact search | Yes | no | Dialer view with contacts + history; TelecomManager.placeCall | normal | M3 | done (0.3.0) |
| Call log | Recent calls (~90 days) | no | Full call log via CallLog provider | normal | M3 | done (0.3.0) |
| In-call controls: mute, hang up, transfer to phone | Yes | no | Mute, route (requestCallEndpointChange) and hang up through the in-call service when bound, else AudioManager mute, Telecom hang up and closing the SCO link from the PC | normal (+Bluetooth) | M3 | done (0.3.0; PC / phone / loudspeaker switching needs the MANAGE_ONGOING_CALLS adb grant, without it only transfer to the phone) |
| In-call DTMF keypad | Limited/absent on many phones | no | Not available to non-dialer apps; documented gap, enhanced-tier experiment later | enhanced | M3 | gap (not available to non-dialer apps) |
| Ringtone on PC, pause media on ring | Yes | no | Ringtone through PipeWire (pw-play); pause MPRIS players on RINGING | normal | M3 | done (0.3.0) |
Photos and files
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Photos gallery | 2000 most recent photos and screenshots; open, copy, save, share, delete (delete on phone) | no | MediaStore query, lazy thumbnails, infinite scroll, no 2000 cap (configurable); delete with confirm (Android 14 delete request unless MANAGE_EXTERNAL_STORAGE) | normal | M2 | done (verified 2026-11-11) |
| Drag photos to PC apps | Drag from gallery into Explorer/apps | no | GtkDragSource with on-demand fetch to a temp file | normal | M2 | done (0.2.0, not yet verified on device) |
| Phone storage in File Explorer | Browse phone storage in Explorer, 30-day trash | yes (Samsung, HONOR) | FUSE mount at ~/Tether/<phone> with file-manager bookmark; trash semantics | normal (MANAGE_EXTERNAL_STORAGE) / SAF fallback | M5 | planned |
| Send files PC to phone | Via Windows share sheet / drag onto Phone Link | partly (drag-drop OEM-gated) | File chooser, drop target on device page and tray; FileOffer + streams | normal | M2 | done (verified 2026-11-11) |
| Send files phone to PC | Link to Windows share-sheet target | no | Android share-sheet target → chosen PC → ~/Downloads/Tether/ | normal | M2 | done (0.2.0, not yet verified on device) |
| Drag and drop between phone screen and PC | Drag files into/out of the mirrored or streamed phone window | yes | Drop onto mirror window → push file and open share; drag out of mirrored app not planned | enhanced | M4 | planned |
Screen, apps and input
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Whole-screen mirroring with input | “Phone screen”: mirror and control the phone with mouse/keyboard | yes | Shell helper: SurfaceControl capture → H.264 → GStreamer in a GTK window; input injection via InputManager | enhanced | M4 | done (0.4.0) |
| Screen off while mirroring (“black screen”) | Yes | yes | SurfaceControl.setDisplayPowerMode off while streaming | enhanced | M4 | done (0.4.0) |
| App streaming (apps in separate windows) | “Apps”: launch phone apps in individual windows, pin to taskbar | yes | Virtual display per app, one GTK window each; “Pin to desktop” writes a .desktop launcher | enhanced | M4 | done (0.4.0; not yet tested by hand against a real phone) |
| App list with icons | Yes | yes | AppList from shell helper (or QUERY_ALL_PACKAGES in normal tier for list only) | enhanced (launch) / normal (list) | M4 | done (0.4.0) |
| Phone audio on PC | Audio of streamed apps plays on PC | yes | REMOTE_SUBMIX/playback capture → Opus → PipeWire | enhanced | M4 | done (0.4.0; playback on the PC not yet tested by hand) |
| Keyboard and clipboard paste into phone apps | Yes | yes | Key events, text commit, paste-as-text | enhanced | M4 | done (0.4.0) |
Clipboard, hotspot, continuity
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Clipboard PC to phone | Cross-device copy/paste | yes | Clipboard message → ClipboardManager.setPrimaryClip | normal | M2 | done (verified 2026-11-11) |
| Clipboard phone to PC (manual) | n/a on non-OEM phones | - | Quick Settings tile, share-sheet target and a notification action send the current clipboard | normal | M2 | done (0.2.0, not yet verified on device) |
| Clipboard phone to PC (automatic) | Cross-device copy/paste | yes | One-time adb grants (READ_LOGS, SYSTEM_ALERT_WINDOW): the app watches ClipboardService’s access-denied log line and reads the clip from an invisible activity (KDE Connect technique); shell helper later | enhanced (one-time adb grant) | M2 | done (verified 2026-11-11) |
| Instant Hotspot | One-click phone hotspot from the PC Wi-Fi list | yes | Spike: shell cmd wifi start-softap/svc; fallback: deep link to hotspot settings + push saved hotspot credentials to NetworkManager | enhanced | M5 | planned (spike) |
| Cross Device Resume / continue browsing | “Continue browsing” hand-off; 2025 Cross Device Resume for partner apps (Spotify, WhatsApp) | yes (partner/OEM) | “Continue on PC” share target and browser URL hand-off with an app mapping; “Open on phone” for URLs | normal | M5 | planned (partial parity) |
| Connected camera / phone as webcam | Windows 11 “Mobile devices”: use the phone as a webcam, switch camera, effects | partial | shell-helper camera → daemon pipeline → v4l2loopback device “Tether Phone Camera”; camera switch, rotation, mirror, torch, zoom; no effects; needs the enhanced tier (a no-adb camera through a foreground service is not built) (ADR-0019) | enhanced | M4.3 | partial (unreleased) |
Device status and controls
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Battery level and charging | Shown in header | no | Battery on change; app header + tray; low-battery desktop alert (Tetheron extra) | normal | M1 | done (verified 2026-11-08) |
| Signal strength, Wi-Fi, SIM | Shown in header | no | Connectivity per SIM + Wi-Fi | normal | M2 | done (verified 2026-11-11) |
| Media controls | Play/pause/next/prev, volume, album art for active sessions | no | MediaSessions → MPRIS player per device so desktop media keys/applets work; volume control | normal | M2 | done (0.2.0; MPRIS verified over D-Bus, not yet with a playing phone) |
| Do not disturb toggle | Yes | no | SetDnd via NotificationManager.setInterruptionFilter | normal | M2 | done (verified 2026-11-11) |
| Phone volume | Yes | no | SetPhoneVolume for music/ring/call streams | normal | M2 | done (verified 2026-11-11) |
| Find my phone / ring | No (not in Phone Link) | - | RingPhone: alarm-stream ringtone + vibrate + stop screen (Tetheron extra) | normal | M2 | done (0.2.0, not yet verified on device) |
| Wallpaper in header | Phone wallpaper shown as header art | no | Optional; needs storage permission on Android 13+; low priority cosmetic | normal | M2 | planned (deferred from M2) |
| Start-menu / Mobile devices panel analogue | Windows 11 Start panel: battery, recent photos, messages at a glance | no | GTK device page + tray menu (M1); GNOME Shell extension quick-settings panel (M5) | normal | M1 / M5 | done (verified 2026-11-08) / planned |
| Device info (model, OS) | Yes | no | DeviceInfo shown in device page | normal | M1 | done (verified 2026-11-08) |
Phone-side PC controls (Link to Windows app)
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| PC card on phone (name, battery, network) | Yes | no | PcState to phone; PC card in the Android app | normal | M5 | planned |
| Lock PC from phone | Yes | no | PcCommand{LOCK} → loginctl lock-session / org.freedesktop.ScreenSaver | normal | M5 | planned |
| Send files from phone | Share sheet → PC | no | See “Send files phone to PC” (M2); dedicated button in M5 | normal | M2 / M5 | planned |
| Clipboard history on phone | Recent PC clipboard items | yes | Clipboard history list fed by PC clipboard sync | normal | M5 | planned |
| Start mirroring from phone | Yes | yes | Phone requests MirrorStart on the PC (enhanced tier required) | enhanced | M5 | planned |
Platform and reach
| Feature | Phone Link behaviour | OEM-gated | Tetheron plan | Tier | Milestone | Status |
|---|---|---|---|---|---|---|
| Multiple phones per PC | Yes, switch between phones | no | Daemon is multi-device from M1; UI sidebar lists all paired devices | normal | M1 | done (verified 2026-11-08) |
| Multiple PCs per phone | Yes | no | Phone keeps one session per paired PC | normal | M1 | done (verified 2026-11-08) |
| Works away from the LAN | Yes, via Microsoft cloud | no | LAN first; VPN/mesh via manual address today; self-hosted relay in M5 (ADR-0010) | normal | M1 (LAN) / M5 (relay) | done (verified 2026-11-08) / planned |
| Account-free, no cloud | No (Microsoft account required) | - | No accounts, pinned certificates, no telemetry (Tetheron extra) | normal | M1 | done (verified 2026-11-08) |
| Permission auto-setup | n/a (OEM system app has them) | yes | Shell helper grants notification access, battery allowlist, storage, sensitive notifications | enhanced | M4 | done (0.4.0) |
| iPhone support | Basic: calls, SMS, notifications over Bluetooth (Windows 11 2023+) | no | Spike: BlueZ ANCS, MAP, PBAP, HFP from the Linux side; no iOS app | normal (Bluetooth) | M5 | planned (spike) |
| Linux desktops supported | Windows 10/11 only | - | Debian/Ubuntu-family .deb (M1), Flatpak (M5); tested on Cinnamon X11; the GNOME Wayland session is not yet verified | - | M1 / M5 | done (verified 2026-11-08) / planned |
| Localisation and accessibility | Yes | no | gettext + Android resources; GTK a11y, TalkBack | normal | M6 | planned |
Supported platforms
The systems Tetheron runs on, what each feature needs, and what has been tested. Entries marked 0.5.0 ship with the next release. The latest release is 0.4.1.
Tested on
Everything was tested on one computer and one phone.
| Tested | |
|---|---|
| Distribution | Linux Mint 22.2, x86-64 |
| Session | Cinnamon on X11 |
| Graphics | NVIDIA, decoder nvh264dec |
| Bluetooth adapter | Realtek RTL8852BU |
| Component versions | GTK 4.14, libadwaita 1.5, GStreamer 1.24, PipeWire 1.0.5, WirePlumber 0.4.17, BlueZ 5.72, adb 35.0.0, v4l2loopback 0.12.7 (0.5.0) |
| Phone | Samsung Galaxy A55 |
| Android 16, One UI 8.5 (releases 0.1.0 to 0.4.1) | Pairing, notifications, messages (SMS send and receive, MMS receive), contacts, photos, files, clipboard, media, phone controls, calls and call audio, enhanced set-up over USB and Wireless debugging, whole-screen mirroring, one app in its own window |
| Android 17 | Phone as webcam (0.5.0) over USB and Wireless debugging. Other features were not tested again after the phone’s update. |
Not tested, which does not mean known to fail:
- Other distributions, Wayland sessions, other desktop environments,
arm64. - The tarball and its install script on Fedora and Arch Linux. The script was run on Linux Mint only.
- VA-API decoders (Intel, AMD), other Bluetooth adapters, a Bluetooth headset as the call audio device, WirePlumber 0.5.
- Android 14 and 15 on a device, and phones of other manufacturers.
- MMS send on a mobile network.
- The Apps tab, pinning an app and phone audio playback on the desktop, on a phone. Their parts passed automated tests.
- Switching Wireless debugging back on after a phone restart.
- Samsung Auto Blocker.
- Webcam (0.5.0): a locked phone, the camera privacy switch, creating the virtual camera through the installed service, creating it at every boot.
Desktop
Distributions and architecture
The desktop side is published for x86-64 (amd64) in two forms: a Debian
package, tether, and from release 0.5.0 a tarball with an install script,
tether-<version>-linux-x86_64.tar.gz. Both are on the
GitHub releases page and
nowhere else.
| Distribution | Status |
|---|---|
| Linux Mint 22.x (Ubuntu 24.04 base) | Supported, Debian package |
| Ubuntu 24.04 and newer, and derivatives | Supported, Debian package. The package is built on Ubuntu 24.04. |
| Debian 13 and newer | Supported, Debian package |
| Fedora 40 and newer | Tarball (0.5.0). Not tested. |
| Arch Linux and derivatives | Tarball (0.5.0). Not tested. |
| Other distributions with systemd, glibc 2.39, GTK 4.14 and libadwaita 1.5, or newer | Tarball (0.5.0). You find the dependencies’ package names yourself. |
Older distributions and arm64 | Nothing published. Build from source. |
The programs in the tarball are the ones in the Debian package. They are built on Ubuntu 24.04 and need at least its versions of glibc, GTK and libadwaita. Install Tetheron on Linux has the steps for both forms.
A Flatpak is planned (Roadmap).
Session type
Tetheron runs in X11 and Wayland sessions, with these differences:
| Behaviour | X11 | Wayland |
|---|---|---|
| Clipboard, phone to desktop, app running | Set at once | Set at once while the app’s window has focus. Otherwise the app shows a notification or a toast with a Copy action. |
| Clipboard, phone to desktop, app not running | The daemon sets it with xclip | The daemon sets it with wl-copy |
| Clipboard, desktop to phone, app running | Sent on every change | Sent only while the app’s window has focus |
| Clipboard, desktop to phone, app not running | The daemon reads the clipboard once a second with xclip | Not available |
| Stay on top in mirror windows | Available when wmctrl is installed | Not available |
| Incoming-call banner kept above other windows | When wmctrl is installed | No |
| Pinned phone apps grouped under their own icon | Window class tether-<device8>-<package> | Application id of the same name |
Desktop environment
The app uses GTK 4 and libadwaita and does not depend on one desktop environment.
| Feature | Requirement |
|---|---|
| Tray icon | A StatusNotifierItem host. Cinnamon and KDE Plasma have one. GNOME needs an AppIndicator extension. Without a host the app runs without a tray icon. |
| Desktop notifications | A notification server (org.freedesktop.Notifications). Action buttons need a server that supports actions. |
| Reply inside the notification | A server that announces inline-reply (KDE Plasma). On other servers Reply opens the reply box of the app. |
| Media keys and media applets for the phone | An MPRIS client in the desktop environment |
| Start at login | Support for XDG autostart entries |
Package dependencies
| Package | Relation | Used for |
|---|---|---|
Shared libraries found at build time ($auto) | Depends | GLib, GTK, D-Bus, GStreamer and system libraries the programs link to |
libgtk-4-1, libadwaita-1-0 | Depends | The app |
avahi-daemon | Depends | mDNS discovery of phones, discovery of Wireless debugging |
adb | Depends | Enhanced tier |
pipewire-bin, libspa-0.2-bluetooth | Depends | Call audio over Bluetooth, ringtone, echo cancellation |
gstreamer1.0-plugins-base, gstreamer1.0-plugins-good, gstreamer1.0-gl | Depends | Screen mirroring, app windows, phone audio, webcam (0.5.0) |
ufw | Recommends | The firewall profile Tether |
bluez | Recommends | Bluetooth pairing and the hands-free link for calls. Without it the daemon does not announce the bluetooth capability. |
wireplumber | Recommends | Call audio routing |
gstreamer1.0-plugins-bad | Recommends | H.264 parser (required for mirroring and webcam) and hardware decoders |
gstreamer1.0-libav | Recommends | Software H.264 decoder |
v4l2loopback-dkms (0.5.0) | Suggests | Kernel module for the virtual camera. Installs DKMS, kernel headers and a compiler. |
v4l2loopback-utils (0.5.0) | Suggests | v4l2loopback-ctl, used to add a device to a module that is already loaded (v4l2loopback 0.13 and newer) |
apt installs dependencies and, unless told otherwise, recommended
packages. It does not install suggested packages.
The tarball’s install script installs no packages. It checks for them and
prints the install command. These are the packages of Fedora and Arch Linux
that match the Debian ones. A message of the app or the daemon that names a
missing package uses the name for the distribution it runs on (0.5.0), read
from /etc/os-release. On a distribution outside these three families it
describes the component.
| Debian package | Fedora | Arch Linux |
|---|---|---|
libgtk-4-1, libadwaita-1-0 | gtk4, libadwaita | gtk4, libadwaita |
avahi-daemon | avahi | avahi |
adb | android-tools | android-tools |
pipewire-bin, libspa-0.2-bluetooth | pipewire, pipewire-utils | pipewire, pipewire-audio |
wireplumber, bluez | wireplumber, bluez | wireplumber, bluez |
gstreamer1.0-plugins-base, gstreamer1.0-gl | gstreamer1-plugins-base | gst-plugins-base |
gstreamer1.0-plugins-good | gstreamer1-plugins-good | gst-plugins-good |
gstreamer1.0-plugins-bad | gstreamer1-plugins-bad-free | gst-plugins-bad |
gstreamer1.0-libav | gstreamer1-plugin-openh264 (decoder openh264dec) | gst-libav |
ufw | firewalld is the default firewall. No profile is installed for it. | ufw |
v4l2loopback-dkms, v4l2loopback-utils (0.5.0) | akmod-v4l2loopback from RPM Fusion Free | v4l2loopback-dkms, v4l2loopback-utils, kernel headers |
What each feature needs
| Feature | Needs on the desktop | Without it |
|---|---|---|
| Discovery | Avahi running, or UDP broadcast on the network. UDP and TCP 7360 open. | Add the phone by address |
| Notifications, messages, contacts, photos, files, media, phone controls | Nothing further | |
| Clipboard with the app closed | xclip (X11) or wl-clipboard (Wayland). Not installed by the package. | Clipboard sync works only while the app runs |
| Calls: banner, answer, decline, dial, call log | Nothing further | |
| Call audio on the desktop | A Bluetooth adapter, BlueZ, PipeWire with its Bluetooth plugin and the hands-free role (hfp_hf), WirePlumber. Tools used: pw-dump, pw-link, pw-cli, pw-metadata, wpctl. | Call audio stays on the phone |
| Echo cancellation | PipeWire’s echo-cancel module (pipewire program) | Call audio without echo cancellation |
| Ringtone | pw-play or paplay, and the sound /usr/share/sounds/freedesktop/stereo/phone-incoming-call.oga | No ringtone on the desktop |
| Enhanced tier | adb from platform-tools 34.0.0 or newer, with USB or Wireless debugging | Enhanced state unavailable. Mirroring, app windows, phone audio and webcam are not offered. |
| Screen mirroring and app windows | GStreamer element h264parse (gstreamer1.0-plugins-bad) and an H.264 decoder | The mirror window names the missing package |
| Phone audio on the desktop | GStreamer and a PipeWire or PulseAudio sound server | Phone audio state unsupported |
| Phone as webcam (0.5.0) | The v4l2loopback kernel module, pkexec (polkit) for the set-up, the parser and a decoder as for mirroring | Virtual camera state not_installed |
H.264 decoders are tried in this order: vah264dec (VA-API), nvh264dec
(NVIDIA), v4l2slh264dec, avdec_h264 (gstreamer1.0-libav),
openh264dec. The first that is installed and works is used.
Minimum versions
| Component | Minimum |
|---|---|
| GTK | 4.14 (Ubuntu 24.04) |
| libadwaita | 1.5 (Ubuntu 24.04) |
| adb (platform-tools) | 34.0.0, enforced by the daemon |
| PipeWire | 1.0 |
| WirePlumber | 0.4.17 |
| GStreamer | 1.20 |
| BlueZ, v4l2loopback (0.5.0) | Not specified |
With v4l2loopback 0.12 the set-up cannot add its device to a module that another program loaded first. 0.13 and newer can. With Secure Boot the module must be signed with an enrolled key.
Phone
| Property | Value |
|---|---|
| Minimum | Android 14 (API level 34, minSdk) |
| Target | Android 15 (API level 35, targetSdk) |
| Package name | org.tether.android |
| Distribution | APK from the GitHub releases page. Not on Google Play. |
The enhanced tier checks each of its functions on the phone when the shell helper starts and hides a function that fails the check (Privilege tiers and adb).
Behaviour that differs by manufacturer
| System | Behaviour |
|---|---|
| Samsung One UI | The system puts apps to sleep regardless of the Android battery setting. The app must be added to Never sleeping apps. The set-up wizard shows this step on Samsung phones only. |
| Samsung One UI | Wireless debugging switches off when the phone restarts. The system switches it off again at once on a Wi-Fi network that was not allowed for Wireless debugging. |
| Samsung One UI 6 and newer | Auto Blocker blocks installing APKs from some sources and blocks adb. |
| Samsung One UI 8.5 (Android 16) | The permission for a self-managed companion device association is reserved for system apps. The wizard skips the companion step. See Android permissions and grants. |
| Samsung One UI 8.5 | Call audio switching works only with the MANAGE_ONGOING_CALLS grant. The telecom command for call companion apps has no effect. |
| Android 13 and newer, all manufacturers | Notification access for an app installed from an APK can be a “restricted setting” that has to be allowed first (Grant Android permissions). |
Command-line tools
The desktop package installs three programs:
| Program | Purpose |
|---|---|
tether-cli | Command-line client of the daemon |
tether | The GTK app |
tetherd | The daemon |
tether-cli and tether talk to tetherd over the session D-Bus
(D-Bus API). All three read
environment variables.
Entries marked 0.5.0 ship with the next release. The latest release is 0.4.1.
tether-cli
tether-cli <COMMAND> [ARGUMENTS] [OPTIONS]
Global options
| Option | Effect |
|---|---|
-h, --help | Print help for the program or for a subcommand |
-V, --version | Print the version |
help [COMMAND] | Same as --help |
Conventions
<ID>is a device id or a unique prefix of one. Ids are 64 lowercase hexadecimal characters.tether-cli devicesprints the first 12. A prefix that matches no device or more than one device is an error.- Values that are switches accept
1,true,on,yesand0,false,off,no(case-insensitive). - Times are printed in UTC as
YYYY-MM-DD HH:MMZ. - Results go to standard output, errors to standard error.
Exit status
| Status | Meaning |
|---|---|
| 0 | Success. Also used when standard output is closed early (for example by head). |
| 1 | The command failed. The reason is printed as Error: <message>. D-Bus errors include the error name in parentheses. |
| 2 | The command line is not valid (unknown subcommand, missing argument, bad option value). |
tether-cli mirror and tether-cli app replace themselves with the GTK app.
Their exit status is then that of tether.
Devices, pairing and connection
devices
tether-cli devices
Lists every device the daemon knows, one per line, with the columns ID
(first 12 characters), NAME, KIND, PAIRED (yes, no), CONNECTED,
BATTERY and STATE.
CONNECTEDisyes,held(disconnected on purpose),reachable(seen on the network, not connected) orno.BATTERYis a percentage, with+appended while charging, or-when unknown.STATEis the pairing state:none,requested_by_us,requested_by_peer,confirmingorpaired.
Prints a hint instead of a table when no device is known.
watch
tether-cli watch
Prints the known devices, then one line for every signal and property change
of the daemon until interrupted with Ctrl+C.
pair
tether-cli pair [-y|--yes] <ID>
Requests pairing with a device, waits up to 60 s for the phone, prints the
six-digit pairing code and asks whether the codes match. An answer of y,
Y or yes confirms. Anything else rejects. After confirming, the command
waits up to 90 s for the phone and prints paired with <name>.
| Option | Effect |
|---|---|
-y, --yes | Confirm the code without asking |
When standard input is not a terminal and --yes is not given, the command
fails without confirming or rejecting.
confirm
tether-cli confirm [-y|--yes] <ID>
Confirms a pairing that the phone started. Shows the code and behaves like
pair from that point. Fails when no pairing is in progress with the device.
reject (alias decline)
tether-cli reject <ID> [CALL_ID]
Rejects the pairing in progress with the device. When CALL_ID is given, or
when a call is ringing and no pairing is in progress, declines that call
instead (see answer).
unpair
tether-cli unpair <ID>
Removes the pairing. Prints nothing on success.
connect
tether-cli connect <ID>
Dials the device’s known addresses now and clears a hold. Prints nothing on success.
disconnect
tether-cli disconnect <ID>
Closes the connection and holds it: neither side reconnects until
tether-cli connect or Connect on the phone.
qr
tether-cli qr [--invert]
Prints a new pairing URI (tether://pair?…) and the same URI as a QR code
drawn with Unicode block characters. The code is valid for 5 minutes and
replaces any earlier one.
| Option | Effect |
|---|---|
--invert | Swap light and dark modules, for terminals with a light background |
add
tether-cli add <ADDRESS>
Adds a manual address (host or host:port, default port 7360), dials it
and stores it in manual_addresses
(Configuration and files).
self
tether-cli self
Prints the daemon’s device id, name and version, and the value of every
setting that config can change.
status
tether-cli status <ID>
Prints the device’s name, connection state and hold, capabilities, Wi-Fi
network and level, airplane mode, one line per SIM (carrier, network type,
signal level out of 4, (data) on the data SIM), Do Not Disturb filter and
whether the phone is ringing through ring. The Wi-Fi network name is
always empty: the Android app does not hold the location permission that
Android requires for it.
Settings
config
tether-cli config <KEY> [VALUE]
Prints a daemon setting, or changes it when VALUE is given. Prints nothing
after a change. The change takes effect at once and is written to
config.toml.
| Key | Value | Default |
|---|---|---|
name | Text, not empty | The host name |
discoverable | Switch | true |
desktop-notifications | Switch | true |
message-notifications | Switch | true |
download-dir | Absolute path, a path starting with ~/, or empty for the default | ~/Downloads/Tether |
auto-accept-files | Switch | true |
clipboard-sync | off, to_phone, from_phone, both | both |
call-audio-on-pc | Switch | true |
call-ringtone | Switch | true |
pause-media-on-call | Switch | true |
The effect of each setting is described in Configuration and files. An unknown key is an error.
Notifications
notifications
tether-cli notifications <ID>
Lists the device’s current notifications. For each: [<key>] <app> — <title>
(with (conversation) for conversation notifications), the text, the path of
the icon, one line per action (action <index>: <title>, with [reply] when
the action takes text) and action -1: open on phone when the notification
can be opened.
notify-act
tether-cli notify-act <ID> <KEY> <INDEX> [TEXT]
Triggers action INDEX of the notification KEY. Index -1 opens the
notification on the phone. TEXT is the reply for an action marked
[reply].
dismiss
tether-cli dismiss <ID> <KEY>
Dismisses the notification on the phone.
Messages and contacts
conversations
tether-cli conversations [--limit <N>] [--refresh] <ID>
Lists the cached conversations, newest first: thread id, time, name, unread count and the start of the last message.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of threads. 0 lists all. | 50 |
--refresh | Ask the phone for the thread list first and wait up to 15 s for it |
messages
tether-cli messages [--limit <N>] [--mark-read] <ID> <THREAD>
Prints the newest messages of a thread, oldest of them first. Each line has
the time, a direction marker (<- received, -> sent, .. queued, !!
failed), the sender and the text. Attachments follow on their own lines with
their part_id, type, size and, when already fetched, their path.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of messages | 50 |
--mark-read | Mark the thread read on the desktop afterwards |
search
tether-cli search [--limit <N>] <ID> <QUERY>
Searches the text of cached messages. Prints matches in the format of
messages, with the thread id ([t<id>]) and the SIM.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of results | 50 |
send
tether-cli send [--to <NUMBER>]... [--attach <FILE>]... [--sim <SUB_ID>]
[--no-wait] <ID> <ADDRESS> [TEXT]...
Sends an SMS to ADDRESS. Several words of TEXT are joined with spaces.
The message becomes an MMS when --attach or --to is used. Prints
queued as <request id>, waits up to 65 s for the phone’s result and prints
sent (message id <id>). A failed send exits with status 1.
| Option | Effect | Default |
|---|---|---|
--to <NUMBER> | Extra recipient, repeatable (group MMS) | |
--attach <FILE> | Attach a file, repeatable | |
--sim <SUB_ID> | SIM subscription id (see status). -1 is the phone’s default SIM. | -1 |
--no-wait | Return after queueing |
attachment
tether-cli attachment <ID> <PART_ID>
Fetches an MMS attachment into the daemon’s cache and prints its path. Waits up to 65 s.
contacts
tether-cli contacts [--refresh] [--lookup <NUMBER-OR-EMAIL>] <ID>
Prints the number of cached contacts and one line per contact: * for
starred contacts, the name, phone numbers with their type, e-mail addresses
and the path of the photo.
| Option | Effect |
|---|---|
--refresh | Ask the phone for changes first and wait up to 30 s |
--lookup <NUMBER-OR-EMAIL> | Print only the contact with this number or address |
Media and phone controls
media
tether-cli media <ID> [ACTION] [POSITION_MS]
Without ACTION, lists the phone’s media sessions (the active one is marked
*): app, session id, title, artist, album, position and duration in
milliseconds, playing or paused, and the path of the cover art.
With ACTION, sends a command to the active session: play, pause,
toggle, next, prev, stop or seek. seek takes the position in
milliseconds as POSITION_MS.
volume
tether-cli volume <ID> [STREAM] [LEVEL]
Without arguments, prints every volume stream as <stream> <level>/<max>,
with (muted) where it applies. With STREAM and LEVEL, sets that stream.
Streams: music, ring, call, notification, alarm.
dnd
tether-cli dnd <ID> [FILTER]
Prints the Do Not Disturb filter and whether the desktop can change it, or
sets it. Filters: all (off), priority, alarms, none (total silence).
Changing it needs Do Not Disturb access on the phone
(Android permissions and grants).
ring
tether-cli ring <ID> [stop]
Rings the phone for at most 60 s. stop (or off) ends the ringing.
clipboard
tether-cli clipboard <ID> send [TEXT]...
tether-cli clipboard <ID> get
send sets the phone’s clipboard. Without TEXT it reads standard input.
get prints the last text received from the phone.
Files and photos
send-file
tether-cli send-file [--no-wait] <ID> <PATH>...
Offers the files to the phone, prints offered as <transfer id> and one
progress line per update until the transfer ends (at most one hour). A
transfer that fails, is cancelled or is rejected exits with status 1.
| Option | Effect |
|---|---|
--no-wait | Return after offering |
transfers
tether-cli transfers <ID>
Lists active and recent transfers: id, direction, state, bytes done and total, and for each file its name, state, progress and local path.
cancel-transfer
tether-cli cancel-transfer <ID> <TRANSFER_ID>
Cancels a transfer.
accept-file
tether-cli accept-file [--reject] <ID> <TRANSFER_ID>
Answers a file offer from the phone. Offers wait for an answer only when
auto-accept-files is off. The transfer id is printed by watch.
| Option | Effect |
|---|---|
--reject | Reject the offer |
photos
tether-cli photos [--limit <N>] [--album <NAME>] <ID> [KIND]
Lists gallery items: id, time, name, dimensions, size, album and the path of
a cached thumbnail. KIND is all (default), image, video or
screenshot. When the index is empty the command asks the phone and waits up
to 20 s. The last line gives the number of items and (more available)
when the limit cut the list.
| Option | Effect | Default |
|---|---|---|
--limit <N> | Maximum number of items | 50 |
--album <NAME> | Only items of this album | all albums |
albums
tether-cli albums <ID>
Prints the album names in the index, one per line.
thumb
tether-cli thumb [--size <PIXELS>] <ID> <MEDIA_ID>
Fetches a thumbnail and prints its path. Waits up to 30 s.
| Option | Effect | Default |
|---|---|---|
--size <PIXELS> | Longest edge | 256 |
fetch
tether-cli fetch <ID> <MEDIA_ID>
Downloads the original into the daemon’s cache and prints its path. Waits up to 10 minutes.
delete-photo
tether-cli delete-photo <ID> <MEDIA_ID>...
Deletes gallery items on the phone and prints which ids were deleted and which failed. Without all-files access the phone asks for confirmation on its screen, and the command waits up to 2 minutes.
Calls and Bluetooth
calls
tether-cli calls <ID>
Prints the current calls and a summary line. A call line has the form
[<call id>] <status> <direction> <who> route=<route>, followed by flags
(muted, audio on pc, the duration of an active call). The summary line
shows whether calls can be controlled, whether dialling is possible, where
the call audio is, the number of unseen missed calls and the Bluetooth state
and address.
answer, hangup, silence
tether-cli answer <ID> [CALL_ID]
tether-cli hangup <ID> [CALL_ID]
tether-cli silence <ID> [CALL_ID]
answer answers the ringing call, hangup ends the current call, silence
stops the ringing on the phone and the desktop without declining. CALL_ID
selects a call when there are several. Each prints <action>: ok, or fails
with the phone’s reason when the phone reports a failure within 3 s. To
decline a call, use reject.
dial
tether-cli dial [--sim <SUB_ID>] <ID> <NUMBER>
Places a call from the phone. Prints the request id and, once the phone reports the outgoing call (up to 16 s), its call line.
| Option | Effect | Default |
|---|---|---|
--sim <SUB_ID> | SIM subscription id. -1 is the phone’s default. | -1 |
mute
tether-cli mute [--call <CALL_ID>] <ID> <on|off>
Mutes or unmutes the phone’s microphone during a call.
audio
tether-cli audio [--call <CALL_ID>] <ID> <pc|phone|speaker>
Moves the call audio to the desktop, to the phone’s earpiece or to the
phone’s loudspeaker, then prints the resulting call audio: value. pc and
speaker need the MANAGE_ONGOING_CALLS grant
(Android permissions and grants).
calllog
tether-cli calllog [--missed] [--limit <N>] [--seen] <ID>
Prints the cached call log, newest first: time, type, duration, name and
number, (new) for unseen missed calls. The last line gives the number of
unseen missed calls.
| Option | Effect | Default |
|---|---|---|
--missed | Only missed calls | |
--limit <N> | Maximum number of entries | 30 |
--seen | Mark missed calls seen afterwards |
bt
tether-cli bt <ID> [status|pair|connect|disconnect]
| Action | Effect |
|---|---|
status (default) | Print the Bluetooth state, the phone’s Bluetooth address and where call audio is |
pair | Start Bluetooth pairing with the phone and follow it. Prints the code to compare. Waits up to 4 minutes. |
connect | Connect the hands-free link and print the state |
disconnect | Disconnect it and print the state |
Enhanced tier
These commands need a phone that announces the enhance capability and a
working adb on the desktop.
enhance
tether-cli enhance [--invert] <ID> [ACTION] [ARG]
| Action | Effect |
|---|---|
status (default) | Print the adb state and version, the enhanced state with its detail, the adb serial, the transport (usb or wifi), whether Wireless debugging can be switched on again through the app, the shell helper’s abilities and the open mirrors |
setup | Link the adb device to this phone and start the shell helper, then print the status |
pair | Print a QR code for Pair device with QR code in the phone’s Wireless debugging settings and follow the pairing for up to 5.5 minutes. Ctrl+C cancels. |
code <CODE> | Pair with the six-digit code from Pair device with pairing code instead. Waits up to 2 minutes. |
grants | Print every grant as granted or missing |
grants apply | Apply all missing grants, then print them |
restart | Restart the shell helper, then print the status |
rearm | Ask the phone to switch Wireless debugging on |
| Option | Effect |
|---|---|
--invert | Swap light and dark modules of the QR code printed by pair |
The grants are listed in Android permissions and grants.
mirror
tether-cli mirror [--screen-off] <ID>
Opens the phone’s screen in a window. The command checks that the enhanced
state is ready and then runs tether --mirror <device id>.
| Option | Effect |
|---|---|
--screen-off | Switch the phone’s own screen off while it is mirrored |
apps
tether-cli apps [--system] <ID>
Lists the phone’s launchable apps as package name and label.
| Option | Effect |
|---|---|
--system | Include preinstalled apps |
app
tether-cli app <ID> <PACKAGE>
Opens one phone app in its own window. The command checks that the enhanced
state is ready and that the shell helper has the ability display.new,
then runs tether --app <device id> <package>.
phone-audio
tether-cli phone-audio <ID> [on|off]
Prints whether the phone’s audio plays on the desktop, with the state and its
detail. With on or off, changes the switch first and waits up to 8 s for
the state to settle.
webcam (0.5.0)
tether-cli webcam <ID> [ACTION] [ARG]
| Action | Effect |
|---|---|
status (default) | Print the switch, the state, the stream in use and the settings |
on, off | Switch the webcam and wait up to 10 s for the state to settle |
cameras | List the phone’s cameras: id, facing, sensor orientation, sizes, frame rates, maximum zoom, torch |
camera <front|back|ID> | Choose the camera |
rotate <0|90|180|270> | Rotate the picture clockwise (rotation is accepted too) |
flip <on|off> | Mirror the picture horizontally |
torch <on|off> | Switch the torch |
zoom <FACTOR> | Zoom factor of 1.0 or more. A trailing x is accepted. |
Every action except cameras ends by printing the status. Only one phone
can be the webcam at a time.
webcam-setup (0.5.0)
tether-cli webcam-setup [status|load|persist|remove]
| Action | Effect |
|---|---|
status (default) | Check again and print the state of the virtual camera |
load | Create the virtual camera device now |
persist | Create it now and at every boot |
remove | Delete the files that create it at boot |
load, persist and remove ask for an administrator password through
polkit. The output shows the state (unsupported, not_installed,
not_loaded, no_device, ready), the device node, whether the device is
created at every boot and which phone uses it.
tether
tether [OPTIONS]
Without options, tether opens the main window. A second start while the app
runs presents the existing window.
| Option | Effect |
|---|---|
-b, --background | Start without showing the window. The autostart entry uses this option. |
--mirror <DEVICE-ID> | Open the phone-screen window of a device. The id may be a unique prefix. In a running app the window opens there and the command returns. |
--screen-off | With --mirror: switch the phone’s own screen off while it is shown |
--app <DEVICE-ID> <PACKAGE> | Open one phone app in its own window, likewise. Pinned launchers use this option. |
--mock | Run against a built-in fake daemon. Needs a build with the mock feature. |
-h, --help | Print the options, including the standard GTK application options |
A malformed --app prints a usage line and exits with status 2.
tetherd
tetherd [-V|--version]
| Option | Effect |
|---|---|
-V, --version | Print tetherd <version> and exit |
tetherd has no other options and ignores other arguments. It runs until it
receives SIGTERM or SIGINT. It exits with a non-zero status when
config.toml cannot be parsed, when the session bus is not available or
when another instance owns the bus name. Settings come from
config.toml and the environment.
Environment variables
All users
| Variable | Read by | Effect |
|---|---|---|
RUST_LOG | tetherd, tether | Log filter in the syntax of the Rust tracing crate, for example info, debug or tetherd=debug,tether_core=trace. Default: info for tetherd (the systemd unit sets the same), tether=info,tether_gtk=info,warn for tether. Logs go to standard error. |
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME | tetherd, tether | Base directories of the files. Defaults: ~/.config, ~/.local/share, ~/.cache. |
XDG_DOWNLOAD_DIR | tetherd | When set, the default download directory is $XDG_DOWNLOAD_DIR/Tether. |
XDG_RUNTIME_DIR | tetherd | Directory of the temporary echo-canceller configuration during calls |
HOME | tetherd, tether | Fallback for the directories above and for ~/ in download_dir |
PATH | tetherd | Search path for adb and the helper programs listed in Supported platforms |
ANDROID_HOME, ANDROID_SDK_ROOT | tetherd | adb is also looked for in <dir>/platform-tools/ |
ANDROID_ADB_SERVER_PORT | tetherd | Port of your own adb server when adb_server = "shared". Default 5037. |
WAYLAND_DISPLAY, DISPLAY | tetherd | Select the clipboard tool (wl-copy or xclip). The clipboard watcher of the daemon runs only on X11. |
TETHER_VIDEO_DECODER | tetherd, tether | Name of a GStreamer H.264 decoder element to try before the built-in list (vah264dec, nvh264dec, v4l2slh264dec, avdec_h264, openh264dec). Used by the mirror windows and, from 0.5.0, the webcam. |
TETHER_APP | tether-cli | Program that mirror and app start. Default: tether next to tether-cli, else tether on PATH. |
Development only
These variables exist for running a second daemon next to an installed one and for testing. Do not set them for normal use.
| Variable | Read by | Effect |
|---|---|---|
TETHER_BUS_NAME | tetherd, tether-cli | D-Bus name to own or to talk to instead of org.tether.Daemon, for example org.tether.Debug |
TETHER_PORT | tetherd | TCP and UDP port, overriding port in config.toml |
TETHER_PEER_PORT | tetherd | Port a phone that dialled in is assumed to listen on. Default 7360. |
TETHER_ADB_PORT | tetherd | Port of the private adb server, overriding adb_server_port |
TETHER_WEBCAM_SETUP (0.5.0) | tetherd | Path of the virtual camera set-up script, instead of /usr/libexec/tether/tether-webcam-setup |
TETHER_TEST_WEBCAM_DEVICE (0.5.0) | tetherd test suite | Device node for one optional test. Not read by the installed program. |
The following variables change the fake daemon of tether --mock and have
no effect without it. The
tether-gtk README
describes what the fake daemon does.
| Variable | Values | Effect |
|---|---|---|
TETHER_MOCK_QUIET | any | No scripted pairing request or reply requests |
TETHER_MOCK_BT | off, unavailable, unpaired (default), paired, connected | Initial Bluetooth state |
TETHER_MOCK_FIRST_CALL | seconds (default 12) | Delay of the first fake incoming call |
TETHER_MOCK_ENHANCED | an enhanced state (default ready) | Initial state of the enhanced tier |
TETHER_MOCK_ADB | missing, too_old | State of adb |
TETHER_MOCK_APPS | empty, error | App list without apps, or an app list that fails to load |
TETHER_MOCK_AUDIO | unsupported, error, playback, playback_dup | Result of switching phone audio on |
TETHER_MOCK_ROTATE | seconds (default 9); 0 for never | Delay of the fake screen rotation |
TETHER_MOCK_WEBCAM_SETUP (0.5.0) | not_installed, not_loaded (default), no_device, ready, unsupported | Initial state of the virtual camera |
TETHER_MOCK_WEBCAM_SETUP_RESULT (0.5.0) | fail, cancel | Result of the set-up action |
TETHER_MOCK_WEBCAM (0.5.0) | unsupported, error, busy | Result of switching the webcam on |
TETHER_MOCK_CAMERAS (0.5.0) | number (default 2) | Number of fake cameras |
Configuration and files
The settings of Tetheron, the files it reads and writes on the desktop, the service, the network ports and the data of the Android app. Entries marked 0.5.0 ship with the next release. The latest release is 0.4.1.
Settings of the daemon: config.toml
Path: $XDG_CONFIG_HOME/tether/config.toml (default
~/.config/tether/config.toml).
The daemon creates the file with default values when it does not exist. It
reads the file once at start and writes the whole file again whenever a
setting changes through the app, tether-cli or D-Bus. Edit the file by hand
only while the daemon is stopped. A file that is not valid TOML stops the
daemon at start. A key that is missing gets its default.
The column CLI key gives the name for
tether-cli config. Keys without one can be changed in the
file only, or through the place named in the description.
Global keys
| Key | CLI key | Type | Default | Effect |
|---|---|---|---|---|
name | name | string | host name, or Linux | Name this desktop announces to phones. Must not be empty. |
discoverable | discoverable | boolean | true | Announce this desktop through mDNS and the UDP beacon. |
show_desktop_notifications | desktop-notifications | boolean | true | Show the phone’s notifications as desktop notifications. |
message_notifications | message-notifications | boolean | true | Show a desktop notification for a new incoming message. |
manual_addresses | array of strings | [] | host or host:port entries the daemon dials at start. tether-cli add appends to it. | |
port | integer | 7360 | TCP port of the listener and UDP port of the beacon. | |
download_dir | download-dir | string | "" | Directory for received files. Empty means ~/Downloads/Tether, or $XDG_DOWNLOAD_DIR/Tether when that variable is set. A leading ~/ is expanded. |
auto_accept_files | auto-accept-files | boolean | true | Accept files offered by paired devices without asking. |
clipboard_sync | clipboard-sync | string | "both" | Direction of clipboard sync: off, to_phone, from_phone or both. |
call_audio_on_pc | call-audio-on-pc | boolean | true | Move call audio to the desktop when a call connects and the Bluetooth hands-free link is up. |
call_echo_cancel | boolean | true | Run PipeWire’s echo canceller while call audio uses the desktop’s default speakers and microphone. | |
call_ringtone | call-ringtone | boolean | true | Play a ringtone on the desktop for incoming calls. |
pause_media_on_call | pause-media-on-call | boolean | true | Pause desktop media players (MPRIS) while a call rings or is in progress. |
adb_server | string | "private" | private: the daemon runs its own adb server with its own key. shared: it uses your adb server. Any other value is treated as private. | |
adb_server_port | integer | 5038 | Port of the private adb server. | |
adb_path | string | "" | Path of the adb program. Empty means: search PATH, then $ANDROID_HOME/platform-tools, $ANDROID_SDK_ROOT/platform-tools and ~/Android/Sdk/platform-tools. | |
phone_audio_source | string | "auto" | How the shell helper captures phone audio: auto, output, playback or playback_dup. auto takes the first of the three that the phone supports. | |
webcam_size (0.5.0) | string | "1280x720" | Picture size of the virtual camera: 1280x720, 640x480 or 1920x1080. Any other value means 1280x720. | |
webcam_fps (0.5.0) | integer | 30 | Frame rate of the virtual camera, 5 to 60. Any other value means 30. | |
webcam_device (0.5.0) | string | "" | Device node of the v4l2loopback device to use. Empty means the device labelled Tether Phone Camera. |
Per-device keys
Each device has a table [devices.<device id>]. A device without a table
uses the defaults.
| Key | Type | Default | Effect |
|---|---|---|---|
blocked_packages | array of strings | [] | Android package names whose notifications are not shown on the desktop. Changed in the app’s per-app list. |
sync_messages | boolean | true | Sync SMS and MMS from this phone. |
sync_contacts | boolean | true | Sync contacts from this phone. |
sync_photos | boolean | true | Index this phone’s gallery. |
bt_address | string | "" | Bluetooth address of the phone. Written by the daemon after Bluetooth pairing. |
adb_serial | string | "" | Hardware serial of the adb device linked to this phone. Written by the enhanced set-up; empty means not set up. |
phone_audio | boolean | false | Play this phone’s audio on the desktop. The Play phone audio on this PC switch and tether-cli phone-audio. |
webcam (0.5.0) | boolean | false | Use this phone as the webcam. The Use as webcam switch and tether-cli webcam. |
webcam_camera (0.5.0) | string | "back" | front, back or a camera id. |
webcam_rotation (0.5.0) | integer | 0 | Clockwise rotation of the picture: 0, 90, 180 or 270. |
webcam_flip (0.5.0) | boolean | false | Mirror the picture horizontally. |
webcam_zoom (0.5.0) | float | 1.0 | Zoom factor. |
Example
name = "study-pc"
discoverable = true
clipboard_sync = "from_phone"
manual_addresses = ["192.168.1.40"]
[devices.<device id>]
blocked_packages = ["com.example.game"]
sync_photos = false
Replace <device id> with the 64-character id of the phone.
Settings of the GTK app: gtk.toml
Path: $XDG_CONFIG_HOME/tether/gtk.toml (default
~/.config/tether/gtk.toml).
The app reads the file at start and writes it when a value changes. A file that cannot be parsed is ignored and the defaults apply.
| Key | Type | Default | Effect |
|---|---|---|---|
show_tray | boolean | true | Show a tray icon and keep the app running when the window is closed. |
window_width | integer | 900 | Width of the main window when it was last closed. |
window_height | integer | 640 | Height of the main window. |
window_maximized | boolean | false | Whether the main window was maximised. |
mirror_screen_off | boolean | false | Switch the phone’s own screen off when a mirror window opens. |
mirror_software_decoding | boolean | false | Do not use hardware video decoders in mirror windows. |
mirror_max_size | integer | 0 | Longest side of the mirrored phone screen in pixels. 0 means the phone’s own size. Does not apply to app windows. |
mirror_bitrate | integer | 0 | Video bitrate in bit/s. 0 means the phone’s default (8 Mbit/s). |
apps_show_system | boolean | false | Show preinstalled apps in the Apps tab. |
app_sizes | table | empty | Last window size of each phone app, by package name. Written by the app. |
app_recents | table | empty | Recently opened phone apps, by device id. Written by the app. |
Files on the desktop
$XDG_CONFIG_HOME, $XDG_DATA_HOME and $XDG_CACHE_HOME default to
~/.config, ~/.local/share and ~/.cache.
Per-user files
| Path | Written by | Content |
|---|---|---|
$XDG_CONFIG_HOME/tether/config.toml | tetherd | Settings of the daemon |
$XDG_CONFIG_HOME/tether/gtk.toml | tether | Settings of the app |
$XDG_CONFIG_HOME/autostart/org.tether.Tether.desktop | tether | Autostart entry that runs tether --background at login. Present while Start Tether in background at login is on in the app’s preferences. |
$XDG_DATA_HOME/tether/identity.key | tetherd | Private key of this desktop (PEM, mode 0600) |
$XDG_DATA_HOME/tether/identity.crt | tetherd | Certificate of this desktop (PEM). The device id is derived from it. |
$XDG_DATA_HOME/tether/trusted.toml | tetherd | Paired devices: id, name, kind, certificate, time of pairing (mode 0600) |
$XDG_DATA_HOME/tether/devices/<device id>/cache.db | tetherd | SQLite cache of one phone: threads, messages, attachments, contacts, gallery index, transfers, call log, app list |
$XDG_DATA_HOME/tether/adb/ | adb | Home directory of the private adb server; .android/ inside holds its key pair |
$XDG_DATA_HOME/applications/tether-<device8>-<package>.desktop | tether | Launcher of a pinned phone app. <device8> is the first eight characters of the device id. |
$XDG_DATA_HOME/icons/hicolor/128x128/apps/tether-<device8>-<package>.png | tether | Icon of a pinned phone app |
$XDG_CACHE_HOME/tether/blobs/ | tetherd | Notification icons, cover art and app icons, named by their SHA-256 |
$XDG_CACHE_HOME/tether/devices/<device id>/thumbs/ | tetherd | Gallery thumbnails |
$XDG_CACHE_HOME/tether/devices/<device id>/media/ | tetherd | Originals fetched with Open or tether-cli fetch |
$XDG_CACHE_HOME/tether/devices/<device id>/attachments/ | tetherd | Fetched MMS attachments |
$XDG_CACHE_HOME/tether/devices/<device id>/contacts/ | tetherd | Contact photos |
$XDG_CACHE_HOME/tether/devices/<device id>/cameras.json (0.5.0) | tetherd | Camera list of the phone |
~/Downloads/Tether/ | tetherd | Received files (see download_dir). A file whose name exists is saved as name (2).ext. |
$XDG_RUNTIME_DIR/tether-echo-cancel.conf | tetherd | Temporary PipeWire configuration of the echo canceller during a call |
With adb_server = "shared" the daemon uses your own adb key in
~/.android/ and writes nothing to $XDG_DATA_HOME/tether/adb/.
Logs
Tetheron writes no log files. tetherd and tether log to standard error.
When the daemon runs as the systemd user unit, the journal collects its
output:
journalctl --user -u tetherd
The level is set with RUST_LOG
(Command-line tools).
Files installed by the package
| Path | Content |
|---|---|
/usr/bin/tetherd, /usr/bin/tether, /usr/bin/tether-cli | The three programs |
/usr/lib/systemd/user/tetherd.service | systemd user unit |
/usr/share/dbus-1/services/org.tether.Daemon.service | D-Bus activation file |
/etc/ufw/applications.d/tether | ufw application profile Tether (configuration file) |
/usr/share/applications/org.tether.Tether.desktop | Desktop entry of the app |
/usr/share/icons/hicolor/scalable/apps/org.tether.Tether.svg | App icon |
/usr/share/metainfo/org.tether.Tether.metainfo.xml | AppStream metadata |
/usr/share/doc/tether/wireplumber/ | Optional WirePlumber configuration for call audio (51-tether.lua, 51-tether.conf, README.md). Never installed into a configuration directory. |
/usr/libexec/tether/tether-webcam-setup (0.5.0) | Script that creates the virtual camera; run as root through pkexec |
/usr/share/polkit-1/actions/org.tether.webcam-setup.policy (0.5.0) | polkit action org.tether.webcam-setup for that script; asks for an administrator password every time |
Files installed by the tarball
The install script of the tarball (0.5.0) installs the same files under
/usr/local, or under the directory given with --prefix. In the unit and
in the D-Bus activation file it replaces /usr/bin/tetherd with the
daemon’s installed path.
| Path | Content |
|---|---|
/usr/local/bin/tetherd, tether, tether-cli | The three programs |
/usr/local/bin/tether-uninstall | A copy of the install script. Run as root, it removes the files in this table. |
/usr/local/lib/systemd/user/tetherd.service | systemd user unit |
/usr/local/share/dbus-1/services/org.tether.Daemon.service | D-Bus activation file |
/usr/local/share/applications/, icons/, metainfo/ | Desktop entry, app icon and AppStream metadata, under the names the package uses |
/usr/local/share/doc/tether/ | LICENSE, NOTICE and the optional WirePlumber configuration |
/usr/libexec/tether/tether-webcam-setup | Script that creates the virtual camera. Always at this path, which the daemon expects. Not installed when /usr is read-only. |
/usr/share/polkit-1/actions/org.tether.webcam-setup.policy | polkit action for that script. Always at this path, where polkit reads actions. |
/etc/ufw/applications.d/tether | ufw application profile Tether. Installed only when that directory exists. |
Files written by the virtual camera set-up (0.5.0)
tether-cli webcam-setup persist and the Create it at every start choice in
the app write two files as root. webcam-setup remove deletes them.
| Path | Content |
|---|---|
/etc/modprobe.d/tether-webcam.conf | Options of the v4l2loopback module: one device labelled Tether Phone Camera |
/etc/modules-load.d/tether-webcam.conf | Loads v4l2loopback at boot |
The set-up picks the first free device number from /dev/video42 to
/dev/video63.
Service
systemd user unit
tetherd.service is a systemd user unit. The package and the tarball’s
install script enable it for all users, so the daemon starts with each
user’s session.
| Property | Value |
|---|---|
| Type | dbus, bus name org.tether.Daemon |
| Command | /usr/bin/tetherd (package), /usr/local/bin/tetherd (tarball) |
| Start | WantedBy=default.target, After=graphical-session.target |
| Stop | With the graphical session (PartOf=graphical-session.target) |
| Restart | on-failure, after 2 s |
| Environment | RUST_LOG=info |
| Hardening | NoNewPrivileges=yes |
D-Bus
| Item | Value |
|---|---|
| Bus | Session bus |
| Service name of the daemon | org.tether.Daemon |
| Object of the daemon | /org/tether/Daemon, interface org.tether.Daemon1 |
| Object of a device | /org/tether/Devices/<device id>, interface org.tether.Device1 |
| Activation file | /usr/share/dbus-1/services/org.tether.Daemon.service |
| Application id of the app | org.tether.Tether (org.tether.Tether.Mock with --mock) |
The activation file names SystemdService=tetherd.service: the first D-Bus
call to org.tether.Daemon starts the user unit when it is not running. The
interfaces are described in D-Bus API.
Network
Ports
| Port | Protocol | Direction | Use |
|---|---|---|---|
| 7360 | TCP | in and out | TLS 1.3 connection between desktop and phone. Both sides listen and both sides dial. Bulk transfers open further connections to the same port. |
| 7360 | UDP | in and out | Discovery beacon: a broadcast every 5 s while discoverable is on (every second during a search), and the listener for the phone’s beacons |
| 5353 | UDP | in and out | mDNS through the Avahi daemon: service type _tether._tcp; for the enhanced tier also the phone’s _adb-tls-pairing._tcp and _adb-tls-connect._tcp |
| 5038 | TCP | loopback only | Private adb server of the daemon (adb_server_port) |
| 5037 | TCP | loopback only | Your own adb server; used for USB and with adb_server = "shared" |
| chosen by the phone | TCP | out | Wireless debugging: pairing port and connection port of the phone. The connection port changes whenever Wireless debugging is switched on. |
| chosen by the system | TCP | loopback only | Listener that the shell helper reaches through adb reverse |
The port key changes both 7360 entries on the desktop. The Android app
always uses 7360. The connection, discovery and pairing are specified in
Wire protocol.
Firewall profile
The package installs the ufw application profile Tether. The tarball’s
install script installs it when ufw is present:
[Tether]
title=Tether
description=Tether phone link: TLS control connection and discovery beacon. mDNS (5353/udp) is covered by the Avahi/mDNS profile.
ports=7360/tcp|7360/udp
Neither changes firewall rules. The profile takes effect when you allow it:
sudo ufw allow Tether
Data of the Android app
| Item | Location | Content |
|---|---|---|
| Identity key | Android Keystore, alias tether-identity | EC P-256 key pair and self-signed certificate of the phone. The private key does not leave the keystore. |
| Paired desktops | files/trusted_desktops.json | Paired desktops with their certificates |
| Settings | Preferences DataStore tether_settings | See the table below |
| Icon cache | files/icons/ | Icons already sent to desktops |
| Temporary files | cache/mms/, cache/outgoing-mms/, cache/outgoing/ | MMS being sent and files shared to a desktop |
| Received files | Download/Tether/ on shared storage | Files sent from a desktop |
All items except the received files are in the app’s private storage and
are removed when the app is uninstalled. The app excludes its data from
Android backups (allowBackup="false").
Settings of the Android app
| Key | Default | Effect |
|---|---|---|
device_name | the phone’s name | Name the phone announces |
run_on_boot | on | Start the background service when the phone starts |
sync_notifications | on | Send notifications to desktops |
include_ongoing | off | Also send ongoing notifications |
blocked_packages | empty | Apps whose notifications are not sent |
sync_messages | on | Announce and serve messages |
sync_contacts | on | Announce and serve contacts |
sync_media | on | Announce and serve media sessions |
sync_photos | on | Announce and serve the gallery |
auto_accept_files | on | Save files from paired desktops without asking |
clipboard_enabled | on | Let desktops set the clipboard and send clipboard changes |
sync_calls | on | Announce and serve calls |
sync_call_log | on | Announce and serve the call log |
bluetooth_enabled | on | Report Bluetooth pairing and hands-free state |
The app also stores onboarding_done and recent_packages (apps that
posted notifications recently) for its own screens.
Android permissions and grants
The permissions that the Tetheron app for Android (org.tether.android)
declares, the special accesses it uses and the grants given over adb. To
grant them, follow
Grant Android permissions.
Permissions granted at installation
Android grants these without asking.
| Permission | Used for |
|---|---|
INTERNET | The TLS connection to the desktop |
ACCESS_NETWORK_STATE | Reconnecting when the network changes; Wi-Fi status for the desktop |
ACCESS_WIFI_STATE | Wi-Fi signal level for the desktop |
CHANGE_WIFI_MULTICAST_STATE | Receiving the desktop’s UDP discovery beacon |
FOREGROUND_SERVICE, FOREGROUND_SERVICE_CONNECTED_DEVICE | The background service that holds the connection |
RECEIVE_BOOT_COMPLETED | Starting the service when the phone starts and after an app update |
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS | Showing the system dialog for the battery optimisation exemption |
REQUEST_COMPANION_SELF_MANAGED | The companion device association |
QUERY_ALL_PACKAGES | Names and icons of the apps that post notifications or play media; the app list of the Apps tab |
ACCESS_NOTIFICATION_POLICY | Declares the request for Do Not Disturb access |
USE_FULL_SCREEN_INTENT | The “find my phone” alert over the lock screen; see Full-screen alerts |
VIBRATE | Vibration during “find my phone” |
MODIFY_AUDIO_SETTINGS | Muting the microphone during a call |
CALL_COMPANION_APP | Makes the app eligible as a call companion; see MANAGE_ONGOING_CALLS |
Permissions prompted at run time
Android shows a dialog for each group. The set-up wizard of the app asks for them step by step, and the app’s Settings screen asks again when a feature is switched on without its permission. Every step except the first can be skipped.
| Permission | Asked in | Used for | Without it |
|---|---|---|---|
POST_NOTIFICATIONS | Wizard, first step | The status notification of the background service; file offers; the “send clipboard” action | Android hides the status notification |
CAMERA | When you tap Scan QR | Scanning the pairing QR code | Pair by code or by address |
READ_SMS, SEND_SMS | Wizard, Messages and contacts | Reading conversations and sending messages | The phone does not announce the messages capability; no Messages tab content |
RECEIVE_SMS, RECEIVE_MMS, RECEIVE_WAP_PUSH | Same step | Requested with the two above; not required for the messages capability | |
READ_CONTACTS | Same step | Contact names and photos | No contacts capability; numbers are shown without names |
READ_PHONE_STATE | Same step, and Calls | SIM, carrier and signal status; call state | No SIM and signal status; no calls capability |
READ_MEDIA_IMAGES, READ_MEDIA_VIDEO | Wizard, Photos and files | The gallery | No photos capability. File transfer needs no permission. |
ANSWER_PHONE_CALLS | Wizard, Calls | Answering, declining and ending calls | No calls capability |
READ_CALL_LOG | Same step | The call log; the caller’s number for incoming calls | No calllog capability; incoming calls may show no number |
CALL_PHONE | Same step | Dialling from the desktop | No calls.dial capability |
BLUETOOTH_CONNECT | Same step | Reporting the Bluetooth pairing and hands-free state to the desktop | No bluetooth capability; no guided set-up of call audio |
BLUETOOTH_ADVERTISE | Same step | Making the phone discoverable while the desktop pairs over Bluetooth | The phone opens its Bluetooth settings instead |
READ_PHONE_NUMBERS | Never asked | The phone’s own number in the device information | The number is left empty |
The app declares READ_PHONE_NUMBERS and never asks for it. The
runtime_permissions grant of the enhanced tier includes it.
The app declares no location permission, so it reports the Wi-Fi signal level without the name of the network.
Special accesses
These are switched on in Android’s settings. The app opens the matching settings screen.
Notification access
| Service | NotificationListener (BIND_NOTIFICATION_LISTENER_SERVICE) |
| Used for | Mirroring notifications, notification actions and replies, dismiss sync, media sessions and media control |
| Without it | No notifications and no media controls on the desktop |
| Granted in | Wizard step Notification access; app Settings → Notification access |
| Over adb | Grant notification_listener |
On Android 13 and newer, an app installed from an APK may first have to be allowed to use “restricted settings” in the system’s app information screen.
Battery optimisation exemption
| Used for | Keeping the connection while the phone is idle (Doze) |
| Without it | Notifications are delayed and the connection drops while the phone is idle |
| Granted in | Wizard step for battery; system setting Battery → Unrestricted |
| Over adb | Grant battery_whitelist |
On Samsung phones the wizard has one more step: add the app to Never sleeping apps. No permission or grant covers that list.
Companion device association
| Permission | REQUEST_COMPANION_SELF_MANAGED |
| Used for | Registering the paired desktop as a companion device. On Android 15 and newer this lets notifications with one-time codes through to the app, and it improves how long Android lets the app run in the background. |
| Without it | Android 15 and newer hide the content of one-time-code notifications from the app, unless the grant sensitive_notifications is applied |
| Granted in | Wizard step after pairing |
On some Android builds the permission is reserved for system apps (seen on Android 16 with One UI 8.5). The app detects this and skips the step.
Do Not Disturb access
| Permission | ACCESS_NOTIFICATION_POLICY |
| Used for | Changing Do Not Disturb from the desktop |
| Without it | The desktop shows the Do Not Disturb state and cannot change it |
| Granted in | App Settings → Do Not Disturb access |
Full-screen alerts
| Permission | USE_FULL_SCREEN_INTENT |
| Used for | Showing the “find my phone” alert over the lock screen |
| Without it | The phone rings; the alert does not appear over the lock screen |
| Granted in | App Settings → Full-screen alerts |
All files access
| Permission | MANAGE_EXTERNAL_STORAGE |
| Used for | Deleting gallery items from the desktop without a confirmation on the phone |
| Without it | Every delete from the desktop asks for confirmation on the phone’s screen |
| Granted in | App Settings → All files access |
| Over adb | Grant manage_external_storage |
Grants over adb
Some permissions cannot be granted on the phone itself. With the
enhanced tier set up, the desktop
applies them through the shell helper, from the set-up wizard of the desktop
app or with tether-cli enhance <id> grants apply. With
your own adb, run the command from the table.
The shell helper runs only the commands of this table. The grant names are fixed in the helper protocol (Wire protocol).
| Grant | Command | What it enables | Without it |
|---|---|---|---|
notification_listener | adb shell cmd notification allow_listener org.tether.android/org.tether.android.features.notifications.NotificationListener | Notification access without the settings screen | Grant it on the phone |
battery_whitelist | adb shell dumpsys deviceidle whitelist +org.tether.android | The battery optimisation exemption | Grant it on the phone |
runtime_permissions | adb shell pm grant org.tether.android <permission>, once for each permission of Permissions prompted at run time that is not granted | All run-time permissions without their dialogs | Grant them on the phone |
manage_external_storage | adb shell appops set org.tether.android MANAGE_EXTERNAL_STORAGE allow | All files access | Grant it on the phone |
read_logs | adb shell pm grant org.tether.android android.permission.READ_LOGS | With system_alert_window: clipboard sync from the phone while the app is in the background. See READ_LOGS and SYSTEM_ALERT_WINDOW. | Clipboard changes are sent only while the app is in the foreground, or by hand |
system_alert_window | adb shell appops set org.tether.android SYSTEM_ALERT_WINDOW allow | See read_logs | See read_logs |
sensitive_notifications | adb shell appops set org.tether.android RECEIVE_SENSITIVE_NOTIFICATIONS allow | One-time codes in notifications on Android 15 and newer, when the companion device association is not available | Android hides the content of those notifications |
manage_ongoing_calls | adb shell appops set org.tether.android MANAGE_ONGOING_CALLS allow | Switching call audio from the desktop. See MANAGE_ONGOING_CALLS. | Only Phone works from the desktop |
write_secure_settings | adb shell pm grant org.tether.android android.permission.WRITE_SECURE_SETTINGS | Switching Wireless debugging on again from the app. See WRITE_SECURE_SETTINGS. | Switch Wireless debugging on by hand after each phone restart |
The desktop reads the state of each grant back from the phone after
applying it. Android stores the grants with the app, and they are lost when
the app is uninstalled. Whether MANAGE_ONGOING_CALLS survives a phone
restart has not been tested.
READ_LOGS and SYSTEM_ALERT_WINDOW
Android does not let an app read the clipboard while it is in the
background. With these two grants the app watches the system log for the
line that Android writes when it refuses the app access to a new clip.
It then starts an invisible activity that takes focus for a moment, reads
the clip and sends it. READ_LOGS allows reading the log.
SYSTEM_ALERT_WINDOW allows starting the activity from the background. The
app never asks for either permission on the phone.
Without them, text copied on the phone reaches the desktop in these ways:
- At once, while the app is in the foreground.
- With the Send clipboard Quick Settings tile, the share sheet or the action in the status notification.
- Through the shell helper while the enhanced tier is running, which needs neither grant.
MANAGE_ONGOING_CALLS
This app-op makes Android’s telephony service bind the app’s call companion
service (TetherInCallService). Through it the app can move a call’s audio
between the Bluetooth device (the desktop), the earpiece and the
loudspeaker, and it sees calls with their numbers.
Without it:
- This PC and Speaker in the in-call window and
tether-cli audio <id> pcfail withroute_unsupported. Phone works, because the desktop can close the audio link by itself. - Call audio can still be moved to the desktop on the phone’s own call screen.
- Answering, declining, ending, muting and dialling are not affected. They use the run-time permissions.
WRITE_SECURE_SETTINGS
Wireless debugging switches off when the phone restarts. With this
permission the app can switch it on again when the desktop asks
(tether-cli enhance <id> rearm, and automatically once per connection).
The app uses the permission for this one setting.
The system may switch Wireless debugging off again at once when the current Wi-Fi network was not allowed for it on the phone. Choose Always allow on this network when the phone asks.
Without the permission the request is ignored and can re-arm in
tether-cli enhance <id> status is false.
Permissions that protect the app’s components
These restrict who may call into the app. The app does not hold them.
| Component | Required permission of the caller | Effect |
|---|---|---|
NotificationListener | BIND_NOTIFICATION_LISTENER_SERVICE | Only the system can bind the listener |
TetherInCallService | BIND_INCALL_SERVICE | Only the telephony service can bind it |
ClipboardTileService | BIND_QUICK_SETTINGS_TILE | Only the system can bind the tile |
AdbLinkReceiver | DUMP | Only the adb shell and the system can send the one-time token that links an adb device to a paired phone |
What the shell helper can do
The enhanced tier does not add permissions to the app. The shell helper is a separate process that the desktop starts over adb. It runs with the privileges of the adb shell, which include capturing the screen, injecting input, capturing audio, opening the camera (0.5.0) and running the grant commands above. See Privilege tiers and adb and Security model.
tetherd D-Bus API (session bus)
Normative contract between tetherd and its clients (tether GTK app,
tether-cli, future shell extensions). Bus name org.tether.Daemon.
All strings UTF-8. Timestamps are Unix milliseconds (t).
/org/tether/Daemon — interface org.tether.Daemon1
Properties
| Name | Type | Access | Meaning |
|---|---|---|---|
SelfId | s | read | this desktop’s device id (64 hex) |
SelfName | s | read/write | advertised name (defaults to hostname) |
Version | s | read | daemon version |
Discoverable | b | read/write | publish mDNS + UDP beacon |
ShowDesktopNotifications | b | read/write | mirror phone notifications to org.freedesktop.Notifications |
Methods
ListDevices() -> (ao paths)— all known devices (paired, connected or merely discovered).StartDiscovery(),StopDiscovery()— browsing is always on while the daemon runs; these are hints to burst beacons.AddManualAddress(s address)—hostorhost:port; dials immediately and remembers the address.GeneratePairingQr() -> (s uri)— returnstether://pair?...valid 5 minutes (see docs/reference/protocol.md). Calling again invalidates the previous one.CancelPairingQr()
Signals
DeviceAdded(o path),DeviceRemoved(o path)QrPairingStarted(o path)— a phone connected using the current QR; UI may show progress.
/org/tether/Devices/<id> — interface org.tether.Device1
<id> is the 64-hex device id (valid D-Bus path element).
Properties (all read-only; changes emitted via org.freedesktop.DBus.Properties.PropertiesChanged)
| Name | Type | Meaning |
|---|---|---|
Id | s | device id |
Name | s | peer name |
Kind | s | desktop / phone / tablet / unknown |
Paired | b | trusted record exists |
Connected | b | authenticated session up |
Reachable | b | seen via discovery in the last 30 s |
Addresses | as | last known ip:port list |
PairState | s | none / requested_by_us / requested_by_peer / confirming / paired |
PairingSas | s | 6 digits while PairState is requested_by_peer or confirming, else "" |
BatteryLevel | i | 0..100, -1 unknown |
BatteryCharging | b | |
Model | s | from DeviceInfo |
Manufacturer | s | |
OsVersion | s | |
Capabilities | as | peer’s Hello.capabilities |
LastSeen | t | ms since epoch |
Methods
RequestPair()— we initiate; emitsPairingSasonce the peer answers.ConfirmPair()— user confirmed the SAS on this side.RejectPair()Unpair()Connect()— dial known addresses now.Disconnect()GetNotifications() -> (aa{sv})— currently visible notifications (dicts described below).ActivateNotification(s key, i index, s reply_text)—index = -1opens on phone;reply_textused for remote-input actions.DismissNotification(s key)GetAppNotificationSettings() -> (a{sb})— package → enabled.SetAppNotificationsEnabled(s package, b enabled)
Signals
NotificationPosted(a{sv} notification)NotificationRemoved(s key)ReplyRequested(s key)— the user clicked a reply action on a desktop notification; the GTK app should open its reply box for that key. For the daemon’s own message notifications (M2)keyisthread:<thread_id>and the app should open that conversation’s composer instead.PairingFinished(b success, s reason)
Notification dict (a{sv})
| Key | Type | Notes |
|---|---|---|
key | s | |
package | s | |
app_name | s | |
title | s | |
text | s | |
big_text | s | |
sub_text | s | |
when_ms | t | |
category | s | |
ongoing | b | |
clearable | b | |
silent | b | |
conversation | b | |
conversation_title | s | |
icon_path | s | absolute path to cached PNG or "" |
app_icon_path | s | absolute path or "" |
has_content_intent | b | |
actions | a(usbs) | (index, title, remote_input, placeholder) |
messages | a(sstb) | (sender, text, ts_ms, from_self) |
Files
- Config:
$XDG_CONFIG_HOME/tether/config.toml(name,discoverable,show_desktop_notifications,manual_addresses,blocked_packagesper device). - Identity:
$XDG_DATA_HOME/tether/identity.key(PKCS#8 PEM, mode 0600),identity.crt(PEM). - Trusted devices:
$XDG_DATA_HOME/tether/trusted.toml—[[device]] id, name, kind, cert_pem, paired_at. - Icon cache:
$XDG_CACHE_HOME/tether/blobs/<sha256>.png. - Logs: journald via
tracing;RUST_LOGhonoured.
Milestone 2 additions
Everything below is additive. org.tether.Device1 gains properties, methods and
signals per feature; the daemon advertises what the peer supports through the
existing Capabilities property, and clients hide UI for missing capabilities.
Dicts (a{sv}) are described after the tables. Paths returned by methods are
absolute and owned by the daemon’s cache; clients copy rather than move them.
org.tether.Daemon1 additions
Properties
| Name | Type | Access | Meaning |
|---|---|---|---|
DownloadDir | s | read/write | where received files land, default ~/Downloads/Tether |
AutoAcceptFiles | b | read/write | accept FileOffers from paired devices without asking (default true) |
ClipboardSync | s | read/write | off / to_phone / from_phone / both (default both) |
MessageNotifications | b | read/write | post a desktop notification for new incoming messages (default true) |
Signals
FileOffered(o device, s transfer_id, a(sts) files)— only whenAutoAcceptFilesis false;files=(name, size, mime).
Methods
AcceptFileOffer(o device, s transfer_id, b accept)
org.tether.Device1 — connection
Properties
| Name | Type | Meaning |
|---|---|---|
Held | b | auto-reconnect paused after a Disconnect (either side); Connect() clears it |
Method semantics change: Disconnect() now sends Disconnect{hold_seconds = 0}
and holds; Connect() clears the hold and dials.
org.tether.Device1 — messages (messages, messages.mms)
Methods
GetConversations(u limit, u offset) -> (aa{sv})— newest first;limit = 0= all.GetMessages(s thread_id, t before_ms, u limit) -> (aa{sv})— newest first,before_ms = 0= newest page.GetMessage(s message_id) -> (a{sv})SendMessage(as addresses, s body, i sub_id, as attachment_paths) -> (s request_id)— result arrives asMessageSendResult.MarkThreadRead(s thread_id)— desktop-local read state.RequestAttachment(s part_id) -> (s path)— returns the cached path if present, else""and laterAttachmentReady.RefreshMessages()— force aConversationsRequestnow.SearchMessages(s query, u limit) -> (aa{sv})
Signals
ConversationsChanged()— thread list order/snippets changed; clients re-fetch. During the initial sync this fires once per stored page instead of oneMessageAddedper historical message.MessageAdded(a{sv} message)— new or updated message (incoming or sent).MessageRemoved(s message_id)MessageSendResult(s request_id, b ok, s error, s message_id)AttachmentReady(s part_id, s path)—pathempty on failure.
Conversation dict: thread_id s, addresses as, display_name s (contact names joined, falls back to numbers), snippet s, date_ms t, unread_count u (desktop-local), message_count u, archived b, photo_path s (first contact’s photo or "").
Message dict: id s, thread_id s, addresses as, body s, date_ms t, type s (inbox|sent|draft|outbox|failed|queued), read b (desktop-local), sub_id i, mms b, subject s, attachments aa{sv} (part_id s, mime s, size t, name s, width u, height u, path s cached file or ""), sender_name s (resolved contact or ""), pending b (sent from this desktop, no result yet).
org.tether.Device1 — contacts (contacts)
Methods
GetContacts() -> (aa{sv})— all cached contacts, sorted by display name.LookupContact(s address) -> (a{sv})— by phone number (normalised comparison) or email; empty dict if none.RefreshContacts()
Signals
ContactsChanged()
Contact dict: uid s, display_name s, phones a(ss) ((type, number)), emails a(ss), photo_path s, starred b.
org.tether.Device1 — media and volume (media, volume)
Methods
GetMediaSessions() -> (aa{sv})— first entry is the active session.MediaCommand(s session_id, s action, t position_ms)—action∈play|pause|toggle|next|prev|stop|seek.GetVolumes() -> (a(suub))—(stream, level, max, muted),stream∈music|ring|call|notification|alarm.SetVolume(s stream, u level)
Signals
MediaSessionsChanged(aa{sv} sessions)VolumesChanged(a(suub) volumes)
Media session dict: id s, package s, app_name s, title s, artist s, album s, art_path s, playing b, position_ms t, position_ts_ms t, duration_ms t, can_seek b, can_next b, can_prev b, can_pause b, can_play b, playback_speed d.
The daemon additionally exports an MPRIS player per connected phone that has an
active session: bus name org.mpris.MediaPlayer2.tether_<first 8 hex of id>,
Identity = "<phone name>", DesktopEntry = "org.tether.Tether", with
PlaybackStatus, Metadata (mpris:artUrl from art_path, xesam:title,
xesam:artist, xesam:album, mpris:length), Position, Play/Pause/ PlayPause/Next/Previous/Stop/Seek/SetPosition, CanControl and the Can*
flags, and Volume mapped to the music stream.
org.tether.Device1 — status and controls (dnd, ring, connectivity, clipboard)
Properties
| Name | Type | Meaning |
|---|---|---|
DndFilter | s | all (off) / priority / alarms / none / unknown |
DndCanChange | b | phone has notification-policy access |
Sims | a(issub) | (sub_id, carrier, network_type, level_0_4, data_active) |
WifiSsid | s | "" if not on Wi-Fi |
WifiLevel | i | 0..4, -1 unknown |
AirplaneMode | b | |
Ringing | b | find-my-phone in progress |
LastClipboard | s | last text received from the phone ("" if none) |
Methods
SetDnd(s filter)RingPhone(b start)SendClipboard(s text)— called by the GTK app on every desktop clipboard change (and by the daemon’s X11 poller while the app is closed).
Signals
ClipboardReceived(s text)— the GTK app sets the desktop clipboard; when the app is not on the bus the daemon sets it itself withwl-copy/xclip(ADR-0013 amendment).ShareReceived(s text, s url, b open)
org.tether.Device1 — files (files)
Methods
SendFiles(as paths) -> (s transfer_id)CancelTransfer(s transfer_id)GetTransfers() -> (aa{sv})— active and recently finished (last 20).
Signals
TransferUpdated(a{sv} transfer)FileReceived(s path)— one per completed incoming file.
Transfer dict: transfer_id s, direction s (in|out), files aa{sv} (name s, size t, mime s, bytes_done t, path s, state s), bytes_done t, bytes_total t, state s (offered|accepted|running|done|failed|cancelled|rejected), error s, started_ms t.
org.tether.Device1 — photos (photos)
Methods
GetMediaItems(s kind, u limit, t before_ms, s album) -> (aa{sv}, b more)—kind∈all|image|video|screenshot; served from the daemon’s index, which it fills from the phone on demand (first call triggers aMediaQuery, result arrives viaMediaItemsChanged).before_msis inclusive (as on the wire, so items sharing a boundary timestamp are never skipped): when paging with the last item’sdate_ms, the next page starts with that item again and clients de-duplicate byid.RequestThumbnail(s id, u max_px) -> (s path)— cached path or""+ laterThumbnailReady.FetchMedia(s id) -> (s request_id)— downloads the original into the daemon cache;MediaFetchedcarries the path. Clients copy it where the user wants (drag-out, Save as).DeleteMedia(as ids) -> (s request_id)GetAlbums() -> (as)
Signals
MediaItemsChanged()— index refreshed; clients re-query.ThumbnailReady(s id, s path)MediaFetched(s request_id, s id, s path)—pathempty on failure.MediaDeleted(s request_id, as deleted, as failed, b needs_confirmation)
Media item dict: id s, name s, mime s, date_ms t, size t, width u, height u, duration_ms t, album s, kind s, orientation u, thumb_path s (cached or "").
Files (M2)
- Per-device cache:
$XDG_DATA_HOME/tether/devices/<id>/cache.db(SQLite: threads, messages, attachments index, contacts, media index, transfers) and$XDG_CACHE_HOME/tether/devices/<id>/{attachments,thumbs,media,contacts}/. - Received files:
DownloadDir(default~/Downloads/Tether/). - Config additions in
config.toml:download_dir,auto_accept_files,clipboard_sync,message_notifications, per-devicesync_messages,sync_contacts,sync_photos(all default true).
Milestone 4 additions (enhanced tier)
Design: ADR-0016 (adb), ADR-0017 (helper), ADR-0018 (media). Wire protocol:
docs/reference/protocol.md “Enhanced tier”.
org.tether.Daemon1
| Member | Kind | Signature | Meaning |
|---|---|---|---|
AdbState | property | s | missing (no adb binary), too_old (< 34.0.0), ready |
AdbVersion | property | s | e.g. 34.0.4, empty when missing |
StartAdbPairing() | method | → (ss) | begins Wireless debugging pairing; returns the QR payload (WIFI:T:ADB;S:…;P:…;;) and the service name. Progress in AdbPairingChanged |
PairAdbWithCode(s code) | method | fallback: pair with the 6-digit code against the pairing service the phone currently advertises | |
CancelAdbPairing() | method | ||
AdbPairingChanged(s stage, s detail) | signal | waiting (for the phone to scan or show a code), pairing, connecting, linking, done, failed (detail = reason) |
Config keys: adb_server = "private" | "shared", adb_path (empty = search
PATH), per-device adb_serial.
org.tether.Device1
| Member | Kind | Signature | Meaning |
|---|---|---|---|
EnhancedState | property | s | unavailable (adb missing or too old), not_set_up (no adb device linked), debugging_off (linked, Wireless debugging off and no USB), offline (linked, device not reachable), unauthorized, starting (helper launching), ready, error |
EnhancedDetail | property | s | human-readable reason for error, unauthorized, debugging_off |
EnhancedAbilities | property | as | ShellHello.abilities while ready |
AdbSerial | property | s | linked adb serial, empty if none |
AdbTransport | property | s | usb, wifi or empty |
CanRearmAdb | property | b | the app can switch Wireless debugging on (AdbWifiState.can_change) |
Mirrors | property | aa{sv} | running mirrors: id, kind (main/app), package, screen_off |
SetUpEnhanced() | method | link an adb device that is already connected and authorised (USB, or Wi-Fi after pairing) to this phone and start the helper | |
RestartHelper() | method | ||
EnableWirelessDebugging() | method | AdbWifiRequest{enable = true}; fails unless CanRearmAdb | |
StartMirror(a{sv} options) | method | → (sh) | mirror id and the mirror connection as a Unix fd (shell.proto MIRROR framing, first record is MirrorMeta). Options: screen_off b, stay_awake b (default true), show_touches b, max_size u, max_fps u, bitrate u, codec s (h264) |
ConfigureMirror(s id, a{sv} options) | method | screen_off b, bitrate u, max_size u, request_keyframe b | |
StopMirror(s id) | method | closing the fd has the same effect | |
MirrorEnded(s id, s reason) | signal | ||
GetGrants() | method | → a(sbs) | name, granted, detail for every grant item |
ApplyGrants(as items) | method | → a(sbs) | empty list = all |
SetScreenPower(b on) | method |
M4.2 members of org.tether.Device1:
| Member | Kind | Signature | Meaning |
|---|---|---|---|
GetApps() | method | → aa{sv} | launchable apps from the phone: package s, label s, icon s (cached PNG path, empty until fetched), system b. Needs capability apps, not adb. The daemon caches the list per device and serves the cache while the phone is away |
AppsChanged() | signal | the list or an icon path changed; call GetApps() again | |
StartMirror options | additionally app s (package: open this app in its own virtual display), width u, height u, dpi u (size of that display; defaults 1080 x 1920, dpi from the phone). screen_off is ignored for app mirrors | ||
ConfigureMirror options | additionally width u, height u (resize an app mirror’s display) | ||
Mirrors entries | kind = app and package for app mirrors; display_id u | ||
StartApp(s package) | method | launch an app on the phone’s main display | |
PhoneAudio | property | b, read/write | play the phone’s audio on this PC. Stays requested across helper restarts; capture runs while EnhancedState = ready |
PhoneAudioState | property | s | off, starting, playing, unsupported, error |
PhoneAudioDetail | property | s | reason for error/unsupported; while playing, the source in use (output, playback, playback_dup) |
Config: phone_audio_source = "auto" | "output" | "playback" | "playback_dup"
(default auto: the first the helper supports in that order), per-device
phone_audio (remembers the switch).
tether-cli: apps <id>, app <id> <package> (opens the app window in the
GTK app: tether --app <device id> <package>), phone-audio <id> [on|off].
Implementation notes (M4.2, tetherd):
- Apps.
GetAppsserves the phone’s order fromcache.db(schema v3, tableapps) and works while the phone is away. Icons are fetched eight at a time;AppsChangedfires on a new list and again as icons arrive.iconcan go empty again if the blob cache evicts the file. - App mirrors.
appneeds abilitydisplay.new. Defaults 1080 x 1920, dpi 0 (the phone derives it; the GTK app always sends 160 x its scale factor).width/height/dpiwithoutappand a resize with only one ofwidth/heightanswerInvalidArgs.Mirrors[].display_idis 0: the id is only inMirrorMeta, which the daemon does not read. Up to eight mirrors per phone; starting a package that is already streamed moves it and ends the old mirror withapp_closed. StartAppneedsapps.start; an unknown package answersInvalidArgs.- Phone audio. The setter returns at once. With the switch on and
nothing capturing, the state is
offwith a reason in the detail (“Waiting for the enhanced tier…”, “Paused while a call is in progress”). Capture stops while any call exists on the phone, ringing included.unsupported: built without theaudiofeature, noaudio.*ability, or the configured source is unavailable. After a failure the daemon retries three times, 3 s apart, then showserroruntil the switch is toggled or the helper becomes ready again. Withautothe daemon picks the source from the abilities. Pipeline:appsrc ! opusdec ! audioconvert ! audioresample ! pulsesink(40 ms buffer;pipewiresink, thenautoaudiosinkas fallbacks), stream namedTether: <phone name>. - CLI.
apps <id> [--system];appandmirrorstart thetetherbinary next totether-cliif there is one, else the one onPATH(TETHER_APPoverrides).
M4.3 members (phone as webcam, ADR-0019).
org.tether.Daemon1 (the machine’s virtual camera device):
| Member | Kind | Signature | Meaning |
|---|---|---|---|
WebcamSetupState | property | s | unsupported (built without the webcam feature or no v4l2sink), not_installed (no v4l2loopback module for the running kernel), not_loaded, no_device (module loaded, no device labelled Tether Phone Camera and no usable webcam_device), ready |
WebcamSetupDetail | property | s | human-readable reason or next step (e.g. the install command, a Secure Boot key rejection, the last set-up error) |
WebcamDevice | property | s | device node in use, e.g. /dev/video42; empty unless ready |
WebcamPersistent | property | b | the load-at-boot files written by persist exist |
WebcamOwner | property | s | device id of the phone whose Webcam switch is on, or empty |
SetUpWebcam(s action) | method | load (create the device now), persist (load and create it at every boot), remove (delete the boot files; the loaded module stays until reboot). Runs /usr/libexec/tether/tether-webcam-setup <action> through pkexec; returns when it has finished. Errors: NotSupported, InvalidArgs, Failed (detail = the script’s last line; cancelled when the polkit prompt was dismissed) | |
RefreshWebcamSetup() | method | read the state again (after the user installed the package) |
org.tether.Device1:
| Member | Kind | Signature | Meaning |
|---|---|---|---|
Webcam | property | b, read/write | use this phone’s camera as the PC’s webcam. Stays requested across helper restarts; the camera runs while EnhancedState = ready and WebcamSetupState = ready. Setting it while another phone owns the webcam fails with Failed (busy) |
WebcamState | property | s | off, starting, streaming, unsupported, error |
WebcamDetail | property | s | reason for error/unsupported, or why the switch is on but nothing is streaming (e.g. “Waiting for the enhanced tier…”, “Set up the virtual camera first”, “The camera is in use on the phone”) |
WebcamInfo | property | a{sv} | while streaming: camera s (Camera2 id), facing s (front/back/external), width u, height u, fps u (what the phone sends), out_width u, out_height u, out_fps u (the V4L2 device format), decoder s |
Cameras | property | aa{sv} | the phone’s cameras while EnhancedState = ready (cached afterwards): id s, facing s, sensor_orientation u, sizes a(uu), fps au, torch b, max_zoom d |
WebcamSettings | property | a{sv} | camera s (front, back or a Camera2 id; default back), rotation u (0, 90, 180, 270 clockwise; default 0), flip b (mirror horizontally; default false), torch b, zoom d (1.0 = none). Stored per device, except torch, which is off at every start |
ConfigureWebcam(a{sv} settings) | method | change any of the WebcamSettings keys; applies to a running webcam at once (a camera change restarts the capture, the V4L2 device stays open) |
Config: webcam_size = "1280x720" (also 640x480, 1920x1080),
webcam_fps = 30, webcam_device (empty = the loopback device labelled
Tether Phone Camera); per-device webcam, webcam_camera,
webcam_rotation, webcam_flip, webcam_zoom.
tether-cli: webcam <id> [status|on|off|cameras|camera <front|back|id>|rotate <0|90|180|270>|flip <on|off>|torch <on|off>|zoom <x>],
webcam-setup [status|load|persist|remove].
Daemon behaviour: the capture is asked for at the listed camera size closest
to the output size. The output format never changes while the daemon holds
the device; the picture is letterboxed into it. After a failure the daemon
retries three times, 3 s apart, then shows error until the switch is
toggled or the helper becomes ready again; camera_disabled is not retried.
The webcam keeps running during calls.
Implementation notes (M4.3, tetherd):
- A dismissed polkit prompt fails with the message
cancelled.persistis safe to repeat and refuses when another modprobe.d file already sets options forv4l2loopback. UnderNoNewPrivilegesthe daemon runspkexecthroughsystemd-run --user. webcam_deviceis accepted only for a virtual video device.Webcam = trueis accepted before the set-up isreadyand triggers a new detection.WebcamOwneris the first paired device with the switch on.- Three retries (four attempts); the budget resets after 30 s of streaming,
on a toggle, on a camera change and on a new helper.
camera_disabledandnot_foundare not retried. torchis reset when the switch is written, not at every capture start.rotationis applied as given; the sensor orientation is not added.Camerasis cached per device (cameras.json) and refreshed from every new helper.TETHER_WEBCAM_SETUPoverrides the script path (build tree).
The daemon starts the helper whenever a linked device is authorised and the
phone is connected over Tether, restarts it with back-off when it exits, and
turns ClipboardWatch on while clipboard sync from the phone is enabled.
All methods that need the helper fail with org.tether.Error.NotReady unless
EnhancedState = ready.
tether-cli: enhance <id> [status|setup|pair|code <code>|grants [apply]|restart|rearm],
mirror <id> [--screen-off] (opens the app’s mirror window; refuses unless
the state is ready).
Implementation notes and deviations (M4.1, tetherd)
- Errors. M4 members answer
org.tether.Error.NotReady,NotSupported(adb missing or too old, ability missing, helper answeredunsupported,EnableWirelessDebuggingwithoutCanRearmAdb),InvalidArgs(bad option type, unknown codec or mirror id, code not six digits) orFailed. AdbSerialis the phone’s hardware serial (ro.serialno), stored as per-deviceadb_serial. Wi-Fi transport serials (ip:port) change and are mapped to it through the mDNS instance name orgetprop.- Two adb servers in private mode. The private server (port
adb_server_port, default 5038) carries Wi-Fi connections only. A phone attached by USB is reached through the user’s default server and key; the daemon watches that server and starts it only onSetUpEnhanced()or when a device has anadb_serial. USB is preferred when a transport is chosen; a running helper is not moved when a cable is plugged in later. AdbPairingChangeddetails.pairing=ip:port,connecting= guid,linking= hardware serial,done= the Tether device id that was linked,failed= reason (cancelledafterCancelAdbPairing).PairAdbWithCodereturns at once, starts a session if none runs and waits up to 20 s for the phone to advertise a pairing service. A session times out after 5 minutes;StartAdbPairingreplaces a running one.SetUpEnhancedneeds the phone connected over Tether, waits up to 10 s forAdbLink, and only refreshes when the linked serial is already authorised.EnhancedState.offlinealso covers “adb is fine but the phone is not connected over Tether”;erroralso covers USBno permissionsand stays shown while a failed helper start is retried;unauthorizedis also set whenadb connectfails to authenticate.- Helper. Hello timeout 20 s, request timeout 15 s, restart back-off 1 s
to 60 s (reset after 30 s of
ready). Its stderr is logged at debug level. StartMirrorhands the fd over in blocking mode;screen_offis dropped when the helper lacksmirror.screen_off. One mirror per phone in M4.1 (busy→Failed).StopMirroremitsMirrorEnded(id, "stopped")at once; a helper that goes away ends its mirrors withhelper_exited.- Re-arm. After
ApplyGrantsgrantswrite_secure_settingsthe daemon asks the app to report again, soCanRearmAdbupdates. An automaticEnableWirelessDebuggingis tried exactly once per Tether session when the state isdebugging_off. One UI switches the setting straight back off when the current Wi-Fi network was not allowed for Wireless debugging by the user (“Always allow on this network”), so the re-arm only works on such networks. - Connect port. Wireless debugging keeps its mDNS instance name and
changes its port on every toggle, which a browse does not report. The
daemon resolves the instance again before every
adb connect, and retries for 20 s after pairing. - Clipboard.
ShellClipboardequal to the last text sent to the phone or toLastClipboardis dropped as an echo. - The daemon always announces
enhance, also without adb.
Milestone 3 additions (calls)
org.tether.Device1 — calls (calls, calls.dial, calllog, bluetooth)
Properties
| Name | Type | Meaning |
|---|---|---|
Calls | aa{sv} | current calls (call dict below); empty when idle |
CanControlCalls | b | phone can answer/reject/hang up |
CanDial | b | phone can place calls |
BtAddress | s | the phone’s BlueZ address if known ("" otherwise) |
BtState | s | unavailable (no adapter/BlueZ), off (adapter powered off or rfkill), unpaired, paired (bonded, HFP not connected), connected (HFP connected, PC is hands-free) |
CallAudio | s | where call audio currently plays: phone, pc, none |
MissedCalls | u | unseen missed calls (desktop-local) |
Methods
AnswerCall(s call_id),RejectCall(s call_id),HangUpCall(s call_id),SilenceCall(s call_id)Dial(s number, i sub_id) -> (s request_id)SetCallMuted(s call_id, b muted)SetCallAudio(s call_id, s target)—target∈pc|phone|speaker;pcasks the phone to route to this PC over Bluetooth;phoneandspeakerroute back to the phone (see “SetCallAudio” below).GetCallLog(t before_ms, u limit) -> (aa{sv})— newest first;before_ms = 0= newest.MarkCallsSeen()— clearsMissedCalls.PairBluetooth()— starts the guided Bluetooth pairing (power on adapter if allowed, discover the phone, pair, trust, connect HFP). Progress viaBtStateandBluetoothPairing.ConnectBluetooth()/DisconnectBluetooth()
Signals
CallStateChanged(aa{sv} calls)— also reflected inCallsvia PropertiesChanged.CallCommandFailed(s request_id, s error)IncomingCall(a{sv} call)— emitted once per ringing call (the GTK app shows its banner).CallLogChanged()BluetoothPairing(s stage, s detail)—stage∈powering|discovering|pairing|confirm|connecting|done|failed; atconfirm,detailis the 6-digit passkey to compare.
Call dict: id s, number s, display_name s, photo_path s, status s (ringing|dialing|active|holding|ended), direction s (incoming|outgoing), start_ms t, connected_ms t, sub_id i, muted b, route s (phone|speaker|bluetooth), audio_on_pc b.
Call log dict: id s, number s, name s (contact name, falls back to the log’s cached name), photo_path s, type s (incoming|outgoing|missed|rejected|blocked|voicemail), date_ms t, duration_s u, sub_id i, new b.
Daemon behaviour during calls
- On
IncomingCallthe daemon posts a freedesktop notification with Answer and Decline actions (urgency critical, categorycall.incoming) and plays the ringtone (/usr/share/sounds/freedesktop/stereo/phone-incoming-call.ogathrough PipeWire) unless the phone is silenced or a desktop DND is active; both stop when the call leavesringing. - MPRIS players on the desktop (other than Tether’s own) are paused on
ringingand resumed when all calls ended, if they were playing before. - Call audio on the PC plays on the default sink and records from the default source (see “Call audio” below); the defaults are not changed.
- Missed calls post a notification (“Missed call from …”) with Call back.
Daemon properties
| Name | Type | Access | Meaning |
|---|---|---|---|
CallAudioOnPc | b | read/write | route call audio to the PC automatically on answer (default true when BtState = connected) |
CallRingtone | b | read/write | play a ringtone on the PC for incoming calls (default true) |
PauseMediaOnCall | b | read/write | pause desktop MPRIS players while ringing/in call (default true) |
Implementation notes and deviations (M3, tetherd)
These describe how the daemon implements the contract above; where they differ from the text above, this section wins.
- Empty
call_id.AnswerCall,RejectCall,SilenceCallwith""act on the ringing call;HangUpCall,SetCallMuted,SetCallAudioon the first non-ringing call. With no matching call the method fails (no call in progress). - Command results. Every call method sends a
CallCommandwith a fresh request id (onlyDialreturns it). ACallCommandResult{ok = false}, no result within 15 s, or a disconnect emitsCallCommandFailed(request_id, error). A failure of an action taken on a desktop notification (Answer / Decline / Call back) is reported with an emptyrequest_id. CallStateChangedvsCalls. The signal carries the phone’s list as sent, so a call that ended appears once withstatus = "ended". TheCallsproperty never contains ended calls (empty when idle).GetCallLog(before_ms, …).before_msis exclusive here, likeGetMessages: page with the last row’sdate_ms. The wire-levelCallLogRequest.before_msstays inclusive, and the daemon de-duplicates by id.MissedCallscounts cached log entries withtype = missed, the phone’snewflag set anddate_msafter the desktop’s seen mark.MarkCallsSeen()moves the mark to max(now, newest entry). It never changes the phone’s call log.- Call audio. The phone decides where a call’s audio goes by opening or
closing the Bluetooth SCO link to this PC. PipeWire creates the phone’s HFP
nodes only while that link is up, as streams (
Stream/Output/Audiofor the caller,Stream/Input/Audiofor our microphone,media.role = Communication), and WirePlumber links them to the default sink/source.CallAudio = pcmeans those nodes exist; the daemon checks once a second while a call is live, so the property also follows a switch made on the phone. 2.5 s after the nodes appear the daemon adds any link that is still missing between them and the default sink/source (pw-link, port by port) and never touches a direction the session manager linked elsewhere (for example to a headset). It does not change the default sink/source. If the phone’s card is not on a call profile (audio-gateway, fallbackheadset-head-unit) the daemon selects it and restores the previous one when the calls end.CallAudio = phonewhile a call exists without the nodes,nonewithout a call. - Echo cancellation. When the call uses the default sink and source (the
PC’s speakers and microphone, not a headset), the daemon runs PipeWire’s
module-echo-cancel(WebRTC, monitor mode) in a childpipewire -cprocess for the duration of the calls. It records the default source, uses the default sink’s monitor as reference and offers the sourcetether_call_mic; the phone’s HFP microphone node is pointed at it (pw-metadata … target.object). The caller’s voice keeps playing on the default sink. Otherwise the caller hears their own voice and the phone’s echo suppressor cuts the PC side. Config keycall_echo_cancel(default true). SetCallAudio. SendsROUTEto the phone.pcalso needsBtState = connected; withCallAudioOnPcthe daemon sendsROUTE bluetoothonce per call by itself when the phone did not pick the PC. If the phone refuses (route_unsupported: its in-call service is not bound, see docs/contributing/checklists/milestone-3.md),phoneis still carried out from the PC by closing the SCO link (the phone card is switched off for a moment, then back), whilespeakerandpcfail withCallCommandFailedand a readable reason: the PC cannot open the SCO link itself.BtState.unavailable: no system bus, noorg.bluezor no adapter.off: adapter not powered, whatever the reason (rfkill included).connected: the matched BlueZ device is bonded and connected, and the phone reportshfp_connected(when it sendsBtIdentity). The phone is matched by the remembered address (per-devicebt_addressinconfig.toml, saved once bonded), then byName/Aliasequal to the phone’sBtIdentity.nameor Tether name, preferring bonded devices.bluetoothis announced inHelloonly whenorg.bluezowns or can activate its name at daemon start.PairBluetooth. Runs in the background, one pairing at a time. Stagespowering(only when the adapter is off; if BlueZ refuses,failed“Bluetooth is blocked (rfkill)”; the daemon never touches rfkill),discovering(skipped when the phone is already bonded; up to 60 s, afterBtRequest{PAIR}),pairing(detail = address; anorg.bluez.Agent1withDisplayYesNois registered at/org/tether/BluezAgentfor this pairing only),confirm(6-digit passkey, auto-accepted on the PC for the matched phone only; the user confirms on the phone),connecting(Trusted = true,Device1.Connect(), thenBtRequest{CONNECT}),done(detail = address),failed(detail = reason). It fails at once without BlueZ.- Notifications. The incoming-call notification is keyed per call
(
call:<id>, replaces itself) with hintsurgency = 2,category = call.incoming,resident,suppress-sound, and is closed when the call leavesringing. Missed calls (incoming, ringing → ended without becoming active, not declined from this desktop) getcategory = call.unansweredand a Call back action when the number is known. Both honourShowDesktopNotifications. Whilecallsis active, mirrored phone notifications withcategory = "call"(the dialer’s own) are not posted, but theNotificationPostedsignal is still emitted. Desktop DND is not consulted for the ringtone yet. - Ringtone and media. One ringtone for the whole desktop:
pw-play(elsepaplay) loops the sound file while any phone has a ringing call that was not silenced (SilenceCallsilences the PC too). It is skipped when neither binary nor the file exists. MPRIS players other thanorg.mpris.MediaPlayer2.tether_*that arePlayingare paused while any call exists (ringing included), and resumed afterwards only if they are stillPaused. - Files.
cache.dbschema v2 addscall_log(id, number, name, type, date_ms, duration_s, sub_id, is_new).config.tomlgainscall_audio_on_pc,call_echo_cancel,call_ringtone,pause_media_on_call(all default true) and per-devicebt_address.
Tether wire protocol v1
Status: normative for Milestones 1–3. Changes require an ADR and a bump of
protocol_version only when incompatible. Milestone 2 additions are purely
additive (new Envelope fields 13 and 70–127, new capabilities); a v1 peer
that lacks a capability never receives the corresponding frames.
Transport
- TCP, fixed port 7360 on both desktop and phone. Both sides listen; either may dial.
- TLS 1.3 only, ALPN
tether/1, mutual certificates. Certificates are self-signed ECDSA P-256 (SHA-256 signature). Validity is irrelevant: verifiers never check dates, names or chains, only the public key. - Device id = lowercase hex SHA-256 of the DER
SubjectPublicKeyInfoof the leaf certificate (64 chars). On Android this isSHA-256(cert.publicKey.encoded). - Verification rules (identical on both sides):
- Peer presents exactly one certificate. Compute
fp. - If any trusted device record has
id == fp→ session is paired with that device. - Else accept the connection as unpaired (TOFU). Unpaired sessions may only
exchange
Hello,Ping/Pong,PairRequest,PairResponse,PairConfirm,PairReject,Unpair. Anything else is ignored and answered with oneUnpair(see “Stale trust” below). - The
Hello.device_idMUST equalfp; otherwise close.
- Peer presents exactly one certificate. Compute
- If two connections to the same peer exist, the one dialled by the device with
the lexicographically smaller device id is kept; the other is closed quietly
after its
Hellois seen. - Framing:
u32big-endian length (≤ 4 MiB) + protobuftether.v1.Envelope.seqstarts at 1 and increases by 1 per sent frame; receivers only log gaps. - Keepalive: send
Pingevery 15 s when idle; drop the connection if nothing (any frame) is received for 45 s. Reconnect with exponential backoff 1 s → 60 s. - Secondary connections: for bulk data, the sender opens another TLS connection to
the same peer (same verification), sends one frame
StreamOpen{purpose, ref_id, index, size}and then raw bytes untilsizebytes are sent or the stream is closed. The receiver mapsref_idto a pending transfer. (Not used in M1 except for blobs > 256 KiB, which M1 never produces.)
Discovery
- mDNS/DNS-SD service
_tether._tcp.local, port 7360, TXT recordsid=<device_id>,name=<name>,kind=desktop|phone|tablet,pv=1. Linux publishes/browses via Avahi D-Bus; Android viaNsdManager. - UDP beacon: protobuf
Beaconsent to255.255.255.255:7360and to the subnet broadcast every 5 s while discoverable (desktop: always while running; phone: while the app is in the foreground or for 60 s after wake). Receivers treat beacons as hints and dial the sender’s TCP port. - Manual: user enters
host[:port]; QR carries addresses (below).
Pairing
Pairing runs on an unpaired session. The initiator is whichever side the user tapped first; both flows are symmetric after the first message.
- Initiator sends
PairRequest{nonce = 32 random bytes, qr_proof?}. - Responder replies at once with
PairResponse{nonce = 32 random bytes, qr_accepted}. - Both compute the SAS:
where(fp_lo, nonce_lo), (fp_hi, nonce_hi) = sort the two (device_id, nonce) pairs by device_id (ASCII) digest = SHA-256( "tether-sas-v1" || fp_lo || fp_hi || nonce_lo || nonce_hi ) sas = (first 4 bytes of digest as u32 big-endian) mod 1_000_000, zero-padded to 6 digitsfp_*are the 64-char ASCII hex strings andnonce_*the raw 32 bytes. - Each side shows
sasand the peer name; the user confirms on both devices. On confirm a side sendsPairConfirm; on reject or 60 s timeout,PairReject{reason}. - The devices are paired when a side has both sent and received
PairConfirm. It then persists{device_id, name, kind, certificate DER}as trusted. Unpairfrom either side removes the record; the receiver removes its record too.
Stale trust
Trust can become asymmetric (one side unpaired while the other was offline). Rules:
- A side that receives a restricted frame (anything other than
Hello,Ping,Pong,Pair*) on an unpaired session MUST reply withUnpaironce and MUST ignore further restricted frames on that session. It SHOULD keep the connection open so the user can re-pair over it. - A device that removes a pairing while the peer is unreachable MUST send
Unpairon the next session with that peer. - A device whose session dies right after
HelloMUST apply reconnect backoff (1 s → 60 s); discovery hints do not bypass that backoff.
QR fast path
The desktop renders tether://pair?v=1&id=<device_id>&n=<url-encoded name>&a=<ip:port>&a=<ip2:port>&s=<base64url 16-byte secret>.
The secret is single-use and valid for 5 minutes. The phone connects to the first
reachable address, and sends PairRequest{nonce, qr_proof = HMAC-SHA256(key = secret, msg = ASCII phone device_id)}.
If the proof is valid the desktop replies PairResponse{nonce, qr_accepted = true}
and immediately PairConfirm; the phone, having scanned the QR, auto-sends
PairConfirm when qr_accepted is true. No SAS prompt is shown on either side.
Invalid proof → PairReject{reason = "mismatch"}.
Test vectors
fp1 = 5b7ad2d123b4cbc97dddc13b75f67df2f68a9150930c9476d059ea53e9b0c915
fp2 = ad75ecdda3a53bf1323b6f6ab6c3ba3c74acf0effb7fc6402e521ab36868a837
nonce1 = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f (belongs to fp1)
nonce2 = 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f (belongs to fp2)
SAS = 754516
fp_a = 00 * 32 (hex "000…0"), fp_b = ff * 32 (hex "fff…f"), both nonces = 32 zero bytes
SAS = 246492
qr_secret (16 bytes) = 000102030405060708090a0b0c0d0e0f
qr_proof for requester fp2 = 9c62474aca6bd1420e62c94879ee5cb6a2c8fd7ac73d6c451d0c30f5b7596565
Session flow after pairing
Helloboth ways (capabilities exchanged).- Phone sends
DeviceInfoandBatteryimmediately, thenBatteryon change (level change or charging state change). - Phone sends
NotificationPostedfor every currently active notification (filtered, see below) and then live updates;NotificationRemovedon removal. - Desktop requests icons by
BlobRequest{hash}; phone answersBlob. Desktop caches by hash. - Desktop sends
NotificationActionRequest/NotificationDismiss; phone acts and the resulting removal flows back asNotificationRemoved.
Notification filtering on the phone
Skip: the phone app’s own notifications, group summaries, FLAG_ONGOING_EVENT
foreground-service notifications unless the user opted in, media transport
notifications (CATEGORY_TRANSPORT, handled by the media feature later),
notifications from packages in the user’s blocklist. Everything else is sent,
including silent ones (flagged silent).
Capabilities
A feature is active only when both sides list the required capability.
| Capability | Since | Frames it enables |
|---|---|---|
battery | M1 | Battery |
deviceinfo | M1 | DeviceInfo |
notifications | M1 | NotificationPosted/Removed, NotificationActionRequest, NotificationDismiss |
notifications.reply | M1 | remote-input actions |
blobs | M1 | BlobRequest/Blob (icons, album art) |
disconnect | M2 | Disconnect (hold semantics, see below) |
streams | M2 | secondary stream connections (StreamOpen), TransferProgress, TransferCancel |
messages | M2 | conversations/messages sync, SendMessage (SMS) |
messages.mms | M2 | attachments in Message, AttachmentRequest, MMS send |
contacts | M2 | ContactsRequest/Delta/Changed |
media | M2 | MediaSessions, MediaCommand |
volume | M2 | PhoneVolume, SetPhoneVolume |
dnd | M2 | DndState, SetDnd |
ring | M2 | RingPhone |
connectivity | M2 | Connectivity |
clipboard | M2 | Clipboard, ShareText |
files | M2 | FileOffer, FileAccept (requires streams) |
photos | M2 | MediaQuery/Items, ThumbnailRequest/Thumbnail, MediaFetch, MediaDelete, MediaChanged |
calls | M3 | CallState, CallCommand (answer/reject/hang up/mute/route/silence), CallCommandResult |
calls.dial | M3 | CallCommand{DIAL} |
calllog | M3 | CallLogRequest, CallLog, CallLogChanged |
bluetooth | M3 | BtIdentity, BtRequest |
enhance | M4 | AdbLink, AdbWifiState, AdbWifiRequest (see “Enhanced tier”) |
apps | M4.2 | AppListRequest, AppList, AppListChanged (icons need blobs) |
The phone advertises a capability only when it holds the permission the feature
needs (e.g. messages requires READ_SMS); it re-sends nothing when a
permission is granted later — the next connection carries the new list, and the
desktop treats Hello.capabilities as the source of truth per session.
Intentional disconnect and hold (M2, ADR-0012)
A user-initiated “Disconnect” on either side sends Disconnect{hold_seconds, reason} on the control connection and then closes it. Rules:
- The sender stops auto-reconnecting to that peer (holds) for
hold_seconds;0means until the local user presses Connect, pairs again, or the peer dials in. The sender still accepts inbound connections from the peer. - The receiver, on
Disconnect, also holds for the same duration: it MUST NOT dial the peer (reconnect loop and discovery hints both pause) until the hold expires, the local user acts, or the peer dials in. A held device remains paired; nothing is persisted — a process restart clears the hold. Disconnectis a restricted frame (paired sessions only). A peer that does not announcedisconnectis simply closed; the other side then applies the pre-M2 behaviour (60 s backoff).reason = "shutdown"is sent by a daemon or app that is exiting; receivers SHOULD treat it ashold_seconds = 0but resume dialling as soon as discovery sees the peer again (shutdown is not a user intent to stay apart).
Secondary streams (M2, ADR-0014)
Bulk bytes never travel on the control connection. The side that has the
bytes dials a new TLS connection to the peer (same certificates, same
verification; the peer MUST be paired, otherwise the connection is closed at
once) and sends exactly one framed Envelope{StreamOpen{purpose, ref_id, index, size, name, mime}} — no Hello. Then it writes exactly size raw bytes and
half-closes (shutdown(SHUT_WR)). The receiver reads size bytes, closes, and
reports completion on the control connection where the feature defines it.
ref_idties the stream to a control-connection request: atransfer_id(FileOffer), or arequest_id(SendMessage,AttachmentRequest,MediaFetch). Ids are random strings (UUID v4 recommended) chosen by the side that created the request. The receiver maps(peer, ref_id, index)to a pending transfer.- Ordering: the control frame and the stream travel on different TCP
connections and may arrive in either order. A receiver MUST hold a stream
whose
ref_idis unknown for up to 10 s waiting for the control frame, then close it. Receivers MUST reject a stream whosesizeexceeds the size announced in the control frame. - At most 4 concurrent streams per peer; senders queue beyond that.
- Flow control and completion are TCP’s;
TransferProgress{ref_id, index, bytes}is sent by the receiver at most every 500 ms per stream for UI only. - Cancellation: either side closes the stream connection and SHOULD send
TransferCancel{ref_id, index, reason}on the control connection;index = 0xFFFFFFFFcancels the whole transfer. A side that cannot provide a requested stream (file vanished, permission missing) sendsTransferCancelwithreason = "not_found"or"error:<text>"instead of opening a stream. - Received files are written to a temporary name in the destination directory
and renamed on completion; partial files are deleted on cancel. Names from the
wire are sanitised to a base name (no path separators, no leading dot, no
control characters) and made unique (
name (2).ext). - The stream dialler uses the peer’s control-connection address; the desktop listens on 7360, the phone listens on 7360 while its service runs.
Purposes: FILE (file transfer), ATTACHMENT (MMS part), MEDIA (gallery
item), BLOB (reserved for > 256 KiB blobs, unused), VIDEO/AUDIO (M4).
Feature flows (M2)
All requests below are desktop → phone unless stated. Pushes are phone → desktop and happen on connect (snapshot) and on change.
Messages (messages, messages.mms)
- On connect the desktop sends
ConversationsRequest{since_ms}with the newestdate_msin its cache (0 on first sync). The phone answers oneConversationList{threads, complete}. - The desktop pages threads it does not have with
MessagesRequest{request_id, thread_id, before_ms, limit ≤ 200}→Messages{request_id, thread_id, messages (newest first), more}. To catch up after being offline it sendsMessagesRequest{thread_id = "", since_ms}. - The phone pushes
MessageEvent{message, deleted}on every provider change (new inbox/sent message, status change, deletion). Pushes are best-effort; the desktop reconciles with step 1 on the next connect. - Sending:
SendMessage{request_id, addresses, body, sub_id, attachments}. Without attachments and with one address the phone sends a (multipart) SMS; otherwise an MMS. For each attachment the desktop opensStreamOpen{ATTACHMENT, ref_id = request_id, index = n, size}. The phone answersSendMessageResult{request_id, ok, error, message_id}once the platform reported the result (sent PendingIntent), orok = falsewith a reason on failure or 60 s timeout. AttachmentRequest{request_id, part_id}→ the phone opensStreamOpen{ATTACHMENT, ref_id = request_id, index = 0, size, name, mime}or sendsTransferCancel{reason = "not_found"}.- Read state and deletion are desktop-local (ADR-0011).
Contacts (contacts)
ContactsRequest{known[{uid, version}]} → one or more
ContactsDelta{upserts[{uid, version, vcard}], deleted[], complete} frames (≤ 2
MiB each; deleted and complete = true on the last). The phone pushes
ContactsChanged{} (throttled to one per 5 s) when the provider changes; the
desktop re-requests. vCard 3.0 with FN, N, TEL;TYPE=…, EMAIL,
PHOTO;ENCODING=b;TYPE=JPEG (≤ 256 px), X-TETHER-STARRED:1 for favourites.
Media sessions and volume (media, volume)
Phone pushes MediaSessions{sessions} (first = active) on connect and on
change, throttled to 2/s; position is position_ms at phone time
position_ts_ms and the desktop extrapolates with playback_speed. Album art
is fetched by BlobRequest{art_hash} (JPEG or PNG, Blob.mime says which).
MediaCommand{session_id, action, position_ms}; SEEK uses position_ms.
PhoneVolume{streams} pushed on connect/change; SetPhoneVolume{stream, level}.
DND, ring, connectivity (dnd, ring, connectivity)
DndState{filter, can_change} pushed on connect/change; SetDnd{filter} is
ignored (and the phone re-pushes the current state) while can_change is false.
RingPhone{start}: the phone rings at maximum alarm volume with vibration and
shows a full-screen activity with a Stop button regardless of silent mode or
DND; the phone stops after 60 s or on RingPhone{start = false}.
Connectivity{sims, wifi_ssid, wifi_level, airplane_mode} pushed on connect
and on change (throttled to one per 10 s).
Clipboard and share (clipboard)
Clipboard{text, ts_ms} in either direction; the receiver replaces its
clipboard and MUST NOT echo it back. Text is capped at 1 MiB. ShareText{text, url, open} phone → desktop from the Android share sheet.
Files (files)
FileOffer{transfer_id, files} → FileAccept{transfer_id, accepted, reason}.
Receivers auto-accept offers from paired devices unless the user disabled it
(then the UI asks). After acceptance the sender opens one FILE stream per
file, index = position in files. The receiver stores into its downloads
directory (~/Downloads/Tether/ on Linux, Downloads/Tether/ via MediaStore
on Android) and the sender’s UI tracks TransferProgress. An offer that is not
answered within 60 s is cancelled by the sender.
Photos (photos)
MediaQuery{request_id, kind, limit ≤ 500, before_ms, album} →
MediaItems{request_id, items (newest first), more}. before_ms is inclusive
(date_ms <= before_ms) so items that share the boundary timestamp are never
skipped between pages; the desktop de-duplicates items by id.
ThumbnailRequest{id, max_px} → Thumbnail{id, max_px, mime, data ≤ 256 KiB};
the desktop caches thumbnails per device and id. MediaFetch{request_id, id} →
StreamOpen{MEDIA, ref_id = request_id, size, name, mime} or TransferCancel.
MediaDelete{request_id, ids} → MediaDeleteResult{request_id, deleted, failed, needs_confirmation}; when Android requires on-phone confirmation the
phone sends a first result with needs_confirmation = true and a final one when
the user answered. MediaChanged{} pushed (throttled to one per 5 s) when
MediaStore changes.
Calls (M3, ADR-0015)
Call control uses the Tether connection; call audio uses Bluetooth HFP with the desktop as hands-free unit and the phone as audio gateway. The two are independent: without a Bluetooth link the desktop can still see, answer, reject, hang up, mute and dial, and audio stays on the phone.
Capabilities: the phone advertises calls when READ_PHONE_STATE and
ANSWER_PHONE_CALLS are granted (numbers additionally need READ_CALL_LOG),
calls.dial with CALL_PHONE, calllog with READ_CALL_LOG, bluetooth with
BLUETOOTH_CONNECT. The desktop advertises all four; it advertises bluetooth
only when BlueZ is present.
Call state
The phone pushes CallState{calls, can_control, can_dial} on connect when any
call exists, and on every change (new call, status, mute, route), at most every
200 ms. It is always the full list. A call that ends is sent once with status
ENDED and omitted afterwards. Call.id is stable for the call’s lifetime.
photo_hash refers to a contact photo fetchable with BlobRequest.
The phone pushes the state within 500 ms of RINGING so the desktop banner
appears in about a second. An incoming call on a session with no calls
capability on the desktop still produces the normal notification mirror.
Commands
CallCommand{request_id, call_id, action, number, sub_id, on, route} →
CallCommandResult{request_id, ok, error} once the platform call returned, then
the resulting CallState.
| Action | Fields | Phone implementation |
|---|---|---|
ANSWER | call_id | TelecomManager.acceptRingingCall() |
REJECT | call_id | TelecomManager.endCall() on a ringing call |
HANGUP | call_id | TelecomManager.endCall() |
DIAL | number, sub_id | TelecomManager.placeCall(tel:…) with the SIM’s PhoneAccountHandle |
MUTE | call_id, on | AudioManager.setMicrophoneMute(on) |
ROUTE | call_id, route | AudioManager.setCommunicationDevice (BLUETOOTH = the device whose address matches the desktop’s BtIdentity.mac; PHONE = earpiece; SPEAKER = speaker) |
SILENCE | call_id | TelecomManager.silenceRinger() |
In-call DTMF is not available to non-dialer apps and is not part of the protocol (documented gap, ADR-0015).
Android implementation (deviations from the table above, M3):
- When Telecom binds the phone’s
InCallService(it does once the app-opMANAGE_ONGOING_CALLSis allowed:adb shell appops set org.tether.android MANAGE_ONGOING_CALLS allow, a one-time grant that survives reboots; verified on Android 16 / One UI 8.5, wheretelecom add-or-remove-call-companion-apphas no effect), ANSWER/REJECT/HANGUP act on the addressedCall(answer,reject,disconnect), MUTE usesInCallService.setMutedand ROUTE usesInCallService.requestCallEndpointChange(BLUETOOTH prefers the endpoint named like the desktop’sBtIdentity.name). - Without the companion service, ROUTE answers
ok = false, error = "route_unsupported"(setCommunicationDeviceonly routes the app’s own audio, ADR-0015); MUTE usesAudioManager.setMicrophoneMute; HANGUP ends the foreground call whatevercall_idsays (TelecomManager.endCall). - SILENCE:
silenceRinger()needsMODIFY_PHONE_STATEor the dialer role; onSecurityExceptionthe phone mutes the ring stream if it has DND access (restored when ringing stops), elseerror = "silence_unsupported". - Fallback call state (no companion service) comes from the aggregate
IDLE/RINGING/OFFHOOK telephony state per SIM: an outgoing call is
ACTIVEwithconnected_ms= off-hook time (the far end answering is not visible), and a waiting call leaving RINGING is assumed answered. - Error strings used in
CallCommandResult.error:calls_disabled,dial_disabled,permission_denied,unknown_call,no_call,not_ringing,invalid_number,route_unsupported,route_unavailable,route_timeout,route_failed: …,mute_failed,end_call_failed,silence_unsupported,unsupported_action,error: …. ACTION_REQUEST_DISCOVERABLEforBtRequest{PAIR}additionally needsBLUETOOTH_ADVERTISE; without it the guidance opens Bluetooth settings (One UI is discoverable while that screen is open).
Call log
CallLogRequest{request_id, since_ms, before_ms, limit ≤ 500} →
CallLog{request_id, entries (newest first), more}. before_ms is inclusive;
the desktop de-duplicates by id. On connect the desktop requests
since_ms = newest cached date (0 on first sync) and pages older entries in the
background. The phone pushes CallLogChanged{added} when entries appear
(throttled to one per 2 s); missed calls have type = MISSED, new = true.
Bluetooth identity and pairing
Both sides send BtIdentity{mac, name, enabled, bonded_to_peer, hfp_connected}
on connect (when bluetooth is shared) and whenever any field changes. The
phone’s mac comes from BluetoothAdapter.getAddress() where allowed; Android
returns 02:00:00:00:00:00 to apps, so the phone instead reports the empty
string and the desktop matches the phone by name among BlueZ devices and,
once bonded, by bonded_to_peer (the phone checks its bonded devices for the
desktop’s mac, which it can see). The desktop drives pairing: it sends
BtRequest{PAIR} (the phone shows “Pair with <PC> over Bluetooth” guidance and
makes itself discoverable via ACTION_REQUEST_DISCOVERABLE if needed), then
discovers and pairs through BlueZ with numeric comparison shown on both sides.
After bonding the desktop sends BtRequest{CONNECT} or connects HFP itself.
Enhanced tier (M4, ADR-0016, ADR-0017)
Two parties on the phone take part: the app (the paired peer, normal
Tether connection) and the shell helper (uid 2000, started by the desktop
through adb, its own sockets and protocol in shell.proto).
App side (enhance)
AdbWifiState(phone → desktop on connect and on change): developer options, USB debugging, Wireless debugging, and whether the app can switch Wireless debugging itself (WRITE_SECURE_SETTINGS).AdbWifiRequest{enable}(desktop → phone): the app writesSettings.Global adb_wifi_enabledand answers withAdbWifiState.AdbLink{token}(phone → desktop): sent when the app’s shell-only receiverorg.tether.android/.enhance.AdbLinkReceiver(permissionandroid.permission.DUMP) receivesam broadcast -n … --es token <token>. The desktop matches the token to the adb device it sent the broadcast through and stores serial ↔ device id.
Helper lifecycle
- The desktop has an authorised adb device linked to a paired phone.
adb reverse localabstract:tether_<nonce> tcp:<port>to the daemon’s listener on 127.0.0.1.adb shell CLASSPATH=<pm path of org.tether.android> app_process / org.tether.shell.Main tether_<nonce>; the daemon writes the one-time token and a newline to the helper’s stdin and keeps stdin open. The helper exits when stdin or the control connection closes.- The helper connects to
localabstract:tether_<nonce>and sendsShellEnvelope{connect{token, CONTROL}}, thenShellEnvelope{hello}. A wrong token closes the connection. - Requests carry a
request_idand are answered withShellResult(or the specific result message). Unknown messages are ignored.
Mirroring
MirrorStart → the helper opens a second connection, sends
connect{token, MIRROR, ref_id = mirror_id}, then ShellResult. From then on
that connection uses u8 kind, u32 length, payload records: MirrorMeta
(kind 1), video packets (kind 2: u64 PTS in µs, u8 flags, Annex-B access
unit) and, towards the phone, InputEvent (kind 3). A rotation or resize
restarts the encoder and sends a new MirrorMeta followed by codec config
and a key frame. Input coordinates are in pixels of the frame size the sender
last saw; the helper scales them and drops events with a stale frame size.
Closing the connection from either side ends the mirror; MirrorEnded is
sent on the control channel when the phone side ends it.
screen_off turns the panel off for the mirror’s lifetime and is restored
when the last mirror that asked for it ends or the helper exits (a detached
cleanup process covers a killed helper). stay_awake keeps the device from
sleeping while mirroring.
Clipboard, grants, display power
ClipboardWatch{on}makes the helper sendShellClipboardon every primary-clip change; the daemon treats it likeClipboardfrom the app.ShellClipboardtowards the helper sets the phone clipboard.GrantRequest{items, apply}→GrantResultwith the state of each item read back after the attempt. Item names are fixed (seeshell.proto).DisplayPower{on}switches the panel outside a mirror.
App streaming and phone audio (M4.2)
- App list (
apps, normal app):AppListRequest→AppListwith every launchable app (package, label, icon blob hash).AppListChangedtells the desktop to ask again. Needs no adb; starting an app in its own window does. - App window:
MirrorStart{new_display{w, h, dpi}, start_package}creates a virtual display, launches the app on it and mirrors it; input on that MIRROR connection goes to that display.MirrorConfigure{resize}changes the display size (newMirrorMeta). The display and its content are destroyed when the mirror ends; when the last task on it goes away the helper ends the mirror withapp_closed. Several mirrors run at once. Needs abilitiesdisplay.newandmirror.input. StartApp{package, display_id}launches an app on an existing display.- Phone audio:
AudioStart{audio_id, source}→ the helper opens an AUDIO connection (AudioMeta, then Opus packets, record framing as for mirrors) and answersShellResult. The daemon decodes and plays it.AudioStop, or closing the connection, ends it;AudioEndedreports the phone side. One capture at a time. Sources and their abilities:OUTPUT(audio.output),PLAYBACK(audio.playback),PLAYBACK_DUP(audio.playback_dup).
Phone as webcam (M4.3, ADR-0019)
- Ability
camera: the helper could read the camera list at start. CameraListRequest→CameraList: per camera its Camera2 id, facing, sensor orientation, the sizes it delivers straight to a video encoder, its fixed frame rates, whether it has a torch, and its maximum zoom.CameraStart{camera_id, device_camera | facing, width, height, fps, bitrate, torch, zoom}→ the helper opens the camera, opens a CAMERA connection (connect{token, CAMERA, ref_id = camera_id}), sendsCameraMeta(kind 1) and then video packets (kind 2, as on a MIRROR connection: codec config first, then access units starting with a key frame), and answersShellResult. The helper takes the listed size and rate closest to the request;CameraMetasays what is in use. Frames are as the sensor delivers them; the desktop rotates and flips.CameraConfigure{bitrate, torch, zoom, request_keyframe}changes a running capture. A different camera or size is aCameraStopand a newCameraStart.CameraStop, or closing the connection, ends it.CameraEnded{reason}is sent for every started capture:stopped,camera_disconnected(another app took the camera),camera_disabled(privacy switch or device policy),camera_error,encoder_error,socket_closed.- One capture at a time (
busy). Nothing travels desktop → helper on the CAMERA connection.
Helper behaviour for M4.3 (verified on a Galaxy A55, Android 17):
- A failed
CameraStartanswers onlyShellResult(noCameraEnded), withbad_request,unsupported,busy,not_found: camera,camera_disabled,camera_disconnected(camera in use),camera_errororencoder_error. CameraEndedis sent once the camera is released, about 0.3 s afterCameraStop. ACameraStartthat arrives while a stopped capture is still closing waits up to 3 s. On a switch the old capture’sCameraEndedarrives before the newShellResult; match bycamera_id.- Size choice: the same aspect ratio is preferred when that size has at
least half the pixels of the largest fitting one. Portrait requests are
not swapped; ask in landscape.
CameraMeta.fpsis 0 when the camera has no fixed rates. - H.264 High profile, key frame every 2 s, PTS is the sensor timestamp. Start to first key frame 0.84 to 1.47 s.
- Shell has a low camera priority: any app that opens the camera takes it
(
camera_disconnected). - Test tools may pass
only=<group,…>after the socket name to limit the start-up probes (mirror,clipboard,grants,display,apps,audio,panel,camera).
Helper behaviour for M4.2 (verified on a Galaxy A55, Android 16):
- An app display is created without system decorations and with IME policy
HIDE: the phone’s soft keyboard does not show for a focused field there; the PC keyboard types. The window must supply Back. - The display size equals the encoded size (rounded to the encoder’s
alignment).
dpi = 0at start derives from the main display;dpi = 0in a resize keeps the density, so a larger window shows more. app_closedmeans “no visible task on the display for about 1.5 s”; it also fires when the phone user swipes the app out of Recents. Apps opened on a virtual display are listed in the phone’s Recents.- Key events,
InputTextand the paste fallback into app displays were reliable on the A55 (15/15, 15/15, 6/6); no UHID path exists. PLAYBACKandPLAYBACK_DUPtake media, game, navigation, sonification, accessibility and assistant audio. Ringtones, alarms, notification sounds and voice calls stay on the phone.OUTPUTtakes everything.AudioEndedis sent for every started capture, also afterAudioStop. Packets are 20 ms Opus at 48 kHz stereo; the config packet isOpusHead.- Limits: eight mirrors, display sides 64 to 4096, one audio capture.
screen_off,stay_awakeandshow_touchesare counted per mirror and restored when the last mirror that asked for them ends.
Helper behaviour worth knowing (M4.1, verified on a Galaxy A55, Android 16):
- Start to
ShellHellotakes 1–2 s. The helper dials the MIRROR connection before it answersMirrorStart. It exits with 0 when stdin or the control connection closes (1 crash, 2 usage or no token, 3 cannot connect); stderr lines aretether-helper: <I|W|E> text. MirrorEndedis sent for every started mirror, also afterMirrorStop(stopped) and when the desktop closes the connection (socket_closed).- Video PTS is the encoder’s monotonic clock, not zero-based; config packets
carry PTS 0. One mirror at a time (
busy); H.265 and AV1 answerunsupported: codec;StartAppanswersunsupporteduntil M4.2. InputTouchwithmouse:buttonsis the mask after the event, a move with no button is a hover, pressure 0 on down/move means 1.0.InputTextfalls back to a paste for unmapped characters and restores the previous clip;InputPastedoes not restore.ClipboardWatchreports changes only, not the current clip.AdbLinkgoes to every paired session that announcedenhance; with none connected the token is kept for 60 s.AdbWifiState.can_changeis not refreshed by itself when the permission is granted later.
Error codes in ShellResult.error: unsupported (ability missing),
bad_request, busy, not_found, encoder_error, denied, internal,
optionally followed by : detail.
Test vectors (M2)
StreamOpen frame for a 5-byte FILE stream, ref_id "t1", index 0, name "a.txt":
envelope seq=1 → protobuf bytes:
08 01 e2 03 0f 08 01 12 02 74 31 20 05 2a 05 61 2e 74 78 74
framed: 00 00 00 14 followed by the 20 bytes above, then the 5 raw bytes.
Glossary
The terms this documentation uses, in alphabetical order.
Ability
A function of the shell helper that passed its check on a particular phone,
for example mirror.main, display.new or camera. The desktop hides a
feature whose ability is missing. Compare capability. See
Wire protocol.
adb
Android Debug Bridge, the command-line tool of the Android platform tools. The enhanced tier uses it to start the shell helper on the phone. See Privilege tiers and adb.
ADR
Architecture decision record: a short document that records one decision that is expensive to reverse, with its context and consequences. See Architecture decisions.
App
The Tetheron app on either side: the Tetheron app for Android on the phone,
or the GTK app tether on the desktop. The documentation says which one is
meant.
App-op
A per-app switch of Android that allows or denies one operation, set with
appops set over adb. Several grants are app-ops. See
Android permissions and grants.
Beacon
A small UDP broadcast on port 7360 with which the desktop and the phone announce themselves on the local network. It complements mDNS. See Discovery and connectivity.
Capability
A feature name that a device announces when a connection starts, for example
messages, calls or enhance. A feature is used only when both sides
announce its capability. See Wire protocol.
Companion device
A device that Android has registered as belonging to an app, through the CompanionDeviceManager. Tetheron registers the paired desktop where the Android build allows it. See Android permissions and grants.
Daemon
tetherd, the background program on the desktop. It holds the connection
to the phone and offers its functions on D-Bus to the app and to
tether-cli. See Architecture.
D-Bus
The message bus of the Linux desktop. The daemon owns the name
org.tether.Daemon on the session bus. See D-Bus API.
Desktop
The Linux computer that runs tetherd. The Android app calls it “PC”. See
Supported platforms.
Device id
The identifier of a desktop or a phone: the SHA-256 hash of the public key
in its certificate, written as 64 lowercase hexadecimal characters.
tether-cli accepts a unique prefix. See
Security model.
Enhanced tier
The features that need the privileges of the adb shell on the phone: screen mirroring, app windows, phone audio, webcam and grants. It is set up once per phone and desktop. Compare normal tier. See Privilege tiers and adb.
Grant
A permission or special access that the desktop gives to the Tetheron app
for Android over adb, for example manage_ongoing_calls. See
Android permissions and grants.
HFP
Hands-Free Profile, the Bluetooth profile of car kits and headsets. The desktop takes the hands-free role so that the phone plays call audio through it. See Calls and call audio.
Hold
The state after a deliberate disconnect. Neither side reconnects until the user chooses Connect on one of them. See Pair and unpair devices.
Manual address
A host name or IP address of the other device, entered by hand when discovery does not find it. See Connect across networks.
mDNS
Multicast DNS, the discovery mechanism of the local network (Avahi on
Linux). Tetheron announces the service type _tether._tcp. See
Discovery and connectivity.
Mirror
A window on the desktop that shows the phone’s screen, or one phone app, and sends mouse and keyboard input back. See Mirror the screen and open phone apps.
MPRIS
Media Player Remote Interfacing Specification, the D-Bus interface that Linux desktops use to show and control media players. The daemon offers one MPRIS player per phone and pauses desktop players during calls. See Control media and the phone.
Normal tier
The features that work with the Tetheron app for Android alone, with permissions granted on the phone: notifications, messages, contacts, photos, files, clipboard, media and calls. Compare enhanced tier. See Privilege tiers and adb.
Notification access
The Android special access that lets an app read the notifications of other apps. See Android permissions and grants.
Pair
To make a phone and a desktop trust each other. Both sides compare a short code, or the phone scans a QR code from the desktop. Each side then stores the other’s certificate. See Pair and unpair devices.
Phone
The Android device that runs the Tetheron app for Android. See Supported platforms.
Pinning (app)
Adding a launcher for one phone app to the desktop’s application menu with Pin to desktop. See Mirror the screen and open phone apps.
Pinning (certificate)
Storing the certificate of the other device at pairing and accepting only that certificate on later connections. No certificate authority is involved. See Security model.
Private adb server
An adb server that the daemon runs on its own port (5038) with its own key, separate from an adb server you may use yourself. See Configuration and files.
SAS
Short authentication string: the six-digit code that both devices show during pairing. Equal codes prove that no third party sits between the devices. See Security model.
SCO
The Bluetooth link that carries the voice of a call between the phone and a hands-free device. The phone opens it. The desktop can only close it. See Calls and call audio.
Secondary stream
An additional TLS connection between the same two paired devices for bulk data (files, photos, attachments), so that large transfers do not delay the main connection. See Wire protocol.
Shell helper
A small program from the Tetheron app for Android that the desktop starts over adb. It runs with the privileges of the adb shell and performs the work of the enhanced tier. It stops when the adb connection ends. See Privilege tiers and adb.
Sideload
To install an Android app from an APK file instead of an app store. See Install Tetheron on Android.
Tetheron
The project and its three parts: the Tetheron app for Android, the daemon
tetherd and the desktop app tether, with the command-line client
tether-cli. Programs, packages, paths and D-Bus names keep the earlier
name tether. See Architecture.
Tray
The area of the desktop panel that shows status icons. The desktop app shows the phone’s battery and a menu there. See Supported platforms.
v4l2loopback
A Linux kernel module that creates virtual camera devices. Tetheron feeds the
phone’s camera into such a device, labelled Tether Phone Camera. See
Use the phone as a webcam.
Virtual camera
The v4l2loopback device that call apps and browsers list as a camera
while the phone is used as a webcam. See
Use the phone as a webcam.
Virtual display
An additional display that exists only in the phone’s memory. Each phone app opened in its own window runs on one. See Screen mirroring, app windows and webcam.
Wireless debugging
The Android developer option that lets adb connect over Wi-Fi instead of USB. See Set up the enhanced tier.
Changelog
All notable changes to Tetheron (called Tether until December 2026) are documented here. The format follows Keep a Changelog and the project uses Semantic Versioning (pre-1.0: a minor bump marks a major feature release and may change the wire protocol additively).
[Unreleased]
Milestone 4, part 3: phone as webcam. Protocol v1, additive (helper ability
camera, camera messages in the shell helper protocol).
Changed
- The project is now called Tetheron. The desktop app’s window, launcher
entry, tray icon and About dialog and the Android app’s label say Tetheron.
Programs (
tether,tetherd,tether-cli), package names, D-Bus names, the Android application id and paths are unchanged, so installations and pairings carry over. The repository moved to https://github.com/tetheron/tetheron. - The AppStream description and release list were brought up to date.
Fixed
- The clipboard text in Preferences on Wayland no longer points to a “Send clipboard” button that does not exist.
- The phone’s QR scanner names the desktop menu entry as it is: “Show pairing QR…”.
Added
- Install script for Fedora, Arch Linux and other distributions: releases
carry
tether-<version>-linux-x86_64.tar.gzbeside the.deb. Itsinstall.shchecks the dependencies, prints thednforpacmancommand for what is missing, installs the programs under/usr/localand enables the daemon.sudo /usr/local/bin/tether-uninstallremoves them. Needs glibc 2.39, GTK 4.14 and libadwaita 1.5 or newer. Not yet tested on Fedora or Arch. - Hints for a missing package name the package of the distribution in use:
the install command in the Virtual camera dialog (
apt,dnforpacman) and the GStreamer packages in the phone screen window’s banner and in the daemon’s messages. Debian, Fedora and Arch families are known; elsewhere the hint describes the component. - Phone as webcam: “Use as webcam” on the Overview tab makes the
phone’s camera a virtual camera (“Tether Phone Camera”) that call apps and
browsers list like any webcam. Works over USB and over Wireless debugging.
Front or back camera, rotation, mirroring, torch and zoom can be changed
while it runs; the picture is 1280 x 720 at 30 fps by default
(
webcam_size,webcam_fps). Needs the enhanced tier. - Virtual camera set-up: a dialog that checks for the
v4l2loopbackkernel module, shows the install command when it is missing, and creates the camera device after one password prompt, optionally at every start. Nothing is loaded without asking. tether-cli webcam <id> …andtether-cli webcam-setup ….
Notes
- Call apps list the camera only while the switch is on, and the phone’s camera stays on for as long as it is.
- Another app that opens the camera on the phone takes it away from the webcam.
- Install
v4l2loopback-dkmsto use the feature (suggested, not pulled in by the package). With Secure Boot the module must be signed with an enrolled key. - Not yet tested: the password prompt from the installed service, the create-at-every-start files, a locked phone, the phone’s camera privacy switch, Wayland.
0.4.1 - 2026-11-16
Changed
- New logo: the desktop app icon, its symbolic variant and the Android launcher icon now show the two-faced bust on an orange background. No functional or protocol changes.
0.4.0 - 2026-11-16
Milestone 4, parts 1 and 2: the enhanced tier. With a one-time adb set-up the
desktop can show and control the phone’s screen, open phone apps in their own
windows and play the phone’s audio. Protocol v1, additive (capabilities
enhance, apps; a separate protocol for the shell helper).
Added
- Enhanced set-up: wizard that pairs with the phone’s Wireless debugging by scanning a QR code (pairing code and USB as alternatives), links the adb device to the paired phone and applies the optional grants. The daemon uses a private adb server, finds the phone again when its port changes and can switch Wireless debugging back on through the app.
- Phone screen: whole-screen mirroring in a window with mouse, keyboard, scroll and paste, Back/Home/Recents buttons and “screen off while mirroring”. Hardware decoding where available.
- Apps: launcher grid of the phone’s apps; each app opens in its own resizable window on a virtual display of the phone; pin apps to the desktop menu.
- Phone audio on the PC: switch on the device page; paused during calls.
- Clipboard from the phone without the log-reading workaround while the helper runs.
- Grants from the desktop: notification access, battery allowlist, runtime permissions, all-files access, sensitive notifications, call audio switching, Wireless debugging re-arm.
tether-cli enhance,mirror,apps,app,phone-audio.- ADR-0016 (adb integration), ADR-0017 (shell helper), ADR-0018 (media pipeline).
Changed
- The
.debnow depends on GStreamer plugins (base, good, gl) and recommendsgstreamer1.0-plugins-badandgstreamer1.0-libav. - Building needs
libgstreamer1.0-devandlibgstreamer-plugins-base1.0-dev.
Known limitations
- Verified on one phone and one PC (Galaxy A55 on Android 16; NVIDIA, X11). Whole-screen mirroring and Wireless debugging set-up were tested by hand. The Apps tab, pinning and phone audio playback were not yet tested by hand against a real phone; their parts passed automated and helper-level tests.
- A desktop with adb access has a full shell on the phone. Set this up only on a PC you trust.
- Protected (
FLAG_SECURE) screens show black. - Closing an app window closes the app on that display; there is no option to keep it on the phone.
- Wireless debugging switches off when the phone reboots; Tether can switch it back on only on Wi-Fi networks you allowed for it on the phone.
- Untested: Wayland, VA-API decoders, Samsung Auto Blocker, measured latency. Phone as webcam is not part of this release.
0.3.0 - 2026-11-15
Milestone 3: calls. Protocol v1, additive (new capabilities calls,
calls.dial, calllog, bluetooth; older peers keep their feature set).
Added
- Calls: incoming-call banner and notification with Answer and Decline, ringtone on the PC, in-call window with timer, mute and hang up, dialling from the desktop (dual-SIM aware), missed-call notifications with Call back. Desktop media players pause while a call rings or is in progress.
- Call log: synced from the phone with contact names, Calls tab with a missed-call badge.
- Call audio on the PC over Bluetooth hands-free (ADR-0015): guided Bluetooth pairing from the Calls tab, two-way call audio through the PC’s speakers and microphone, with echo cancellation (PipeWire’s WebRTC canceller) when no headset is used.
- Audio switching between this PC, the phone and the phone’s loudspeaker from the in-call window; the selection follows switches made on the phone. Needs a one-time adb grant on the phone (see the release notes); without it only “Phone” works from the desktop.
tether-clicommands for calls, the call log and Bluetooth.- Config keys
call_audio_on_pc,call_echo_cancel,call_ringtone,pause_media_on_call.
Known limitations
- Call audio is verified on one setup (PipeWire 1.0.5 / WirePlumber 0.4.17, Realtek RTL8852BU, Galaxy A55 on Android 16). Occasional short static-like noises can occur during PC calls; under investigation.
- Echo cancellation starts a few seconds into a PC call.
- The PC cannot take the call audio by itself; “This PC” asks the phone to switch and therefore needs the adb grant, or a tap on the phone.
- With in-band ringing the phone’s ringtone may play on the PC next to the PC’s own.
- No in-call DTMF keypad, conference merge/swap or video calls.
- Untested: GNOME Wayland session.
0.2.0 - 2026-11-11
Milestone 2: messages and everyday sync. Protocol v1, additive (new capabilities; 0.1.x peers keep working with the M1 feature set).
Added
- Messages: SMS/MMS thread list and conversations synced from the phone into a per-device SQLite cache, live updates for sent and received messages, send SMS and MMS with attachments (dual-SIM aware), contact names and photos, desktop notifications with reply, search, desktop-local read state.
- Contacts: vCard delta sync with photos.
- Media: now-playing card with album art, playback controls and seek; an MPRIS player per phone so desktop media keys and applets control the phone; phone volume control.
- Phone status and controls: SIM carrier and signal, Wi-Fi, airplane mode, Do Not Disturb toggle, find-my-phone ring.
- Clipboard: automatic two-way sync. Phone to desktop in the background needs two one-time adb grants (see the release notes); the daemon sets and watches the desktop clipboard when the app is closed (X11).
- Files: send files both ways (drag and drop, file chooser, Android share
sheet), progress and cancel, received files in
~/Downloads/TetherandDownload/Tether. - Photos: gallery with lazy thumbnails, filters, open, save, copy, drag-out and delete (no phone prompt with all-files access).
- Secondary TLS streams for bulk data (ADR-0014).
tether-clicommands for every feature;confirm --yes.- Desktop notification for incoming pair requests.
Changed
- Disconnect now holds on both sides until the user reconnects instead of the phone redialling immediately (ADR-0012).
- Android release builds are signed with the project release key.
Fixed
- Pairing no longer fails when both sides dial each other at once.
- Reconnect backoff after a session dies right after
Hello. - Identity key is no longer regenerated on a transient KeyStore error.
Known limitations
- Read state and deletions of messages are not synced back to the phone (non-default SMS app, ADR-0011). RCS is not supported.
- Wayland: desktop to phone clipboard only while the Tether window has focus.
- Untested on device: MMS send on a carrier, GNOME Wayland session.
0.1.0 - 2026-11-08
Milestone 1: pairing (SAS and QR), notification mirroring with actions,
replies and dismiss sync, battery status, .deb packaging.
Explanation
These pages give the reasons behind Tetheron’s design: the context, the alternatives that were rejected and what each choice costs. For steps to follow, see the how-to guides.
| Page | What it explains |
|---|---|
| About the architecture | The parts on the phone and the desktop, how they talk, and how a notification travels from one to the other. |
| About the security model | Device identities, pairing, what an attacker on your network can and cannot do, and what is stored where. |
| About privilege tiers and adb | Why some features need a one-time adb set-up and what that grants. |
| About discovery and connectivity | How the devices find each other and stay connected, and why the phone app asks for what it asks. |
| About calls and call audio | Why call control uses the Tetheron connection and call audio uses Bluetooth. |
| About screen mirroring, app windows and the webcam | How the phone’s screen, apps, sound and camera reach the desktop. |
| About the licence and distribution | The GPL, the sign-off, and where the packages come from. |
| Frequently asked questions | Short answers that link to the pages above. |
Architecture decision records
A decision that is expensive to reverse is written down as an architecture decision record (ADR) when it is made: the context, the decision, its consequences and the alternatives. An ADR is not rewritten afterwards. A decision that changes gets a new record or a dated amendment. The records were written under the project’s earlier name, Tether, and keep it.
The explanation pages describe how things are now and link to the records for the full reasoning. Where a page and an ADR disagree about a reason, the ADR is right. Where they disagree about current behaviour, the reference is right.
About the architecture
Tetheron is an Android app and a set of Linux programs that share one wire protocol. This page explains why the parts are split the way they are, and follows one notification from the phone to the desktop and back.
Android phone Linux desktop
+-------------------------------+ +------------------------------------------+
| Tether app (Kotlin/Compose) | | tetherd (Rust, systemd user service) |
| TetherService (foreground | TLS 1.3 / TCP | identity + pinning pairing (SAS/QR) |
| service, connectedDevice) |<================>| discovery (Avahi mDNS + UDP beacon) |
| NotificationListenerService | port 7360 | sessions + features: notifications, |
| SMS/MMS, contacts, calls, | protobuf | messages, contacts, media, files, |
| media sessions, MediaStore, | Envelope | photos, clipboard, calls, apps |
| clipboard, app list | + secondary | SQLite cache per phone, MPRIS player |
| NsdManager + UDP beacon | TLS streams | adb, phone audio, webcam |
| | | | |
| P-256 key in AndroidKeyStore | | | D-Bus org.tether.Daemon |
+-------------------------------+ | v (session bus) |
^ | +-------------+ +------------+ |
| Bluetooth hands-free (call audio) | | tether | | tether-cli | |
+------------------------------------------>| | GTK4/adw | +------------+ |
| | tray (SNI) | |
+-------------------------------+ | +-------------+ org.freedesktop. |
| Shell helper | adb reverse | ^ Notifications |
| org.tether.shell.Main | tunnel, | | mirror connection |
| (same APK, runs as `shell`, | one-time token | | (file descriptor) |
| started by tetherd over adb) |<================>| tetherd listener on 127.0.0.1 |
+-------------------------------+ ShellEnvelope +------------------------------------------+
+ media streams
The webcam path ships with 0.5.0. Everything else in the diagram is in 0.4.1.
One repository, one protocol definition
The two sides are useless without each other, and the protocol between them grows with every feature. Both therefore live in one repository, and the protocol is defined once, in protobuf schema files from which the Rust side and the Kotlin side generate their message types at build time. A protocol change is one pull request that touches the schema, the desktop and the phone together. With separate repositories it would be three coordinated ones.
The phone app is Kotlin with Jetpack Compose and requires Android 14, because that is where the foreground service type Tetheron depends on appeared, and older versions would need a second code path for services and permissions. The desktop is Rust with GTK 4 and libadwaita. The daemon has to hold TLS connections, speak D-Bus and decode video in one binary without a runtime, and the target desktops (Cinnamon, GNOME) are GTK-based. ADR-0001 records both choices.
The desktop side
tetherd, the daemon, is the only process that talks to the phone. It owns
the device identity, discovery, pairing, the connections, every feature and
the caches. The desktop app tether and the command-line tool tether-cli
are clients of the daemon’s D-Bus API,
org.tether.Daemon on the session bus, which is the only interface between
the daemon and any user interface.
The split exists because syncing must keep working when no window is open. Notifications must appear, files must arrive, and the battery level in the tray must update. The daemon posts desktop notifications itself, and the app can be closed, crash or be replaced without dropping the connection to the phone. A documented API also allows more than one front end. The app and the command-line tool are two, and a GNOME Shell extension is planned as a third.
The daemon runs as you, never as root, as a systemd user service tied to the graphical session. It needs your notification service and your files, and a system service running as a dedicated user could reach neither.
Two alternatives were rejected. A single app with the daemon built in would disconnect the phone when you close the window. A GNOME Shell extension as the whole product would exclude Cinnamon, KDE and Xfce. The cost of the chosen design is that every feature needs a D-Bus surface as well as a protocol surface. ADR-0006 has the record.
The phone side
The phone side is one APK with three entry points that Android treats very differently.
TetherServiceis a foreground service of typeconnectedDevice, the type Android offers to apps that maintain a connection to an external device. It holds the connection to the desktop for hours with the screen off and shows one silent, permanent notification. About discovery and connectivity explains what else the phone needs to keep it alive, and ADR-0005 records the model.- The notification listener is bound by Android when you grant notification access. It is kept small and forwards what it sees to the service.
- The shell helper is a second program inside the same APK and is not part
of the app. The daemon starts it through adb, and it runs as Android’s
shelluser, which may capture the display, inject input, create virtual displays and capture audio. It exists only in the enhanced tier.
Android does not let a normal app do what screen mirroring needs, and the
shell user is the one route to those abilities that needs neither root nor
a partnership with the phone’s manufacturer. Packing the helper into the
app’s APK means there is one file to install and the helper always matches
the app’s version. The helper is not the paired peer and has no identity of
its own, so it speaks a small protocol of its own to the daemon, gated by a
one-time token. About privilege tiers and adb covers
this in full.
The wire protocol in outline
The wire protocol reference is the normative description. The design decisions behind it are these.
Both sides listen on TCP port 7360 and either may dial, because the phone may be unreachable while it dozes and the desktop may be asleep when the phone comes home.
Every connection is TLS 1.3 with a certificate on both ends, and there is no plaintext mode. The certificates are self-signed. What counts is the key, which each side pins when you pair; see About the security model. TCP with TLS was chosen over QUIC because no maintainable QUIC implementation existed for Android that did not bring in Google-shipped or native code. The framing does not depend on the transport, so QUIC can be added later.
Messages are protobuf, one per length-prefixed frame. Protobuf has code generators for both Kotlin and Rust and tolerates unknown fields, so the two sides share a schema and can still evolve separately. Adopting KDE Connect’s protocol was considered and rejected for reasons of transport and pairing that ADR-0002 sets out.
On connecting, each side sends a list of capability strings such as
notifications, messages or calls. A feature is active only when both
sides list what it needs. This is how an old and a new build keep working
together. It is also how the phone tells the desktop that a permission is
missing: it does not advertise a capability whose permission it does not
hold.
Bulk data (files, photos, message attachments) never travels on the first connection, the control connection. The side that has the bytes opens another TLS connection to the same peer for them. Cutting files into control frames was rejected because a large transfer would stall notifications and media controls behind it. The price is one TLS handshake per stream. ADR-0014 has the comparison.
Where the desktop keeps data
Messages, contacts and the photo index must outlive a window, so the cache lives in the daemon. It is one SQLite database per paired phone, with large items (attachments, thumbnails, fetched photos) as files beside it. Configuration and files lists the locations. D-Bus suits paged method calls and change signals and does not suit megabytes of data, so clients ask the daemon for a page of rows, and for bulk data they get a file path in the daemon’s cache.
Media control lives in the daemon for the same reason. For each connected
phone that has a media session, the daemon exports an MPRIS player. MPRIS is
how Linux desktops connect media keys, panel applets and tools such as
playerctl to players, so all of those control the phone with no Tetheron
window open.
The clipboard is the exception. On Wayland a program can read the clipboard
only while it has focus, so the desktop app watches and sets the clipboard.
When the app is not running, the daemon covers for it with wl-copy or
xclip, and on X11 it also watches for changes on the desktop.
ADR-0013 records these decisions.
A notification, end to end
- A chat app on the phone posts a notification. Android hands it to the notification listener.
- The phone app filters it. Its own notifications, group summaries, ongoing foreground-service notifications, media transport notifications and apps on your blocklist are dropped.
- The app sends a
NotificationPostedmessage on the control connection. The message carries the SHA-256 hash of the icon in place of the icon. - If the daemon has no icon with that hash, it sends a
BlobRequestand the phone answers with the image. The daemon stores the image under its hash, so each icon crosses the network once. - The daemon posts a desktop notification through
org.freedesktop.Notifications, with the phone notification’s actions as buttons. It also emits aNotificationPostedsignal on D-Bus, and the desktop app, if it is running, adds the notification to its list. - You click Reply. Desktop notification pop-ups have no standard for
typing a reply inside them, so the daemon emits
ReplyRequestedand the desktop app opens its reply box. - You type and send. The app calls the daemon over D-Bus, and the daemon
sends a
NotificationActionRequestwith your text to the phone. - The phone app fills the text into the notification’s reply action and fires it. The chat app sends the message as if you had replied from the phone’s notification shade, and never learns that the reply came from a desktop.
- When the chat app removes its notification, the phone sends
NotificationRemoved, and the daemon closes the desktop notification.
The daemon does all the work up to step 5, so the notification appears with the app closed. The app is needed only for the reply box.
About the security model
Tetheron carries your notifications, messages and files between two devices, and it can place calls and send texts in your name. Each device has its own key, the devices exchange keys once while you watch, and afterwards each accepts only the other’s key. No account, certificate authority or server is involved.
Identities and pinned keys
Each device generates a long-lived ECDSA P-256 key pair and a self-signed certificate for it. On the phone the key is created in AndroidKeyStore, in secure hardware where the phone has it, and cannot be exported. On the desktop the key is a file in the daemon’s data directory that only your user can read.
A device’s device id is the SHA-256 hash of its public key, written as 64 hexadecimal characters. Nothing else in the certificate counts. Tetheron ignores the certificate’s dates, names and chain, so there is no expiry to handle and no dependence on the clock.
Every connection is TLS 1.3 with a certificate on both ends. When a connection opens, each side computes the id of the key the peer presented and looks it up in its list of trusted devices. If the id is in the list, the session is paired and every feature is available. If it is not, the session is unpaired: it may say hello, keep itself alive and run the pairing exchange, and every other message is ignored.
Storing the peer’s key and accepting only that key is called pinning. A new key is a new device.
P-256 was chosen over Ed25519 because AndroidKeyStore has provided hardware-backed P-256 on every device since Android 6, while its Ed25519 support is recent and uneven across manufacturers. ADR-0003 has the full comparison.
Pairing
Pairing is the one moment where a person decides. The threat at that moment is an attacker on the same network who answers before the real device does, or who sits between the two devices and relays their traffic. Both ways to pair are built to defeat that attacker. Pair and unpair devices has the steps, and the exact computation is in the wire protocol reference.
The six-digit code
Each side sends the other 32 random bytes. Both sides then hash the two device ids and the two random values together and reduce the result to six digits, a short authentication string (SAS). Each device shows the digits, and you confirm on both that they match.
An attacker in the middle has a different key from the real peer, so the two devices hash different ids and show different digits. The chance of a match is one in a million for each attempt. Only one pairing runs at a time, it times out after 60 seconds, and a failed attempt shows you two codes that differ.
Most tools offer a key fingerprint of 64 characters to compare. That is stronger on paper, but people skip it. Six digits are short enough to compare. The cost is that the protection depends on you looking: if the codes differ and you confirm anyway, you have paired with the attacker.
The QR code
The desktop shows a QR code that contains its device id, its addresses and a random secret that is valid for five minutes and for one use. The phone scans the code, connects, and proves that it knows the secret by sending a keyed hash (HMAC) of its own device id. The desktop checks the proof and both sides pair without a prompt.
The secret travels from screen to camera and never over the network, so a network attacker cannot produce the proof. The phone learned the desktop’s device id from the QR code and closes the connection if the device that answers has a different id.
The QR code does not protect against someone who can see your screen during those five minutes. Treat the code like a password while it is displayed.
What an attacker on your network can and cannot do
Assume someone else is on your Wi-Fi, or controls the router. They can:
- See that Tetheron is in use. Discovery announces each device’s name and device id on the local network. You can switch the announcements off, and paired devices still reconnect through the addresses they remember.
- See when the devices talk and how much, though not what.
- Connect to either device as a stranger. Pairing has to start somewhere, so the TLS handshake and the first messages are reachable by anyone on the network. A stranger can ask to pair, and you will see a pairing request you did not start. Reject it.
- Block or disturb the connection.
Without your key or a mistake during pairing, they cannot:
- Read or change what the devices send each other.
- Pretend to be your phone or your desktop after pairing. A different key is a different device and gets an unpaired session, which carries no feature.
- Make the devices fall back to something weaker. There is no plaintext mode and no TLS version below 1.3.
Discovery messages are not trusted. An announcement is a hint about where to dial, and who answers is decided by the key in the TLS handshake.
What is stored where
| What | Phone | Desktop |
|---|---|---|
| Own private key | AndroidKeyStore, not exportable | A file in the daemon’s data directory, readable only by your user |
| Trusted peers | A file in the app’s private storage: id, name and certificate of each paired desktop | A file in the daemon’s data directory: id, name, kind and certificate of each paired phone |
| Synced content | Stays where Android keeps it. The app reads it when asked | A SQLite database per phone (messages, contacts, photo index, call log, transfers) and cached files (icons, thumbnails, attachments, fetched photos) |
| Received files | The phone’s Downloads | ~/Downloads/Tether unless you change it |
Configuration and files lists the exact paths.
Tetheron does not encrypt the desktop cache. It is protected by the permissions of your home directory, like your browser profile or your mail, and anyone who can read your files can read your cached messages.
Losing a key means losing the identity. If you reinstall the phone app or delete the desktop’s data directory, the device has a new key and must be paired again. The phone’s key cannot be backed up or moved to a new phone, which is also what makes it hard to steal.
What leaves your devices
Nothing goes to any server. Tetheron has no account, no telemetry and no push service, and the Android app contains no Google Play Services or Firebase code. Data travels only between the paired devices, over the path you gave them: your local network, or a VPN or mesh network if you entered a manual address.
A relay for use across the internet is planned. By design it forwards the encrypted TLS bytes between two paired devices and never ends the TLS connection, so it would see which device ids talk, when and how much, and nothing of the content. It is meant to be self-hosted and off until you configure it. See About discovery and connectivity.
Unpairing
Unpairing on either device removes the trust record there and tells the peer, which removes its record too.
If the peer is unreachable at that moment, trust is one-sided for a while. The device that unpaired remembers to send the unpair message the next time it meets the peer. A device that receives a feature message on an unpaired session answers with an unpair message once, and the side that still believed in the pairing then drops it. One-sided trust opens nothing in the meantime, because a device sends and accepts feature data only for a peer whose key is in its own list.
Unpairing does not delete the phone’s cached messages and photos from the desktop. Configuration and files says where they are.
The local boundary on the desktop
The daemon runs as your user, never as root, and offers its API on the D-Bus session bus. Any program that runs as you can call that API: read synced messages, send a text, start pairing. Such a program already has the same power over your files and your other applications, and Tetheron does not try to defend against it.
The extra trust in the enhanced tier
The enhanced tier adds a second, much larger grant: the phone authorises the desktop for adb. An adb authorisation gives the desktop a shell on the phone. That is far more than Tetheron uses, and it is a property of adb. Tetheron keeps its own use narrow in these ways:
- The enhanced tier is opt-in, and the app says what the authorisation means before you give it.
- By default the daemon uses its own adb server and its own adb key, apart from any adb you use for development.
- The shell helper connects to a listener on the desktop’s loopback address. Any local program could connect there, so every connection must present a one-time token. The daemon hands the token to the helper on its standard input. A command line would be readable by other processes.
- The helper applies permission grants from a fixed list. The desktop cannot send it arbitrary commands.
- The helper runs as Android’s
shelluser. It cannot read the app’s private data, and the app has no way to make itselfshell. - Root is never required and never used.
You can withdraw the authorisation at any time on the phone, under Developer options, with Revoke USB debugging authorisations. The normal tier keeps working.
Logging
People attach logs to bug reports. The project’s rule is that message
contents, keys, the random values used in pairing and the pairing digits do
not appear in the log at any level you would normally run. On the desktop
they may appear only at the trace level, which is off unless you ask for
it.
Limits
Tetheron does not defend against:
- A compromised phone or desktop, or an attacker who has your login. Whoever controls a paired device controls the link.
- Someone with physical access to an unlocked device.
- Denial of service on the local network.
- Weaknesses in what it builds on: Android’s notification and SMS permission model, and Bluetooth’s hands-free profile, which carries call audio.
- Someone who confirms a pairing code without comparing it.
To report a vulnerability, use the private channel described in the security policy.
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.
About discovery and connectivity
The phone and the desktop have to find each other, stay connected for hours while the phone sleeps in a pocket, and find each other again whenever an address changes. This page explains how they do it, why the local network comes first, and why the phone app asks for the permissions and exemptions it asks for.
Finding each other
No single discovery method works on every home or office network, so Tetheron uses two at once.
The first is mDNS, the mechanism printers and media players use. Both
devices announce a service named _tether._tcp. Routers mostly let mDNS
through, and ordinary tools such as avahi-browse can see it, which helps
when diagnosing a problem. The Debian and Ubuntu family already runs
avahi-daemon on the mDNS port and a second responder would conflict with
it, so the daemon publishes and browses through Avahi, which makes
avahi-daemon a required package. The phone uses Android’s own service
discovery. mDNS fails more often than it should: many access points drop or
throttle multicast traffic to save power, guest networks and “AP isolation”
block it, and Android’s implementation is unreliable on some manufacturers’
Wi-Fi drivers.
The second is a small UDP broadcast packet, the beacon, sent every five seconds. Broadcast gets through on some networks that mangle multicast. The beacon uses port 7360, the same number as the TCP port, so the firewall needs one entry for both. The desktop sends beacons whenever the daemon runs. The phone sends them only while the app is on screen, or for a minute after the screen turns on, because Android drops broadcast and multicast packets while the screen is off unless an app holds a multicast lock, and holding that lock costs battery. So the desktop advertises all the time and the phone usually finds the desktop.
ADR-0004 lists the other options that were considered, among them Bluetooth advertising and a rendezvous server.
Neither mechanism is trusted. An announcement is a hint to try dialling an address. Who is there is decided by the key in the TLS handshake; see About the security model. Both mechanisms tell everyone on the local network a device’s name and id. You can switch discovery off on the desktop, and paired devices still reconnect through the addresses they remember.
Neither mechanism crosses from one subnet to another, and some networks block both. For those cases you can enter the other device’s address by hand. A manual address is stored and dialled on every reconnect attempt, next to the discovered ones. Connect across networks has the steps. The pairing QR code also carries the desktop’s current addresses, so a phone that scans it can connect and pair where discovery is blocked.
Staying connected
Both devices listen on TCP port 7360 and either may dial. The phone may be unreachable for incoming connections while it dozes, and the desktop may be asleep when the phone comes home, so whichever device wakes up first restores the link. A design in which only the desktop listens was rejected for that reason. When both dial at the same moment, both sides apply the same fixed rule to pick the connection to keep.
Each side keeps a list of addresses for each paired device: discovered ones, manual ones and the last one that worked. When the connection drops, it dials them again, waiting one second at first and doubling up to a minute between attempts.
The connection itself shows whether it is alive. An idle connection carries a ping every 15 seconds, and a side that hears nothing for 45 seconds drops the connection and reconnects.
Why the local network comes first
Two devices behind different routers cannot find each other without a meeting point, and some pairs cannot connect directly at all and need a relay. A meeting point or a relay is a server. Someone has to run it, keep it up and deal with abuse, and a server that is on by default is a privacy decision made for you. ADR-0010 therefore sets this order:
- The local network first. Every feature works with no hosted service, and the features that need low latency (mirroring, calls, clipboard) work best there.
- A VPN or mesh network through a manual address. If you already run Tailscale, ZeroTier or WireGuard, your devices share a virtual network. Enter the phone’s or desktop’s address on that network and Tetheron works across the internet today. This is a supported configuration, and it stays optional.
- A relay, which is planned. You would be able to host it yourself. Devices would prove their identity to it with their keys and meet by the id of their paired peer. The relay would pass the encrypted bytes along without being able to read them, and would see only which ids talk, when and how much. A hosted default may be offered, but it stays off until you opt in.
The code already treats a connection as an opaque stream of bytes and does not assume the peer is on the local subnet, so the relay can be added without changing any feature or message.
Waking the phone through Google’s push service is ruled out for good. It would require Google Play Services and a Google cloud project.
Disconnecting on purpose
Both apps have a Disconnect button. In the first release it closed the connection, and the other side, seeing what looked like a network failure, reconnected within a second.
The app now sends a Disconnect message before closing. Both sides then
hold: they stop dialling each other until you press Connect on either
device. The pairing is untouched.
The hold is kept in memory only, so restarting the daemon or the phone’s service clears it. It stops outgoing dials and still accepts incoming ones: if one side has forgotten the hold because it restarted, its next dial is accepted and the hold ends on the other side too. A daemon or app that shuts down also announces it, with the reason “shutdown”. The peer does not hold in that case and resumes as soon as discovery sees the device again.
Two other designs were considered. “Pause sync” would keep the connection open and stop the features, but the phone would still show “connected” and every feature would need a paused state. Treating a disconnect as a temporary unpair would destroy the pairing for a passing wish. ADR-0012 records the choice.
How Android shapes the phone side
Android works hard to stop apps from running in the background, and a connection that must deliver a notification within a second is what it tries to prevent. Most of what the phone app asks for during set-up exists to keep that one connection alive. Grant Android permissions walks through the set-up, and ADR-0005 records the design.
The foreground service and its notification
The connection lives in a foreground service. Android requires such a
service to declare a type and to show a notification for as long as it runs.
Tetheron uses the type connectedDevice, which exists for apps that
maintain a connection to an external device. The general-purpose type for
syncing data is limited to six hours a day on Android 15, which rules it
out.
That is why the app shows a permanent notification. It is silent and has the lowest importance. You can hide its channel in Android’s settings, and Android then shows its own generic notice.
The service restarts after a reboot and after an app update, and it redials when the network changes.
Battery optimisation
When the phone is idle, Android’s Doze mode suspends network access for most apps, apart from occasional maintenance windows. An app that is exempt from battery optimisation keeps its network access, so the app asks for the exemption. Without it, a notification can take minutes to arrive while the screen is off, and the link is restored when you turn the screen on. The app shows a warning while the exemption is missing.
The app does not hold the phone awake. It takes a wake lock only for the duration of a file transfer. A permanent wake lock was rejected because of the battery drain.
Notification access and restricted settings
Reading notifications needs notification access, which you grant in Android’s settings. For an app that was not installed from an app store, Android 13 and later may disable that switch until you choose Allow restricted settings in the app’s info page. The app detects the situation and shows the steps.
The companion device registration
Android lets an app register another device as its companion. A registered app is treated more gently in the background, and on Android 15 and later it is allowed to see notifications that contain one-time codes, which Android otherwise redacts for notification listeners it does not trust.
The app offers this registration during set-up where the phone allows it. On recent Android builds, a Samsung phone with Android 16 among them, the permission for the kind of registration that Tetheron needs is reserved for apps that the manufacturer preinstalls. There the step is skipped with an explanation, and the foreground service and the battery exemption keep the connection alive without it. On those builds, notifications with one-time codes reach the desktop only after the “sensitive notifications” grant, which is part of the enhanced tier.
Manufacturer app killers
Some manufacturers add their own limits on top of Android’s. Samsung puts apps to sleep after days without use unless they are listed under Never sleeping apps. Xiaomi needs Autostart to be allowed. No programming interface switches these, so the app can only guide you to the setting, and it does so only on phones from those manufacturers.
What was rejected
Scheduled background jobs run at most every 15 minutes and cannot hold a connection. Google’s push service needs a cloud service, which Tetheron does not have. Using an accessibility service to stay alive would be an abuse of an interface made for assistive tools.
The cost of the chosen design is a long set-up: a notification permission, notification access with the restricted-settings detour, the battery exemption and, on some phones, a manufacturer setting.
About calls and call audio
A call uses two connections at once. Answering, declining and dialling travel over Tetheron’s own encrypted connection, like notifications and messages. The voices travel over Bluetooth, through the hands-free profile that a car kit uses. This page explains the split, what the desktop’s audio system does during a call, and where the limits come from.
For the steps, see Make and receive calls. The decision record is ADR-0015.
Two channels for one call
Phone Desktop
+---------------------+ Tether (TLS, LAN) +-----------------------+
| Tether app |<==========================>| tetherd |
| call state, answer,| state, commands, call log | call windows, dialer |
| dial, mute, route | | ringtone, call log |
+---------------------+ +-----------------------+
| Android Telecom | Bluetooth hands-free | BlueZ + PipeWire |
| audio gateway |<==========================>| hands-free unit |
| | both voices (SCO link) | speakers, microphone |
+---------------------+ +-----------------------+
Control goes over the Tetheron connection because Android offers it to a normal app. With the phone and call-log permissions, the app can see the state of a call, answer it, reject it, end it, silence the ringer, place a call and read the call log. Control therefore works with Bluetooth switched off, and on a desktop without a Bluetooth adapter.
Audio goes over Bluetooth because that is the route Android provides for the voice of a cellular call. The audio interfaces open to a normal app affect only the app’s own sound. In the Bluetooth Hands-Free Profile (HFP) the phone is the audio gateway and the other device is the hands-free unit, and Android’s telephony stack routes the call to it by itself.
The cost of the split is a second pairing, over Bluetooth, and two connections that can disagree. A call can be fully controllable from the desktop while its audio stays on the phone, which is why the call windows say where the audio is.
How PipeWire exposes the link
Tetheron does not implement the hands-free profile on the desktop. PipeWire has implemented the hands-free role in its Bluetooth support since 2021, and WirePlumber enables it by default. The daemon drives BlueZ for the guided pairing and then follows what PipeWire does.
PipeWire presents the phone’s call audio as two streams, one carrying the caller’s voice into the desktop and one carrying the microphone to the phone. They are not devices, as a headset’s microphone and speaker would be. WirePlumber therefore connects them to the default speakers and the default microphone by itself, as it would for any voice application. The streams exist only while the phone holds the audio link, called SCO, open. When the phone closes it, the streams vanish.
Three consequences follow.
The existence of the streams is the reliable sign that call audio is on the desktop. The daemon looks at the audio graph once a second during a call, which is how the PC button in the in-call window follows a switch that you make on the phone’s own call screen.
The daemon has little to do in the normal case. It adds a connection only if one is still missing a few seconds after the streams appear, and it leaves alone a direction that the session manager connected somewhere else, for example to a headset. It does not change the default speakers or microphone.
The desktop cannot pull the audio to itself. PipeWire opens the audio link only when a stream starts, and there is no stream without the link, so moving a call to the desktop always has to be done by the phone. The desktop can only push audio away: switching the phone’s Bluetooth card off for a moment closes the link, and Android falls back to the earpiece.
Why switching audio needs a one-time adb grant
Since the phone has to open the link, the app on the phone must be able to tell Android to route the call to Bluetooth, to the earpiece or to the loudspeaker. Android reserves that for the in-call service of a dialler or call-companion app, and the direct Bluetooth call that would connect the audio is restricted to system apps.
The app ships such an in-call service. On Android 16, Android binds the
service only when the app holds the app-op MANAGE_ONGOING_CALLS, a
per-app switch that Android keeps outside the permission dialogs. Holding
the normal call-companion permission was not enough, and neither was
registering the app as a call companion through Telecom’s shell command. The
app-op is granted once over adb. That makes audio switching an
enhanced-tier feature in a narrow sense: it needs one
command and does not need the running helper.
Without the grant, calls still work with less control:
- Android routes a call to the desktop by itself when the desktop is the connected hands-free device, so answering on the desktop usually works.
- Phone works from the desktop, by pushing the audio away as described above.
- PC and Speaker report the reason, and you can still choose the desktop on the phone’s call screen.
Why echo cancellation runs the way it does
A laptop is a poor speakerphone. Its speakers play the caller’s voice a few centimetres from its microphone, so the caller’s voice goes straight back to the caller. A real hands-free unit announces that it cancels echo, and PipeWire’s hands-free role does not. The phone and the mobile network therefore treat the returning voice as echo and suppress the desktop’s side of the call whenever the far end makes sound. In the first test the caller heard roughly two thirds of the speech, with gaps.
The fix is PipeWire’s echo-cancel module with the WebRTC canceller on the microphone path. Tetheron runs it in a particular way:
- Only when the call uses the default speakers and microphone. A headset does not have the problem, so the daemon leaves it alone.
- In monitor mode. The obvious layout creates a virtual speaker and a virtual microphone and moves both directions of the call onto them. That removed the echo, but one side dropped out intermittently. In monitor mode the caller’s voice stays connected to the real speakers, the canceller listens to what the speakers play as its reference, and only the microphone side moves to a cancelled source. Both directions were clear.
- In a child process. Monitor mode cannot be reached through the usual module-loading command, and a module loaded by a short-lived tool dies with it. The daemon starts a small PipeWire process with its own configuration for the duration of the calls and stops it afterwards.
The cost is a gap at the start. The daemon waits for WirePlumber’s own linking to settle before it starts the canceller, so the first seconds of a call on the desktop run without cancellation. The same happens for about a second each time the audio moves back to the desktop mid-call.
Why there is no in-call keypad
Touch tones (DTMF) are how you answer “press 1 for …” menus and enter PIN codes. Android lets only the phone’s default dialler send them into a call. The keypad button in the in-call window explains this, and for menus and PIN codes you use the keypad on the phone.
Conference calls (merge and swap) and video calls are out of scope as well.
Alternatives that were rejected
oFono is a telephony service that can take over the hands-free profile from PipeWire. It replaces PipeWire’s native headset support, runs as a system service and is fragile. With PipeWire’s own role there is no new system service, and earbuds and other headsets keep their behaviour. hsphfpd, a separate hands-free daemon that PipeWire once supported, is abandoned.
Tetheron could register its own Bluetooth profile, open the audio sockets and run the wideband codec itself. That was estimated at four to six weeks, followed by a long tail of adapter and kernel differences. It remains the fallback if PipeWire’s native role proves unusable on common hardware.
Call control could also go through PipeWire. PipeWire 1.0.5, which the Ubuntu 24.04 family ships, has no call-control interface, and the telephony interface on D-Bus arrives with PipeWire 1.4. Control over the Tetheron connection works on every supported distribution and does not depend on Bluetooth being up.
Trade-offs that remain
- Wideband speech (mSBC) depends on the Bluetooth adapter. Without it the call falls back to narrowband.
- The phone may prefer earbuds that are connected at the same time. Android decides that.
- With in-band ringing the phone opens the audio link while the call still rings, so its ringtone can play on the desktop next to the desktop’s own.
- Occasional short static-like noises during calls on the desktop are a known, undiagnosed issue.
- Call audio was developed on one desktop, one Bluetooth adapter and one phone, so other hardware may behave differently.
The changelog lists the known limitations of each release.
About screen mirroring, app windows and the webcam
The phone’s screen, single phone apps, the phone’s audio and its camera reach the desktop through the shell helper, a program that the daemon starts on the phone through adb. All four features therefore belong to the enhanced tier, and none of them has a normal-tier variant. About privilege tiers and adb explains the helper and why it is needed. The webcam comes with the next release, 0.5.0.
For the steps, see Mirror the screen and open phone apps and Use the phone as a webcam.
The parts
phone desktop
┌─────────────────────────┐ ┌─────────────────────────────────┐
│ shell helper │ control │ tetherd │
│ │◄──────────►│ starts and supervises helper │
│ display ─► encoder ────┼──video────►│──► fd ──► Tether app: window │
│ input injector ◄───────┼──input─────│◄── fd ◄── mouse and keyboard │
│ audio capture ─► Opus ─┼──audio────►│ decode ─► desktop sound server │
│ camera ─► encoder ─────┼──video────►│ decode ─► virtual camera │
└─────────────────────────┘ adb tunnel └─────────────────────────────────┘
The helper keeps one control connection to the daemon for small requests and answers, and opens a separate connection for every stream: one per phone screen or app window, one for audio, one for the camera. All of them run through the adb tunnel, over USB or Wi-Fi, and each must present the one-time token of this helper start. The daemon gives the helper that token on its standard input when it starts it.
For the phone screen and app windows, the daemon does not sit in the path. It sets the stream up and then passes its end of the connection to the desktop app as a file descriptor. Video goes from the helper to the window, and input from the window to the helper on the same connection, without a detour through the daemon or D-Bus. The record format is in the wire protocol reference.
Capture and encoding on the phone
For the phone screen, the helper asks Android for a display that mirrors the main one and hands it the input surface of a hardware video encoder. Android composes the screen straight into the encoder, and the helper never touches pixels. The codec is H.264, at 8 Mbit/s unless the desktop asks for something else, and at the phone’s own resolution unless a maximum size is set.
When the phone rotates, the helper restarts the encoder and announces the new size before the first new frame, and the window on the desktop resizes to match.
Two options ride along with a mirror. Screen off switches the phone’s panel off while the picture continues on the desktop. The helper restores the panel when the last window that asked for it closes. If the helper is killed, a small detached process on the phone restores it, so the phone is not left dark. Stay awake keeps the phone from going to sleep while it is mirrored.
Android itself composes screens that an app marks as protected as black. The helper cannot change that.
Virtual displays for app windows
An app window is not a cropped view of the phone’s screen. For each app window the helper creates a new display on the phone, with the size of the window, starts the app on it and mirrors that display. The phone’s own screen is free for something else, and several apps can run side by side. The limit is eight windows per phone.
The display follows the window. When you resize the window, the desktop waits until the size has settled and then asks the helper to resize the display, and the app is laid out again as it would be on a phone or tablet of that size. The density is chosen so that one Android layout unit is one desktop pixel, which keeps text about as large as on the desktop.
Such a display has no status bar and no navigation bar, so the window supplies its own Back button. The phone’s on-screen keyboard is kept away from it, and the desktop keyboard types.
The display lives exactly as long as the stream. Closing the window destroys the display and closes the app on it. There is no option yet to move the app to the phone’s screen. In the other direction, the helper notices when no app is visible on the display any more, for example because you closed it in the phone’s Recents, and ends the stream, which closes the window.
Decoding and display on the desktop
The window decodes with GStreamer and draws into a GTK widget through
OpenGL. GStreamer was chosen because it is packaged on every target
distribution and finds the hardware decoder by itself. Linking against
ffmpeg directly was rejected because its library versions differ between the
distributions that one .deb has to serve. The GTK sink is linked into the
desktop app statically, because it is packaged on only one of the three
target distributions. ADR-0018
records these choices.
The decoder is chosen when the stream starts: hardware decoders first (VA-API, then NVIDIA, then V4L2 stateless decoders), software decoders after them. If a decoder fails while running, the window takes the next one and asks the phone for a new key frame. A switch in the preferences skips the hardware decoders for machines where they misbehave.
The pipeline is tuned to show the newest picture and may skip older ones. It does not synchronise to timestamps, so a frame is shown when it is decoded. A newer decoded frame replaces an older one that has not been drawn. If encoded frames pile up in front of the decoder for more than a moment, the window throws the backlog away and asks for a key frame.
Input
The mouse acts as one finger. The window maps the pointer position into the coordinates of the video frame, allowing for the bars that appear when window and picture have different shapes. Each event also names the frame size it refers to. The helper scales the position to the real display and discards events that refer to a frame size from before a rotation, so a click does not land in the wrong place after the screen has turned.
Keys take one of two routes. Characters go through the desktop’s input
method first, so that dead keys, compose sequences and input methods for
other scripts work, and arrive on the phone as finished text. Keys with
Ctrl or Alt, and keys that produce no character, are sent as Android key
presses with their modifiers, so that shortcuts inside Android apps behave
as on a keyboard plugged into the phone. If a character has no key on
Android’s virtual keyboard, the helper pastes it and then puts the previous
clipboard content back.
Pointer motion is limited to about 125 events per second. Everything that is held down is released when the window loses focus or the screen rotates, so that no finger stays stuck on the phone.
Audio capture
Phone audio is independent of the windows. The helper captures what the phone plays, encodes it as Opus in packets of 20 ms and sends it on its own connection. The daemon decodes and plays it, so the sound continues when no window is open. It appears in the desktop’s mixer as a stream of its own.
Android offers the shell more than one way to capture, and they differ in what the phone itself still plays:
| Source | What is captured | The phone itself |
|---|---|---|
output | everything | silent |
playback | media, games, navigation and similar; not ringtones, alarms, notification sounds or calls | silent for what is captured |
playback_dup | as playback | keeps playing too |
The helper reports which of these work on the phone, and the daemon takes the first available one in that order unless configured otherwise.
Capture stops while a call exists on the phone and resumes afterwards. Call audio travels over Bluetooth by a different route (see About calls and call audio), and the two must not compete.
The webcam, and why it needs a kernel module
For the webcam the helper opens the phone’s camera and, as with the screen, lets it render straight into a video encoder. No app is visible on the phone and no notification is shown. The phone’s own camera indicator is the sign that the camera is on. The helper is the only way the camera reaches the desktop, so there is no webcam without the enhanced tier.
The hard part is on the desktop. Video call apps and the default browser
builds on the target distributions list cameras from one source only: the
kernel’s video device interface, V4L2. A camera offered through PipeWire
would need no special rights, but those apps do not show it. A V4L2 device
without hardware behind it exists only through the kernel module
v4l2loopback, which is not part of the standard kernel, and loading a
kernel module needs administrator rights.
Tetheron takes this route and keeps the privileged part small:
- The module is not installed with the package and never loaded silently. Loading it from the package’s install script was rejected because it would surprise people who never use the webcam, and fail noisily under Secure Boot.
- The daemon has no administrator rights. One small script with a fixed set of three actions creates the device, started through the system’s authorisation prompt.
- Two failures can be explained to you but not repaired for you: a module that no longer builds after a kernel update, and Secure Boot refusing a module whose signing key is not enrolled.
The daemon owns the device. It decodes the camera stream, rotates and flips the picture as you set it, scales it into a fixed frame and writes it to the device. The format of the device never changes while the daemon holds it. Changing camera, rotating or a short interruption changes only the picture inside the frame, with black bars or black frames where needed, so a call app never sees the format change under it.
Orientation is a setting. The helper does not track how the phone is held, because that would have needed more hidden parts of Android for something the desktop does in one step.
The webcam is a switch and does not start when a call app opens the camera, because the module version on the target distributions does not tell the daemon when an app starts reading. The phone’s camera is therefore on for as long as the switch is on. And because the device is created so that apps see it only while it is fed, the switch must be on before the call app looks for cameras.
The shell user has a low priority for the camera. Any app on the phone that opens the camera takes it away, and the webcam picture stops until that app lets go.
ADR-0019 records the webcam design.
Latency
The design aims at a delay of no more than about a tenth of a second between the phone’s screen and the window. scrcpy reports 35 to 70 ms with the same approach of an encoder on the phone and a stream through adb. Tetheron’s own delay has not been measured yet.
Four things keep the delay short. The display or the camera feeds the encoder directly, so nothing is copied on the phone. Video and input for windows bypass the daemon. The desktop shows frames as they arrive and drops late ones. Hardware decoding is used where the system has it.
Other things lengthen it:
- All streams of one phone share the single adb connection, so a burst on one stream can hold up the others.
- Software decoding adds delay on machines without a usable hardware decoder.
- The first start of a hardware decoder can take several seconds. Later starts are fast.
- Audio is buffered for a few hundredths of a second on the desktop to avoid crackling. Audio and video are not synchronised with each other.
Limits
- Protected screens are black.
- Closing an app window closes the app on that display.
- The helper depends on hidden parts of Android that change between releases. A feature can disappear after a phone update until Tetheron follows. The helper’s probing keeps the other features working.
- Hardware decoding has been tested with NVIDIA on X11 only. Supported platforms lists what has been tested.
About the licence and distribution
The licence
Everything in the repository is licensed GPL-3.0-or-later: the Android app, the desktop programs, the protocol schemas, the build scripts and this documentation.
For you as a user this means that you may run Tetheron for any purpose, read and change its source, and pass on copies, changed or unchanged. Whoever distributes a changed version must make its source available under the same licence.
The project chose a copyleft licence because of that last condition. The link between your phone and your computer should stay under your control. A permissive licence such as MIT or Apache-2.0 would let a phone manufacturer or a cloud company ship a closed version with a proprietary relay in the middle. Version 3 of the GPL was chosen because Apache-2.0 code can be combined into a GPL-3.0 work and cannot be combined into a GPL-2.0-only one.
The costs are that code under GPL-incompatible licences cannot be linked, and that some companies do not contribute to or embed GPL-3.0 software. ADR-0009 has the full comparison, including MPL-2.0 and AGPL-3.0.
Contributing: a sign-off and no contributor agreement
Contributions are accepted under the
Developer Certificate of Origin (DCO).
You add a Signed-off-by line to each commit, which certifies that you have
the right to submit the work under the project’s licence.
Submit a pull request shows how.
There is no contributor licence agreement (CLA). A CLA would let the project relicense contributions later, which deters contributors and puts that power in the maintainer’s hands. Without one, nobody, the maintainer included, can move Tetheron to a licence other than a later GPL version without the consent of every contributor.
Code and knowledge from elsewhere
Open-source code may be reused under a licence compatible with GPL-3.0, and
must be credited. The
NOTICE file
carries the credits. Today there are two. The shell helper behind the
enhanced tier is an independent implementation that follows techniques
documented in and used by scrcpy (Apache-2.0), and the files that do so say
it in their header. The desktop app links gst-plugin-gtk4 (MPL-2.0).
One rule binds every contributor. Do not contribute code or knowledge that was obtained by reverse engineering proprietary software, such as decompiling an app or capturing its traffic. Public documentation and behaviour that any user can see are fine.
Phone Link and Link to Windows are trademarks of Microsoft; Tetheron is not affiliated with Microsoft.
Why Tetheron is not on Google Play
The Android app is an APK file on the releases page, and that is the only place it is published. It will not be on Google Play, because it needs permissions and behaviours that Play’s policies forbid, or put behind a review, for an app that is not the phone’s default handler:
- reading and sending SMS and reading the call log without being the default SMS or phone app
- access to all files, for deleting photos from the desktop
- the list of all installed apps, for notification icons and the app list
- the exemption from battery optimisation
- a second entry point that is designed to be run as Android’s
shelluser
Play would also require signing through Play. ADR-0008 records the decision.
This has costs for you. Nothing updates the app automatically, so you install each new release yourself. On Android 13 and later you may have to choose Allow restricted settings before you can grant notification access; see Grant Android permissions.
It has one cost for the project, which holds the key that signs the APK. Android accepts an update only if it is signed with the same key, so a lost key would mean a new app identity. The fingerprint of the signing certificate is published so that you can check a download.
The app contains no Google Play Services and no Firebase, and the project’s rules forbid adding them. Tetheron does not use Google’s push service to wake the phone.
Install Tetheron on Android has the steps.
Why a Debian package first and Flatpak later
The desktop side is one Debian package, also on the releases page. It contains the daemon, the desktop app and the command-line tool, and supports Ubuntu 24.04 and newer, derivatives such as Linux Mint 22, and Debian 13 and newer.
A .deb was chosen because it is the only format that can install all of
the following without you configuring anything: a systemd user unit that
starts the daemon at login, a D-Bus activation file that starts the daemon
when you open the app, a firewall profile for ufw, and dependencies on the
distribution’s own avahi-daemon and adb.
A Flatpak is planned. It did not come first because the daemon fits poorly
in a sandbox: it has to own a name on the session bus, talk to Avahi and
BlueZ, start adb, and be started by systemd. Snap and AppImage were
rejected because neither can install the unit and D-Bus files, and Snap is
disabled by default on Linux Mint.
Until the Flatpak exists, only the Debian and Ubuntu family has a package.
For other distributions, such as Fedora and Arch Linux, releases from 0.5.0
carry a tarball with the same programs and an install script. The script
puts the unit, the activation file and the rest under /usr/local and
enables the daemon. It cannot declare dependencies, so you install the
distribution’s packages yourself, and it tells you which are missing.
Updates are manual in both forms.
Install Tetheron on Linux has the steps for
both.
Why Tetheron is not your SMS app
Tetheron shows your text messages on the desktop and sends new ones, but it does not become the phone’s default SMS app. Your phone keeps using Google Messages or Samsung Messages.
Android lets any app with the SMS permissions read and send messages. Only the default SMS app may change what is stored: mark a message as read, delete it, save a draft. Becoming the default would mean replacing your messaging app with a complete one of Tetheron’s on the phone. You would also lose RCS chats, because RCS has no public interface for third-party apps. ADR-0011 rejects that.
You meet the consequences in three places:
- Reading a message on the desktop does not mark it as read on the phone. The desktop keeps its own read state.
- You cannot delete messages on the phone from the desktop.
- RCS chats are not in the Messages tab. They still reach the desktop as notifications that you can reply to.
Frequently asked questions
About the project
Does it need an account or the internet?
Neither. The phone and the desktop talk directly over your local network, and that works with no internet connection. See About the security model.
Is my data sent anywhere?
Only to the device you paired with. Tetheron has no server, no telemetry and no push service. Synced messages, contacts and thumbnails are cached on the desktop, in your home directory. See “What leaves your devices”.
Can I use it away from home?
Yes, if both devices are on a VPN or mesh network such as Tailscale or WireGuard: enter the other device’s address by hand, as Connect across networks describes. Without a VPN, Tetheron works on the local network only. A relay that you can host yourself is planned.
Why are the commands called tether?
The project used to be called Tether and was renamed Tetheron. The programs
(tether, tetherd, tether-cli) and identifiers such as file paths and
D-Bus names still carry the old name. They will follow in a later release.
Is it affiliated with Microsoft?
No. Tetheron is an independent project with its own protocol, and it does not work with Microsoft’s Phone Link or Link to Windows apps.
Compatibility
Does it work on my distribution?
There is a package for Ubuntu 24.04 and newer, Linux Mint 22 and newer, and Debian 13 and newer. From release 0.5.0 there is a tarball with an install script for other distributions that have GTK 4.14 and libadwaita 1.5, such as Fedora 40 and newer and Arch Linux. Elsewhere you can build from source until the planned Flatpak exists. See Supported platforms.
Does it work on Wayland?
Yes, with two differences from X11. A program on Wayland can read the clipboard only while it has focus, so text you copy on the desktop is sent to the phone while the Tetheron window is focused, where on X11 it is sent in the background. And GNOME shows the tray icon only with an AppIndicator extension. Supported platforms has the details.
Does it work with my phone brand?
Any phone with Android 14 or newer should work. Samsung and Xiaomi stop background apps more aggressively than Android does and need one extra setting, which the app points you to; see “Manufacturer app killers”. The enhanced tier relies on Android internals that differ between versions and manufacturers, so the desktop hides any part of it that does not work on your phone.
Does it work with an iPhone?
No. There is no Tetheron app for iOS and none is planned.
Does it support RCS?
Not in the Messages tab, because Android has no public interface that lets a third-party app read or send RCS chats. RCS conversations still reach the desktop as notifications, and you can reply to those. See “Why Tetheron is not your SMS app”.
Installation and permissions
Why is it not on Google Play?
The app needs permissions that Play’s policies do not allow for an app of its kind, among them reading and sending SMS without being the default SMS app, the call log and access to all files. You install the APK from the releases page. See “Why Tetheron is not on Google Play”.
Why does it ask for so many permissions?
Each feature needs the Android permission that guards its data: notification access for notifications, SMS permissions for messages, contacts for names, phone permissions for calls, media permissions for photos. The rest keep the connection alive in the background. If you refuse a permission, only the feature it belongs to is switched off. Android permissions and grants lists every permission with its purpose.
Why is adb needed for screen mirroring?
Android does not let an installed app inject touches and keys, turn the
screen off while capturing, or create a separate display for one app.
Android’s shell user may do all of that, and adb is how a computer reaches
it. The daemon starts a small helper on the phone through adb, and the
helper does the capturing and the input. Everything outside the enhanced
tier works without adb. See
About privilege tiers and adb.
Do I need root?
No. Tetheron never requires root on the phone and does not use it if it is there. On the desktop the daemon runs as your user. The one password prompt is for the virtual camera of the webcam feature (next release, 0.5.0), because loading a kernel module needs administrator rights.
Why does it use Bluetooth for calls?
For the sound only. Answering, declining and dialling go over the normal connection and work without Bluetooth. Android routes the audio of a mobile call itself, and the route it offers to another device is the Bluetooth hands-free profile that car kits use, so the desktop presents itself as a hands-free device. See About calls and call audio.
Other projects
How is it different from KDE Connect and GSConnect?
KDE Connect, and GSConnect for GNOME, overlap with Tetheron in notifications, file transfer, clipboard and media control. If they do what you need, there is no reason to switch. Tetheron adds call audio on the computer, SMS and MMS conversations with history, and the phone’s screen and apps in windows, and it makes you compare a six-digit code or scan a QR code when you pair. It is younger and less tested, supports fewer systems, and is not compatible with KDE Connect: ADR-0002 records why it has its own protocol.
How is it different from scrcpy?
scrcpy shows and controls an Android screen over adb, and Tetheron’s enhanced tier follows techniques that scrcpy documents and uses. In Tetheron, mirroring sits next to notifications, messages, calls and files in one app, the daemon keeps the adb connection up for you, and phone apps can be pinned to the desktop’s menu. If you want only a mirror, scrcpy is the more mature tool.
Taking part
Something does not work. What do I do?
Start with Troubleshoot. If that does not help, report a bug. Report security problems privately, as the security policy describes.
How do I help?
Use Tetheron and report what you find. Reports from phones and desktops other than the maintainer’s Samsung phone and Linux Mint help most. To work on the code or these pages, start at Contributing.
Architecture Decision Records
Tetheron records every decision that is expensive to reverse as an ADR in this
directory, following the MADR-style template in
0000-adr-template.md. The decision table in
../roadmap.md is the index of record; the files below are the
full reasoning.
Process: copy the template to NNNN-short-title.md (next free number), open a
pull request with status proposed, discuss in the PR, merge as accepted.
Superseding an ADR means writing a new one and changing the old one’s status to
superseded by ADR-NNNN; never edit an accepted decision in place beyond
typo fixes and cross-links. See Submit a pull request.
| ADR | Title | Status |
|---|---|---|
| 0001 | Monorepo, language stacks and shared protobuf schemas | accepted |
| 0002 | Wire protocol: TLS 1.3 over TCP 7360, length-prefixed protobuf | accepted |
| 0003 | Identity and pairing: P-256 self-signed certificates, pinning, SAS, QR | accepted |
| 0004 | Discovery: mDNS _tether._tcp, UDP beacon, manual address, QR | accepted |
| 0005 | Android background model: connectedDevice FGS and CompanionDeviceManager | accepted |
| 0006 | Linux process model: tetherd + D-Bus + GTK app + CLI | accepted |
| 0007 | Privilege tiers: normal vs enhanced (adb shell helper) | accepted (amended 2026-12-04) |
| 0008 | Distribution: sideload; .deb first, Flatpak later | accepted (amended 2026-12-04: GitHub releases only; tarball with install script for other distributions) |
| 0009 | Licence: GPL-3.0-or-later | accepted |
| 0010 | Reachability: LAN first, path-agnostic transport, relay later | accepted |
| 0011 | SMS: Tether is a non-default SMS app | accepted |
| 0012 | Intentional disconnect: Disconnect frame with hold semantics | accepted |
| 0013 | Desktop data layer for M2: SQLite cache in tetherd, MPRIS, clipboard model | accepted (amended 2026-11-11) |
| 0014 | Bulk transfer over secondary TLS connections | accepted |
| 0015 | Calls: control over Tether, audio over PipeWire’s native HFP hands-free role | accepted (amended 2026-11-15) |
| 0016 | adb integration: private adb server, QR pairing, Avahi discovery, reverse tunnel | accepted |
| 0017 | Shell helper: app_process entry point in the APK, probed abilities, own protocol | accepted |
| 0018 | Mirror media pipeline on the desktop: GStreamer with a statically linked GTK4 sink | accepted |
| 0019 | Phone as webcam: shell-helper camera into a v4l2loopback device owned by the daemon | accepted |
The project was called Tether until December 2026. Records written before the change keep that name, as do the programs and identifiers they describe.
ADR-NNNN: Short noun-phrase title
- Status: proposed | accepted | deprecated | superseded by ADR-XXXX (link the file)
- Date: YYYY-MM-DD
- Deciders: who approved it (for Tether: the maintainer, after the research round noted in Context)
- Tags: optional, e.g.
android,linux,protocol,packaging
Context
What forces are at play: the problem, the constraints (platform rules, licences, hardware, time), and the research that informed the decision. Link to sources where they matter. Write it so a reader a year from now understands why this was hard.
Decision
The choice, stated as a fact (“We use …”). Include the concrete parameters that other documents depend on (ports, algorithms, package names, API levels).
Consequences
Positive
What becomes easier or safer.
Negative / risks
What becomes harder, what we accept as a known gap, and what we must watch. Where a risk has a mitigation, name it.
Alternatives considered
One bullet per alternative: what it is, and the specific reason it lost. Keep the reasons concrete enough that the alternative can be re-evaluated if the reason stops being true.
Notes
Optional: follow-ups, related ADRs, when to revisit.
ADR-0001: Monorepo, language stacks and shared protobuf schemas
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
repo,android,linux,protocol
Context
Tether is two products that are useless without each other: an Android app and a Linux daemon/desktop app. They share one wire protocol that will grow for years (notifications in M1, messages/media/files in M2, calls in M3, video/audio/input in M4, relay in M5). A single developer builds both at an aggressive pace with parallel subagents, so coordination overhead must be near zero and a protocol change must be a single commit that updates both sides and their tests.
The target desktops are consumer Debian/Ubuntu-family installs (Linux Mint 22.2 on X11 Cinnamon today, GNOME Wayland preferred going forward). The target phone is a Samsung running One UI 6+ (Android 14+), with Xiaomi later.
Platform facts that shaped the Android baseline:
- Android 14 (API 34) made foreground-service types mandatory and introduced the
connectedDevicetype we rely on (ADR-0005). Supporting API < 34 would mean a second code path for service declaration, permission prompts and CompanionDeviceManager behaviour. - Android 13 (API 33) is where
POST_NOTIFICATIONS, self-managed CDM associations and the “restricted settings” rule for sideloaded apps appeared. Everything we need is stable at 34. - Android 15 (API 35) is the current
targetSdkexpectation and the version that introduced OTP notification redaction, which we must handle (ADR-0005).
Platform facts that shaped the Linux stack:
- The daemon must hold TLS sockets, speak D-Bus, talk to Avahi, BlueZ (M3) and
PipeWire (M3), and later decode H.264/Opus at low latency (M4). It must be
packaged as a single static-ish binary for
.deb. - GTK 4.14 and libadwaita 1.5 are available on the target distribution; Qt would put us in KDE Connect’s territory and look foreign on GNOME/Cinnamon.
Decision
- One repository (
linux-phonelink, product name Tether) containingandroid/,desktop/,proto/,docs/and CI. Releases of the two products are tagged together (vX.Y.Z); protocol compatibility is tracked byprotocol_versioninHello, not by repo layout. proto/tether/v1/*.protois the single source of truth for the wire format. Rust generates code at build time withprost-build+protox(pure Rust, noprotocneeded); Android generates Kotlin with Wire from the same files via a source-set link. No hand-written message types on either side.- Android: Kotlin 2.x, Jetpack Compose with Material 3, kotlinx-coroutines,
manual dependency injection (no Hilt/Dagger until the module count justifies
it), CameraX + ZXing for QR,
minSdk = 34,targetSdk = 35, single:appGradle module for M1 (split into:core,:features:*when the shell helper lands in M4). - Linux: Rust (edition 2021, MSRV 1.85) Cargo workspace with crates
tether-proto(codegen),tether-core(identity, TLS, framing, pairing, discovery, session, capability registry, plugin trait),tetherd(daemon),tether-gtk(binarytether),tether-cli. Core libraries:tokio,rustls0.23 (ring),prost,zbus5 (tokio),gtk4-rs0.9 +libadwaita0.7,rcgen,tracing. - Both sides share test vectors (SAS, QR proof) checked into
docs/reference/protocol.mdand asserted by unit tests in both languages.
Consequences
Positive
- A protocol change is one PR touching
proto/, Rust and Kotlin, reviewable as a whole; CI runs both builds on every change toproto/. minSdk 34removes every legacy branch for services, permissions and CDM.- Rust gives one binary per component, no runtime, and the crates we need for TLS,
D-Bus, GTK and GStreamer (
gst-plugin-gtk4statically linked in M4) exist and are maintained. - Compose and gtk4-rs are both declarative enough that UI iteration stays fast for one person.
Negative / risks
minSdk 34excludes phones that will never get Android 14. Accepted: those phones are also the ones most likely to be OEM-abandoned for the background behaviour we depend on.- Two toolchains in CI (Gradle + Cargo) roughly double CI time and cache complexity. Mitigation: path filters so Android changes do not rebuild Rust and vice versa.
- The monorepo forces one issue tracker and one release cadence; a desktop-only
bugfix still produces a tag that implies an Android release. Mitigation: release
notes state per-product changes; APK and
.debare separate artefacts. - gtk4-rs follows GTK upstream closely; distribution GTK versions lag. We pin the
v4_14/v1_5feature flags to the lowest version we ship on.
Alternatives considered
- Two repositories (
tether-android,tether-linux) with the protocol in a third: three PRs per protocol change and a submodule or package-registry hop for the.protofiles. Rejected for coordination cost at a one-person pace. - Kotlin Multiplatform or Flutter for a shared UI: neither integrates with libadwaita, D-Bus, freedesktop notifications or StatusNotifierItem without a native shim that would be most of the desktop code anyway. Rejected.
- Python daemon (GLib main loop): fastest to prototype, but packaging a Python
daemon with TLS, D-Bus and later real-time video decode into a
.debthat works across Ubuntu releases is painful, and performance for M4 would force a rewrite. Rejected. - Electron/Tauri desktop app: memory footprint and non-native look on GNOME/Cinnamon; Tauri would still need a Rust daemon. Rejected.
- C++/Qt: viable, but KDE Connect already owns that space and our target desktops are GTK-based. Rejected.
- JSON over the wire with hand-written models (KDE Connect’s approach): no schema contract between two languages, drift is found at runtime. Rejected (see ADR-0002).
minSdk 26or29for wider device reach: doubles the service/CDM code paths and the testing matrix for features that are flaky on exactly those devices. Rejected.
ADR-0002: Wire protocol: TLS 1.3 over TCP 7360, length-prefixed protobuf
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
protocol,security
Context
Tether needs a transport that works on a home LAN today, through a self-hosted relay later (ADR-0010), and that can carry small control messages, medium blobs (icons, thumbnails, attachments) and, from M4, latency-sensitive video, audio and input streams. Both peers are authenticated by their own certificates (ADR-0003); there is no CA and no cloud.
We evaluated inheriting an existing protocol rather than designing one.
KDE Connect is the obvious candidate: mature, GPL, well-documented plugin payloads. Its transport, however, is a poor fit:
- LAN-only by design: identity packets are UDP broadcasts on port 1716 and there is no concept of a connection that did not originate from a broadcast. Adding a relay would mean forking the core.
- It needs a range of about 50 ports (TCP 1716-1764 for connections, plus
per-transfer payload ports) so that several transfers can run at once. Firewall
setup is the most common support question in its community, and a single
ufwapplication profile cannot express it cleanly. - TLS is trust-on-first-use: the pairing step shows a key fingerprint but nothing forces the user to compare it, so a LAN attacker present at first pairing wins.
- Its network-facing code accumulated several CVEs in 2025 (packet handling and
plugin input validation in
kdeconnectd), a reminder that a large legacy surface written for a friendly LAN is a liability once the network is hostile. - Packets are newline-delimited JSON with ad-hoc payload-transfer side channels; there is no schema we could share between Kotlin and Rust.
Its plugin payload schemas (notifications, SMS, telephony, mpris, battery) remain an excellent reference for which fields matter and are credited where we borrowed field semantics.
QUIC was the other serious option. It gives multiplexed streams without head-of-line blocking, connection migration across Wi-Fi/cellular and 0-RTT, all of which would help a relay path and M4 media. But as of November 2026:
- There is no mature, embeddable QUIC implementation for Kotlin/Android that does not drag in Cronet (Google-shipped, Play-adjacent) or an NDK build of quiche/msquic/ngtcp2 with our own JNI; Netty’s QUIC codec is still incubator grade. We would be maintaining a QUIC binding on the phone.
- On a LAN, TCP’s head-of-line blocking only matters between streams, which we solve with additional connections, and bandwidth/latency are not the bottleneck.
- rustls supports TLS 1.3 over TCP everywhere we need it; Android’s Conscrypt supports TLS 1.3 since Android 10.
Protobuf vs alternatives. JSON has no cross-language schema. CBOR/MessagePack
are compact but schemaless. gRPC brings HTTP/2 framing, a heavy Android client
and an RPC model that fits request/response but not the event-stream shape of
notifications and battery updates, and makes custom certificate pinning awkward on
Android. Protobuf has first-class Kotlin (Wire) and Rust (prost) code generators,
unknown-field forward compatibility and a oneof that maps exactly onto “one
frame = one message”.
Decision
- Transport: TCP, fixed port 7360 on both desktop and phone; both sides
listen and either may dial. TLS 1.3 only, ALPN
tether/1, mutual certificates verified by the rules in ADR-0003. No plaintext mode, ever. - Framing: each frame is a
u32big-endian length (max 4 MiB) followed by onetether.v1.Envelope.Envelope.seqstarts at 1 per sender and increments per frame; receivers log gaps but never reject on them. - Messages: every message is defined in
proto/tether/v1/*.protoand carried inEnvelope.msg(oneof). New features add messages; they never change the meaning of existing field numbers.protocol_versioninHellois bumped only on incompatible change. - Capabilities:
Hello.capabilitieslists feature strings (battery,notifications,notifications.reply,blobs, …). A feature is active only when both sides advertise what it needs, so old and new builds interoperate. - Keepalive:
Pingevery 15 s when idle; drop after 45 s of silence; reconnect with exponential backoff 1 s to 60 s. - Control plus secondary connections: the first connection is the control
channel. For bulk data the sender opens another TLS connection to the same peer
(same verification), sends one
StreamOpen{purpose, ref_id, index, size}frame and then raw bytes. This gives per-transfer flow control and avoids blocking notifications behind a file or video stream. Inline blobs are capped at 256 KiB; anything larger goes through a stream. - Relay-agnostic: a “connection” is any byte stream carrying this TLS session. The relay (ADR-0010) forwards opaque TLS bytes and never terminates TLS. Nothing in core may assume the peer address is on the local subnet.
- QUIC is deferred, not rejected. The framing is transport-independent; QUIC can be added as a second transport (streams map to secondary connections) when a maintainable Android implementation exists.
Normative details live in docs/reference/protocol.md.
Consequences
Positive
- One port for everything: a single
ufwprofile, one router rule, one line of onboarding text. - Shared schemas: the Kotlin and Rust types are generated from the same files and CI fails if either side forgets to regenerate.
- Mutual TLS 1.3 with pinned keys gives confidentiality and authentication without any PKI or account.
- Secondary connections keep M1 simple (not even used) while giving M2 files and M4 media a clean home.
Negative / risks
- Both peers must implement both TLS roles and the connection-dedupe rule
(keep the connection dialled by the lexicographically smaller device id).
Mitigation: shared state-machine description in
protocol.mdand an in-process two-endpoint test on each side. - A custom protocol gets no third-party clients for free. Accepted: the schema is public and GPL; anyone can implement it.
- 4 MiB frame cap means large payloads must use streams, which is more code than “just put it in the message”. Accepted deliberately.
- TCP over a lossy Wi-Fi link will show head-of-line stalls inside a single video stream in M4. Mitigation: per-stream connections, and QUIC later if measured latency demands it.
- Fixed port can collide with another service. Mitigation: port is configurable in both apps and advertised via mDNS/beacon/QR; 7360 is the default, not an assumption.
Alternatives considered
- Adopt KDE Connect’s protocol (and interoperate with
kdeconnectd): rejected for the transport reasons above; interoperability would also force us to carry its TOFU pairing model. - QUIC from day one: rejected for lack of a maintainable Android stack; kept as a planned second transport.
- WebSocket/HTTP-based protocol: adds HTTP framing for nothing, and Android HTTP clients fight custom certificate verification. Rejected.
- gRPC: rejected for client weight, HTTP/2 overhead and awkward pinning.
- Noise protocol framework instead of TLS: smaller and elegant, but fewer audited implementations on Android and no hardware-key integration path. Rejected.
- Dynamic/ephemeral ports or a port range: rejected (firewall UX, see KDE Connect).
ADR-0003: Identity and pairing: P-256 self-signed certificates, pinning, SAS, QR
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
security,protocol,android,linux
Context
Every Tether device needs a long-lived cryptographic identity that (a) works as a TLS 1.3 certificate on both Android and Linux, (b) is hardware-backed on the phone where possible, (c) can be pinned after a one-time pairing so that later connections need no user interaction, and (d) can be verified by a human during pairing on a potentially hostile LAN.
There is no CA, no account and no cloud (ADR-0010). The threat we care about at pairing time is an attacker on the same network who answers discovery faster than the real peer or sits in the middle of the first connection. After pairing, the threat is impersonation by a device that is not the pinned peer.
Key algorithm. We wanted Ed25519 for its small keys and simple, misuse-resistant signing. It lost to ECDSA P-256 for Android-specific reasons:
- Hardware-backed keys on Android come from
AndroidKeyStore. EC P-256 has been a mandatory, hardware-backed Keymaster algorithm since Android 6; Ed25519 was only added to Keystore in Android 13 and is implemented in software or inconsistently across vendors’ KeyMint, and its availability for TLS client authentication through Conscrypt’sKeyManagerpath is not something we can rely on across OEMs. - TLS 1.3 makes
ecdsa_secp256r1_sha256mandatory-to-implement; every stack we touch (rustls with ring, Conscrypt, OpenSSL for debugging) handles P-256 certificates without configuration. - The identity is used for TLS only; no custom signing scheme exists where Ed25519’s ergonomics would matter.
Pairing ceremony. Fingerprint comparison (64 hex chars) is what TLS-pinning apps and KDE Connect offer and what users skip. A short authentication string (SAS) derived from both identities and both fresh nonces reduces the comparison to six digits that must match on both screens; an active attacker must make both sides’ SAS agree, which succeeds with probability 10^-6 per attempt, and any failed attempt is visible to the user. This is the model Bluetooth numeric comparison, Signal safety numbers and Matrix verification use.
A QR code covers the common case of a desktop with a screen and a phone with a camera: the desktop shows a one-time secret out of band; the phone proves knowledge of it with an HMAC. The secret never crosses the network.
Decision
- Certificates: self-signed ECDSA P-256 (SHA-256 signature), one per device.
- Android: key pair generated in
AndroidKeyStore(KeyProperties.KEY_ALGORITHM_EC,secp256r1, purposesSIGN), StrongBox when available, non-exportable; the self-signed certificate is created at key generation time. - Linux:
rcgenP-256; PKCS#8 PEM at$XDG_DATA_HOME/tether/identity.key(mode 0600) andidentity.crt. - Validity dates, subject names and chains are ignored by verifiers. Only the public key matters.
- Android: key pair generated in
- Device id = lowercase hex SHA-256 of the DER
SubjectPublicKeyInfoof the leaf certificate (64 chars). On Android that isSHA-256(cert.publicKey.encoded). It is the key in every store, D-Bus path and UI. - Verification (identical both sides): the peer must present exactly one
certificate; compute its id; if a trusted record matches, the session is
paired; otherwise it is unpaired and may only exchange
Hello,Ping/PongandPair*messages.Hello.device_idmust equal the computed id. - Pinning: on pairing success each side persists
{device_id, name, kind, certificate DER}. Pinning is by key hash (the id), so certificate re-issuance with the same key would still match; a new key is a new device. - SAS pairing: initiator sends
PairRequest{nonce(32 B)}, responder answersPairResponse{nonce(32 B)}; both computeSHA-256("tether-sas-v1" || fp_lo || fp_hi || nonce_lo || nonce_hi)with the pairs sorted by device id, take the first 4 bytes as big-endian u32 mod 10^6, zero-pad to 6 digits. Both users must confirm;PairConfirmfrom both completes it;PairRejector 60 s timeout aborts. Test vectors are inprotocol.mdand asserted by Rust and Kotlin unit tests. - QR pairing: desktop renders
tether://pair?v=1&id=<desktop id>&n=<name>&a=<ip:port>...&s=<base64url 16-byte secret>, valid 5 minutes, single use. Phone connects to the first reachable address and sendsPairRequest{nonce, qr_proof = HMAC-SHA256(secret, ASCII phone id)}. Valid proof: desktop repliesPairResponse{qr_accepted = true}andPairConfirmimmediately; phone auto-confirms. No prompt on either side. Invalid proof:PairReject{mismatch}and the secret is burned. - Unpair from either side deletes both records (
Unpairmessage).
Consequences
Positive
- No PKI, no accounts, no certificate expiry handling, no clock dependence.
- The phone’s private key never leaves secure hardware on devices with StrongBox/TEE; a malware-infested phone cannot clone its Tether identity.
- Six-digit SAS is short enough that users actually compare it; QR removes the comparison entirely for the desk-side case.
- Pinning by key hash means certificate details can change freely in future versions.
Negative / risks
- Losing the key means losing the identity: a reinstalled app or a wiped
$XDG_DATA_HOMErequires re-pairing. Accepted and documented; it is also what makes identity theft hard. - Android Keystore keys are device-bound: no backup/restore of the pairing. Accepted.
- A six-digit SAS is weaker than a 64-hex fingerprint against an attacker who can
retry. Mitigations: pairing is a user-initiated, 60 s, one-at-a-time ceremony
(
PairReject{busy}for concurrent attempts); any failure is shown to the user; a mismatch on one side should make them stop. - P-256 ECDSA signature generation needs good randomness; ring and Keystore both use RFC 6979-style or hardware RNG. We rely on them and do not implement any signing ourselves.
- Unpaired (TOFU-style) connections are accepted up to
Helloso pairing can happen; this exposes the TLS handshake andHelloparser to anyone on the LAN. Mitigation: rate-limit unpaired connections per source address; minimal parser surface before pairing.
Alternatives considered
- Ed25519 certificates: rejected for Android Keystore/Conscrypt support
reasons above. Revisit if
minSdkreaches a level where Keystore Ed25519 and TLS use are universal. - RSA-2048/3072: universally supported but slow on phones and large on the wire for no benefit. Rejected.
- Trust on first use only (KDE Connect model): no defence against a first-contact MITM. Rejected.
- PAKE (SPAKE2/OPAQUE) with a PIN: cryptographically stronger pairing that
binds the session to a shared PIN. More code and library review on both
platforms than a hash-derived SAS; the SAS gives equivalent practical security
for a one-time supervised ceremony. Deferred; the
Pair*messages leave room for aPairRequest.pakefield later. - Account-based identity (what Phone Link does with a Microsoft account): violates the no-cloud principle. Rejected.
- Bluetooth out-of-band pairing: requires Bluetooth on both sides at pairing time and a BlueZ agent; useful later for M3 call setup, not for the core identity. Rejected for M1.
ADR-0004: Discovery: mDNS _tether._tcp, UDP beacon, manual address, QR
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
protocol,android,linux,networking
Context
Before pairing, a phone and a desktop on the same network must find each other with zero configuration. After pairing, they must re-find each other every time the phone’s IP changes, the desktop reboots or Wi-Fi flaps, without user action.
Home and office networks are hostile to every single discovery mechanism:
- mDNS/DNS-SD is the standard (Bonjour, Avahi, Android
NsdManager) and is what printers and Chromecasts use, so routers mostly let it through. But many access points drop or throttle multicast in power-save mode, “AP isolation” and guest networks block it entirely, and Android’sNsdManagerhas a history of flaky resolution on some OEM Wi-Fi drivers. - UDP broadcast (KDE Connect’s only mechanism) is simple and works on networks that mangle multicast, but it does not cross subnets either and Android drops broadcast/multicast frames when the screen is off unless the app holds a multicast lock.
- Manual addresses always work when the user knows the IP, and they are the only option on networks that block both of the above or when the two devices are on different subnets (VLANs, Tailscale, a relay-less VPN).
- A QR code can carry the desktop’s addresses as a side effect of pairing (ADR-0003), covering the first-contact case even when discovery is blocked.
On Linux, avahi-daemon already owns UDP 5353 on every Ubuntu/Mint/Debian desktop;
a second mDNS responder in our process would conflict with it and double-answer
queries. Avahi exposes publish/browse/resolve over D-Bus.
Both peers listen on TCP 7360 and either may dial (ADR-0002), because the phone may be unreachable for inbound connections while dozing and the desktop may be asleep when the phone comes home. Two simultaneous dials must therefore collapse to one session deterministically.
Decision
- mDNS/DNS-SD service type
_tether._tcp.local, port 7360, TXT recordsid=<device id>,name=<display name>,kind=desktop|phone|tablet,pv=<protocol version>.- Linux: publish and browse through Avahi’s D-Bus API (
org.freedesktop.Avahi.Server,EntryGroup,ServiceBrowser,ServiceResolver) viazbusproxies. No in-process mDNS stack.avahi-daemonis a hard package dependency. - Android:
NsdManagerregistration and discovery (API 34registerServiceInfoCallbackfor TXT/address resolution).
- Linux: publish and browse through Avahi’s D-Bus API (
- UDP beacon fallback: protobuf
Beacon{device_id, name, kind, tcp_port, protocol_version}sent to255.255.255.255:7360and the subnet broadcast every 5 s while discoverable. Desktop: always while running. Phone: while the app is in the foreground or for 60 s after the screen turns on, holding aWifiManager.MulticastLockonly during that window (CHANGE_WIFI_MULTICAST_STATE). Beacons are hints: receivers dial the sender’s TCP port; nothing is trusted from the datagram itself. - Manual address:
host[:port]entered on either side; stored per device and dialled on every reconnect attempt alongside discovered addresses. - QR carries the desktop’s current addresses (
a=parameters) so a phone that scanned it can connect without any discovery. - Reconnect policy: each side keeps a per-peer address list (discovered,
beacon, manual, last-connected) and dials them with exponential backoff
1 s to 60 s; a peer is
Reachableif seen by any discovery mechanism in the last 30 s. - Dedupe rule: if two connections to the same peer exist, keep the one dialled
by the device with the lexicographically smaller device id; the other side
closes its dialled connection quietly after seeing
Hello. Both sides implement the rule identically; there is no negotiation.
Consequences
Positive
- At least one mechanism works on nearly every network we have seen; the user is
guided to the manual path only when all automatic ones fail (see
docs/how-to/troubleshoot.md). - Using Avahi makes Tether visible to
avahi-browse, which doubles as a support tool, and avoids fighting the system responder for port 5353. - The beacon shares port 7360 with TCP, so the firewall profile is still one entry
(
7360/tcp|7360/udp).
Negative / risks
- Hard dependency on
avahi-daemonon Linux. Acceptable on the target distros (installed by default); Flatpak (ADR-0008) will need--talk-name=org.freedesktop.Avahi. NsdManagerreliability varies by OEM. Mitigation: the beacon and manual paths; and the desktop advertises aggressively (always-on beacon) so the phone usually finds it.- Multicast locks cost battery; we hold them only in short windows and never in the background.
- Beacons and mDNS leak the device name and id to the LAN. Accepted: the id is a
public key hash, the name is user-chosen, and
Discoverablecan be turned off (paired devices still reconnect via remembered addresses). - The dedupe rule must be bit-identical on both sides or sessions flap.
Mitigation: documented in
protocol.md, exercised by the in-process handshake test with both dial orders.
Alternatives considered
- mDNS only: fails on too many real networks and on Android power-save paths.
- UDP broadcast only (KDE Connect): works on more networks than mDNS alone but is invisible to standard tooling and equally dead across subnets; also blocked when Android screen is off. Kept as fallback, not as primary.
- Own Rust mDNS responder (
mdns-sd,libmdns): conflicts with Avahi on 5353 and would need its own interface tracking. Rejected on Linux; revisit for non-Avahi systems. - Bluetooth LE advertising: works without Wi-Fi and is how Phone Link bootstraps Instant Hotspot; requires BT on both sides and BlueZ LE advertising code. Deferred to M3/M5 where BlueZ is already in play.
- Cloud rendezvous: solves cross-network discovery but is exactly what the relay (ADR-0010) will do, self-hosted. Not for M1.
- Only the desktop listens (phone always dials): simpler dedupe, but the desktop could not wake a sleeping phone’s connection and the roles would be asymmetric for the relay. Rejected.
ADR-0005: Android background model: connectedDevice FGS and CompanionDeviceManager
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
android,reliability
Context
Tether on the phone must keep a TLS connection open to the desktop for hours with the screen off, deliver notifications within a second, and survive Doze, app standby buckets, OEM “sleeping apps” killers and reboots. Android 14/15 constrain how a non-system app may do that:
- Foreground services need a declared type.
dataSyncis capped at 6 hours per 24 on Android 15;specialUseis accepted but is a flag for review; theconnectedDevicetype exists precisely for apps that maintain a connection to an external device and requiresFOREGROUND_SERVICE_CONNECTED_DEVICEplus at least one device-connection runtime/normal permission (we holdCHANGE_WIFI_MULTICAST_STATE, which qualifies). - Doze suspends network access except in maintenance windows unless the app is
on the battery-optimisation allowlist. The allowlist dialog
(
ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS) is a permission Google Play restricts to companion-style apps; Tether is sideloaded (ADR-0008) and is a companion app, so the exemption is both available and legitimate. - Notification access (
NotificationListenerService) is what we need for notification sync. On Android 13+ sideloaded apps hit the “restricted setting” gate: the toggle is disabled until the user goes to App info → Allow restricted settings. The listener is also unbound whenever the OS kills the process. - Android 15 OTP redaction: notifications that look like one-time codes are
redacted for untrusted listeners. The
RECEIVE_SENSITIVE_NOTIFICATIONSpermission is role/signature-gated, but apps holding a CompanionDeviceManager association are exempt, exactly because they are expected to forward notifications to a companion device. - CompanionDeviceManager (CDM) also gives: eligibility to start foreground
services and run in the background when the companion is present
(
REQUEST_COMPANION_RUN_IN_BACKGROUND,REQUEST_COMPANION_USE_DATA_IN_BACKGROUND),startObservingDevicePresence/CompanionDeviceServicecallbacks, and a system-level “this app is associated with that device” record that OEM battery killers (Samsung’s “sleeping apps”, in our testing) treat more gently. Since Android 13 an association can be self-managed (AssociationRequest.Builder.setSelfManaged(true),REQUEST_COMPANION_SELF_MANAGED): the app does the discovery itself and the system only shows a confirmation dialog with the display name we pass. That fits our mDNS/TLS discovery; the system’s own Bluetooth/Wi-Fi scan dialog would not find a TLS peer. - OEM killers: Samsung One UI puts apps to sleep after days of non-use (Battery → Background usage limits) unless they are listed under Never sleeping apps; Xiaomi needs Autostart. No API toggles these; onboarding must guide.
Phone Link (Link to Windows) uses the same primitives: a persistent foreground service, CDM association and the battery exemption, and OEM whitelisting where it ships as a system app.
Decision
TetherServiceis a foreground service of typeconnectedDevicewith a persistent, low-importance notification (Connected to <PC>).START_STICKY, restarted onBOOT_COMPLETEDandMY_PACKAGE_REPLACED; reconnect driven byConnectivityManager.NetworkCallbackand the session’s backoff.- CDM self-managed association is created right after the first successful
pairing (the display name is the desktop’s
Hello.name), one association per paired desktop, removed on unpair. The app declaresREQUEST_COMPANION_SELF_MANAGED,REQUEST_COMPANION_RUN_IN_BACKGROUND,REQUEST_COMPANION_USE_DATA_IN_BACKGROUND, and usesCompanionDeviceServicepresence callbacks as an additional reconnect trigger. - Battery optimisation exemption is requested in onboarding with an explanation; the app shows a persistent warning if it is not granted.
- Notification access is requested in onboarding with the restricted-settings
detection and instructions;
NotificationListenerServiceis kept minimal and forwards to the service. - Samsung/Xiaomi guidance is a dedicated onboarding step shown only on those
manufacturers (
Build.MANUFACTURER), with deep links where they exist. - No wake locks except a partial wake lock held for the duration of a file or blob transfer. Keepalive relies on the TCP socket plus the exemption; the 15 s ping interval is tolerated by Doze maintenance windows when the exemption is missing (degraded: latency up to minutes, reconnect on screen-on).
- No FCM/Play Services for wake-ups (ADR-0008, ADR-0010).
Consequences
Positive
- Honest use of the platform’s intended mechanism for exactly this use case; no tricks that an OS update is likely to break.
- CDM exempts us from OTP redaction without any shell-level grant, so 2FA codes reach the desktop in the normal tier.
- The association also improves survival on Samsung in our tests and gives a system UI entry the user recognises.
Negative / risks
- Onboarding is long: notifications permission, notification access (+ restricted
settings), battery exemption, CDM dialog, OEM step. Mitigation: a step-by-step
wizard with status checks, and
docs/how-to/set-up-android-permissions.md. - The persistent notification is visible forever. Mitigation: minimal importance, no sound, user can hide the channel (Android then shows a generic “running in background” summary).
- If the user declines the battery exemption, delivery latency with the screen off degrades. Accepted; the app shows the state.
- CDM self-managed dialogs are system-styled and vary by OEM; a user tapping “Don’t allow” loses the exemptions silently. Mitigation: detect missing association and offer to redo it.
connectedDevicerequires the companion-connection permission prerequisite; if Google tightens the rule to Bluetooth/USB-only permissions, we fall back tospecialUse(sideload-only, so no store review).
Alternatives considered
- WorkManager / JobScheduler polling: 15-minute minimum and no persistent socket. Useless for notifications.
- FCM push to wake the phone: requires Play Services and a cloud project; contradicts ADR-0008/0010.
dataSyncorspecialUseFGS type:dataSyncis time-capped;specialUseis the fallback, not the first choice.- AccessibilityService to stay alive: abuse of an accessibility API, triggers the same restricted-settings gate and worse warnings. Rejected.
- Permanent wake lock: battery drain users would uninstall over. Rejected.
- Skip CDM and rely on the shell helper (ADR-0007) to grant
RECEIVE_SENSITIVE_NOTIFICATIONS: works only in the enhanced tier; OTPs are the single most wanted notification type and must work in the normal tier.
Amendment 2026-11-08: self-managed CDM is privileged on recent builds
Field finding during Milestone 1 bring-up on a Galaxy A55 (Android 16, One UI 8.5):
pm list permissions -f reports android.permission.REQUEST_COMPANION_SELF_MANAGED
with protectionLevel: signature|privileged, and CompanionDeviceManager.associate()
with setSelfManaged(true) throws SecurityException: Application does not hold android.permission.REQUEST_COMPANION_SELF_MANAGED. A sideloaded app therefore cannot
create a self-managed association on such builds (Link to Windows can because OEMs
preinstall it as a privileged app).
Consequences:
- The onboarding step detects the missing grant and skips itself with an explanation.
- The CDM benefits (Android 15+ OTP-notification visibility, background eligibility)
are not available in the normal tier on these builds. OTP visibility moves to the
enhanced tier (
cmd appops set org.tether.android RECEIVE_SENSITIVE_NOTIFICATIONS allowvia the adb shell helper, Milestone 4). - Milestone 3 will attempt a regular (non-self-managed) association using a
BluetoothDeviceFilterthat matches the desktop’s Bluetooth adapter, since the PC must be Bluetooth-paired for calls anyway. That path uses only normal permissions. - Background reliability in Milestone 1 rests on the
connectedDeviceforeground service plus the battery-optimisation exemption; verified to survive forced Doze (dumpsys deviceidle force-idle) with notifications still delivered.
ADR-0006: Linux process model: tetherd + D-Bus + GTK app + CLI
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
linux,architecture,packaging
Context
Phone sync must keep working when no window is open: notifications must appear, battery must update in the tray, files must arrive. At the same time the desktop UI must be restartable, replaceable (GTK today, a GNOME Shell extension or a KDE applet later) and scriptable. The target desktops are Cinnamon on X11 today and GNOME on Wayland tomorrow; both are freedesktop-compliant.
Relevant platform facts:
- Desktop notifications are a D-Bus service,
org.freedesktop.Notifications, implemented by every major shell. Actions (actionscapability), replace-by-id, icons by path, andActionInvoked/NotificationClosedsignals are standard; inline reply is not (ainline-replyhint exists only in some servers), so replies need our own UI. - Tray icons are
org.kde.StatusNotifierItem(SNI). Cinnamon, KDE and Xfce support it natively; GNOME needs the AppIndicator extension. A GNOME Shell extension can provide a first-class indicator later by consuming our D-Bus API. - systemd user units and D-Bus activation are the standard ways to run a
per-user daemon on these distributions;
SystemdService=in the D-Bus service file ties the two so there is exactly one instance. - The daemon needs the session bus (notifications, Avahi via the system bus is
also fine) and the user’s
$XDG_*directories (identity, trusted devices,~/Downloads/Tether). It must not run as root.
Prior Linux attempts (GSConnect as a Shell extension, Sefirah/Vortex/Linksy as app-plus-service) validate the daemon-plus-client shape and show that extension-only designs lock out non-GNOME desktops.
Decision
tetherd(Rust,tokio): owns identity, TLS listener/dialer, discovery, pairing, sessions, plugins (battery, notifications, deviceinfo in M1) and the caches. Runs as a systemd user service (tetherd.service,WantedBy=default.target,PartOf=graphical-session.target,Restart=on-failure) and is D-Bus activatable on the session bus asorg.tether.Daemon(SystemdService=tetherd.service). Logs to journald viatracing.- D-Bus API at
/org/tether/Daemon(org.tether.Daemon1) and/org/tether/Devices/<id>(org.tether.Device1) is the only interface between the daemon and any UI; it is a documented contract (docs/reference/dbus-api.md) with properties, methods and signals. - Desktop notifications are emitted by the daemon through
org.freedesktop.Notificationsso they work with no Tether window open: phone notification → desktop notification withreplaces_id, actions mapped to Android actions, icon from the blob cache;ActionInvoked→NotificationActionRequest;NotificationClosed(reason=dismissed)→NotificationDismiss; a reply action emitsReplyRequestedon D-Bus so the GTK app can open its reply box. tether(GTK4/libadwaita, cratetether-gtk) is a pure D-Bus client: device list, device page (battery, notifications with inline reply), pairing (QR + SAS), manual address, preferences. It also hosts the StatusNotifierItem tray (viaksni) because SNI needs a long-lived process with a menu; the app runs in the background when the window is closed if the tray is available.tether-cliis a D-Bus client for scripting and support (devices,pair,qr,unpair,notify-test,log).- One package
tether(ADR-0008) ships all three binaries plus the unit, D-Bus service file, desktop entry, icon andufwprofile.
Consequences
Positive
- Sync is independent of any window; the UI can crash or be swapped without dropping the phone connection.
- Multiple front-ends (GTK, CLI, future Shell extension/KDE applet) against one stable API; the API doubles as the test seam for the daemon.
- D-Bus activation means a user who only ever opens the app still gets the daemon started correctly, and the unit gives autostart at login.
- Freedesktop notifications and SNI work the same on Cinnamon, GNOME (with extension), KDE and Xfce.
Negative / risks
- Every feature needs a D-Bus surface in addition to the protocol surface. Mitigation: keep D-Bus shapes close to the protobuf messages; generate documentation from the interface.
- GNOME without an AppIndicator extension has no tray. Mitigation: documented; notifications still work from the daemon; a GNOME Shell extension is planned (M5).
- Inline reply from the notification popup is not possible on most shells; the user gets a “Reply” action that focuses the app. Accepted (Phone Link on Windows has the same two-step for most apps).
- Wayland clipboard sync (M2) cannot be done from a daemon without focus; it will live in the GTK app or a portal, X11 via XFixes in the daemon. Documented in the M2 plan.
PartOf=graphical-session.targetstops the daemon at logout, which is what we want for a session-bound device; headless/lingering use (receive files while logged out) is not supported in M1.
Alternatives considered
- Single GTK process with the daemon embedded: closing the window would disconnect the phone, and the process would depend on a display. Rejected.
- GNOME Shell extension as the product (GSConnect model, JavaScript): excludes Cinnamon/KDE/Xfce and ties releases to Shell versions. Rejected; planned later as a client.
- System service (
/etc/systemd/system) running as a dedicated user: cannot post to the user’s session bus for notifications, cannot see the user’s files, and needs IPC to the session anyway. Rejected. - KDE Connect plugin: Qt, protocol (ADR-0002) and project governance mismatch. Rejected.
- GApplication-style D-Bus singleton with autostart
.desktopinstead of a systemd unit: works on XDG autostart desktops but has no restart-on-failure and no journald integration. Rejected in favour of the unit plus D-Bus activation.
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).
ADR-0008: Distribution: sideload + own F-Droid repo; .deb first, Flatpak later
- Status: accepted (amended twice on 2026-12-04)
- Date: 2026-11-08
- Deciders: maintainer
- Tags:
packaging,android,linux,release
Context
Android. Tether needs permissions and behaviours that Google Play policy
either forbids for a non-default-handler app or gates behind a declaration
review: READ_SMS/RECEIVE_SMS/SEND_SMS and READ_CALL_LOG outside the
default-handler role (Phone Link is allowed as an OEM/partner exception),
MANAGE_EXTERNAL_STORAGE for the file explorer and photo deletion,
QUERY_ALL_PACKAGES for the app list and icons, REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
and a second entry point designed to be run as shell (ADR-0007). Play would
also force Play App Signing and a developer account. Sideloading is the only
honest route and it is what the project’s target users already do.
F-Droid’s main repository is attractive (reproducible builds, trust) but has lead times of days to weeks per release and strict dependency rules; we use only FOSS dependencies (Wire, CameraX, ZXing, kotlinx, Compose) so inclusion is possible later, but it must not gate releases. The F-Droid client supports third-party repositories added by URL or QR, with signed indexes and automatic updates, which gives us an update channel without a store.
Linux. The target is the Debian/Ubuntu family (Mint 22.2 = Ubuntu 24.04 base:
GTK 4.14, libadwaita 1.5; Debian 13 has newer). A .deb is what those users
install, and it is the only format that can ship a systemd user unit, a D-Bus
activation file, a ufw application profile and a dependency on the distro’s
avahi-daemon and adb without the user configuring anything. cargo-deb
builds it from Cargo metadata with no debian/ boilerplate.
Flatpak is the right long-term format for the GTK app, but the daemon is awkward
in a sandbox today: it must own a session bus name, talk to Avahi and BlueZ,
spawn adb, mount FUSE in M5, and be started by systemd/D-Bus activation outside
the portal model. Doing that well is a milestone of its own (M5). Snap is disabled
on Mint by default; AppImage cannot install unit/D-Bus files.
A Launchpad PPA requires source packages built on Launchpad, i.e. vendoring every
crate and a debian/rules that drives Cargo offline, which is substantial
maintenance for no user-visible gain over a self-hosted apt repository of binary
.debs served over HTTPS with our own signing key.
Decision
- Android: release APKs are sideloaded. They are attached to GitHub
Releases and published in a Tether-run F-Droid repository (
fdroidserver, signed index, repo URL and QR in the README). Never Google Play. Submission to F-Droid’s main repository is welcome later but not a release gate. APKs are signed with a project key whose certificate fingerprint is published so users can verify. - Linux: one Debian package
tetherbuilt bycargo-debfrom thetetherdcrate’s metadata, containingtetherd,tether,tether-cli,tetherd.service(user unit),org.tether.Daemon.service(D-Bus activation), theufwapplication profile, desktop entry, icon and AppStream metainfo.Depends: libgtk-4-1, libadwaita-1-0, avahi-daemon, adb(+$autoshared libs);Recommends: ufw. Published via GitHub Releases and a self-hosted apt repository (repreprooraptly, seedesktop/packaging/README.md). Supported: Ubuntu 24.04+ and derivatives, Debian 13+. - Flatpak for the GTK app (and, if feasible, the daemon) in M5; a PPA only if a contributor wants to maintain it. No Snap, no AppImage.
- Versions: one
vX.Y.Ztag produces both the APK and the.deb; the protocol version is independent (ADR-0002).
Consequences
Positive
- No store policy can block a feature; releases are as fast as CI.
- The
.debintegrates with the system exactly as a distro package would (unit, D-Bus, firewall profile, dependencies) and can be removed cleanly. - The F-Droid repo gives Android users automatic updates with a FOSS client.
Negative / risks
- Sideloading means users must allow “Install unknown apps” and, on Android 13+,
“Allow restricted settings” for notification access. Mitigation:
docs/how-to/set-up-android-permissions.mdand in-app detection of those states. - We hold the APK signing key and the apt/F-Droid repo keys; losing them means a new app identity. Mitigation: offline backup, documented in the release runbook (M6).
- Only Debian-family Linux is supported in M1; Fedora/Arch users must build from source until Flatpak (M5). Accepted per the project’s target.
cargo-debcannot express everythingdhcan (e.g. user-unit enablement), so we ship hand-writtenpostinst/prerm. Mitigation: scripts are minimal, idempotent and never fail the install.
Alternatives considered
- Google Play: policy-incompatible permissions and shell entry point. Rejected.
- F-Droid main repo only: release latency and no control over timing. Rejected as the sole channel; welcome as an addition.
- Flatpak first: daemon/systemd/Avahi/BlueZ/adb/FUSE integration is not sandbox-friendly yet. Deferred to M5.
- Launchpad PPA: source-build requirement and crate vendoring maintenance. Deferred unless a maintainer appears.
- Snap / AppImage: unit and D-Bus activation files cannot be installed; Snap is off by default on Mint. Rejected.
- Separate
tetherd,tether-gtk,tether-clipackages: more correct for a distro, but every user wants all three andcargo-debbuilds one package per crate; a split can happen when a distro packager asks for it.
Amendment (2026-12-04): GitHub releases only, for now
The project does not run an F-Droid repository or an apt repository, and neither is planned for the next releases. Both were part of this decision and neither was built.
- Android: the signed APK is attached to GitHub releases of
tetheron/tetheron. Installing it from the desktop withadb installis the recommended route, since the desktop package depends onadband the same USB debugging set-up serves the enhanced tier. Still never Google Play. - Linux: the
.debis attached to the same GitHub release. Flatpak remains planned.
Running our own repositories means keeping signing keys and an index online and current for every release. That is not worth it for a project of this size yet; the question can be reopened when there are users asking for automatic updates.
Amendment (2026-12-04): a tarball with an install script for other distributions
The decision left Fedora and Arch users to build from source until the Flatpak. Building needs the Rust toolchain and the development headers, and it leaves the unit, the D-Bus activation file, the polkit action and the desktop entry for the user to place by hand.
- Linux: each release also carries
tether-<version>-linux-x86_64.tar.gz: the three release programs that go into the.deb, the same data files, andinstall.sh(desktop/packaging/build-tarball.sh,desktop/packaging/tarball/). - The script installs under
/usr/local, enables the user unit globally and installs a copy of itself astether-uninstall. It checks dependencies and prints thednforpacmancommand. It does not run a package manager. - The
.debstays the supported form for the Debian family. The tarball is offered for Fedora 40 and newer and for Arch Linux, untested by the project at the time of writing.
Considered and not chosen:
- An RPM and a PKGBUILD. They would declare dependencies and remove cleanly through the package manager. Each needs a build and a test environment the project does not have, and an RPM is tied to a Fedora release. A tarball covers both families with one artefact. Either can be added when someone maintains it.
- Installing dependencies from the script. A script run as root that
calls
dnforpacmanwith a list that may be out of date is harder to trust and to debug than a command the user reads and runs. - Static or bundled libraries. GTK and GStreamer have to match the desktop’s own. The tarball links to the system’s libraries and requires versions at least as new as those of the build machine (Ubuntu 24.04: glibc 2.39, GTK 4.14, libadwaita 1.5).
Consequences: files under /usr/local are not tracked by a package manager,
so updates and removal go through the script. The webcam helper and the
polkit action must still go to /usr, because the daemon and polkit look
there. On systems with a read-only /usr they are not installed and the
virtual camera cannot be created. The app’s and the daemon’s hints for
missing packages have to know three sets of package names; they take them
from the crate tether-distro, which reads /etc/os-release.
ADR-0009: Licence: GPL-3.0-or-later
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer
- Tags:
legal,community
Context
Tether is a clean-room reimplementation of a proprietary product’s behaviour (no reverse engineering of Microsoft binaries or protocols). It will reuse open-source components where licences allow, and its most valuable property is that the phone-to-PC link stays under the user’s control. Candidate reuse we have already identified and their licences:
- scrcpy (Apache-2.0): shell-helper techniques for display capture, virtual displays and input injection (ADR-0007).
- KDE Connect (GPL-2.0-or-later / LGPL): plugin payload semantics as reference only; no code copied.
- Klinker
android-smsmms(Apache-2.0): MMS PDU handling (M2). gst-plugin-gtk4(MPL-2.0), rustls/tokio/prost/zbus (MIT/Apache-2.0), gtk4-rs (MIT), Wire (Apache-2.0), CameraX/Compose (Apache-2.0), ZXing (Apache-2.0).
A permissive licence would let an OEM or a cloud vendor ship a closed fork with the same feature set and a proprietary relay, which is the exact outcome the project exists to avoid. GPL-2.0-only would be incompatible with incorporating Apache-2.0 code (scrcpy, Klinker), which we need. GPL-3.0-or-later is compatible with Apache-2.0 (one way, into GPL-3), MPL-2.0, MIT and BSD, and the “or later” clause avoids a future licence dead end.
Decision
- All first-party code in this repository (Android app, Rust crates, protocol
schemas, build and packaging scripts) is licensed GPL-3.0-or-later. The
repository root
LICENSEis the GPLv3 text; every source file carries an SPDX header// SPDX-License-Identifier: GPL-3.0-or-later(or the comment syntax of its language). - Documentation under
docs/is also GPL-3.0-or-later for simplicity (no dual-licensing of docs). - Contributions are accepted under the Developer Certificate of Origin (DCO,
Signed-off-bytrailer), not a CLA. The project therefore cannot relicense contributions to anything other than later GPL versions. - Third-party code is included only if its licence is GPL-3.0 compatible; each
inclusion is recorded in a
THIRD_PARTY.md(created when the first inclusion happens) with licence and origin. Reference-only reading of GPL-2.0-only code (none identified so far) is avoided to keep the clean-room claim simple. - The relay server (M5, ADR-0010) will be evaluated separately for AGPL-3.0-or-later because it is a network service; that will be its own ADR.
Consequences
Positive
- Copyleft protects the user-controlled link; forks must stay open.
- Compatible with everything we plan to reuse; F-Droid inclusion is straightforward.
- DCO keeps contribution friction to a one-line trailer.
Negative / risks
- GPL-incompatible components (CDDL, some OEM SDKs, proprietary codecs’ SDKs) cannot be linked. Accepted; none are needed.
- Companies with GPL-3 policies may not contribute or embed. Accepted.
- No relicensing is possible without every contributor’s consent. Accepted; “or later” covers the FSF’s future versions.
Alternatives considered
- MIT / Apache-2.0: maximum adoption, no protection against closed forks. Rejected.
- GPL-2.0-or-later (KDE Connect’s licence): compatible via “or later”, but choosing 2 signals nothing we want and complicates Apache-2.0 inclusion for people reading it as 2-only. Rejected.
- AGPL-3.0-or-later for everything: appropriate for the relay, unnecessary for client software and off-putting for app distribution. Deferred to the relay ADR.
- MPL-2.0 (file-level copyleft): allows proprietary combination at the binary level, which defeats the purpose. Rejected.
- CLA instead of DCO: enables relicensing but deters contributors and concentrates power in the maintainer. Rejected.
ADR-0010: Reachability: LAN first, path-agnostic transport, relay later
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer
- Tags:
protocol,networking,privacy
Context
Phone Link works from anywhere because every byte goes through Microsoft’s cloud with a Microsoft account on both ends. Tether has no account and no cloud (ADR-0003, ADR-0008), so the question is how far from the desk the phone can be.
Observations:
- The large majority of Phone Link use is at a desk, with phone and PC on the same Wi-Fi. The LAN case is where latency-sensitive features (mirroring, calls, clipboard) are viable at all.
- Cross-network reachability needs a rendezvous point: NAT traversal needs a signalling server, and the fallback for symmetric NATs is a relay. Both are infrastructure with uptime, abuse and cost implications, and a default hosted endpoint is a privacy decision users must be able to opt out of.
- Users who already run Tailscale/ZeroTier/WireGuard have a flat virtual LAN; a manual address (ADR-0004) makes Tether work across the internet today for them.
- Pushing wake-ups via FCM would require Play Services and a Google project.
- Whatever we build must not require protocol changes: the session is TLS between two pinned keys; a relay that forwards opaque bytes cannot read anything.
Decision
- LAN first. Milestones 1 to 4 target devices on the same network (or any routable path such as a VPN/mesh via manual address). No hosted service is required for any feature.
- Path-agnostic transport. Core code treats a connection as an opaque byte
stream carrying the TLS session (ADR-0002). Addresses are lists, not single
values; liveness comes from
Ping/Pong, never from discovery; reconnect logic is independent of how the stream was obtained. Timeouts are constants that a relay path may tune. - Relay in M5. A
tether-relaycrate: devices authenticate to the relay with their identity key (challenge signed with the P-256 key), rendezvous by the paired peer id, and the relay pipes bytes between the two; TLS stays end-to-end so the relay sees only metadata (ids, timing, volume). The phone keeps the relay socket open from the foreground service with adaptive keepalive; the desktop is always connected. Self-hostable (Docker image + docs); an optional hosted default may be configured but is never required and is off until the user opts in. UDP hole-punching for direct paths is an optimisation after that. - No FCM or other push service, ever.
Consequences
Positive
- M1 to M4 ship with zero infrastructure and zero privacy questions.
- The relay slots in without changing a single plugin or protobuf message.
- Power users get internet reachability today via a mesh VPN and a manual address; this is documented as a supported configuration.
Negative / risks
- Until M5 Tether is not at parity with Phone Link’s “works from anywhere”.
Documented in
docs/reference/feature-parity.md. - Mobile-data use through a relay costs battery and data; adaptive keepalive and a “LAN only” toggle mitigate.
- A hosted relay, if we ever run one, is an abuse target and a metadata collector. Mitigation: authenticated devices only, no accounts, no logging of payload, published source, self-host instructions first.
- Path-agnostic code is slightly more abstract than a LAN-only design. Accepted as the price of not rewriting core in M5.
Alternatives considered
- Cloud relay from day one (parity-first): infrastructure and privacy burden before the product exists. Rejected.
- libp2p or WebRTC data channels for NAT traversal: heavy dependencies on Android and Rust, their own identity models, and still need signalling servers. Rejected for now; hole-punching can be added narrowly later.
- Bluetooth as a transport fallback: low bandwidth, but works with no network at all; relevant for the iOS spike (ANCS) and possibly for notifications when Wi-Fi is off. Deferred; not a reachability solution.
- Require Tailscale: excellent for power users, unacceptable as a mandatory dependency. Documented as an option, not required.
ADR-0011: SMS: Tether is a non-default SMS app
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after the November 2026 research round
- Tags:
android,messages
Context
Phone Link shows the phone’s SMS/MMS threads on the PC and sends replies, while the phone keeps using its own Messages app (Samsung Messages or Google Messages, including RCS). It is not the default SMS app on the phone. Android’s SMS model since 4.4 (KitKat):
- Any app with
READ_SMScan read the SMS/MMS content providers (Telephony.Sms,Telephony.Mms,Telephony.Threads) and watch them with aContentObserver;RECEIVE_SMS/RECEIVE_MMS/RECEIVE_WAP_PUSHdeliver incoming messages as broadcasts to non-default apps too (after the default app). SmsManager.sendTextMessage/sendMultipartTextMessageworks from any app withSEND_SMS, and the system writes the sent SMS into the provider on the app’s behalf so it appears in the default Messages app.- Only the default SMS app may write to the providers directly: mark as read,
delete, create drafts, change thread state, or store received/sent MMS. A
non-default app sending MMS via
SmsManager.sendMultimediaMessagemust build the PDU itself and the sent MMS is not reliably recorded in the provider on all devices. - Becoming the default SMS app means replacing the user’s Messages app on the
phone with ours, losing RCS (no third-party RCS API exists; Google Messages and
Samsung Messages implement RCS privately) and committing to a full phone-side
messaging UI. Android does allow a temporary default switch
(
RoleManager/ACTION_CHANGE_DEFAULTprompt), which some backup apps use to perform writes and then switch back; it is a jarring two-prompt flow.
Phone Link’s known limitations here (read state not synced back to the phone, no delete from PC on most phones, RCS only on Samsung via a partnership) are consequences of exactly this model.
Decision
- Tether on Android is a non-default SMS app. It requests
READ_SMS,SEND_SMS,RECEIVE_SMS,RECEIVE_MMS,RECEIVE_WAP_PUSH,READ_CONTACTS,READ_PHONE_STATE(SIM info) at runtime in M2 onboarding. - It reads threads and messages from the providers with a
ContentObserverfor live updates, sends SMS withSmsManager(multipart, per-SIMsubscriptionId), and sends MMS by building the PDU (Klinkerandroid-smsmms, Apache-2.0, or our own encoder) andsendMultimediaMessage, recording sent MMS in Tether’s own cache when the provider does not. - It does not mark as read, delete or draft on the phone; the desktop keeps its own read state and unread counts per device. The desktop UI says so in the thread view (“Read status is not synced to the phone”).
- RCS is out of scope for the Messages feature (no public API). RCS conversations still reach the desktop as notifications with inline reply via the notifications feature, which is what Phone Link offers on non-Samsung phones.
- A later ADR may add an optional “temporary default” flow for delete if users ask; it is not planned.
Consequences
Positive
- The user keeps their Messages app, RCS, spam filtering and backups untouched.
- Scope stays bounded: no phone-side messaging UI, no MMS receiving/storing pipeline beyond reading what the default app stores.
- Same model and the same limits as Phone Link, so parity expectations are met rather than exceeded in confusing ways.
Negative / risks
- Read state and deletions do not propagate to the phone. Documented gap.
- MMS sending from a non-default app is the least-tested path on OEM firmware;
carrier APN settings must be read (
Telephony.Carriers, needsREAD_PRIVILEGED_PHONE_STATEon some versions, which we lack) or obtained viaSmsManager.getCarrierConfigValues. Mitigation: M2 verification on a real carrier; fall back to “open on phone” if MMS send fails. - The SMS permission group triggers Android’s “this app wants to read your messages” prompt; fine for sideload (ADR-0008).
- Dual-SIM handling depends on
READ_PHONE_STATEforSubscriptionManager. Accepted.
Alternatives considered
- Become the default SMS app: full phone-side messaging UI, loss of RCS, user disruption. Rejected.
- Temporary default switch for writes: two prompts per delete, confusing; deferred unless demanded.
- Notification-only messaging (reply via notification actions, no history): insufficient parity; it is already what the M1 notification feature gives, and M2 adds history on top.
- Read SMS via the notification listener only: misses history and attachments. Rejected.
ADR-0012: Intentional disconnect: Disconnect frame with hold semantics
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer, after Milestone 1 field testing on a Galaxy A55
- Tags:
protocol,reliability,ux
Context
Both the desktop app and the phone app offer a “Disconnect” button. In Milestone 1 it only closed the TCP connection. The other side’s reconnect loop treats a closed connection as a network failure and redials within a second, so the user saw the device reconnect immediately. The desktop side already parked its own redial timer for 60 s, but it still accepted the phone’s inbound connection, so the hold was invisible.
There is no protocol-level way to say “I am closing on purpose, do not come back”. Candidate designs:
- A
Disconnect{hold_seconds, reason}frame sent before closing; the receiver pauses auto-reconnect for the given time (0 = until a user acts). - Replace Disconnect with “Pause sync”: keep the session open, stop sending feature frames. No reconnect churn, but the connection stays up, the phone’s foreground service still shows “connected”, and every feature needs a paused state.
- Treat Disconnect as a soft unpair (remove trust until Connect). Destroys the pairing for a transient wish and would show a SAS prompt again.
Decision
Option 1. Both implementations send Disconnect{hold_seconds = 0, reason = "user"} and close when the user presses Disconnect. Receivers and senders hold:
the reconnect loop and discovery-triggered dials skip the peer until the hold
expires, the local user presses Connect (or pairs), or the peer dials in. A hold
is in-memory only; restarting the daemon or the phone service clears it. An
exiting daemon sends reason = "shutdown", which receivers treat as a hold that
discovery may lift. Disconnect is advertised with the disconnect
capability; against a peer without it the old behaviour (close, 60 s backoff)
applies.
On D-Bus the device gains a Held property so the UI can show “Disconnected —
press Connect to resume” instead of “Reconnecting…”.
Consequences
Positive
- Disconnect means disconnected until the user says otherwise, on both devices.
- Pairing and trust are untouched; reconnect is one click (or a phone reboot).
- Tiny protocol surface: one frame, one capability, two boolean fields of state.
Negative / risks
- An asymmetric hold is possible (one side restarted) and resolves itself on the next successful inbound connection; documented.
- A “disconnect for N minutes” UI is possible but not built;
hold_secondsis carried for it.
Alternatives considered
See options 2 and 3 above; both rejected for complexity or for destroying state the user did not ask to lose.
ADR-0013: Desktop data layer for Milestone 2: SQLite cache in tetherd, MPRIS, clipboard model
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer
- Tags:
linux,architecture,messages,media,clipboard
Context
Milestone 2 brings data that must outlive a window: message threads (thousands
of rows), contacts, a photo index, transfer history. ADR-0006 made tetherd the
only process that talks to the phone and D-Bus the only interface to UIs. The
questions are where the cache lives, how large datasets cross D-Bus, how phone
media reaches desktop media keys, and how clipboard sync can work on both X11
and Wayland.
Facts:
- A phone with years of SMS has tens of thousands of messages; the first sync must survive daemon restarts and be resumable per thread.
- D-Bus is fine for paged method calls of a few hundred dicts and for change signals; it is wrong for streaming megabytes (attachments, photos).
- MPRIS (
org.mpris.MediaPlayer2.*) is how every Linux desktop exposes media keys, lock-screen and panel controls. Exporting one player per phone makes phone playback controllable from existing applets without any Tether UI. - On X11 any client can watch and set the selection without focus (GDK uses XFixes). On Wayland a client reads the clipboard only when focused and can set it only with a recent input serial; no portal for a daemon exists on GNOME today.
Decision
- Cache in the daemon.
tetherdkeeps a per-device SQLite database (rusqlitewith the bundled SQLite) at$XDG_DATA_HOME/tether/devices/<id>/cache.dbwith tables for threads, messages, attachments, contacts, media items and transfers, plus desktop-local read state. Binary payloads (attachments, thumbnails, fetched media, contact photos) are files under$XDG_CACHE_HOME/tether/devices/<id>/…, referenced by path. The schema is versioned withPRAGMA user_versionand migrated on open. - Sync strategy. On connect the daemon requests conversations since its
newest known message, then pages missing threads oldest-newest in the
background (a few requests in flight), persisting as it goes; live
MessageEvents are applied immediately. Contacts are a delta sync keyed by(uid, version). The photo index is filled on demand when a client asks for items and refreshed onMediaChanged. - D-Bus shapes. Paged getters return
aa{sv}; changes are signals carrying the changed row (messages) or a hint to re-query (threads, contacts, media). Bulk bytes never cross D-Bus: methods return file paths in the daemon cache and clients copy them. - MPRIS in the daemon. For every connected phone with at least one media
session,
tetherdexportsorg.mpris.MediaPlayer2.tether_<id8>mirroring the active session and forwarding commands asMediaCommand;Volumemaps to themusicstream. - Clipboard. Phone → desktop: the daemon stores the text, emits
ClipboardReceivedand exposesLastClipboard; the GTK app (long-lived thanks to the tray) sets the desktop clipboard. On Wayland that succeeds only when the app can obtain a serial; otherwise the app posts a notification whose “Copy” action and the device page’s “Copy phone clipboard” button do it on user interaction. Desktop → phone: the GTK app watches the GDK clipboard (changedsignal; on X11 this works unfocused, on Wayland while focused) and callsSendClipboard; the app also offers an explicit “Send clipboard” action and the CLItether-cli clipboard send. Direction toggles live in the daemon config (ClipboardSync). Automatic phone → desktop sync remains an enhanced tier feature (M4). - Desktop notifications for messages. The daemon posts a freedesktop
notification for each new incoming message (sender name, snippet, “Reply”
action →
ReplyRequested-style signal handled by the GTK app) unless the thread is open in the app orMessageNotificationsis off. Incoming SMS also arrive as mirrored phone notifications; the daemon suppresses the mirror for the default SMS app’s package whilemessagesis active to avoid duplicates.
Consequences
Positive
- Messages, contacts and photos survive app restarts and are searchable offline; the first sync is incremental and restartable.
- Media keys, GNOME/Cinnamon media applets and
playerctlcontrol the phone. - One place (the daemon) holds state; the GTK app stays a thin client and a future Shell extension gets the same data.
Negative / risks
- SQLite adds a native dependency to
tetherd(bundled, no system package). - Wayland clipboard sync is best-effort and documented as such until a portal exists.
- Two copies of large media (daemon cache and wherever the user saves it); mitigated by a cache size cap (default 2 GiB, LRU) in a later milestone.
Alternatives considered
- Cache in the GTK app: loses data when the app is closed, duplicates work for every client. Rejected.
- Stream data over D-Bus (
hfile descriptors): workable but complex; paths in a daemon-owned cache are simpler and match how icons already work. - MPRIS in the GTK app: dies with the app and would require the app for media keys. Rejected.
- wl-clipboard / xclip subprocesses from the daemon: fragile across compositors and absent on minimal installs. Rejected as the primary path.
Amendment (2026-11-11): automatic two-way clipboard sync
User feedback during 0.2.0 testing asked for the clipboard to stay in sync both ways without pressing “Send”. Changes to the clipboard decision above:
- Phone → desktop is automatic when the user grants two permissions once
over adb:
READ_LOGSand theSYSTEM_ALERT_WINDOWapp-op. Android logsClipboardService: Denied/Denying clipboard access to <pkg>when it skips a background app’s clip listener; the app follows logcat for that line and starts a translucent activity that gains focus, reads the clip, sends it and finishes (the technique KDE Connect uses). Without the grants the Quick Settings tile, share sheet and notification action remain. This moves the “Clipboard phone to PC (automatic)” parity row from M4 to M2 as an enhanced-tier feature that needs only a one-time grant, not the shell helper (ADR-0007). - The daemon covers for a closed GTK app: when
org.tether.Tetheris not on the bus,tetherdsets the desktop clipboard withwl-copy/xclipand, on X11, polls the CLIPBOARD selection once a second to send desktop changes. Wayland still requires the focused app for desktop → phone. - The manual “Send clipboard” button and tray entry were removed from the GTK app.
Known costs: Android 13+ may show a “Tether pasted from your clipboard” toast for
each background read; the log line wording differs between AOSP and One UI, so
the watcher matches the common substring clipboard access to <pkg>.
ADR-0014: Bulk transfer over secondary TLS connections
- Status: accepted
- Date: 2026-11-08
- Deciders: maintainer
- Tags:
protocol,files,messages,photos
Context
ADR-0002 fixed a single framed control connection with a 4 MiB frame cap and
reserved StreamOpen for bulk data without specifying it. Milestone 2 needs
MMS attachments (both directions), file transfer (both directions) and photo
originals (phone → desktop), from a few KiB to several GiB. Options:
- Chunk bulk data into control frames (
Chunk{ref_id, offset, bytes}). Simple, but head-of-line blocking stalls notifications and media controls during a transfer, and every chunk is re-serialised. - One secondary TLS connection per stream carrying a
StreamOpenheader and raw bytes. Parallel to the control connection, no framing cost, cancellation by closing, backpressure from TCP. Costs one TLS handshake per stream. - A multiplexed secondary connection (HTTP/2-like). Most efficient, most code.
Decision
Option 2, as specified in docs/reference/protocol.md “Secondary streams”: the side that
has the bytes dials, sends one Envelope{StreamOpen} (no Hello), then exactly
size raw bytes and half-closes. The receiver verifies the peer is paired, maps
(peer, ref_id, index) to a pending request (waiting up to 10 s for the control
frame if it arrived first), enforces the announced size, writes to a temporary
file and renames on completion. At most four concurrent streams per peer;
TransferProgress for UI; TransferCancel for reasons. StreamOpen gains
name and mime hints and a new purpose MEDIA. Both implementations expose a
small “stream manager” (Rust tether-core::streams, Kotlin
transport/StreamManager.kt) used by messages, files and photos alike.
Consequences
Positive
- Control traffic stays responsive during transfers; a stalled transfer cannot kill the session.
- Zero extra framing; GiB-scale files are fine.
- Cancelling is closing a socket; resumption can be added later with an offset field without breaking receivers.
Negative / risks
- One TLS handshake per file (≈ 2 round trips on LAN); negligible for the file counts involved.
- Both sides must accept connections while running; the phone’s listener is already up with the foreground service, so phone → desktop and desktop → phone both work. Behind a relay (M5) streams will need the same path the control connection uses; ADR-0010 keeps transport path-agnostic.
- The out-of-order arrival window (10 s) is a small amount of state per peer.
Alternatives considered
Options 1 and 3 above. Option 1 was rejected for head-of-line blocking; option 3 for complexity that Milestone 2 does not need.
ADR-0015: Calls: control over Tether, audio over PipeWire’s native HFP hands-free role
- Status: accepted
- Date: 2026-11-11
- Deciders: maintainer, after the M3 research round
- Tags:
calls,bluetooth,audio,linux,android
Context
Phone Link handles calls by pairing the PC with the phone over Bluetooth: the PC becomes a hands-free unit (HFP HF) and the phone the audio gateway (AG), exactly like a car kit, while call control and caller information come over Phone Link’s own channel. Tether needs the same on Ubuntu 24.04-family desktops (PipeWire 1.0.5, WirePlumber 0.4.17) and newer (Debian 13, Ubuntu 26.04 with PipeWire 1.4–1.6, WirePlumber 0.5).
Research (November 2026, read-only on the target machine):
- PipeWire’s native BlueZ backend has implemented HFP HF since 0.3.22 (2021);
the 1.0.5
libspa-bluez5.socontains the HF AT command set and WirePlumber 0.4.17’s defaultbluez5.rolesalready includehfp_hfnext tohfp_ag, so existing headsets keep working. - PipeWire 1.0.5 has no call-control API; PipeWire ≥ 1.4 adds an oFono-style
org.ofonotelephony D-Bus API, not available on 24.04. - Alternatives: oFono as
bluez5.hfphsp-backend(replaces PipeWire’s native headset support, system service, fragile); hsphfpd (abandoned); our own HF implementation over a BlueZProfile1with SCO sockets and mSBC (4–6 weeks, adapter/kernel long tail). - Android: with the PC connected as HF and active, Telecom routes cellular call
audio to it automatically.
AudioManager.setCommunicationDeviceaffects only the app’s own VoIP audio,BluetoothHeadset.connectAudio()is privileged since API 33. A call-companionInCallService(CALL_COMPANION_APP, normal permission) can callsetAudioRoute(ROUTE_BLUETOOTH); to be verified on One UI. TelecomManager.acceptRingingCall/endCall(ANSWER_PHONE_CALLS),placeCall(CALL_PHONE),silenceRingerare available to normal apps; DTMF is not.
Decision
- Call control and call log travel over the Tether protocol (
calls.proto, docs/reference/protocol.md “Calls”). The phone uses Telecom/Telephony APIs for state and commands and the CallLog provider for history. Control works with or without Bluetooth. - Call audio uses PipeWire’s native HFP HF role.
tetherdhandles Bluetooth through BlueZ D-Bus (guided pairing with numeric comparison, trust, connect) and, during a call routed to the PC, selects the phone card’sheadset-head-unitprofile and links the phone’s HFP source to the default sink and the default source to the phone’s HFP sink (pipewire links viapw-link/wpctlor pipewire-rs), restoring the previous profile and links afterwards. The.debdepends onlibspa-0.2-bluetooth; a WirePlumber drop-in that pinsbluez5.roles(includinghfp_hf) and enables mSBC is installed only when the user’s configuration overrides the roles. - Routing on the phone: Telecom’s automatic routing to the active HF device
first; a call-companion
InCallServicefor explicitROUTEcommands where One UI allows it; otherwise “transfer to phone/PC” is done from the desktop by connecting/disconnecting the SCO link (HFPAT+BCC/ dropping the profile). - Fallback: if no HFP node appears or the phone does not open SCO within 3 s, the UI says “Audio on phone” and keeps control.
- Out of scope: in-call DTMF keypad (documented gap, like Phone Link on many phones), conference merge/swap, video calls. The PipeWire ≥ 1.4 telephony API may later replace parts of the routing logic.
Amendment 2026-11-15: field findings on PipeWire 1.0.5 and Android 16
- With the phone as audio gateway PipeWire creates the HFP nodes only while
the phone holds the SCO link open, and as streams (
Stream/Output/Audio,Stream/Input/Audio, roleCommunication) that WirePlumber links to the default devices.tetherdtherefore treats “the nodes exist” as “audio is on the PC”, checks once a second during a call and only adds missing links. - The PC cannot open SCO (no node to start), so “transfer to the PC” always goes through the phone. “Transfer to the phone” works from the PC by switching the phone card off for a moment, which closes SCO.
- Telecom binds our
InCallServiceonly with the app-opMANAGE_ONGOING_CALLS(adb, one-time, survives reboots);telecom add-or-remove-call-companion-apphas no effect on One UI 8.5. With it,ROUTEto Bluetooth, earpiece and loudspeaker all work.
Consequences
Positive
- No new system services or audio backends; earbuds and other headsets keep their behaviour.
- Call control is available even without Bluetooth (e.g. Bluetooth off, desktop without an adapter).
- Small daemon surface: BlueZ D-Bus plus a few PipeWire links.
Negative / risks
- mSBC wideband depends on the adapter; otherwise CVSD narrowband.
- The phone may prefer another active HF/headset (earbuds) for calls; the UI must explain “PC is the active call device”.
- The phone will also see the PC as an A2DP sink; media may start playing on
the PC. A WirePlumber rule can restrict the phone card to
hfp_hf. - Echo: PipeWire’s echo-cancel module on the mic path is recommended and documented.
- Bluetooth must be on; on this test machine it is rfkill-blocked by default.
Alternatives considered
oFono backend, hsphfpd and a custom HF stack (see Context), all rejected for M3; the custom stack remains the fallback if the native role proves unusable.
ADR-0016: adb integration: private adb server, QR pairing, Avahi discovery, reverse tunnel
- Status: accepted
- Date: 2026-11-15
- Deciders: maintainer, after the M4 research round (
docs/notes/m4-research-desktop.md) - Tags:
linux,android,adb,security
Context
The enhanced tier (ADR-0007) needs the daemon to obtain and keep adb access to the phone without the user touching a terminal: pair over Wireless debugging, find the phone again when its port changes, notice when debugging is switched off (Samsung does that on reboot), and start the shell helper. Research findings that constrain the design:
- No Rust crate implements Wireless debugging pairing (SPAKE2 over TLS);
adb_clientforwardspairto an adb server. - adb’s own mDNS is unusable: Debian 13’s adb 34.0.5 is built without it and
the Google 35.0.0 binary answers
mdns daemon unavailablehere. We already use Avahi for Tether discovery. adb pair(before 34.0.5) andadb connectexit with 0 on failure.- A developer who uses adb expects
adb kill-serverand their device list to be their own. - Android Studio pairs by showing a QR code
WIFI:T:ADB;S:<name>;P:<password>;;that the phone scans under Wireless debugging; the phone then advertises_adb-tls-pairing._tcpwith that service name.
Decision
- Shell out to the
adbbinary (distro package, version ≥ 34.0.0, parsed fromadb version). Output is parsed; exit codes are not trusted. Onlyhost:track-devices-lis spoken directly to the adb server for event-driven device state. - Private adb server by default: own key directory
(
$XDG_DATA_HOME/tether/adb, viaHOME/ANDROID_USER_HOMEoverride), own server port (ANDROID_ADB_SERVER_PORT, default 5038),ADB_MDNS=0. The user’s own server and key are not touched and the phone does not show up in their tools through us. Configadb_server = "private" | "shared". A phone attached by USB is visible to whichever server owns the USB interface; in private mode our server leaves USB to the user’s (ADB_USB=0) and USB set-up goes through the shared server on request. - Pairing: QR flow first (the GTK app renders the payload; the daemon
browses
_adb-tls-pairing._tcpwith Avahi, matches the service name and runsadb pair ip:port password), 6-digit code as fallback (same browse, user types the code). - Connecting: Avahi browse of
_adb-tls-connect._tcp;adb connect ip:port; re-run whenever the service appears or its port changes. - Linking an adb device to a paired phone: the daemon sends a one-time
token with
adb shell am broadcast -n org.tether.android/.enhance.AdbLinkReceiver --es token …(receiver guarded byandroid.permission.DUMP, which only shell and system hold); the app returns it inAdbLinkover the Tether session. Serial ↔ device id is stored inconfig.toml. - Helper transport:
adb reverse localabstract:tether_<nonce> tcp:<port>to a daemon listener on 127.0.0.1 with an ephemeral port; the helper opens separate connections for control and each media stream. Every connection authenticates with a one-time token that the daemon writes to the helper’s stdin (never argv, whichpsshows). - State:
EnhancedStateper device (docs/reference/dbus-api.md). When Wireless debugging is off and the app holdsWRITE_SECURE_SETTINGS(one of the grants), the daemon asks the app to switch it back on (AdbWifiRequest).
Amendment 2026-11-15 (M4.1 implementation)
The private server carries Wi-Fi connections only. A USB-attached phone is
reached through the user’s default adb server and key, which the daemon
starts only when a phone is linked or SetUpEnhanced() is called. The stored
serial is the hardware serial, because Wi-Fi transport serials change with
the port. Details: docs/reference/dbus-api.md “Implementation notes and deviations
(M4.1)”.
Consequences
Positive
- One code path for USB and Wi-Fi after the device is connected.
- No interference with the user’s development adb.
- Pairing without typing; reconnect without user action in the common case.
Negative / risks
- Depends on output strings of
adb; covered by parser tests with captured output and a version floor. - A second adb server process while Tether runs.
- Anyone local can connect to the 127.0.0.1 listener; the token gates it.
- A desktop with adb authorisation has a full shell on the phone (ADR-0007).
- Auto Blocker’s effect on Wireless debugging and the
WRITE_SECURE_SETTINGSre-arm on One UI are unverified until tested on the A55.
Alternatives considered
- Native adb protocol in Rust: no pairing implementation exists; large.
- Shared server only: simplest, but
adb kill-serverby the user or an IDE drops mirroring, and our phone appears in their device lists. - Helper dials the daemon over LAN TLS: saves the tunnel hop, needs the helper to carry TLS and the pinned identity; kept as a later optimisation.
- Unix-socket reverse target (
localfilesystem:): untested with distro adb.
ADR-0017: Shell helper: app_process entry point in the APK, probed abilities, own protocol
- Status: accepted
- Date: 2026-11-15
- Deciders: maintainer, after the M4 research round (
docs/notes/m4-research-shell-helper.md) - Tags:
android,protocol,security
Context
ADR-0007 decided that privileged features run in a helper started through adb as the shell uid. The research round compared what works from uid 2000 on Android 14, 15 and 16 (scrcpy 5.x and AOSP as references) and found that the hidden APIs involved break in monthly and quarterly updates, not only in major releases, and that Samsung adds its own failures.
Decision
- Entry point
org.tether.shell.Mainin the app’s own dex, started withCLASSPATH=<apk> app_process / org.tether.shell.Main. The helper packageorg.tether.shelluses no resources, AndroidX or JNI and is kept by R8 rules. It sets up a fake context for packagecom.android.shellbefore any system service is touched (including the Samsung configuration-controller fix), and exits when its control connection or stdin closes. - Own protocol (
proto/tether/v1/shell.proto,docs/reference/protocol.md“Enhanced tier”):ShellEnvelopeframes on a control connection, and one connection per mirror carrying video packets one way and input events the other. The desktop end of a mirror connection is passed to the GTK app as a file descriptor. - Probed abilities: at start the helper tests each feature against the
running build and lists what works in
ShellHello.abilities. The desktop hides what is missing. A feature that later throws answersShellResult{ok = false}and never takes the helper down. - Main-display mirroring through the hidden
DisplayManager.createVirtualDisplay(name, w, h, displayIdToMirror, surface); display changes throughIWindowManager.registerDisplayWindowListener; MediaCodec surface encoder, H.264 by default; input injected to display 0 in device coordinates. - Screen off through
SurfaceControl.setDisplayPowerMode(DisplayControl class-loader path on 14+),cmd display power-offas fallback on 15+, restored by a detached cleanup process if the helper dies; a user-activity ticker keeps the device awake while a mirror asks for it. - Clipboard through the real
ClipboardManageron the fake context. - Grants by executing a fixed list of
pm/appops/cmd/dumpsyscommands and reading the state back; the desktop cannot send arbitrary commands.RECEIVE_SENSITIVE_NOTIFICATIONSis set withappops, sincepm grantcannot grant asignature|rolepermission. - App list (M4.2) comes from the normal app over the Tether session; the helper only launches apps.
- Phasing: M4.1 mirror of the main display with input, screen off, clipboard, grants. M4.2 per-app virtual displays and phone audio. M4.3 camera.
Consequences
Positive
- No second APK or download; the helper always matches the app version.
- A broken hidden API costs one feature, not the tier.
- Video and input bypass the daemon.
Negative / risks
- Reflection against hidden APIs needs upkeep with every Android release.
FLAG_SECUREwindows stay black; there is no workaround from shell.- Typing into a new display is reported as unreliable on Android 16 / One UI 8.5 (scrcpy issue 6909); M4.2 needs paste and UHID paths.
- The helper dies with the adb connection; the daemon restarts it.
Alternatives considered
- Shizuku or a root helper: extra app or root; adb is the common denominator.
- MediaProjection in the normal app: consent per session, no input, no screen-off, no virtual displays (ADR-0007).
- Reusing the main
Envelope: the helper is not the paired app and has no identity; a separate, token-gated protocol keeps the trust model simple.
ADR-0018: Mirror media pipeline on the desktop: GStreamer with a statically linked GTK4 sink
- Status: accepted
- Date: 2026-11-15
- Deciders: maintainer, after the M4 research round (
docs/notes/m4-research-desktop.md) - Tags:
linux,gtk,packaging
Context
The mirror window must decode H.264 from a socket and show it in a GTK4
widget with low latency, from one .deb that installs on Ubuntu 24.04,
Linux Mint 22 and Debian 13. gtk4paintablesink is packaged only on
Debian 13. libavcodec’s soname differs between Ubuntu 24.04 and Debian 13.
Decision
- GStreamer through gstreamer-rs, with
gst-plugin-gtk4linked statically into thetetherbinary (the release line matching our gtk4 bindings). Pipeline:appsrc ! h264parse ! <decoder> ! glsinkbin (gtk4paintablesink), live, unsynchronised, late frames dropped. Decoder picked at run time:vah264dec,nvh264dec, thenavdec_h264,openh264dec. - The GTK app reads the mirror connection it receives as a file
descriptor from the daemon (
StartMirror) and writes input events to it. - Phone audio (M4.2) is decoded in the daemon with GStreamer
(
appsrc ! opusdec ! audioconvert ! audioresample ! pulsesink), so it plays without the window. - Webcam (M4.3):
v4l2sinkinto v4l2loopback with guided module set-up; a PipeWire camera node as an optional second output. - Packaging: build-depends
libgstreamer1.0-dev,libgstreamer-plugins-base1.0-dev; the.debdepends ongstreamer1.0-plugins-base,-good,-gland recommendsgstreamer1.0-plugins-bad,gstreamer1.0-libav. The mirror code sits behind the cargo featuremirror(default on) so the app still builds without the GStreamer headers.
Consequences
Positive
- One binary across the target distributions; hardware decode where the system has it.
Negative / risks
- Larger binary and a longer build.
- Software decode may add frames of delay; to be measured against the 100 ms target.
- VA-API and the Wayland dmabuf path cannot be tested on the author’s NVIDIA machine.
Alternatives considered
- ffmpeg bindings with our own texture upload: soname mismatch across the target distributions.
- Depending on a packaged
gstreamer1.0-gtk4: absent on Ubuntu 24.04 and Mint 22.
ADR-0019: Phone as webcam: shell-helper camera into a v4l2loopback device owned by the daemon
- Status: accepted
- Date: 2026-11-28
- Deciders: maintainer, from the M4 research round (
docs/notes/m4-research-shell-helper.mdsection 8,docs/notes/m4-research-desktop.mdsection C.2) - Tags:
android,linux,packaging
Context
Milestone 4.3 makes the phone’s camera usable as a webcam in video call apps
on the PC. Zoom, Teams, Discord, Slack and the default browser builds on
Mint 22 / Ubuntu 24.04 list V4L2 devices only; PipeWire camera nodes are not
shown without the user changing browser settings. A V4L2 device that is not
backed by hardware needs the out-of-tree kernel module v4l2loopback, and
loading a module needs root.
On the phone, the shell user holds android.permission.CAMERA and can open
Camera2 from the helper without a visible activity or a foreground service.
Decision
- Capture in the shell helper (enhanced tier only).
CameraManagerthrough its hidden constructor on the fake context, with the Android 16ActivityManagercontext patch. The camera renders straight into a MediaCodec input surface at one of the sizes the camera lists forMediaCodec; there is no GL stage and no rotation on the phone. Abilitycamerais probed at start (a camera list can be read). MessagesCameraListRequest/CameraList,CameraStart,CameraConfigure,CameraStop,CameraEnded, and aCAMERAconnection with the mirror record framing (shell.proto). One capture at a time. - The daemon owns the webcam. It reads the CAMERA connection and runs
appsrc ! h264parse ! <decoder> ! videoflip ! videoconvert ! videoscale (borders) ! videorate ! video/x-raw,format=YUY2,<fixed size and rate> ! v4l2sink. The device format is fixed for as long as the daemon holds the device (default 1280 x 720 at 30 fps); rotation, flip and a camera switch change the picture inside that frame, never the format. Cargo featurewebcamintetherd, default on, shares the GStreamer dependency withaudio. - The webcam is a switch per phone (
Webcam), like phone audio: on means the phone’s camera is open and the V4L2 device is fed. One phone at a time feeds the device. There is no start-on-demand when a call app opens the device: v4l2loopback 0.12.7 (Ubuntu 24.04, Mint 22) has no client-usage event. - The device stays open across captures. An output stage
(
appsrc ! v4l2sink) is held while the switch is on and is fed black frames whenever no capture runs; each capture gets its own decode stage. A camera switch, a retry or a helper restart does not close the device. The output caps are taken from the sink pad, becausev4l2sinkrejects caps without the device’s colorimetry. - Orientation is set by the user (
rotation0/90/180/270,flip), stored per phone. The helper reports facing and sensor orientation; it does not track how the phone is held. - v4l2loopback set-up is explicit and guided, never implicit. The daemon
reports the machine’s state (
WebcamSetupState:not_installed,not_loaded,no_device,ready, plus a reason such as a Secure Boot key rejection) and uses the loopback device whose card label isTether Phone Camera(or the configuredwebcam_device).SetUpWebcamruns the packaged script/usr/libexec/tether/tether-webcam-setupthroughpkexec(polkit actionorg.tether.webcam-setup):loadrunsmodprobe v4l2loopback devices=1 video_nr=<free> card_label="Tether Phone Camera" exclusive_caps=1, or adds a device withv4l2loopback-ctl addwhen the module is already loaded by someone else (v4l2loopback 0.13 and later only; 0.12.7 has no control device, there the script stops with an instruction to unload the module);persistalso writes/etc/modprobe.d/tether-webcam.confand/etc/modules-load.d/tether-webcam.conf;removedeletes those files. The script takes no free-form arguments. - Packaging:
Suggests: v4l2loopback-dkms, v4l2loopback-utils. The package is not pulled in by default because it installs DKMS, kernel headers and a compiler. The set-up page shows the install command when the module is missing.
Consequences
Positive
- Every call app sees the camera, with no visible activity on the phone.
- No root in the daemon; one polkit prompt, with a fixed script.
- The device format never changes under a consumer.
Negative / risks
- DKMS can fail after a kernel update; Secure Boot needs an enrolled machine owner key. Both can only be explained, not fixed, by Tether.
- With
exclusive_caps=1the device is listed by apps only while the daemon feeds it, so the switch must be on before the call app looks. - The camera stays on while the switch is on (privacy indicator on the phone, battery).
- Camera access from shell depends on hidden API details that changed in Android 16 once already.
- Behaviour with the phone locked and with the camera privacy switch on is not known before the first device test.
Alternatives considered
- PipeWire
Video/Sourcenode (pipewiresink mode=provide): no root and no module, but not listed by the call apps and default browsers on the target distributions. Kept as a possible second output later (ADR-0018). - Camera in the normal app (foreground service type
camera): works without adb, but must be started from a visible activity each time and shows an ongoing notification. Left for a later milestone as the fallback for phones without the enhanced tier. - Loading the module from the package’s postinst: surprises users who do not use the webcam and fails noisily under Secure Boot.
- Rotating on the phone with a GL stage: more hidden-API surface in the helper for something the desktop does in one element.
Contributing to Tetheron
Tetheron connects an Android phone to a Linux desktop. The repository holds a
Kotlin and Compose app for Android (android/), a Rust workspace for the
desktop (desktop/: the daemon tetherd, the GTK app tether, tether-cli)
and the protobuf schemas both sides share (proto/).
Ways to help
- Test on your phone and distribution. Tetheron is developed against a small number of devices, so a report that something works or fails on another phone model, Android skin, distribution or desktop session is useful. The supported platforms page shows what has been checked, and the verification checklists give you steps to follow.
- Report bugs. Follow Report a bug. Report
security problems privately, as described in
SECURITY.md. - Write code. Fix a bug, finish an open item from the roadmap, or pick an issue. Say in the issue that you are working on it.
- Improve the documentation. See Write documentation.
Translations are not possible yet. The text of both apps is in English in the source code and neither app has a translation catalogue. Adding one is a code contribution to discuss in an issue first.
Where to start
- Work through the tutorial. It takes you from a fresh clone to a running daemon paired with a fake phone. You need neither an Android phone nor the Android toolchain.
- Read the architecture page and the repository layout.
- Before you open a pull request, read Submit a pull request.
Pages in this guide
| Page | What it is for |
|---|---|
| Tutorial: build and run without a phone | Build, test, run the app against a fake daemon and the daemon against a fake phone |
| Set up a development environment | Install the Linux and Android toolchains and prepare a test phone |
| Build, run and install from source | Build each part, run debug builds in place of or beside the installed ones, build the APK and the .deb |
| Test your changes | Unit tests, what CI runs, the fake backends, the manual checklists and the rules for tests on a real phone |
| Debug Tetheron | Logs on both sides, D-Bus inspection, call audio, the enhanced tier and the mirror window |
| Add or change a protocol feature | Change proto/, the Rust side and the Kotlin side together |
| Submit a pull request | Branches, commit messages, sign-off and review |
| Write documentation | Page kinds, language and Markdown conventions of this site |
| Package and release | Version numbers, tags, the .deb and the signed APK |
| Repository layout | What lives in which directory and crate |
| Code style | Rules for Rust, Kotlin, protobuf and shell |
| Platform findings | Behaviour of Android, vendor skins and Linux desktops that the code depends on |
Ground rules
- Do not contribute code or knowledge obtained by reverse engineering proprietary software. Code from open-source projects may be reused only under a licence compatible with GPL-3.0, and must be credited.
- Contributions are licensed GPL-3.0-or-later. Every commit carries a
Signed-off-byline (git commit -s). There is no contributor licence agreement. - Reviews talk about code, not people. The code of conduct applies everywhere in the project.
Names
The project is called Tetheron. Programs, crates, D-Bus names, the Android
package and paths still use tether (tetherd, tether-core,
org.tether.Daemon1, org.tether.android, ~/.config/tether). They will be
renamed together in a later release (see the roadmap), so do
not rename them piecemeal.
How decisions are made
Anything that is expensive to reverse is recorded as an architecture decision record (ADR): the shape of the protocol, cryptography, a platform mechanism, a dependency on a system service, the packaging format, the licence. The list of ADRs answers most “why not X” questions. To change an answer, propose a new ADR that supersedes the old one in a pull request. Small implementation choices need only a code comment or a line in the pull request.
The roadmap records what each milestone contains and what has shipped. A pull request that completes a feature updates the roadmap and the feature table.
Tutorial: build and run Tetheron without a phone
In this tutorial we take a fresh clone of Tetheron and end with three things working on one Linux computer:
- the desktop workspace built and its tests passing,
- the GTK app running against its built-in fake daemon,
- the real daemon paired with a fake phone, driven from the command line.
We need neither an Android phone nor the Android toolchain. Allow about half an hour, most of it for the first compilation. The tutorial is written for Ubuntu 24.04 and Linux Mint 22.
Important
You can follow this tutorial on a computer where Tetheron is already installed and paired with your phone. Every command below uses its own bus name, its own ports and its own directory,
~/tether-tutorial, so the installed daemon, its settings and its data are never touched. That only holds if you type the commands as they are written, including the environment variables in front of them.
1. Install the build tools
Install the libraries that the desktop side builds against:
sudo apt update
sudo apt install git curl \
libgtk-4-dev libadwaita-1-dev libdbus-1-dev pkg-config build-essential \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-libav gstreamer1.0-gl
The build needs Rust 1.85 or newer, which the distribution’s archive does not have. Install the current stable Rust with rustup and accept the default choices:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Open a new terminal so that cargo is on the PATH, then check the version:
rustc --version
We see a version number of 1.85 or higher.
2. Get the source
git clone https://github.com/tetheron/tetheron.git
cd tetheron/desktop
All commands in the rest of the tutorial run in this desktop directory.
3. Build the workspace
cargo build --workspace
The first build compiles every dependency and takes several minutes. It ends with a line like this:
Finished `dev` profile [unoptimized + debuginfo] target(s) in 4m 12s
We now have three programs in target/debug/: the daemon tetherd, the GTK
app tether and the command-line tool tether-cli.
4. Run the tests
cargo test --workspace
Cargo prints one block per crate and per integration test. Every block ends
with a line that starts with test result: ok., and none reports a failure:
test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
The numbers differ from crate to crate.
5. Make a directory for the tutorial
The GTK app and the daemon store settings and data in your home directory. We give them a directory of their own:
mkdir -p ~/tether-tutorial/config/tether ~/tether-tutorial/data ~/tether-tutorial/cache
6. Run the app against its fake daemon
The GTK app can be built with a fake daemon inside it, which invents two devices and a stream of events:
XDG_CONFIG_HOME=$HOME/tether-tutorial/config \
XDG_DATA_HOME=$HOME/tether-tutorial/data \
cargo run -p tether-gtk --features mock -- --mock
Cargo compiles the app once more with the mock feature and opens its window.
In it we see:
- two devices, Galaxy S24 and Pixel Tablet,
- a battery level that drains and notifications that arrive on their own,
- after about 8 seconds a request to pair,
- after about 12 seconds an incoming call.
Nothing here is real. Click through the tabs, answer the call, send a message.
Note
About 45 seconds after the start the fake phone sends a clipboard text, and the app puts it on your desktop clipboard, as it would for a real phone. If you have something on the clipboard that you still need, paste it first.
Closing the window may leave the app running in the system tray. Press
Ctrl+C in the terminal to stop it.
The mock app has its own application id, org.tether.Tether.Mock, so it opens
a window even when the installed app is running.
7. Start the real daemon under a private name
A daemon normally takes the bus name org.tether.Daemon, listens on port 7360
and reads ~/.config/tether. An installed daemon already does all of that, so
ours gets a different bus name, different ports and the tutorial directory.
First we write a configuration file for it:
cat > ~/tether-tutorial/config/tether/config.toml <<'EOF'
discoverable = false
show_desktop_notifications = false
message_notifications = false
clipboard_sync = "off"
adb_path = "/nonexistent/adb"
EOF
With these five lines the daemon does not announce itself on the network, does not show the fake phone’s notifications on the desktop, does not send the desktop clipboard to the fake phone, and does not use adb. Every setting is described in Configuration and files.
Then we start the daemon:
TETHER_BUS_NAME=org.tether.Debug \
TETHER_PORT=7362 \
TETHER_PEER_PORT=7363 \
XDG_CONFIG_HOME=$HOME/tether-tutorial/config \
XDG_DATA_HOME=$HOME/tether-tutorial/data \
XDG_CACHE_HOME=$HOME/tether-tutorial/cache \
cargo run -p tetherd
The daemon logs to the terminal. The first start pauses for a few seconds while GStreamer indexes its plug-ins into the new cache directory. Among the lines we see these (timestamps left out, and the id and the name are those of your computer):
INFO tetherd: tetherd 0.4.1 starting as "my-computer" (config /home/me/tether-tutorial/config/tether/config.toml)
INFO tether_core::core: tether core: id 8baf3454… name "my-computer" listening on TCP port 7362
WARN tetherd::features::enhance: enhanced tier unavailable: adb_path "/nonexistent/adb" is not an executable
INFO tetherd: D-Bus: owning org.tether.Debug
The adb warning comes from the last line of our configuration file. The line
D-Bus: owning org.tether.Debug tells us that the daemon is ready. Leave it
running in this terminal.
8. Connect the fake phone
tether-core contains an example program that behaves like a phone. Open a
second terminal, change to the desktop directory, and start it:
cargo run -p tether-core --example fake_phone -- \
--port 7363 --dial 127.0.0.1:7362 \
--data $HOME/tether-tutorial/fake-phone --no-beacon --no-mdns
The fake phone listens on port 7363 and dials our daemon on port 7362.
--no-beacon and --no-mdns stop it from announcing itself on the network,
where an installed daemon would pick it up. It prints:
fake phone Fake Phone id 5e9907fd… on port 7363 caps []
device added 8baf3454
INFO tether_core::core: session 1 up: my-computer (8baf3454) Outbound 127.0.0.1:7362 paired=false
device 8baf3454 "my-computer" paired=false connected=true reachable=false held=false state=none
The two programs are connected but do not trust each other yet: paired=false.
9. Pair the two from the command line
Open a third terminal and change to the desktop directory. tether-cli
talks to the daemon over D-Bus. We point it at our daemon for this terminal:
export TETHER_BUS_NAME=org.tether.Debug
Important
Without
TETHER_BUS_NAME,tether-clitalks to the installed daemon. Use this terminal for everytether-clicommand in this tutorial.
List the devices that our daemon knows:
cargo run -p tether-cli -- devices
ID NAME KIND PAIRED CONNECTED BATTERY STATE
5e9907fd40bc Fake Phone phone no yes - none
The id is different on your computer. A real phone on your network that runs the Android app may be listed too, as not paired. Our daemon only lists it and never connects to it.
Ask for pairing with the fake phone:
cargo run -p tether-cli -- pair <id>
Replace <id> with the start of the id from the list, for example 5e99.
The command prints a six-digit pairing code and asks whether the codes match:
pairing requested with Fake Phone; waiting for the phone…
Pairing code: 505 310
Make sure the same code is shown on Fake Phone.
Do the codes match? [y/N] (Enter = N, reject)
In the second terminal the fake phone shows the same code and has already confirmed its side:
SAS for 8baf3454: 505310
auto-confirming
The codes are the same, so we type y and press Enter. The command ends
with:
confirmed; waiting for the phone…
paired with Fake Phone
The desktop and a real phone pair with the same exchange. The security model explains what the code protects against.
10. Look at what the phone sent
Once the two are paired, the daemon asks the phone for its data. In the second terminal the fake phone lists the requests it answers:
-> my-computer: battery 93% + notification #1
<- 8baf3454 ConversationsRequest since 0 -> 3 threads
<- 8baf3454 ContactsRequest (0 known) -> 2 upserts
In the third terminal we ask the daemon for some of it:
cargo run -p tether-cli -- devices
cargo run -p tether-cli -- notifications <id>
cargo run -p tether-cli -- conversations <id>
devices now shows yes under PAIRED and a battery level. notifications
lists a notification from the app “Fake Chat”. conversations lists three
message threads.
While the fake phone is connected, your desktop’s media controls may show a player for it, because the fake phone reports a playing media session.
11. Stop and clean up
-
In the second terminal, press
Ctrl+Cto stop the fake phone. -
In the first terminal, press
Ctrl+Cto stop the daemon. It logsSIGINT receivedandshutting down. -
Close the third terminal, or run
unset TETHER_BUS_NAMEin it. -
Remove the tutorial’s data, which includes the fake phone’s identity:
rm -r ~/tether-tutorial
The mock and the fake phone are the everyday tools for work on the desktop side. Test your changes lists their other switches, and Build, run and install from source shows how to run a debug build with a real phone.
Set up a development environment
This page lists what to install to build and test Tetheron on Ubuntu 24.04, Linux Mint 22 or a later release of either. Set up only the parts you work on: the desktop side builds without the Android toolchain, and the Android app builds without Rust. For a guided first run, follow the tutorial.
Set up the Linux toolchain
-
Install the libraries and plug-ins that the desktop workspace builds and tests against. CI installs the same list (
desktop.yml):sudo apt install \ libgtk-4-dev libadwaita-1-dev libdbus-1-dev pkg-config build-essential \ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \ gstreamer1.0-libav gstreamer1.0-glPackages Needed for libgtk-4-dev,libadwaita-1-dev(1.5 or newer)the GTK app libdbus-1-dev,pkg-config,build-essentialevery crate libgstreamer1.0-dev,libgstreamer-plugins-base1.0-devthe mirror window of the app (feature mirror) and phone audio and webcam in the daemon (featuresaudio,webcam)gstreamer1.0-plugins-base,-good,-bad,-libav,-glrunning the mirror window and phone audio. The decoder tests skip a decoder that is not installed On Fedora, the same libraries are in
gtk4-devel libadwaita-devel dbus-devel gcc pkgconf-pkg-config gstreamer1-devel gstreamer1-plugins-base-devel. On Arch Linux they are inbase-devel gtk4 libadwaita dbus gstreamer gst-plugins-base. The run-time plug-ins are the ones in Install Tetheron on Linux. CI builds on Ubuntu only.You do not need
protoc. The Rust build compiles the.protofiles withprotox. -
Install Rust with rustup. The minimum supported version is the
rust-versionindesktop/Cargo.toml, currently 1.85. CI builds with the latest stable release, so a lint that is new there can fail CI although your older toolchain accepts the code. Nightly features are not used. -
Add the two components that CI runs:
rustup component add rustfmt clippy -
Build and test the workspace:
cd desktop cargo build --workspace cargo test --workspace
Programs the daemon uses at run time
The daemon builds without these, and reports the features that need them as unavailable. The Debian package depends on or recommends them.
| Program or package | Used for |
|---|---|
avahi-daemon | mDNS discovery. Without it the daemon falls back to UDP beacons and manual addresses |
adb, version 34.0.0 or newer | the enhanced tier |
pw-dump, pw-link, pw-metadata, pipewire (package pipewire-bin), wpctl (package wireplumber), libspa-0.2-bluetooth, bluez | call audio on the PC |
xclip (X11) or wl-copy (Wayland) | setting the desktop clipboard while the GTK app is not running |
wmctrl | keeping the call banner and “stay on top” windows above others on X11 |
v4l2loopback-dkms, v4l2loopback-utils | phone as webcam |
Optional tools
To build the Debian package, install cargo-deb. Add lintian
(sudo apt install lintian) to lint the package as CI does.
cargo install cargo-deb --locked
To preview this documentation, install the mdBook version that CI uses (see Write documentation):
cargo install mdbook --locked --version 0.5.4
Set up the Android toolchain
You need this only to build the Android app or to run its unit tests.
-
Install a JDK. CI builds with JDK 21 (Eclipse Temurin). JDK 17 also works, because the app is compiled for Java 17. Check with
java -version. -
Install the Android SDK packages that the build uses: platform 35, build tools 35.0.0 and the platform tools (which contain
adb). With the SDK’ssdkmanager:sdkmanager --sdk_root=$HOME/Android/Sdk \ "platforms;android-35" "build-tools;35.0.0" platform-tools -
Tell Gradle where the SDK is. Either set
ANDROID_HOMEto the SDK directory, or createandroid/local.properties(git ignores the file), with your user name in place of<you>:sdk.dir=/home/<you>/Android/Sdk -
Run the unit tests and build the debug APK:
cd android ./gradlew :app:testDebugUnitTest :app:assembleDebugThe wrapper downloads the Gradle version the project uses (8.11.1) on the first run.
Android Studio is optional. CI runs the command-line build above
(android.yml).
The Wire Gradle plug-in generates the Kotlin classes for the protocol from
proto/ at build time.
Prepare a phone for testing
The app needs Android 14 or newer (minSdk = 34).
-
On the phone, turn on Developer options: open Settings, then About phone, then Software information, tap Build number seven times and enter your PIN. These are the names on Samsung phones. Other phones name them slightly differently.
-
In Settings, open Developer options and turn on USB debugging.
-
Connect the phone with a USB cable. The phone asks whether to allow USB debugging from this computer. Tick Always allow from this computer and accept. The authorisation can be lost after the cable is replugged or debugging is toggled. Accept the prompt again when that happens.
-
Check that adb lists the phone as
device(unauthorizedmeans the prompt was not accepted):adb devices -
Install the app as described in Build, run and install from source.
Some features need permissions that can only be given over adb. The enhanced tier set-up applies them for you. The list is in Android permissions and grants.
Warning
A test phone is often the phone you use every day. Before you run any test that captures the screen, audio, the clipboard or the camera, read “Test against a real phone” in Test your changes.
Without a spare phone you can still work on most of the desktop side: the GTK app has a fake daemon and the daemon has a fake phone, both described in Test your changes.
Editors
The repository ships no editor or IDE configuration, and git ignores .idea/
and .vscode/. The tools define the formatting: cargo fmt for Rust and the
official Kotlin style (kotlin.code.style=official) for Kotlin. See
Code style.
Build, run and install from source
This page shows how to build each part of Tetheron and run what you built, in place of an installed copy or beside it. First set up a development environment.
Build the desktop side
All Cargo commands run in desktop/.
cd desktop
cargo build --workspace
The programs are in target/debug/:
| Program | Crate | What it is |
|---|---|---|
tetherd | tetherd | the daemon |
tether | tether-gtk | the GTK app |
tether-cli | tether-cli | the command-line client of the daemon |
To build one crate, name it: cargo build -p tetherd. With --release the
build is optimised and the programs are in target/release/.
Choose Cargo features
| Crate | Feature | Default | Effect |
|---|---|---|---|
tether-gtk | tray | on | Tray icon (StatusNotifierItem). Does nothing when the desktop has no tray host. |
tether-gtk | mirror | on | Video in the phone-screen and app windows, through GStreamer. Without it the windows open and show “No video in this build”. |
tether-gtk | mock | off | The --mock option: the app runs against a fake daemon inside its own process. |
tetherd | audio | on | Phone audio on the PC, through GStreamer. Without it PhoneAudioState is unsupported. |
tetherd | webcam | on | Phone as webcam, through GStreamer. Without it WebcamSetupState is unsupported. |
cargo build -p tether-gtk --features mock # app with the fake daemon
cargo build -p tetherd --no-default-features # daemon without GStreamer
cargo test --workspace --features tether-gtk/mock # all tests, including the mock's
Run a debug daemon and app in place of the installed ones
Use this to try your build with your real, already paired phone. The debug
daemon takes the installed daemon’s bus name and port, and reads the same
settings and data in ~/.config/tether and ~/.local/share/tether.
Warning
The debug daemon works on your real data. A daemon that is newer than the installed one may move the per-phone database to a newer schema, which the installed daemon then has to open. If you are changing the database, copy
~/.local/share/tetherfirst.
-
Stop the installed daemon and app:
systemctl --user stop tetherd pkill -x tether -
Start the debug daemon from
desktop/straight away and leave it running:RUST_LOG=info,tetherd=debug ./target/debug/tetherdThe installed package registers the daemon for D-Bus activation. While no daemon owns
org.tether.Daemon, a program that calls that name makes the session bus start the installed daemon again, and your debug daemon then fails withowning org.tether.Daemon (is another tetherd running?). -
In a second terminal, start the debug app:
./target/debug/tether -
Use
./target/debug/tether-clifor the command line.tether-cli mirrorandtether-cli appstart thetetherprogram that lies next totether-cli, so they open the debug app. SetTETHER_APPto a path to make them start a different one.
cargo run -p tetherd, cargo run -p tether-gtk and
cargo run -p tether-cli -- <command> do the same and rebuild first.
Switch back to the installed ones
-
Stop the debug app and daemon. Press
Ctrl+Cin their terminals, or:pkill -x tether pkill -x tetherdpkill -xmatches the exact program name. Never usepkill -f: it matches whole command lines, including that of the shell that runs it. -
Start the installed daemon again:
systemctl --user start tetherd -
Start the installed app from the application menu.
Run a debug daemon beside the installed one
Use this when the installed daemon should keep serving your phone while you work. The second daemon needs its own bus name, ports and directories.
| Variable | Effect | Default |
|---|---|---|
TETHER_BUS_NAME | Bus name the daemon takes. tether-cli reads the same variable to choose the daemon it talks to. | org.tether.Daemon |
TETHER_PORT | TCP port for phones and UDP port for discovery beacons | port in config.toml, 7360 |
TETHER_PEER_PORT | Port on which the daemon dials back a peer that connected to it. Needed only for a fake phone on a port other than 7360. | 7360 |
TETHER_ADB_PORT | Port of the daemon’s private adb server | adb_server_port in config.toml, 5038 |
XDG_CONFIG_HOME, XDG_DATA_HOME, XDG_CACHE_HOME | Where the settings, the identity and trusted devices, and the caches live | ~/.config, ~/.local/share, ~/.cache |
-
Create a directory for the second daemon:
mkdir -p ~/tether-debug/config ~/tether-debug/data ~/tether-debug/cache -
Start the daemon with all of the variables:
TETHER_BUS_NAME=org.tether.Debug \ TETHER_PORT=7362 \ TETHER_ADB_PORT=5039 \ XDG_CONFIG_HOME=$HOME/tether-debug/config \ XDG_DATA_HOME=$HOME/tether-debug/data \ XDG_CACHE_HOME=$HOME/tether-debug/cache \ ./target/debug/tetherd -
Talk to it with
tether-cli:TETHER_BUS_NAME=org.tether.Debug ./target/debug/tether-cli devices
Set every variable. Without TETHER_ADB_PORT, both daemons use the adb
server on port 5038, and the debug daemon stops that server when it exits.
Without the XDG_ variables, both daemons write the same files.
The second daemon has its own identity, so to a phone it is another computer.
It announces itself on the network unless its config.toml says
discoverable = false.
The GTK app does not read TETHER_BUS_NAME. It always talks to
org.tether.Daemon, and a second tether process hands over to the one that
is already running. Drive a second daemon with tether-cli or with a
fake phone. The tutorial is a complete example
of this set-up.
Run the app against its fake daemon
cargo run -p tether-gtk --features mock -- --mock
The mock app has its own application id (org.tether.Tether.Mock) and runs
beside the real app. It shares the real app’s settings file
(~/.config/tether/gtk.toml), its autostart switch, and the launcher entries
that “Pin to desktop” writes. Point it at scratch directories to keep those
apart:
XDG_CONFIG_HOME=/tmp/tether-mock/config XDG_DATA_HOME=/tmp/tether-mock/data \
cargo run -p tether-gtk --features mock -- --mock
The mock’s options are in Test your changes.
Build and install the Android app
All Gradle commands run in android/.
Debug APK
-
Build it:
cd android ./gradlew :app:assembleDebugThe APK is
app/build/outputs/apk/debug/app-debug.apk. -
Install it on the phone that is connected over adb, and start it:
adb install -r app/build/outputs/apk/debug/app-debug.apk adb shell am start -n org.tether.android/.ui.MainActivity
adb install -r replaces the app and keeps its data, so a debug APK installed
over an earlier debug APK from the same computer keeps the phone’s identity
and its pairing.
The debug and the release build have the same application id,
org.tether.android, and different signing keys. Android refuses to install
one over the other. Uninstall the app first. That removes the app’s data, so
you pair again afterwards.
Release APK
./gradlew :app:assembleRelease
The release build is minified with R8. It is signed only if the build finds a
keystore, through four TETHER_* environment variables or
android/keystore.properties (see “Sign the APK” in
Package and release). Without one the APK is unsigned,
and Android does not install an unsigned APK.
A release APK that you sign with your own key cannot replace the project’s released APK on a phone, because the keys differ.
Build and install the Debian package
-
Install
cargo-debonce:cargo install cargo-deb --locked -
Build the release programs and the package:
desktop/packaging/build-deb.shThe script runs
cargo build --release --workspaceand thencargo deb -p tetherd --no-build. The package is one file,desktop/target/debian/tether_<version>-1_<arch>.deb, and contains the daemon, the app andtether-cli. -
Inspect it if you changed the packaging:
dpkg-deb -c desktop/target/debian/tether_*.deb lintian desktop/target/debian/tether_*.deb -
Install it and restart the daemon:
sudo apt install ./desktop/target/debian/tether_*.deb systemctl --user restart tetherd
Build the tarball for other distributions
desktop/packaging/build-tarball.sh
The script builds the release programs and writes
desktop/target/tarball/tether-<version>-linux-<arch>.tar.gz. Unpack it and
run sudo ./install.sh to install your build under /usr/local, as
Install Tetheron on Linux describes for a
release. The programs need the GTK, libadwaita and glibc versions of the
machine that built them, or newer.
The package layout and the maintainer scripts are described in
desktop/packaging/README.md.
Releases are covered in Package and release.
Test your changes
This page covers the automated tests, the fake backends for the desktop side, and the rules for tests on a real phone. First set up a development environment.
Run the Rust tests
-
Run every test of the workspace, as CI does:
cd desktop cargo test --workspace -
Run them again with the GTK app’s fake daemon compiled in. This adds the tests of the mock itself, which CI does not run:
cargo test --workspace --features tether-gtk/mock -
Run the two checks that CI runs before the tests:
cargo fmt --all --check cargo clippy --workspace --all-targets -- -D warnings
To run the tests of one crate, name it: cargo test -p tether-core. Unit
tests are next to the code. The integration tests of tether-core are in
desktop/crates/tether-core/tests/. They start two cores in one process and
run pairing, the QR flow, disconnect and hold, messages, calls, streams and
the enhanced tier messages between them.
Tests that decode video or play audio skip an element that is not installed
and print skipping: GStreamer element … is not installed.
Run the Android unit tests
cd android
./gradlew :app:testDebugUnitTest
These are JVM tests that need no phone and no emulator. They cover framing,
the pairing code and QR vectors, stream handling, feature logic and the pure
parts of the shell helper (org.tether.shell). The HTML report is in
android/app/build/reports/tests/.
There are no instrumented tests. Behaviour on a real phone is checked by hand with the checklists.
Know what CI runs
A pull request must pass these jobs. Each runs only when its part of the repository changed.
| Workflow | Runs when these change | Commands |
|---|---|---|
| Desktop | desktop/, proto/ | cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace |
| Android | android/, proto/ | ./gradlew --no-daemon --stacktrace :app:testDebugUnitTest :app:assembleDebug |
| Docs | docs/, book.toml, CHANGELOG.md | python3 docs/tools/check_links.py, mdbook build |
-
The Desktop job runs on Ubuntu 24.04 with the latest stable Rust and with
RUSTFLAGS=-D warnings, so a compiler warning fails the build, also incargo test. -
The Desktop job uses the default features. It does not build or test the
mockfeature oftether-gtk. When you touch the GTK app, run these yourself:cargo clippy --workspace --all-targets --features tether-gtk/mock -- -D warnings cargo test --workspace --features tether-gtk/mock -
The Android job uses JDK 21, platform 35 and build tools 35.0.0.
On a v* tag the workflows also build the .deb and the signed APK. See
Package and release.
Keep the shared test vectors green
The Rust and the Kotlin implementation must compute the same bytes. The wire protocol reference contains test vectors for the pairing code, the QR proof and the first frame of a secondary stream (sections “Test vectors” and “Test vectors (M2)”). Both sides have unit tests that check those values:
| Side | Tests |
|---|---|
| Rust | desktop/crates/tether-core/src/pairing.rs (sas_vector_1, sas_vector_2, qr_proof_vector), desktop/crates/tether-core/src/streams.rs (stream_open_test_vector) |
| Kotlin | android/app/src/test/java/org/tether/android/pairing/SasTest.kt, QrPairingUriTest.kt, android/app/src/test/java/org/tether/android/transport/StreamManagerTest.kt |
If you change pairing or framing, change the vector in the reference and the tests on both sides in the same pull request. See Add or change a protocol feature.
Test the user interface with the mock backend
The GTK app built with the feature mock contains a fake daemon. Use it for
all work on the user interface.
-
Start it with scratch directories, so that it does not write to the settings of your installed app:
cd desktop XDG_CONFIG_HOME=/tmp/tether-mock/config XDG_DATA_HOME=/tmp/tether-mock/data \ cargo run -p tether-gtk --features mock -- --mock -
Wait for the scripted events, or set the state you need with an environment variable in front of the command:
Variable Effect TETHER_MOCK_QUIET=1No scripted pair request and reply requests, which open dialogs and switch tabs TETHER_MOCK_FIRST_CALL=<seconds>When the first fake incoming call arrives TETHER_MOCK_BT=off|unavailable|unpaired|paired|connectedInitial Bluetooth state TETHER_MOCK_ENHANCED=<state>Initial state of the enhanced tier. not_set_upshows the set-up wizard pathTETHER_MOCK_ADB=missing|too_oldState of adb on the computer TETHER_MOCK_APPS=empty|errorApps tab without apps, or with an error TETHER_MOCK_AUDIO=unsupported|error|playback|playback_dupPhone audio state TETHER_MOCK_WEBCAM_SETUP=not_installed|not_loaded|no_device|ready|unsupportedState of the virtual camera The complete list, the timing of every scripted event and the texts that make an action fail are in the tether-gtk README.
-
To open only the mock phone’s screen window:
cargo run -p tether-gtk --features mock -- --mock --mirror 5b7a -
To see every event the fake daemon emits and every input record the fake screen receives, add
RUST_LOG=tether=debug.
The mock phone pushes a clipboard text about 45 seconds after the start, and the app puts it on your desktop clipboard.
The window must stay usable down to a width of 360 px. Check narrow widths when you change a layout.
Test the daemon with the fake phone
fake_phone is an example program in tether-core that speaks the phone’s
side of the protocol: pairing, battery, notifications, messages, contacts,
media, volumes, do-not-disturb, connectivity, clipboard, files, photos, calls,
the call log and a short app list. It has no adb side. For screen mirroring,
app windows, phone audio and the webcam, use the mock backend or a real phone.
-
Start a daemon. To keep it apart from an installed one, start it as described in “Run a debug daemon beside the installed one” in Build, run and install from source, with
TETHER_PEER_PORTset to the fake phone’s port. The tutorial shows the complete commands. -
Start the fake phone and let it dial the daemon:
cargo run -p tether-core --example fake_phone -- \ --port 7363 --dial 127.0.0.1:7362 --no-beacon --no-mdns -
Pair with
tether-cli pair <id>and drive the daemon withtether-clior over D-Bus.
| Option | Effect |
|---|---|
--port <n> | Port the fake phone listens on (default 7361) |
--name <text> | Name it announces (default “Fake Phone”) |
--dial <host:port> | Dial a daemon instead of waiting to be discovered |
--data <dir> | Where it keeps its identity and trusted devices (default tether-fake-phone in the temporary directory). Keep the directory to stay paired between runs |
--no-beacon, --no-mdns | Do not announce itself by UDP beacon or by mDNS. Without them the fake phone announces itself on the network on the standard port 7360, and an installed daemon lists it as a device |
--manual | Ask before confirming the pairing code instead of confirming at once |
--initiate | Request pairing from the phone’s side when it connects unpaired |
--no-cap <capability> | Leave one capability out of its Hello. Repeat for more. Tests capability gating. |
--m1 | Announce only the Milestone 1 capabilities |
--period <seconds> | Interval of the battery and notification updates (default 20) |
--share-file <path> | Offer this file to the desktop after pairing. Repeat for more |
--call-in <seconds> | Ring with an incoming call that long after every connect |
While paired, a clipboard text sent with tether-cli clipboard <id> send <word> triggers a hook in the fake phone: share offers the --share-file
files again, url and text share a link or a text, clip sends a
clipboard text back, call rings now, hangup makes the caller hang up.
Test the shell helper with helper_test.py
android/tools/helper_test.py starts the enhanced tier’s shell helper on a
phone connected over adb and talks to it directly, without the daemon. It
needs only Python 3. The installed Android app provides the helper.
--classpath <path> runs it from an APK that you pushed to the phone.
python3 android/tools/helper_test.py --help
| Mode | What it does on the phone | What it writes on the computer |
|---|---|---|
| no mode option (default) | Handshake, grant check, writes test strings to the clipboard, mirrors the phone’s main display, sends Home and a tap, turns the screen off and on | The main display’s video, as mirror.h264 (--out) |
--app <package> | Opens that app on a new virtual display, types, taps, resizes | The video of that virtual display only |
--audio | Captures each audio source for --seconds. --play <command> runs a command on the phone once the capture runs | Whatever the phone plays, as one .opus file (Ogg) per source |
--camera | Lists the cameras and captures for --seconds, counting packets and bytes | Nothing |
Warning
Do not run the default mode on a phone that is in daily use. It records the phone’s main display, with whatever is on it, to
mirror.h264. No option stops that recording:--no-clipboard,--no-inputand--no-screen-offswitch off only the clipboard, input and screen-off parts.
The clipboard part writes test strings and never requests the existing clipboard content, but it leaves the clipboard overwritten.
Test against a real phone
A test phone is often somebody’s daily phone, with their messages, photos and accounts on it. Automated tests on such a phone have captured private content before (see the session notes). These rules apply to every test that a person or a program runs against a phone that is in use.
- Screen: never capture, dump or screenshot the phone’s main display. Use
only a display that the test itself created. Before you rely on a tool’s
display argument, check on a harmless screen that the tool honours it:
uiautomator dump --display-idignores it on One UI 8.5 and dumps the main screen. - Audio: capture audio only while nothing is playing, or with a test tone that the test itself starts.
- Clipboard: never read the clipboard. Write a test string and read that back.
- Camera: count frames and statistics only. Never save or view camera frames, and check that the test releases the camera when it ends.
- Before a test run, tell the phone’s owner what will be visible or audible on the phone. Afterwards, report what was touched: apps opened, settings changed, the clipboard.
- Prefer a spare phone or an emulator for anything that reads content.
- Apps opened on virtual displays show up in the phone’s Recents, and a list of the installed apps is personal data too. Do not paste either into an issue or a pull request.
- Remove test artefacts from the phone and from your computer when you are done.
- Remove names, numbers and message texts from logs before you attach them to an issue.
When an AI coding agent runs device tests for you, give it these rules as part of the task.
Run the manual checklists
Features that depend on a real phone, a real call or a real Bluetooth link are verified by hand. Each checklist is a table of numbered steps with the expected result.
- Milestone 2 verification checklist: connect and disconnect, messages, media, do-not-disturb, ring, connectivity, clipboard, files and photos.
- Milestone 3 verification checklist: call control, the call log, Bluetooth and call audio on the PC.
Run the sections that your change touches, on your own phone. Say in the pull request which rows you ran, on which phone model, Android version and desktop session. Rows that nobody has verified yet are listed in the status sections of the roadmap.
Milestone 2 verification checklist
Manual device matrix for Milestone 2 (messages, contacts, media, DND, ring,
connectivity, clipboard, files, photos) plus the pairing/disconnect fixes from
ADR-0012. Run it on the real phone after every integration build; tick the
boxes in the “M2 status” section of docs/roadmap.md when done.
Setup: debug daemon (systemctl --user stop tetherd; RUST_LOG=info,tether=debug ./target/debug/tetherd) or the installed .deb; latest debug APK installed
(adb install -r), phone and desktop paired and connected (tether-cli devices). adb logcat -v time | grep -E "Tether\." in a second terminal.
Connection (ADR-0012)
| # | Step | Expect |
|---|---|---|
| C1 | Desktop: tether-cli disconnect <id> (or GTK Disconnect) | Both sides show disconnected; phone does not redial for ≥ 2 min; desktop Held = true |
| C2 | Desktop: tether-cli connect <id> | Reconnects within 5 s; Held = false |
| C3 | Phone: tap Disconnect on the desktop card | Desktop drops, shows “Disconnected — press Connect”; desktop does not redial; phone card says “Disconnected by you” |
| C4 | Phone: tap Connect | Reconnects |
| C5 | Phone: Unpair while connected | Desktop drops to “Available to pair” with no flicker, no reconnect loop in journalctl --user -u tetherd |
| C6 | Desktop: Unpair while the phone is offline (airplane mode), then bring the phone back | Phone receives Unpair on first contact, shows the desktop as unpaired; no loop |
| C7 | Re-pair right after C5/C6 (SAS path) | SAS visible on both sides, matches; after confirm the GTK page shows Disconnect/Unpair |
| C8 | QR path: tether-cli qr and scan with the app (or adb shell am start -a android.intent.action.VIEW -d '<uri>') | Pairs with no SAS prompt on either side |
| C9 | Restart tetherd while connected | Phone reconnects; GTK pages re-bind (SAS/Disconnect state correct) |
| C10 | Reboot the phone (adb reboot) without opening the app | Service starts (BootReceiver), reconnects within 60 s |
Messages
| # | Step | Expect |
|---|---|---|
| M1 | First connect after install | tether-cli conversations <id> lists threads matching the phone’s Messages app order; sync progresses in the log; thread count equals adb shell content query --uri content://mms-sms/conversations?simple=true row count |
| M2 | tether-cli messages <id> <thread> | Newest messages first; bodies, dates and direction match the phone |
| M3 | Receive an SMS from another phone | MessageAdded within 2 s; desktop notification with sender name; GTK thread moves to top with unread badge |
| M4 | Send an SMS from GTK (and tether-cli send) | Appears as pending, then sent; the phone’s Messages app shows it; MessageSendResult ok |
| M5 | Receive an MMS with an image | Thread shows the image thumbnail; opening fetches the full part (AttachmentReady) |
| M6 | Send an MMS with an image from GTK | Delivered on the recipient; or a clear “MMS not supported” error if the PDU path is not shipped |
| M7 | Dual SIM (if available) | SIM selector in the composer; sub_id honoured |
| M8 | Contact names and photos | Threads show names and avatars for numbers that exist in Contacts; tether-cli contacts <id> count equals the phone’s contact count |
Media, DND, ring, connectivity
| # | Step | Expect |
|---|---|---|
| D1 | Play Spotify/YouTube Music on the phone | GTK now-playing card updates with art; playerctl -l lists tether_<id8>; media keys on the keyboard pause/resume the phone |
| D2 | tether-cli media <id> next | Track changes on the phone |
| D3 | Volume slider in GTK | Phone media volume changes; phone volume keys move the slider |
| D4 | Toggle DND in GTK | Phone DND icon changes; toggling on the phone updates GTK |
| D5 | Ring phone with the phone on silent and screen off | Rings loudly with vibration, full-screen Stop activity; Stop ends it; 60 s auto-stop |
| D6 | Header | Carrier name, signal bars, Wi-Fi SSID (needs location permission) and airplane mode reflect the phone within 10 s |
Clipboard, files, photos
| # | Step | Expect |
|---|---|---|
| K1 | Copy text on the desktop (X11) | Phone clipboard has it (paste in any app) |
| K2 | Phone: Quick Settings “Send clipboard” tile | Desktop clipboard has it (GTK app running); on Wayland a notification with Copy appears if the window is unfocused |
| K3 | Phone: share a URL to Tether | Opens in the desktop browser |
| F1 | Drag 3 files onto the device page | Files appear in Downloads/Tether/ on the phone; progress in the Files tab |
| F2 | Phone: share 3 photos to Tether | Files land in ~/Downloads/Tether/; desktop notification with Open folder |
| F3 | Cancel a large transfer mid-way | Partial file removed on the receiver; both UIs show cancelled |
| P1 | Photos tab | Thumbnails load lazily; scrolling pages further; Screenshots tab filters |
| P2 | Drag a photo from Photos to Nemo | Full-resolution file lands in the folder |
| P3 | Delete a photo from the desktop | Confirmation dialog; phone asks to confirm (or deletes directly with all-files access); grid updates |
| P4 | Take a photo on the phone | MediaChanged → new item appears on refresh |
Multi-desktop / Wayland (pending from M1)
| # | Step | Expect |
|---|---|---|
| W1 | GNOME Wayland session | Notifications, tray (AppIndicator extension), app renders; clipboard limitations as documented |
| W2 | Second desktop paired to the same phone | Both receive messages; media commands from either work |
Milestone 3 verification checklist (calls)
Prerequisites: the M3 .deb installed (sudo apt install ./desktop/target/debian/tether_*.deb && systemctl --user restart tetherd), the M3 APK on the phone, call permissions granted:
for p in READ_PHONE_STATE ANSWER_PHONE_CALLS READ_CALL_LOG CALL_PHONE BLUETOOTH_CONNECT BLUETOOTH_ADVERTISE; do adb shell pm grant org.tether.android android.permission.$p; done
adb shell appops set org.tether.android MANAGE_ONGOING_CALLS allow # one-time: binds the in-call service (per-call control, audio routing from the PC)
Watch: tether-cli watch, journalctl --user -fu tetherd, adb logcat -s Tether.Calls Tether.CallLog Tether.Bt.
Verified 2026-11-11 with the release daemon: capabilities negotiated (control: true dial: true), call log synced with contact names, Bluetooth state reported (unpaired).
Verified 2026-11-15 with a debug daemon and debug APK on the A55: B3 and B4 (incoming and outgoing calls, two-way audio on the PC’s speakers and microphone without echo, This PC / Phone / Speaker switching). Background and diagnosis recipe: docs/notes/2026-11-15-call-audio-spike.md.
Call control (no Bluetooth needed)
| # | Step | Expect |
|---|---|---|
| K1 | Call the phone from another phone | Banner + notification with Answer/Decline within ~1 s, ringtone on the PC, desktop media paused |
| K2 | Answer from the banner | Call active on the phone, in-call window with timer; audio on the phone |
| K3 | Mute / unmute, hang up from the PC | Phone mic mutes; call ends; log entry appears |
| K4 | Let a call ring out | “Missed call” notification with Call back; missed badge on the Calls tab |
| K5 | Decline from the notification | Caller hears rejection; not counted as missed |
| K6 | Dial from the Calls tab (a number you may call) | Phone places the call on the chosen SIM |
| K7 | Answer on the phone itself | Banner closes on the PC |
Bluetooth and call audio on the PC
| # | Step | Expect |
|---|---|---|
| B1 | rfkill list bluetooth unblocked, bluetoothctl show Powered: yes | Preconditions |
| B2 | Calls tab → Set up call audio (or tether-cli bt <id> pair) | Stages discovering → confirm with a 6-digit code shown on both PC and phone → connecting → done; tether-cli bt <id> says connected |
| B3 | Incoming call → Answer on PC | tether-cli calls <id> shows audio: pc; two-way audio through PC speakers/mic; pw-link -l | grep bluez shows the links; a few seconds in, journalctl --user -u tetherd says echo canceller started and the caller does not hear themselves |
| B4 | Switch audio PC → Phone → Speaker → PC in the in-call window | Audio moves and the selected button follows (also when switched on the phone). Without the MANAGE_ONGOING_CALLS grant only Phone works (the PC closes the SCO link); Speaker/PC toast a reason |
| B5 | After hang-up | Previous audio profile and default devices restored; earbuds still work |
| B6 | If audio stays on the phone | HFP nodes exist only while the phone holds SCO open: pw-dump | grep -c headset-audio-gateway during the call. Note the phone card’s profiles: pw-dump | jq '.[]|select(.info.props."device.api"=="bluez5")|.info.params.EnumProfile[].name'; check journalctl --user -u tetherd | grep -E "HFP|call audio" |
Debug Tetheron
This page shows where each part logs, how to watch what the daemon does, and how to investigate call audio, the enhanced tier and the mirror window.
Logs can contain names, phone numbers and notification texts. Remove them before you attach a log to an issue.
Read the daemon’s log
The daemon writes its log to standard error. For the installed daemon (a systemd user service), read the journal:
journalctl --user -u tetherd -f
A daemon started from the build tree logs to its terminal.
RUST_LOG chooses what is logged. It takes a default level and levels per
module, separated by commas. Without it the level is info.
RUST_LOG=info,tetherd=debug ./target/debug/tetherd
| Value | Shows |
|---|---|
info | Start-up, connections, pairing, state changes of each feature |
info,tetherd=debug | Also each request of the daemon’s features and the output of the shell helper on the phone |
tether_core=trace,tetherd=debug | Also the transport library (tether-core) in full detail |
Message contents, keys, nonces and pairing codes are never logged above the
level trace. Keep to that in new code (see Code style).
The lines to look for at start-up are listening on TCP port, the state of
adb (adb <version> at <path> or enhanced tier unavailable), the state of
the virtual camera (webcam:) and D-Bus: owning org.tether.Daemon. If the
daemon exits with owning org.tether.Daemon (is another tetherd running?),
another daemon has the name.
Watch the daemon’s events
tether-cli watch prints every D-Bus signal of the daemon until you press
Ctrl+C: devices that appear and disappear, property changes, notifications,
pairing, calls.
tether-cli watch
Run it in one terminal while you reproduce the problem in another. To watch
a daemon with a private bus name, set TETHER_BUS_NAME for the command.
Inspect the daemon over D-Bus
The daemon owns org.tether.Daemon on the session bus. The object
/org/tether/Daemon has the interface org.tether.Daemon1. Each device is
an object /org/tether/Devices/<device-id> with the interface
org.tether.Device1. The D-Bus API reference
describes every member.
busctl --user tree org.tether.Daemon 2>/dev/null
busctl --user introspect org.tether.Daemon /org/tether/Daemon 2>/dev/null
busctl --user introspect org.tether.Daemon /org/tether/Devices/<device-id> 2>/dev/null
busctl --user get-property org.tether.Daemon /org/tether/Devices/<device-id> \
org.tether.Device1 PairState Connected
busctl --user monitor org.tether.Daemon
Replace <device-id> with the full id from the output of tree.
busctl prints Unexpected signal <arg> direction value 'in'. many times
for the daemon’s objects. The warning is harmless, and 2>/dev/null hides it.
introspect shows the current value of every property of a device. Be
careful with busctl --user call: methods act on the real phone.
Read the phone app’s log
The Android app logs to logcat with tags that start with Tether..
adb logcat -v time | grep -E "Tether\."
To follow a few tags only:
adb logcat -s Tether.Calls Tether.CallLog Tether.Bt
| Area | Tags (each prefixed with Tether.) |
|---|---|
| Connection and pairing | Engine, Session, Conn, Pairing, Trust, Identity, Streams, Network |
| Discovery | Nsd, Beacon |
| Service life cycle | Service, Boot |
| Notifications | NotifListener, NotifBridge, NotifFeature, NotifMap |
| Messages and contacts | Messages, SmsRepo, SmsSend, MmsSend, Contacts, ContactsRepo |
| Media and phone controls | Media, Volume, Dnd, Ring, Connectivity, Battery, DeviceInfo |
| Clipboard, files, photos | Clipboard, Files, Share, Photos, PhotosRepo, Blobs |
| Calls | Calls, CallLog, Bt |
| Enhanced tier | Enhance, Apps |
| User interface | Onboarding, UiFlow, Qr, Cdm |
Only a debug build of the app writes debug-level lines. A release build logs
from info upwards.
The shell helper of the enhanced tier runs outside the app process and does
not log to these tags. It writes lines of the form
tether-helper: <I|W|E> text to its standard error, and the daemon logs them
at debug level (RUST_LOG=info,tetherd=debug).
The app has no log export of its own. Save the log with adb. -d prints what
is in the log buffer and exits:
adb logcat -d -v time | grep -E "Tether\." > tether-phone.log
Read the file before you share it, and remove anything personal.
Debug call audio
Call control travels over the connection between the phone and the daemon. Call audio uses Bluetooth hands-free through PipeWire, and most problems are there. Calls and call audio explains the design, and the call audio spike notes record how the current behaviour was found.
With a phone as the audio gateway, PipeWire creates the call’s nodes only while the phone holds the audio link (SCO) open. Only the phone can open that link.
-
Read what the daemon decided:
journalctl --user -u tetherd | grep -E 'CallAudio|call audio|echo' -
During a call, look at the PipeWire graph:
pw-dump | grep -c headset-audio-gateway pw-link -l | grep -A2 bluez_You see Meaning A count of 0 The phone has not opened the audio link. The audio is on the phone. Look at the phone side (step 4). Nodes bluez_input.<MAC>.<n>andbluez_output.<MAC>.<n>The link is open. bluez_inputhas the classStream/Output/Audio(the caller’s voice),bluez_outputhasStream/Input/Audio(your microphone). Both are streams.The nodes exist but pw-link -lshows no links for themWirePlumber did not link them to the default sink and source. The daemon adds missing links about 2.5 seconds after the nodes appear. pw-top -b -n 2shows whether the nodes are running.pw-dumpcan print a second JSON array when the graph changes while it runs. If you parse its output, parse the first value only. -
Read the session manager and the kernel:
journalctl --user -u wireplumber -u pipewire sudo dmesg | grep -i sco -
Look at the phone:
adb logcat | grep -E 'Tether\.Calls|InCallController' adb shell appops get org.tether.android MANAGE_ONGOING_CALLS adb shell dumpsys telecom | grep -i tether adb shell dumpsys bluetooth_managerThe app-op must be
allow. Without it Android does not bind the app’s in-call service, and the desktop cannot switch the audio route. In thedumpsys bluetooth_manageroutput, the sectionHeadsetServiceshows when the audio link opened and closed. -
If the far end hears an echo or loses your voice, check the echo canceller. The daemon runs it while a call uses the PC’s speakers and microphone. The setting is
call_echo_cancelinconfig.toml.
Start capturing before the call starts. A snapshot of the graph every two seconds during a test call shows more than the logs do afterwards.
Debug adb and the enhanced tier
Start with the state the daemon reports:
tether-cli enhance <id> status
Then run the daemon with RUST_LOG=info,tetherd=debug to see the results of
the adb commands and the helper’s output.
| Symptom | Cause and what to do |
|---|---|
enhanced tier unavailable: no adb on PATH in the daemon’s log | Install adb, or set adb_path in config.toml. The daemon needs adb 34.0.0 or newer. |
The phone is unauthorized | USB debugging authorisation can be lost after the cable is replugged or debugging is toggled. Accept the prompt on the phone again, with Always allow from this computer. |
adb devices in your terminal does not show the phone that the daemon uses over Wi-Fi | Expected. By default the daemon runs its own adb server on port 5038 with its own key. A phone on a USB cable is reached through your normal adb server. |
| Mirroring over Wi-Fi stops working after Wireless debugging was toggled | Wireless debugging changes its port on every toggle. The daemon resolves it again before it connects. tether-cli enhance <id> rearm asks the phone to switch Wireless debugging back on. |
| Wireless debugging switches itself off again on a Samsung phone | One UI does that when the current Wi-Fi network was not allowed for Wireless debugging. Turn Wireless debugging on by hand on the phone and choose Always allow on this network when asked. The daemon tries the automatic switch-on once per session. |
| The helper exits or does not start | tether-cli enhance <id> restart, and read the tether-helper: lines in the daemon’s log. The helper’s exit codes are 0 (its input or the control connection closed), 1 (crash), 2 (wrong usage or no token) and 3 (cannot connect). |
A script that calls adb pair or adb connect reports success although it failed | Both commands exit with 0 on failure. Parse their output. |
android/tools/helper_test.py tests the helper without the daemon (see
Test your changes). Platform findings
lists the behaviour of adb and of vendor builds that the code works around.
Warning
Debugging tools that capture the phone’s screen or dump its user interface can expose private content. Read “Test against a real phone” in Test your changes first.
Debug the mirror window’s video
The phone-screen window and the app windows decode H.264 with GStreamer
inside the GTK app (feature mirror). The pipeline is appsrc, h264parse,
a decoder, a queue and a GTK 4 sink that is compiled into the app.
Screen mirroring, app windows and webcam
explains the design.
-
Reproduce the problem without a phone first. The mock plays two embedded test clips through the same pipeline:
RUST_LOG=tether=debug cargo run -p tether-gtk --features mock -- --mock --mirror 5b7aIf the mock’s picture is fine, the problem is on the phone’s or the daemon’s side.
-
Find out which decoder is used. The app logs
video decoder selected. It triesvah264dec,nvh264decandv4l2slh264dec(hardware), thenavdec_h264andopenh264dec(software), and moves on to the next one when a decoder fails while running. -
Force a decoder to rule the others out.
TETHER_VIDEO_DECODERnames an element that is tried before all others:TETHER_VIDEO_DECODER=avdec_h264 ./target/debug/tetherThe “software decoding” preference of the app leaves the hardware decoders out.
-
Check that the elements exist on the computer:
gst-inspect-1.0 h264parse gst-inspect-1.0 avdec_h264h264parseis ingstreamer1.0-plugins-bad,avdec_h264ingstreamer1.0-libav.
| Symptom | Cause |
|---|---|
| “No video in this build” | The app was built without the feature mirror. |
| The window stays on “connecting” for some seconds at the first start | The first start of a pipeline with nvh264dec can take 2 to 9 seconds under load. Later starts are fast. |
| The picture jumps forward | Intended. When more than 30 encoded frames wait in front of the decoder for over 1.5 seconds, the app drops them and asks the phone for a key frame. |
GStreamer’s own debug output is controlled by its GST_DEBUG environment
variable, described in the
GStreamer documentation.
The daemon uses GStreamer too, for phone audio and for the webcam.
tether-cli phone-audio <id> and tether-cli webcam <id> status show their
state, and their errors are in the daemon’s log.
Common pitfalls
- Stop programs with
pkill -x, neverpkill -f.pkill -x tetherdmatches the exact program name.pkill -fmatches whole command lines, including that of the calling shell. - The GTK app is
tether, the daemon istetherd.pkill -x tetherstops only the app. - Two daemons cannot share a bus name or a port. If a debug daemon will not start, the installed one is probably running. Stop it, or run the debug daemon beside it.
tether-clitalks to the installed daemon unlessTETHER_BUS_NAMEis set. Check the variable before you run a command that acts on a phone.- A stopped daemon can come back. The installed package registers
org.tether.Daemonfor D-Bus activation, and the GTK app’s Start service button starts the installed service. - The GTK app keeps running in the tray. Closing the window hides it while
the tray icon is active. A second
tetheronly brings the first one’s window to the front, so stop the old app before you start a new build. adb install -rkeeps the pairing only between builds signed with the same key. Switching between a debug and a release APK means uninstalling and pairing again.
Add or change a protocol feature
This page takes a feature from a .proto message to a button in the desktop
app. It follows one small feature that already exists: Ring phone
(capability ring, message RingPhone). Open the files named in each step
and copy the pattern.
A protocol change touches proto/, the Rust side and the Kotlin side in the
same pull request, together with the reference pages that describe it.
Before you begin
- Build both sides: see Set up a development environment and Build, run and install from source.
- Keep the wire protocol reference and the D-Bus API reference open next to the code.
- Decide whether the change needs an architecture decision record (see When you need an ADR). If it does, write the record first.
The steps cover frames on the control connection between the phone app and
the daemon. Messages between the daemon and the shell helper of the enhanced
tier live in proto/tether/v1/shell.proto. They are outside Envelope and
are negotiated through the abilities in ShellHello. The compatibility rules
below apply to them as well.
Overview of the path
proto/tether/v1/misc.proto message RingPhone
proto/tether/v1/envelope.proto Envelope.msg, field 102
|
+-- desktop/crates/tether-proto Rust types (prost, at build time)
| tether-core capability, gating, Core::ring_phone
| tetherd Features::ring_phone, D-Bus RingPhone
| tether-cli tether-cli ring <id>
| tether-gtk Backend::ring_phone, Overview row
|
+-- android/app Kotlin types (Wire, at build time)
transport/Protocol.kt capability "ring"
features/misc/RingController.kt handler
Write the contract
-
Define the message in the
.protofile of its feature area.RingPhoneis inproto/tether/v1/misc.proto:// Desktop -> phone. start = true plays the alarm ringtone at full volume with // vibration and shows a full-screen stop activity; start = false stops it. message RingPhone { bool start = 1; }State the direction and the semantics in the comment. If you create a new
.protofile, give it the same header as the others (package tether.v1,java_package = "org.tether.proto.v1",java_multiple_files = true), import it inenvelope.protoand add it to the file list indesktop/crates/tether-proto/build.rs. Wire on the Android side picks up every file underproto/by itself. -
Add the message to the
oneof msgofEnvelopeinproto/tether/v1/envelope.proto. Field numbers are grouped in blocks of ten per feature area:Numbers Area 10–13 session ( Hello,Ping,Pong,Disconnect)20–24 pairing 30–31 device information and battery 40–43 notifications 50–51 blobs 60 StreamOpen70–77 messages 80–82 contacts 90–93 media sessions and volume 100–105 Do Not Disturb, ring, connectivity, clipboard, share 110–113 files 120–127 photos 130–137 calls, call log, Bluetooth identity 140–145 enhanced tier, app side A message that belongs to an existing area takes the next free number in that block (
RingPhone ring_phone = 102;). A new area starts the next free block. -
Choose the capability. A feature is active only when both sides list its capability in
Hello.capabilities. Reuse the capability of the area when the new frame cannot be used without the existing ones. Add a new string when a peer could support one without the other (ringis separate fromdnd). Sub-features use a dotted name:messages.mms,calls.dial. -
Describe the contract in
docs/reference/protocol.md: a row in the “Capabilities” table and the behaviour in the section of the feature area (forring: “DND, ring, connectivity”). Include limits, timeouts and what the receiver does when it cannot comply.
Implement the desktop side
Rust types are generated at build time by
desktop/crates/tether-proto/build.rs with protox and prost-build. You
do not need protoc. After cargo build the message is
tether_proto::v1::RingPhone and the oneof case is
tether_proto::v1::envelope::Msg::RingPhone.
-
In
desktop/crates/tether-core/:File What to add src/lib.rsthe capability string in CAPABILITIES, which must matchProtocol.kton Androidsrc/session.rsan arm in required_capability(Msg::RingPhone(_) => "ring") and the frame’s name for the log inmsg_namesrc/device.rsfor a frame the peer sends to ask for something, a PeerRequestvariant (PeerRequest::Ring). For state the peer reports, anEventvariantsrc/core/mod.rsan arm in the dispatch matchthat turns the frame into the request or eventsrc/core/feature_flow.rsa typed send helper on Core(Core::ring_phone), which callsCore::sendtests/messages_contacts.rsa round trip between two in-process cores Core::sendrefuses a frame whose capability the peer did not announce (Error::Unsupported). Capabilities added in Milestone 3 and 4 are also checked on receipt (M3_CAPABILITIES,M4_CAPABILITIESinlib.rs, helpers insrc/core/call_flow.rsandsrc/core/enhance_flow.rs). Do the same for a new capability.To try the feature without a phone, teach
examples/fake_phone.rsto answer or print the frame. -
In
desktop/crates/tetherd/, add the feature logic to the module of the feature area undersrc/features/. Each module is animpl Featuresblock:src/features/misc.rshasFeatures::ring_phone, which sends the frame through the core, keeps theringingflag inMiscStateand announces the property change.- Events that arrive from the phone are routed to the feature in
Features::handleinsrc/features/mod.rs. - Data that must survive a restart goes into the per-device cache in
src/db.rs.
-
Expose it on D-Bus in
desktop/crates/tetherd/src/dbus/device.rs(theorg.tether.Device1interface) ordbus/daemon.rs(org.tether.Daemon1). Forringthis is the methodring_phone(RingPhone(b start)on the bus) and the propertyringing(Ringing). Signals are emitted from the feature code with thedevice_signal!macro, property changes withdevice_props_changed!(both insrc/features/mod.rs). -
Document every new method, property and signal in
docs/reference/dbus-api.md, in the section of the capability. In the pull request, state who can call a new method and what it can do (see the hardening checklist). -
Add the command to
tether-cliindesktop/crates/tether-cli/:src/proxies.rs: the method on theorg.tether.Device1proxy trait (fn ring_phone(&self, start: bool) -> zbus::Result<()>;).src/main.rs: a variant of theCmdenum (Cmd::Ring) and its arm in the commandmatch.
Describe the command in the command-line reference.
-
Add it to the desktop app in
desktop/crates/tether-gtk/. The user interface talks to aBackendtrait, which has a D-Bus implementation and an in-process fake:File What to add src/backend/mod.rsthe method on the Backendtrait (async fn ring_phone(&self, device_id: &str, start: bool) -> Result<()>;) and any new field of the device snapshot (ringing)src/backend/dbus.rsthe method on the zbus proxy trait and the Backendimplementation that calls itsrc/backend/mock.rsthe same method on the fake daemon, with plausible behaviour, and the capability in its capability list src/widgets/…the widget. ringis a row on the Overview page,src/widgets/overview_page.rsShow the control only while the device is connected and has the capability (
d.connected && d.has_capability("ring")).A method that is missing in the fake daemon breaks the
mockbuild, which screenshots and user interface work depend on. CI does not build that feature, so check it yourself:cd desktop cargo clippy --workspace --all-targets --features tether-gtk/mock -- -D warnings cargo run -p tether-gtk --features mock -- --mock
Implement the Android side
Kotlin types are generated at build time by the Wire Gradle plugin from the
same proto/ tree (wire { … } in android/app/build.gradle.kts). The
classes are in the package org.tether.proto.v1. An Envelope has one
nullable property per oneof case (envelope.ring_phone). All paths below
are under android/app/src/main/java/org/tether/android/.
-
Announce the capability in
transport/Protocol.kt, functioncapabilities(). Add it unconditionally if the feature needs no permission (add("ring")), otherwise only while the permission is held and the user has the feature switched on:if (settings?.syncContacts != false && Permissions.contacts(context)) add("contacts")Permission checks live in
core/Permissions.kt. -
Write the handler as a class that implements
Feature(transport/Feature.kt).features/misc/RingController.ktis the model:override suspend fun onMessage(session: Session, envelope: Envelope): Boolean { val req = envelope.ring_phone ?: return false if (session.peer?.has("ring") != true) return true if (req.start) start() else stop() return true }Return
falsefor frames that are not yours andtrueonce the frame is consumed. Ignore the frame when the peer did not announce the capability. UseonPairedto push initial state after a connection is established (features/misc/DndFeature.ktdoes this forDndState). -
Register the feature in
AppGraph.kt: aby lazyproperty and an entry in thefeatures = listOf(…)argument ofTetherEngine. -
Declare what the feature needs in
android/app/src/main/AndroidManifest.xml.ringaddedVIBRATE,USE_FULL_SCREEN_INTENTand the activityRingActivity(android:exported="false"). Every new permission gets a comment in the manifest that says why it is there. If the user sees a prompt or has to change a setting, describe it in Grant Android permissions and list the permission in Android permissions and grants. -
Add unit tests under
android/app/src/test/java/for logic that does not need a device (parsing, paging, diffing, encoding).
Keep the shared test vectors green
The protocol reference contains byte-exact test vectors that both
implementations check: the short authentication string (SAS, the six-digit
pairing code), the QR proof and a framed StreamOpen.
| Vector | Rust test | Kotlin test |
|---|---|---|
| SAS and QR proof (“Pairing”, “Test vectors”) | desktop/crates/tether-core/src/pairing.rs | android/app/src/test/java/org/tether/android/pairing/SasTest.kt, QrPairingUriTest.kt |
StreamOpen frame (“Test vectors (M2)”) | desktop/crates/tether-core/src/streams.rs | android/app/src/test/java/org/tether/android/transport/StreamManagerTest.kt |
-
If you change pairing, framing or a message that has a vector, the vectors must still pass on both sides. If you add something whose bytes both sides must agree on (a derivation, a hash, a frame layout), add a vector to
docs/reference/protocol.mdand a test for it in both languages. -
Run the checks of both sides as described in Test your changes.
Update the project records
-
Update, in the same pull request:
- Feature table: add or flip the row of the feature (tier, milestone, status).
- Roadmap: the status paragraph of the milestone, with what was and was not verified on a real phone.
CHANGELOG.md: a line under “Unreleased”, and whether the protocol change is additive.- The user guide, if a user can see the feature: the matching page under
docs/how-to/.
Compatibility rules
- Never renumber or reuse a field number, in
Envelopeor in any message. - When you remove a field, reserve its number (
reserved 4;) so that it cannot be reused by accident. - Add fields and messages. Do not change existing ones. A new optional field or a new message with a capability is compatible. Changing the type or meaning of an existing field is incompatible.
- Negotiate with capabilities. A peer that lacks a capability must never
receive the frames it enables, and must behave as before. The sender
checks the peer’s
Hello.capabilities. The receiver ignores frames for capabilities that were not announced. - The phone announces a capability only while it holds the permission behind
it. The list is fixed for the duration of a connection. The desktop treats
Hello.capabilitiesas the truth for that session and hides controls for missing capabilities. - An incompatible change needs an architecture decision record and a bump of
the protocol version:
PROTOCOL_VERSIONindesktop/crates/tether-proto/src/lib.rsandProtocol.VERSIONintransport/Protocol.kt. Its commit carries!and aBREAKING CHANGE:footer (see Submit a pull request). - Validate every length and index that comes off the wire. Frames are capped at 4 MiB and inline blobs at 256 KiB.
- Protocol constants (ports, timeouts, limits) are defined once per side and
match
docs/reference/protocol.md:desktop/crates/tether-proto/src/lib.rsand the modules oftether-corein Rust,transport/Protocol.ktin Kotlin.
When you need an ADR
Write an architecture decision record before the code when the change is expensive to reverse:
- the shape of the protocol: transport, framing, a new kind of connection, the pairing or trust model, an incompatible change,
- cryptography,
- a platform mechanism (a new Android service type, a hidden API, a kernel module, a new way to reach the phone),
- a dependency on a system service on either side,
- packaging or licence.
A message that is added to an existing feature area and follows a decision that is already recorded does not need a new record. Link the existing one in the pull request.
Submit a pull request
This page takes a change from the issue to the merge.
Before you begin
Three rules apply to every contribution.
- Do not contribute code or knowledge obtained by reverse engineering proprietary software. Code from open-source projects may be reused only under a licence compatible with GPL-3.0, and must be credited.
- All contributions are licensed GPL-3.0-or-later. You sign off every commit to certify the Developer Certificate of Origin. There is no contributor licence agreement.
- Reviews talk about code, not about people. The code of conduct applies to issues, pull requests and reviews.
Report security problems privately, as described in
SECURITY.md.
For ordinary bugs see Report a bug.
Read the architecture decision for the area you are about to change. If the decision is wrong, propose a new record.
Follow the workflow
- Open an issue or pick one, and say in it that you are working on it.
- Create a branch from
main. - Make the change. Keep the pull request to one feature or one fix. A
protocol change touches
proto/, the Rust side and the Kotlin side in the same pull request, so that the two sides onmainnever disagree. See Add or change a protocol feature. - Update the documentation and the changelog.
- Run the checks locally.
- Commit with a Conventional Commits message and a sign-off.
- Push and open the pull request against
main. Fill in the template. - Wait for CI and for the review. Push further commits to the same branch to answer review comments.
Run the checks locally
CI runs one workflow per part of the repository, and only when a pull request touches its paths. Run the same commands before you push.
Desktop
Runs for changes under desktop/ or proto/
(.github/workflows/desktop.yml),
on Ubuntu 24.04 with the latest stable Rust.
cd desktop
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
CI sets RUSTFLAGS="-D warnings" for all three steps, so a compiler warning
fails the build. To reproduce that locally:
RUSTFLAGS="-D warnings" cargo test --workspace
The system packages CI installs first are listed in Set up a development environment.
CI does not build the mock feature of tether-gtk. If you changed the
Backend trait or the fake daemon, also run:
cargo clippy --workspace --all-targets --features tether-gtk/mock -- -D warnings
cargo test --workspace --features tether-gtk/mock
Android
Runs for changes under android/ or proto/
(.github/workflows/android.yml),
with JDK 21 (Temurin), platforms;android-35 and build-tools;35.0.0.
cd android
./gradlew --no-daemon --stacktrace :app:testDebugUnitTest :app:assembleDebug
CI uploads the debug APK and the test reports as artefacts of the run.
Documentation
Runs for changes under docs/, to book.toml or to CHANGELOG.md
(.github/workflows/docs.yml).
Run from the repository root:
python3 docs/tools/check_links.py
mdbook build
Write documentation shows how to install mdBook. Test your changes covers the fake phone and the device checklists.
Write commit messages
The project uses Conventional Commits:
type(scope): summary
| Part | Values |
|---|---|
| Type | feat, fix, docs, refactor, test, build, ci, chore, perf |
| Scope | the part of the repository, such as proto, core, tetherd, gtk, cli, android, packaging, docs |
The history also uses desktop for a change that spans several Rust crates
and release for the release commit (chore(release): 0.4.1).
A breaking protocol change adds ! after the scope and a BREAKING CHANGE:
footer that says what breaks.
feat(android): forward RemoteInput replies for MessagingStyle notifications
Maps NotificationActionRequest.reply_text onto the action's RemoteInput and
fires the PendingIntent. Closes #42.
Signed-off-by: Jane Doe <jane@example.com>
Add the sign-off with -s:
git commit -s
Git appends Signed-off-by: Your Name <you@example.com> from your
user.name and user.email. If you forgot it on the last commit:
git commit --amend -s --no-edit
Describe the pull request
Fill in every part of the pull request template.
- What and why: what changes and which problem it solves. Link the issue
(
Closes #123), and the ADR if the behaviour follows from one. - How it was tested: the commands you ran. If you tested on hardware, give the phone model, Android version and OEM skin, desktop distribution and session (X11 or Wayland). State what you did not test.
- Screenshots for user interface changes. Take desktop screenshots with the
fake daemon (
--mock) or with demonstration data only. Never attach a picture that shows a real person’s name, number, message, photo or device identifier. - Security note, for a new Android permission, a new exported component or a new D-Bus method: who can call it and what it can do.
- The checklist: sign-off, checks passed, protocol changes complete on both sides, documentation and changelog updated.
Update documentation and the changelog
A pull request that changes behaviour changes the pages that describe it.
- Reference pages are checked against the code: Wire protocol, D-Bus API, Command-line tools, Configuration and files, Android permissions and grants.
- A pull request that completes a feature flips its row in the feature table and its entry in the roadmap.
- Add a line under “Unreleased” in
CHANGELOG.mdfor anything a user would notice. The file follows Keep a Changelog:Added,Changed,Fixed, andKnown limitationsorNotesfor what does not work yet or was not tested. - If you learned something about Android, an OEM skin, PipeWire, adb or GStreamer the hard way, add it to Platform findings.
Get it reviewed and merged
- CI must be green.
- One approving review from a maintainer is required.
- The maintainer squash-merges the pull request. Commits are kept when the history is meaningful, for example a contract commit followed by one commit per stack.
- The maintainer cuts releases: see Package and release.
Record an architecture decision
Anything that is expensive to reverse gets an architecture decision record (ADR): the shape of the protocol, cryptography, a platform mechanism, a dependency on a system service, a packaging format, the licence. Small implementation choices need only a code comment or a line in the pull request.
-
Copy the template to
docs/adr/NNNN-short-title.md, whereNNNNis the next free number:cp docs/adr/0000-adr-template.md docs/adr/<NNNN>-<short-title>.md -
Fill in Context (with the research and its sources), Decision, Consequences and Alternatives considered. Set the status to
proposed. -
Open a pull request. The discussion happens there.
-
Before the merge, set the status to
accepted. Add the row to the table indocs/adr/README.mdand the page todocs/SUMMARY.md. If the decision changes the plan, update the roadmap.
The statuses are proposed, accepted, deprecated and
superseded by ADR-NNNN.
To change an accepted decision, write a new ADR that supersedes it and set
the old record’s status to superseded by ADR-NNNN with a link. Do not
rewrite an accepted record beyond typing corrections and cross-links. An
addition that keeps the decision is recorded as a dated amendment at the end
of the record and in its status (accepted (amended 2026-11-15)).
Write documentation
The documentation is plain Markdown under docs/, built into a website with
mdBook. The structure follows
Diátaxis. This page is the style guide.
Preview the site
Install mdBook once, then serve the book from the repository root:
cargo install mdbook --locked --version 0.5.4
mdbook serve --open
The site rebuilds when a file changes. mdbook build writes it to
target/book/.
Before you open a pull request, build the book and check the links. CI runs
the same two commands
(.github/workflows/docs.yml).
mdbook build
python3 docs/tools/check_links.py
Add a page
- Decide which kind of page it is (see the next section). If you cannot decide, the page is probably two pages.
- Create the Markdown file in the matching directory.
- Add it to
docs/SUMMARY.md. A file that is not listed there is not part of the site, and a listed file that does not exist fails the build. - Link to it from the pages a reader would come from, at least the section’s
index.md.
Choose the kind of page
Diátaxis sorts documentation by what the reader needs at that moment. Each kind has its own directory and its own rules.
| Kind | Directory | The reader is | The page |
|---|---|---|---|
| Tutorial | tutorials/, contributing/first-build.md | learning, with time set aside | leads them through one concrete exercise to a result that works |
| How-to guide | how-to/, most of contributing/ | at work, with a goal | lists the steps that reach that goal |
| Reference | reference/, contributing/repository-layout.md, contributing/code-style.md | at work, looking something up | describes the thing completely and neutrally |
| Explanation | explanation/, adr/ | studying, away from the keyboard | discusses why things are the way they are |
Tutorials
- One path, no choices. Pick the option for the reader and say so.
- Every step produces something the reader can see. Say what they should see.
- Explain only what is needed to take the next step, in a clause. Link to an explanation page for the rest.
- A tutorial must work every time. Run it from a clean state before you merge a change to it.
- Write “we” for what the reader and the page do together.
How-to guides
- The title names the goal: “Pair and unpair devices”, not “Pairing”.
- State what the reader needs before they begin, and stop when the goal is reached.
- Steps are numbered and imperative. Options and branches are allowed (“If
ufwis enabled, …”). - Do not teach. One clause of reason is fine. More belongs in an explanation page.
- Say things in plain words (“six-digit code”, “local network discovery”) and link to the glossary at most once for a technical term.
Reference
- Structure follows the thing described: one section per command, per interface, per file.
- State facts. No instructions beyond a short usage example, no opinions, no history.
- Be complete and consistent. A missing option is a bug.
- Reference pages are checked against the code. When code changes behaviour that a reference page describes, the same pull request changes the page.
Explanation
- The title could follow the word “About”: “About privilege tiers”.
- Give context, reasons, alternatives that were rejected, and trade-offs.
- No steps to follow. Link to the how-to guide.
- A decision that is expensive to reverse is recorded as an architecture decision record. Explanation pages summarise and connect the records.
Names
- The project is Tetheron. Write that in prose.
- Programs, packages, paths and identifiers keep
tetheruntil they are renamed together:tetherd,tether-cli,tether_<version>-1_amd64.deb,org.tether.Daemon,org.tether.android,~/.config/tether,TETHER_*,sudo ufw allow Tether. Write them exactly as they are. - Quote user interface text as the app shows it, including labels that still say Tether (Welcome to Tether).
- The launcher entry, window title, tray entry and Android app label are Tetheron from the next release. Where a step names one, write Tetheron and, at most once per page, add “(Tether in 0.4.1 and earlier)”.
- Describe Tetheron by what it does: it connects an Android phone to a Linux desktop. Comparisons with other products belong only in the feature table.
Language
- British spelling: licence (noun), set-up (noun), set up (verb), optimisation, colour.
- Present tense, active voice. Address the reader as “you”. Tutorials may use “we”.
- Use the same word for the same thing on every page. The
glossary is the list of record: “phone”,
“desktop” (the Linux computer), “daemon” (
tetherd), “app” (say which side), “enhanced tier”, “pair”. - Write user interface text exactly as it appears on screen and in bold:
Start service. Write keys as
Ctrl+C. - Say what is true of the release a reader can install. Mark anything that ships later with the release it is planned for.
- In the user guide, name releases (“0.4.1”). Milestone numbers, ADR numbers and source file names belong in the contributor guide. Explanation pages may link to an ADR as further reading.
Write like a person
- Short declarative sentences with a concrete subject. Vary their length.
- Say what a thing is. Do not set it against what it is not (“not X but Y”, “rather than”) for effect.
- No filler vocabulary: additionally, crucial, key, robust, seamless, leverage, enhance, comprehensive, ensure, “note that”, “in order to”, “serves as”, “it is worth noting”.
- No “simply”, “just”, “easy”, “powerful” or “obviously”, and no rhetorical questions.
- No lists of three for rhythm, and no trailing “-ing” clause that comments on the sentence (“, ensuring that…”).
- Use a full stop or a comma where an em dash or a semicolon would go. A colon before a list is fine.
- Bold is for user interface text and for term labels in tables and lists. It is not for emphasis.
- Headings are in sentence case and name their content. A section with one short paragraph is merged into its neighbour.
- One sentence to open a page. No closing summary, and at most three links under “see also”.
- State a caveat once, where it applies. Keep a limitation only if the reader would act differently because of it. What was tested on which device belongs in Supported platforms.
- At most two callouts on a page, and none for an ordinary remark. No table with one row.
- It is fine for a page to be short.
Markdown conventions
-
Wrap lines at about 80 columns.
-
One
#heading per page, as its first line. It is the page title. Sections start at##. -
Link to other pages with relative paths to the
.mdfile:[pair the devices](../how-to/pair-devices.md). mdBook turns them into links between pages and they also work on GitHub. -
Link to files outside
docs/(source code,CHANGELOG.md) with a fullhttps://github.com/tetheron/tetheron/blob/main/…URL. A relative link that leavesdocs/breaks on the website. -
Fence every code block and name its language:
sh,toml,text,kotlin,rust,protobuf. -
Commands a reader types go in
shblocks without a prompt character, so they can be copied. Show expected output in a separatetextblock. -
Write placeholders in angle brackets and say what replaces them:
tether-cli pair <device-id>. -
Callouts use GitHub’s alert syntax, which mdBook renders as a coloured box:
NOTEfor a side remark,TIPfor a shortcut,IMPORTANTfor a requirement,WARNINGfor something that loses data or weakens security.> [!WARNING] > A debug build must be uninstalled before a release build is installed, > which removes the pairing. -
Use a table for a matrix, a list for a sequence, prose for reasoning.
-
Diagrams are text diagrams in a
textblock, so that they can be edited without a tool and reviewed in a diff.
Screenshots
Screenshots live in docs/images/desktop/ (PNG) and docs/images/android/.
Desktop screenshots are taken from the app running against its fake daemon,
never against a real phone, so that no personal messages, contacts or photos
end up in the repository. docs/tools/screenshots.sh takes the whole set. It
builds the app with the mock feature and runs it on its own Xvfb display,
session bus and scratch directories, away from your desktop session and from
tetherd:
docs/tools/screenshots.sh
Run it again when the user interface changes. SHOTS_SCENES selects a subset
of the scenes (main fresh pair webcam call), SHOTS_OUT another output
directory and TETHER_BIN an already built tether. The tools it needs
(Xvfb, metacity, xdotool, ImageMagick and others) are listed at the top of
the script. Its clicks use fixed coordinates, so adjust the “Click targets”
block when a layout changes.
To look at a state by hand, run cargo run -p tether-gtk --features mock -- --mock in desktop/. The environment variables that put the fake daemon
into a particular state are listed in the
tether-gtk README.
- Never commit a screenshot that shows a real person’s name, number, message, photo, notification or device identifier. This includes your own.
- Give every image alternative text that says what it shows:
. - The steps must be followable without the screenshot.
- Android screenshots are placeholders for now
(
docs/images/android/*.svg). Replace one by adding a PNG taken on a phone with demonstration data and changing the link.
Keep documentation true
- A pull request that changes behaviour changes the pages that describe it. The pull request checklist asks for this.
- A feature that ships flips its row in the feature table and its entry in the roadmap.
- User-visible changes get a line in
CHANGELOG.md, which the Changelog page includes. - Do not copy a fact to a second page. Link to the page that owns it.
Package and release
This page is for maintainers. It shows how to cut a release and how to build the Debian package, the tarball and a signed APK on your own machine.
A release is these files, attached to one GitHub release of
tetheron/tetheron:
| Asset | Built from |
|---|---|
tether_<version>-1_amd64.deb | the desktop/ workspace: tetherd, tether and tether-cli in one package |
tether-<version>-linux-x86_64.tar.gz | the same programs and files with install.sh, for distributions without a Debian package (from 0.5.0) |
tether-android-<version>.apk | android/, signed with the project key |
SHA256SUMS | checksums of the three files |
GitHub releases are the only distribution channel. A Flatpak is planned (see the roadmap).
Versions follow Semantic Versioning. Before 1.0 a minor bump marks a feature release and may extend the wire protocol additively.
Before you begin
You need:
- push access to the repository and the
GitHub CLI (
gh), signed in, - the signing secrets set in the repository (see Sign the APK),
- a tree on
mainin which every feature that ships is documented and listed under “Unreleased” inCHANGELOG.md.
Cut a release
-
Bump the version in two files:
File Field desktop/Cargo.tomlversionunder[workspace.package], which all six crates inheritandroid/app/build.gradle.ktsversionName(the same string) andversionCode(an integer that increases by one with every release)Build the desktop workspace once so that
desktop/Cargo.lockpicks up the new version, and commit the lock file with the bump. -
Update
CHANGELOG.md: rename the “Unreleased” section to## [<version>] - <YYYY-MM-DD>, start a new empty “Unreleased” section if work continues, and add the compare link at the end of the file:[<version>]: https://github.com/tetheron/tetheron/compare/v<previous>...v<version>List what was not verified on a real phone under “Known limitations” or “Notes”.
-
Update the pages that name the current release: the status line and the “Available now” column in
README.md, the status of the shipped rows in the feature table, and the milestone’s status paragraph in the roadmap. -
Run the checks with the toolchain CI uses. CI takes the latest stable Rust, so update first:
rustup update stable cd desktop cargo fmt --all --check cargo clippy --workspace --all-targets -- -D warnings cargo test --workspacecd android ./gradlew :app:testDebugUnitTest :app:assembleDebug -
Commit as
chore(release): <version>, push tomain, and wait until all workflows are green. -
Create an annotated tag whose name starts with
vand push it:git tag -a v<version> -m "<message>" git push origin v<version> -
Wait for the tag’s workflows. They create a draft release for the tag and attach the assets to it (see What CI builds).
-
Regenerate
SHA256SUMS. The file that CI attaches lists only the APK. Download the three assets from the draft release into an empty directory, then run there:sha256sum tether-android-<version>.apk tether_<version>-1_amd64.deb \ tether-<version>-linux-x86_64.tar.gz > SHA256SUMS gh release upload v<version> SHA256SUMS --clobber -
Check the draft: the three assets are present, the APK is signed with the project key (signer certificate SHA-256
dd87db65274499ba7aab364bce0bf70662dca61de6e2119ba4f97b56288c57cf), the.debinstalls on a clean supported system, and./install.sh --checkfrom the unpacked tarball reports no program that cannot start. -
Publish. Replace the placeholders with the title and a file that holds the release notes:
gh release edit v<version> --title "<title>" --notes-file <file> --draft=false --latest
What CI builds
Pushing a tag that matches v* runs the normal checks and then one release
job in each workflow.
| Workflow | Job | Steps | Result |
|---|---|---|---|
desktop.yml | deb, after check | cargo install cargo-deb --locked, cargo build --release --workspace, cargo deb -p tetherd --no-build, lintian (informational, never fails the job), packaging/build-tarball.sh --no-build | desktop/target/debian/*.deb as artefact tether-deb and desktop/target/tarball/*.tar.gz as artefact tether-tarball, both attached to the draft release |
android.yml | release, after build | decodes the keystore, ./gradlew --no-daemon --stacktrace :app:assembleRelease, copies the APK to dist/tether-android-<version>.apk, writes SHA256SUMS for it, deletes the keystore | both files as artefact tether-android-release and attached to the draft release |
Both jobs run on Ubuntu 24.04, so the package and the tarball are built for
amd64 against the libraries of that release. The tarball’s programs
therefore need glibc 2.39, GTK 4.14 and libadwaita 1.5 or newer where they
run. Both attach to a draft release with generated
release notes. Nothing is public until you publish the draft.
If the secret ANDROID_KEYSTORE_BASE64 is not set, the Android release job
prints a notice and skips the build. The draft then has no APK.
Build the Debian package locally
Build, inspect and install the package as described in
Build, run and install from source. Arguments you give to
desktop/packaging/build-deb.sh are passed on to cargo deb. After a change
to the systemd unit, reload and verify it:
systemctl --user daemon-reload
systemctl --user restart tetherd
systemd-analyze --user verify /usr/lib/systemd/user/tetherd.service
The package’s metadata (dependencies, description, the list of installed
files) is in [package.metadata.deb] at the end of
desktop/crates/tetherd/Cargo.toml. When you add a file to the package,
add it to the assets list there, to the tarball (see the next section)
and to the table in
desktop/packaging/README.md.
Build the tarball locally
desktop/packaging/build-tarball.sh
The script runs cargo build --release --workspace and writes
desktop/target/tarball/tether-<version>-linux-<arch>.tar.gz. With
--no-build it packs the programs that are already in target/release/.
It fails when install.sh lists a file that is not in the tarball.
The list of installed files is the function payload in
desktop/packaging/tarball/install.sh. When you add a file to the Debian
package, add it there and to build-tarball.sh as well. The package lists
for Fedora and Arch Linux are at the top of install.sh. The same lists are
in README.md, in desktop/packaging/tarball/README.md and in
Install Tetheron on Linux. The package
names that the programs show in their hints are in
desktop/crates/tether-distro/src/lib.rs.
To try the script without touching the system, unpack the tarball and stage an installation:
DESTDIR=/tmp/tether-stage ./install.sh
DESTDIR=/tmp/tether-stage ./install.sh --uninstall
Sign the APK
android/app/build.gradle.kts signs the release build when it finds a
keystore, and builds an unsigned release APK when it does not. It reads four
values, each from an environment variable first and from
android/keystore.properties second:
| Value | Environment variable | Key in keystore.properties |
|---|---|---|
| Path of the keystore file | TETHER_KEYSTORE_PATH | storeFile |
| Keystore password | TETHER_KEYSTORE_PASSWORD | storePassword |
| Key alias | TETHER_KEY_ALIAS | keyAlias |
| Key password | TETHER_KEY_PASSWORD | keyPassword |
Warning
Never commit a keystore or
keystore.properties. The repository’s.gitignoreexcludes*.jks,*.keystoreandkeystore.properties. An APK signed with a different key cannot update an installed app, so a lost key cannot be replaced.
In CI
The release job expects four repository secrets:
| Secret | Contents |
|---|---|
ANDROID_KEYSTORE_BASE64 | the keystore file, base64-encoded |
ANDROID_KEYSTORE_PASSWORD | the keystore password |
ANDROID_KEY_ALIAS | the key alias |
ANDROID_KEY_PASSWORD | the key password |
The job decodes the keystore into the runner’s temporary directory, passes
the values to Gradle through the TETHER_* environment variables, and
removes the file when it ends.
On your machine
-
Create
android/keystore.properties:storeFile=<path to the keystore file> storePassword=<keystore password> keyAlias=<key alias> keyPassword=<key password>Use an absolute path for
storeFile. Alternatively, export the fourTETHER_*variables in the shell that runs Gradle. -
Build:
cd android ./gradlew :app:assembleReleaseThe APK is written to
android/app/build/outputs/apk/release/.
The release build is minified with R8. A debug build and a release build are signed with different keys, so one must be uninstalled before the other can be installed, and the phone must then be paired again.
A fork that publishes its own builds uses its own key. Its APK cannot replace an installed APK that was signed with the project key.
Repository layout
Tetheron is one repository with two products, the Android app and the Linux
desktop software, and the protocol schemas they share
(ADR-0001). Directories, crates and
packages keep the name tether (see Names).
Top level
.
├── proto/ protobuf schemas, the single source for both sides
├── desktop/ Rust workspace: daemon, desktop app, CLI, packaging
├── android/ Gradle build: the Android app and the shell helper
├── docs/ this documentation (mdBook source)
├── .github/ CI workflows, issue and pull request templates
├── book.toml mdBook configuration, output goes to target/book/
├── README.md project overview
├── CHANGELOG.md release notes, Keep a Changelog format
├── CONTRIBUTING.md pointer to the contributor guide
├── CODE_OF_CONDUCT.md code of conduct
├── SECURITY.md how to report a vulnerability, threat model summary
├── NOTICE copyright notice and third-party credits
├── LICENSE GPL-3.0
└── logo.svg the project logo
proto/tether/v1/
The wire protocol, version 1. Rust types are generated by tether-proto,
Kotlin types by the Wire Gradle plugin. Behaviour is specified in the
wire protocol reference.
| File | Contents |
|---|---|
envelope.proto | Envelope: the frame of the control connection, a oneof over every message below except those of shell.proto |
common.proto | Hello, Ping, Pong, Disconnect, the UDP Beacon, StreamOpen and StreamPurpose for secondary connections, DeviceKind |
pairing.proto | PairRequest, PairResponse, PairConfirm, PairReject, Unpair |
device.proto | DeviceInfo, Battery |
notifications.proto | NotificationPosted, NotificationRemoved, NotificationActionRequest, NotificationDismiss |
blobs.proto | BlobRequest, Blob: small binary objects addressed by hash (icons, avatars, album art) |
messages.proto | SMS and MMS: conversations, messages, live events, sending, attachments |
contacts.proto | contact sync as vCard deltas |
media.proto | media sessions and commands, phone volume |
misc.proto | Do Not Disturb, RingPhone, Connectivity, Clipboard, ShareText |
files.proto | file offers in both directions, transfer progress and cancellation |
photos.proto | gallery queries, thumbnails, fetch, delete, change notices |
calls.proto | call state, call commands, call log, Bluetooth identity |
enhance.proto | enhanced tier, app side: AdbLink, AdbWifiState, AdbWifiRequest, the app list |
shell.proto | the separate protocol between the daemon and the shell helper (ShellEnvelope): handshake, mirroring, input, clipboard, grants, display power, app start, audio, camera |
desktop/
A Cargo workspace (desktop/Cargo.toml) with six crates under
desktop/crates/ and the packaging files under desktop/packaging/.
Cargo.lock is committed.
Crate dependencies
tether-proto generated types, no dependency on other crates
^
|-- tether-core protocol engine (library)
| ^
| |
|-- tetherd the daemon, uses tether-core and tether-proto
|
`-- tether-gtk the desktop app, uses tether-proto only
tether-distro no dependency on other crates, used by tetherd and tether-gtk
tether-cli no dependency on other crates
tether-gtk and tether-cli reach the daemon only through D-Bus
(ADR-0006). tether-gtk uses
tether-proto for the mirror stream, which it reads from the shell helper’s
video connection.
tether-proto
| Path | Contents |
|---|---|
build.rs | compiles the .proto files with protox and prost-build, from an explicit list of files |
src/lib.rs | module v1 (generated), PROTOCOL_VERSION, DEFAULT_PORT, ALPN, MDNS_SERVICE |
tether-distro
| Path | Contents |
|---|---|
src/lib.rs | family(): the distribution family (Debian, Fedora, Arch or other) from /etc/os-release. The package names and install commands that hints of the daemon and the app show for each family |
tether-core
A library with everything an endpoint needs below the user interface. It has no D-Bus interface.
| Path | Contents |
|---|---|
src/lib.rs | public exports, CAPABILITIES |
src/identity.rs | the device identity: a self-signed ECDSA P-256 certificate. The device id is the hash of its public key |
src/trust.rs | the persistent store of paired devices |
src/tls.rs | mutual TLS 1.3 with trust on first use |
src/framing.rs | length-prefixed Envelope framing |
src/session.rs | one authenticated connection: Hello, send and receive loop, keepalive, the capability each frame requires |
src/pairing.rs | short authentication string, QR proof, the tether://pair URI |
src/streams.rs | secondary connections for bulk data (ADR-0014) |
src/blobs.rs | cache of small blobs, addressed by hash |
src/device.rs | the device registry and the Event and PeerRequest types the daemon consumes |
src/paths.rs | XDG directories |
src/error.rs | the crate’s error type |
src/discovery/ | avahi.rs (mDNS through Avahi’s D-Bus API), beacon.rs (UDP beacon), mod.rs (merged events, manual addresses) |
src/core/mod.rs | Core: owns identity, trust, transport, discovery and the registry; dispatches received frames |
src/core/net.rs | listening, accepting, dialling |
src/core/pair_flow.rs | the pairing state machine |
src/core/notif_flow.rs | device information, battery, notifications, blobs |
src/core/feature_flow.rs | Milestone 2 frames and their send helpers, intentional disconnect |
src/core/call_flow.rs | calls, call log, Bluetooth identity |
src/core/enhance_flow.rs | enhanced tier frames and the app list |
src/core/state.rs | the state shared by the core’s tasks |
tests/ | integration tests between two in-process cores: pairing, QR, disconnect and hold, messages and contacts, streams, calls, enhanced tier |
examples/fake_phone.rs | a fake phone for developing against the real daemon |
tetherd
The daemon. Owns the connection to the phone and the D-Bus name
org.tether.Daemon on the session bus. Cargo features audio and webcam
(both default) pull in GStreamer.
| Path | Contents |
|---|---|
src/main.rs | start-up |
src/config.rs | config.toml |
src/db.rs | the SQLite cache per device (ADR-0013) |
src/dbus/mod.rs | the bridge from core events to D-Bus signals and property changes |
src/dbus/daemon.rs | interface org.tether.Daemon1 |
src/dbus/device.rs | interface org.tether.Device1 |
src/dbus/dicts.rs | builders for the a{sv} values of the D-Bus API |
src/notify.rs | phone notifications as desktop notifications, and the daemon’s own notifications |
src/battery.rs | the low-battery alert |
src/mpris.rs | one MPRIS player per phone with an active media session |
src/media_pause.rs | pauses desktop players during a call |
src/ringtone.rs | the desktop ringtone for incoming calls |
src/call_tracker.rs | the call state machine |
src/bluetooth.rs | BlueZ: adapter, guided pairing, hands-free connection |
src/pipewire.rs | PipeWire graph logic for call audio |
src/adb.rs | adb: the binary, the private server, a command runner that parses output, device tracking (ADR-0016) |
src/shell.rs | supervisor of the shell helper (ADR-0017) |
src/phone_audio.rs | playback of the phone’s audio through GStreamer |
src/webcam.rs | the camera pipeline into the v4l2loopback device (ADR-0019) |
src/webcam_setup.rs | state of v4l2loopback on the machine; runs the set-up script through pkexec |
src/features/mod.rs | Features, the per-device state, routing of core events to features |
src/features/messages.rs, contacts.rs, vcard.rs | message sync and sending; contact sync; the vCard parser |
src/features/media.rs | media sessions and phone volume |
src/features/misc.rs | Do Not Disturb, ring, connectivity, clipboard, share |
src/features/files.rs, photos.rs | file transfer; gallery index, thumbnails, originals, deletion |
src/features/calls.rs, calllog.rs, bt.rs, audio.rs | calls; call log; Bluetooth glue; call audio routing and echo cancellation |
src/features/enhance.rs | the enhanced tier: adb servers, Wireless debugging pairing, linking, the state machine per device |
src/features/apps.rs, phone_audio.rs, webcam.rs | the app list; the phone audio switch; the webcam switch and the virtual camera |
tether-cli
| Path | Contents |
|---|---|
src/main.rs | the clap command tree and every command |
src/proxies.rs | zbus proxies for org.tether.Daemon1 and org.tether.Device1 |
tether-gtk
The desktop app. The crate is tether-gtk, the binary is tether. Cargo
features: tray and mirror (default), mock (the in-process fake daemon,
tether --mock).
| Path | Contents |
|---|---|
src/main.rs, application.rs, window.rs | entry point; the application object; the main window |
src/backend/mod.rs | the Backend trait and the typed data the interface uses |
src/backend/dbus.rs | the Backend implementation over D-Bus |
src/backend/mock.rs, mock/, mock_data.rs | the fake daemon and its generated data |
src/backend/calls.rs, enhance.rs, apps.rs, webcam.rs | typed forms of the Milestone 3 and 4 parts of the D-Bus API |
src/models/ | GObject models the widgets bind to |
src/widgets/ | the pages and rows: overview, notifications, messages, photos, files, calls, apps, webcam group |
src/dialogs/ | pairing QR, add address, preferences, per-app settings, file offer, image viewer, Bluetooth pairing, webcam set-up |
src/calls/ | incoming-call banner and in-call window |
src/enhance/ | enhanced tier status row and set-up wizard |
src/mirror/ | the mirror window: stream framing, decode pipeline, input mapping (ADR-0018) |
src/apps/ | app windows and “pin to desktop” |
src/clipboard.rs, tray.rs, config.rs, util.rs | clipboard sync; tray icon; gtk.toml and autostart; helpers |
data/ | style sheet, GResource manifest, desktop entry, AppStream metainfo, icons, sample streams for the fake daemon (data/mock/) |
build.rs | compiles the GResource bundle |
desktop/packaging/
Everything that turns the workspace into the single Debian package tether
and into the tarball for other distributions
(ADR-0008). The package metadata is in
[package.metadata.deb] at the end of desktop/crates/tetherd/Cargo.toml.
| Path | Contents |
|---|---|
build-deb.sh | builds the release binaries and the .deb |
build-tarball.sh | builds the release binaries and tether-<version>-linux-<arch>.tar.gz |
tarball/install.sh | the install script inside the tarball: dependency check, install, uninstall |
tarball/README.md | the short instructions inside the tarball |
debian/postinst, prerm, postrm | maintainer scripts |
systemd/tetherd.service | the systemd user unit |
dbus/org.tether.Daemon.service | session bus activation |
ufw/tether | the ufw application profile Tether (port 7360, TCP and UDP) |
webcam/tether-webcam-setup | root helper that creates the v4l2loopback device |
webcam/org.tether.webcam-setup.policy | the polkit action for that helper |
wireplumber/ | optional WirePlumber drop-ins for call audio, installed as documentation only |
README.md | what is installed where |
android/
A Gradle build (settings.gradle.kts, wrapper included) with two modules.
Dependency versions are in gradle/libs.versions.toml.
| Path | Contents |
|---|---|
app/ | the application module: the Android app and the shell helper in one APK |
hidden-api/ | a compile-only Java stub of one hidden framework interface (android.content.IContentProvider), not packaged |
tools/helper_test.py | drives the shell helper on an attached phone without the daemon (Python 3, standard library only) |
android/app/src/main/java/org/tether/android/
The app. ADR-0005 describes its background model.
| Package | Contents |
|---|---|
| (root) | AppGraph (manual dependency injection), TetherApp (the Application) |
core | logging (TLog), byte helpers, Permissions, SettingsRepository, TrustedDesktopStore |
core.identity | the identity key in AndroidKeyStore and its certificate |
transport | Framing, Connection, Session, TetherEngine, the Feature interface, Protocol (constants and capabilities), HoldSet, StreamManager |
transport.tls | the TLS context and the trust manager |
pairing | Sas, QrPairingUri, PairingManager |
discovery | mDNS (NsdDiscovery), UDP beacon, the merged repository |
service | TetherService (foreground service), BootReceiver, NetworkMonitor, notification channels |
features.battery, features.deviceinfo | battery and device information |
features.notifications | the notification listener, the bridge with filtering, the wire mapping |
features.blobs | blob store and feature |
features.messages | SMS and MMS repository, diffing, senders, the MMS PDU encoder |
features.contacts | contacts repository, vCard writer, delta sync |
features.media | media sessions and volume |
features.misc | Do Not Disturb, ring, connectivity, clipboard (with the tile and the send activity) |
features.files, features.share | file transfer; the share target |
features.photos | MediaStore repository, the photos feature, the delete activity |
features.calls | call state and commands, the in-call service, call log, caller lookup |
features.bluetooth | Bluetooth identity and connect requests |
features.apps | the list of launchable apps |
enhance | the app side of the enhanced tier |
ui | Compose screens: MainActivity, navigation, onboarding, home, settings, qr, components, theme |
android/app/src/main/java/org/tether/shell/
The shell helper of the enhanced tier
(ADR-0017). It is in the same APK and runs
outside the app process: the daemon starts it through adb with
app_process, and it speaks shell.proto.
| File | Contents |
|---|---|
Main.kt | entry point, ability probes, the control channel |
ShellProtocol.kt, Geometry.kt | pure protocol and geometry code |
FakeContext.kt, Workarounds.kt, Hidden.kt | the system context as the shell package; access to hidden APIs |
MirrorSession.kt, CaptureTarget.kt | the H.264 encoder on the main display or a virtual display |
InputInjector.kt | touch, key, scroll and text input |
AudioCapture.kt, OpusConfig.kt | phone audio capture to Opus |
CameraCapture.kt, CameraSelect.kt | camera capture for the webcam |
ClipboardBridge.kt | clipboard read, write and watch |
Grants.kt, GrantTable.kt, Exec.kt | the fixed grant commands |
PanelPower.kt, CleanUp.kt | screen off while mirroring, and its restore if the helper dies |
ShellLog.kt | logging to stderr |
Other parts of the module: android/app/src/main/AndroidManifest.xml,
resources under android/app/src/main/res/, unit tests under
android/app/src/test/java/ (same packages), R8 rules in
android/app/proguard-rules.pro.
.github/
| Path | Contents |
|---|---|
workflows/desktop.yml | fmt, clippy and tests on every change to desktop/ or proto/. Builds the .deb and the tarball on a v* tag |
workflows/android.yml | unit tests and debug APK on every change to android/ or proto/. Builds the signed release APK on a v* tag |
workflows/docs.yml | checks links, builds this site, publishes it from main |
ISSUE_TEMPLATE/ | bug_report.yml, feature_request.yml, config.yml |
PULL_REQUEST_TEMPLATE.md | the pull request checklist |
docs/
The source of this site.
| Path | Contents |
|---|---|
introduction.md, SUMMARY.md | the landing page and the table of contents. A page that SUMMARY.md does not list is not built |
tutorials/, how-to/, reference/, explanation/ | the user guide, by kind of page |
adr/ | architecture decision records and their template |
contributing/ | this guide. checklists/ holds the device verification checklists per milestone |
roadmap.md | plan and status of every milestone |
notes/ | engineering notes: research reports and session records, not updated after they are written |
images/ | screenshots (desktop/, android/) |
tools/ | check_links.py, the link checker CI runs, and screenshots.sh, which takes the desktop screenshots |
Code style
The conventions for each language in the repository and the security rules that apply to all code. “Enforced by CI” means a pull request fails without it. Everything else is checked in review.
All code
| Rule | Detail |
|---|---|
| Licence | GPL-3.0-or-later. A new source file starts with the line SPDX-License-Identifier: GPL-3.0-or-later in the comment syntax of the language, as the existing ones do. |
| Third-party code | Only under licences compatible with GPL-3.0, credited in NOTICE. A file that follows a technique of another project says so in its header. |
| Reverse engineering | No code or knowledge obtained by reverse engineering proprietary software. See About the licence and distribution. |
| Spelling | British, in documentation and in user interface text: licence (noun), set-up (noun), colour. |
| Protocol constants | Ports, timeouts and limits are defined in one place per side and match the wire protocol reference. |
Logging
Never log message contents, keys, nonces or short authentication string
(SAS) values above the trace level. This covers notification text, SMS and
MMS bodies, clipboard text, contact data, pairing secrets and tokens.
| Side | Facility | Notes |
|---|---|---|
| Rust | tracing (trace!, debug!, info!, warn!, error!) | The level is set with RUST_LOG. The packaged service runs with RUST_LOG=info. |
| Android app | TLog (android/app/src/main/java/org/tether/android/core/TLog.kt): TLog.d, TLog.i, TLog.w, TLog.e with a short tag | Tags appear in logcat with the prefix Tether.. TLog.d is dropped in release builds. |
| Shell helper | ShellLog (android/app/src/main/java/org/tether/shell/ShellLog.kt) | Writes tether-helper: <I|W|E> text to stderr, which the daemon reads. |
Log identifiers in shortened form where the full value is not needed (the core logs the first eight characters of a device id).
Rust (desktop/)
Toolchain and build
| Item | Value | Where |
|---|---|---|
| Edition | 2021 | desktop/Cargo.toml, [workspace.package] |
| Minimum supported Rust version | 1.85 (rust-version) | desktop/Cargo.toml |
| Toolchain in CI | latest stable (dtolnay/rust-toolchain@stable) | .github/workflows/desktop.yml |
| Nightly features | not used | |
| Dependency versions | declared once in [workspace.dependencies], used in crates as name.workspace = true | desktop/Cargo.toml |
| Release profile | lto = "thin", codegen-units = 1, strip = true | desktop/Cargo.toml |
| Protobuf code generation | protox and prost-build in tether-proto/build.rs, without protoc |
There is no rust-toolchain.toml, rustfmt.toml or clippy.toml, and no
[lints] table in any Cargo.toml. Formatting and lints are the tools’
defaults.
Formatting and lints
| Rule | Enforced by CI |
|---|---|
rustfmt defaults: cargo fmt --all --check passes | yes |
cargo clippy --workspace --all-targets -- -D warnings passes | yes |
No compiler warnings (RUSTFLAGS="-D warnings") | yes |
Fix a lint in preference to #[allow]. An #[allow] carries a comment that says why. | no |
#![forbid(unsafe_code)] in tether-core, tetherd and tether-cli | by the compiler |
tether-proto contains only generated code and sets
#![allow(clippy::all)]. tether-gtk does not forbid unsafe. A new Rust
release can add clippy lints that an older local toolchain does not report.
Conventions
| Topic | Rule |
|---|---|
| Errors | thiserror in libraries, anyhow in binaries. |
unwrap() | Not outside tests, except where a comment proves that it cannot fail. |
| Async | tokio everywhere. No blocking calls on the runtime. Use spawn_blocking for bursts of file I/O and for key generation. |
| Documentation | Every public item in tether-core has a doc comment. Modules start with a //! comment that says what they own and names the ADR or reference section they implement. |
| Tests | Unit tests next to the code (#[cfg(test)] mod tests), integration tests in the crate’s tests/ directory. |
| Test vectors | Changes to pairing and framing keep the shared test vectors of the protocol reference green. |
| Test fixtures | Fixtures for external tools (pw-dump, adb output) come from a real capture, not from an assumed shape. |
| External commands | Parse the output of adb. Its exit code is 0 on some failures (Platform findings). |
Kotlin (android/)
Toolchain and build
| Item | Value | Where |
|---|---|---|
| Kotlin | 2.1.21 | android/gradle/libs.versions.toml |
| Android Gradle Plugin | 8.10.1 | android/gradle/libs.versions.toml |
| Gradle | 8.11.1, through the wrapper | android/gradle/wrapper/gradle-wrapper.properties |
| JDK in CI | 21 (Temurin) | .github/workflows/android.yml |
| JVM target | 17 | android/app/build.gradle.kts |
compileSdk / targetSdk / minSdk | 35 / 35 / 34 | android/app/build.gradle.kts |
| Protobuf code generation | Wire 5.3.11, plain Kotlin classes in org.tether.proto.v1 | android/app/build.gradle.kts |
| Dependency versions | version catalogue | android/gradle/libs.versions.toml |
| Release builds | R8 minification and resource shrinking | android/app/proguard-rules.pro |
Formatting and lints
| Rule | Enforced by CI |
|---|---|
Official Kotlin style (kotlin.code.style=official in android/gradle.properties) | no |
| ktlint-compatible formatting: four-space indent, trailing commas in multi-line declarations, no wildcard imports | no |
| Soft limit of 120 columns | no |
Unit tests pass and the debug build assembles (:app:testDebugUnitTest :app:assembleDebug) | yes |
There is no ktlint or detekt Gradle task and no .editorconfig. Run
ktlint yourself if you have it installed. Android lint is configured not to
fail the build (abortOnError = false).
Conventions
| Topic | Rule |
|---|---|
| User interface | Jetpack Compose with Material 3 only. Composables are stateless, with state hoisted out of them. Screens read StateFlows of the singletons in AppGraph. |
| Concurrency | Coroutines. Every coroutine runs in a scope that is passed in. No GlobalScope. |
| Dependency injection | Manual: constructor parameters and the AppGraph object. Adding Hilt or Dagger needs an ADR. |
| Dependencies | No Google Play Services and no Firebase (ADR-0008). |
| Permissions | Every new permission has a comment in AndroidManifest.xml that says why it is needed. If the user sees a prompt, it is described in Grant Android permissions. |
| Components | A new exported activity, service or receiver is explained in the pull request: who can call it and what it can do. |
| Capabilities | A capability is announced only while its permission is held (transport/Protocol.kt). |
| Tests | JUnit 4 unit tests under android/app/src/test/, with the shared vectors from the protocol reference. |
| Shell helper | Code in org.tether.shell uses no resources, no AndroidX and no JNI. |
Protobuf (proto/)
| Rule | Detail |
|---|---|
| Syntax and package | proto3, package tether.v1, option java_package = "org.tether.proto.v1", option java_multiple_files = true. |
| Field numbers | Never reuse or renumber a field. Reserve the number of a removed field. |
Envelope | A new message goes into the oneof msg in the block of its feature area, or in the next free block for a new area. The blocks are listed in Add or change a protocol feature. |
| Enums | The zero value is <PREFIX>_UNSPECIFIED. Values carry the enum’s name as prefix (DND_FILTER_PRIORITY). |
| Names | Messages in UpperCamelCase, fields in snake_case. |
| Comments | State the direction (Desktop -> phone) and the semantics above each message, and units in field comments (ts_ms). |
| Documentation | Behaviour is described in the wire protocol reference in the same pull request. |
| Negotiation | New frames are enabled by a capability in Hello.capabilities. |
Shell and packaging (desktop/packaging/)
| Rule | Detail |
|---|---|
| Shell | POSIX sh (#!/bin/sh), no bash features. |
| Static analysis | shellcheck-clean. CI does not run shellcheck; run it yourself. |
| Error handling | set -eu in build scripts (build-deb.sh). The maintainer scripts use set -e and guard every step with ` |
| Maintainer scripts | postinst, prerm and postrm must never fail the installation or removal of the package: a missing tool or a failed step is skipped. |
| Root helpers | A script that runs as root takes a fixed set of words and no free-form arguments, and sets its own PATH (webcam/tether-webcam-setup). |
| Install-time side effects | The package does not load kernel modules or copy files into a user’s configuration at install time (ADR-0019). |
| Package check | lintian runs in the release workflow for information and does not fail the build. |
The rules for documentation are in Write documentation.
Hardening checklist
Every change is reviewed against this list from
SECURITY.md.
- Validate every length and index that comes off the wire. Frames are capped at 4 MiB and inline blobs at 256 KiB.
- Treat
Hellofrom an unpaired peer as untrusted input. Never show itsnamein user interface or notification markup without escaping. The TLS handshake andHellocan be reached by anyone on the local network before pairing. - Use logging levels so that message bodies, nonces and SAS digits never
appear above
trace. - A new permission, exported Android component or D-Bus method gets a note in the pull request about who can call it and what it can do.
Further rules that follow from the threat model in the same file:
- Identifiers from the peer that end up in file names must be plain tokens
(
Protocol.isValidRefIdon Android). Received files must not escape their directory or overwrite other files. - Secrets do not go into process arguments, which other processes can read. The shell helper receives its token on stdin (ADR-0016).
- The daemon runs as the logged-in user, never as root. The one privileged action goes through polkit with a fixed script.
- No telemetry and no connection to a server that the user did not configure.
The reasoning behind these rules is in the security model.
Platform findings
Behaviour of Android, OEM skins, PipeWire, adb and GStreamer that was found by testing on real hardware and that the code depends on. Check this page before you change the code named in an entry, and add an entry when you find new behaviour.
Each entry gives the finding, where it was seen and what the code does. “Seen on” is the only configuration on which the finding was checked. Unless an entry says otherwise, the set-up was:
| Part | Version |
|---|---|
| Phone | Galaxy A55, One UI 8.5 (Android 16). Android 17 for the webcam entries |
| Desktop | Linux Mint 22 (Ubuntu 24.04 base), Cinnamon on X11 |
| Audio | PipeWire 1.0.5, WirePlumber 0.4.17 |
| adb | 35.0.0 |
| Video decoder | nvh264dec (no VA-API decoder on the test machine) |
TLS and pairing
AndroidKeyStore TLS keys need DIGEST_NONE
- Finding: Conscrypt signs the TLS 1.3
CertificateVerifymessage with a digest it has already computed. A key in AndroidKeyStore that does not allowDIGEST_NONEfails the handshake. - Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.1.0.
- Code: the identity key is created with
DIGEST_NONEandDIGEST_SHA256. A key that is known to lack it is regenerated. A transient KeyStore error does not trigger regeneration.android/app/src/main/java/org/tether/android/core/identity/Identity.kt.
The phone’s TLS listener runs whenever the app is visible
- Finding: before pairing nothing is trusted, so the foreground service is not running. A desktop that dials the phone to pair finds no listener unless the app starts one.
- Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.1.0.
- Code: the service, and with it the listener on port 7360, starts when
the app comes to the foreground. UDP beacons are sent only while the app is
visible.
android/app/src/main/java/org/tether/android/TetherApp.kt.
Stale trust must not cause a reconnect loop
- Finding: unpairing while the peer was offline left the peer believing it was still paired. It reconnected every second and both user interfaces flickered.
- Seen on: Galaxy A55 with the desktop daemon, release 0.1.0.
- Code: restricted frames on an unpaired session are ignored and answered
with one
Unpair. A pendingUnpairis delivered on the next contact.Unpairis allowed on unpaired sessions. The phone backs off when a session dies right afterHello. Test:desktop/crates/tether-core/tests/disconnect_hold.rs. See wire protocol, “Stale trust”, and ADR-0012.
The QR code carries only real LAN addresses
- Finding: a desktop with container or virtual machine bridges
(
docker0,br-*,veth*,virbr*,lxc*) put addresses into the pairing URI that the phone cannot reach. - Seen on: the Linux desktop, release 0.1.0.
- Code: those interfaces are filtered out when the desktop lists its
addresses.
desktop/crates/tether-core/src/discovery/mod.rs.
Desktop app pages re-bind when the daemon restarts
- Finding: when the daemon restarted while the app was open, the app rebuilt its device objects but its pages stayed bound to the old ones, with no Disconnect or Unpair buttons and no pairing code.
- Seen on: the Linux desktop, release 0.1.0.
- Code: a page re-binds when the device object instance changes
(
desktop/crates/tether-gtk/).
Android background and permissions
No self-managed companion association for sideloaded apps on One UI
- Finding:
REQUEST_COMPANION_SELF_MANAGEDissignature|privilegedon One UI 8.5. A sideloaded app cannot create a self-managed CompanionDeviceManager association. - Seen on: Galaxy A55, One UI 8.5 (Android 16).
- Code: the companion step is optional. The app checks whether it holds
the permission before it offers the step, and works without the
association.
android/app/src/main/java/org/tether/android/ui/onboarding/CdmScreen.kt. See ADR-0005 and ADR-0007.
One UI logs clipboard denials with different wording
- Finding: background clipboard sync watches the log for the line the
clipboard service writes when it refuses access. AOSP writes
Denied clipboard access to <pkg>. Android 14 and later and One UI writeDenying clipboard access to <pkg>,. - Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.2.0.
- Code: it matches
clipboard access to <pkg>, which is common to both.android/app/src/main/java/org/tether/android/features/misc/ClipboardFeature.kt. See ADR-0013, amendment.
Messages and photos
SMS and MMS changes are not notified on content://mms-sms/
- Finding: the platform does not notify observers of
content://mms-sms/when an SMS changes, so live updates never fired. - Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.2.0.
- Code: the phone registers its observer on
content://smsandcontent://mmsas well.android/app/src/main/java/org/tether/android/features/messages/MessagesFeature.kt.
The media provider may refuse to delete a photo
- Finding: some OEM media providers refuse a delete from another app even when the app has all-files access.
- Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.2.0.
- Code: it falls back to deleting the file and asking the media scanner
to rescan the path.
android/app/src/main/java/org/tether/android/features/photos/PhotosRepository.kt.
Calls and audio
PipeWire exposes a phone’s call audio as streams, only while SCO is open
- Finding: when the remote device is a phone (the PC is the hands-free
unit), PipeWire creates the HFP nodes with
media.classStream/Output/Audio(the caller’s voice) andStream/Input/Audio(the microphone path). They are notAudio/SourceandAudio/Sink. They exist only while the phone holds the SCO link open, and WirePlumber links them to the default devices by itself. Selecting a card profile does not create them. The PC can close SCO by switching the card profile tooff. It cannot open it. - Seen on: PipeWire 1.0.5, WirePlumber 0.4.17, mSBC, Galaxy A55, One UI 8.5 (Android 16), release 0.3.0.
- Code: the presence of the HFP nodes means that call audio is on the PC.
The daemon polls the graph once a second during a call. To move audio to
the PC it asks the phone (
ROUTE). To move it away when the phone refuses, it switches the card profile off and restores it shortly afterwards. Test fixtures use the classes and port names of a real graph.desktop/crates/tetherd/src/pipewire.rs,src/features/audio.rs. See call audio spike, finding 1, and ADR-0015, amendment.
Telecom binds the in-call service only with the app-op MANAGE_ONGOING_CALLS
- Finding: without a bound
InCallServicean app cannot route call audio. HoldingCALL_COMPANION_APPdoes not bind the service, andtelecom add-or-remove-call-companion-appexits with 0 and has no effect. The app-opMANAGE_ONGOING_CALLS, allowed over adb, binds it. The permission must also be declared in the manifest. - Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.3.0.
- Code: the manifest declares the permission, and the grant is one of the
adb grants of the enhanced set-up. Without it,
ROUTEcommands answerroute_unsupportedand the desktop falls back to closing SCO.android/app/src/main/java/org/tether/android/features/calls/TetherInCallService.kt,android/app/src/main/AndroidManifest.xml. See call audio spike, finding 2.
Echo cancellation runs in monitor mode
- Finding: on laptop speakers the caller’s voice returns through the
microphone and the phone suppresses the uplink, so the caller loses words.
Routing both call directions through a virtual sink and source removed
the echo but caused drop-outs. Monitor mode (
monitor.mode = true: the canceller reads the real sink’s monitor, only the microphone side moves) was clear in both directions. Monitor mode cannot be set through pipewire-pulse’smodule-echo-cancel, and a module loaded withpw-clidies withpw-cli. - Seen on: PipeWire 1.0.5, WirePlumber 0.4.17, release 0.3.0.
- Code: the daemon writes a configuration file to
$XDG_RUNTIME_DIR/tether-echo-cancel.confand runspipewire -c <conf>as a child for the duration of the calls, only when the call uses the default sink and source. It points the phone’s microphone node at the cancelled source withpw-metadata, and does not add links to the raw microphone while the canceller owns the routing. Configuration keycall_echo_cancel.desktop/crates/tetherd/src/features/audio.rs. See call audio spike, finding 3.
pw-dump can print two JSON arrays
- Finding:
pw-dumpprints a second array when the graph changes while it runs. - Seen on: PipeWire 1.0.5.
- Code: it parses the first JSON value only.
desktop/crates/tetherd/src/pipewire.rs.
A small quantum makes call audio worse
- Finding: forcing a small quantum (
clock.force-quantum 256) to cureout of buffersmessages on the microphone path increased them. Kernel messages about corrupted SCO packets did not coincide with bad audio. - Seen on: PipeWire 1.0.5, mSBC.
- Code: it leaves the quantum and the codec alone. See call audio spike, finding 4.
adb and the enhanced tier
The decisions behind these entries are in ADR-0016 and ADR-0017.
Wireless debugging changes its port on every toggle
- Finding: Wireless debugging keeps its mDNS instance name and changes its port each time it is switched on. An mDNS browse that is already running does not report the new port.
- Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.4.0.
- Code: it resolves the instance again before every
adb connect.desktop/crates/tetherd/src/features/enhance.rs.
One UI switches Wireless debugging back off on a network that was not allowed
- Finding: when the user has not allowed the current Wi-Fi network for
Wireless debugging, One UI sets
adb_wifi_enabledstraight back to off after an app switches it on. - Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.4.0.
- Code: the automatic re-arm is tried once per session, never in a loop.
desktop/crates/tetherd/src/features/enhance.rs.
adb pair and adb connect exit with 0 on failure
- Finding:
adb connect, andadb pairbefore 34.0.5, report failure only in their output. - Seen on: adb 35.0.0.
- Code: one command runner parses the output and ignores exit codes. Its
tests use captured output.
desktop/crates/tetherd/src/adb.rs.
adb’s own mDNS does not work in distribution builds
- Finding: the mDNS discovery built into adb is unusable in the adb packages of the distributions.
- Seen on: adb 35.0.0 from the distribution.
- Code: the daemon starts adb with
ADB_MDNS=0and browses_adb-tls-pairing._tcpand_adb-tls-connect._tcpthrough Avahi.desktop/crates/tetherd/src/adb.rs,desktop/crates/tether-core/src/discovery/avahi.rs.
The helper’s token goes over stdin, never in the arguments
- Finding: process arguments on the phone are visible to other
processes through
ps. - Code: the daemon writes the one-time token as the first line of the
helper’s stdin.
desktop/crates/tetherd/src/shell.rs,android/app/src/main/java/org/tether/shell/Main.kt.
uiautomator dump --display-id ignores the display on One UI
- Finding: the command dumps the main screen whatever display is named.
- Seen on: Galaxy A55, One UI 8.5 (Android 16).
- Code: the option was removed from
android/tools/helper_test.py. See the rules for device tests in Test your changes.
All helper abilities work on Android 16 without a fallback
- Finding: all ten abilities of the shell helper were available. Typing into virtual displays was reliable (15 of 15 keys, 15 of 15 text entries). The typing problem reported for Android 16 as scrcpy issue 6909 did not reproduce.
- Seen on: Galaxy A55, One UI 8.5 (Android 16), release 0.4.0.
- Code: abilities are probed at every helper start and reported in
ShellHello. The desktop offers only what was probed. The paste fallback for text input is kept.
USB debugging authorisation can flip to “unauthorized”
- Finding: after replugging the cable or toggling debugging, the phone
reported
unauthorizeduntil the prompt was accepted again with Always allow from this computer. - Seen on: Galaxy A55, One UI 8.5 (Android 16).
- Code: the daemon tracks the adb device state, including
unauthorized.desktop/crates/tetherd/src/adb.rs.
A Wireless debugging pairing can stop working after a system update
- Finding: a pairing made under Android 16 no longer connected after the phone was updated to Android 17. The update is the probable cause. Pairing again fixed it.
- Seen on: Galaxy A55, Android 16 to Android 17.
- Code: nothing automatic. The set-up wizard pairs again.
Mirroring and webcam
The decisions behind the webcam entries are in ADR-0019.
The first decoder start with nvh264dec is slow
- Finding: the first start of a GStreamer pipeline with
nvh264dectakes 2 to 9 s under load. Later starts are fast. - Seen on: NVIDIA GPU, GStreamer from Ubuntu 24.04, release 0.4.0.
- Code: the mirror window shows the picture when the first frame
arrives. Neither code nor tests treat a slow first start as a failure.
desktop/crates/tether-gtk/src/mirror/. See ADR-0018.
Call apps list V4L2 devices only
- Finding: video call apps and the default browser builds list V4L2 devices. They do not show PipeWire camera nodes unless the user changes browser settings.
- Seen on: Linux Mint 22, Ubuntu 24.04.
- Code: the webcam is a
v4l2loopbackdevice fed by the daemon.
v4l2loopback 0.12.7 has no control device and no client-usage event
- Finding: the version in Ubuntu 24.04 and Linux Mint 22 has no
v4l2loopback-ctl add(0.13 and later only), so a module that is already loaded without the project’s device cannot be extended. It also cannot tell the daemon that an app opened the device. - Seen on: v4l2loopback 0.12.7.
- Code: the set-up script stops with an instruction to unload the module
in that case. The webcam is a switch that the user turns on. It is not
started on demand.
desktop/packaging/webcam/tether-webcam-setup,desktop/crates/tetherd/src/webcam_setup.rs.
v4l2sink rejects caps without the device’s colorimetry
- Finding:
v4l2sinkdoes not accept output caps that lack the colorimetry the loopback device reports. - Seen on: GStreamer from Ubuntu 24.04, v4l2loopback 0.12.7.
- Code: the daemon queries the sink pad once and takes the output caps
from it.
desktop/crates/tetherd/src/webcam.rs.
With exclusive_caps=1 the device is listed only while it is fed
- Finding: apps list the virtual camera only while a producer writes to it, and a consumer must never see the format change.
- Code: an output stage holds the device open for as long as the switch
is on and is fed black frames whenever no capture runs. Each capture gets
its own decode stage. The device format is fixed. Rotation, flip and a
camera switch change the picture inside that frame.
desktop/crates/tetherd/src/webcam.rs.
pkexec cannot gain privileges from the packaged service
- Finding: the systemd user unit sets
NoNewPrivileges=yes, so a setuidpkexecstarted by the daemon cannot become root. - Code: when the daemon runs with that flag it starts
pkexecthroughsystemd-run --user. This path has not been verified from the installed package.desktop/crates/tetherd/src/webcam_setup.rs,desktop/packaging/systemd/tetherd.service.
The shell user can open the camera, with one Android 16 change
- Finding: the shell user holds
android.permission.CAMERAand can open Camera2 without a visible activity or a foreground service. On Android 16 reading the camera characteristics goes throughActivityManager, which needs a patched context. - Seen on: Galaxy A55, Android 17. Start to first key frame 0.84 to 1.47 s.
- Code: the helper creates
CameraManagerthrough its hidden constructor on the fake context and patches theActivityManagercontext.android/app/src/main/java/org/tether/shell/CameraCapture.kt,FakeContext.kt. See Milestone 4 research: shell helper, section 8.
Another camera client takes the camera away
- Finding: when another app on the phone opens the camera, the helper’s capture is disconnected.
- Seen on: Galaxy A55, Android 17.
- Code: the helper reports
CameraEndedwith the reasoncamera_disconnected. The device on the desktop stays open and shows black frames. See wire protocol, “Phone as webcam”.
Not yet tested
Treat code that depends on these as unverified. The current list is in the roadmap.
| Area | Open question |
|---|---|
| Webcam | the camera while the phone is locked or the screen is off, the camera privacy switch (camera_disabled), the persist and remove actions of the set-up script |
| Enhanced tier | re-arm of Wireless debugging after a phone reboot, Samsung Auto Blocker, physical rotation of a whole-screen mirror, measured mirror latency |
| Desktop | Wayland sessions (window class of pinned apps, dmabuf path), VA-API decoders |
| Calls | the MANAGE_ONGOING_CALLS grant after a phone reboot, adapters and phones other than the one tested |
Tetheron roadmap
The project was called Tether when this plan was written (November 2026) and the text below keeps that name. It began as an analogue of Microsoft Phone Link for Linux; the scope has since grown beyond that. Status sections under each milestone say what has shipped.
Context
Goal: a fully functional, clean-room analogue of Microsoft Phone Link (Windows) + Link to Windows (Android) for consumer Debian/Ubuntu-family desktops, with the highest achievable feature parity. Two products: Tether for Android (Kotlin/Compose) and Tether for Linux (Rust daemon + GTK4/libadwaita app + CLI). Clean room = reproduce publicly observable behaviour only; no reverse engineering of Microsoft binaries/protocols. Open-source components are reused where licence-compatible (GPL-3.0-or-later project).
Research (three parallel agents, Nov 2026) and the Q&A below fixed the strategy. Summary of what the research established:
- Phone Link’s “best” tier (app streaming, mirroring, clipboard, drag-drop, hotspot) exists only where Link to Windows is a privileged OEM system app. The only route to that tier for us is shell uid via adb (scrcpy model). Everything else (notifications, SMS/MMS, BT calls, photos, files, media) is reachable from a normal app.
- Call audio is only possible over Bluetooth HFP with the PC as hands-free unit; PipeWire ≥1.0 handles audio, call control goes over our own channel via
TelecomManager. - KDE Connect’s protocol is a poor transport to inherit (LAN-only, 50 ports, UDP broadcast, TOFU TLS, 2025 CVEs); its plugin schemas are a good reference. Prior Linux attempts (Sefirah, Vortex, Linksy) validate the daemon + Kotlin shape but none is polished.
- CompanionDeviceManager association is required day one: it exempts our notification listener from Android 15 OTP redaction and grants background-run eligibility.
Decisions (ADRs to be written in docs/adr/)
| # | Decision | Choice |
|---|---|---|
| 0001 | Repo & stacks | Monorepo. Android: Kotlin 2.x + Jetpack Compose, minSdk 34, targetSdk 35. Linux: Rust (tokio, rustls, prost, zbus, gtk4-rs/libadwaita). Shared .proto schemas. |
| 0002 | Wire protocol | Greenfield. TLS 1.3 over TCP, fixed port 7360; u32-BE length-prefixed protobuf Envelope; control connection + on-demand secondary TLS connections for bulk streams (icons, files, later video/audio). Relay-agnostic: a connection is any byte stream carrying the same TLS session. QUIC deferred. |
| 0003 | Identity & pairing | Self-signed ECDSA P-256 certs (Android: AndroidKeyStore hardware-backed; Linux: rcgen key file 0600). Device id = SHA-256(SPKI) hex. Pinning after pairing. Pairing = nonce exchange + 6-digit SAS from SHA-256(fpA‖fpB‖nonceA‖nonceB), confirmed on both sides; or QR (desktop shows tether://pair?... with address + one-time secret, phone proves HMAC). |
| 0004 | Discovery | mDNS _tether._tcp (Linux via Avahi D-Bus, Android via NsdManager) + UDP beacon on 7360 fallback + manual IP + QR. Both sides listen; connection dedupe by lower device id. |
| 0005 | Android background | Foreground service type connectedDevice (prerequisite CHANGE_WIFI_MULTICAST_STATE), self-managed CDM association after pairing, battery-optimisation exemption requested in onboarding, Samsung “never sleeping apps” guidance. No wake locks except during transfers. |
| 0006 | Linux process model | tetherd (systemd user service, owns transport, exposes D-Bus org.tether.Daemon), tether (GTK4/libadwaita app, D-Bus client), tether-cli. Desktop notifications via org.freedesktop.Notifications; tray via StatusNotifierItem. |
| 0007 | Privilege tiers | Normal tier (no adb) and Enhanced tier (shell helper launched by desktop over adb; our APK’s dex doubles as the app_process server). Enhanced unlocks mirroring, app streaming, clipboard read, permission auto-grants, OTP notifications, phone audio. Every feature declares its tier. |
| 0008 | Distribution | Android: APK on GitHub releases, never Play. Linux: .deb on GitHub releases first, Flatpak later (amended 2026-12-04; no F-Droid or apt repository for now; a tarball with an install script for Fedora, Arch and others). |
| 0009 | Licence | GPL-3.0-or-later for everything. |
| 0010 | Reachability | LAN first; transport path-agnostic; self-hostable relay in a later milestone. |
| 0011 | SMS | Non-default SMS app (read/send/receive; no mark-read/delete), like Phone Link. |
| 0012 | Disconnect | Disconnect{hold_seconds} frame; both sides hold auto-reconnect until the user acts or the peer dials in. |
| 0013 | Desktop data layer (M2) | SQLite cache per device inside tetherd, paged D-Bus getters + change signals, MPRIS player per phone, clipboard set by the GTK app (Wayland best-effort). |
| 0015 | Calls | Control/call log over Tether; audio via PipeWire native HFP HF (BlueZ pairing + PipeWire links); fallback audio on phone. |
| 0014 | Bulk streams | One secondary TLS connection per stream: StreamOpen header + raw bytes; 10 s out-of-order window; 4 concurrent per peer. |
User answers that drove these: greenfield protocol; adb-only mirroring; LAN-first relay-ready; full calls in v1; sideload-only; Rust+GTK4; .deb; GPL-3; Samsung One UI test phone (Xiaomi later); Cinnamon X11 now, GNOME Wayland preferred going forward; Milestone 1 = pairing + notifications + battery; name Tether; opportunistic shell helper; minSdk 34; solo, aggressive full-time pace, heavy parallel subagents, ADRs, finish M1 this session.
Local environment (verified)
Linux Mint 22.2 (Ubuntu 24.04 base), X11 Cinnamon, GNOME Wayland session available. Installed: adb 35 (adb pair capable), kdeconnectd running (different ports, no clash), PipeWire 1.0.5 with bluez5 SPA + mSBC/LC3 codecs, BlueZ 5.72, avahi active, GTK 4.14.5, libadwaita 1.5 dev available via apt, GStreamer 1.24 (gtk4paintablesink not packaged: use the gst-plugin-gtk4 Rust crate statically), Rust 1.93, OpenJDK 21, Node 24. Missing: Android SDK/cmdline-tools, Gradle (wrapper will fetch), protobuf-compiler, libgtk-4-dev/libadwaita-1-dev headers, pkg-config-visible libei (not needed for M1). No phone attached yet.
Samsung caveat (from research): Wireless Debugging toggle resets after reboot and One UI 6+ “Auto Blocker” blocks adb; both must be covered by Enhanced-tier onboarding (M4), not M1.
Repository layout
linux-phonelink/ (git init here; name "Tether")
LICENSE (GPL-3.0-or-later) README.md CONTRIBUTING.md
docs/adr/0001-...0011-*.md docs/reference/protocol.md docs/reference/feature-parity.md
proto/tether/v1/*.proto # single source of truth
desktop/ # Cargo workspace
Cargo.toml
crates/tether-proto # prost codegen from ../../proto
crates/tether-core # identity, tls, framing, pairing, discovery, session, capability registry, plugin trait
crates/tetherd # daemon: D-Bus service, config, plugins (battery, notifications, deviceinfo, ping)
crates/tether-gtk # libadwaita app
crates/tether-cli
packaging/debian/ # control, rules, tetherd.service (user), ufw profile, desktop file, icons
packaging/systemd/tetherd.service
android/ # Gradle (Kotlin DSL), single :app module for M1
app/src/main/java/org/tether/android/{core,transport,pairing,discovery,service,features/{battery,notifications},ui,onboarding}
app/src/main/proto -> ../../../../proto (Wire codegen)
.github/workflows/{desktop.yml,android.yml}
Protocol v1 (M1 subset, proto/tether/v1/)
Envelope { uint64 seq; oneof msg { Hello, Ping, Pong, PairRequest, PairResponse, PairConfirm, PairReject, DeviceInfo, Battery, NotificationPosted, NotificationRemoved, NotificationAction, NotificationDismiss, IconRequest, IconBlob, StreamOpen } }Hello { device_id, name, kind(DESKTOP|PHONE), protocol_version=1, capabilities[] }sent by both right after TLS. Unpaired peers may only exchange Hello/Pair*/Ping.PairRequest { nonce(32B), qr_proof? }→PairResponse { nonce }→ both compute SAS → user confirms →PairConfirm/PairReject. 60 s timeout.Battery { level, charging, low },DeviceInfo { model, manufacturer, os_version, phone_number? }.NotificationPosted { key, package, app_name, title, text, big_text, sub_text, when_ms, category, ongoing, clearable, silent, conversation, icon_hash, actions[ {index, title, remote_input, result_key} ], messages[ {sender, text, ts} ] };NotificationRemoved { key, reason };NotificationAction { key, index, reply_text? }(index −1 = content intent “open on phone”);NotificationDismiss { key }; icons by hash (IconRequest→IconBlob{hash, png}), LRU cache on desktop.- UDP beacon
Beacon { device_id, name, kind, tcp_port, protocol_version }broadcast every 5 s while discoverable. - mDNS TXT:
id,name,kind,pv.
Milestone 1 (this session): pairing + notifications + battery, end to end
Deliverable: install the .deb on this Mint box, sideload the APK on the Samsung, discover, pair by QR or SAS, phone notifications appear as desktop notifications with working actions/replies/dismiss sync, battery shown in app + tray, survives phone screen-off/Doze and Wi-Fi reconnect.
Work streams run in parallel by subagents after I lay down the proto + skeletons:
Stream A — Rust core + daemon (tether-core, tetherd, tether-cli)
- Identity: rcgen P-256 self-signed cert, id = SHA-256(SPKI); store under
$XDG_DATA_HOME/tether/. - TLS: rustls 0.23 server+client with custom verifier (accept any self-signed → record fp; enforce pinned fp for paired ids). Framing codec (length-prefixed prost). Session state machine: Connecting → Hello → Unpaired/Paired → Ready; ping every 15 s, drop at 45 s; exponential reconnect.
- Discovery: Avahi D-Bus publish+browse via zbus proxies (
org.freedesktop.Avahi.Server,EntryGroup,ServiceBrowser,ResolveService); UDP beacon send/listen; manual address list in config. - Pairing handler (SAS + QR secret), trusted-device store (TOML), D-Bus signals for UI.
- Plugins:
battery(state + low-battery desktop notification),notifications(map toorg.freedesktop.Notificationswithreplaces_id, actions, icon files from blob cache; desktop dismiss →NotificationDismiss; action click →NotificationAction; reply actions surface as “Reply” that asks UI to open reply box),deviceinfo. - D-Bus API
org.tether.Daemonat/org/tether/Daemon:Devices,StartDiscovery,AddManualAddress,RequestPair(id),ConfirmPair(id, accept),GetPairingSas(id),GeneratePairingQr(); per-device object/org/tether/Devices/<id>: propsName, Kind, Paired, Connected, Battery(level, charging),Unpair(),SendNotificationAction,DismissNotification, signalsNotificationPosted/Removed. tether-cli:devices,pair <id>,qr,unpair,notify-test,log.- Tests: codec round-trip, pairing SAS vectors (shared with Android test vectors), in-process two-endpoint handshake + pairing + notification flow.
Stream B — Android app
- Gradle project, Wire protobuf codegen from
proto/, Compose Material3, Hilt or manual DI (manual; avoid overengineering), kotlinx-coroutines, CameraX + ZXing for QR. - Identity in AndroidKeyStore (EC P-256, self-signed),
SSLContextwith KeyStore KeyManager + pinning TrustManager (same rules as desktop). Framing codec + session state machine mirroring Stream A. Shared SAS test vectors. - Discovery:
NsdManagerdiscover_tether._tcp+ register own service; UDP beacon listen/send with multicast lock; manual IP entry; QR scan. TetherServiceforeground service (connectedDevice), persistent low-priority notification,BOOT_COMPLETEDrestart,ConnectivityManager.NetworkCallbackfor reconnect,START_STICKY.- Features:
BatteryReporter(ACTION_BATTERY_CHANGED),NotificationListener(NotificationListenerService: posted/removed, filter ongoing/group-summary/media/own, per-app blacklist, icon PNG + hash cache, MessagingStyle extraction, actions + RemoteInput reply via PendingIntent,cancelNotificationon desktop dismiss, content intent open). - Onboarding (Compose): welcome → POST_NOTIFICATIONS → notification access (detect restricted-settings state, explain “Allow restricted settings”) → battery optimisation exemption → Samsung sleeping-apps tip → find PC (list/QR/manual) → SAS confirm → CDM self-managed
associate()→ done. Main screen: PC card (connected/paired, battery sent), notification sync toggle, per-app filter list, disconnect/unpair. - Unit tests for codec/pairing; instrumentation smoke test optional.
Stream C — GTK app, packaging, docs
tether-gtk: libadwaitaAdwApplicationWindowwith sidebar of devices; device page shows battery, connection, notification list (with inline reply entry, dismiss, open-on-phone); pairing dialog shows QR (qrcodecrate → cairo) + SAS; manual-address dialog; preferences (per-app notification toggles, notification display on/off). Tray viaksniStatusNotifierItem (battery % + menu).- Packaging:
cargo-debmetadata,tetherd.serviceuser unit (enabled viasystemctl --userin postinst viadeb-systemd-helper), ufw application profile for 7360/tcp+udp,.desktop+ icon, apt repo scripts stub. - ADRs 0001–0011,
docs/reference/protocol.md,docs/reference/feature-parity.md(Phone Link feature × Tether status × tier), README with install/onboarding. - CI workflows (cargo fmt/clippy/test; gradle assembleDebug).
Integration (me, after streams): build .deb, install, build APK, adb install once phone is on USB or wireless, run through onboarding on the Samsung, fix issues, tag v0.1.0.
Environment setup required at execution start (network downloads): sudo apt install libgtk-4-dev libadwaita-1-dev protobuf-compiler libdbus-1-dev pkg-config build-essential, cargo install cargo-deb, Android cmdline-tools + platforms;android-35 + build-tools into ~/Android/Sdk, Gradle wrapper fetch, Rust crates fetch. Confirm with user before sudo apt install.
Milestone 1 status (2026-11-08)
Built and verified end to end on Linux Mint 22.2 (Cinnamon/X11) + Galaxy A55 (Android 16, One UI 8.5):
- Discovery via UDP beacon and Avahi mDNS; manual address and QR URI generation.
- Mutual TLS 1.3 between rustls and Conscrypt with hardware-backed P-256 identity on the phone.
- SAS pairing (desktop-initiated, confirmed on both sides), trusted store persisted, reconnect after daemon restart in ~1 s.
- Notifications: Gmail, WhatsApp, SMS mirrored with icons; replies to WhatsApp and SMS from the desktop delivered; dismiss from desktop removes on phone and clears desktop list;
adb shell cmd notification posttest notifications arrive within ~2 s. - Battery level + charging state shown on desktop.
- Resilience: connection held and notifications delivered during forced Doze with screen off; reconnect within ~1 s after Wi-Fi off/on.
- .deb packaged; GTK app runs against the live daemon.
Field findings and fixes:
- AndroidKeyStore TLS signing requires
DIGEST_NONEon the key (Conscrypt signs CertificateVerify pre-hashed). Fixed with automatic key regeneration. - The TLS listener must run whenever the app is visible so a desktop can dial before anything is trusted. Fixed (service starts on app foreground).
REQUEST_COMPANION_SELF_MANAGEDissignature|privilegedon this build; self-managed CDM association is unavailable to sideloaded apps. Onboarding step now skips itself; see ADR 0005 amendment. Bluetooth-filter association planned for M3; OTP visibility moves to the enhanced tier (M4).- Unpairing while the peer was offline left the peer believing it was still paired; it reconnected every second and both UIs flickered. Fixed on both sides: restricted frames on an unpaired session are ignored and answered with one
Unpair, pendingUnpairnotices are delivered on next contact,Unpairis allowed on unpaired sessions, and the phone applies real backoff when a session dies right afterHello(docs/reference/protocol.md “Stale trust”). - GTK app showed stale device state (no Disconnect/Unpair buttons, no SAS) after the daemon restarted while the app was open: the app rebuilt its device objects but kept pages bound to the orphaned objects. Fixed (pages re-bind when the object instance changes).
- QR URI now carries only real LAN addresses (no docker/veth bridges) and compact percent-encoding.
Not yet verified: GNOME Wayland session, phone reboot autostart, low-battery alert (needs a real discharge), QR scan path end to end (SAS path used), .deb install via dpkg (daemon was run from the build tree).
Known bugs and pending verification at hand-off are tracked in docs/handoff.md
(“Known bugs / open UX issues” and “Pending verification”). The user chose to proceed to
Milestone 2 and fix the pair/unpair/disconnect issues alongside it.
Cross-session continuity
This plan file is the canonical roadmap. At the start of execution it is copied into the repo as docs/roadmap.md and kept in sync; each milestone closes with a roadmap update and an ADR for any decision that changed. Future sessions read docs/handoff.md first, then docs/roadmap.md, docs/adr/, and docs/reference/feature-parity.md. Every feature in the parity matrix records: Phone Link behaviour, Tether status (planned/partial/done), tier (normal/enhanced), milestone.
Milestone 2 — Messages & everyday sync (normal tier)
Deliverable: desktop Messages app at Phone Link parity (threads, SMS/MMS send/receive with attachments, contact names/photos, emoji/GIF-free but image attach), media controls, DND, find-my-phone, signal, clipboard, file send both ways, Photos gallery. No cap at 30 days / 2000 photos (configurable).
Protocol additions (proto/tether/v1/messages.proto, contacts.proto, media.proto, files.proto, photos.proto, misc.proto):
- Conversations:
ConversationsRequest{since_ms}→ConversationList{threads[{thread_id, addresses[], snippet, date_ms, unread, message_count, archived}]};MessagesRequest{thread_id, before_ms, limit}→Messages{thread_id, messages[]};MessageEvent{message}pushed on ContentObserver change;Message{id, thread_id, addresses[], body, date_ms, type INBOX|SENT|DRAFT|OUTBOX|FAILED|QUEUED, read, sub_id, attachments[{part_id, mime, size, thumb_hash}]};SendMessage{request_id, addresses[], body, sub_id, attachments[{name, mime, size}]}followed by oneStreamOpen{purpose=ATTACHMENT, request_id, index}per attachment;SendMessageResult{request_id, ok, error, message_id};AttachmentRequest{part_id}→ stream. - Contacts:
ContactsRequest{known[{uid, version_ts}]}→ContactsDelta{upserts[{uid, version_ts, vcard}], deleted[]}; photos as blobs by hash via existingIconRequest/IconBlobgeneralised toBlobRequest/Blob. - Media:
MediaSessions{sessions[{id, package, app_name, title, artist, album, art_hash, playing, position_ms, duration_ms, can_seek, can_next, can_prev}]},MediaCommand{session_id, PLAY|PAUSE|TOGGLE|NEXT|PREV|STOP|SEEK{pos_ms}},PhoneVolume{stream MUSIC|RING|CALL, level, max},SetPhoneVolume. - Misc:
DndState{filter ALL|PRIORITY|ALARMS|NONE},SetDnd;RingPhone{start};Connectivity{sims[{sub_id, carrier, network_type, level_0_4}], wifi_ssid, wifi_level};Clipboard{text | image_hash}both directions. - Files:
FileOffer{transfer_id, files[{name, size, mime, mtime_ms}]}→FileAccept{transfer_id, accepted, save_dir_hint}→ per fileStreamOpen{purpose=FILE, transfer_id, index};TransferProgress{transfer_id, bytes};TransferCancel;ShareText{text|url, open}. - Photos:
MediaQuery{kind IMAGE|VIDEO|SCREENSHOT|ALL, limit, before_ms, album}→MediaItems{items[{id, name, mime, date_ms, size, w, h, duration_ms, thumb_hash, album}]};ThumbnailRequest{id, max_px}→Blob;MediaFetch{id}→ stream;MediaDelete{ids[]}→MediaDeleteResult(Android 14:MediaStore.createDeleteRequestneeds on-phone confirm unlessMANAGE_EXTERNAL_STORAGE, which we hold as sideload).
Android work: permissions READ_SMS, SEND_SMS, RECEIVE_SMS, RECEIVE_MMS, RECEIVE_WAP_PUSH, READ_CONTACTS, READ_PHONE_STATE, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, MANAGE_EXTERNAL_STORAGE (opt-in step), ACCESS_NOTIFICATION_POLICY (DND, settings deep-link). SmsRepository over Telephony.Sms/Mms/Threads + ContentObserver; SmsManager.sendMultipartTextMessage, MMS via Klinker android-smsmms (Apache-2.0) or own PDU encoder + sendMultimediaMessage; sent/delivered PendingIntents → results. ContactsRepository (vCard export via ContactsContract + photo). MediaSessionManager.getActiveSessions (listener component). NotificationManager.setInterruptionFilter. RingPhone: play alarm-stream ringtone at max volume + vibrate, full-screen activity to stop. Connectivity via TelephonyManager per SIM + WifiManager. Clipboard: receive → ClipboardManager.setPrimaryClip; send → Quick Settings tile + share-sheet target + “Send clipboard” notification action. Share-sheet target activity (ACTION_SEND, ACTION_SEND_MULTIPLE) → FileOffer to chosen PC. MediaStore queries with thumbnails via ContentResolver.loadThumbnail. Received files → Downloads/Tether/.
Desktop work: SQLite cache (rusqlite) per device for threads/messages/contacts/media index; Messages view (thread list with avatars, conversation bubbles, attachment previews, composer with contact autocomplete, GTK EmojiChooser, attach files/recent phone photos, send progress/failure); Contacts cache + search; media widget on device page + MPRIS player org.mpris.MediaPlayer2.tether_<id> so desktop media keys and applets control phone playback; DND switch, Ring phone button, signal/SIM display in header; Photos grid (thumbnails lazy, infinite scroll, drag-out via GtkDragSource with on-demand fetch to temp, open with default app, save, delete with confirm, screenshots tab); Send files (file chooser, drop target on device page and tray menu), receive to ~/Downloads/Tether/ with notification + “Open folder”; clipboard sync (GTK clipboard watch when app/daemon has focus on Wayland, X11 via XFixes selection events in daemon) with per-direction toggles; D-Bus API extensions; Cinnamon/GNOME tray parity (AppIndicator fallback note in docs).
Verification: send/receive SMS and MMS with image both ways with real carrier; thread list matches phone’s Messages app; contact names + photos resolve; play/pause Spotify from desktop and via media keys; DND toggle reflects on phone; Ring phone rings even when silent; drag a photo from Photos grid to Nemo; delete a photo from desktop; send 3 files PC→phone via drop and phone→PC via share sheet; clipboard text PC→phone instant, phone→PC via tile.
Milestone 2 status (closed 2026-11-11, released as 0.2.0)
Released as v0.2.0 (CI-built .deb, signed APK). Tests: desktop 84 (core 18 unit + 24 integration incl. the pair/unpair/disconnect matrix, tetherd 16, GTK 26), Android 55 unit tests; clippy (stable 1.99), fmt and lint clean.
Verified on the Galaxy A55: pairing survives app upgrades; all 18 capabilities negotiated; full thread/message sync (57/57 threads) with live updates for sent and received SMS; SMS send and receive on a real carrier; 447 contacts with photos; photo index, thumbnails, fetch and delete without a phone prompt (all-files access); volumes, DND state, SIM/connectivity; clipboard synced automatically both ways (phone side via the one-time adb grants, ADR-0013 amendment); 3 MB file desktop → phone byte-identical; Disconnect hold on both sides and Connect resume (ADR-0012); GTK app against the real daemon.
Changes during M2 testing: the phone observed only content://mms-sms/, which the platform does not notify for SMS changes, so live updates never fired (now observes content://sms and content://mms too); clipboard became automatic in both directions instead of “send” buttons; photo delete falls back to removing the file when the provider refuses.
Carried over to M3 verification: MMS send on a carrier, media sessions/MPRIS with a playing phone, Ring, phone → desktop files via the share sheet, drag-out to Nemo, GNOME Wayland session, desktop notifications for messages and files. Deferred: DND-aware delivery and quiet hours, per-app badges, wallpaper header. Checklist: docs/contributing/checklists/milestone-2.md.
Milestone 3 — Calls (normal tier + Bluetooth)
Deliverable: incoming-call banner with answer/decline, dialer with contact search, 90-day+ call log, in-call window (mute, hangup, transfer to phone), audio over Bluetooth HFP with PC as hands-free unit, media auto-pause, ringtone on PC.
Protocol: CallState{calls[{id, number, display_name, photo_hash, state RINGING|DIALING|ACTIVE|HOLDING|ENDED, direction, start_ms}]}; CallCommand{ANSWER|REJECT|HANGUP|DIAL{number}|MUTE{on}|ROUTE{BT|PHONE}}; CallLogRequest{since_ms} → CallLog{entries[{id, number, name, type INCOMING|OUTGOING|MISSED|REJECTED, date_ms, duration_s}]}; BtIdentity{mac, name} both ways for pairing automation.
Android: TelephonyCallback.CallStateListener + READ_CALL_LOG broadcast extras for number; TelecomManager.acceptRingingCall()/endCall() (ANSWER_PHONE_CALLS); dial via TelecomManager.placeCall (CALL_PHONE); mute via AudioManager.setMicrophoneMute; route via AudioManager.setCommunicationDevice(BT device) (API 31+) with fallback to automatic HFP routing; DTMF impossible for non-dialer apps → in-call keypad marked Enhanced-tier/unsupported (documented gap, Phone Link also lacks */# on Samsung); CallLog provider reads; contact photo lookup.
Desktop: BlueZ D-Bus (org.bluez.Adapter1/Device1/Agent1): guided pairing flow from protocol-exchanged MAC (start discovery, pair with passkey confirm shown on both, trust, connect HFP), auto-reconnect HFP when phone connects over Wi-Fi; PipeWire: detect HFP source/sink nodes (pw-dump/libpipewire or wpctl-equivalent via pipewire-rs), switch default sink/source during call, restore after; ringtone via GStreamer playbin on PC speakers; incoming-call banner (GTK window always-on-top + freedesktop notification with Answer/Decline actions); in-call window with timer, mute, hangup, transfer-to-phone (ROUTE PHONE + disconnect SCO); dialer with contact search/history; call log view; pause MPRIS players on RINGING, resume after; optional use of org.pipewire.Telephony when PipeWire ≥1.4 is detected (future distros).
Risks: HFP role negotiation (ensure PipeWire takes HF role, phone AG; disable hfp_ag role in WirePlumber config if conflicting), SCO/mSBC quality on specific adapters, Samsung audio routing to BT only when BT is “active for calls” (user guidance). Verification: call from another phone → banner within 1 s → answer on PC → two-way audio through PC → hangup on PC; outgoing dial from desktop; missed call appears in log and as notification; transfer to phone mid-call.
Milestone 3 status (released as 0.3.0 on 2026-11-15)
Built on all three stacks (contract 1910c34, Android 4470b82, desktop bbdbf4f, GTK c98c57f). Tests: desktop 131 passing, Android 84; clippy clean on stable 1.99. Verified on the A55: calls/calls.dial/calllog/bluetooth negotiated, call log synced with contact names, Bluetooth state reported. Pending a human: real incoming/outgoing calls (checklist docs/contributing/checklists/milestone-3.md K1–K7), Bluetooth pairing and HFP audio on the PC (B1–B6), the PipeWire profile name (audio-gateway vs headset-head-unit) on real hardware, One UI call-companion binding via telecom add-or-remove-call-companion-app.
Update 2026-11-15: call audio verified on the A55 with the laptop’s own speakers and microphone, both call directions (incoming and outgoing), two-way audio clear and without echo, switching This PC / Phone / Speaker from the in-call window. Three fixes got it there: the daemon recognises PipeWire’s stream-class HFP nodes and follows the graph during a call, the phone’s in-call service is bound through the app-op MANAGE_ONGOING_CALLS (the telecom add-or-remove-call-companion-app route has no effect on One UI 8.5), and the daemon runs a WebRTC echo canceller on the microphone path. Details and open items: docs/notes/2026-11-15-call-audio-spike.md, ADR-0015 amendment. Tests: desktop 134 passing, Android unit tests passing. Still open from the checklist: K4–K5 and B5 were not walked through formally, the grant after a phone reboot, GNOME Wayland.
Released as 0.3.0 on 2026-11-15 after a final test with the release .deb (audio switching and echo cancellation confirmed in the daemon log). Carried over as known issue: occasional static-like noises during PC calls, see the open items in the spike notes.
Milestone 4 — Enhanced tier via adb (mirroring, app streaming, audio, grants)
Deliverable: one-time “Enhanced setup” on phone (Developer options → Wireless Debugging; Samsung Auto Blocker off) + desktop-driven adb pair; thereafter desktop launches our shell helper whenever the phone is reachable and unlocks: whole-screen mirroring with input, per-app streaming windows, phone audio to PC, clipboard phone→PC, auto-grants (notification access, RECEIVE_SENSITIVE_NOTIFICATIONS, battery whitelist, MANAGE_EXTERNAL_STORAGE), screen-off-while-mirroring, phone as webcam.
Shell helper: new entry point org.tether.shell.Main inside the same APK, started with adb shell CLASSPATH=$(pm path org.tether.android) app_process / org.tether.shell.Main --token …; connects back to the daemon (via adb reverse or LAN TLS with one-time token) and speaks a Shell* message family. Uses reflection/AIDL stubs for IInputManager.injectInputEvent, DisplayManager/SurfaceControl virtual displays (trusted flags), MediaCodec surface encoding (H.264 default, H.265/AV1 option), AudioRecord with REMOTE_SUBMIX/playback capture + Opus, IClipboard read (shell package), appops/pm grant/cmd notification allow_listener/settings put/dumpsys deviceidle whitelist. Desktop restarts the helper on drop; detects Wireless Debugging reset after reboot and prompts; USB fallback (adb over cable) always available. Samsung Knox: document app_process quirks (configuration controller fix as in scrcpy).
Protocol: ShellHello{abilities[]}; MirrorStart{target MAIN|NEW_DISPLAY{w,h,dpi}, codec, bitrate, max_fps, max_size, screen_off, show_touches} → StreamOpen{purpose=VIDEO, mirror_id} carrying codec-config + framed access units with PTS; MirrorStop; InputEvent{touch{action, pointer_id, x, y, pressure} | key{action, keycode, meta} | scroll{x, y, hscroll, vscroll} | text{utf8}} targeted by display_id; AppListRequest → AppList{apps[{package, label, icon_hash, launchable}]}; StartApp{package, display_id}; AudioStart{source OUTPUT|PLAYBACK_DUP, codec OPUS} → stream; ClipboardRead → Clipboard; GrantRequest{items[]} → GrantResult; CameraStart{facing, size, fps} → video stream for webcam.
Desktop: adb integration (require distro adb ≥34; locate binary; adb mdns services or Avahi browse _adb-tls-pairing._tcp/_adb-tls-connect._tcp; pairing wizard where user types the 6-digit code shown by phone); mirror window with GStreamer pipeline appsrc ! h264parse ! (vah264dec|avdec_h264) ! gtk4paintablesink (statically linked gst-plugin-gtk4), input mapping (left=tap, right=back, middle=home, scroll, long-press, keyboard incl. text commit, clipboard paste), window resize → --flex-style display resize; App Streaming: launcher grid from AppList, one NEW_DISPLAY per app in its own GTK window, “Pin to desktop” writes .desktop launching tether app <pkg>; Phone audio toggle (GStreamer opusdec ! pipewiresink); Webcam: CameraStart → decode → v4l2sink to v4l2loopback device with module/DKMS detection and install guidance; Enhanced setup wizard in app + CLI tether enhance.
Verification: pair wirelessly once; reboot phone → desktop detects helper missing and guides; mirror at ≤100 ms perceived latency on LAN; type into a phone app from PC keyboard; open WhatsApp in a separate window via app streaming while phone screen stays off; phone audio plays through PC; OTP SMS notification visible on desktop on Android 15 after grant; clipboard copied on phone appears on PC without any phone interaction; webcam appears in a video call app.
Milestone 4 phasing and status (started 2026-11-15)
Research: docs/notes/m4-research-shell-helper.md, docs/notes/m4-research-desktop.md. Decisions: ADR-0016 (adb integration), ADR-0017 (shell helper), ADR-0018 (media pipeline). Contract: proto/tether/v1/enhance.proto, shell.proto, docs/reference/protocol.md “Enhanced tier”, docs/reference/dbus-api.md “Milestone 4 additions”.
Changes against the plan above: QR pairing first with the 6-digit code as fallback; private adb server; the helper token goes over stdin, not argv; main-display capture through DisplayManager.createVirtualDisplay only; RECEIVE_SENSITIVE_NOTIFICATIONS is an app-op, not a pm grant; the app list comes from the normal app; audio sink is pulsesink; grants include MANAGE_ONGOING_CALLS (M3) and WRITE_SECURE_SETTINGS (lets the app re-arm Wireless debugging after a reboot).
- M4.1 adb set-up (QR/code pairing, USB), device linking, helper lifecycle with probed abilities, auto-grants, clipboard through the helper, whole-screen mirroring with input, screen off, stay awake; Enhanced set-up wizard, mirror window,
tether-cli enhance/mirror. Status 2026-11-15: built on all three stacks on branchm4-enhanced. Verified on the A55 over USB: linking, helper with all five abilities, grants read-back, H.264 mirror stream into the mirror window’s decoder (nvh264dec), input events in the phone’s input queue, screen off and its restore after a killed helper, clipboard through the helper. Tests: desktop 200, Android 109. Not yet verified: Wireless debugging pairing by QR and by code, Wi-Fi reconnect after a port change, re-arm after a phone reboot, Auto Blocker, typing/paste/scroll into real apps, rotation, measured latency, Wayland, VA-API decoders. Update: Wireless debugging verified by the user on 2026-11-15 (QR pairing, mirroring over Wi-Fi) after the stale-port and re-arm fixes. - M4.2 (started 2026-11-15; contract in
shell.proto/enhance.proto,docs/reference/protocol.md“App streaming and phone audio”,docs/reference/dbus-api.md) app streaming (virtual display per app, launcher grid, pin to desktop), phone audio on the PC. Status 2026-11-15: built on all three stacks. Verified on the A55: ten helper abilities, the app list (through the daemon), an app in its own window (Calculator on a virtual display, decoded in the app window), several mirrors at once, resize,app_closed, typing into app displays, all three audio sources at the helper level (Opus decodes, real audio). Tests: desktop 234, Android unit tests passing. Not yet verified: phone audio played through the daemon on the PC, the Apps tab and pinning against the real phone,StartAppon the main display, an app already open on the phone’s own screen, landscape-only apps, Wayland window class. Open contract gaps: no “keep the app on the phone when the window closes” option;Mirrors[].display_idis always 0. M4.1 and M4.2 released as 0.4.0 on 2026-11-16, with the unverified M4.2 items listed in the release notes and indocs/notes/2026-11-15-m4-session-notes.md. - M4.3 (started 2026-11-28; ADR-0019; contract in
shell.proto“Camera”,docs/reference/protocol.md“Phone as webcam”,docs/reference/dbus-api.md“M4.3 members”) phone as webcam: camera capture in the shell helper, daemon-owned pipeline into a v4l2loopback device, guided module set-up through polkit, webcam controls in the app andtether-cli webcam. Changes against the plan above: the camera stream goes to the daemon on its own helper connection, not throughStreamOpen; orientation is a user setting applied on the desktop; no normal-tier (foreground service) camera and no PipeWire camera node in this phase. Status 2026-11-28: built on all three stacks on branchm4.3-webcam. Verified on the A55 (now Android 17, sdk 37) through a debug daemon over USB: abilitycamera, four cameras listed,Webcamon tostreaming(camera 0, 1280 x 720 at 30 fps,nvh264dec), frames read back from/dev/video42as YUYV 1280 x 720, switch to the front camera and rotation while a reader held the device, switch off releases the camera on the phone. At helper level: start to first key frame 0.84 to 1.47 s, bitrate/torch/zoom/key-frame changes,busy,camera_disconnectedwhen another client opens the camera, release after a killed helper. Tests: desktop workspace passing (tetherd105,tether-gtk124), Android 128. Not yet verified:SetUpWebcamthroughpkexecfrom the installed service (the unit hasNoNewPrivileges, so the daemon goes throughsystemd-run --user),persist/remove, the camera in a real call app or browser, the GTK webcam group and set-up dialog against the real daemon, the picture itself (tests only counted frames and luma statistics), phone locked or screen off, the camera privacy switch (camera_disabled), Wi-Fi transport, Wayland. Found on the way:v4l2sinkneeds the device’s own colorimetry in the caps (the daemon queries the sink pad); v4l2loopback 0.12.7 has nov4l2loopback-ctl add, so a module that is already loaded without our device cannot be extended (0.13+ only). Update 2026-11-28, checked by the user with the debug build: the “Webcam” group in the app, the camera listed and working in a call app, and the webcam over Wireless debugging with the cable unplugged (after pairing again; the pairing from 2026-11-15 had stopped working, probably through the phone’s update to Android 17). Still not verified:SetUpWebcamthroughpkexecfrom the installed service,persist/remove, phone locked or screen off, the camera privacy switch, Wayland, measured latency.
Milestone 5 — Files, phone-side controls, resume, relay, Flatpak, iOS spike
- Files in file manager:
FileOpsprotocol (ListDir, Stat, Read{off,len}, Write, Mkdir, Rename, Delete, Trash), phone side overjava.io.FilewithMANAGE_EXTERNAL_STORAGE(SAF fallback if denied), desktop FUSE filesystem viafusermounted at~/Tether/<phone>with Nemo/Nautilus sidebar bookmark, 30-day trash folder semantics like Phone Link, thumbnails viaThumbnailRequest. - Phone-side PC controls:
PcState{battery, network, locked}to phone;PcCommand{LOCK | SEND_CLIPBOARD | OPEN_URL}(lock viaorg.freedesktop.ScreenSaver/loginctl lock-session); phone UI gets PC card, send files, clipboard history, start mirroring from phone. - Cross-device resume: phone “Continue on PC” share target + browser URL hand-off → desktop opens URL/app mapping (Spotify URI → spotify, WhatsApp → web.whatsapp.com); desktop → phone “Open on phone” for URLs. Documented as partial parity (no OEM task-continuity API).
- Instant hotspot: spike only. Normal apps cannot start tethering; shell
cmd wifi start-softap/svcpaths tested on Samsung; if impossible, fall back to “turn on hotspot” deep link + saved Wi-Fi credentials push to PC via NetworkManager. Decision recorded in ADR. - Relay (reachability phase 2):
tether-relaycrate: devices authenticate with their identity key, rendezvous by paired-id, relay forwards opaque TLS bytes (end-to-end encryption preserved, relay cannot read); phone keeps the FGS socket to the relay with adaptive keepalive (no FCM, no Play dependency); desktop always connected; UDP hole-punch optional later; Docker image + docs for self-hosting; optional hosted default configurable in both apps; sameEnvelopeprotocol, zero plugin changes. - Flatpak: manifest with
--share=network --socket=wayland --socket=fallback-x11 --socket=pulseaudio --allow=bluetooth --system-talk-name=org.bluez --talk-name=org.freedesktop.Notifications --talk-name=org.freedesktop.Avahi --device=all, bundledadb; document features degraded in sandbox. - Wayland/GNOME polish: GNOME Shell extension (indicator + quick settings toggle) consuming the daemon D-Bus API; KDE Plasma applet optional; portal RemoteDesktop for phone→PC remote input (reverse mousepad) optional.
- iOS spike: BlueZ ANCS (GATT client), obexd MAP/PBAP clients, HFP via PipeWire → decide whether “Tether for iPhone (basic)” ships; no iOS app.
Milestone 6 — Release hardening
Localization (gettext + Android string resources), accessibility (GTK a11y labels, TalkBack), opt-in diagnostics/log export, crash-free soak test (48 h connected), docs site, parity matrix complete, v1.0.0.
Verification (M1)
cargo testindesktop/(codec, pairing vectors, in-process handshake)../gradlew testinandroid/.- Install .deb:
systemctl --user status tetherdactive;tether-cli deviceslists nothing;tether-cli qrprints QR URI. - Sideload APK on Samsung (USB
adb installor copy). Onboarding grants notification access + battery exemption; CDM dialog appears and association is created. - Discovery: phone lists this PC within 5 s on same Wi-Fi; PC lists phone. Manual IP path tested with mDNS disabled.
- Pair via QR; unpair; pair via SAS (digits identical on both screens; mismatch test by rejecting).
- Notifications: send a Telegram/SMS/WhatsApp message to phone → desktop notification with icon within 1 s; click “Reply”, type, send → message delivered from phone; dismiss on desktop → gone on phone; dismiss on phone → desktop notification closes; “Open on phone” launches app on phone.
- Battery: unplug/plug charger → tray and app update; drop below 15 % → desktop low-battery alert.
- Resilience: phone screen off 15 min → still connected or reconnects within 10 s of screen-on; toggle phone Wi-Fi → reconnects; restart
tetherd→ phone reconnects; reboot phone → service auto-starts and reconnects. - GNOME Wayland session: log in, confirm notifications, tray fallback behaviour, app renders.
Later: finish the rename to Tetheron
Since December 2026 the project, its documentation and the app titles say
Tetheron. Everything a program or another device identifies us by still says
tether, so that existing installations and pairings keep working. Renaming
those is one coordinated, breaking release with a migration, not something to
do piecemeal:
- binaries and the package:
tether,tetherd,tether-cli, the.debname,tetherd.service, the ufw profileTether; - Rust crates
tether-*and theorg.tether.shell/org.tether.androidKotlin packages; - D-Bus names
org.tether.Daemon*, the app idorg.tether.Tether, icons and the desktop entry; - the Android application id
org.tether.android(a new id is a new app to Android: users reinstall and pair again); - paths (
~/.config/tether,~/.local/share/tether,~/Downloads/Tether), environment variablesTETHER_*, the mDNS service_tether._tcp, thetether://pairing URI and the virtual camera label “Tether Phone Camera”; - remaining user interface text and log tags that say Tether.
Engineering notes
These are working notes written while Tether was being built: research reports, spikes and session records. They are kept because the decisions in the architecture decision records cite them, and because they record measurements and dead ends that are expensive to rediscover.
They are a record, not a guide. Each note describes what was known on the day it was written and is not updated afterwards; where a note and the rest of this documentation disagree, the reference and the code are right.
| Note | What it records |
|---|---|
| Call audio spike (2026-11-15) | Why call audio did not reach the PC, how PipeWire exposes a phone’s hands-free link, and the echo cancellation set-up that worked |
| Milestone 4 session notes (2026-11-15) | What was and was not verified on a real phone for the enhanced tier, and the privacy rules for device tests |
| Milestone 4 research: desktop | adb integration, video decoding and presentation, audio and virtual camera options on Linux |
| Milestone 4 research: shell helper | What a process running as shell can do on Android: displays, input, audio, camera, clipboard |
Call audio spike: learnings (2026-11-15)
Field notes from getting Milestone 3 call audio working end to end on the
author’s hardware. Read this before touching tetherd’s features/audio.rs,
pipewire.rs or the phone’s TetherInCallService. Decisions are in
ADR-0015 (with its 2026-11-15 amendment); the D-Bus behaviour is in
docs/reference/dbus-api.md (“Call audio”, “Echo cancellation”, “SetCallAudio”).
Setup this was learned on
| Part | Version |
|---|---|
| Desktop | Linux Mint (Ubuntu 24.04 base), kernel 6.17 OEM, Cinnamon/X11 |
| Audio | PipeWire 1.0.5, WirePlumber 0.4.17, pipewire-pulse |
| Bluetooth adapter | Realtek RTL8852BU (USB 0bda:4853), BlueZ from the distro |
| Phone | Galaxy A55, Android 16 / One UI 8.5 |
| Call codec | mSBC (wideband), PC = HFP hands-free, phone = audio gateway |
Starting symptoms
- Calls could be placed and answered from the laptop, but the in-call window always said “Audio on the phone” and the caller mostly could not hear the laptop user.
- The audio buttons (This PC / Phone / Speaker) did nothing.
Findings
1. PipeWire exposes a phone’s call audio as streams, and only while SCO is up
The daemon looked for HFP nodes with media.class Audio/Source and
Audio/Sink. That is what a headset card exposes. When the remote device is
a phone (we are the hands-free unit), PipeWire’s sco-source.c / sco-sink.c
create:
| Node | media.class | Direction |
|---|---|---|
bluez_input.<MAC>.N | Stream/Output/Audio | caller’s voice into the graph |
bluez_output.<MAC>.N | Stream/Input/Audio | our microphone to the phone |
Both carry media.role = Communication and api.bluez5.profile = headset-audio-gateway. Because they are streams, WirePlumber links them to
the default sink and source by itself; no pw-link is needed in the normal
case.
They are also dynamic: bluez5-device.c emits them when the SCO transport
goes to pending/active and removes them when it goes idle. Consequences:
- “The HFP nodes exist” is the reliable signal for “call audio is on the PC”. The daemon now polls the graph once a second during a call instead of waiting 3 s once and giving up.
- Selecting the card profile does not create them. The profile on this
machine is always
audio-gatewayalready. - The PC cannot pull the audio to itself. PipeWire only opens SCO when a node is started, and there is no node without SCO. Moving audio to the PC always needs the phone to open the link.
- The PC can push audio away: switching the phone card’s profile to
offdestroys the nodes, which closes SCO; Telecom then falls back to the earpiece. The daemon restores the profile about half a second later so the next call can use the PC again. This is the fallback for “Phone” when the phone refusesROUTE.
The old unit-test fixture had the wrong classes, which is why the tests were green while the feature never worked. The fixture now uses the classes and port names seen on the real graph.
How to see it: during a call, pw-dump | grep -c headset-audio-gateway and
pw-link -l | grep -A2 bluez_.
2. Android 16 binds a third-party InCallService only with MANAGE_ONGOING_CALLS
Without a bound InCallService the app cannot route call audio
(setCommunicationDevice and setSpeakerphoneOn only affect the app’s own
audio; BluetoothHeadset.connectAudio is privileged), so every ROUTE
answered route_unsupported.
What does not bind the service on One UI 8.5:
- holding
CALL_COMPANION_APP(granted, normal permission); adb shell telecom add-or-remove-call-companion-app org.tether.android 1(exit code 0, no effect; Telecom logsSkipping binding to … control: false, car-mode: false, ui: false).
What does:
adb shell appops set org.tether.android MANAGE_ONGOING_CALLS allow
plus <uses-permission android:name="android.permission.MANAGE_ONGOING_CALLS"/>
in the manifest (signature|appop; the app-op check needs the declaration).
The clue was adb shell appops get org.tether.android MANAGE_ONGOING_CALLS
showing a fresh rejectTime right after a call started. An app-op grant is
expected to survive reboots (not yet re-checked after a reboot). With it,
requestCallEndpointChange works for Bluetooth, earpiece and loudspeaker, and
the service also gives exact per-call state.
This belongs to the adb tier (ADR-0007); the M4 “auto-grants” step should apply it together with the other grants.
3. No echo cancellation means the caller loses our voice
Once audio flowed, the caller heard roughly 60–70 % of the speech cleanly, with gaps, and sometimes heard themselves. Cause: laptop speakers feed the caller’s voice back into the laptop microphone. PipeWire’s hands-free role does not announce echo cancellation, so the phone (and the network) treat the returning voice as echo and suppress our uplink while the far end makes sound.
Fix: PipeWire’s module-echo-cancel with the WebRTC canceller on the
microphone path for the duration of a call, only when the call uses the
default sink and source (a headset does not need it).
Two layouts were tried:
| Layout | Result |
|---|---|
Virtual sink + virtual source (pactl load-module module-echo-cancel), both call directions moved onto them | Echo gone, but one side dropped out intermittently; more dropped-buffer messages and an ALSA resync |
Monitor mode (monitor.mode = true): caller’s voice stays linked to the real sink, the canceller reads the sink’s monitor as reference, only the microphone side moves to tether_call_mic | Echo gone, both directions clear |
Monitor mode is not reachable through pipewire-pulse’s module-echo-cancel
arguments, and a module loaded with pw-cli load-module dies with pw-cli.
The daemon therefore writes a small config to
$XDG_RUNTIME_DIR/tether-echo-cancel.conf and runs pipewire -c <conf> as a
child (killed when the calls end or the daemon exits). The phone’s microphone
node is pointed at the cancelled source with
pw-metadata <node id> target.object tether_call_mic; WirePlumber 0.4 accepts
a node name there and moves the link.
Things to keep in mind:
- The first 2.5–4 s of a PC call run without cancellation: the daemon waits for WirePlumber’s own linking (which may itself wait 2 s for a remembered target) before it starts the canceller.
- After a mid-call switch away and back, the new SCO link brings new nodes, and PipeWire may reuse the old node ids. The “already targeted” list must be cleared when the nodes disappear.
- WirePlumber’s
restore-streamremembers the target under the generic keyInput/Audio:media.role:Communication. It only applies a remembered target when that node exists, so the entry is harmless outside calls. - While the canceller owns the routing, the daemon must not add links to the raw microphone “to repair” a moment without links.
4. Things that looked like causes and were not
- Quantum. WirePlumber logs
out of buffers on port 0 1during calls (the mic stream handing buffers to the SCO sink). Forcing a small quantum (clock.force-quantum 256) in an A/B test made it worse (16 messages in 20 s against 0–5 at the default 1024). The loss at the default is around 100 ms per 20 s, far too little to explain missing words. Not changed. Bluetooth: hci0: corrupted SCO packetin the kernel log on the Realtek adapter: appeared in bursts, not during the bad stretches of the A/B call. mSBC was kept; forcing CVSD was not needed.- Microphone level, phone microphone mute, WirePlumber’s remembered target pointing at absent earbuds: all checked and ruled out.
How the daemon behaves now
CallAudiofollows the graph, including switches made on the phone.- Once per call it sends
ROUTE bluetoothwhen the user wants PC audio and the phone did not pick the PC. - 2.5 s after the nodes appear it adds any missing link to the default devices and leaves a direction alone that the session manager linked elsewhere (a headset).
- It runs the echo canceller as described (config key
call_echo_cancel, default true). SetCallAudio phonefalls back to closing SCO from the PC when the phone refuses;speakerandpcreport a readable reason instead.
Diagnosis recipe for next time
- Daemon:
journalctl --user -u tetherd | grep -E 'CallAudio|call audio|echo'. - Graph during the call:
pw-dump(node classes, state),pw-link -l,pw-top -b -n 2. - Session manager and kernel:
journalctl --user -u wireplumber -u pipewire,dmesg | grep -i sco. - Phone:
adb logcat | grep -E 'Tether\.Calls|InCallController',adb shell dumpsys bluetooth_manager(sectionHeadsetService: state machine log shows when SCO opened and closed),adb shell dumpsys telecom | grep -i tether,adb shell appops get org.tether.android MANAGE_ONGOING_CALLS. - Read the PipeWire source for the installed version rather than guessing:
spa/plugins/bluez5/{sco-source,sco-sink,bluez5-device,backend-native}.c. - When the far end’s experience is the question, run a timed A/B during one call with desktop notifications naming each phase, and ask the other side which phase was clean.
Process lessons
- A capture armed before the call (graph snapshots every 2 s while the HFP nodes exist) answered more than any amount of reading. Arm it before every test call.
- Unit tests built on an assumed
pw-dumpshape gave false confidence. Take fixtures from a real capture. pw-dumpcan print a second JSON array when the graph changes while it runs; parse the first value only.pkill -fmatched the calling shell again during this work. Usepkill -x, or a pattern that cannot match the caller.
Open items
-
Occasional static-like noises during PC calls (reported by the user on the final test with the release build, 2026-11-15; accepted for 0.3.0). Not diagnosed. Candidates: the remaining
out of buffersdrops on the microphone path,corrupted SCO packetbursts from the Realtek adapter with mSBC, or WebRTC canceller artefacts (try its noise-suppression and gain-control arguments, or CVSD). Capturepw-top, the WirePlumber journal anddmesgduring a call where it happens. -
Re-check the app-op grant after a phone reboot.
-
Each switch back to the PC re-points the microphone node about a second after the nodes appear; until then the raw microphone is linked.
-
Cancellation starts a few seconds into the call; starting the canceller as soon as the nodes appear would close that gap.
-
In-band ringing opens SCO while the call still rings, so the PC ringtone and the phone’s ringtone can both play on the PC.
-
The small
out of buffersloss on the microphone path remains (PipeWire 1.0 SCO sink following the ALSA clock); revisit on PipeWire ≥ 1.2. -
Other adapters and phones are untested. If one-way audio shows up with everything linked, try CVSD (
bluez5.enable-msbc = falsein a WirePlumber drop-in); note that it also narrows headset microphones on that PC.
Milestone 4.1 / 4.2 session notes (2026-11-15)
Recorded at the user’s request at the end of the session that built the
enhanced tier (adb set-up, shell helper, mirroring, app streaming, phone
audio). Status and open items are also in docs/roadmap.md “Milestone 4
phasing and status”; this file keeps the session’s own account, including
what went wrong during testing.
Privacy incidents during the Android agent’s device tests
The test phone is the user’s daily phone. During the automated tests of the shell helper on it:
- WhatsApp chat lines. A UI-dump command (
uiautomator dump --display-id N) ignored its display argument on this build and dumped the phone’s main screen, which was showing a WhatsApp conversation. Several message lines landed in the agent’s test output. The agent removed that option from the test tool and deleted the dump on the phone, and did not repeat the content. Nothing of it is in the repository or in the reports. - The user’s own playback. Something was playing on the phone, so the three audio test captures recorded it. The agent measured levels only and deleted the files. The phone speaker was silenced for about 10 s in total.
- Clipboard value. One captured frame showed a clipboard “paste suggestion” chip in Calculator; the frame was deleted.
- App list. The installed apps (63) were listed through the CLI to verify the feature, so those names passed through the session.
- Recents. Calculator, Clock and Settings were opened on virtual displays and appear in the phone’s Recents.
Rules for device tests from now on
- Never capture, dump or screenshot the phone’s main display in automated tests. Use a virtual display the test created, and verify that a tool honours its display argument on a harmless screen before relying on it.
- Audio capture tests only while nothing is playing, or with a test tone the test itself starts; say so before running them.
- Do not read the clipboard in tests; write a test string and read that back, and say that the clipboard was overwritten.
- Prefer a spare phone or an emulator for anything that reads content.
- Tell the user before a test run what will be visible or audible on the phone, and report afterwards what was touched.
What works against the phone (Galaxy A55, Android 16 / One UI 8.5)
- The daemon sees all ten helper abilities, including virtual displays, app start and three audio sources.
- The app list arrives from the phone through the daemon.
- Calculator opened in its own window on a virtual display (450x800, decoded
by
nvh264dec). - At helper level (agent’s tests): several mirrors at once, resize, app-closed detection, and typing into app displays (15/15 keys, 15/15 text, 6/6 paste fallback). The Android 16 typing bug (scrcpy issue 6909) did not reproduce.
- All three audio sources produce valid Opus with real audio at helper level.
- 234 desktop tests and the Android unit tests pass.
- From M4.1, verified by the user: USB set-up, whole-screen mirroring with input, Wireless debugging pairing by QR and mirroring over Wi-Fi (after the stale-port and re-arm fixes).
Not verified yet
- Apps tab against the real phone: search, open an app, resize its window, type, press Back, close the app from the phone.
- Pin to desktop: the launcher appears and opens the app.
- Phone audio through the daemon on the PC: latency, crackle, whether the phone goes silent.
- A call during phone audio: capture should pause and resume.
- An app that is already open on the phone’s own screen.
Also unverified: StartApp on the main display, landscape-only apps,
physical rotation of the whole-screen mirror, re-arm of Wireless debugging
after a phone reboot, Samsung Auto Blocker, measured latency, Wayland
(window class of pinned apps, dmabuf path), VA-API decoders.
Things to know
- Closing an app window destroys that app’s display and its content; there is no “keep it on the phone” option yet.
- With the playback sources, ringtones, alarms, notification sounds and voice calls stay on the phone. The “output” source takes everything.
tether-cli appandmirrorused to start the installed app fromPATH, which did not know--app. They now prefer thetetherbinary next totether-cli.- The Wayland window class for pinned apps is untested.
- USB debugging authorisation flipped to “unauthorized” twice during the session (after cable replugs and debugging toggles); accepting the prompt with “Always allow from this computer” fixes it.
- A short network outage stopped all three build agents mid-work; they were resumed with their context and their trees were intact.
Milestone 4 desktop research: adb automation, video, audio, webcam, input
- Date: 2026-11-15
- Scope: desktop side of the enhanced tier (ADR-0007), implementation reference for M4.
- Machine used for local checks: Linux Mint 22.2, kernel 6.17.0-1032-oem, X11 Cinnamon,
NVIDIA RTX 4050 (driver 580, no iGPU visible in
lspci), PipeWire 1.0.5, GStreamer 1.24.2, GTK 4.14.5, libadwaita 1.5.0, Secure Boot disabled. - Nothing was installed and no device was contacted. Only
adb version,adb mdns check,adb host-features(server-only queries),apt-cache,dpkg -S,gst-inspect-1.0were run.
Confidence markers used below:
- [verified-local] checked on this machine.
- [verified-src] read in AOSP / Debian / crates.io / scrcpy sources or docs during this research (link given).
- [unverified] from memory or community reports; spike before relying on it.
Summary of recommendations
| Topic | Choice |
|---|---|
| Pairing UX | QR flow primary (WIFI:T:ADB;S:studio-<10>;P:<12>;;), 6-digit code as fallback; both discover the pairing port through Avahi |
| Connect-port discovery | Our own Avahi browse of _adb-tls-connect._tcp, then adb connect ip:port. Never rely on adb’s built-in mDNS |
| adb server and key | Private adb server (own socket/port, own key dir via HOME, ADB_USB=0, ADB_MDNS=0) for wireless; user’s default server only for the USB fallback. Config switch for “shared” |
| adb integration | Shell out to the adb binary; speak the host protocol directly only for host:track-devices |
| Helper transport | adb reverse localabstract:tether_<id> to a daemon listener, separate sockets for control/video/audio, token kept. Direct LAN TLS is a later optimisation |
| Minimum adb | 34.0.0 (parse adb version); never trust adb pair/adb connect exit codes, parse stdout |
| Video | GStreamer via gstreamer-rs 0.23 + gst-plugin-gtk4 0.13 linked statically; appsrc ! h264parse ! <dec> ! glsinkbin(gtk4paintablesink) |
| Audio | GStreamer in the daemon: `appsrc ! opusdec ! audioconvert ! audioresample ! pulsesink |
| Webcam | v4l2loopback + v4l2sink first (only path every call app sees); PipeWire Video/Source node as a no-root second output |
| Input | GestureClick + EventControllerMotion + EventControllerScroll + EventControllerKey with GtkIMMulticontext; EventControllerLegacy for touch sequences; scrcpy’s default bindings |
A. adb automation from a daemon
A.1 Wireless debugging pairing flows (Android 11+)
Source of truth: AOSP packages/modules/adb/docs/dev/adb_wifi.md [verified-src].
Facts:
- The phone runs the Pairing Server; the desktop’s adb is the pairing client. A host is
“paired” once its public key is in the phone’s
/data/misc/adb/adb_keys. - mDNS service types published by the phone:
_adb._tcp: legacyadb tcpiplistener._adb-tls-pairing._tcp: only while a pairing dialog is open on the phone._adb-tls-connect._tcp: while “Wireless debugging” is on (TLS server, random port).
- Instance names:
- connect service:
adb-<ro.serialno>-<random>(e.g.adb-14141FDF600081-TnSdi9); the value ispersist.adb.wifi.guidand is the “guid” adb prints after pairing. - pairing service, code flow:
adb-<guid>. - pairing service, QR flow: exactly the name the QR asked for,
studio-<RANDOM-10>.
- connect service:
- Shared secret: 6-digit number (code flow) or a host-generated password (QR flow). The doc
says “10-digit number” in one place but its own example password is 12 printable
characters:
WIFI:T:ADB;S:studio-g@<xeYnap/;P:(Aq+v9>Cx>!/;;.
Pairing-code flow
- Phone: Developer options, Wireless debugging, “Pair device with pairing code”. The dialog
shows a 6-digit code and
ip:port. - Desktop:
adb pair <ip>:<port> <code>(code may also be given on stdin after theEnter pairing code:prompt). - Success output:
Successfully paired to <ip>:<port> [guid=adb-<serial>-<suffix>]; failure:Failed: Wrong password or connection was dropped.(strings fromclient/adb_wifi.cpp, platform-tools 35.0.2 [verified-src]). adb then writes the guid toadb_known_hosts.pband tries to connect by service name. - We do not need the user to read the ip:port: browse
_adb-tls-pairing._tcpwith Avahi and take the address and port from the resolved record; the user types six digits only.
QR flow (what Android Studio does)
- Desktop generates a service name and password and shows the QR
WIFI:T:ADB;S:<name>;P:<password>;;(format piggybacks on the WPA3 Wi-Fi QR syntax). - Phone: Wireless debugging, “Pair device with QR code”, scan. Seeing
T:ADB, the phone starts a Pairing Server and advertises_adb-tls-pairing._tcpwith instance name<name>. - Desktop sees that instance (which also tells it which phone scanned), resolves it and
runs
adb pair <ip>:<port> <password>.
Implementation notes for our generator:
- Name:
studio-+ 10 random characters. Community tools pair with arbitrary names (a widely used gist usesdebug), so the prefix is probably not enforced [unverified]; keepstudio-because that is what AOSP documents and Studio emits. - Password: 12 random characters. Use
[A-Za-z0-9]only for both fields, so nothing needs the Wi-Fi QR escaping rules (\ ; , : ") and nothing needs shell quoting. - Pass the password as an argv element (no shell). It is single-use and short-lived.
- The QR must be scanned from inside Settings (Wireless debugging), not a general camera app, on most builds [unverified for One UI].
- The
qrcodecrate is already in the workspace and the GTK app already renders pairing QRs. - Platform-tools 37.0.3 added
adb pair --qr(terminal QR) [verified-src]; too new to depend on, but it confirms the flow is the supported one.
Recommendation. Offer the QR flow as the primary path and the 6-digit code as the
fallback in the same wizard page. QR needs no typing and identifies the phone
unambiguously when several devices are in pairing mode. The fallback covers camera
problems. Both use one Avahi browser for _adb-tls-pairing._tcp (reuse
desktop/crates/tether-core/src/discovery/avahi.rs), and both end in the same
adb pair call. The CLI (tether enhance) uses the code flow, or a terminal QR.
This changes the roadmap text (“user types the 6-digit code”) from the only path to the
fallback path.
Sources:
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/docs/dev/adb_wifi.md
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/tags/platform-tools-35.0.2/client/adb_wifi.cpp
- https://developer.android.com/tools/adb (user-facing steps)
- https://gist.github.com/benigumocom/a6a87fc1cb690c3c4e3a7642ebf2be6f (community QR script, arbitrary name)
- https://developer.android.com/tools/releases/platform-tools (37.0.3
adb pair --qr)
A.2 Discovering the connect port
The TLS connect port is random and changes every time Wireless debugging is toggled (and therefore after every reboot). It has to be discovered each time.
State of adb’s own mDNS, from the platform-tools release notes [verified-src]:
| Version | mDNS backend |
|---|---|
| 30.0.0 | wireless pairing added; mDNS needs a Bonjour daemon (mdnsResponder) |
| 30.0.2 | mDNS auto-connect off by default (ADB_MDNS_AUTO_CONNECT) |
| 31.0.2 | embedded openscreen backend added, off by default (ADB_MDNS_OPENSCREEN=1) |
| 35.0.2 | openscreen default on all platforms |
| 37.0.0 | new default backend libadbmdns, openscreen deprecated |
| 37.0.1 | openscreen deleted; ADB_MDNS_OPENSCREEN has no effect |
What the distributions ship:
- Debian 13 (trixie):
adb1:34.0.5-12 (bookworm 29.0.6, bookworm-backports 34.0.5, experimental 35.0.2). Debian’s build stubs mDNS out completely:debian/system/adb.mkgenerates a file with emptyinit_mdns_transport_discovery(),mdns_check()returning"", andmdns_get_connect_service_info()returningnullopt; the openscreen and mdnsresponder sources are commented out inlibadb.mk[verified-src]. Soadb mdns servicesreturns nothing and there is no auto-connect. - Ubuntu 24.04 / Mint 22:
adb1:34.0.4-1build3 (universe) [verified-local]. Same packaging lineage, so mDNS is almost certainly stubbed as well [unverified, not inspected]. - This machine:
/usr/bin/adbis Google’s binary 35.0.0-11411520 fromgoogle-android-platform-tools-installer(multiverse,Provides: adb). It contains openscreen (host-featureslistsopenscreen_mdns) but 35.0.0 still defaults to Bonjour, andadb mdns checkanswersERROR: mdns daemon unavailable[verified-local]. A second adb, 37.0.1, sits in~/Android/Sdk/platform-tools.
So a user can have an adb with no mDNS, with a non-working Bonjour default, with openscreen, or with libadbmdns. Only our own browse is predictable.
Recommendation.
- Browse
_adb-tls-connect._tcp(and_adb-tls-pairing._tcpduring the wizard) with the existing Avahi D-Bus code. Resolve, prefer IPv4 (adb’s own listing is IPv4-only). - Remember the guid printed by
adb pairper paired phone. When a connect instance whose name equals that guid appears:adb connect <ip>:<port>. When it disappears, treat the transport as gone (and confirm via track-devices). - Start our adb server with
ADB_MDNS=0(honoured inclient/main.cpp[verified-src]) so behaviour is the same on every adb build and adb never auto-connects behind our back. - Because
adb paironly auto-connects through adb’s mDNS, always follow a successful pair with our ownadb connect. - Serial to use afterwards:
<ip>:<port>(whatadb connectregisters). Pass it with-son every command. - Optional later: the Tether Android app can report the port over the normal-tier
connection (
NsdManagerdiscovery of its own service) for networks where multicast is filtered [unverified].
Sources:
- https://developer.android.com/tools/releases/platform-tools
- https://sources.debian.org/src/android-platform-tools/34.0.5-12/debian/system/adb.mk
- https://sources.debian.org/src/android-platform-tools/34.0.5-12/debian/system/libadb.mk
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/docs/user/adb.1.md
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/tags/platform-tools-35.0.2/client/main.cpp
A.3 Key storage and server: shared or private
How adb decides [verified-src] (adb_utils.cpp, client/auth.cpp, client/adb_wifi.cpp,
client/main.cpp, 35.0.2):
- Key:
$HOME/.android/adbkey(+.pub), generated on first server start. OnlyHOMEis consulted on Linux. ADB_VENDOR_KEYS: colon-separated extra private keys (files or directories) offered in addition to the user key.- Wireless known hosts:
$HOME/.android/adb_known_hosts.pb(guids of paired devices). - Server address:
-L <socket>/ADB_SERVER_SOCKET, or-P <port>/ANDROID_ADB_SERVER_PORT; defaulttcp:localhost:5037. ADB_USB=0skips USB initialisation;ADB_MDNS=0skips mDNS;ADB_REJECT_KILL_SERVER=1makes the server ignorekill-server.- A client kills a running server only when the internal protocol version differs. Both
35.0.0 and 37.0.1 here report
1.0.41, so the two installed adbs do not kill each other’s server [verified-local]. The server keeps the feature set of whichever binary started it.
Options:
| Shared (user’s key, server on 5037) | Private (own key dir, own socket) | |
|---|---|---|
Phone appears in the developer’s adb devices, Android Studio, flutter devices | Yes, permanently, as soon as it is on Wi-Fi. A second device then makes every un-targeted adb command fail with “more than one device” | No |
adb kill-server by the user or an IDE | Kills our helper session (we recover, but mirroring drops) | No effect |
| Server started by another binary (Studio’s 37.x, distro 34.x) | We inherit its behaviour (mDNS auto-connect, USB backend) | We control the binary and environment |
| Existing USB authorisation reused | Yes | No, needs its own pairing (we drive pairing anyway) |
| USB | One server owns the USB interface, no contention | Would compete with the user’s server for the USB interface unless ADB_USB=0 |
| Revocation | Mixed with the developer’s own authorisation | Separate key; “Revoke” still removes both on the phone |
| Local attack surface | tcp:localhost:5037 is reachable by every local user | Can listen on a unix socket inside $XDG_RUNTIME_DIR |
Recommendation. Private server by default, shared as a config option
([adb] server = "private" | "shared").
- Environment for every adb invocation in private mode:
HOME=$XDG_DATA_HOME/tether/adb(key ends up in.../tether/adb/.android/adbkey, mode 0600 as adb creates it),ADB_MDNS=0,ADB_USB=0, and eitherADB_SERVER_SOCKET=localfilesystem:$XDG_RUNTIME_DIR/tether/adb.sockwithadb -L <same> start-server, orANDROID_ADB_SERVER_PORT=<fixed non-5037 port>. The unix-socket form is supported by adb’s socket specs but is [unverified] with distro 34.x; fall back to a TCP port ifstart-serverfails. - Start the server explicitly (
adb start-server) from the daemon and stop it withkill-serveron daemon exit; do not leave it to implicit start. - USB fallback: use the user’s default server (plain
adb, no overrides). The phone shows the usual “Allow USB debugging?” dialog for the user’s own key. This keeps a single USB owner on the machine and still gives “cable always works”. - Wrap this in one
AdbEnv { binary, envs, serial }type so shared/private/USB are data, not code paths. - Never copy or read
~/.android/adbkeyourselves.
Sources:
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/tags/platform-tools-35.0.2/adb_utils.cpp
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/tags/platform-tools-35.0.2/client/auth.cpp
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/tags/platform-tools-35.0.2/client/main.cpp
A.4 Detecting state
Event-driven device list. host:track-devices [verified-src] (docs/dev/services.md):
open a connection to the adb server, send <4 hex length>host:track-devices (i.e.
0012host:track-devices), read OKAY, then read forever: <4 hex length> followed by that
many bytes of serial\tstate\n lines, one full list per change. Variants
host:track-devices-proto-binary / -proto-text exist on newer servers (feature
devicetracker_proto_format, present in 35.0.0 here); do not depend on them. 31.0.2 fixed
late updates for wireless devices and 33.0.3 fixed duplicate entries, both below our
minimum. A zero-length list (0000) means no devices. This is about 40 lines of tokio code
and works over TCP or a unix socket.
States (from adb devices / tracker; strings confirmed in the 35.0.0 binary
[verified-local]): device (usable), unauthorized (key not accepted or dialog
pending), authorizing, connecting, offline, no permissions (USB udev rules),
host, recovery, sideload, bootloader.
Decision table for the daemon
| Observation | Meaning | Action |
|---|---|---|
Tether normal-tier link up, no _adb-tls-connect._tcp instance with our guid | Wireless debugging is off (reboot, Wi-Fi network changed, user toggled) | Notify “Turn Wireless debugging back on”; offer USB |
Instance present, adb connect prints connected to / already connected to and tracker shows device | Ready | Launch helper |
adb connect prints failed to connect to ...: Connection refused or times out | Stale port or client isolation on the AP | Re-resolve; after N tries, guide |
adb connect prints failed to authenticate to <ip:port> or tracker shows unauthorized on a TLS transport | Our key was revoked (“Revoke USB debugging authorisations”, factory reset) | Forget guid, run pairing wizard again |
Tracker offline | Transport stalled (Wi-Fi sleep) | adb disconnect <serial>, reconnect; adb reconnect offline |
USB: unauthorized | RSA dialog waiting on the phone | Prompt the user to accept |
USB: no permissions | udev rules missing | Point at android-sdk-platform-tools-common / plugdev |
| USB: phone connected (normal tier knows) but nothing appears on the default server | USB debugging off or blocked (Auto Blocker) | Guide |
Helper process (adb shell ... app_process) exits while tracker still says device | Helper crashed or was killed | Restart with backoff; report ShellHello missing |
Notes:
adb connectand (before 34.0.5)adb pairreturn exit code 0 on failure; 34.0.5 fixedpaironly [verified-src, release notes]. Ubuntu ships 34.0.4. Always parse stdout. The exactadb connectstrings above are [unverified] against 34.x; capture them in the first spike and match loosely (connected to,failed to).- Wireless debugging resets. The toggle does not survive a reboot, and it switches off when the phone leaves the Wi-Fi network it was enabled on. ADR-0007 attributes this to Samsung; it is believed to be AOSP behaviour [unverified]. Either way the detection above is the same.
- Possible self-heal [unverified, worth a spike]: during the first enhanced session the
helper can
pm grant org.tether.android android.permission.WRITE_SECURE_SETTINGS; the normal app could then writeSettings.Global "adb_wifi_enabled" = 1after boot when the desktop asks, removing the manual step. Known from community tools on stock Android; behaviour on One UI 6/7 and Android 15/16 is unknown, and it must stay opt-in because it widens what the normal app may do (ADR-0007 security boundary). - Samsung Auto Blocker. Community and Samsung-forum reports: with Auto Blocker on, the
USB debugging toggle is greyed out / forced off (“Block commands by USB cable”). Whether
it also blocks Wireless debugging on One UI 7 is [unverified]. Desktop-visible
symptoms: no USB device at all, no pairing or connect service advertised. The phone app
cannot be assumed to read the Auto Blocker state; the wizard should show the Samsung
step whenever
Build.MANUFACTURER == samsung(the phone reports that inHello). - Add a “Wireless debugging” Quick Settings tile hint (Developer options, “Quick settings developer tiles”) to the guidance; it turns the post-reboot fix into one tap.
Recommendation. One AdbMonitor task per adb server: a persistent
host:track-devices connection (reconnect with backoff, starting the server if needed)
merged with Avahi browse events and the normal-tier link state into a small state machine
(Unpaired, WirelessOff, Connecting, Unauthorized, Ready, HelperRunning) exported over
D-Bus for the wizard and the tray.
Sources:
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/docs/dev/services.md
- https://developer.android.com/tools/releases/platform-tools
- https://forum.developer.samsung.com/t/s24-ultra-developer-option-usb-debugging-greyed-out/29526
- https://techwiser.com/fix-usb-debugging-greyed-out-on-samsung-galaxy-phone/
A.5 Shell out to adb or speak the protocol from Rust
Crates checked on crates.io [verified-src]:
| Crate | Version (date) | Licence | Notes |
|---|---|---|---|
adb_client | 3.2.3 (2026-08) | MIT | Most active. Server-proxy mode and direct USB/TCP mode, optional mdns, usb. Depends on rustls/rcgen/rsa. Its pair (src/server/commands/pair.rs) forwards to a running adb server; no native pairing was found. Blocking API |
mozdevice | 0.5.5 (2026-06) | MPL-2.0 | Talks to an adb server only |
forensic-adb | 0.8.1 (2025-03) | MPL-2.0 | Tokio fork of mozdevice, server only |
adbear | 0.1.1 (2024) | n/a | Pairing CLI, self-described as fragile |
MIT and MPL-2.0 are both compatible with GPL-3.0-or-later, so licence is not the deciding factor.
Why not native:
- Pairing is TLS, then SPAKE2 as implemented in BoringSSL (not the RustCrypto
spake2wire format [unverified]), keyed with TLS exported keying material, then AES-128-GCM framedPeerInfoexchange. No maintained Rust implementation was found. Android 17 is reported to rework ADB Wi-Fi again [unverified]. - The connect path needs the A_STLS upgrade, client-certificate auth with the adb RSA key,
the adb stream multiplexer, shell v2,
reverse:and sync. scrcpy, Android Studio’s fallback and every comparable project lean on the stock binary for this. adbis already a package dependency (ADR-0007), and USB works for free.
Recommendation. Shell out to adb with tokio::process::Command (argv, never a shell
string; kill_on_drop(true); timeouts on every call) for start-server, pair, connect,
disconnect, reverse, push/install and the long-running
adb -s <serial> shell CLASSPATH=... app_process ... child whose lifetime is the helper’s
lifetime. Speak the host protocol ourselves only for host:track-devices (A.4). Do not add
an adb crate.
Sources:
- https://docs.rs/crate/adb_client/latest and https://github.com/cocool97/adb_client
- https://docs.rs/crate/adb_client/3.2.1/source/src/server/commands/pair.rs
- https://crates.io/crates/mozdevice , https://crates.io/crates/forensic-adb
A.6 Transport for the helper’s connection back to the daemon
What scrcpy does [verified-src] (doc/develop.md, doc/tunnels.md):
- Default is
adb reverse: the client listens first, then starts the server, which connects tolocalabstract:scrcpy_<SCID>on the device (SCID is a random 31-bit id so several instances coexist). Reason given: no race and no polling, because the listener exists before the server starts. - Fallback is
adb forward(--force-adb-forward, or automatically when reverse fails): the device listens and the client connects. Because a forward “connect” succeeds even with nobody listening, the server sends one dummy byte on the first socket so the client can detect a real connection. - Up to three separate sockets, opened in order: video, audio, control.
- Frames are sent with a 12-byte header (flags for config/key frame, PTS, size); the client decodes and shows frames immediately with no buffering.
adb reverseover a TCP/IP adb transport is unreliable on old Android versions, which is why the fallback exists [unverified, from scrcpy FAQ memory]; not a concern for our Android 14+ floor.
Options for Tether:
adb reverse | adb forward | Helper dials daemon over LAN TLS | |
|---|---|---|---|
| Works over USB and Wi-Fi alike | Yes | Yes | Wi-Fi only |
| Startup race | None | Needs retry or dummy byte | None |
| Path | helper, adbd, TLS, adb server, daemon (two extra hops, one multiplexed TCP connection) | same | one hop, separate TCP connections |
| Head-of-line blocking between video/audio/control | Yes, all adb streams share one TCP connection | Yes | No |
| Extra crypto and auth in the helper | None (adb TLS already protects it) | None | TLS + pinning + token |
| Firewall | Nothing new | Nothing new | Needs the daemon port reachable (ufw profile exists for 7360) |
| Fits ADR-0014 secondary streams | Framing reused, transport differs | same | Yes, directly |
Latency: scrcpy’s 35 to 70 ms figures are achieved through the adb tunnel, over USB and Wi-Fi, so the tunnel is not the limiting factor on a good LAN. The risk is Wi-Fi loss: a retransmit stalls every stream at once.
Recommendation.
- M4 baseline:
adb reverse localabstract:tether_<8 hex> <host spec>where the host side is a daemon listener:localfilesystem:$XDG_RUNTIME_DIR/tether/shell-<id>.sock[unverified with distro adb], elsetcp:<ephemeral port bound on 127.0.0.1>. Set it up before launching the helper and remove it (adb reverse --remove) at stop. Reverse entries vanish when the transport drops; re-create on every launch. - Open one connection per purpose (control, video per mirror, audio), each starting with
the existing
StreamOpenenvelope plus the launch token, so the code path matches ADR-0014 streams and the transport can be swapped. - Keep the one-time token even with reverse: other processes on the phone may be able to reach an abstract socket, and with the TCP fallback any local desktop user can reach the port.
- Pass the token on the helper’s stdin, not argv (argv is visible in
psto other shell-uid processes). - Add direct LAN TLS later only if measurements on Wi-Fi show stalls; the helper (shell uid) may open network sockets, and the protocol will not need to change.
Sources:
- https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md
- https://github.com/Genymobile/scrcpy/blob/master/doc/tunnels.md
- https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/docs/dev/services.md (
reverse:)
A.7 Minimum adb version and detection
Relevant history [verified-src, release notes]: 30.0.0 wireless pairing; 31.0.2
track-devices fix for wireless; 33.0.3 duplicate entry fix, rejects unexpected reverse
requests; 34.0.5 adb pair returns non-zero on failure and wait-for-disconnect works
for wireless; 35.0.2 openscreen default.
Available: Ubuntu 24.04 / Mint 22 adb 34.0.4; Debian 13 34.0.5; Debian 12 29.0.6 (too
old; backports has 34.0.5); Google installer package 35.0.0; SDK 37.x.
Detection: run adb version; the second line is Version <major>.<minor>.<patch>-<build>
(Version 35.0.0-11411520 here [verified-local]; Debian builds print a -debian
suffix [unverified]). Parse with ^Version (\d+)\.(\d+)\.(\d+). The first line
(Android Debug Bridge version 1.0.41) is the protocol version and is useless for this.
Binary lookup order: config adb.path, then adb on PATH, then
$ANDROID_HOME/platform-tools/adb, $ANDROID_SDK_ROOT/platform-tools/adb,
~/Android/Sdk/platform-tools/adb. Use the first that meets the minimum; log the path and
version; expose both over D-Bus for the wizard.
Recommendation. Require >= 34.0.0 (as the roadmap says). Treat 34.0.x pair/connect
exit codes as unreliable and parse output. Keep adb in Depends (the Google installer
package satisfies it through Provides: adb). If adb is missing or too old the enhanced
tier reports “unavailable” with the reason; the normal tier is unaffected.
Sources:
- https://developer.android.com/tools/releases/platform-tools
- https://packages.debian.org/search?keywords=adb&searchon=names&exact=1
B. Video in the GTK4 app
B.1 Decoding and display options
Assumed plumbing: the daemon owns adb and the helper sockets. The GTK app gets the video stream as a unix socket file descriptor passed over D-Bus (zbus supports fd passing), with the same framing as the helper stream (header with PTS, flags, length, then one Annex-B access unit). The app does not talk to adb.
Option 1: GStreamer + gtk4paintablesink (recommended)
Availability of the sink [verified-src / verified-local]:
| Distro | Package | Version |
|---|---|---|
| Ubuntu 24.04 / Mint 22 | none. Only librust-gst-plugin-gtk4-dev 0.12.3 (Rust source, universe). gst-inspect-1.0 gtk4paintablesink fails here | n/a |
| Debian 13 | gstreamer1.0-gtk4 | 0.13.5-1 |
| Ubuntu 26.04 | gstreamer1.0-gtk4 | 0.14.4 (component not checked, probably universe) |
So on our oldest targets the plugin does not exist as a package and we must link it
statically. Versions that fit the workspace (gtk4 0.9, rust-version 1.85)
[verified-src, crates.io]:
gst-plugin-gtk40.13.x (0.13.7): depends ongtk4 ^0.9,gstreamer ^0.23, MSRV 1.71, licence MPL-2.0 (compatible with GPL-3.0-or-later).- 0.14.x needs
gtk4 0.10/gstreamer 0.24; 0.15.x needsgtk4 0.11/gstreamer 0.25and Rust 1.92. Moving up means bumping gtk4-rs for the whole app. - 0.13 features:
wayland(=waylandegl),x11egl,x11glx,dmabuf(pullsgtk_v4_14andgst-video/v1_24),gtk_v4_10/12/14/16.
# desktop/crates/tether-gtk/Cargo.toml
gst = { package = "gstreamer", version = "0.23" }
gst-app = { package = "gstreamer-app", version = "0.23" }
gst-video = { package = "gstreamer-video", version = "0.23" }
gst-plugin-gtk4 = { version = "0.13", features = ["wayland", "x11egl", "x11glx", "dmabuf", "gtk_v4_14"] }
#![allow(unused)]
fn main() {
gst::init()?;
gstgtk4::plugin_register_static()?; // registers gtk4paintablesink in-process
let sink = gst::ElementFactory::make("gtk4paintablesink").build()?;
let paintable = sink.property::<gdk::Paintable>("paintable");
// If the paintable has a GL context, wrap the sink so upload and colour conversion run in GL.
let video_sink = if paintable.property::<Option<gdk::GLContext>>("gl-context").is_some() {
gst::ElementFactory::make("glsinkbin").property("sink", &sink).build()?
} else {
sink.upcast() // put `videoconvert` in front in this case
};
picture.set_paintable(Some(&paintable)); // gtk::Picture, content-fit = Contain
}
The crate name in code is gstgtk4. This registration pattern is the documented way
applications embed the plugin, but the README fetched for this research did not show it,
so treat the snippet as [unverified] until it compiles. glsinkbin lives in
gstreamer1.0-gl [verified-local].
GL and dmabuf paths:
- X11 (Cinnamon, the primary dev setup):
x11eglandx11glxlet hardware or GL-uploaded frames reach GTK asGdkGLTexturewith no CPU copy. Enable both; GTK picks EGL or GLX depending on the driver. - Wayland (GNOME):
waylandfor GL textures, anddmabuf(GTK >= 4.14, GStreamer >= 1.24, both exactly what Ubuntu 24.04 has) letsvah264decoutputvideo/x-raw(memory:DMABuf)straight into aGdkDmabufTexture. Wrapping the picture inGtkGraphicsOffload(GTK 4.14) can hand it to the compositor as a subsurface. - No GL context (software renderer, remote X): the sink accepts system-memory frames; slower but works.
Decoders [verified-local unless marked]:
| Element | Package (Ubuntu 24.04) | Hardware | State on this machine |
|---|---|---|---|
vah264dec | gstreamer1.0-plugins-bad (universe), libgstva.so | Intel / AMD through VA-API | Plugin file installed, element not registered (NVIDIA-only GPU, no usable VA driver) |
nvh264dec | gstreamer1.0-plugins-bad, libgstnvcodec.so | NVIDIA proprietary driver | Present, rank primary+1, outputs CUDAMemory, GLMemory or system NV12 |
vaapih264dec | gstreamer1.0-vaapi (universe) | legacy VA plugin, deprecated upstream | Package installed, element not registered |
v4l2h264dec / v4l2slh264dec | gstreamer1.0-plugins-good | ARM SBCs, some laptops | Not present |
avdec_h264 | gstreamer1.0-libav (universe) | software (FFmpeg) | Present |
openh264dec | gstreamer1.0-plugins-bad | software | Present |
h264parse | gstreamer1.0-plugins-bad (libgstvideoparsersbad.so) | n/a | Present |
Selection: build the pipeline with an explicit candidate list and take the first factory
that exists and reaches PAUSED with the stream’s caps: vah264dec, nvh264dec,
v4l2slh264dec, avdec_h264, openh264dec. On error at runtime fall back to the next and
request a key frame. Expose a “software decoding” switch in preferences and an env override
(TETHER_VIDEO_DECODER).
Option 2: FFmpeg (ffmpeg-next 9.1.0, WTFPL; ac-ffmpeg 0.19, MIT) + our own texture upload
- This is what scrcpy does in C. We would decode to
AVFrame, convert (swscale) and buildGdkMemoryTextures per frame, or wire VA-API/NVDEC hwaccel and dmabuf export ourselves for zero copy. - Packaging blocker: libavcodec’s soname differs between targets (FFmpeg 6.1 in Ubuntu
24.04, 7.1 in Debian 13), so one
.debcannot link dynamically against both. We would need per-distro builds or a statically bundled FFmpeg. GStreamer 1.x keeps one ABI, so a binary built on Ubuntu 24.04 runs on Debian 13. - More code for less: hardware paths, colour handling and GL upload are all ours.
Option 3: VA-API directly. Needs our own H.264 bitstream parsing and DPB management (or
the cros-codecs crate), covers Intel/AMD only, and still needs a software fallback.
Rejected.
Recommendation. GStreamer through gstreamer-rs 0.23 with gst-plugin-gtk4 0.13 linked
statically, features wayland,x11egl,x11glx,dmabuf,gtk_v4_14; pipeline
appsrc ! h264parse ! <decoder> ! glsinkbin sink=gtk4paintablesink; explicit decoder
fallback list. Put it behind a cargo feature (mirror, default on) so --mock UI work
does not need GStreamer headers. The VA path cannot be tested on this machine; it needs an
Intel or AMD box (or CI smoke tests on software decode only).
Sources:
- https://packages.debian.org/search?keywords=gstreamer1.0-gtk4 , https://packages.ubuntu.com/search?keywords=gstreamer1.0-gtk4
- https://crates.io/crates/gst-plugin-gtk4 (versions, features, dependencies)
- https://github.com/GStreamer/gst-plugins-rs/blob/main/video/gtk4/README.md
- https://crates.io/crates/ffmpeg-next , https://crates.io/crates/ac-ffmpeg
B.2 Low-latency pipeline settings
Properties below exist in GStreamer 1.24.2 here [verified-local via gst-inspect]; the latency effects are from GStreamer/scrcpy practice and should be measured [unverified].
- appsrc:
is-live=true,format=time,stream-type=stream,do-timestamp=true(arrival-time stamping; we render unsynchronised anyway),block=false,max-buffers=4,leaky-type=none. Do not let appsrc drop encoded frames: dropping a P-frame corrupts everything until the next key frame. If the queue ever exceeds the bound, flush and ask the helper for a key frame instead. - caps on appsrc:
video/x-h264,stream-format=byte-stream,alignment=au. Declaring access-unit alignment letsh264parseforward each buffer immediately instead of waiting for the start of the next AU (one frame of latency saved). Requires the helper to send exactly one AU per message, with SPS/PPS prepended to the first key frame (scrcpy merges the config packet into the next frame for the same reason). - h264parse: defaults; it also gives decoders the framerate/resolution caps they need.
- Decoders:
avdec_h264:max-threads=1orthread-type=slice. Frame threading (the default with auto threads) adds one frame of delay per thread. FFmpeg may also hold frames for reordering if the SPS lacksbitstream_restriction; scrcpy setsAV_CODEC_FLAG_LOW_DELAY, whichavdec_h264does not expose as a property. Measure; if output lags by frames, preferopenh264decor fix on the encoder side (baseline / no B-frames,KEY_LATENCY=0/KEY_LOW_LATENCY=1,KEY_MAX_B_FRAMES=0).nvh264dec:max-display-delay=0.vah264dec: no property needed; the base class uses low-latency bumping for live pipelines, which is another reason foris-live=true[unverified for 1.24].
- After the decoder:
queue max-size-buffers=1 max-size-bytes=0 max-size-time=0 leaky=downstream. Decoded frames are safe to drop; this keeps only the newest frame when the UI thread is slow. - Sink:
sync=falseon the sink (glsinkbinproxies it),qos=false. No clock synchronisation; show frames as they arrive, like scrcpy. Pipelinelatencystays default. - Session changes: on rotation or flex-resize the helper starts a new stream with new
SPS/PPS;
h264parserenegotiates caps. Verify that every decoder in the list survives a mid-stream resolution change; otherwise rebuild the pipeline on the session packet. - Static screens: the Android encoder emits frames only when the surface changes. Set
KEY_REPEAT_PREVIOUS_FRAME_AFTER(scrcpy uses 100 ms) in the helper so the first frame arrives and quality recovers after motion. - Stats for the “<= 100 ms” verification: timestamp at socket read and in a pad probe on the sink; expose frames dropped, decode ms and decoder name in a debug overlay.
Sources:
- https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md
gst-inspect-1.0 appsrc | avdec_h264 | nvh264dec | h264parseon this machine
B.3 Build and packaging impact
Build dependencies (Ubuntu 24.04 names; none of the -dev packages is installed on this
machine yet, pkg-config --modversion gstreamer-1.0 fails [verified-local]):
libgstreamer1.0-dev(1.24.2)libgstreamer-plugins-base1.0-dev(app, video, gl, allocators.pcfiles; pulls GL/EGL headers)- existing:
libgtk-4-dev,libadwaita-1-dev libgstreamer-plugins-bad1.0-devis not needed.
CI (ubuntu-24.04 runner): add libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev to
both apt steps in the workflow; for pipeline smoke tests also
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl and run under xvfb-run with software GL. Build on
24.04 (oldest GStreamer/GTK/glibc) so the binary runs on Debian 13 (GStreamer 1.26.2, GTK
4.18.6, libadwaita 1.7.6, PipeWire 1.4.2).
Runtime metadata for [package.metadata.deb] in desktop/crates/tetherd/Cargo.toml:
$autowill addlibgstreamer1.0-0,libgstreamer-plugins-base1.0-0,libgstreamer-gl1.0-0.- Add to
depends:gstreamer1.0-plugins-base(app, opus, audioconvert, videoconvert),gstreamer1.0-plugins-good(v4l2sink, pulse),gstreamer1.0-gl(glsinkbin). - Add to
recommends:gstreamer1.0-plugins-bad(h264parse and all hardware decoders; effectively required for mirroring),gstreamer1.0-libav(software H.264/H.265),gstreamer1.0-pipewire. Both-badand-libavare in universe on Ubuntu and main on Debian. If we want mirroring to work on a default install, promotegstreamer1.0-plugins-badandgstreamer1.0-libavtodepends; Mint enables universe by default and already ships both. - Add to
suggests:v4l2loopback-dkms. - No
gstreamer1.0-gtk4dependency (static). - At startup, check for
h264parseand at least one decoder; show a precise “install gstreamer1.0-plugins-bad / gstreamer1.0-libav” message instead of a pipeline error.
Size: release binaries today are tether 6.6 MB and tetherd 12.1 MB (stripped, thin
LTO). Expect a few MB more for tether from gstreamer-rs bindings and the static sink
[unverified estimate]; GStreamer itself stays dynamic. Build time grows noticeably
(gstreamer-gl and friends).
Sources: local apt-cache policy/show, dpkg -S; https://sources.debian.org (trixie versions).
B.4 H.265 and AV1 later
| Codec | Hardware elements | Software elements | Here (Ubuntu 24.04 base) |
|---|---|---|---|
| H.265 | vah265dec, nvh265dec, vulkanh265dec | avdec_h265 (libav), libde265dec (bad) | nvh265dec, avdec_h265, libde265dec, vulkanh265dec present; vah265dec not registered |
| AV1 | vaav1dec, nvav1dec | av1dec (libaom, slow), dav1ddec (not in 24.04’s packages) | nvav1dec, av1dec present; dav1ddec, vaav1dec absent |
Parsers h265parse and av1parse are in gstreamer1.0-plugins-bad. Whether Debian 13’s
GStreamer 1.26 ships dav1ddec was not checked [unverified].
Recommendation. H.264 only in M4. Design MirrorStart.codec negotiation now: the
desktop probes factories at startup and sends the list it can decode (hardware first); the
helper intersects with its encoders. Add H.265 next (wide hardware support on both ends,
real bitrate saving on Wi-Fi). AV1 only when a hardware decoder is present; software AV1 at
phone resolution is not viable with av1dec.
C. Audio and webcam
C.1 Opus to PipeWire playback
Ownership: the daemon should own phone audio (and the webcam), so both work with the
GTK window closed, like call audio does today. The daemon already shells out to
wpctl/pw-link/pipewire and depends on pipewire-bin.
Options:
| Option | Pros | Cons |
|---|---|---|
GStreamer in tetherd: appsrc ! opusdec ! audioconvert ! audioresample ! sink | One media stack shared with webcam; opusdec has PLC and in-band FEC (plc, use-inband-fec); sinks handle device changes and clock drift; all elements installed by default here | tetherd links GStreamer (glib main context not needed for appsrc pipelines, but a bus watch thread is) |
opus crate 0.4 (MIT/Apache, libopus) + pw-cat --playback --raw - | Tiny; no new library in the daemon beyond libopus | Pipe buffering (default pipe is 64 KiB, about 340 ms of 48 kHz stereo s16) must be shrunk; no drift compensation; underrun handling is ours; one more subprocess to supervise |
opus + pipewire crate 0.10 (MIT) | Lowest latency, real graph node | Needs libpipewire-0.3-dev + clang/bindgen at build, own PipeWire main-loop thread, compatibility with PipeWire 1.0.5 not checked [unverified] |
opus + cpal 0.18 (Apache-2.0) | Portable | Goes through ALSA to pipewire-alsa: extra buffering, poor device naming |
audiopus (ISC) has had no release since 2021; prefer opus if a pure-crate decoder is
ever needed.
Sink choice [verified-local for presence]: pulsesink (talks to pipewire-pulse, the
best-tested path on PipeWire 1.0.x), pipewiresink (gstreamer1.0-pipewire, main; fine
for video, historically rougher for audio on 1.0.x [unverified]), autoaudiosink. Try
pulsesink, then pipewiresink, then autoaudiosink.
Latency settings:
- Helper: Opus 48 kHz stereo, 10 or 20 ms frames, one packet per message with PTS.
- appsrc:
is-live=true format=time do-timestamp=true, capsaudio/x-opus,channel-mapping-family=0,channels=2,rate=48000. - pulsesink:
buffer-time=40000 latency-time=10000(40 ms target, 10 ms periods),stream-properties="props,media.role=Music,application.name=Tether,node.name=tether_phone_audio". - Keep
sync=trueon the audio sink with arrival timestamps so the sink’s clock slaving absorbs phone/PC drift; cap backlog by flushing when appsrc holds more than about 150 ms. scrcpy targets a 50 ms audio buffer and compensates drift by resampling. - There is no lip-sync between audio (daemon) and video (GTK app, unsynchronised). With both under about 100 ms this matches scrcpy’s behaviour and is acceptable for M4.
- When phone audio is captured with
REMOTE_SUBMIXthe phone goes silent;PLAYBACK_DUPkeeps it audible (Android 13+ in scrcpy terms). That is a helper decision, noted here because the desktop toggle needs both labels. - Calls: do not start phone audio while an HFP call is active, or mute it (interaction with the M3 call-audio graph).
Recommendation. GStreamer in tetherd behind a cargo feature media (default on):
appsrc ! opusdec plc=true ! audioconvert ! audioresample ! pulsesink with the fallback
order above. The same feature hosts the webcam pipeline (C.2), so the dependency is paid
once. The roadmap’s opusdec ! pipewiresink becomes the second choice of sink, not the
first.
Sources: local gst-inspect-1.0 opusdec | pipewiresink; crates.io (opus, audiopus,
pipewire, cpal); https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md
C.2 Phone as webcam
v4l2loopback
| Distro | Package | Version | Component |
|---|---|---|---|
| Ubuntu 24.04 / Mint 22 | v4l2loopback-dkms, v4l2loopback-utils | 0.12.7-2ubuntu5.2 | universe |
| Debian 13 | v4l2loopback-dkms | 0.15.0-2 | main |
On this machine [verified-local]: v4l2loopback-dkms 0.12.7-2ubuntu5.1 is installed
and DKMS has built it for 6.17.0-1032-oem and 6.17.0-35-generic (older OEM kernels show
DKMS warnings), modinfo v4l2loopback resolves, the module is not loaded, Secure Boot
is disabled, /dev/video0-1 are the integrated camera. So Ubuntu’s patched 0.12.7 does
build on an OEM 6.17 kernel, but every kernel update re-runs DKMS and can break it.
Constraints:
- Out-of-tree module: needs
dkms, kernel headers and a compiler on the user’s machine. - Secure Boot: the module must be signed with an enrolled MOK. Ubuntu’s DKMS signs with
the machine owner key and prompts for enrolment (reboot + MOK manager) the first time; on
Debian the user must
mokutil --importthe DKMS key manually. Until enrolled,modprobefails with “Key was rejected by service”. We cannot automate this. - Creating the device needs root:
modprobe v4l2loopback devices=1 video_nr=<N> card_label="Tether Phone Camera" exclusive_caps=1, or persistently/etc/modprobe.d/*.conf+/etc/modules-load.d/*.conf.exclusive_caps=1is needed for Chromium-based apps to list the device.v4l2loopback-ctl add(dynamic devices through/dev/v4l2loopback) also needs root and its availability in 0.12.7 is [unverified]. - If another tool already loaded the module (OBS), reuse an existing free loopback device instead of reloading.
- Once the node exists the daemon can write to it as the session user (udev
uaccess/videogroup).
Feeding: appsrc ! h264parse ! <decoder> ! videoconvert ! videoscale ! video/x-raw,format=YUY2,width=W,height=H,framerate=F/1 ! v4l2sink device=/dev/videoN sync=false. Keep format and size fixed for the lifetime of the device (letterbox on
rotation); consumers do not cope with format changes. v4l2sink is in
gstreamer1.0-plugins-good. v4l2sink against loopback 0.12.7 with GStreamer 1.24 needs a
quick spike (there have been negotiation regressions between specific versions)
[unverified].
Detection for guidance: /sys/module/v4l2loopback (loaded), modinfo v4l2loopback
(installed), /sys/devices/virtual/video4linux/video*/name (find our label),
mokutil --sb-state, and the modprobe error text.
PipeWire virtual camera (no kernel module)
... ! videoconvert ! pipewiresink mode=provide stream-properties="props,media.class=Video/Source,media.role=Camera,node.description=Tether Phone Camera"creates a camera node in the session; no root, no DKMS, no Secure Boot issue. (pipewiresinkhasmodeandstream-propertieshere [verified-local]; the exact property string is from published examples and is [unverified] on 1.0.5.)- Who sees it (2026) [mostly unverified, moving target]:
- Firefox: PipeWire camera backend exists (
media.webrtc.camera.allow-pipewire), default on in Fedora since 41, apparently still off by default upstream; a December 2025 Ubuntu bug shows users setting the pref by hand and the snap unable to reach PipeWire cameras. - Chromium/Chrome: PipeWire camera landed in M127 behind a flag, official builds fixed around M132; default state today not confirmed.
- OBS Studio: PipeWire camera source (beta) since 30.2; GNOME Snapshot uses PipeWire natively.
- Zoom, Teams, Discord, Slack desktop clients and most Electron apps: V4L2 only.
- Access goes through the xdg-desktop-portal Camera portal (1.20 here and in Debian 13).
- Firefox: PipeWire camera backend exists (
- Conclusion: on Mint 22 / Ubuntu 24.04 with default browsers the PipeWire node will not show up in a typical video call without the user flipping a browser pref. It does not satisfy the M4 verification line “webcam appears in a video call app” by itself.
Recommendation.
- M4: v4l2loopback path.
Suggests: v4l2loopback-dkms; a “Set up webcam” page that detects state (not installed / installed not loaded / Secure Boot key rejected / ready) and runs onepkexec modprobe ...on request, plus an optional “load at boot” step that writes the two config files through the same polkit prompt. Never load the module implicitly. - Build the webcam pipeline with a
teeso a PipeWireVideo/Sourceoutput can be added as a second, zero-setup sink; ship it in M4 only if the spike on PipeWire 1.0.5 is clean, labelled “works in apps with PipeWire camera support”. - Revisit the default once Firefox and Chromium enable PipeWire cameras by default on the target distros.
Sources:
- local
apt-cache policy v4l2loopback-dkms,dkms status,modinfo,mokutil --sb-state - https://sources.debian.org/src/v4l2loopback/ (trixie 0.15.0-2)
- https://www.phoronix.com/news/Fedora-41-Firefox-PipeWire-Cam
- https://www.phoronix.com/news/Chrome-127-PipeWire-Capture
- https://lists.ubuntu.com/archives/ubuntu-mozillateam-bugs/2025-December/182153.html
- https://ideasonboard.com/news/pipewire-is-the-new-v4l2loopback (could not be fetched, 403; cited from search summary)
D. Input mapping for the remote-control window
D.1 Event controllers
Attach to the widget that shows the video (a gtk::Picture inside a focusable container,
focusable=true, can-target=true, grab focus on click):
| Input | Controller | Notes |
|---|---|---|
| Mouse buttons | GestureClick with button=0 (all buttons) | pressed/released give widget coordinates; current_button() gives 1..9; current_event_state() gives modifiers |
| Pointer motion / hover | EventControllerMotion | Send move events while a button is held (drag); send hover moves only when no button is held and throttle to the frame rate |
| Wheel / touchpad scroll | EventControllerScroll with BOTH_AXES (not DISCRETE) | scroll(dx, dy); check unit() (GTK 4.8+): wheel units vs surface pixels. Accumulate and send floats |
| Keys | EventControllerKey | key-pressed(keyval, keycode, state) / key-released; attach the IM context with set_im_context |
| Text | GtkIMMulticontext | commit(str) gives composed text (dead keys, compose, IBus/Fcitx) |
| Touchscreen | EventControllerLegacy | Raw GdkEvent: TouchBegin/Update/End/Cancel, event_sequence() maps to pointer_id; gives true multi-touch |
| Touchpad pinch | GestureZoom | Translate to a two-pointer gesture around the pointer position |
| Focus loss | EventControllerFocus | On leave: release every pressed key and pointer (send UP/CANCEL) to avoid stuck input |
| File drop | DropTarget (gdk::FileList) | Later: push file / install APK, as scrcpy does |
Mouse-emulated touch uses one fixed pointer id (scrcpy reserves special ids for mouse and for the virtual second finger), real touch sequences get ids from a small allocator.
D.2 Coordinate mapping with letterboxing
With gtk::Picture content-fit=Contain, widget size (w, h) in logical pixels and
current video size (vw, vh):
s = min(w / vw, h / vh)
ox = (w - vw * s) / 2 oy = (h - vh * s) / 2
x' = (x - ox) / s y' = (y - oy) / s
- Ignore presses that start in the bars; clamp moves and releases of an ongoing drag to
[0, vw-1] x [0, vh-1]. - Scale factor (HiDPI) cancels out because only ratios are used.
- Send the frame size the coordinates refer to with every event (scrcpy sends position
plus screen size) so the helper can rescale or drop events that raced with a rotation or
a flex-resize. This suggests adding
frame_w/frame_htoInputEvent.touchandInputEvent.scrollin the protocol. (vw, vh)comes from the stream’s session packet / negotiated caps, never from the widget.- For window resize driving a display resize (NEW_DISPLAY / flex): debounce to about 200 ms, round to multiples of 8, keep letterboxing active in between.
D.3 Keys: keycodes or committed text
scrcpy’s SDK keyboard [verified-src, doc/keyboard.md]: letters and control keys go as
key events (so games get real key down/up), other printable characters go as text events;
--prefer-text sends letters as text too; --raw-key-events sends everything as key
events. Text injection in this mode is limited to ASCII plus a few characters; scrcpy’s
answer for everything else is a simulated HID keyboard (UHID), which needs the phone’s
layout to match.
Proposed rule for Tether:
- In
key-pressed, if Ctrl, Alt or Super is held, or the keyval is non-printing (navigation, editing, function, modifier, media keys): sendInputEvent.keywith an Android keycode and metastate, on press and on release. - Otherwise let the IM context filter the event; on
commit(str)sendInputEvent.text{utf8}. - Helper side: inject ASCII through
KeyCharacterMapevents; for anything else set the clipboard and inject paste, or (later) a UHID keyboard. This is the same limitation scrcpy has and should be stated in the UI docs. - A “game mode / raw keys” toggle sends every key as a key event (WASD).
- Key repeat: forward repeats with a repeat count; allow disabling.
Keyval to Android keycode (values are android.view.KeyEvent constants, from memory,
check against the SDK when writing the table):
| GDK keyval | Android | GDK keyval | Android | |
|---|---|---|---|---|
Return, KP_Enter | ENTER 66 | Up/Down/Left/Right | DPAD 19/20/21/22 | |
BackSpace | DEL 67 | Home / End | MOVE_HOME 122 / MOVE_END 123 | |
Delete | FORWARD_DEL 112 | Page_Up / Page_Down | 92 / 93 | |
Tab | TAB 61 | Insert | 124 | |
Escape | ESCAPE 111 | F1..F12 | 131..142 | |
space | SPACE 62 | a..z | A..Z 29..54 | |
0..9 | 7..16 | Shift_L/R | 59 / 60 | |
Control_L/R | 113 / 114 | Alt_L/R | 57 / 58 | |
Super_L/R | META 117 / 118 | Menu | MENU 82 | |
Caps_Lock | 115 | XF86AudioRaiseVolume/LowerVolume/Mute | 24 / 25 / 164 | |
XF86AudioPlay | MEDIA_PLAY_PAUSE 85 | (navigation) | BACK 4, HOME 3, APP_SWITCH 187, POWER 26 |
Metastate: SHIFT 0x1, ALT 0x2, CTRL 0x1000, META 0x10000 (plus the left/right bits if
needed). Use the keyval lowered with gdk::Key::to_lower() for letters so Shift state
travels in the metastate, not in the keycode choice.
D.4 Mouse buttons and shortcuts (scrcpy defaults)
Mouse [verified-src, doc/mouse.md]; scrcpy’s default is --mouse-bind=bhsn:++++:
| Button | Default | With Shift |
|---|---|---|
| Left | touch / click | n/a |
| Right | BACK (wakes the screen if it is off) | forwarded as a real secondary click |
| Middle | HOME | forwarded |
| 4th | APP_SWITCH | forwarded |
| 5th | expand notification panel | forwarded |
Hover is forwarded by default. Ctrl + drag simulates pinch-to-zoom/rotate around the centre, Shift + drag a vertical two-finger tilt, Ctrl + Shift + drag a horizontal one. Double-click on the black bars removes them (resize window to content).
Shortcuts [verified-src, doc/shortcuts.md]: scrcpy uses MOD = left Alt or left Super; MOD+h HOME, MOD+b / MOD+Backspace BACK, MOD+s APP_SWITCH, MOD+m MENU, MOD+Up/Down volume, MOD+p POWER, MOD+o screen off (keep mirroring), MOD+Shift+o screen on, MOD+r rotate, MOD+n / MOD+Shift+n notification panel, MOD+f fullscreen, MOD+g 1:1, MOD+w fit window, MOD+c / MOD+x copy / cut, MOD+v sync clipboard and paste, MOD+Shift+v inject clipboard as typed text. All plain Ctrl+key combinations are forwarded to the device.
Adjustments for a GTK app on GNOME and Cinnamon:
- Super combinations are taken by the shell, and Alt+drag moves windows on Cinnamon. Use left Alt as MOD by default, configurable, and give every action a header-bar button or menu entry (Back, Home, Recents, Power, Volume, Screen off, Rotate, Fit, Fullscreen) so no shortcut is required.
- Forward Ctrl+key to the phone (Ctrl+C/X/V/A/Z work in Android text fields). On Ctrl+V, first push the desktop clipboard to the phone, then forward the key, which gives the expected paste. Ctrl+Shift+V types the clipboard as text.
- F11 toggles fullscreen locally; Escape is forwarded (Android treats it as Back).
- Optional:
gdk::Toplevel::inhibit_system_shortcutswhile the pointer is inside and a “capture keyboard” toggle is on, so Alt+Tab reaches the phone. - Scroll: one wheel notch = 1.0 scroll unit; for smooth scrolling divide pixel deltas by a fixed step (about 50 px) and send fractional values; natural-scroll direction follows the desktop setting automatically because GDK already applies it.
Recommendation. Use the controller set in D.1, the letterbox mapping in D.2 with the
frame size carried in each event, the hybrid key/text rule in D.3, and scrcpy’s
bhsn:++++ mouse defaults with left Alt as the shortcut modifier plus visible buttons for
every navigation action. Add frame_w/frame_h (and a mouse buttons mask if hover and
real secondary clicks are wanted) to the InputEvent messages before the protocol is
frozen.
Sources:
- https://github.com/Genymobile/scrcpy/blob/master/doc/mouse.md
- https://github.com/Genymobile/scrcpy/blob/master/doc/keyboard.md
- https://github.com/Genymobile/scrcpy/blob/master/doc/shortcuts.md
- https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md
Open items to spike first
adb -L localfilesystem:...server socket andadb reverse ... localfilesystem:...with distro adb 34.0.4 / 34.0.5; exactadb connect/adb pairoutput strings on 34.x.- Whether Ubuntu’s adb 34.0.4 has mDNS stubbed like Debian’s (expected yes; irrelevant if
we set
ADB_MDNS=0and use Avahi). - QR pairing on One UI: is the
studio-prefix required, and does the Settings scanner accept our payload. gstgtk4::plugin_register_static()build with gtk4 0.9 / gstreamer 0.23 on Ubuntu 24.04;nvh264decto GL texture on X11 with the NVIDIA driver; frame delay ofavdec_h264with a MediaCodec stream.- A VA-API test machine (Intel/AMD) for
vah264decand the dmabuf path on Wayland. v4l2sinkinto v4l2loopback 0.12.7 with GStreamer 1.24;pipewiresink mode=providecamera node on PipeWire 1.0.5 and which apps list it.- Re-enabling Wireless debugging from the app with
WRITE_SECURE_SETTINGSon One UI. - Auto Blocker’s effect on Wireless debugging (as opposed to USB) on One UI 7.
M4 research: the adb shell helper (org.tether.shell.Main)
Technical reference for writing the enhanced-tier helper in Kotlin (ADR-0007, roadmap “Milestone 4”). Researched 2026-11-15.
Primary reference: scrcpy v5.0.1 (commit a60891ae, 2026-10-08, Apache-2.0),
server/ directory, read from a local clone, plus its release notes and
issues. Secondary: AOSP android14-release, android15-release,
android16-release branches (Shell manifest, IClipboard.aidl, core
permission definitions), fetched from android.googlesource.com.
Conventions used below:
- [scrcpy] = read directly in scrcpy v5.0.1 source.
- [AOSP] = read directly in the AOSP branch named.
- [issue] = taken from a scrcpy issue or release note (linked).
- UNVERIFIED = from memory, inference, or a secondary source; test on the A55 before relying on it.
- Nothing here has been run on the Galaxy A55 (Android 16 / One UI 8.5). Every “works” below means “scrcpy does this and ships it”, not “tested by us”.
- Since
minSdk = 34, all pre-Android-14 branches in scrcpy can be dropped; they are mentioned only where they explain why something exists.
Source file index (all under
https://github.com/Genymobile/scrcpy/blob/v5.0.1/server/src/main/java/com/genymobile/scrcpy/):
| Topic | File |
|---|---|
| Entry point, looper, exit | Server.java |
| ActivityThread / context hacks, AudioRecord fallback | Workarounds.java |
| Fake context | FakeContext.java |
| Restore-on-death process | CleanUp.java |
| Main display mirror | video/ScreenCapture.java |
| New virtual display | video/NewDisplayCapture.java |
| Encoder loop | video/SurfaceEncoder.java, video/CaptureControl.java |
| Packet framing | device/Streamer.java |
| Display change detection | display/DisplayMonitor.java, wrappers/DisplayWindowListener.java |
| Hidden API wrappers | wrappers/ (DisplayManager, SurfaceControl, DisplayControl, InputManager, WindowManager, ActivityManager, PowerManager, ClipboardManager, ServiceManager) |
| Input, clipboard, app start | control/Controller.java, device/Device.java |
| Audio | audio/ (AudioDirectCapture, AudioPlaybackCapture, AudioRecordReader, AudioEncoder, AudioConfig) |
| Camera | video/CameraCapture.java |
| Compile-time AIDL stubs | server/src/main/aidl |
Licence note: scrcpy is Apache-2.0, which is one-way compatible with our
GPL-3.0. Translating its logic to Kotlin is allowed; keep an attribution line
in NOTICE/the file header for anything ported closely.
1. Launching with app_process
How it works
- Classpath.
app_processaccepts a dex, jar or apk that containsclasses.dex(scrcpydoc/develop.md).pm path org.tether.androidprintspackage:/data/app/~~…/base.apk(one line per split); strippackage:and take thebase.apkline. The path changes on every app update, so resolve it at every launch. The$(…)must be expanded on the phone, so quote the whole command for the remote shell. - Command shape used by scrcpy (
app/src/server.c,execute_server):adb -s <serial> shell CLASSPATH=<path> app_process / <MainClass> <args…>. scrcpy reads its own path back fromSystem.getProperty("java.class.path")(first entry) so it can relaunch itself for the cleanup child. - Process name.
app_processtakes--nice-name=<name>between the directory argument and the class name (app_process / --nice-name=tether-shell org.tether.shell.Main). UNVERIFIED on the A55 (from memory ofapp_main.cpp); scrcpy does not use it. - Hidden API policy. scrcpy uses plain
Class.forName/getDeclaredMethodeverywhere with no exemption trick, which implies hidden-API enforcement is not applied to a shell-startedapp_process. No bypass library is needed. (Inference from scrcpy; UNVERIFIED by reading ART source.) - Startup order in
Server.main/internalMain[scrcpy]:- Install a default uncaught-exception handler that logs thread + throwable and then chains to the previous handler.
- If uid is 0 (rooted adbd),
Os.setuid(2000): clipboard does not work as root (#6224). - Prepare a quittable main looper:
Looper.prepare()then set the private staticLooper.sMainLoopertoLooper.myLooper()by reflection. (Looper.prepareMainLooper()makes it non-quittable.) - Parse options; apply workarounds (below); open the connection; start
worker threads;
Looper.loop()on the main thread. - When all workers finish or one reports a fatal error, call
Looper.getMainLooper().quitSafely(), stop/join workers, and finally alwaysSystem.exit(status), because framework classes may have started non-daemon threads that would keep the VM alive.
- Workarounds (
Workarounds.java) [scrcpy]. A static initialiser: constructsandroid.app.ActivityThreadthrough its private constructor, stores it in the staticsCurrentActivityThread, and setsmSystemThread = true. Thenapply()does, in this order:fillConfigurationController()(API 31+): buildandroid.app.ConfigurationController(ActivityThreadInternal)with the activity thread and store it inmConfigurationController. Needed on Samsung, whereDisplayManagerGlobal.getDisplayInfoLocked()callsActivityThread.currentActivityThread().getConfiguration()and hits a null controller (#4467, fixed in v2.3.1). This is the “configuration controller” item in our roadmap. It must run before the firstgetSystemContext()call.fillAppInfo(): createActivityThread$AppBindData, set itsappInfoto anApplicationInfowhosepackageNameiscom.android.shell, and store it inmBoundApplication. (Skipped on ONYX devices, irrelevant to us.)fillAppContext():Instrumentation.newApplication(Application.class, FakeContext)and store the result inmInitialApplication, soActivityThread.currentApplication()is non-null. All three are wrapped in try/catch and failure is only logged.
- FakeContext (
FakeContext.java) [scrcpy]: aContextWrapperaroundActivityThread.getSystemContext()(reflection) that overrides:getPackageName()andgetOpPackageName()→"com.android.shell".getAttributionSource()→AttributionSource.Builder(Process.SHELL_UID).setPackageName("com.android.shell").build().getDeviceId()→0(Android 14 API; default device).getApplicationContext()→ itself;createPackageContext(...)→ itself.getContentResolver()→ an anonymousContentResolversubclass whose hiddenacquireProvider(Context, String)goes throughIActivityManager.getContentProviderExternal(name, userId 0, token, tag)(the mechanismsettings/contentshell commands use) and returns theproviderfield of the returned holder. The other four hidden abstract methods are stubbed. This needs a compile-time stub ofandroid.content.IContentProvider.getSystemService(name): forclipboard, the Samsung-internalsemclipboard, andactivity, overwrite the returned manager’s privatemContextfield with the fake context so later binder calls carry packagecom.android.shellinstead ofandroid. The reason for all of this: the system context’s package isandroid, and system_server rejectsandroidfor uid 2000 (“package android does not belong to uid 2000” / “does not match caller’s uid 2000”: #4639, #6224, #6523).
- Binder services without a manager:
android.os.ServiceManager.getService(name)then<Interface>$Stub.asInterface(binder), both by reflection (wrappers/ServiceManager.java). Used forwindow,power, and the activity manager (viaActivityManagerNative.getDefault()). - Exit when adb dies. scrcpy has no explicit watchdog: each socket read
or write fails when the tunnel closes, the worker reports termination, and
the main looper quits. adbd also kills the shell subprocess when the
transport drops. Because that kill can arrive before any restore code runs,
scrcpy forks a second
app_process(CleanUp.main) at start, which callsOs.setsid()to leave the server’s session, then blocks reading its stdin pipe from the parent. EOF means the parent died; it then restores settings and display power and exits. The parent can update “restore display power” by writing one byte to that pipe. - Samsung restore bug: settings were not restored on some Samsung devices
(#6405,
#6540, fixed in v3.3.4).
The
setsid()comment inCleanUp.main(“avoid being terminated along with the server process on some devices”) is very likely that fix; UNVERIFIED that it is the same commit.
Per version / Samsung
- 14 / 15 / 16: same launch path; no version-specific branch in
Server.java. - Samsung:
fillConfigurationControlleris mandatory (Android 14+ One UI). - Samsung Android 11 only: the encoder crashes when
/proc/self/cmdlineexceeds about 256 bytes (#7169, open). Not our target version, but a reason to keep argv short.
What to do
- Launch as
adb shell 'CLASSPATH=$(pm path org.tether.android | sed -n "s/^package://;/base\.apk$/p") exec app_process / org.tether.shell.Main'and add--nice-nameonly after confirming it on the A55. - Do not pass the one-time token on argv (ADR-0007 currently shows
--token): argv is visible to any other adb shell viaps, and long command lines are a known Samsung hazard. Write it to the helper’s stdin as the first line instead. - Port
Workarounds+FakeContextalmost one to one; keep the same call order; keep every step individually try/caught and report which ones failed inShellHelloas diagnostics. - Release builds use R8 (
isMinifyEnabled = true): add keep rules fororg.tether.shell.**entry points and anything reached only by reflection or byapp_process. - Put framework stubs (
android.content.IContentProvider,android.view.IDisplayWindowListener,android.content.IOnPrimaryClipChangedListener) in acompileOnlymodule so they are not packaged; the boot classpath provides the real classes at runtime. (scrcpy compiles them into its jar and relies on parent-first class loading; either works,compileOnlyis cleaner inside an app APK. UNVERIFIED that AIDL generation works from acompileOnlymodule in our Gradle setup; fallback is to ship them.) - The helper has no
Application, no resources from our APK, no AndroidX initialisers and no native libraries. Keeporg.tether.shellfree ofR.*, Compose, Hilt and JNI. Kotlin stdlib and coroutines are fine (Dispatchers.Mainworks only after the main looper is prepared). - Exit rules: socket EOF or stdin EOF → orderly stop →
exitProcess. Port the cleanup child withsetsid()for anything that must be undone (display power,show_touches,screen_off_timeout, IME policy).
2. Screen capture of the main display
How it works
-
Which API.
ScreenCapture.start()[scrcpy] first calls the hidden staticandroid.hardware.display.DisplayManager.createVirtualDisplay(String name, int width, int height, int displayIdToMirror, Surface surface)by reflection; this returns aVirtualDisplaythat mirrors an existing display at the requested size. Only if that throws does it fall back toSurfaceControl.createDisplay(name, secure)+ a transaction (setDisplaySurface,setDisplayProjection(token, 0, deviceRect, targetRect),setDisplayLayerStack(token, layerStack)). -
Why DisplayManager on 14+. The
SurfaceControldisplay-token methods were moved out ofandroid.view.SurfaceControlin Android 14 (intocom.android.server.display.DisplayControl, see section 5), so the old path does not exist there. That it is the removal that forced the switch is UNVERIFIED (consistent with scrcpy’s Android 14 fixes and the comment inDevice.setDisplayPower). The fallback is effectively dead code for us. -
Permissions [AOSP Shell manifest, 14/15/16]: shell holds
CAPTURE_VIDEO_OUTPUT,READ_FRAME_BUFFER,ACCESS_SURFACE_FLINGER. Android 16 adds a newADD_MIRROR_DISPLAYpermission and shell holds it. -
Secure content. Shell cannot create a secure display since Android 12 (comment in
ScreenCapture.createDisplay); shell does not holdCAPTURE_SECURE_VIDEO_OUTPUTon 14/15/16 [AOSP].FLAG_SECUREwindows (banking apps, some password fields, DRM video) are black in the stream. There is no non-root workaround (#3049). scrcpy also warns when the display lacksFLAG_SUPPORTS_PROTECTED_BUFFERS. Whether Android 15’s “sensitive content protection” (OTP notifications hidden during screen share) applies to a shell mirror display is UNVERIFIED. -
Display size / rotation.
DisplayManagerGlobal.getInstance().getDisplayInfo(displayId)returns a hiddenDisplayInfo; read fieldslogicalWidth,logicalHeight(already rotated),rotation,layerStack,flags,logicalDensityDpi, anduniqueId(may be missing on some ROMs, #6461). If the call returns null, scrcpy parsesdumpsys displaywith a regex on themOverrideDisplayInfoline. -
Change detection (
DisplayMonitor) [scrcpy]: on Android 14+ scrcpy does not useDisplayManager.DisplayListener; it registers anIDisplayWindowListenerwithIWindowManager.registerDisplayWindowListenerand reacts toonDisplayConfigurationChanged(displayId, Configuration). Reason:DisplayListenernever fired on some Android 14 builds and broke again in an Android 15 update (#5908, fixed v3.2). On each event it re-readsDisplayInfo, compares (size, rotation) with the last known value, and only then triggers a reset. -
Android 16 listener pitfall. Android 16 added methods to
IDisplayWindowListener(e.g.onDisplayAddSystemDecorations). A subclass compiled against the old three-method interface throwsAbstractMethodErroron a binder thread and kills the process (#6331, #6362, fixed v3.3.2 / v3.3.3). scrcpy’s fix is to overrideonTransact, catchAbstractMethodError, callreply.writeNoException()and return true. -
Rotation / resize / fold handling (
SurfaceEncoder.streamCapture,CaptureControl) [scrcpy]: a reset callssignalEndOfInputStream()on the running codec; the drain loop sees EOS, then the outer loop stops andreset()s the codec, recomputes the size, reconfigures, creates a new input surface, releases and recreates the mirror display, and restarts. A fold or unfold is just another size change on display 0 (UNVERIFIED on a foldable). -
Sizing. Scale the logical size to fit
max_size, then align to the encoder’sVideoCapabilities.getWidthAlignment()/getHeightAlignment()(v4.0+). Encoder capability limits are applied only after the first failure (v4.1), then scrcpy steps down through 2560, 1920, 1600, 1280, 1024, 800. After a first frame was sent, it retries up to 3 times with a 50 ms sleep. -
Encoder settings (
SurfaceEncoder.createFormat) [scrcpy]:Key Value KEY_MIMEvideo/avc(default),video/hevc,video/av01, VP8/VP9 since v4.1KEY_BIT_RATE8 000 000 default KEY_FRAME_RATE60 (required by configure; real rate is variable) KEY_COLOR_FORMATCOLOR_FormatSurfaceKEY_COLOR_RANGECOLOR_RANGE_LIMITEDKEY_I_FRAME_INTERVAL10 (seconds) KEY_REPEAT_PREVIOUS_FRAME_AFTER100 000 µs (emits a frame for static content, and makes the first frame appear) KEY_PRIORITY0 (real time) KEY_LATENCY1 (added in v4.0, #6670) "max-fps-to-encoder"(float)only when an fps cap is requested scrcpy sets no profile, level or bitrate mode; the encoder default applies. Extra keys can be injected per device via
--video-codec-options. -
Encoder thread must call
Looper.prepare()(some OEM codecs deadlock otherwise, #4143). Output is drained synchronously withdequeueOutputBuffer(info, -1). -
Framing (
Streamer.java) [scrcpy]: stream starts with a 4-byte codec id; each encode session starts with a 12-byte session packet (top bit set, low bit = “client-initiated resize”, then width, height); each buffer is a 12-byte header (u64big-endian = PTS in µs, with bit 62 = config packet and bit 61 = key frame;u32length) followed by the payload. The config buffer (BUFFER_FLAG_CODEC_CONFIG: SPS/PPS, Annex B) is sent as its own packet with no PTS; the client prepends it to the next frame. PTS isBufferInfo.presentationTimeUsunchanged.
Per version / Samsung
- 14:
DisplayListenerunreliable → window listener path. - 15: same; a QPR broke
DisplayListeneragain (#5908). - 16:
IDisplayWindowListenergrew methods (guardonTransact);ADD_MIRROR_DISPLAYexists and is held by shell. - Samsung: needs the configuration-controller workaround for
getDisplayInfo. Exynos encoder behaviour on the A55 (alignment,KEY_LATENCYsupport) is UNVERIFIED; scrcpy’s downsize-on-error loop exists for exactly this.
What to do
- Use only the
DisplayManager.createVirtualDisplay(name, w, h, displayIdToMirror, surface)path. Treat failure as “capability absent”, do not port theSurfaceControlfallback. - Ask the mirror display for the final video size directly (no GL stage); keep input coordinates in device space (section 4).
- Port
DisplayMonitor’s window-listener path including theonTransactguard. This is the single most likely thing to crash on One UI 8.5. - Copy scrcpy’s
MediaFormatas the default and expose codec options through the protocol so the daemon can push per-device overrides without an app release. Our own additions, all UNVERIFIED: request an on-demand key frame withMediaCodec.setParameters(PARAMETER_KEY_REQUEST_SYNC_FRAME)when a viewer (re)attaches instead of a 10 s wait; change bitrate live withPARAMETER_KEY_VIDEO_BITRATE. - Map framing onto our protocol:
StreamOpencarries codec + width/height (scrcpy’s session packet) and is re-sent on every reset; config buffers are a flagged frame; access units carry PTS and a key-frame flag. The desktoph264parseneeds the config before the first key frame after every reset.
3. New virtual display for per-app streaming
How it works
-
API (
wrappers/DisplayManager.createNewVirtualDisplay) [scrcpy]: instantiateandroid.hardware.display.DisplayManagerthrough its hidden(Context)constructor with the fake context, then call the publiccreateVirtualDisplay(name, width, height, dpi, surface, flags). -
Flags (
NewDisplayCapture.startNew) [scrcpy]:Flag Value When PUBLIC1 << 0always PRESENTATION1 << 1always (v3.3.3, #6344) OWN_CONTENT_ONLY1 << 3always SUPPORTS_TOUCH1 << 6always ROTATES_WITH_CONTENT1 << 7always DESTROY_CONTENT_ON_REMOVAL1 << 8default on; off with --no-vd-destroy-contentSHOULD_SHOW_SYSTEM_DECORATIONS1 << 9default on; off with --no-vd-system-decorationsTRUSTED1 << 10Android 13+ OWN_DISPLAY_GROUP1 << 11Android 13+ ALWAYS_UNLOCKED1 << 12Android 13+ TOUCH_FEEDBACK_DISABLED1 << 13Android 13+ OWN_FOCUS1 << 14Android 14+ DEVICE_DISPLAY_GROUP1 << 15Android 14+ -
Permissions [AOSP Shell manifest 14/15/16]:
ADD_TRUSTED_DISPLAY,ADD_ALWAYS_UNLOCKED_DISPLAY,CAPTURE_VIDEO_OUTPUT,INTERNAL_SYSTEM_WINDOWare all held by shell. -
Minimum version. scrcpy refuses
--new-displaybelow Android 10 and injects input on secondary displays from Android 10. The trusted / own-focus flag set that makes a display behave like an independent screen needs 13 and 14. WithminSdk 34we always get the full set. -
Default size/dpi. Without an explicit size scrcpy uses the main display’s natural size and scales dpi by the ratio of the longer sides; flex mode defaults to 1280x960 at 160 dpi.
-
Starting an app (
Device.startApp,wrappers/ActivityManager) [scrcpy]: get the launch intent fromFakeContext.getPackageManager().getLaunchIntentForPackage(pkg)(leanback intent as fallback), addFLAG_ACTIVITY_NEW_TASK, buildActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle(), and callIActivityManager.startActivityAsUser(caller=null, callingPackage="com.android.shell", intent, resolvedType=null, resultTo=null, resultWho=null, requestCode=0, startFlags=0, profilerInfo=null, options, userId=-2)by reflection (11 parameters). A+prefix makes scrcpy callforceStopPackage(pkg, -2)first. The CLI equivalent isam start --display <id> -n <component>. -
Already-running app. What happens when the app already has a task on the phone’s own display (moved, or a second task) is UNVERIFIED; scrcpy’s force-stop option exists because of this.
-
Resize (flex display, v4.0) [scrcpy]:
VirtualDisplay.resize(w, h, dpi)after a debounce; the resulting configuration event resets the encoder and the existing display is re-pointed withVirtualDisplay.setSurface(newSurface)(the display is not recreated, so apps stay). A small tracker remembers recently requested sizes (3 s) to tell client-initiated resizes from device-initiated ones. -
Rotation. The display rotates with content, but the produced frames stay in the display’s physical orientation; scrcpy rotates them in an OpenGL stage (
OpenGLRunner+AffineOpenGLFilter) and keeps a separate transform for input coordinates. -
Destroying the display. With
DESTROY_CONTENT_ON_REMOVALthe tasks on it are removed; without it they move to the main display (scrcpydoc/virtual-display.md, #5615). -
System decorations. With the flag, some devices show a launcher and navigation bar on the new display. Without it the display is empty until an app starts, and no frame is produced until something renders.
-
IME.
IWindowManager.setDisplayImePolicy(displayId, policy):0local,1fallback display (default: keyboard appears on the phone’s own screen),2hide. scrcpy restores a changed policy in the cleanup process. -
Keeping it awake.
IPowerManager.userActivity(displayId, uptimeMillis, 0, 0)every 4 s (--keep-active, v4.0);IPowerManager.isDisplayInteractive(displayId)on 14+ tells whether a given display is on.
Per version / Samsung
- 14: full flag set available.
- 15: UHID devices can be bound to a virtual display by unique id (section 4).
- 16: virtual displays crashed scrcpy on Pixel after the September 2025 security update when desktop-experience features were enabled (#6234, fixed v3.3.2 by the listener guard). One UI 8.5 is a later base, so assume the same applies.
- Samsung, all from open scrcpy issues (not reproduced by us):
- With system decorations, One UI shows a DeX-like desktop on the new display, with a duplicated navigation bar (#6591, S23 Ultra, Android 16) and a new “My Files” icon each run (#6270, S24 Ultra, Android 15). It is not flagged as DeX mode by the phone (#6433, One UI 7), and several displays at once work there.
setDisplayImePolicy(local)throws on a Galaxy S10+ / Android 12 (#5997). Status on One UI 8.5 UNVERIFIED.- Typing into apps on a new display intermittently does nothing on a Fold with Android 16 / One UI 8.5, including with UHID (#6909, open, no diagnosis). Same OS as our test phone.
- Z Fold 4 / Android 16: new display reported as not usable (#6855, open, unconfirmed).
- Press reports say One UI 8 can run real DeX on such a display with scrcpy 4.1+ (PhoneArena); details UNVERIFIED.
What to do
- One
VirtualDisplayper streamed app. Flags: scrcpy’s full Android 14 set minusSHOULD_SHOW_SYSTEM_DECORATIONS, so no launcher, no DeX-like shell and none of the Samsung decoration bugs. Consequence: the desktop window must supply Back (and optionally Home → close window), and the stream must tolerate “no frame yet” until the app draws. - Default to
DESTROY_CONTENT_ON_REMOVAL. Moving a task to the main display when a desktop window closes would wake an app on a phone that may be locked or screen-off. Offer “keep on phone” later. - Start apps through
IActivityManager.startActivityAsUserwithsetLaunchDisplayId; keepam start --displayas a fallback path behind the same protocol message. Test the already-running case on the A55 first and decide whether force-stop is needed. - Window resize: debounce on the desktop too, call
VirtualDisplay.resize, reuse the encoder-reset path from section 2. - Rotation: instead of porting the GL pipeline, send the display rotation in
StreamOpenand rotate on the desktop (GStreamervideoflip). Our own simplification, UNVERIFIED. - IME: try
setDisplayImePolicy(id, LOCAL), catch failure, report it in the mirror’s capabilities. With a PC keyboard the soft keyboard is not needed, soHIDEis a reasonable second choice. - Run a
userActivityticker per live virtual display. - Budget time for #6909-style typing failures on One UI 8.5; have clipboard paste and UHID as alternative text paths (section 4).
4. Input injection
How it works
- Injection call (
wrappers/InputManager) [scrcpy]: get the realandroid.hardware.input.InputManagerfromFakeContext.getSystemService("input")and invoke the hiddeninjectInputEvent(InputEvent, int mode). Modes:0async,1wait for result,2wait for finish. scrcpy uses async for everything except the synthetic COPY/CUT key before a clipboard read (wait for finish). Shell holdsINJECT_EVENTSon 14/15/16 [AOSP]. - Target display: hidden
InputEvent.setDisplayId(int), called only when the id is not 0. - Which display id and which coordinates [scrcpy,
#5370,
#5614]:
- Mirroring the main display: inject to display 0 with coordinates scaled to the device size. Injecting into the mirror display made some UI elements unclickable (fixed v3.1).
- Mirroring another existing display: positional events go to the mirror display id with coordinates in the mirror’s size; key events go to the source display id.
- New virtual display: everything goes to the virtual display id.
- Events whose “screen size” field does not match the current video size are dropped (they were generated against a stale frame).
- Touch (
Controller.injectTouch,PointersState) [scrcpy]: keep up to 10 pointers, each mapped from the client’s pointer id to a small local id, with reusablePointerProperties(toolType = TOOL_TYPE_FINGER) andPointerCoords(x, y, pressure; size and orientation 0). Build withMotionEvent.obtain(downTime, eventTime, action, pointerCount, props, coords, metaState=0, buttonState, xPrecision=1f, yPrecision=1f, deviceId=0, edgeFlags=0, source, flags=0).downTimeis the time of the first pointer’sACTION_DOWN. With more than one pointer, down/up becomeACTION_POINTER_DOWN/UP | (index << ACTION_POINTER_INDEX_SHIFT). Source isSOURCE_TOUCHSCREENandbuttonStatemust be 0 for fingers. - Mouse. When the pointer is the mouse and the event is a hover or has a
non-primary button:
TOOL_TYPE_MOUSE,SOURCE_MOUSE. Button sequence required by apps such as Chrome (#3635): first button down →ACTION_DOWNthenACTION_BUTTON_PRESS; other buttons →ACTION_BUTTON_PRESSonly; release →ACTION_BUTTON_RELEASE, andACTION_UPafter the last one. The action button is set with the hiddenMotionEvent.setActionButton(int). Hover isACTION_HOVER_MOVE. - Scroll: one pointer,
ACTION_SCROLL,SOURCE_MOUSE, withAXIS_HSCROLL/AXIS_VSCROLLset on the coords. - Keys (
Device.injectKeyEvent):KeyEvent(downTime=now, eventTime=now, action, keyCode, repeat, metaState, deviceId=KeyCharacterMap.VIRTUAL_KEYBOARD, scancode=0, flags=0, source=SOURCE_KEYBOARD). The client sends the Android meta state (shift/ctrl/alt/meta bits) with each key. Back, Home and Recents areKEYCODE_BACK,KEYCODE_HOME,KEYCODE_APP_SWITCH. scrcpy’s right-click is “back, or POWER if the screen is off”, decided withisDisplayInteractive(displayId)on 14+. - Text (
Controller.injectText) [scrcpy]: per char,KeyCharacterMap.load(VIRTUAL_KEYBOARD).getEvents(chars); accented letters are first decomposed into dead-key + letter (KeyComposition). Returns null for anything the virtual key map lacks (most non-Latin text, emoji), and the char is skipped. The alternative is clipboard paste: set the device clipboard, then injectKEYCODE_PASTE(scrcpydoc/control.md). That overwrites the phone clipboard, and a few apps ignore programmatic paste (scrcpy’s--legacy-paste). - UHID (
control/UhidManager) [scrcpy]: shell can open/dev/uhidand create a HID keyboard/mouse (UHID_CREATE2,UHID_INPUT2), which Android treats as a physical device (hardware keyboard layout, IME hidden, real mouse pointer). On Android 15+ the device can be tied to a virtual display withInputManager.addUniqueIdAssociationByPort(inputPort, displayUniqueId)usingDisplayInfo.uniqueId(v3.3). Below 15 a UHID mouse only works on the main display. - Permission error. Some OEMs gate
INJECT_EVENTSbehind an extra developer toggle (“USB debugging (Security settings)”, Xiaomi family); scrcpy detects theSecurityExceptiontext and prints guidance (#6080). Not known to affect Samsung.
Per version / Samsung
- 14:
OWN_FOCUSgives each virtual display its own focus, so keys aimed at it do not disturb the phone’s foreground app. - 15: UHID-to-display association available.
- 16: no injection API change found in scrcpy’s history.
- Samsung: see #6909 in section 3 (typing sometimes ignored on One UI 8.5).
What to do
- Port
Device.injectEvent,PointersStateand the mouse button sequence as they are. Use async mode by default. InputEvent{... display_id}in our protocol should carry the mirror id; the helper resolves it to (target display id, coordinate transform) with the rules above, and drops positional events for a stale stream size.- Text: try
KeyCharacterMapfirst; on a null result fall back to clipboard +KEYCODE_PASTEfor the whole string, and restore the previous clip afterwards (our addition, UNVERIFIED that restore is race-free). Suppress our own clipboard-changed echo while doing so (section 6). - Treat UHID keyboard as a later option for the “types nothing” failure mode and for non-US layouts.
- Report
SecurityExceptionon first injection as a capability failure inShellHelloinstead of failing silently.
5. Screen off while mirroring
How it works
- Call (
Device.setDisplayPower) [scrcpy]: for every physical display,SurfaceControl.setDisplayPowerMode(IBinder token, int mode)with mode0(off) or2(normal), by reflection onandroid.view.SurfaceControl. - Tokens on Android 14+ (
wrappers/DisplayControl) [scrcpy]:getPhysicalDisplayIds()andgetPhysicalDisplayToken(long)are no longer onSurfaceControl; they live incom.android.server.display.DisplayControl, which is in the system-server jars, not the boot classpath. The trick:com.android.internal.os.ClassLoaderFactory.createClassLoader(String dexPath, String librarySearchPath, String libraryPermittedPath, ClassLoader parent, int targetSdkVersion, boolean isNamespaceShared, String classLoaderName)withdexPath = Os.getenv("SYSTEMSERVERCLASSPATH"), nulls, the system class loader as parent,0,true,null.loadClass("com.android.server.display.DisplayControl").- Invoke the private
Runtime.loadLibrary0(Class, String)with that class and"android_servers"so its native methods bind. - Call the static
getPhysicalDisplayIds(): long[]andgetPhysicalDisplayToken(long): IBinder. scrcpy picks this path when SDK ≥ 34 andSurfaceControlhas nogetPhysicalDisplayIds(some OEM builds kept it).
- Android 15 alternative.
DisplayManagerGlobal.requestDisplayPower(int displayId, boolean on)exists and scrcpy 3.0 used it, but it made the device stop accepting input on some phones, so it was rolled back to the old method (#5530, v3.0.1); it is behind a constant set to false. The shell commandcmd display power-off 0/power-on 0is the same mechanism (Android 15+, scrcpydoc/device.md). - It is not sleep. The panel is off but the device stays interactive.
Any wake (POWER key, physical or injected) turns the panel back on, so
scrcpy re-applies “off” 200 ms after it injects
KEYCODE_POWER/KEYCODE_WAKEUPkey-up. The physical power button still turns it on. - Timeout and lock. The normal screen timeout still runs; when it fires
the device really sleeps and locks, and the mirror shows the lock screen
after a wake. scrcpy pairs screen-off with
--stay-awake(settings put global stay_on_while_plugged_in 7, effective only while charging),--screen-off-timeout(settings put system screen_off_timeout), or theuserActivityticker. - Restore. The cleanup child (section 1) turns power back to normal if
the helper dies while the display is forced off, but only if the display is
still “on” according to
isDisplayInteractive. For a new-virtual-display session the power call targets display 0 (#5522). - OEM notes [scrcpy]: Honor on 14 needs the single built-in token path (#4823); “turn screen off on some devices” was fixed in v3.1 (#4544, #5274).
Per version / Samsung
- 14, 15, 16:
DisplayControlclass-loader path. 15+ also hasrequestDisplayPower/cmd display power-offas a second option. - Whether rotation, a fold, or Always On Display re-lights the panel on One UI is UNVERIFIED. No Samsung-specific breakage found in scrcpy’s tracker for 14+.
What to do
- Implement the
DisplayControlpath first; keepcmd display power-off <id>(exec) as the fallback on 15+ and probe which one works atShellHello. - Always run the cleanup child when
screen_offis requested; never rely on in-processfinallyblocks. - Wireless adb means “not plugged in” is common, so
stay_on_while_plugged_inis not enough: use theuserActivityticker (display 0) while a mirror is open, and tell the user that the lock timeout is being held off. - After any injected POWER/WAKEUP, re-apply off after ~200 ms.
6. Clipboard as shell
How it works
- Current scrcpy (v5.0.1) no longer reflects on
IClipboard. It takes the realandroid.content.ClipboardManagerfromFakeContext.getSystemService("clipboard")(whosemContexthas been replaced by the fake context) and uses the publicgetPrimaryClip(),setPrimaryClip(ClipData.newPlainText(null, text))andaddPrimaryClipChangedListener(...). The manager fills in packagecom.android.shell, attribution tag, user id and device id itself. - Create it on the main (looper) thread, even if unused at first
(comment in
Controller’s constructor); listener callbacks are delivered through that looper. - Why shell may read in the background [AOSP Shell manifest 14/15/16]:
shell holds
READ_CLIPBOARD_IN_BACKGROUND. Whether the “pasted from clipboard” toast appears for shell reads is UNVERIFIED. - Binder signatures, if we ever need the raw interface. Identical on
Android 14, 15 and 16 [AOSP
core/java/android/content/IClipboard.aidl]:getPrimaryClip(String pkg, String attributionTag, int userId, int deviceId): ClipDatasetPrimaryClip(ClipData clip, String callingPackage, String attributionTag, int userId, int deviceId)addPrimaryClipChangedListener(IOnPrimaryClipChangedListener listener, String callingPackage, String attributionTag, int userId, int deviceId)(and the matchingremove…), listener is a oneway interface with one methoddispatchPrimaryClipChanged().- Also
hasPrimaryClip,getPrimaryClipDescription,clearPrimaryClip,getPrimaryClipSourcewith the same four trailing parameters. - Values scrcpy used: package
com.android.shell, tagnull, user0, device id0(default device).deviceIdis the Android 14 addition.
- OEM signature drift (scrcpy v3.2
wrappers/ClipboardManager.java): sevengetPrimaryClipvariants were probed in order, including OEM ones with an extra trailingboolean userOperate(Honor, #4822), a seven-argument form, and a trailingString. This probing is exactly what the switch to the real manager removed. - Samsung. One UI’s
ClipboardManagerdelegates toSemClipboardManager, which readsSettings.Systemthrough the context’s content resolver; with the plain system context that fails with “calling package android does not match caller’s uid 2000” (#6224, v3.3.2). After a later update a similar denial required patching thesemclipboardservice’s context as well (#6523, v3.3.4). Both are covered byFakeContextas described in section 1. - Echo suppression [scrcpy]: an atomic “setting clipboard” flag is raised
around
setPrimaryClipso the listener ignores our own write; and the set is skipped when the clipboard already holds the same text (otherwise keyboard clipboard histories get flooded). - Text only. scrcpy never transfers images or URIs.
Per version / Samsung
- 14 / 15 / 16: no signature difference in AOSP.
- Samsung: depends on the fake content resolver and the
semclipboardpatch. UNVERIFIED on One UI 8.5.
What to do
- Use the real
ClipboardManagerthroughFakeContext, created on the main looper thread; register the listener there; pushClipboardmessages on change and answerClipboardReadon demand. - Keep a raw
IClipboardpath (AOSP four-trailing-parameter signature only) as a diagnostic fallback, not as the main path. - Port both echo-suppression measures.
- First test on the A55: read, write, listener, with the phone locked and unlocked.
7. Audio capture of device playback
How it works
- Sources (
audio/AudioSource.java) [scrcpy]:output=MediaRecorder.AudioSource.REMOTE_SUBMIX: the whole mix, and playback on the phone is silenced while capturing (scrcpydoc/audio.md).playback: anAudioPolicyloopback mix (below), Android 13+.micand other microphone presets; since v3.2 alsoVOICE_CALL,VOICE_UPLINK,VOICE_DOWNLINK,VOICE_PERFORMANCE.
- Permissions [AOSP Shell manifest 14/15/16]:
RECORD_AUDIO,CAPTURE_AUDIO_OUTPUT,MODIFY_AUDIO_ROUTINGall held by shell. - Format (
AudioConfig): 48 000 Hz, stereo, PCM 16-bit. - Direct capture (
AudioDirectCapture) [scrcpy]:AudioRecord.Builder().setContext(FakeContext)(API 31+),.setAudioSource(source),.setAudioFormat(...),.setBufferSizeInBytes(8 * minBufferSize),.build(),startRecording().setContextis what makes the attribution (uid 2000,com.android.shell) correct. - Fallback constructor (
Workarounds.createAudioRecord) [scrcpy], used only when the builder throwsNullPointerException(Vivo): create an emptyAudioRecordthrough the hidden(long)constructor, set private fields (mRecordingState,mInitializationLooper,mAudioAttributesbuilt with the hiddenAudioAttributes.Builder.setInternalCapturePreset(int),mChannelCount,mChannelMask), call the privateaudioParamCheckandaudioBuffSizeCheck, then the privatenative_setup. On Android 14+ that native method has 12 parameters:(Object weakThis, Object attributes, int[] sampleRate, int channelMask, int channelIndexMask, int audioFormat, int buffSizeInBytes, int[] sessionId, Parcel attributionSource, long nativeRecordInJavaObj, int maxSharedAudioHistoryMs, int halInputFlags). The attribution parcel comes from the hiddenAttributionSource.asScopedParcelState()→getParcel(). Then setmSampleRate,mSessionId,mState = STATE_INITIALIZED. - Android 11 foreground hack: start
com.android.shell/.HeapDumpActivityso uid 2000 counts as foreground, retry, then force-stop the shell package. Android 11 only; irrelevant withminSdk 34. - Android 16:
AudioRecord.Builder.build()threwUnsupportedOperationException: Cannot create AudioRecordon Android 16 previews and again on Beta 4 (#5698 fixed v3.2, #6021 fixed v3.3). The root cause and the exact fix were not read; the v5.0.1 shape ofFakeContext(attribution source,getDeviceId,setContext) is the result. UNVERIFIED beyond that. - Playback capture (
AudioPlaybackCapture) [scrcpy, #4380], all hidden classes inandroid.media.audiopolicy:AudioMixingRule.Builder();setTargetMixRole(MIX_ROLE_PLAYERS);addMixRule(RULE_MATCH_ATTRIBUTE_USAGE, AudioAttributes)once per usage (media, game, alarm, notification, ringtone, assistant, accessibility, navigation, sonification, voice communication and signalling, unknown; the full list is new in v5.0, #6975);voiceCommunicationCaptureAllowed(true);build().AudioMix.Builder(rule).setFormat(format).setRouteFlags(flag).build()withROUTE_FLAG_LOOP_BACK(captured audio is removed from the phone’s speaker) orROUTE_FLAG_LOOP_BACK_RENDER(duplication: still plays on the phone; scrcpy--audio-dup).AudioPolicy.Builder(FakeContext).addMix(mix).build().- Hidden static
AudioManager.registerAudioPolicyStatic(policy), must return 0. policy.createAudioRecordSink(mix)returns theAudioRecord. Needs Android 13 (when shell gainedMODIFY_AUDIO_ROUTING). Not affected by phone volume or connected headsets. Apps that opt out of playback capture are not captured.
- Reading (
AudioRecordReader): read at most 1024 frames per call into a direct buffer; PTS fromAudioRecord.getTimestamp(ts, TIMEBASE_MONOTONIC), falling back to previous PTS + duration, forced strictly increasing. - Encoding (
AudioEncoder):MediaCodecforaudio/opus,KEY_BIT_RATE = 128000,KEY_CHANNEL_COUNT = 2,KEY_SAMPLE_RATE = 48000; asynchronous callback on aHandlerThread, separate input and output threads. If the device has no Opus encoder, configure fails with0xfffffffeand scrcpy suggests AAC. - Framing: same 12-byte header as video. Android’s Opus codec-config
buffer is not a bare
OpusHead: it is"AOPUSHDR", a native-endian 64-bit length, theOpusHeadbytes, thenAOPUSDLY/AOPUSPRLblocks.Streamer.fixOpusConfigPackettrims it to justOpusHead. Frames after that are plain Opus packets. - Audio failure is non-fatal in scrcpy: it sends a “stream disabled” code and continues with video.
Per version / Samsung
- 14: both sources available;
native_setuphas the extrahalInputFlags. - 15: no change found.
- 16: builder regression twice during previews, fixed upstream (see above).
- Samsung: no Samsung-specific audio issue found in scrcpy’s tracker.
Presence of
c2.android.opus.encoderon the A55 is expected but UNVERIFIED.
What to do
- Map protocol
AudioStart.source:OUTPUT→REMOTE_SUBMIX(phone goes silent, captures everything);PLAYBACK_DUP→AudioPolicywithROUTE_FLAG_LOOP_BACK_RENDER. Consider a third value forROUTE_FLAG_LOOP_BACK(silent phone, per-usage capture, ignores volume). - Default the “Phone audio” toggle to the playback/policy path with a UI note
that some apps opt out; offer
OUTPUTas “capture everything (mutes phone)”. - Use the builder with
setContext(FakeContext)only. Port the reflectivenative_setupfallback only if the A55 actually needs it. - Strip the Opus config to
OpusHeadand put it inStreamOpen; the desktop can feed it toopusdecas stream header. - Make audio failure a
GrantResult-style soft error, never fatal to the mirror. - Worth a separate spike for M3’s call audio: scrcpy lists
VOICE_CALL/ uplink / downlink sources for shell. Whether Samsung’s audio HAL honours them is UNVERIFIED.
8. Camera capture from shell
How it works
- Access (
wrappers/ServiceManager.getCameraManager,CameraCapture) [scrcpy]: constructandroid.hardware.camera2.CameraManagerthrough its hidden(Context)constructor with the fake context. Shell holdsandroid.permission.CAMERAon 14/15/16 [AOSP]. - Minimum version: Android 12 (
Server.scrcpyrefuses below; that is when shell could open the camera). - Flow: dedicated
HandlerThread;openCamera(id, callback, handler); choose a size fromStreamConfigurationMap.getOutputSizes(MediaCodec.class)(or high-speed sizes);SessionConfiguration(SESSION_REGULAR | SESSION_HIGH_SPEED, [OutputConfiguration(encoderSurface)], executor, stateCallback);createCaptureRequest(TEMPLATE_RECORD), add the surface, optionally setCONTROL_AE_TARGET_FPS_RANGE = Range(fps, fps),FLASH_MODE_TORCH,CONTROL_ZOOM_RATIO;setRepeatingRequest. - Constraints [scrcpy]:
- The camera only renders to a surface whose size equals a supported capture size. Any other output size needs the OpenGL stage; v4.1 adapts the target size to avoid configuration errors (#6919).
SurfaceTexture’s transform matrix is wrong for camera input; scrcpy substitutes a vertical-flip matrix when it uses GL.- Declared sizes and frame rates are not reliable on all devices
(scrcpy
doc/camera.md). - The camera can be taken away (another app opens it); scrcpy marks the capture closed and ends the stream.
- Android 16 breakage:
CameraManager.getCameraCharacteristicsnow callsgetRotationOverride→ActivityManager.getAppTasks(), which sent packageandroidfor uid 2000 and was denied (#6523, fixed v3.3.4). The fix is theactivityentry inFakeContext.getSystemService(patching theActivityManager’smContext).
Per version / Samsung
- 14 / 15: works with the fake context.
- 16: needs the
ActivityManagercontext patch. - Samsung: scrcpy v2.3 “fix camera issues on many devices” (#4392); nothing newer and Samsung-specific found. Behaviour while the phone is locked or the camera privacy toggle is on is UNVERIFIED.
What to do
- Offer only sizes reported by
getOutputSizes(MediaCodec.class)and encode at exactly that size, so no GL stage is needed. Send sensor orientation and facing inStreamOpenand rotate/flip on the desktop beforev4l2sink. - Expose camera list (id, facing, sizes, fps ranges) through
ShellHelloor a dedicated message. - Keep the normal-tier foreground camera stream (ADR-0007) as the fallback when the shell camera fails.
- Handle camera disconnect as a clean stream end with a reason.
9. Privileged commands for grants
How it works
-
scrcpy mixes both styles [scrcpy]: binder for hot paths (settings through the
settingscontent provider obtained withgetContentProviderExternal, inwrappers/ContentProvider.java; activity start; force-stop), and plainRuntime.execfor rare things (dumpsys displayparsing inwrappers/DisplayManager, helpers inutil/Command.java). -
Shell holds the needed permissions on 14/15/16 [AOSP Shell manifest]:
GRANT_RUNTIME_PERMISSIONS,MANAGE_APP_OPS_MODES,MANAGE_NOTIFICATION_LISTENERS,WRITE_SECURE_SETTINGS,CHANGE_DEVICE_IDLE_TEMP_WHITELIST,DEVICE_POWER. -
Per grant:
Goal Command Notes Runtime permissions pm grant org.tether.android <permission>Only for runtime (dangerous) or development permissions. Notification access cmd notification allow_listener org.tether.android/<listener class>Skips the Android 13+ “restricted settings” UI gate for sideloaded apps. OTP / sensitive notifications (15+) appops set org.tether.android RECEIVE_SENSITIVE_NOTIFICATIONS allowRECEIVE_SENSITIVE_NOTIFICATIONSis `signatureAll files access appops set org.tether.android MANAGE_EXTERNAL_STORAGE allowPermission is `signature Battery allowlist dumpsys deviceidle whitelist +org.tether.androidUser allowlist. Settings `settings put <global secure -
Persistence across reboot (UNVERIFIED as a set; standard platform behaviour, confirm each on the A55): runtime permission grants, app-op modes, the enabled notification listener list, the device-idle user allowlist and settings values are all stored on disk and survive reboot. They are lost on uninstall, and app-ops/permissions can be reset by the user (“Reset app preferences”, manual revoke). Not persistent: the helper itself, display power state,
deviceidle tempwhitelist, and wireless debugging on Samsung (ADR-0007). -
Hard-restricted runtime permissions (SMS, call log) may need installer allowlisting before
pm granttakes effect. UNVERIFIED; check against how ADR-0011 already obtains them.
Per version / Samsung
- 14: no sensitive-notification gate.
- 15 / 16:
RECEIVE_SENSITIVE_NOTIFICATIONSapp-op needed for OTP content. Android 16 restricts whichdevice_configflags shell may write (allowlist); none of our grants usedevice_config. - Samsung: no extra developer toggle is needed for
pm grant(unlike the Xiaomi family). One UI’s own “sleeping apps” list is separate from the device-idle allowlist and has no known shell command; UNVERIFIED.
What to do
- Exec the commands from the helper with
ProcessBuilder, array arguments (never a shell string), capture exit code + stderr intoGrantResult. They are rare, the CLIs are stable across 14–16, and binder signatures for the same operations are not. - After each grant, verify by reading back (
appops get,cmd notification list_listenersor the secure setting,dumpsys deviceidle whitelist,dumpsys packagepermission state) and report the verified state, not the exit code. - Whitelist the exact set of grant items in the helper; do not expose a generic “run command” message over the socket.
- Re-check grants on every helper start and repair silently; treat them as persistent but revocable.
10. App list with labels and icons
How it works
- scrcpy (
Device.listAppsand friends) [scrcpy]:FakeContext.getPackageManager();getInstalledApplications(GET_META_DATA); keep entries whereappInfo.enabledandgetLaunchIntentForPackage(pkg) ?: getLeanbackLaunchIntentForPackage(pkg)is non-null; label frompm.getApplicationLabel(appInfo); system flag fromApplicationInfo.FLAG_SYSTEM. It is slow (“this may take some time”) and runs on a worker.--list-appsbroke once and was fixed in v3.3.1 (#6165), so the fake context path forPackageManageris exercised upstream. Shell holdsQUERY_ALL_PACKAGES[AOSP]. - Icons: scrcpy does not fetch icons at all. Loading
pm.getApplicationIcon(...)and rasterising anAdaptiveIconDrawableto aBitmapinsideapp_processis plausible but UNVERIFIED. - CLI alternative:
cmd package query-activities --brief -a android.intent.action.MAIN -c android.intent.category.LAUNCHERlists launchable components; no labels or icons.
What to do
- Build
AppListin the normal app, not in the helper. Our app has a realContext, resources and bitmaps: declare a<queries>element forACTION_MAIN+CATEGORY_LAUNCHER(noQUERY_ALL_PACKAGESneeded), usequeryIntentActivitiesorLauncherAppsfor label + icon, hash the PNG foricon_hash, cache by package +lastUpdateTime. This also works in the normal tier (for “Open on phone”) and keeps the helper small. - The helper only needs
StartApp{package, display_id}: resolve the launch intent withFakeContext.getPackageManager().getLaunchIntentForPackage(the scrcpy path) or accept an explicit component from the app’s list. - If a shell-side list is ever needed (app not running), use scrcpy’s
PackageManagerapproach for package + label and skip icons.
11. Samsung / One UI problems and workarounds
| Problem | Evidence | Workaround |
|---|---|---|
NPE in ConfigurationController.getConfiguration() when reading display info (Android 14+ One UI) | #4467, v2.3.1 | fillConfigurationController() before first system-context use (section 1). |
Clipboard: “calling package android does not match caller’s uid 2000” via SemClipboardManager | #6224 v3.3.2, #6523 v3.3.4 | Fake content resolver + patch mContext of clipboard and semclipboard managers. |
| Settings/display state not restored after disconnect | #6405, #6540, v3.3.4 | Cleanup child in its own session (Os.setsid()). |
| Encoder abort when the process command line is long (Android 11 Samsung) | #7169 open | Short argv; pass options over stdin/socket. |
| New display shows a DeX-like shell, double nav bar, duplicated icons | #6591, #6270, #6433 | Create displays without SHOULD_SHOW_SYSTEM_DECORATIONS. |
| Typing sometimes ignored on a new display, Android 16 / One UI 8.5 | #6909 open | None known. Have paste and UHID text paths. |
setDisplayImePolicy throws (S10+, Android 12) | #5997 open | Catch, fall back to default/hide. Status on 16 UNVERIFIED. |
| New display unusable on Z Fold 4 / Android 16 | #6855 open, unconfirmed | None. Probe and degrade to main-display mirror. |
| Mirroring an existing DeX display is black on Android 15 | #6287 open | Not our use case; do not target DeX displays. |
| Auto Blocker blocks adb commands over USB | Press and vendor help pages (HotHardware, Phonecheck); default-on on newer One UI per netzwelt | User must turn it off (or its USB-commands sub-option). Whether it also blocks wireless debugging was not answered by any source: UNVERIFIED, test on the A55. One UI 9 beta “Maximum restrictions” reportedly blocks USB entirely (Android Authority). |
| Wireless debugging off after reboot | ADR-0007 (not re-verified here) | Detect and prompt; USB fallback. |
Knox / app_process | No Knox-specific app_process restriction found in scrcpy source or tracker beyond the items above | Nothing to do. Not using root, so Knox warranty bit is untouched. |
| Secure Folder, Samsung Pass, banking apps | General FLAG_SECURE behaviour (section 2); Samsung specifics UNVERIFIED | Black frames; show a “protected content” hint on the desktop. |
What to do
- Treat the first five rows as mandatory ports; they are cheap and already proven upstream.
- Add a
ShellHello.diagnosticsblock: brand, model, SDK, One UI version (ro.build.version.oneui), which workarounds applied, which probes failed. - Run a scripted A55 acceptance pass before building UI: display info,
mirror, rotation event, clipboard read/write/listener, new display without
decorations, app start, key + text into that display, IME policy, screen
off/on + cleanup after
adb kill-server, both audio sources, camera open. - Watch scrcpy’s tracker for #6909; it is the same OS build family as the test phone.
12. New shell restrictions in Android 15 / 16
Findings
-
No permission was removed from the shell package between
android14-release,android15-releaseandandroid16-release[AOSPpackages/Shell/AndroidManifest.xml, diffed]. Every permission this design relies on is present in all three:INJECT_EVENTS,ADD_TRUSTED_DISPLAY,ADD_ALWAYS_UNLOCKED_DISPLAY,CAPTURE_VIDEO_OUTPUT,CAPTURE_AUDIO_OUTPUT,MODIFY_AUDIO_ROUTING,RECORD_AUDIO,CAMERA,READ_CLIPBOARD_IN_BACKGROUND,GRANT_RUNTIME_PERMISSIONS,MANAGE_APP_OPS_MODES,MANAGE_NOTIFICATION_LISTENERS,WRITE_SECURE_SETTINGS,DEVICE_POWER,QUERY_ALL_PACKAGES,START_ACTIVITIES_FROM_BACKGROUND. This is AOSP; Samsung’s shipped manifest may differ (UNVERIFIED; check withdumpsys package com.android.shellon the A55). -
Never held:
CAPTURE_SECURE_VIDEO_OUTPUT(so secure content stays black). -
Added for shell: Android 15
MANAGE_DISPLAYS,RECEIVE_SENSITIVE_NOTIFICATIONS(for CTS; shell holding it does not let shell grant it to us). Android 16ADD_MIRROR_DISPLAY(new gate for mirror displays; shell passes it),MANAGE_ADVANCED_PROTECTION_MODE/QUERY_ADVANCED_PROTECTION_MODE. -
Behaviour changes that broke scrcpy without any permission change:
Release Change Reference 14 Display tokens moved to DisplayControl;DisplayListenerunreliable;native_setupgained a parameter;--lock-video-orientationand crop paths brokev2.3, v2.4, v3.0 notes 14 QPR3 / 15 freezeDisplayRotation/thawDisplayRotationgained aString callerparameterwrappers/WindowManager.java15 New requestDisplayPower, unusable on some devices;DisplayListenerbroke again in a monthly update#5530, #5908 15 OTP content withheld from notification listeners without the sensitive-notifications app-op section 9 16 AudioRecord.Builderfailed for shell during previews (twice)#5698, #6021 16 IDisplayWindowListenergained methods →AbstractMethodError#6331, #6362 16 CameraManagerperforms a package/uid check throughgetAppTasks#6523 16 device_configwrites from shell limited to an allowlistAOSP mirror commits (omnirom gerrit); secondary source -
Android 16 Advanced Protection Mode: its effect on adb / wireless debugging was not established. UNVERIFIED.
-
Pattern: most breakages arrived in monthly or QPR updates, not at major releases, and were package-attribution checks or interface growth rather than permission removals.
What to do
- Design for breakage between app releases: every feature is a probed
capability in
ShellHello; one failing probe never takes down the helper; failures carry the exception class and message so the desktop can show a precise “not supported on this build” and we can triage from logs. - Any binder callback class we implement must tolerate unknown transactions
(the
onTransactguard). - Anything that passes a package name must pass
com.android.shell, neverandroid. When a newSecurityExceptionmentions “package android … uid 2000”, the fix is almost always another manager whosemContextneeds the fake context. - Track scrcpy releases as an early-warning feed; its fixes for Pixel betas typically precede the same base reaching One UI.
Open items to verify on the Galaxy A55 (Android 16 / One UI 8.5)
--nice-nameaccepted byapp_process; stdin token hand-off works over wireless adb.- Workarounds all apply;
getDisplayInfo(0)returns data. - Window-listener events arrive on rotation; no
AbstractMethodError. - Clipboard read / write / listener, locked and unlocked.
- New display without system decorations: app start, touch, keys, text, IME policy result; behaviour when the app is already open on the phone.
DisplayControlscreen-off path and cleanup after transport loss.REMOTE_SUBMIXandAudioPolicycapture; Opus encoder present.- Camera open and sizes; behaviour while locked.
- Each grant command, its read-back, and survival across reboot.
- Whether Auto Blocker affects wireless debugging.
dumpsys package com.android.shellpermission list versus AOSP.