Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Decisions

Every decision the design pages do not explain on their own, with its date and reason. Open ones wait for the project owner; the rest are settled until someone reopens them. When a decision changes, its entry is updated, and the old reasoning is kept in a sentence.

Package ID

Settled 2026-11-17: dev.t342.quitlock (dev builds dev.t342.quitlock.dev), under the owner’s domain t342.dev. The Kotlin packages follow it (dev.t342.quitlock, dev.t342.quitlock.core). It replaced the placeholder org.quitlock.app, which claimed quitlock.org, a domain the project does not own, and could have been registered first by someone else with Google or a store.

It cannot change once phones run a release: Android treats another package ID as another app, and device owner cannot move to it, so every phone would need an exit and a fresh setup. The domain must stay renewed, so no one else can appear to own the name.

Open

Arming without Chrome

A release build refuses to arm without Chrome, the one managed browser. The alternative is to arm and suspend every browser until Chrome is installed, which would let people without Chrome use QuitLock, but leaves them with no browser at all. Left to the owner, since it changes who can use the app.

Arming when the battery dialog is declined (milestone 10)

Arming goes ahead; the self-check then reports it on every check, and a tap asks again. Refusing to arm would be stricter, but would also block arming on a phone whose battery settings misbehave. No better option found; kept.

Re-pairing replaces the config (milestone 5)

The enrolment after a re-pair carries a config, so it replaces the config as well as the keys. While armed it may only keep or tighten the config in force, so this cannot loosen anything. No better option found; kept.

looks_like_android matches cameras (milestone 12)

The CLI looks for a phone by its MTP, PTP or adb interface. A PTP camera matches too, and is then sent AOA request 51, which it should stall. Harmless as far as is known; narrowing the match would miss phones in PTP mode.

Made after the first phone test (2026-12-01)

The owner’s first armed test on a real phone (Android 13) found the CLI hanging, setup’s settings never reaching the phone, and a main screen that contradicted itself. Decisions, each confirmed by the owner:

  • Sessions are gone; the phone answers while it is unlocked, with no tap. A session had to be opened on the phone before every command; the CLI then waited up to 5 minutes for it, which looked like a hang, and each command used up the session. Unarmed and in dev builds the tap protected nothing, since adb was on anyway. Now a command connects, works and disconnects. Requiring the phone to be unlocked keeps an idle phone from answering whatever it is plugged into. Every change still needs a signature, so serving without a tap adds no way out.
  • The 5-minute USB debugging tap stays for armed phones (renamed Allow USB debugging), with its limit, tamper watch, self-check and log entries, because an adb shell is still a shell. Invariant 13 is unchanged in substance.
  • The CLI fails at once when adb says the phone is unauthorised, offline or not permitted, with what to do, instead of waiting. It waits only for the phone to be unlocked and for Android’s accessory chooser.
  • --transport auto uses adb first when the phone has it on, and the USB accessory only otherwise, so a phone that adb reaches is never switched out of file transfer.
  • Running setup again on an enrolled phone sends the settings as a config change, signed with the enrolled owner key, instead of stopping. Setup saves the settings to quitlock.toml before touching the phone and reads them back afterwards.
  • The phone shows no settings until some have arrived, instead of the defaults it would enforce, so a failed enrolment is visible.

Made in milestone 14 (2026-11-18)

  • A hard never-suspend rule, decided on the phone. A blocklisted keyboard could leave a phone with a password screen lock impossible to unlock, and undoing it needs the CLI, which needs the unlocked phone: a lockout only a recovery wipe ends. The phone works out what it needs each time it applies the rules, rather than trusting a fixed list of names, because names differ between makers and an absent system app’s name can be taken by a sideloaded app. Exempting every system app was the alternative; rejected, since some system apps are browsers. Role holders installed after arming are protected only when they are the last one left, which leaves a narrow, visible gap (a browser that is the only keyboard) in exchange for never locking the owner out.

