Platform facts
QuitLock relies on these facts about Android and Chrome. Each was checked against current documentation, and where possible on an emulator, before the code relied on it. This page records the result for each: what was checked, where, when, and what was found.
Each item is checked in the milestone that first depends on it. Details for checked items are under Findings.
| # | Assumption | Needed by milestone | Status |
|---|---|---|---|
| 1 | clearDeviceOwnerApp still works for a non-test device owner | 1 | Confirmed on API 36 and API 29 emulators; see below |
| 2 | Chrome policy names, types and Android support | 4 | Confirmed from the Chromium source; behaviour in real Chrome not tested; see below |
| 3 | How to learn about new installs reliably | 6 | Runtime receiver plus periodic job, checked on API 36 and API 29 emulators; see below |
| 4 | Package visibility for listing apps and resolving browser intents | 6 | Needs QUERY_ALL_PACKAGES, even as device owner; checked on API 36; see below |
| 5 | Installer-source API per API level; Play and F-Droid package names; adb installs | 6 | Confirmed for adb installs on API 36 and API 29 emulators; Play and F-Droid names from documentation only; see below |
| 6 | Device owner can install an APK without a user prompt | 9 (done early) | Confirmed on API 36 and API 29 emulators, with release-variant builds; dev builds cannot update themselves; see below |
| 7 | DISALLOW_CONFIG_VPN stops installed VPN apps connecting | 4 | Documentation read; see below. Not yet tested |
| 8 | Automatic-time API at API 29 versus 30 and later | 4 | Confirmed from documentation and by test; see below |
| 9 | API level of the Private Space restriction | 4 | API 35; see below |
| 10 | Ed25519 verification library for Android API 29 and later | 2 | Chosen: Bouncy Castle; see below |
| 11 | Output formats of dumpsys account, pm list users, dumpsys device_policy | 7 | Captured on API 36 and API 29 emulators, with the dpm set-device-owner errors; accounts only without any; see below |
| 12 | Private DNS call with unaffiliated users or profiles; result codes | 1 | Works only with the INTERNET permission; see below |
| 13 | Device owner can toggle adb with no developer-options step | 3 | Confirmed on API 36 and API 29 emulators, and in a release build on API 36; see below |
| 14 | adb authorisation survives adb being switched off and on | 3 | Cannot be checked on an emulator; on the manual checklist |
| 15 | App-local socket reachable through adb forwarding; peer is checkable as shell | 3 | Confirmed on the API 36 emulator, partly on API 29; see below |
| 16 | What an adb shell can change against a device owner | 3, 10 | Examined on API 36 and API 29 emulators: four ways through, each now caught by the tamper watch or the self-check; see below |
| 17 | Where adb can push a file the system file picker can see | 3 | Confirmed on the API 36 emulator; see below |
| 18 | FLAG_SECURE keeps screenshots and recordings out | 9 | Confirmed for screencap and screenrecord on API 36 and API 29; an accessibility service’s screenshot not checked; see below |
| 19 | Views marked not important for accessibility are hidden from services | 9 | False; fixed with an accessibility delegate, tested on API 36 and API 29; see below |
| 20 | Confirm-credential screen usable by the device owner app | 9 | Confirmed on API 29 with a PIN; see below |
| 21 | Argon2id time on a low-end phone | 9 | Not checked: no such phone; see below |
| 22 | The USB accessory transport on real phones | 12 | Not checked on a phone: emulators have no accessory; both ends’ logic unit-tested; see below |
Findings
1. clearDeviceOwnerApp (checked 2026-11-14)
- Documentation (DevicePolicyManager reference): deprecated since API 26, described as “expected to be used for testing purposes only”. It is still present and no restriction to test-only apps is stated. The reference also says clearing policies afterwards is “a best-effort process and some other policies will still remain in place”, which is why teardown undoes every policy itself before calling it (invariant 11).
- Experiment: a debug-signed build without
android:testOnlywas made device owner on AOSP emulators andRemovalTestwas run. The call succeeded anddpm list-ownersreported no owners afterwards. - Not checked: real devices from any manufacturer. This goes on the manual checklist.
2. Chrome policies (checked 2026-11-14)
Source: the policy definitions in the Chromium repository (components/policy/resources/templates/policy_definitions/Miscellaneous/<name>.yaml, branch main).
| Policy | Type | Android support | Value used |
|---|---|---|---|
IncognitoModeAvailability | integer enum | from Chrome 30 | 1 (disabled) when disable_incognito is on, else 0. Value 2 (forced) is not supported on Android. |
ForceGoogleSafeSearch | boolean | from Chrome 41 | as force_safesearch |
DnsOverHttpsMode | string enum: off, automatic, secure | from Chrome 85 | always off |
URLBlocklist | list of strings | from Chrome 86 | chrome.url_blocklist |
URLAllowlist | list of strings | from Chrome 86 | chrome.url_allowlist |
ForceYouTubeRestrict | integer enum 0, 1, 2 | from Chrome 55 | not set; it is not among the Chrome settings and there is no config field for it |
The app passes these to setApplicationRestrictions for com.android.chrome as an int, a boolean, a string and two string arrays, which are among the value types that method documents. Checked by test: the stored restrictions read back with these keys and values (PolicyTest). Not checked: that Chrome obeys them. The AOSP emulator images have no Chrome; this is on the manual checklist. Setting restrictions for a package that is not installed works.
3. Learning about new installs (checked 2026-11-15)
- A manifest receiver does not get
PACKAGE_ADDED. On the API 29 emulator the system log shows “Background execution not allowed” for it, as expected since API 26 made it an implicit broadcast. A receiver registered at run time does get it, also withRECEIVER_NOT_EXPORTEDon API 33 and later (system broadcasts still arrive with that flag). - The app therefore uses three triggers: a runtime receiver for
PACKAGE_ADDEDandPACKAGE_CHANGED, registered whenever the app’s process starts; a periodicJobSchedulerjob every 15 minutes (the shortest period allowed), persisted across reboots; and the boot receiver. Each runs the self-check, which includes the app rules. The screen’s refresh runs it too. - Checked by test (
AppRulesTest.aNewInstallIsCaughtWhileTheAppRuns): an app installed with the process running is suspended within 15 seconds without anything else being called. Passes on both images. - So an app installed while the process is not running can run for up to about 15 minutes before the job catches it. Not measured: how late the job runs under Doze on a real phone; the system may defer it further while the phone is idle.
4. Package visibility (checked 2026-11-15)
- Being device owner gives no exemption from package visibility filtering (API 30 and later). Without a
<queries>entry,getPackageInfofor a test app threwNameNotFoundExceptionandgetInstalledPackagesleft it out, on the API 36 emulator, with the app as device owner. - The app now holds
QUERY_ALL_PACKAGES. It must see every installed app to judge it, and a<queries>element cannot name packages not known in advance. Play restricts this permission to listed uses; QuitLock is not published on Play (it is a device-owner app installed by the CLI), so this is accepted. API 29 has no visibility filtering and the permission does nothing there. - Browser detection asks the package manager for activities of that one package that handle
ACTION_VIEW+CATEGORY_BROWSABLEforhttp://andhttps://links to a host that cannot exist (quitlock-browser-check.invalid, RFC 2606). An app that opens links only for its own sites does not match.MATCH_ALLis needed; without it the system answers only with the default browser. Checked by test with a code-free test app that declares only that intent filter (android/testapps/browser), on both images. - Cannot be detected: an app that shows web pages without declaring that it opens links (a “browser” inside another app). That is outside what the rules can see; see Known limits.
5. Installer source (checked 2026-11-15)
| API level | Call used | adb install (pm install) | pm install -i com.android.vending |
|---|---|---|---|
| 30 and later | getInstallSourceInfo: initiatingPackageName, else installingPackageName | initiating com.android.shell (API 36) | initiating still com.android.shell; the installer name was not set (API 36, an image without Play) |
| 29 | getInstallerPackageName | not checked separately | installer recorded as com.android.vending: adb can claim any installer |
- The initiating package is recorded by the system and cannot be claimed by the installer, so on API 30 and later an adb install is always recognised. The app treats
com.android.shellas never trusted. - On API 29 the installer name can be faked from adb. Since adb is on only during a session, the app records when sessions are open and, on API 29, treats any app first installed during a session (with two seconds of slack either side) as coming through adb. Checked by test (
AppRulesTest.anInstallDuringASessionIsNeverTrusted, which installs with-i com.android.vendingduring a session) on both images. From API 30 the window is not applied (changed 2026-11-15 at the owner’s request): there the initiating package is recorded by the system and an adb install always showscom.android.shellwhatever-isays, as checked on API 36, so a real Play Store install that happens to finish during a session is judged normally. API 30 to 35 were not run; that they behave like 36 rests on the documentation ofInstallSourceInfo.getInitiatingPackageName(added in API 30). The decision itself is unit-tested (AppRulesTest.theSessionWindowCountsOnlyWhereTheInstallerCanBeFaked). - Package names of the default trusted installers:
com.android.vending(Play Store) andorg.fdroid.fdroid(F-Droid). From documentation only; the test images have neither. Not checked: what is recorded when F-Droid installs through its privileged extension (org.fdroid.fdroid.privileged), or by F-Droid forks and other stores. Those can be added totrusted_installers. On the manual checklist.
6. A device owner installing an APK without a prompt (checked 2026-11-15)
Pulled forward from milestone 9 at the project owner’s request.
- Silent self-update works on the API 36 and API 29 emulators: a
PackageInstallersession created and committed by the device owner app installs a newer version of the same app with no prompt. No extra permission was needed (noREQUEST_INSTALL_PACKAGES). The app stays device owner, its stored state survives, and the process restarts. Checked by hand with release-variant builds signed with a throwaway key, versions 1 to 2 (API 36) and 1 to 3 (API 29). - A dev build cannot update itself. It is marked
testOnly, and the installer then fails withINSTALL_FAILED_TEST_ONLY. Setting the hiddenINSTALL_ALLOW_TESTflag by reflection was allowed by the hidden-API check but had no effect (API 36): the platform evidently honours it only for installs from the shell. Dev builds are updated withadb install -t -r; the CLI warns. - Reading an archive’s signer: on API 29,
getPackageArchiveInfo(path, GET_SIGNING_CERTIFICATES)returnssigningInfo == null. AddingGET_SIGNATURESto the flags fills it. On API 36 thePackageInfoFlagsform works withGET_SIGNING_CERTIFICATESalone. The app passes both flags below API 33; API 30 to 32 were not tested.UpdateTestcovers this on both test images. - Refused, on both images, with
apk_rejectedbefore anything was consumed: an older version code, the same package signed by another key, and another package. A bundle whose APK was changed after signing was refused withapk_mismatch. - On API 36 the delayed path was run with a dev build: the APK was kept through the countdown, a cancel deleted it, and when the countdown was made to finish (by editing the dev build’s stored state) the install ran and its result (
INSTALL_FAILED_TEST_ONLY, as expected for a dev build) was shown on the status screen. - A side note from testing:
adb uninstallof a device owner app on API 29 left the device-owner record in place with no active admin, and installs then needed user confirmation (STATUS_PENDING_USER_ACTION). That emulator had to be wiped. Normal use never uninstalls a device owner app this way.
Not checked: a real phone; a delayed update reaching a real install (needs a release build armed; on the emulator a stub app named com.android.chrome makes that possible, see item 13, but the update itself was not run); updates across an Android version upgrade.
7. DISALLOW_CONFIG_VPN (documentation read 2026-11-14)
The UserManager reference says the restriction “also prevents VPNs from starting”, and that from Android 12 (API 31) enforcing it “clears currently active VPN if it was configured by the user”. So on API 29 and 30 a VPN that is already connected when QuitLock arms may stay up until it next restarts. To be tested with a real VPN app in milestone 4.
8. Automatic time (checked 2026-11-14)
setAutoTimeEnabled was added in API 30; setAutoTimeRequired is deprecated from API 30 in its favour. The app calls setAutoTimeEnabled(true) on API 30 and later and setAutoTimeRequired(true) on API 29, with DISALLOW_CONFIG_DATE_TIME on both. PolicyTest confirms the auto_time setting is 1 after arming on the API 36 and API 29 emulators.
9. Private Space restriction (documentation read 2026-11-14)
UserManager.DISALLOW_ADD_PRIVATE_PROFILE was added in API 35. The reference says that on a device with a device owner the default is already true “and the device owner currently cannot change it to false”. So Private Space is blocked on any QuitLock phone from provisioning on, not only once armed, and teardown has nothing to undo for it beyond clearing device owner.
10. Ed25519 verification on Android (checked 2026-11-14)
- The platform’s own Ed25519 support is not available across the supported range: it arrived in the Android 13 (API 33) crypto provider, and the minimum here is API 29. This is from memory of the platform release notes and was not re-read; it does not matter for the choice below, which avoids the platform provider entirely.
- Chosen: Bouncy Castle
bcprov-jdk18on1.87, using the low-levelorg.bouncycastle.math.ec.rfc8032.Ed25519.verify. It is pure Java with no dependence on the Android version or on any security provider being registered, so the same code runs in JVM unit tests and on the phone. - Checked by test: all shared vectors pass in
android/coreon the JVM, including a signature with the group order added to S, which it rejects, as does the Rust side (verify_strict). - Not checked: the verifier running on a device. Nothing on the phone calls it until milestone 3. The dependency makes the unshrunk release APK about 8 MB; code shrinking for the release build is a milestone 10 matter.
11. Preflight command output (checked 2026-11-15)
Captured on the API 36 and API 29 emulators into cli/tests/fixtures/preflight/api36 and api29; the parsers in cli/src/preflight.rs are tested against them.
pm list users: the same on both,Users:then oneUserInfo{id:name:flags}line per user,runningafter it when running. A name given topm create-userthroughadb shellis cut at the first space by the phone’s shell (it is not quoted), so the test user is just “Preflight”.dumpsys account: a block per user (User UserInfo{0:Owner:...}:) withAccounts: N. No account could be added on these images (no Google services), so the line for an account,Account {name=..., type=...}, comes from the AOSP source (AccountManagerService) and the test using it is synthesised, not captured. The parser keeps the type and drops the name at once. Check against a real phone with accounts.dumpsys device_policy: with a device owner, both show aDevice Owner:heading withadmin=ComponentInfo{package/class}under it; API 29 also haspackage=. Without one, API 36 still printsDevice Owner Type: -1, so the parser matches the heading exactly. A profile owner’s heading (Profile Owner (User N):) is from the AOSP source; not captured, since a work profile could not be made on these images.dpm set-device-ownererrors. API 36 printsException occurred while executing 'set-device-owner':and the exception with its stack; API 29 prints only the exception for some errors, and for an unknown component the wholedpmusage text, thenError: Unknown admin: ...(API 36 saysInvalid component ... for device owner). The usage text mentions device and profile owners, so errors are matched on theError:and...Exception:lines only. Captured: several users, already set, unknown admin.- On API 36, the attempt after a refused one failed with
Not active admin, and the one after that worked. The refused attempt seems to leave an admin half set up.quitlock provisiontries once more after two seconds when it sees that. On API 29 the next attempt simply worked. dpm list-ownersdoes not exist on API 29, so the CLI readsdumpsys device_policyfor owners on every version.- The emulators report
ro.product.manufacturerasunknown; the manufacturer notes were not seen on a real phone. - A real phone (2026-12-01): a Samsung Galaxy S20 FE on Android 13 was set up end to end by
quitlock setup(the owner’s test, dev build): preflight, device owner, enrolment, arming. Its output was not captured as fixtures.
12. Setting Private DNS (checked 2026-11-14)
Enforcement calls setGlobalPrivateDnsModeSpecifiedHost and check its result code.
What the reference documents: the result codes PRIVATE_DNS_SET_NO_ERROR (0), PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING (1), PRIVATE_DNS_SET_ERROR_FAILURE_SETTING (2); that the call blocks on “a connectivity check to the resolver”; and that it fails when unaffiliated secondary users or profiles exist.
What it does not say, found by experiment on the API 36 emulator:
- The connectivity check runs inside the calling app’s own process (
android.net.PrivateDnsConnectivityChecker, called fromDevicePolicyManager, seen in a stack trace). Without the INTERNET permission the app cannot open a socket, the check fails withEPERM, and the call returnsHOST_NOT_SERVINGevery time without reaching the system service. - This contradicted invariant 4 as first written (no INTERNET). Decision by the project owner, 2026-11-14: the app holds INTERNET for this one call, and invariant 4 was amended.
scripts/check-invariants.shnow enforces an exact list of permissions and the absence of networking code instead. - With an unaffiliated secondary user present,
setGlobalPrivateDnsModeOpportunisticthrowsSecurityException(“operation not allowed when device has unaffiliated users”) rather than returning code 2. The code treats an exception from either call as a failure.
How the code uses it:
- Arming uses the documented call only. No network, or a host that does not serve DNS over TLS, means arming is refused and nothing is left applied (
ArmTest.armIsRefusedWhenTheResolverCannotBeReached). - Self-check repair tries the documented call, and if that fails writes the settings
private_dns_specifierandprivate_dns_modedirectly withDevicePolicyManager.setGlobalSetting, which makes no connectivity check. So a drifted setting is restored even offline (ArmTest.selfCheckRestoresDnsEvenWhenOffline). - Teardown uses
setGlobalPrivateDnsModeOpportunistic, with the same direct write as fallback so that extra users cannot block removal.
About the fallback: the setGlobalSetting reference lists the settings it supports and these two are not among them. The system accepted them on the API 29 and API 36 emulators, including with an unaffiliated user present, but this is undocumented and a future Android version or a manufacturer build could refuse it. If it is refused, the self-check reports that it could not re-apply the setting.
Also observed with the filter in place (API 36 emulator): a domain in the blocked category stopped resolving and an ordinary domain still resolved.
Not checked: real devices; teardown with an unaffiliated user present was tested with the earlier settings-only code, not re-run since the documented call was put first.
13. Device owner switching adb on and off (checked 2026-11-14)
- Documentation: the
setGlobalSettingreference listsSettings.Global.ADB_ENABLEDas supported and says to use it “to turn adb on”, withUserManager.DISALLOW_DEBUGGING_FEATURESto stop the user enabling it. The restriction’s own entry says that set by a device owner “it disables debugging features altogether, including USB debugging”. - Experiment (
AdbLockTest): arming setadb_enabledto 0 with the restriction on, and the host lost its adb connection. Opening a session cleared the restriction and setadb_enabledto 1; closing it, and the time limit, reversed that. No developer-options step was involved. Setting adb on by hand while no session was open was caught and reversed by the self-check. - Release build (2026-11-16, API 36 emulator): a release APK signed with a throwaway key, made device owner, enrolled with a CLI carrying that key’s certificate hash, and armed (with a stub app installed as
com.android.chrome, since arming needs Chrome). On arming,adb devicesshowed the emulatoroffline. A tap on Connect to PC, sent through the emulator console, brought adb back;quitlock statusreported “0.1.0 (release build)”, all policies in place; adb wasofflineagain as soon as the CLI finished. - Not checked: a real phone, where developer options may additionally have to be enabled once for adb to start. On the manual checklist (Manual checks).
14. adb authorisation surviving an off/on cycle
The AOSP emulator images have ro.adb.secure=0, so there is no authorisation to lose. This can only be checked on a real phone.
15. Session socket through adb (checked 2026-11-14)
- An abstract-namespace
LocalServerSocketin the app is reachable withadb forward tcp:0 localabstract:<name>;tcp:0makes adb pick a free port and print it. LocalSocket.getPeerCredentials()reports UID 2000 (shell) for a connection that arrives through adb: the CLI completed sessions against the API 36 emulator with the check in force. A connection from the app’s own UID is refused (thenSessionTest, nowLinksTest; API 36 and API 29).- On API 29 the full path through adb was not exercised with the CLI; only the listening socket, the refusal of a non-shell peer, and that
adb shellruns as UID 2000 there. - Closing a
LocalServerSocketdoes not wake a thread blocked inaccept(); the app wakes it with a throwaway connection.
16. What an adb shell can change (checked 2026-11-16)
Checked on the API 36 and API 29 AOSP emulators, with the dev build armed as device owner, by running each command from adb shell (UID 2000, the same as a session gives).
Refused, on both API levels:
| Command | Result |
|---|---|
settings put global private_dns_mode off, ... private_dns_specifier <host> | Silently ignored: the value stays (the DISALLOW_CONFIG_PRIVATE_DNS restriction covers shell writes) |
settings put global auto_time 0 | Silently ignored |
am force-stop, am stop-app (API 36) | Ignored: logcat says “Ignoring request to force stop protected package” |
pm clear | Refused (API 36: no CLEAR_APP_USER_DATA; API 29: “protected package”) |
pm disable-user | Refused: “Cannot disable a protected package” |
pm suspend of QuitLock; pm unsuspend of an app QuitLock suspended | API 36: no change; API 29: “Cannot suspend/unsuspend packages. User 0 has an active DO or PO” |
pm hide | Needs MANAGE_USERS |
pm uninstall [-k] --user 0 | DELETE_FAILED_DEVICE_POLICY_MANAGER (36), DELETE_FAILED_OWNER_BLOCKED (29) |
pm create-user | Refused: no_add_user |
setprop persist.sys.safemode 1 | Refused |
pm revoke of QUERY_ALL_PACKAGES | Not a changeable permission |
am set-standby-bucket | Ignored: a device owner stays EXEMPTED (36) or ACTIVE (29) |
am crash (API 36) | No effect |
Allowed:
-
A global proxy (
settings put global http_proxy host:port). The system copies it intoglobal_http_proxy_host, and the shell can also write that directly. The self-check clears it withsetRecommendedGlobalProxy(null), but thehttp_proxystring stays, a device owner cannot clear it, and at the next boot Android turns it back into a global proxy (seen on API 36 after a cold start). The boot receiver’s self-check clears that each time. The self-check now also reports the stored string, with the command that removes it (adb shell settings delete global http_proxy, while USB debugging is allowed). -
Cancelling QuitLock’s jobs (
cmd jobscheduler cancel <package>). Without the periodic job nothing checks while the app is closed. The self-check now schedules it again. -
Restricting QuitLock in the background (
cmd appops set <package> RUN_ANY_IN_BACKGROUND ignore). Settings cannot do this for a device owner: on both API levels its battery page shows the control greyed out (“Background usage can’t be restricted” on 29, “This app requires unrestricted battery usage” on 36), and its battery optimization list says “Battery optimization not available” for QuitLock. Only a shell can set it, and a device owner cannot lift it. What it does differs:- API 29: the periodic job never runs (
dumpsys jobschedulershowsreadyNotRestrictedInBg: false). - API 36: no effect on the job (
readyNotRestrictedInBg: true, job marked “User BG restricted”), since a device owner sits in theEXEMPTEDstandby bucket. - On Android’s power allowlist (
cmd deviceidle whitelist +<package>), the job is ready again on API 29 with the restriction in place.
A device owner cannot add itself to that allowlist:
DevicePolicyManager.setApplicationExemptionsneedsMANAGE_DEVICE_POLICY_APP_EXEMPTIONS, which isinternal|role(API 36 emulator). Settings showing QuitLock as not optimized does not put it on the list either (dumpsys deviceidle whitelistdoes not name it). So QuitLock asks once before arming, through the system dialog (ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, permissionREQUEST_IGNORE_BATTERY_OPTIMIZATIONS). A shell can take it back (cmd deviceidle whitelist -<package>), which the tamper watch counts (battery_optimized). The self-check reports a restriction with the adb command that lifts it, and a missing exemption with a tap that asks again. - API 29: the periodic job never runs (
-
Killing QuitLock’s process with
am killonce the app is not on screen. Combined with 3 (on API 29, without the battery exemption), during a session this would leave adb on until the next boot or until the app is opened. Now, a foreground service runs for the length of each session, andam killleft the process alone with it running (both API levels). A process that dies anyway is followed by a one-off job just after the session’s time limit, and its session is logged as closed (app_stopped) when the app starts again.
The tamper watch (TamperWatch) checks, every second and at once on any global setting change, install, unsuspension or restriction change, for: a proxy, Private DNS mode or lock, the restrictions, automatic time, the uninstall block, wireless debugging, a background restriction, the periodic job, released apps, and an install that came through adb. The first finding ends the session, is logged and is repaired by the closing self-check. A background restriction or missing battery exemption that was already there when the session opened does not end it: QuitLock cannot undo either, and the restriction can only be lifted from a session. TamperTest covers the proxy, the job, the background restriction and the battery exemption (each new and existing), an install over adb, drift from before the session and QuitLock’s own changes, on both API levels.
Checked by hand only: that am kill leaves the process alone during a session (the instrumented test runs in the app’s own process); that a session whose process was killed (as root, standing in for a crash or a low-memory kill) is logged as app_stopped when the app next starts. On API 29, with the process killed and the app left alone, the one-off job started it again 6 minutes after the session opened (the limit is 5 minutes; the job may run from 30 to 60 seconds after it), which logged the session as closed; the self-check that turns adb off in that case is covered by AdbLockTest.
Not checked:
- Wireless debugging.
settings put global adb_wifi_enabled 1stayed 0 on the API 36 emulator, which has no real Wi-Fi to debug over. Whether a device owner may write it withsetGlobalSettingis not known; the code tries and relies onDISALLOW_DEBUGGING_FEATURESotherwise. - Commands not tried:
device_config,cmd overlay,cmd role,cmd netpolicy, and settings in the secure and system tables beyond those above. The watch looks only at global settings. None of those found so far affects DNS, restrictions or app suspension, but the list of shell commands is long and changes with each Android version. - Real phones. Manufacturer builds add their own shell commands and may treat a device owner differently.
In a release build (2026-11-16, API 36 emulator, the build described under item 13): dpm remove-active-admin was refused (“Attempt to remove non-test admin”), and adb uninstall and pm uninstall --user 0 gave DELETE_FAILED_DEVICE_POLICY_MANAGER, all before arming. Armed, in a session opened on the phone, settings put global http_proxy ended the session: adb was offline 222 ms later. The next session’s quitlock log pull showed the tamper entry, the closing self-check clearing the proxy, and an intact chain.
Known and not closed here: adb reboot recovery reaches recovery mode, where a factory reset removes QuitLock (a known limit); a phone can also be put into recovery with its buttons.
17. Getting a bundle file to the file picker (checked 2026-11-14)
A file pushed with adb push <file> /sdcard/Download/ appears under Downloads in the system file picker opened by ACTION_OPEN_DOCUMENT, and importing it worked. It did not appear under Recent. Checked on API 36 only.
18. FLAG_SECURE against screenshots and recordings (checked 2026-11-15)
- API 36 emulator:
adb exec-out screencapwhile the PIN dialog was open gave the rest of the screen with the dialog’s area solid black. - API 29 emulator:
screencaprefused to capture at all while the dialog was open (no output, exit status 1), as it did for Android’s own confirm-credential screen. A 3-secondscreenrecordshowed the dialog’s area black. - Not checked: a screenshot taken by an accessibility service (
AccessibilityService.takeScreenshot, API 30 and later).
19. Hiding views from accessibility services (checked 2026-11-15)
IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTSis not enough. A service that setsFLAG_INCLUDE_NOT_IMPORTANT_VIEWSsees such views anyway, and any service may set it.uiautomator dump, which does so by default, listed every key label of the password keyboard on API 29; a test listening that way receivedTYPE_VIEW_CLICKEDwith the text7, then3, as the keys were pressed: the PIN, digit by digit.- What works: an
AccessibilityDelegateon the keys and the typed-text display that gives their node no text, content description or hint, and sends no events, and on the dialog’s root one whoseonRequestSendAccessibilityEventreturns false, so nothing from inside reaches a service. From Android 14 the root is also markedACCESSIBILITY_DATA_SENSITIVE_YES, which keeps it from every service that is not an accessibility tool. SecretPadTest(instrumented) checks it: listening as a service that includes not-important views, it sees the dialog’s title but no key label, nothing typed and no click. It fails on the earlier code and passes on the new, on API 29 and (from 2026-11-16) API 36.- A service can still see that the dialog has unlabelled clickable boxes, and their positions. Without events it cannot tell which were pressed.
20. Confirming the phone’s screen lock (checked 2026-11-15)
API 29 emulator, with a PIN set by locksettings set-pin: once the phone had a screen lock, “This phone’s screen lock” was offered for the owner. KeyguardManager.createConfirmDeviceCredentialIntent opened Android’s ConfirmLockPassword from the device owner app. A wrong PIN kept that screen up; the right one returned RESULT_OK and the draft waiting for the owner was approved. Back returned without RESULT_OK and the change kept waiting. Not checked on API 36, or with a pattern or biometrics.
A side effect seen on the way: after a restart with a screen lock set, the app’s activity “does not exist” until the user unlocks, because the app is not direct-boot aware. Enforcement does not depend on the activity.
21. Argon2id time on a low-end phone
Not checked: there is no low-end phone here. On the emulators (x86_64, desktop CPU) setting and checking a phone secret at 64 MiB and 3 iterations took well under the 4 seconds the scripted steps waited. The parameters are stored with each secret, so they can be lowered for new secrets if a real phone is too slow.
22. The USB accessory transport
Not checked on a phone: emulators have no USB accessory, and no phone was attached. What was checked:
- Both ends’ logic, in unit tests.
AccessoryLinkTest(Kotlin,android/core) drives the phone’s link over in-memory pipes: stale bytes and an old sync before a session listens are discarded; the sync is answered before the hello; a session served over adb gets no answer; a closed session’s channel can neither read nor write into the next one; whole-packet writes are split; the cable going ends the link.aoa.rs(Rust) tests the CLI’s search for the answer at every split point, past stale bytes, an older answer and a near miss. - No other device is touched. On the development PC (a Keychron keyboard, a Razer mouse, an Elgato Stream Deck and an ASUS AURA LED controller, whose interface is vendor-specific
ff/ff/ff), no device matched the filter, so none was opened or sent a request. - Builds: the CLI type-checks and passes clippy for Linux (glibc and musl) and Windows; nusb is a Linux-only dependency, so the Windows build does not change.
What rests on documentation and kernel source, to be checked on phones (Manual checks):
- AOA requests 51 to 53 work in MTP, PTP and charging-only modes; the phone re-enumerates as
18d1:2d00(or2d01with adb). - Closing an accessory file descriptor does not wake a blocked read, and opening it again fails until that read returns (
f_accessory’s exclusive open). This is why the link stays open between sessions. - A read shorter than a packet loses data, and a zero-length read reaches Java as the end of the stream. This is why the app reads 16384 bytes at a time and neither side sends a zero-length packet.
- Turning adb on while in accessory mode re-enumerates USB; the app reopens the accessory after a second.
- The “Always” choice in Android’s attach dialog grants the accessory permission for later sessions.
Other findings
DISALLOW_ADD_MANAGED_PROFILEis always in force on a device with a device owner, armed or not, and clearing it as device owner has no effect (API 36 and API 29 emulators). The app still applies it at arm, which is harmless, and it goes away when device owner is cleared.ACTION_DELETEfor the app’s own package needsREQUEST_DELETE_PACKAGES. Without it the system uninstaller refuses silently. The app declares it; the user still confirms in the system prompt.- The API 37.0 AOSP emulator image (revision 6) does not boot:
system_servercrashes in a loop inAdvancedProtectionService. Device tests run on API 36 and API 29 instead.