Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / parentalcontrols / src / main / AndroidManifest.xml
AndroidManifest.xml398 lines · 21.3 KiBRaw
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:tools="http://schemas.android.com/tools"> |
| 4 | <!-- |
| 5 | Everything this app holds arrives with the SYSTEM_SUPERVISION role, which the platform |
| 6 | grants to whichever package `config_systemSupervision` names - see the pin and the list of |
| 7 | what it costs in vendor/modern-apps/rro/MaosFrameworkResRRO/res/values/config.xml. A role |
| 8 | grants only what the manifest requests, which is why the two below are declared: without |
| 9 | them the role holds them back. |
| 10 | |
| 11 | Neither belongs in privapp-permissions-modern-apps.xml. They are `signature|role` and |
| 12 | `internal|role` rather than `signature|privileged`, this app is not a priv-app, and an |
| 13 | entry there that does not match the manifest is boot-fatal under |
| 14 | ro.control_privapp_permissions=enforce. |
| 15 | --> |
| 16 | <!-- Lets us call SupervisionManager.setPolicy/getPolicies, which is how a decision reaches |
| 17 | the platform at all. --> |
| 18 | <!-- MAOS: opt out of the GrapheneOS Sensors permission (OTHER_SENSORS). --> |
| 19 | <!-- This app uses no motion/environment sensors; MAOS withholds the --> |
| 20 | <!-- Sensors permission at install instead of auto-granting it. --> |
| 21 | <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" /> |
| 22 | |
| 23 | <uses-permission android:name="android.permission.MANAGE_SUPERVISION" /> |
| 24 | <!-- Reads per-app foreground time so a daily cap can resume mid-day after a reboot instead |
| 25 | of handing back a fresh budget. This is an appop, not a role grant: it is declared here |
| 26 | but the permission half is signature|privileged and we are not a priv-app, so the op |
| 27 | stays at MODE_DEFAULT (denied) until we set it ourselves - see UsageAccess. --> |
| 28 | <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" |
| 29 | tools:ignore="ProtectedPermissions" /> |
| 30 | <!-- Lets UsageAccess set the usage-stats app-op on our own uid, which is the only way this |
| 31 | app can read foreground time (see above). Part of the SYSTEM_SUPERVISION role's grant, |
| 32 | gated upstream on android.permission.flags.supervision_role_enabled - ENABLED on this |
| 33 | build. Managing app ops is inherent to what a supervision app does, but it is a broad |
| 34 | permission and is taken only for that one op on our own uid. --> |
| 35 | <uses-permission android:name="android.permission.MANAGE_APP_OPS_MODES" |
| 36 | tools:ignore="ProtectedPermissions" /> |
| 37 | <!-- Re-arms the bedtime alarm and the usage observers after a restart. Both are boot-scoped, |
| 38 | so without this a reboot silently ends supervision. --> |
| 39 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
| 40 | <!-- Bedtime is a promise about a specific minute, so the alarm has to be exact. --> |
| 41 | <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" /> |
| 42 | <!-- The app-limits and bedtime screens list launchable apps to choose between. --> |
| 43 | <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" |
| 44 | tools:ignore="QueryAllPackagesPermission" /> |
| 45 | <!-- Restriction notices (limit spent, window opened) tap through to the lock screens. --> |
| 46 | <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> |
| 47 | |
| 48 | <!-- Not requested, deliberately: no INTERNET. Nothing here leaves the device - the schedule, |
| 49 | the caps and which apps they cover are all local, and there is no account to sync to. --> |
| 50 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" |
| 51 | tools:node="remove" /> |
| 52 | |
| 53 | <application |
| 54 | android:allowBackup="false" |
| 55 | android:dataExtractionRules="@xml/data_extraction_rules" |
| 56 | android:icon="@mipmap/ic_launcher" |
| 57 | android:label="@string/app_name" |
| 58 | android:roundIcon="@mipmap/ic_launcher" |
| 59 | android:supportsRtl="true" |
| 60 | android:theme="@style/Theme.General"> |
| 61 | <!-- |
| 62 | **No launcher activity.** Supervision is something a parent reaches through |
| 63 | Settings > Parental controls, which is where every control actually lives - this app |
| 64 | owns none of them. An icon would open a screen that could only say "go to Settings". |
| 65 | |
| 66 | It is also how the platform expects a supervision app to behave: the role is |
| 67 | `visible="false"` in roles.xml, and Settings resolves this app by role rather than by |
| 68 | anything the user launches. |
| 69 | --> |
| 70 | |
| 71 | <!-- |
| 72 | The service Settings binds to, and the reason the Parental controls entry exists at all. |
| 73 | |
| 74 | `SupervisionHelper.hasNecessarySupervisionComponent` queries `config_systemSupervision` |
| 75 | for exactly this action; when nothing answers it, |
| 76 | `TopLevelSupervisionPreferenceController` reports UNSUPPORTED_ON_DEVICE and the whole |
| 77 | feature is hidden - which is why parental controls appeared to be missing from the OS |
| 78 | rather than merely switched off. |
| 79 | |
| 80 | `exported` is true because the caller is Settings, in another process. The service |
| 81 | checks who is calling; see SupervisionMessengerService. |
| 82 | --> |
| 83 | <service |
| 84 | android:name=".service.SupervisionMessengerService" |
| 85 | android:exported="true" |
| 86 | tools:ignore="ExportedService"> |
| 87 | <intent-filter> |
| 88 | <action android:name="android.app.supervision.action.SUPERVISION_MESSENGER_SERVICE" /> |
| 89 | </intent-filter> |
| 90 | </service> |
| 91 | |
| 92 | <!-- |
| 93 | The service the platform binds, and the reason policy changes reach us at all. |
| 94 | |
| 95 | `AppBindingService` registers `SupervisionAppServiceFinder` unconditionally and it is |
| 96 | enabled by default, so the system was already looking for this on our package and |
| 97 | logging a failure. It keeps the connection in the foreground and rebinds after a |
| 98 | backoff if we die. |
| 99 | |
| 100 | `BIND_SUPERVISION_APP_SERVICE` is required by the upstream contract - the platform will |
| 101 | not bind a service that anything else could bind. |
| 102 | --> |
| 103 | <service |
| 104 | android:name=".service.ParentalControlsAppService" |
| 105 | android:exported="true" |
| 106 | android:permission="android.permission.BIND_SUPERVISION_APP_SERVICE"> |
| 107 | <intent-filter> |
| 108 | <action android:name="android.app.action.SUPERVISION_APP_SERVICE" /> |
| 109 | </intent-filter> |
| 110 | </service> |
| 111 | |
| 112 | <!-- |
| 113 | The top-level "Parental controls" page. MAOS patches the platform Settings supervision |
| 114 | entry to redirect here (see vendor/modern-apps patches), so this - not the AOSP |
| 115 | supervision dashboard - is what the user sees. Exported because Settings launches it |
| 116 | from another process; the page is read-only and every change is behind the parent PIN. |
| 117 | --> |
| 118 | <!-- |
| 119 | The single navigation host. Every former editor activity below is an alias |
| 120 | onto this host, keeping its own label, permission, intent-filter and Settings |
| 121 | meta-data, so Settings rows land exactly where they did; MainActivity.routeFor |
| 122 | turns the arriving intent into the start route (gated editors start at their |
| 123 | PIN gate). singleTask so a second Settings tap re-routes via onNewIntent. |
| 124 | --> |
| 125 | <activity |
| 126 | android:name=".MainActivity" |
| 127 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 128 | android:exported="true" |
| 129 | android:label="@string/dashboard_title" |
| 130 | android:launchMode="singleTask" |
| 131 | android:theme="@style/Theme.General" /> |
| 132 | |
| 133 | <!-- The top-level "Parental controls" page (was DashboardActivity). --> |
| 134 | <activity-alias |
| 135 | android:name=".ui.DashboardActivity" |
| 136 | android:exported="true" |
| 137 | android:label="@string/dashboard_title" |
| 138 | android:targetActivity=".MainActivity"> |
| 139 | <intent-filter> |
| 140 | <action android:name="com.vayunmathur.parentalcontrols.action.DASHBOARD" /> |
| 141 | <category android:name="android.intent.category.DEFAULT" /> |
| 142 | </intent-filter> |
| 143 | <intent-filter> |
| 144 | <action android:name="android.app.supervision.action.INTERSTITIAL_SCREEN" /> |
| 145 | <category android:name="android.intent.category.DEFAULT" /> |
| 146 | </intent-filter> |
| 147 | </activity-alias> |
| 148 | |
| 149 | <!-- Web content filters: dashboard-only, so no intent-filter (was WebContentFiltersActivity). --> |
| 150 | <activity-alias |
| 151 | android:name=".ui.WebContentFiltersActivity" |
| 152 | android:exported="false" |
| 153 | android:label="@string/web_filters_title" |
| 154 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 155 | android:targetActivity=".MainActivity" /> |
| 156 | |
| 157 | <!-- |
| 158 | The parental-control features themselves. |
| 159 | |
| 160 | AOSP ships no bedtime or app-limit UI: SupervisionDashboardScreen declares an EMPTY |
| 161 | preference group and nothing in the tree fills it. Rows appear only for activities |
| 162 | tagged with the supervision category below, which DashboardFragmentRegistry maps to |
| 163 | SupervisionDashboardFragment. These two meta-data tags are therefore the entire reason |
| 164 | Parental controls has anything in it. |
| 165 | |
| 166 | Still no launcher entry: these are reached from Settings, and an icon would be a second |
| 167 | route to a screen that only makes sense in that context. |
| 168 | --> |
| 169 | <activity-alias |
| 170 | android:name=".ui.BedtimeActivity" |
| 171 | android:exported="true" |
| 172 | android:label="@string/bedtime_title" |
| 173 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 174 | android:targetActivity=".MainActivity"> |
| 175 | <intent-filter> |
| 176 | <action android:name="com.vayunmathur.parentalcontrols.action.BEDTIME" /> |
| 177 | <category android:name="android.intent.category.DEFAULT" /> |
| 178 | </intent-filter> |
| 179 | <meta-data |
| 180 | android:name="com.android.settings.category" |
| 181 | android:value="com.android.settings.category.ia.supervision" /> |
| 182 | <meta-data |
| 183 | android:name="com.android.settings.summary" |
| 184 | android:resource="@string/bedtime_summary" /> |
| 185 | </activity-alias> |
| 186 | |
| 187 | <activity-alias |
| 188 | android:name=".ui.AppLimitsActivity" |
| 189 | android:exported="true" |
| 190 | android:label="@string/limits_title" |
| 191 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 192 | android:targetActivity=".MainActivity"> |
| 193 | <intent-filter> |
| 194 | <action android:name="com.vayunmathur.parentalcontrols.action.APP_LIMITS" /> |
| 195 | <category android:name="android.intent.category.DEFAULT" /> |
| 196 | </intent-filter> |
| 197 | <meta-data |
| 198 | android:name="com.android.settings.category" |
| 199 | android:value="com.android.settings.category.ia.supervision" /> |
| 200 | <meta-data |
| 201 | android:name="com.android.settings.summary" |
| 202 | android:resource="@string/limits_summary" /> |
| 203 | </activity-alias> |
| 204 | |
| 205 | <!-- |
| 206 | The Family Link set: downtime, school time and the device-wide daily limit. Same |
| 207 | Settings-dashboard integration as bedtime and app limits - one row each, filled only |
| 208 | because of the supervision category tags. All three are parent-gated in the host |
| 209 | (Route.PinGate); the MANAGE_SUPERVISION permission here keeps other apps from |
| 210 | opening them directly. |
| 211 | --> |
| 212 | <activity-alias |
| 213 | android:name=".ui.DowntimeActivity" |
| 214 | android:exported="true" |
| 215 | android:label="@string/downtime_title" |
| 216 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 217 | android:targetActivity=".MainActivity"> |
| 218 | <intent-filter> |
| 219 | <action android:name="com.vayunmathur.parentalcontrols.action.DOWNTIME" /> |
| 220 | <category android:name="android.intent.category.DEFAULT" /> |
| 221 | </intent-filter> |
| 222 | <meta-data |
| 223 | android:name="com.android.settings.category" |
| 224 | android:value="com.android.settings.category.ia.supervision" /> |
| 225 | <meta-data |
| 226 | android:name="com.android.settings.summary" |
| 227 | android:resource="@string/downtime_summary" /> |
| 228 | </activity-alias> |
| 229 | |
| 230 | <activity-alias |
| 231 | android:name=".ui.SchoolTimeActivity" |
| 232 | android:exported="true" |
| 233 | android:label="@string/school_title" |
| 234 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 235 | android:targetActivity=".MainActivity"> |
| 236 | <intent-filter> |
| 237 | <action android:name="com.vayunmathur.parentalcontrols.action.SCHOOL_TIME" /> |
| 238 | <category android:name="android.intent.category.DEFAULT" /> |
| 239 | </intent-filter> |
| 240 | <meta-data |
| 241 | android:name="com.android.settings.category" |
| 242 | android:value="com.android.settings.category.ia.supervision" /> |
| 243 | <meta-data |
| 244 | android:name="com.android.settings.summary" |
| 245 | android:resource="@string/school_summary" /> |
| 246 | </activity-alias> |
| 247 | |
| 248 | <activity-alias |
| 249 | android:name=".ui.DailyLimitActivity" |
| 250 | android:exported="true" |
| 251 | android:label="@string/daily_title" |
| 252 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 253 | android:targetActivity=".MainActivity"> |
| 254 | <intent-filter> |
| 255 | <action android:name="com.vayunmathur.parentalcontrols.action.DAILY_LIMIT" /> |
| 256 | <category android:name="android.intent.category.DEFAULT" /> |
| 257 | </intent-filter> |
| 258 | <meta-data |
| 259 | android:name="com.android.settings.category" |
| 260 | android:value="com.android.settings.category.ia.supervision" /> |
| 261 | <meta-data |
| 262 | android:name="com.android.settings.summary" |
| 263 | android:resource="@string/daily_summary" /> |
| 264 | </activity-alias> |
| 265 | |
| 266 | <!-- |
| 267 | Where Settings sends the user for "app settings" of a supervision app. Without an |
| 268 | activity answering this, `createSupervisionAppPreference` throws IllegalStateException |
| 269 | and the app never appears under "Apps managing this device". Bedtime is the most useful |
| 270 | landing point, so it is an alias rather than a third screen. |
| 271 | --> |
| 272 | <activity-alias |
| 273 | android:name=".ui.ManageAlias" |
| 274 | android:exported="true" |
| 275 | android:label="@string/app_name" |
| 276 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 277 | android:targetActivity=".MainActivity"> |
| 278 | <intent-filter> |
| 279 | <action android:name="android.settings.MANAGE_SUPERVISION_APP_SETTINGS" /> |
| 280 | <category android:name="android.intent.category.DEFAULT" /> |
| 281 | </intent-filter> |
| 282 | </activity-alias> |
| 283 | |
| 284 | <!-- Clock, date and timezone changes: re-derive windows and re-arm alarms in the |
| 285 | new local time instead of leaving boundaries armed in the old one. System |
| 286 | broadcasts only; not exported. --> |
| 287 | <receiver |
| 288 | android:name=".platform.TimeChangedReceiver" |
| 289 | android:exported="false"> |
| 290 | <intent-filter> |
| 291 | <action android:name="android.intent.action.TIME_SET" /> |
| 292 | <action android:name="android.intent.action.TIMEZONE_CHANGED" /> |
| 293 | <action android:name="android.intent.action.DATE_CHANGED" /> |
| 294 | </intent-filter> |
| 295 | </receiver> |
| 296 | |
| 297 | <!-- Fired by UsageStatsService when an app spends its daily budget. Not exported: the |
| 298 | PendingIntent we hand the platform is what delivers it. --> |
| 299 | <receiver |
| 300 | android:name=".platform.LimitReachedReceiver" |
| 301 | android:exported="false" /> |
| 302 | |
| 303 | <!-- The next bedtime boundary. Re-armed each time it fires. --> |
| 304 | <receiver |
| 305 | android:name=".platform.BedtimeReceiver" |
| 306 | android:exported="false" /> |
| 307 | |
| 308 | <receiver |
| 309 | android:name=".platform.BootReceiver" |
| 310 | android:exported="true" |
| 311 | android:permission="android.permission.BIND_SUPERVISION_APP_SERVICE"> |
| 312 | <intent-filter> |
| 313 | <action android:name="android.intent.action.BOOT_COMPLETED" /> |
| 314 | </intent-filter> |
| 315 | </receiver> |
| 316 | |
| 317 | <!-- Our own update replaced the APK and killed the process: re-arm alarms, |
| 318 | usage observers and policy state, or supervision stays off until the next |
| 319 | boot or window boundary. Self-protection beyond this (and the boot re-arm |
| 320 | above) is not something a normal app can do - Device Admin cannot stop a |
| 321 | force-stop and an accessibility service watching Settings would be an |
| 322 | abuse vector, so neither is declared here; preventing force-stop or |
| 323 | uninstall outright is a platform (MAOS) property of the supervision role's |
| 324 | placement, not app code. See parentalcontrols/AGENTS.md. --> |
| 325 | <receiver |
| 326 | android:name=".platform.PackageReplacedReceiver" |
| 327 | android:exported="false"> |
| 328 | <intent-filter> |
| 329 | <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> |
| 330 | </intent-filter> |
| 331 | </receiver> |
| 332 | |
| 333 | <!-- |
| 334 | The second half of the availability test. `getSupervisionAppInstallActivityInfo` looks |
| 335 | for this action so Settings can show the entry *before* supervision has been set up - |
| 336 | on a device where the supervision app still has to be installed, this is the row's |
| 337 | destination. Ours is already installed, so it hands straight over to the platform's own |
| 338 | setup flow rather than duplicating it. |
| 339 | --> |
| 340 | <activity |
| 341 | android:name=".ui.SetupActivity" |
| 342 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 343 | android:exported="true" |
| 344 | android:launchMode="singleTask" |
| 345 | android:theme="@style/Theme.General"> |
| 346 | <intent-filter> |
| 347 | <action android:name="android.app.supervision.action.INSTALL_SUPERVISION_APP" /> |
| 348 | <category android:name="android.intent.category.DEFAULT" /> |
| 349 | </intent-filter> |
| 350 | </activity> |
| 351 | |
| 352 | <!-- |
| 353 | The parent-PIN challenge as an activity, kept for the lock screens: they run |
| 354 | outside the navigation host and start it for a result (RESULT_VERIFIED grants |
| 355 | bonus time), a contract a route cannot answer. Inside the host the same |
| 356 | PinGateScreen is Route.PinGate. Not exported and guarded by MANAGE_SUPERVISION, |
| 357 | so even an explicit intent from elsewhere cannot open it. (PIN setup is now |
| 358 | Route.PinSetup in the host, so its former activity is gone.) |
| 359 | --> |
| 360 | <activity |
| 361 | android:name=".ui.PinGateActivity" |
| 362 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 363 | android:exported="false" |
| 364 | android:permission="android.permission.MANAGE_SUPERVISION" |
| 365 | android:theme="@style/Theme.General" /> |
| 366 | |
| 367 | <!-- |
| 368 | Full-screen restriction notices, one per block reason. None exported: started |
| 369 | explicitly by our own receivers and notifications. showWhenLocked is set in code so |
| 370 | the child meets the reason over the keyguard, not a home screen. |
| 371 | --> |
| 372 | <activity |
| 373 | android:name=".ui.BedtimeLockActivity" |
| 374 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 375 | android:exported="false" |
| 376 | android:theme="@style/Theme.General" /> |
| 377 | <activity |
| 378 | android:name=".ui.DowntimeLockActivity" |
| 379 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 380 | android:exported="false" |
| 381 | android:theme="@style/Theme.General" /> |
| 382 | <activity |
| 383 | android:name=".ui.SchoolTimeLockActivity" |
| 384 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 385 | android:exported="false" |
| 386 | android:theme="@style/Theme.General" /> |
| 387 | <activity |
| 388 | android:name=".ui.DailyLimitLockActivity" |
| 389 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 390 | android:exported="false" |
| 391 | android:theme="@style/Theme.General" /> |
| 392 | <activity |
| 393 | android:name=".ui.AppLimitLockActivity" |
| 394 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 395 | android:exported="false" |
| 396 | android:theme="@style/Theme.General" /> |
| 397 | </application> |
| 398 | </manifest> |