Made in milestone 13 (2026-11-17)

  • Sessions over the USB accessory last 15 minutes; with adb, 5. The 5-minute limit exists because adb is a shell on the phone. An accessory session exposes only the session protocol, where every change needs a signature, so its length gives no extra way out, and 5 minutes was tight for quitlock setup, dash and a partner reading a review. Changes invariant 13. Superseded 2026-12-01: there are no sessions; the adb window keeps its 5 minutes.
  • Config changes can start on the phone (Propose a change, and Allow for a suspended app), behind the owner phone secret. Replaces “no config editing on the phone”. It adds no way out: a phone-made change is exactly a config push --draft approved with the owner phone secret, so loosening still waits and still needs the partner. Closes milestone 6’s gap that allowing an app needed a computer.
  • Settings are display preferences only, stored apart from enrolment (quitlock_settings), so nothing there can weaken protection. No adb default: adb stays a choice made on the phone each time.
  • The theme setting applies through a configuration override in every QuitLock screen, rather than UiModeManager.setApplicationNightMode on API 31 and later: one way for every API level.
  • Screens keep their state across rotation (configChanges), rather than saving and restoring each pending step: the screens are built in code, so nothing needs reloading, and a dialog’s answer is not lost.
  • The developer tools change state directly (finish a countdown, drop a waiting change). They exist only in dev builds, which can be removed instantly anyway.
  • The CLI asks “Send it?” before a loosening change that will start a countdown, an exit, a key change and an update while armed. Tightening changes are sent without asking. --yes skips it for scripts.
  • The setup wizard checks the recovery phrase by asking for three random words, which can be skipped by typing skip.
  • The spec is retired for this book. It was a brief for building QuitLock; the book describes it as it is. Amendment notes moved out of the normative pages into this log.

Owner amendments, earlier

  • The holder of the phone can always get out by re-pairing (2026-11-15, invariant 2). Originally a keyless exit started on the phone. Replaced by “Pair a new key” plus the CLI’s signed exit, which in solo mode gives the same total delay with one way out instead of two. Partner mode keeps a 72-hour minimum on re-pairing, so the owner cannot drop the partner at once.
  • INTERNET is held for the Private DNS call (2026-11-14, invariant 4). Originally forbidden outright, which made the documented call impossible: it tests the resolver from inside the app. What this costs: “no monitoring” used to show in the manifest alone; it now rests on the source containing no networking code, which the build checks and a reader can confirm.
  • The CLI may download a release from GitHub (2026-11-15). The only network code in the project, in the CLI; the phone stays offline, and a download goes through the signed, delayed update path. It trusts nothing it fetches: SHA256SUMS only catches a damaged download; the signer checks, the owner’s signature and the delay protect the phone.
  • People and approvals (2026-11-15, milestone 9): phone secrets for both people, waiting changes, three ways for a partner to join and to approve, recovery phrases. Before, approval meant a signature only.
  • config bundles may name the config they replace (2026-11-15, milestone 8), so a partner is shown exactly what changes, and an approval cannot be reused once the config has moved on.
  • Sessions over the USB accessory (2026-11-17, milestone 12), with adb kept as the fallback. Since 2026-12-01 adb comes first when the phone has it on, and there are no sessions. Windows keeps adb: its MTP driver blocks the switch, and the alternative (libusb with the UsbDk driver) would need every user to install a driver. Both transports are offered in every session. The accessory stays open between sessions, because a closed accessory cannot be reopened while a read on it is blocked; while plugged in, the phone stays in accessory mode and file transfer is off.

Protocol and keys

  • Canonical JSON payloads (milestone 0): one encoding per value, anything else rejected. Two parsers that disagree (duplicate keys, say) would let a bundle show one thing and do another. Signatures are still verified over the received bytes.
  • A binary envelope (QLB1) rather than a text format.
  • Every signature must be valid and from a known key; one good and one bad is rejected.
  • sequence_in_future: more than 24 hours ahead of the phone’s clock is rejected, since one far-future bundle would otherwise block all later ones.
  • Enrolment is self-signed by an owner key it lists.
  • Bundles last 24 hours; those that need a partner, and drafts, 7 days.
  • Small-order keys are not rejected (milestone 2); unreduced S is. The two libraries do not promise the same behaviour on small-order points, and such a key can only be enrolled by the person it would fool.
  • Key files: Argon2id at 64 MiB, 3 iterations, 1 lane; names of 1 to 32 characters from a-z 0-9 _ -; kept in QUITLOCK_KEY_DIR, --key-dir, ~/.config/quitlock/keys or %APPDATA%\quitlock\keys.
  • Phone secrets: PIN 6 to 32 digits, password 8 to 128 printable ASCII characters; key files on the computer need 8 digits or 10 characters, since a copied file can be attacked offline without the phone’s lockout. Argon2id 64 MiB and 3 iterations, stored with each secret so they can change.
  • Invite files are plain, unsigned JSON. They only say which phone to make a key_add for; the phone checks the reply, and fingerprints are compared by voice.
  • partner join makes a key called partner unless --key names one.
  • A partner-mode change is both sent and written to a file, so a partner far away can approve it with no other step from the owner. partner sign replaces the file in place, atomically, unless --out is given.
  • The phone’s status lists public keys, which are not secret; the CLI needs the partner’s to remove it.

