Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / parentalcontrols / src / main / AndroidManifest.xml

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