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