Modern Apps git

← MAOS.git

maos: ship parentalcontrols and screentime as role holders

Commit
e33a915fb808f8e12829f48bad9cea60f68f1622
Author
Vayun Mathur <[email protected]>
When
2026-09-14 05:39 UTC (2 months ago)
Parents
46162d5

Diff

Android.bp
diff --git a/Android.bp b/Android.bpindex 338ba9c..fcf84c3 100644--- a/Android.bp+++ b/Android.bp@@ -361,11 +361,25 @@ android_app_import {         "Provision",         "SetupWizard2",     ],++// ParentalControls is the system supervision app (bedtime + app limits). It holds the+// SYSTEM_SUPERVISION role via the config_systemSupervision pin in MaosFrameworkResRRO,+// which grants MANAGE_SUPERVISION and MANAGE_APP_OPS_MODES at runtime. It is NOT privileged:+// a privapp-permissions entry for a non-priv-app is boot-fatal under+// ro.control_privapp_permissions=enforce. Its reflective UsageStatsManager observer access+// is allowlisted via hidden-api-whitelisted-app in sysconfig-modern-apps.xml.+android_app_import {+    name: "ModernAppsParentalControls",+    apk: "prebuilts/parentalcontrols-release.apk",+    presigned: true,+    product_specific: true,+     dex_preopt: {         enabled: false,     }, } + // Updater is PRIVILEGED: it holds REBOOT, ACCESS_CACHE_FILESYSTEM and ALLOCATE_AGGRESSIVE, and // it drives android.os.UpdateEngine to write an OTA payload into the inactive A/B slot. All // three are signature|privileged and are allowlisted in privapp-permissions-modern-apps.xml.@@ -390,6 +404,20 @@ android_app_import {     overrides: [         "Updater",     ],++// ScreenTime is the self-managed wellbeing app (dashboard, timers, focus, wind-down). It+// holds the SYSTEM_WELLBEING role via the config_systemWellbeing pin in MaosFrameworkResRRO,+// which grants SUSPEND_APPS, SYSTEM_APPLICATION_OVERLAY and OBSERVE_APP_USAGE at runtime. It+// is NOT privileged: a privapp-permissions entry for a non-priv-app is boot-fatal under+// ro.control_privapp_permissions=enforce. Its reflective UsageStatsManager observer and+// PackageManager suspend access is allowlisted via hidden-api-whitelisted-app in+// sysconfig-modern-apps.xml.+android_app_import {+    name: "ModernAppsScreenTime",+    apk: "prebuilts/screentime-release.apk",+    presigned: true,+    product_specific: true,+     dex_preopt: {         enabled: false,     },
IMPLEMENTATION_README.md
diff --git a/IMPLEMENTATION_README.md b/IMPLEMENTATION_README.mdindex f91355f..fdc41db 100755--- a/IMPLEMENTATION_README.md+++ b/IMPLEMENTATION_README.md@@ -32,6 +32,8 @@ repo.) | 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 |+| Parental Controls | `com.vayunmathur.parentalcontrols` | n/a (new; AOSP has no supervision app) — system supervision app: bedtime + app limits via the SYSTEM_SUPERVISION role (pinned by `config_systemSupervision`) |+| Screen Time | `com.vayunmathur.screentime` | n/a (new; AOSP has no wellbeing app) — self-managed screen time: dashboard, timers, focus, wind-down via the SYSTEM_WELLBEING role (pinned by `config_systemWellbeing`) |  ## Layout 
README.md
diff --git a/README.md b/README.mdindex d5b4e6f..00519a6 100644--- a/README.md+++ b/README.md@@ -9,8 +9,10 @@ a clean, cohesive set of everyday apps built to work together.  Flash MAOS straight from your browser with the WebUSB installer: + **→ https://ma.vayunmathur.com/os/install** + You'll need a supported Pixel and a Chromium-based desktop browser (Chrome, Edge). No command-line tools required. Once installed, MAOS keeps itself up to date automatically over the air.@@ -44,6 +46,9 @@ app installed from an app store simply can't: - **Speech** — provides **offline** voice typing (speech-to-text) and text-to-speech to   every app on the device. - **Keyboard** — is available on the **lock screen** and during first-time setup.+- **Parental Controls** — bedtime, downtime, school time, app limits and a device-wide+  daily limit, enforced on-device behind a parent PIN with bonus time grants.+- **Screen Time** — your own dashboard, per-app timers, focus mode and overnight wind-down.  The remaining apps (Camera, Photos, PDF, Contacts, Calculator, Clock, Calendar, Music, App Store, Web) are simply the built-in defaults — the same apps you'd get from the store.
build-maos.sh
diff --git a/build-maos.sh b/build-maos.shindex 6e35a19..6124dd8 100755--- a/build-maos.sh+++ b/build-maos.sh@@ -99,7 +99,7 @@ BUILD="$TAG" MANIFEST_URL="https://github.com/GrapheneOS/platform_manifest.git" MAOS_GH="https://github.com/vayun-mathur/"     # overlay repo remote (for the local manifest) MODERN_APPS_GH="vayun-mathur/Modern-Apps"      # source of the prebuilt APKs-APPS=(web camera pdf contacts calculator clock files photos appstore keyboard speech calendar music communicate euicc backup networklocation findfamily share cast setupwizard logviewer updater)+APPS=(web camera pdf contacts calculator clock files photos appstore keyboard speech calendar music communicate euicc backup networklocation findfamily share cast setupwizard logviewer updater parentalcontrols screentime)  # ---- Derived / optional-env config ---- # ONE shared, device-independent key set (see the "Signing keys" note above).
modern_apps.mk
diff --git a/modern_apps.mk b/modern_apps.mkindex 105e335..8af54e9 100644--- a/modern_apps.mk+++ b/modern_apps.mk@@ -108,6 +108,26 @@ PRODUCT_PACKAGE_OVERLAYS += vendor/modern-apps/overlay PRODUCT_COPY_FILES += \     vendor/modern-apps/default-permissions-modern-apps.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/default-permissions/default-permissions-modern-apps.xml +# NOTE on screen time: Modern Apps Screen Time (com.vayunmathur.screentime) is the+# self-managed wellbeing app (dashboard, timers, focus, wind-down). It is pinned via+# config_systemWellbeing in the frameworks/base overlay (RRO), which makes it the default+# holder of the SYSTEM_WELLBEING role - the role grant supplies SUSPEND_APPS,+# SYSTEM_APPLICATION_OVERLAY and OBSERVE_APP_USAGE at runtime. It is NOT a priv-app, so it+# has no privapp-permissions entry. Its reflective UsageStatsManager observer and+# PackageManager suspend access is allowlisted via hidden-api-whitelisted-app in+# sysconfig-modern-apps.xml. Shipped as presigned android_app_import (ModernAppsScreenTime)+# and collected by collect-apks.sh.++# NOTE on parental controls: Modern Apps Parental Controls (com.vayunmathur.parentalcontrols)+# is the system supervision app (bedtime + app limits). It is pinned via config_systemSupervision+# in the frameworks/base overlay (RRO), which makes it the default holder of the SYSTEM_SUPERVISION+# role and qualifies it for the SUPERVISION role - the role grant supplies MANAGE_SUPERVISION and+# MANAGE_APP_OPS_MODES at runtime. It is NOT a priv-app, so it has no privapp-permissions entry+# (an entry for a non-priv-app is boot-fatal under ro.control_privapp_permissions=enforce). Its+# reflective access to the UsageStatsManager limit-observer methods is allowlisted via+# hidden-api-whitelisted-app in sysconfig-modern-apps.xml. Shipped like every other app as a+# presigned android_app_import (ModernAppsParentalControls) and collected by collect-apks.sh.+ # 4. Privileged-permission allowlist so Files (priv-app) may hold MANAGE_DOCUMENTS, #    NetworkLocation (priv-app) may hold INSTALL_LOCATION_PROVIDER / LOCATION_HARDWARE / #    MODIFY_PHONE_STATE / UPDATE_DEVICE_STATS, Euicc (priv-app, the eSIM LPA) may hold
patches/platform_build.patch
diff --git a/patches/platform_build.patch b/patches/platform_build.patchindex 3c50145..6c5dc97 100644--- a/patches/platform_build.patch+++ b/patches/platform_build.patch@@ -63,6 +63,8 @@ index 2a4602d43b..9008973800 100644 +    ModernAppsSetupWizard \ +    ModernAppsLogViewer \ +    ModernAppsUpdater \++    ModernAppsParentalControls \++    ModernAppsScreenTime \      preinstalled-packages-platform-handheld-product.xml \      SettingsIntelligence \ -    SpeechServices \
rro/MaosFrameworkResRRO/res/values/config.xml
diff --git a/rro/MaosFrameworkResRRO/res/values/config.xml b/rro/MaosFrameworkResRRO/res/values/config.xmlindex 0716968..f5d06d3 100644--- a/rro/MaosFrameworkResRRO/res/values/config.xml+++ b/rro/MaosFrameworkResRRO/res/values/config.xml@@ -58,6 +58,7 @@          framework default-transport pin (a "package/service" component); Backup holds the          signature|privileged BACKUP permission (allowlisted in          privapp-permissions-modern-apps.xml) so the BackupManagerService will bind it. -->+     <string name="config_backup_transport" translatable="false">com.vayunmathur.backup/.service.ConfigurableBackupTransportService</string>      <!-- Automotive projection role -> Modern Apps Cast.@@ -89,4 +90,20 @@          Precedent: config_defaultSms above works the same way - the SMS role auto-grants its          SMS/Phone/Contacts runtime permissions. -->     <string name="config_systemAutomotiveProjection" translatable="false">com.vayunmathur.cast</string>++<!-- System supervision app -> Modern Apps Parental Controls. Upstream defaults to empty,+         in which case Settings hides the Parental controls entry (TopLevelSupervisionPreferenceController+         reports UNSUPPORTED_ON_DEVICE) and the platform never binds SupervisionAppService. The pin is+         the default holder of the SYSTEM_SUPERVISION role (see roles.xml defaultHolders) and the+         qualifier for the SUPERVISION role (SupervisionRoleBehavior), granting MANAGE_SUPERVISION /+         MANAGE_APP_OPS_MODES at runtime. No privapp-permissions entry: not a priv-app. -->+    <string name="config_systemSupervision" translatable="false">com.vayunmathur.parentalcontrols</string>++<!-- System wellbeing app -> Modern Apps Screen Time. Upstream defaults to empty, in+         which case Settings shows no Digital Wellbeing entry and no role holder exists to+         grant SUSPEND_APPS / SYSTEM_APPLICATION_OVERLAY / OBSERVE_APP_USAGE. The pin is the+         default holder of the SYSTEM_WELLBEING role (see roles.xml defaultHolders). No+         privapp-permissions entry: not a priv-app. -->+    <string name="config_systemWellbeing" translatable="false">com.vayunmathur.screentime</string>+ </resources>
scripts/collect-apks.sh
diff --git a/scripts/collect-apks.sh b/scripts/collect-apks.shindex c5f59e5..f610447 100755--- a/scripts/collect-apks.sh+++ b/scripts/collect-apks.sh@@ -21,6 +21,7 @@ SRC="${1:?usage: collect-apks.sh <path to Modern-Apps repo, its distribution_apk DEST="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/prebuilts" mkdir -p "$DEST" + # The app list is the one in build-maos.sh, parsed rather than duplicated. These two # arrays drifted apart once already (22 vs 18), and the symptom was a Soong failure about # a missing prebuilt rather than anything pointing back at this script.@@ -29,6 +30,7 @@ BUILD_MAOS="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/build-maos.sh" mapfile -t APPS < <(sed -n 's/^APPS=(\(.*\))$/\1/p' "$BUILD_MAOS" | tr ' ' '\n' | grep -v '^$') [[ "${#APPS[@]}" -gt 0 ]] || { echo "ERROR: could not parse APPS=(...) from $BUILD_MAOS" >&2; exit 1; } + find_apk() {   local app="$1"   local candidates=(
sysconfig-modern-apps.xml
diff --git a/sysconfig-modern-apps.xml b/sysconfig-modern-apps.xmlindex 58139e5..1a1fdd2 100644--- a/sysconfig-modern-apps.xml+++ b/sysconfig-modern-apps.xml@@ -22,7 +22,19 @@     <allow-in-data-usage-save package="com.vayunmathur.networklocation" />     <allow-unthrottled-location package="com.vayunmathur.networklocation" /> +     <backup-transport-whitelisted-service         service="com.vayunmathur.backup/.service.ConfigurableBackupTransportService" />     <allow-in-power-save package="com.vayunmathur.backup" />++    <!-- Parental Controls (com.vayunmathur.parentalcontrols) reaches the @SystemApi+         UsageStatsManager app-limit observer methods reflectively. It ships presigned+         (not platform-signed) but as a /product app it takes the isSystemApp() branch of+         ApplicationInfo.isAllowedToUseHiddenApis(), where this whitelist entry disables+         hidden-API enforcement. Without it the registration lookups return null and+         app limits silently never arm. Narrower than android:usesNonSdkApi and inert for+         a non-system install of the same APK. -->+    <hidden-api-whitelisted-app package="com.vayunmathur.parentalcontrols" />+    <hidden-api-whitelisted-app package="com.vayunmathur.screentime" />+ </config>