maos: SENSORS_OPTOUT permission strips sensor requests at parse time
- Commit
d172d27e72da8870b1cabf0ce8802d48abbdbe3b- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-08 15:12 UTC (27 days ago)
- Parents
5cca4ef
Declares com.vayunmathur.permission.SENSORS_OPTOUT (normal) in frameworks/base and removes BODY_SENSORS, BODY_SENSORS_BACKGROUND, ACTIVITY_RECOGNITION and HIGH_SAMPLING_RATE_SENSORS from both requestedPermissions and implicitPermissions in PackageParser.parseBaseApk for any app declaring it, so the request is gone entirely (never granted, never visible in Settings). Audit (Nov 2026): no stock system app requests sensor-data permissions today; Settings verified zero hits at TAG 2026080500. The opt-out is declared by Settings and GmsCompat (compat shim only, not sandboxed GMS) and enforced for present and future requests alike. local_manifest: MAOS primary is now git.maproj.org (GitHub mirrors).
Diff
local_manifest.xml
diff --git a/local_manifest.xml b/local_manifest.xmlindex 5426114..098c4f3 100644--- a/local_manifest.xml+++ b/local_manifest.xml@@ -12,10 +12,10 @@ stock apps we replace. --> <manifest>- <remote name="maos-github" fetch="https://github.com/vayun-mathur/" />+ <remote name="maos" fetch="https://git.maproj.org/" /> <!-- The overlay repo (this repo) lands at vendor/modern-apps. -->- <project path="vendor/modern-apps" name="MAOS" remote="maos-github" revision="main" />+ <project path="vendor/modern-apps" name="MAOS.git" remote="maos" revision="main" /> <!-- OPTIONAL: remove the SOURCE of the stock apps we replace. Not required — modern_apps.mk
patches/frameworks_base.patch
diff --git a/patches/frameworks_base.patch b/patches/frameworks_base.patchindex 2c961fa..e754368 100644--- a/patches/frameworks_base.patch+++ b/patches/frameworks_base.patch@@ -846,3 +846,48 @@ index b50c541b8329..05cc079120a7 100644 } @EnforcePermission(android.Manifest.permission.MANAGE_DISPLAYS)+diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml+--- a/core/res/AndroidManifest.xml++++ b/core/res/AndroidManifest.xml+@@ -9210,6 +9210,13 @@+ android:protectionLevel="internal|role|installer"+ android:permissionFlags="allowedInPrivateComputeCore" />+++ <!-- MAOS: apps declaring this permission have all sensor permission requests++ (BODY_SENSORS, BODY_SENSORS_BACKGROUND, ACTIVITY_RECOGNITION,++ HIGH_SAMPLING_RATE_SENSORS) removed at parse time. Applied to MA system++ apps and MA apps, which must never access body sensors. -->++ <permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT"++ android:protectionLevel="normal" />+++ <!-- @SystemApi Permission that protects the {@link Intent#ACTION_REVIEW_ACCESSIBILITY_SERVICES}+ intent.+ @hide -->+diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java+--- a/core/java/android/content/pm/PackageParser.java++++ b/core/java/android/content/pm/PackageParser.java+@@ -2465,8 +2465,24 @@+ if (!pkg.requestedPermissions.contains(perm)) {+ pkg.requestedPermissions.add(perm);+ pkg.implicitPermissions.add(perm);+ }+ }+ }+++ // MAOS: SENSORS_OPTOUT removes sensor permission requests entirely (not just++ // the grant) for apps declaring com.vayunmathur.permission.SENSORS_OPTOUT.++ // Applied to MA system apps and MA apps, which must never access body sensors.++ // Audit (Nov 2026): no stock system app requests these today, so this is++ // enforcement for present and future requests alike.++ if (pkg.requestedPermissions.contains("com.vayunmathur.permission.SENSORS_OPTOUT")) {++ pkg.requestedPermissions.remove("android.permission.BODY_SENSORS");++ pkg.requestedPermissions.remove("android.permission.BODY_SENSORS_BACKGROUND");++ pkg.requestedPermissions.remove("android.permission.ACTIVITY_RECOGNITION");++ pkg.requestedPermissions.remove("android.permission.HIGH_SAMPLING_RATE_SENSORS");++ pkg.implicitPermissions.remove("android.permission.BODY_SENSORS");++ pkg.implicitPermissions.remove("android.permission.BODY_SENSORS_BACKGROUND");++ pkg.implicitPermissions.remove("android.permission.ACTIVITY_RECOGNITION");++ pkg.implicitPermissions.remove("android.permission.HIGH_SAMPLING_RATE_SENSORS");++ }+++ if (supportsSmallScreens < 0 || (supportsSmallScreens > 0
patches/gmscompat.patch
diff --git a/patches/gmscompat.patch b/patches/gmscompat.patchindex 36abbe7..1160f0d 100644--- a/patches/gmscompat.patch+++ b/patches/gmscompat.patch@@ -11,3 +11,16 @@ index 676a024..1cb8642 100644 <!-- needed for config fragments for updating permissions for Android Auto, etc. --> <uses-permission android:name="android.permission.UPDATE_AND_INVALIDATE_PERMISSION_STATE" /> +diff --git a/AndroidManifest.xml b/AndroidManifest.xml+--- a/AndroidManifest.xml++++ b/AndroidManifest.xml+@@ -13,6 +13,9 @@+ <uses-permission android:name="com.vayunmathur.logviewer.SHOW_ERROR_REPORT" />+ <!-- needed for config fragments for updating permissions for Android Auto, etc. -->+ <uses-permission android:name="android.permission.UPDATE_AND_INVALIDATE_PERMISSION_STATE" />+ ++ <!-- MAOS: opt out of all body-sensor permission requests (removed at parse time). -->++ <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" />+++ <permission+ android:name="app.grapheneos.gmscompat.SHOW_UI"
patches/settings.patch
diff --git a/patches/settings.patch b/patches/settings.patchindex 26cea00..f0a24c2 100644--- a/patches/settings.patch+++ b/patches/settings.patch@@ -791,3 +791,16 @@ index c689a201ec0..14b2bbdba72 100644 + Intent("com.vayunmathur.screentime.action.DASHBOARD") + .setPackage("com.vayunmathur.screentime") +}+diff --git a/AndroidManifest.xml b/AndroidManifest.xml+--- a/AndroidManifest.xml++++ b/AndroidManifest.xml+@@ -153,6 +153,9 @@+ <uses-permission android:name="com.vayunmathur.logviewer.SHOW_LOGCAT" />+ <uses-permission android:name="android.permission.CONTROL_SIM_AUTO_PIN_MANAGEMENT" />+ <uses-permission android:name="android.permission.MANAGE_COMPUTER_CONTROL_CONSENT" />+ ++ <!-- MAOS: opt out of all body-sensor permission requests (removed at parse time). -->++ <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" />+++ <application+ android:name=".SettingsApplication"