Enforcement
What an armed phone enforces, and how. Android 10 (API 29) is the minimum; the app targets the current SDK.
DNS
- Private DNS is set with
DevicePolicyManager.setGlobalPrivateDnsModeSpecifiedHost, off the main thread, with its result code checked, and locked withDISALLOW_CONFIG_PRIVATE_DNS. - The default host is
family-filter-dns.cleanbrowsing.org(adult content blocked, SafeSearch enforced). The host is a config field; changing it is a loosening change, whichever way it goes. - The call tests the resolver before accepting the host, so arming needs the phone online and refuses a host that does not serve DNS over TLS.
- When the self-check has to restore a DNS setting that drifted and that test fails (no network, DNS over TLS blocked), it writes the Private DNS settings directly instead, without the test: the filter must come back even offline.
- It fails closed. On a network that blocks DNS over TLS the phone has no name resolution. There is no fallback to unfiltered DNS.
Restrictions applied at arm
| Restriction | Purpose |
|---|---|
DISALLOW_CONFIG_PRIVATE_DNS | Lock DNS |
DISALLOW_CONFIG_VPN | Stop a VPN bypass |
DISALLOW_DEBUGGING_FEATURES | Keep adb off outside a debugging window (Connecting) |
DISALLOW_SAFE_BOOT | Stop a safe-mode bypass |
DISALLOW_FACTORY_RESET | Close the Settings reset path |
DISALLOW_NETWORK_RESET | Stop a network settings reset |
DISALLOW_ADD_USER | Stop a clean secondary user |
DISALLOW_ADD_MANAGED_PROFILE | Stop a work profile |
DISALLOW_CONFIG_DATE_TIME | Protect the countdown clock |
Also: QuitLock blocks its own uninstall, and automatic time is forced on. Private Space (DISALLOW_ADD_PRIVATE_PROFILE, API 35 and later) needs nothing from QuitLock: Android already enforces it on any phone with a device owner, and a device owner cannot change it.
Two restrictions are deliberately not set: DISALLOW_INSTALL_UNKNOWN_SOURCES (it would block F-Droid; app rules replace it) and DISALLOW_USB_FILE_TRANSFER (the file fallback needs it).
Chrome
Chrome is the one managed browser. A release build refuses to arm without it. Its managed configuration (setApplicationRestrictions) sets:
- incognito disabled
- SafeSearch forced
- Chrome’s own DNS over HTTPS off, so it uses the system’s DNS
- the URL blocklist and allowlist from the config
Domain lists apply inside Chrome only, and an allowlist entry cannot unblock a domain the DNS provider blocks.
App rules
Checked on every package install (while QuitLock’s process runs), at boot and on a periodic job (at most every 15 minutes).
| Config field | Effect |
|---|---|
install_policy = "open" | No install-source check |
install_policy = "trusted_installers" (default) | Apps from other sources are suspended until allowed |
install_policy = "approval_required" | Every new app is suspended until allowed |
trusted_installers | Default: the Play Store and F-Droid |
blocklist | Always suspended |
allowlist | Allowed apps |
browser_allowlist | Browsers exempt from automatic suspension |
-
Browsers: any newly installed app that can open
httporhttpslinks as a browser is suspended unless it is Chrome or onbrowser_allowlist, whatever the install policy. -
Apps installed through adb (possible only while USB debugging is allowed) count as coming from an untrusted source.
-
Apps already installed when the phone is armed are left alone, browsers included, unless they are on the blocklist.
-
Suspension uses
setPackagesSuspended. Some system packages cannot be suspended; failures are logged and shown in the status. -
What the phone needs is never suspended, whatever the config, so the phone can always be unlocked and QuitLock reached (
AppRules.kept):- core system apps: Settings, the system UI, the phone, telecom and emergency apps, the permission controller and the package installer, matched only against system apps, since another phone’s system app name can be taken by a sideloaded one;
- a keyboard, home screen, dialer or SMS app that is a system app or was installed before arming;
- if every app in one of those roles would be suspended, the one in use, whatever it is.
An app installed after arming gets no protection from filling a role while another remains, so a new browser cannot escape the browser rule by also being a keyboard. The self-check names every app kept this way.
-
Updates to an app already allowed are not checked again.
-
To allow a suspended app: tap Allow next to it on the phone and approve the change, or add it to
allowlist(a browser tobrowser_allowlist) andquitlock config push. Either way it is a loosening change.
Self-check
Runs at boot, when the app opens, on the periodic job and at the end of every debugging window. It checks every policy above, re-applies any that drifted, clears a global HTTP proxy, and, when armed with no debugging window open, makes sure adb is off and the debugging restriction applied (this covers the app being killed with a window open). Problems are shown on the status screen and written to the event log.
Teardown
In order: unsuspend everything QuitLock suspended, clear Chrome’s managed configuration, return Private DNS to automatic, clear every user restriction, lift the uninstall block, then clear device owner. Only then does the app offer to uninstall itself. Teardown is safe to re-run if it was interrupted.
Nothing may hold a removal up for good (invariant 2):
- Every step is tried, whatever happened to the ones before it.
- A removal is marked as started before anything is undone, and upkeep (boot, the periodic job, opening the app) finishes one left half-done.
- Device owner is given up only once every step that only the device owner can undo has taken. Otherwise something could be left that nobody can remove.
- Private DNS is the exception: once its lock is cleared the user can change it in Settings, so failing to set it back to automatic does not stop the removal; the screen and the log name the host it was left at.