Modern Apps git

MAOS.git

Public
git clone https://git.maproj.org/MAOS.git
main ▾

MAOS.git / IMPLEMENTATION_README.md

IMPLEMENTATION_README.md14.4 KiBRenderedCodeRaw

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 AppPackageReplaces
Webcom.vayunmathur.webVanadium (browser only; WebView kept)
Cameracom.vayunmathur.cameraGrapheneOS Camera
PDFcom.vayunmathur.pdfPdfViewer
Contactscom.vayunmathur.contactsAOSP Contacts
Calculatorcom.vayunmathur.calculatorAOSP Calculator
Clockcom.vayunmathur.clockAOSP DeskClock
Filescom.vayunmathur.filesDocumentsUI (Files also takes over the SAF role — see below)
Photoscom.vayunmathur.photosAOSP Gallery
App Storecom.vayunmathur.appstoreGrapheneOS Apps
Keyboardcom.vayunmathur.keyboardAOSP LatinIME (Direct Boot-aware for lock-screen input)
Speechcom.vayunmathur.speechGrapheneOS SpeechServices (default STT + TTS)
Calendarcom.vayunmathur.calendarAOSP Calendar (uses system CalendarProvider)
Musiccom.vayunmathur.musicAOSP Music (incl. popup single-file player)
Communicatecom.vayunmathur.communicateAOSP Dialer and Messaging (default dialer + SMS app)
Euicccom.vayunmathur.euiccGoogle's eSIM LPA EuiccGoogle (system LPA; Pixel EuiccSupportPixel backend kept — see below)
Backupcom.vayunmathur.backupSeedvault (com.stevesoltys.seedvault) and the GrapheneOS contacts backup transport (app.grapheneos.backup.contacts) — system app-data backup transport; see below
Emergencycom.vayunmathur.emergencyAOSP EmergencyInfo (medical info + contacts + SOS countdown; wireless alerts stay stock CellBroadcast)
Parental Controlscom.vayunmathur.parentalcontrolsn/a (new; AOSP has no supervision app) — system supervision app: bedtime + app limits via the SYSTEMSUPERVISION role (pinned by `configsystemSupervision`)
Screen Timecom.vayunmathur.screentimen/a (new; AOSP has no wellbeing app) — self-managed screen time: dashboard, timers, focus, wind-down via the SYSTEMWELLBEING role (pinned by `configsystemWellbeing`)
Autocom.vayunmathur.auton/a (new) — SYSTEMAUTOMOTIVEPROJECTION role holder (Android Auto projection)
Network Locationcom.vayunmathur.networklocationGrapheneOS NetworkLocation — network location provider + offline geocoder
Find Familycom.vayunmathur.findfamilyn/a (new) — family location sharing (ordinary user app, preinstalled)
Sharecom.vayunmathur.sharen/a (new) — AirDrop-compatible sharing (privileged for the Mosey/AWDL HAL)
Castcom.vayunmathur.castn/a (new) — Cast / remote-display provider
Setup Wizardcom.vayunmathur.setupwizardGrapheneOS SetupWizard2 (first-run setup; see Android.bp warning)
Log Viewercom.vayunmathur.logviewerGrapheneOS LogViewer (error-report viewer, no launcher entry)
Updatercom.vayunmathur.updaterGrapheneOS Updater (overrides) — polls ro.maos.ota.server; see updater/
Healthcom.vayunmathur.healthn/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 tree

Usage

  1. Set up a GrapheneOS build environment and choose a release branch.
  2. 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 sync

This lands the overlay at vendor/modern-apps/.

  1. Inherit the product config last in your device makefile

(device/.../aosp_<device>.mk):

   $(call inherit-product, vendor/modern-apps/modern_apps.mk)
  1. Populate the prebuilt APKs (build them from Modern-Apps first):
   vendor/modern-apps/scripts/collect-apks.sh /path/to/Modern-Apps
  1. 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_documentsUiPackage is overlaid to com.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 presigned so each keeps its com.vayunmathur certificate, preserving the

app-store update chain. The OS is signed with your own platform keys.

  • Silent-breakage guard: modern_apps.mk fails 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's overrides: field on android_app_import also

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.patch needed regenerating: the config_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):

  1. LocationRequest/LastLocationRequest.setCoarse() coarsened-location API

(upstream 138e17945; GmsCompat 10f829b adopted it).

  1. Hibernation exemption set HIBERNATION_EXEMPT_SYSTEM_PACKAGES (upstream

1539b4b9d7); our store is NOT in it — separate patch in flight.

  1. Secure-paste clipboard policy + per-app toggle (upstream 96d35a691c41,

default-allow).

  1. Contact Scopes calling-app identity (upstream 4196e9c2).
  2. Sensors permission now implicitly added via addImplicitPermission with a

hasCode=false skip (upstream b1fc9e346db3); our SENSORS_OPTOUT exemption lives in our own patch.