MAOS.git
Publicgit clone https://git.maproj.org/MAOS.gitMAOS.git / modern_apps.mk
modern_apps.mk172 lines · 12.5 KiBRaw
| 1 | # MAOS (Modern Apps OS) — product configuration overlay. |
| 2 | # |
| 3 | # Inherited from the device product makefile. The MAOS app list itself lives in |
| 4 | # GrapheneOS's build/make/target/product/*.mk, patched in by phase_overlay - a |
| 5 | # makefile inherited from here cannot add or remove PRODUCT_PACKAGES entries that |
| 6 | # belong to the parent, because inherit-product defers resolution (see |
| 7 | # build/make/core/product.mk:539). |
| 8 | # |
| 9 | # ----------------------------------------------------------------------------------- |
| 10 | |
| 11 | # 0. Register this directory's Soong namespace. Android.bp here opens with |
| 12 | # `soong_namespace {}`, and modules in an unregistered namespace are never |
| 13 | # exported to Make - Soong emits rules for them but PRODUCT_PACKAGES silently |
| 14 | # matches nothing, which is how a build shipped zero MAOS apps and still passed. |
| 15 | PRODUCT_SOONG_NAMESPACES += vendor/modern-apps |
| 16 | |
| 17 | # 1. App membership (which Modern Apps ship, which stock apps are dropped) is applied |
| 18 | # by patches/platform_build.patch against build/make/target/product/*.mk. The |
| 19 | # Android.bp modules referenced there are defined alongside this file. |
| 20 | |
| 21 | # NOTE on the browser (Vanadium): Vanadium provides BOTH the default browser AND the |
| 22 | # system WebView provider. We make Modern Apps Web the default browser via the |
| 23 | # config_defaultBrowser overlay but deliberately KEEP Vanadium installed so WebView |
| 24 | # keeps working (our Web app uses androidx.webkit / system WebView). If you want to |
| 25 | # drop the Vanadium *browser* entirely, identify the browser-only module name in your |
| 26 | # tree and add it to the filter-out list above — do NOT remove the WebView/Trichrome |
| 27 | # modules. |
| 28 | |
| 29 | # NOTE on speech: Modern Apps Speech REPLACES GrapheneOS's SpeechServices (which we remove |
| 30 | # above). It becomes the default on-device recognizer via config_default*SpeechRecognitionService |
| 31 | # (overlay) and, being the only remaining installed TTS engine, the default TTS engine. Its |
| 32 | # RECORD_AUDIO runtime permission must be granted by default for the recognizer to work |
| 33 | # headless — see the default-permissions grant referenced below. |
| 34 | |
| 35 | # NOTE on the keyboard: Modern Apps Keyboard replaces AOSP LatinIME as the IME. For it to |
| 36 | # work on the lock screen after a reboot it must be Direct Boot aware; that attribute is set |
| 37 | # in the keyboard app's own manifest (Modern-Apps repo). With LatinIME removed it is the sole |
| 38 | # preinstalled IME, so the system enables/selects it by default. |
| 39 | |
| 40 | # NOTE on communicate (dialer + messaging): Modern Apps Communicate (com.vayunmathur.communicate) |
| 41 | # is a single app that provides BOTH the phone dialer and the SMS/MMS messenger. It replaces the |
| 42 | # two separate GrapheneOS/AOSP UI apps Dialer (com.android.dialer) and Messaging |
| 43 | # (com.android.messaging), both removed above. It is made the default dialer via config_defaultDialer |
| 44 | # and the default SMS app via config_defaultSms in the frameworks/base overlay (RRO). Holding the |
| 45 | # DIALER and SMS roles causes the role system to auto-grant its runtime permissions, so it is NOT a |
| 46 | # priv-app and needs no default-permissions grant. Only the UI apps are removed; the telephony |
| 47 | # backends (TelephonyProvider, telecom framework) stay intact. Neither `Dialer` nor `Messaging` ends |
| 48 | # in `Provider`, so the safety guard above correctly permits removing them. |
| 49 | |
| 50 | # NOTE on network location + geocoder: Modern Apps NetworkLocation (com.vayunmathur.networklocation) |
| 51 | # is a priv-app that provides BOTH the network location provider and the offline geocoder. It |
| 52 | # replaces GrapheneOS's NetworkLocation module (app.grapheneos.networklocation), which we remove |
| 53 | # above. Removing that module also drops its bundled privapp-permissions/sysconfig etc files (they |
| 54 | # are `required:` deps of the module). Our app is pinned via config_networkLocationProviderPackageName, |
| 55 | # config_geocoderProviderPackageName and config_locationProviderPackageNames in the frameworks/base |
| 56 | # overlay, gets its privileged perms from privapp-permissions-modern-apps.xml, and gets Doze / |
| 57 | # Data-Saver exemptions (for always-on background operation) from sysconfig-modern-apps.xml below. |
| 58 | # `NetworkLocation` is a provider *implementation* app, NOT a content-provider backend — it does not |
| 59 | # end in `Provider`, so the safety guard above correctly permits removing it. |
| 60 | |
| 61 | # NOTE on eSIM (euicc): Modern Apps Euicc (com.vayunmathur.euicc) is a priv-app that is the system |
| 62 | # eSIM LPA (Local Profile Assistant). It declares android.service.euicc.EuiccService plus the eSIM |
| 63 | # management LUI (MANAGE_/PROVISION_EMBEDDED_SUBSCRIPTIONS) and implements the full SGP.22 stack, |
| 64 | # driving the eUICC over a telephony logical channel. It gets its signature|privileged perms |
| 65 | # (WRITE_EMBEDDED_SUBSCRIPTIONS / MODIFY_PHONE_STATE / READ_PRIVILEGED_PHONE_STATE) from |
| 66 | # privapp-permissions-modern-apps.xml. It replaces Google's LPA app EuiccGoogle |
| 67 | # (com.google.android.euicc) and its companion RRO EuiccGoogleOverlay (com.google.android.euiccoverlay), |
| 68 | # both removed above; with the Google LPA gone, ours is the sole app resolving the EuiccService intent |
| 69 | # with the privileged eSIM permission, so the framework selects it as the LPA automatically (no config |
| 70 | # pin needed). Only the LPA *app* layer is replaced: the proprietary Pixel hardware backend |
| 71 | # EuiccSupportPixel (com.google.euiccpixel) and the modem/Shannon firmware are KEPT — they provide the |
| 72 | # low-level access to the built-in eUICC that this app sits on top of. `EuiccGoogle`/`EuiccGoogleOverlay` |
| 73 | # are not content-provider backends (they don't end in `Provider`), so the safety guard permits removal. |
| 74 | |
| 75 | # NOTE on backup: Modern Apps Backup (com.vayunmathur.backup) is a priv-app that is the system |
| 76 | # app-data backup transport. It declares android.app.backup.BackupTransport via a service with the |
| 77 | # android.backup.TRANSPORT_HOST intent-filter (gated by the system-only BIND_BACKUP_TRANSPORT |
| 78 | # permission) and also performs standalone encrypted file/media backup. It gets its |
| 79 | # signature|privileged perms (BACKUP to act as a transport, WRITE_SECURE_SETTINGS to activate |
| 80 | # itself) from privapp-permissions-modern-apps.xml, and is pinned as the default transport via |
| 81 | # config_backup_transport in the frameworks/base overlay (RRO). It replaces GrapheneOS's Seedvault |
| 82 | # (com.stevesoltys.seedvault, module Seedvault) and the GrapheneOS contacts backup transport |
| 83 | # (app.grapheneos.backup.contacts, module ContactsBackup), both removed above; with Seedvault gone, |
| 84 | # ours is the transport pinned by config_backup_transport. Backups are encrypted end-to-end with a |
| 85 | # BIP-39 recovery code, so there is no separate account/content-provider backend to keep. Neither |
| 86 | # `Seedvault` nor `ContactsBackup` ends in `Provider`, so the safety guard above permits removal. |
| 87 | # (Module names are the GrapheneOS build names — re-confirm on your synced tree if a build surprises |
| 88 | # you, per the note on the removal list above.) |
| 89 | |
| 90 | # NOTE on emergency: Modern Apps Emergency (com.vayunmathur.emergency) is a priv-app |
| 91 | # that replaces AOSP EmergencyInfo (module EmergencyInfo, removed from |
| 92 | # telephony_system_ext.mk via platform_build.patch). It answers the same platform |
| 93 | # actions (EMERGENCY_ASSISTANCE, EDIT_EMERGENCY_INFO + legacy EDIT_MEDICAL_INFO), the |
| 94 | # Settings ia.emergency injection, and the SystemUI SOS gesture via a LAUNCH_EMERGENCY |
| 95 | # alias (config_preferredEmergencySosPackage is empty, so no SystemUI patch is needed). |
| 96 | # Settings finds it through the package pins rewired in settings.patch, and the SOS |
| 97 | # gesture state flows through the gesture authority rewired in frameworks_base.patch. |
| 98 | # Its signature|privileged perms (CALL_PRIVILEGED / MANAGE_USERS / |
| 99 | # READ_PRIVILEGED_PHONE_STATE / SCHEDULE_EXACT_ALARM / START_ACTIVITIES_FROM_BACKGROUND |
| 100 | # / WRITE_SECURE_SETTINGS) are allowlisted in privapp-permissions-modern-apps.xml, and |
| 101 | # it is exempt from Doze in sysconfig-modern-apps.xml so the SOS countdown survives idle. |
| 102 | # Wireless emergency alerts (CellBroadcastReceiver) are deliberately NOT replaced and |
| 103 | # keep shipping stock. |
| 104 | |
| 105 | # 3. framework-res config |
| 106 | |
| 107 | # 3. framework-res config (default browser, documents UI, speech recognition service, and the |
| 108 | # geocoder / network-location provider pins + their override bools) ships as an explicit |
| 109 | # static, platform-signed RRO. With PRODUCT_ENFORCE_RRO_TARGETS := * (from generic_system.mk) |
| 110 | # a plain PRODUCT_PACKAGE_OVERLAYS on framework-res is turned into an auto-generated product |
| 111 | # RRO named framework-res__$(PRODUCT_NAME)__auto_generated_rro_product.apk, which collides |
| 112 | # with the identically named prebuilt adevtool ships under vendor/google_devices/<dev>/overlays |
| 113 | # (soong "packaging conflict"). An explicit module has a unique name and coexists with it. |
| 114 | # platform signing is required to overlay the non-public config_* resources; isStatic makes it |
| 115 | # always-on at boot. See vendor/modern-apps/rro/MaosFrameworkResRRO/. |
| 116 | PRODUCT_PACKAGES += MaosFrameworkResRRO |
| 117 | |
| 118 | # There is no PRODUCT_PACKAGE_OVERLAYS entry here: framework-res config ships via the |
| 119 | # explicit RRO above, so no auto-generated framework-res RRO is produced. |
| 120 | |
| 121 | # 3b. Default-permission grant so the Speech recognizer/TTS gets RECORD_AUDIO headlessly. |
| 122 | PRODUCT_COPY_FILES += \ |
| 123 | vendor/modern-apps/default-permissions-modern-apps.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/default-permissions/default-permissions-modern-apps.xml |
| 124 | |
| 125 | # NOTE on screen time: Modern Apps Screen Time (com.vayunmathur.screentime) is the |
| 126 | # self-managed wellbeing app (dashboard, timers, focus, wind-down). It is pinned via |
| 127 | # config_systemWellbeing in the frameworks/base overlay (RRO), which makes it the default |
| 128 | # holder of the SYSTEM_WELLBEING role - the role grant supplies SUSPEND_APPS, |
| 129 | # SYSTEM_APPLICATION_OVERLAY and OBSERVE_APP_USAGE at runtime. It is NOT a priv-app, so it |
| 130 | # has no privapp-permissions entry. Its reflective UsageStatsManager observer and |
| 131 | # PackageManager suspend access is allowlisted via hidden-api-whitelisted-app in |
| 132 | # sysconfig-modern-apps.xml. Shipped as presigned android_app_import (ModernAppsScreenTime) |
| 133 | # and collected by collect-apks.sh. |
| 134 | |
| 135 | # NOTE on parental controls: Modern Apps Parental Controls (com.vayunmathur.parentalcontrols) |
| 136 | # is the system supervision app (bedtime + app limits). It is pinned via config_systemSupervision |
| 137 | # in the frameworks/base overlay (RRO), which makes it the default holder of the SYSTEM_SUPERVISION |
| 138 | # role and qualifies it for the SUPERVISION role - the role grant supplies MANAGE_SUPERVISION and |
| 139 | # MANAGE_APP_OPS_MODES at runtime. It is NOT a priv-app, so it has no privapp-permissions entry |
| 140 | # (an entry for a non-priv-app is boot-fatal under ro.control_privapp_permissions=enforce). Its |
| 141 | # reflective access to the UsageStatsManager limit-observer methods is allowlisted via |
| 142 | # hidden-api-whitelisted-app in sysconfig-modern-apps.xml. Shipped like every other app as a |
| 143 | # presigned android_app_import (ModernAppsParentalControls) and collected by collect-apks.sh. |
| 144 | |
| 145 | # 4. Privileged-permission allowlist so Files (priv-app) may hold MANAGE_DOCUMENTS, |
| 146 | # NetworkLocation (priv-app) may hold INSTALL_LOCATION_PROVIDER / LOCATION_HARDWARE / |
| 147 | # MODIFY_PHONE_STATE / UPDATE_DEVICE_STATS, Euicc (priv-app, the eSIM LPA) may hold |
| 148 | # WRITE_EMBEDDED_SUBSCRIPTIONS / MODIFY_PHONE_STATE / READ_PRIVILEGED_PHONE_STATE, and |
| 149 | # Backup (priv-app, the app-data backup transport) may hold BACKUP / WRITE_SECURE_SETTINGS. |
| 150 | PRODUCT_COPY_FILES += \ |
| 151 | vendor/modern-apps/privapp-permissions-modern-apps.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-modern-apps.xml |
| 152 | |
| 153 | # 4b. Sysconfig so NetworkLocation is exempt from Doze / Data Saver and keeps running in the |
| 154 | # background (always-on), mirroring GrapheneOS's own networklocation sysconfig. |
| 155 | PRODUCT_COPY_FILES += \ |
| 156 | vendor/modern-apps/sysconfig-modern-apps.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/sysconfig/sysconfig-modern-apps.xml |
| 157 | |
| 158 | # 4c. Google Sans Flex as the system sans-serif. patches/frameworks_base.patch repoints the |
| 159 | # sans-serif family in fonts.xml at this file; Minikin reads fonts.xml from /system/etc, so |
| 160 | # this cannot be an RRO. The upstream filename contains commas, which the build dislikes, |
| 161 | # so it is shipped renamed. The font is SIL Open Font Licensed - OFL.txt travels with it. |
| 162 | PRODUCT_COPY_FILES += \ |
| 163 | vendor/modern-apps/fonts/GoogleSansFlex.ttf:$(TARGET_COPY_OUT_SYSTEM)/fonts/GoogleSansFlex.ttf \ |
| 164 | vendor/modern-apps/fonts/OFL.txt:$(TARGET_COPY_OUT_SYSTEM)/fonts/OFL-GoogleSansFlex.txt |
| 165 | |
| 166 | # 5. MAOS branding (PRODUCT_* + ro.maos.* props). Kept separate for readability. |
| 167 | $(call inherit-product-if-exists, vendor/modern-apps/maos_branding.mk) |
| 168 | |
| 169 | # 6. The old leak guard lived here. It filtered the same local PRODUCT_PACKAGES as the |
| 170 | # removal above, so it was always empty and never fired - which is why a build that |
| 171 | # shipped zero MAOS apps still reported success. Removal is now a patch, and a patch |
| 172 | # that no longer applies fails loudly in phase_overlay. |