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

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

AndroidManifest.xml172 lines · 10.1 KiBRaw
1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
4 <uses-permission android:name="android.permission.INTERNET" />
5 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
7 <!-- Local Network Protections (Android 16+): without this NsdManager.discoverServices throws
8 SecurityException and every LAN socket is blocked, so the device list is silently empty. -->
9 <uses-permission android:name="android.permission.ACCESS_LOCAL_NETWORK" />
10
11 <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
12 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
13 <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
14 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
15 <!-- AudioRecord needs this even for playback capture, where no microphone is involved: the
16 permission gates the API, not the source. -->
17 <uses-permission android:name="android.permission.RECORD_AUDIO" />
18
19 <!-- Both halves of RemoteDisplayProviderWatcher.verifyServiceTrusted: the app must hold
20 REMOTE_DISPLAY_PROVIDER and the service must be guarded by BIND_REMOTE_DISPLAY. Failing
21 either one is not an error the user sees - the watcher logs and skips the service, and the
22 Cast page is simply empty. Signature|privileged, so it needs the priv-app allowlist entry
23 in vendor/modern-apps/privapp-permissions-modern-apps.xml. -->
24 <uses-permission android:name="android.permission.REMOTE_DISPLAY_PROVIDER" />
25 <!-- Desktop-mode audio. That path holds no MediaProjection - which is what lets it run with
26 no consent dialog - so AudioPlaybackCapture is unavailable and audio comes from
27 MediaRecorder.AudioSource.REMOTE_SUBMIX instead, the platform's own remote-display audio
28 source. REMOTE_SUBMIX is gated on this permission. Signature|privileged, so it needs the
29 priv-app allowlist entry in vendor/modern-apps/privapp-permissions-modern-apps.xml.
30 Screen mirroring does NOT use this: it keeps the projection-scoped capture, which is
31 narrower and honours each app's own allowCapture policy. -->
32 <uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT" />
33 <!-- Selecting a route in Settings has to end at CastPairActivity, which takes six digits off
34 the TV. By then Settings is in front and this app is a bound service in the background, so
35 without this the launch is silently dropped and the route sits at CONNECTING for ever.
36 protectionLevel is signature|privileged|vendorPrivileged|oem|verifier|role, so the priv-app
37 allowlist entry is what grants it. -->
38 <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
39 <!-- Lets MaRemoteDisplayProvider create the cast display with VIRTUAL_DISPLAY_FLAG_TRUSTED.
40 MediaRouterService never creates a display for a remote display route - it only reads back
41 the id the provider publishes via RemoteDisplay.setPresentationDisplayId - so the display
42 is ours to make. TRUSTED is what lets the system extend onto it and is required by
43 VIRTUAL_DISPLAY_FLAG_ALLOWS_CONTENT_MODE_SWITCH, which is what hands the mirror-vs-extend
44 choice to Settings instead of building one here.
45
46 protectionLevel is signature|role. It is NOT signature|privileged, so it does not belong in
47 privapp-permissions-modern-apps.xml - an entry there is boot-fatal. Nor is it granted by
48 platform signing: ModernAppsCast in vendor/modern-apps/Android.bp is presigned, not
49 certificate: "platform". It is carried by the SYSTEM_AUTOMOTIVE_PROJECTION role, pinned to
50 this package by config_systemAutomotiveProjection in MaosFrameworkResRRO, which is why
51 dumpsys reports it as GRANTED_BY_ROLE. Note the role auto-grants its whole permission
52 list, RECORD_AUDIO among them.
53
54 Deliberately not CAPTURE_VIDEO_OUTPUT: that gate only guards
55 VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, and ALLOWS_CONTENT_MODE_SWITCH suppresses AUTO_MIRROR
56 being added to a PUBLIC display, so the check is never reached. -->
57 <uses-permission android:name="android.permission.ADD_TRUSTED_DISPLAY" />
58
59 <uses-feature android:name="android.hardware.wifi" android:required="false" />
60
61 <permission
62 android:name="com.vayunmathur.cast.permission.STREAM_CONTENT"
63 android:label="@string/cast_stream_content_permission_label"
64 android:description="@string/cast_stream_content_permission_desc"
65 android:protectionLevel="signature" />
66
67 <application
68 android:allowBackup="true"
69 android:dataExtractionRules="@xml/data_extraction_rules"
70 android:icon="@mipmap/ic_launcher"
71 android:label="@string/app_name"
72 android:roundIcon="@mipmap/ic_launcher"
73 android:supportsRtl="true"
74 android:theme="@style/Theme.General">
75 <!-- The remote display provider API is a shared library, not part of the base framework.
76 Optional so the app still installs on a stock device, where nothing binds
77 CastRemoteDisplayService anyway. -->
78 <uses-library
79 android:name="com.android.media.remotedisplay"
80 android:required="false" />
81
82 <activity
83 android:name=".MainActivity"
84 android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
85 android:exported="true"
86 android:launchMode="singleTop"
87 android:theme="@style/Theme.General">
88 <intent-filter>
89 <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
90 </intent-filter>
91 </activity>
92 <!-- Launcher entry as an alias so MAOS can hide it (there the app's own screen-sharing UI
93 is redundant - the OS drives casting) without disabling MainActivity, which is still
94 reached as the QS tile's preferences/settings activity. CastApplication disables this
95 alias when the app is the privileged system remote-display provider (only on MAOS); on
96 an ordinary install it stays enabled and the icon shows. -->
97 <activity-alias
98 android:name=".LauncherAlias"
99 android:exported="true"
100 android:targetActivity=".MainActivity">
101 <intent-filter>
102 <action android:name="android.intent.action.MAIN" />
103 <category android:name="android.intent.category.LAUNCHER" />
104 </intent-filter>
105 </activity-alias>
106
107 <activity
108 android:name=".platform.mirror.MirrorConsentActivity"
109 android:excludeFromRecents="true"
110 android:exported="false"
111 android:launchMode="singleTop"
112 android:theme="@android:style/Theme.Translucent.NoTitleBar" />
113 <!-- The pair prompt for a route selected in Settings. Launched by
114 MaRemoteDisplayProvider over whatever is in front, on the same
115 START_ACTIVITIES_FROM_BACKGROUND grant MirrorConsentActivity needs. Not exported: the
116 only caller is this app's own provider, and the SDK path pairs inside
117 CastPickerActivity instead. configChanges so a rotation does not throw away digits the
118 user has already typed. -->
119 <activity
120 android:name=".platform.CastPairActivity"
121 android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
122 android:excludeFromRecents="true"
123 android:exported="false"
124 android:launchMode="singleTop"
125 android:theme="@style/Theme.CastPair" />
126
127 <activity
128 android:name=".platform.CastPickerActivity"
129 android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
130 android:excludeFromRecents="true"
131 android:exported="true"
132 android:launchMode="singleTop"
133 android:permission="com.vayunmathur.cast.permission.STREAM_CONTENT"
134 android:theme="@style/Theme.General" />
135
136 <service
137 android:name=".service.CastService"
138 android:exported="false"
139 android:foregroundServiceType="mediaProjection|mediaPlayback" />
140
141 <!-- Bound by system_server's RemoteDisplayProviderWatcher, which is what puts this app's
142 receivers in Settings' Cast page. BIND_REMOTE_DISPLAY is required by the watcher, not
143 merely prudent - see MaRemoteDisplayProvider. -->
144 <service
145 android:name=".service.CastRemoteDisplayService"
146 android:exported="true"
147 android:permission="android.permission.BIND_REMOTE_DISPLAY">
148 <intent-filter>
149 <action android:name="com.android.media.remotedisplay.RemoteDisplayProvider" />
150 </intent-filter>
151 </service>
152
153 <service
154 android:name=".service.ContentCastService"
155 android:exported="true"
156 android:permission="com.vayunmathur.cast.permission.STREAM_CONTENT" />
157
158 <service
159 android:name=".platform.mirror.MirrorTileService"
160 android:exported="true"
161 android:icon="@drawable/ic_tile_cast_mirror"
162 android:label="@string/cast_tile_label"
163 android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
164 <intent-filter>
165 <action android:name="android.service.quicksettings.action.QS_TILE" />
166 </intent-filter>
167 <meta-data
168 android:name="android.service.quicksettings.ACTIVITY"
169 android:value="com.vayunmathur.cast.MainActivity" />
170 </service>
171 </application>
172</manifest>