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

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

AndroidManifest.xml450 lines · 24.5 KiBRaw
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
4 <!-- The projection session outlives any activity: it is bound to the cable or the wireless
5 link, not to a screen the user is looking at. -->
6 <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
7 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
8 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
9 <uses-permission android:name="android.permission.WAKE_LOCK" />
10 <!-- The head unit connects in over TCP. For the Desktop Head Unit that is an adb forward
11 to loopback; for a real car it is the wireless link. -->
12 <uses-permission android:name="android.permission.INTERNET" />
13 <!-- Bringing up the WiFi link to a wireless head unit. This is also what qualifies
14 ProjectionService for the connectedDevice foreground type: that check accepts a USB
15 accessory only when one is physically attached and permission-granted, so the USB
16 filter below does not satisfy it on its own. -->
17 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
18 <!-- WiFi Direct discovery toward the wireless head unit, plus the Bluetooth
19 scan that finds it. Both are runtime-gated on the pairing screen
20 (NEARBY_WIFI_DEVICES covers the WiFi half on S+). -->
21 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
22 <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
23 <!-- Android 12+ requires COARSE alongside FINE; the guidance monitor
24 degrades to last-known without either (fail-closed), never crashes. -->
25 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
26 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
27 <uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
28 <!-- Restart the projection listener after a reboot; the session is bound to
29 the cable or the wireless link, not to an activity. -->
30 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
31 <!-- Retaining a car-mic voice turn for transcription. The ch6 channel
32 itself needs no permission (chunks are acked and counted regardless);
33 without this grant the phone keeps no voice data (fail-closed). -->
34 <uses-permission android:name="android.permission.RECORD_AUDIO" />
35 <!-- Music capture into the ch5 media sink: AudioPlaybackCapture of the USAGE_MEDIA
36 mix needs the media-projection consent dialog, whose foreground service type
37 is mediaProjection. The capture runs only while consented in-app AND granted
38 here; either off means fail-closed silence on the head unit. -->
39 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
40 <!-- Background survival on API 34+ without a visible activity: the
41 projection service declares the connectedDevice type (permission
42 declared up top with the base FOREGROUND_SERVICE). The old
43 microphone/location types are gone (see the service declaration):
44 nothing captures device audio or reads device location directly,
45 and claiming them crashed cold start on fresh installs. The runtime
46 RECORD_AUDIO / location grants still gate their own features (ch6
47 retention, ch7 phone seed) and are requested in-app. -->
48 <!-- Wireless bring-up (BT_START -> RFCOMM -> TCP): discovery, association
49 and the socket all need the Bluetooth family. The CDM trigger
50 (CarCompanionDeviceService) additionally needs the association trio
51 below; the pairing-screen stand-in path needs SCAN+CONNECT. -->
52 <uses-permission android:name="android.permission.BLUETOOTH" />
53 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
54 <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
55 <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
56 <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
57 <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS" />
58 <!-- Projected calls + message/call templates: the InCall pair
59 (CarProjection/non-car) and reading the threads the mirror posts.
60 Without these the call UI stays on the phone and restricted message
61 data never reaches the car (fail-closed silence). -->
62 <uses-permission android:name="android.permission.CALL_PHONE" />
63 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
64 <uses-permission android:name="android.permission.READ_CALL_LOG" />
65 <uses-permission android:name="android.permission.READ_CONTACTS" />
66 <uses-permission android:name="android.permission.RECEIVE_SMS" />
67 <uses-permission android:name="android.permission.SEND_SMS" />
68 <uses-permission android:name="android.permission.READ_CALENDAR" />
69 <uses-permission android:name="android.permission.RECEIVE_SENSITIVE_NOTIFICATIONS" />
70 <uses-permission android:name="android.permission.GET_INTENT_SENDER_INTENT" />
71 <!-- Wired auto-launch/role-switch/reset: the USB receivers and the reset
72 chain. Privapp-gated (see the allowlist note below): without the
73 allowlist entry this is inert and USB falls back to the plain
74 attach/permission/open path, which needs no privileged grant. -->
75 <uses-permission android:name="android.permission.MANAGE_USB" />
76 <!-- Audio routing + telephony/in-call control + background launch: the
77 sinks route to the car speakers (not the phone), the InCall pair
78 controls the call, and background starts fire the startup chain.
79 Privapp-gated like MANAGE_USB (see below). -->
80 <uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING" />
81 <uses-permission android:name="android.permission.TETHER_PRIVILEGED" />
82 <uses-permission android:name="android.permission.POWER_SAVER" />
83 <uses-permission android:name="android.permission.MANAGE_USERS" />
84 <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
85 <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
86 <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
87 <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" />
88 <uses-permission android:name="android.permission.CALL_PRIVILEGED" />
89 <!-- Trusted display + projection control + secure capture: the virtual
90 display route (TRUSTED vs PRIVATE), the projection toggle, and
91 secure surfaces. Without these the display stays private-only and
92 secure content renders black on the head unit. -->
93 <uses-permission android:name="android.permission.ADD_TRUSTED_DISPLAY" />
94 <uses-permission android:name="android.permission.ADD_ALWAYS_UNLOCKED_DISPLAY" />
95 <uses-permission android:name="android.permission.CREATE_VIRTUAL_DEVICE" />
96 <uses-permission android:name="android.permission.TOGGLE_AUTOMOTIVE_PROJECTION" />
97 <uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT" />
98 <!-- Companion-device trigger for wireless: the CDM service
99 (CarCompanionDeviceService) associates with the automotive-projection
100 profile and fires the BT_START chain. Without these the association
101 never forms and wireless stays on the pairing-screen stand-in. -->
102 <uses-permission android:name="android.permission.ASSOCIATE_COMPANION_DEVICES" />
103 <uses-permission android:name="android.permission.REQUEST_COMPANION_PROFILE_AUTOMOTIVE_PROJECTION" />
104 <uses-permission android:name="android.permission.REQUEST_COMPANION_SELF_MANAGED" />
105 <uses-permission android:name="android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS" />
106 <uses-permission android:name="android.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE" />
107 <!-- Background/trusted launch: the startup chain (BT_START,
108 START_USB_PROJECTION, deep links) and car-mode entry fire without a
109 visible activity. Without these the chain can only start while the
110 app is foreground. -->
111 <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
112 <uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED" />
113 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
114 <uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES" />
115 <!-- Do-not-disturb state for the rail status cluster (DND icon): reading
116 the interruption filter needs the policy grant; without it the icon
117 stays gone (fail-closed), like every other absent source. -->
118 <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
119 <!-- Privapp allowlist half (mirrors the MAOS role half in MaosRole):
120 com.vayunmathur.auto must additionally allowlist MANAGE_USB,
121 MODIFY_AUDIO_ROUTING, TETHER_PRIVILEGED, CALL_PRIVILEGED,
122 POWER_SAVER, READ_PRIVILEGED_PHONE_STATE,
123 CHANGE_COMPONENT_ENABLED_STATE, MANAGE_USERS,
124 CAPTURE_SECURE_VIDEO_OUTPUT, BLUETOOTH_PRIVILEGED,
125 CONTROL_INCALL_EXPERIENCE and MODIFY_PHONE_STATE. Both halves are
126 boot-fatal if wrong: land one at a time. Gearhead's GMS-signed
127 host permissions (NAVIGATION_TEMPLATES, ACCESS_SURFACE,
128 GEARHEAD_SERVICE, START_PROJECTED_ACTIVITY) are not declarable by
129 third parties and stay absent on purpose. -->
130
131 <!-- The car launcher resolves Maps / Music / dialer through PackageManager. Android 11+
132 hides other apps by default, so these queries keep those lookups visible. The media
133 monitor also resolves the music browser service through getServiceInfo, which needs
134 no query entry, but the explicit package row keeps the intent clear. -->
135 <queries>
136 <package android:name="com.vayunmathur.maps" />
137 <package android:name="com.vayunmathur.music" />
138 <package android:name="com.vayunmathur.communicate" />
139 <intent>
140 <action android:name="android.media.browse.MediaBrowserService" />
141 </intent>
142 <intent>
143 <action android:name="android.intent.action.DIAL" />
144 <data android:scheme="tel" />
145 </intent>
146 <!-- Third-party car apps: the launcher discovers CarAppService
147 implementations per category (navigation, POI, IoT, weather) and
148 hosts their templates generically. -->
149 <intent>
150 <action android:name="androidx.car.app.CarAppService" />
151 <category android:name="androidx.car.app.category.NAVIGATION" />
152 </intent>
153 <intent>
154 <action android:name="androidx.car.app.CarAppService" />
155 <category android:name="androidx.car.app.category.POI" />
156 </intent>
157 <intent>
158 <action android:name="androidx.car.app.CarAppService" />
159 <category android:name="androidx.car.app.category.IOT" />
160 </intent>
161 <intent>
162 <action android:name="androidx.car.app.CarAppService" />
163 <category android:name="androidx.car.app.category.WEATHER" />
164 </intent>
165 <intent>
166 <action android:name="androidx.car.app.CarAppService" />
167 <category android:name="androidx.car.app.category.MESSAGING" />
168 </intent>
169 </queries>
170
171 <application
172 android:allowBackup="false"
173 android:dataExtractionRules="@xml/data_extraction_rules"
174 android:icon="@mipmap/ic_launcher"
175 android:label="@string/app_name"
176 android:roundIcon="@mipmap/ic_launcher"
177 android:supportsRtl="true"
178 android:theme="@style/Theme.General">
179
180 <activity
181 android:name=".MainActivity"
182 android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
183 android:exported="true"
184 android:launchMode="singleTop"
185 android:theme="@style/Theme.General">
186 <intent-filter>
187 <action android:name="android.intent.action.MAIN" />
188 <category android:name="android.intent.category.LAUNCHER" />
189 </intent-filter>
190 <!-- Plugging into a head unit puts the phone into AOAP accessory mode and
191 Android hands the connection to whoever matches, which is also how the app
192 gets launched on plug-in. -->
193 <intent-filter>
194 <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
195 </intent-filter>
196 <meta-data
197 android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
198 android:resource="@xml/usb_accessory_filter" />
199 </activity>
200
201 <!-- No `microphone`/`location` types: the service never captures
202 device audio or reads device location directly. The ch6 mic path
203 reads GAL chunks off the socket (acked/counted permission-free;
204 RECORD_AUDIO gates only in-memory retention), and the ch7 phone
205 seed flows through `NavGuidanceMonitor` (all `runCatching`-
206 guarded, degrades to last-known). Claiming either type crashes
207 cold start on a fresh install (no grant yet) with
208 SecurityException: that was the recurring crash. -->
209 <service
210 android:name=".service.ProjectionService"
211 android:exported="false"
212 android:foregroundServiceType="connectedDevice" />
213 <!-- Holds the media-projection token while music capture runs. Started
214 only after the user grants the consent dialog (see MusicCaptureGrant):
215 on API 34+ an FGS with type mediaProjection cannot start before the
216 projection is registered, so this lives apart from ProjectionService
217 rather than widening its foreground type and crashing bring-up. -->
218 <service
219 android:name=".service.MusicCaptureService"
220 android:exported="false"
221 android:foregroundServiceType="mediaProjection" />
222
223 <!-- Answers the USB permission round-trip and accessory detach while no
224 activity is up; both funnel into UsbConnector. The permission action
225 is app-private (setPackage on request). The force-start chain action
226 (CarStartupService START_USB_PROJECTION) funnels there too. -->
227 <receiver
228 android:name=".platform.UsbReceiver"
229 android:exported="false">
230 <intent-filter>
231 <action android:name="com.vayunmathur.auto.USB_PERMISSION" />
232 <action android:name="android.hardware.usb.action.USB_ACCESSORY_DETACHED" />
233 <action android:name="com.vayunmathur.auto.USB_ACCESSORY_FORCE_START" />
234 </intent-filter>
235 </receiver>
236
237 <!-- TPlus head-unit announce/detach: funnels into the same USB attach
238 path (see UsbTPlusReceiver); the framing difference is HU-side. -->
239 <receiver
240 android:name=".platform.UsbTPlusReceiver"
241 android:exported="false">
242 <intent-filter>
243 <action android:name="com.vayunmathur.auto.USB_TPLUS_ATTACHED" />
244 <action android:name="com.vayunmathur.auto.USB_TPLUS_DETACHED" />
245 </intent-filter>
246 </receiver>
247
248 <!-- USB role/port/gadget/function resets: re-arms the projection
249 listener after the stack re-enumerates (see
250 ConnectionResetReceiver). MA-defined equivalents of gearhead's
251 internal reset chain. -->
252 <receiver
253 android:name=".platform.ConnectionResetReceiver"
254 android:exported="false">
255 <intent-filter>
256 <action android:name="com.vayunmathur.auto.RESET_USB_PORT" />
257 <action android:name="com.vayunmathur.auto.RESET_GADGET" />
258 <action android:name="com.vayunmathur.auto.RESET_ROLES" />
259 <action android:name="com.vayunmathur.auto.RESET_FUNCTION" />
260 </intent-filter>
261 </receiver>
262
263 <!-- Link changes under a wireless session (see
264 ConnectivityEventReceiver). -->
265 <receiver
266 android:name=".platform.ConnectivityEventReceiver"
267 android:exported="false">
268 <intent-filter>
269 <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
270 </intent-filter>
271 </receiver>
272
273 <!-- Re-starts the projection listener after a reboot or an app
274 update. Runs in :car like gearhead's init receiver; both the boot
275 and the replaced actions restart plus republish the role. -->
276 <receiver
277 android:name=".platform.BootReceiver"
278 android:exported="true"
279 android:process=":car">
280 <intent-filter>
281 <action android:name="android.intent.action.BOOT_COMPLETED" />
282 <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
283 </intent-filter>
284 </receiver>
285
286 <!-- Mirrors phone message notifications onto the projection session's
287 ch14 owner via MessageMirrorBus. The system binds this itself once
288 the user enables MA Auto in notification-access settings; posting
289 additionally requires the in-app consent switch (MessagingPrefs),
290 so either gate off means fail-closed silence. Single-user (one
291 listener across profiles would double-mirror), sensitive
292 notifications permitted (templates would otherwise arrive empty),
293 and the mirror filter declares the CATEGORY_MESSAGE gate. -->
294 <service
295 android:name=".notifications.MessageMirrorService"
296 android:exported="true"
297 android:label="@string/messaging_headline"
298 android:singleUser="true"
299 android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
300 <intent-filter>
301 <action android:name="android.service.notification.NotificationListenerService" />
302 </intent-filter>
303 <meta-data
304 android:name="com.vayunmathur.auto.MIRROR_FILTER"
305 android:resource="@xml/message_mirror_filter" />
306 </service>
307
308 <!-- Projected calls (car-mode InCall half of the NonCar/CarProjection
309 split). The platform binds this in car mode with the InCall grant;
310 needs CALL_PHONE/READ_PHONE_STATE/CONTROL_INCALL_EXPERIENCE. -->
311 <service
312 android:name=".telephony.CarProjectionInCallService"
313 android:exported="true"
314 android:permission="android.permission.BIND_INCALL_SERVICE">
315 <intent-filter>
316 <action android:name="android.telecom.InCallService" />
317 </intent-filter>
318 <meta-data
319 android:name="android.telecom.IN_CALL_SERVICE_UI"
320 android:value="true" />
321 </service>
322
323 <!-- Non-car InCall half: manifest-disabled, never bound (see
324 NonCarInCallService). Declared so the package surfaces match
325 gearhead's split. -->
326 <service
327 android:name=".telephony.NonCarInCallService"
328 android:exported="false"
329 android:enabled="false"
330 android:permission="android.permission.BIND_INCALL_SERVICE">
331 <intent-filter>
332 <action android:name="android.telecom.InCallService" />
333 </intent-filter>
334 </service>
335
336 <!-- Companion-device trigger for wireless projection (CDM,
337 automotive-projection profile). Fires the BT_START chain on
338 association; runs in :car like gearhead's. The system binds this
339 under the CDM association grant (ASSOCIATE_COMPANION_DEVICES
340 above); no separate bind permission exists for the
341 automotive-projection profile. -->
342 <service
343 android:name=".platform.CarCompanionDeviceService"
344 android:exported="true"
345 android:process=":car"
346 android:permission="android.permission.ASSOCIATE_COMPANION_DEVICES">
347 <intent-filter>
348 <action android:name="android.companion.CompanionDeviceService" />
349 </intent-filter>
350 </service>
351
352 <!-- Head-unit compositor/decor bind targets (exported, like
353 gearhead's): binds are safely rejected: MA renders CarDisplay
354 into ch2 video rather than hosting HU-composited windows. -->
355 <service
356 android:name=".platform.CarSystemUiControllerService"
357 android:exported="true" />
358 <service
359 android:name=".platform.AppDecorService"
360 android:exported="true" />
361
362 <!-- Chimera entry point (GMS-compat car.service.START): funnels into
363 the projection service. Same single type as ProjectionService
364 (no mic/location types: nothing here captures device audio or
365 reads device location either). -->
366 <service
367 android:name=".platform.CarChimeraService"
368 android:exported="true"
369 android:foregroundServiceType="connectedDevice">
370 <intent-filter>
371 <action android:name="car.service.START" />
372 </intent-filter>
373 </service>
374
375 <!-- First-time setup handshake target: binds safely rejected (the
376 pairing screen owns setup). -->
377 <service
378 android:name=".platform.CarSetupService"
379 android:exported="true">
380 <intent-filter>
381 <action android:name="com.vayunmathur.auto.CAR_SETUP_SERVICE" />
382 </intent-filter>
383 </service>
384
385 <!-- Head-unit startup chain (BT_START + START_USB_PROJECTION +
386 CAR_STARTUP_NOTIFICATION): starts the phone side without the app
387 open. -->
388 <service
389 android:name=".platform.CarStartupService"
390 android:exported="true">
391 <intent-filter>
392 <action android:name="com.vayunmathur.auto.BT_START" />
393 <action android:name="com.vayunmathur.auto.START_USB_PROJECTION" />
394 <action android:name="com.vayunmathur.auto.CAR_STARTUP_NOTIFICATION" />
395 </intent-filter>
396 </service>
397
398 <!-- Wireless setup pair: the shared service owns the phone half (tap
399 stand-in or CDM MAC), the car service's bind is safely rejected
400 (credentials ride CDM/RFCOMM, not a binder). -->
401 <service
402 android:name=".platform.WirelessSetupSharedService"
403 android:exported="false" />
404 <service
405 android:name=".platform.WirelessSetupCarService"
406 android:exported="true" />
407
408 <!-- BT/WiFi state during wireless setup (ACL + adapter state). -->
409 <receiver
410 android:name=".platform.WifiBluetoothReceiver"
411 android:exported="false">
412 <intent-filter>
413 <action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
414 <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
415 <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
416 </intent-filter>
417 </receiver>
418
419 <!-- Wireless head-unit announcement: enters the BT_START chain. -->
420 <receiver
421 android:name=".platform.WirelessStartupReceiver"
422 android:exported="true">
423 <intent-filter>
424 <action android:name="com.vayunmathur.auto.WIRELESS_STARTUP" />
425 </intent-filter>
426 </receiver>
427
428 <!-- Wireless first-run entry + deep-link router: no UI, they enter
429 the startup chain and finish. -->
430 <activity
431 android:name=".platform.WirelessStartupActivity"
432 android:exported="true"
433 android:theme="@style/Theme.General"
434 android:noHistory="true"
435 android:excludeFromRecents="true" />
436 <activity
437 android:name=".platform.DeepLinkResolverActivity"
438 android:exported="true"
439 android:theme="@style/Theme.General"
440 android:noHistory="true"
441 android:excludeFromRecents="true">
442 <intent-filter>
443 <action android:name="android.intent.action.VIEW" />
444 <category android:name="android.intent.category.DEFAULT" />
445 <category android:name="android.intent.category.BROWSABLE" />
446 <data android:scheme="maauto" />
447 </intent-filter>
448 </activity>
449 </application>
450</manifest>