The phone

  • No UI library: the screens are plain platform views, so the app depends on nothing but :core and Bouncy Castle. Smaller, easier to reproduce and audit.
  • Permissions added, each for one call: REQUEST_DELETE_PACKAGES (the uninstall prompt), RECEIVE_BOOT_COMPLETED (countdowns after reboot), QUERY_ALL_PACKAGES (seeing new installs on API 30 and later), FOREGROUND_SERVICE and FOREGROUND_SERVICE_SPECIAL_USE (keeping the process alive while it serves a computer or USB debugging is allowed; the closer types need network permissions), REQUEST_IGNORE_BATTERY_OPTIMIZATIONS (asking out of Doze). No notification permission: on Android 13 and later the notification may not show, and the service keeps the process alive regardless.
  • The typed confirmation is ARM, in capitals; the field asks for them.
  • Cancel asks for confirmation: one extra tap, no key, no delay.
  • A tightening change is accepted while something is pending; only a second loosening action is refused.
  • A delayed action that cannot be fully enforced when it completes is applied in the fail-closed way, and the self-check reports what is wrong.
  • The wall-clock credit across a reboot counts from the last checkpoint, saved whenever the countdown is looked at.
  • Teardown leaves automatic time and adb as they are and lifts only the locks on them.
  • A dev build arms without Chrome and without enrolment, since the test images have neither. It still stores Chrome’s configuration.
  • ForceYouTubeRestrict is not set; there is no config field for it.
  • A failed update install drops the update, because a successful one restarts the app and must not repeat. The owner sends it again.

App rules

  • allowlist does not exempt a browser; only browser_allowlist does.
  • Browsers installed before arming are left alone; the guide says to uninstall or blocklist them first.
  • Apps disabled at arm are dormant: enabling one later counts as a new install.
  • Facts are kept, the verdict recomputed: taking a browser off browser_allowlist later suspends it again.
  • The adb window (an app first installed while USB debugging was allowed is untrusted) applies on API 29 only. On API 30 and later the system records the shell as the installer whatever adb claims. On API 29 any install during the window also closes it.
  • An app installed while QuitLock’s process is dead may run for up to about 15 minutes, the shortest period of a periodic job.
  • Package names are logged when QuitLock suspends or releases an app: QuitLock’s own action, not monitoring of use.

Connecting

  • The hello reports not_owner, so the CLI can talk to an app that is not yet device owner.
  • A dev build accepts a root peer, for emulator images whose adbd runs as root.
  • A tamper closes the debugging window; it does not lock the button out. Every tamper is in the log for a partner to see.
  • A background restriction already in place when the window opens does not close it, since only an adb shell can lift it. The self-check reports it, with the command, until it is lifted.
  • The window runs the self-check as it opens, which can take a few seconds if DNS has to be set again.
  • Status reports the last self-check, not a new one, since a new one repairs and can take longer than the CLI waits.

Setup and releases

  • provision removes users itself, after a yes for each; accounts are left for the user to remove on the phone. User names are shown so the user knows what they agree to delete; account names never are.
  • One automatic retry of dpm set-device-owner after Not active admin.
  • A dump that cannot be parsed does not block provisioning; Android checks again when the owner is set.
  • Releases are drafts until a maintainer publishes them after checking the files.
  • versionCode from the tag: MAJOR×1,000,000 + MINOR×1,000 + PATCH, each at most 999.
  • The signing key is made on a live system, backed up offline on two encrypted drives; the secrets live in a release environment only v* tags may use.
  • APK signature schemes v2 and v3 only, so the files inside a signed APK equal those of the unsigned build, which keeps verify-release.sh simple.
  • The Linux CLI is static (musl); Windows uses MSVC; there is no macOS build.
  • Provenance attestations are skipped while the repository is private.
  • The default repository for --github is compiled in, overridable with QUITLOCK_GITHUB_REPO at build time or --repo.

Settled defaults

QuestionAnswer
Length of the short tier3 hours
USB debugging window on an armed phone5 minutes
A limit on how often it can be openedNone; each one is logged
Whether partner approval shortens or skips the delayNo
Whether arming needs a signatureNo: a button on the phone with a typed confirmation, or the owner phone secret