MAOS — Implementation & Build Guide
This is the implementation and build documentation for MAOS. For a user-facing overview and install instructions, see README.md.
A GrapheneOS-derived Android OS that ships the Modern Apps ecosystem (com.vayunmathur.*) in place of the stock GrapheneOS/AOSP userspace apps.
This repository is the overlay — the single repo you maintain. It is added to a GrapheneOS source tree at vendor/modern-apps/ via a repo local manifest. There are no long-lived AOSP forks: additions, removals, and config are all expressed as overlays. (Full design rationale lives in GRAPHENEOS_FORK_PLAN.md in the Modern-Apps repo.)
Apps swapped
| Modern App | Package | Replaces |
|---|---|---|
| Web | com.vayunmathur.web | Vanadium (browser only; WebView kept) |
| Camera | com.vayunmathur.camera | GrapheneOS Camera |
com.vayunmathur.pdf | PdfViewer | |
| Contacts | com.vayunmathur.contacts | AOSP Contacts |
| Calculator | com.vayunmathur.calculator | AOSP Calculator |
| Clock | com.vayunmathur.clock | AOSP DeskClock |
| Files | com.vayunmathur.files | DocumentsUI (Files also takes over the SAF role — see below) |
| Photos | com.vayunmathur.photos | AOSP Gallery |
| App Store | com.vayunmathur.appstore | GrapheneOS Apps |
| Keyboard | com.vayunmathur.keyboard | AOSP LatinIME (Direct Boot-aware for lock-screen input) |
| Speech | com.vayunmathur.speech | GrapheneOS SpeechServices (default STT + TTS) |
| Calendar | com.vayunmathur.calendar | AOSP Calendar (uses system CalendarProvider) |
| Music | com.vayunmathur.music | AOSP Music (incl. popup single-file player) |
| Communicate | com.vayunmathur.communicate | AOSP Dialer and Messaging (default dialer + SMS app) |
| Euicc | com.vayunmathur.euicc | Google's eSIM LPA EuiccGoogle (system LPA; Pixel EuiccSupportPixel backend kept — see below) |
| Backup | com.vayunmathur.backup | Seedvault (com.stevesoltys.seedvault) and the GrapheneOS contacts backup transport (app.grapheneos.backup.contacts) — system app-data backup transport; see below |
| Emergency | com.vayunmathur.emergency | AOSP EmergencyInfo (medical info + contacts + SOS countdown; wireless alerts stay stock CellBroadcast) |
| Parental Controls | com.vayunmathur.parentalcontrols | n/a (new; AOSP has no supervision app) — system supervision app: bedtime + app limits via the SYSTEMSUPERVISION role (pinned by `configsystemSupervision`) |
| Screen Time | com.vayunmathur.screentime | n/a (new; AOSP has no wellbeing app) — self-managed screen time: dashboard, timers, focus, wind-down via the SYSTEMWELLBEING role (pinned by `configsystemWellbeing`) |
| Auto | com.vayunmathur.auto | n/a (new) — SYSTEMAUTOMOTIVEPROJECTION role holder (Android Auto projection) |
| Network Location | com.vayunmathur.networklocation | GrapheneOS NetworkLocation — network location provider + offline geocoder |
| Find Family | com.vayunmathur.findfamily | n/a (new) — family location sharing (ordinary user app, preinstalled) |
| Share | com.vayunmathur.share | n/a (new) — AirDrop-compatible sharing (privileged for the Mosey/AWDL HAL) |
| Cast | com.vayunmathur.cast | n/a (new) — Cast / remote-display provider |
| Setup Wizard | com.vayunmathur.setupwizard | GrapheneOS SetupWizard2 (first-run setup; see Android.bp warning) |
| Log Viewer | com.vayunmathur.logviewer | GrapheneOS LogViewer (error-report viewer, no launcher entry) |
| Updater | com.vayunmathur.updater | GrapheneOS Updater (overrides) — polls ro.maos.ota.server; see updater/ |
| Health | com.vayunmathur.health | n/a (new) — health metrics/medications (ordinary user app, preinstalled) |
Layout
Android.bp # android_app_import per app (Files: privileged)
modern_apps.mk # product config: app membership notes, RRO, privapp; branding
maos_branding.mk # PRODUCT_* + ro.maos.* identity (inherited by modern_apps.mk)
privapp-permissions-modern-apps.xml # signature|privileged allowlists for the 12 priv-apps
rro/MaosFrameworkResRRO/ # static platform-signed framework-res RRO (config_* pins)
prebuilts/ # release APKs (git-ignored; populated by script)
scripts/collect-apks.sh # copies Modern-Apps release APKs into prebuilts/
keys/generate-keys.sh # generates the OS key set (offline; never committed)
ota/ # OTA flow notes (pipeline lives in build-maos.sh)
installer/ # prepare-factory.sh + sparse_split.py for the web installer
updater/ # MA Updater: server URL via ro.maos.ota.server
docs/BUILD_RUNBOOK.md # end-to-end Linux build/sign/OTA/publish
local_manifest.xml # adds this repo to the GrapheneOS treeUsage
- Set up a GrapheneOS build environment and choose a release branch.
- Before
repo sync, symlink the local manifest:
mkdir -p .repo/local_manifests
ln -s /path/to/MAOS/local_manifest.xml .repo/local_manifests/modern-apps.xml
repo syncThis lands the overlay at vendor/modern-apps/.
- Inherit the product config last in your device makefile
(device/.../aosp_<device>.mk):
$(call inherit-product, vendor/modern-apps/modern_apps.mk)- Populate the prebuilt APKs (build them from Modern-Apps first):
vendor/modern-apps/scripts/collect-apks.sh /path/to/Modern-Apps- Generate OS signing keys (offline), build, sign, and rebrand — full sequence in
docs/BUILD_RUNBOOK.md. You cannot ship as "GrapheneOS".
Notes
- Vanadium stays installed as the system WebView provider; only the default browser
role moves to Web (via config_defaultBrowser). Our Web app relies on system WebView.
- Files absorbs DocumentsUI. DocumentsUI is the system Storage Access Framework (SAF)
picker (OPEN_DOCUMENT / CREATE_DOCUMENT / OPEN_DOCUMENT_TREE / GET_CONTENT), not just a file manager. Removing it requires Files to take over that role in the system build only:
config_documentsUiPackageis overlaid tocom.vayunmathur.files.- Files ships as a priv-app holding
MANAGE_DOCUMENTS(see the privapp allowlist). - The SAF picker is implemented in the Files app (Modern-Apps repo) as a
DocumentPickerActivity. It is the same APK as the F-Droid build — no separate flavor. The picker component ships disabled and a small Application enables it only when MANAGE_DOCUMENTS is granted (i.e. only in MAOS), so the userspace Files app is unchanged.
- Euicc is the eSIM LPA. Modern Apps Euicc replaces Google's LPA app EuiccGoogle
(com.google.android.euicc) and its companion RRO EuiccGoogleOverlay. It ships as a priv-app declaring android.service.euicc.EuiccService; with the Google LPA removed it is the sole app resolving that intent with WRITE_EMBEDDED_SUBSCRIPTIONS, so the framework selects it as the LPA automatically (no config pin). Its privileged perms (WRITE_EMBEDDED_SUBSCRIPTIONS, MODIFY_PHONE_STATE, READ_PRIVILEGED_PHONE_STATE) are in the privapp allowlist. Only the LPA app is swapped — the proprietary Pixel backend EuiccSupportPixel (com.google.euiccpixel) and the modem firmware are kept, since they provide the low-level access to the built-in eUICC.
- Backup is the app-data backup transport. Modern Apps Backup replaces GrapheneOS's
Seedvault (com.stevesoltys.seedvault) and the GrapheneOS contacts backup transport (app.grapheneos.backup.contacts), both removed in modern_apps.mk. It ships as a priv-app declaring android.app.backup.BackupTransport via a service with the android.backup.TRANSPORT_HOST intent-filter (gated by the system-only BIND_BACKUP_TRANSPORT), and is pinned as the default transport via config_backup_transport in the RRO. Its privileged perms (BACKUP to act as a transport, WRITE_SECURE_SETTINGS to activate itself) are in the privapp allowlist. Backups are encrypted end-to-end with a BIP-39 recovery code and written to a SAF folder or a WebDAV/Nextcloud remote, so there is no separate account/content-provider backend to keep.
- APKs are
presignedso each keeps itscom.vayunmathurcertificate, preserving the
app-store update chain. The OS is signed with your own platform keys.
- Silent-breakage guard:
modern_apps.mkfails the build if any stock module we meant
to drop is still present in PRODUCT_PACKAGES (guards against upstream renames).
- Alternative to
filter-out: AOSP'soverrides:field onandroid_app_importalso
removes a named module. We use filter-out for a single, explicit removal list.
Remote device attestation (one-time, the Auditor model)
Server-verified hardware attestation lives in two places:
- Server (
location_share_server,src/handlers/attest.rs, served on
api.maproj.org under /attest/v1/*, with the public result page at https://maproj.org/attest): verifies the Android hardware attestation certificate chain up to Google's hardware attestation root (embedded; that Google-root dependency is unavoidable for Pixel hardware attestation), parses the KeyDescription extension, checks the single-use server nonce (300 s expiry, consumed on first use) — issued only for a live session started at maproj.org/attest and bound to that session, so a precomputed chain from another session cannot pass — and checks the RootOfTrust says Verified with the device locked. That is the whole verdict: there is no enrollment, no allowlist, no approval, and no persistent device identity or history — any device presenting valid hardware evidence gets a verdict. A submit returns one ephemeral result plus a verificationId / userCode / verifyUrl; the result attaches to the initiating session's page and the userCode stays a read-only receipt (short code expires in 15 minutes, the stored result within hours). Rate limiting is abuse control only, not permission. ATTEST_STATUS_TOKEN still gates the diagnostics status endpoint, and the /c_password123/attest console is a read-only recent-results view.
- Device (
patches/packages_apps_Settings_maos_attestation.patch,
applied by build-maos.sh): Settings > Security & privacy > Device attestation (on the SecuritySettings dashboard, above More security settings). One-off and user-triggered only — a "Verify" action; there is no periodic, scheduled, or on-boot verification. The screen takes the session shown at maproj.org/attest — Scan QR (SettingsLib QrCamera, the Wi-Fi DPP scanner path) or, as a fallback, type/paste the session code into the Session code field; each Verify sends that code with its challenge request and submit, generates a fresh hardware key (StrongBox where available, TEE otherwise, labelled from the server's chain reading) in AndroidKeyStore with the session-bound server challenge, and submits its chain once. When it completes, the screen keeps the last server verdict and shows "See your verification: maproj.org/attest — code XXXX" with the full URL (tapping it opens the page). The status shown is always the server's verdict from its last response, never a local self-check (which a compromised OS could lie about). A compromised OS cannot fake a Verified/locked RootOfTrust or the verified-boot key; it can only refuse, delay, or attest a good state and compromise itself afterwards — attestation is a point-in-time verdict.
No owner steps are needed before a real device can pass: attestation is open to any user. No on-device verification was performed for this implementation (no device available); the Settings patch was verified with git apply --check / apply / reverse on the pristine Settings files, and the server with cargo test using a generated fixture chain.
OTA
MAOS uses the standard A/B OTA flow (update_engine) with updates served from https://ota.maproj.org, a Cloudflare R2 bucket exposed via a custom domain. The build host uploads signed OTA zips + channel metadata straight to R2 (the publish phase of build-maos.sh), and devices download directly from R2 — no GitHub Release and no server proxy, since the payloads are multi-GB. The OTA flow is documented in ota/; how the MA Updater finds the server is covered in updater/. Full design rationale is in GRAPHENEOS_FORK_PLAN.md (Modern-Apps repo).
Web installer
https://ma.vayunmathur.com/os/install is a browser-based WebUSB flasher (like GrapheneOS's /install/web) — flash MAOS to a Pixel with no command-line tools. The static front-end lives in the location_share_server repo (os_installer/); the build-host side (turning a factory image into the manifest + images it flashes, and uploading to R2) is in installer/. Requires a Chromium desktop browser and an R2 CORS policy allowing https://ma.vayunmathur.com.
Base rebases
2026080500 → 2026110700 (d4c1a74)
- Only
patches/frameworks_base.patchneeded regenerating: theconfig_ext.xml
hunk re-anchored (@@ -51,4 → @@ -58,4) after upstream appended new setting_default_display_color_mode + setting_default_allow_clipboard_read entries at the end of the file. MAOS content is identical — the first-party store stays com.vayunmathur.appstore.
- App list unchanged: 23 repos removed upstream, all unused Car/TV leftovers none
of which MAOS marks, so sensor-optout.list is untouched (the rebase touches only build-maos.sh and frameworks_base.patch).
- Upstream behavior deltas to know at the next rebase (hashes are upstream
~/maos commits, not re-verified in this repo):
LocationRequest/LastLocationRequest.setCoarse()coarsened-location API
(upstream 138e17945; GmsCompat 10f829b adopted it).
- Hibernation exemption set
HIBERNATION_EXEMPT_SYSTEM_PACKAGES(upstream
1539b4b9d7); our store is NOT in it — separate patch in flight.
- Secure-paste clipboard policy + per-app toggle (upstream
96d35a691c41,
default-allow).
- Contact Scopes calling-app identity (upstream
4196e9c2). - Sensors permission now implicitly added via
addImplicitPermissionwith a
hasCode=false skip (upstream b1fc9e346db3); our SENSORS_OPTOUT exemption lives in our own patch.