Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / emergency / src / main / AndroidManifest.xml
AndroidManifest.xml340 lines · 17.9 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 | A like-for-like replacement for GrapheneOS's EmergencyInfo |
| 6 | (platform_packages_apps_EmergencyInfo, package com.android.emergency), namespaced to |
| 7 | com.vayunmathur.emergency because a Gradle-built app cannot be platform-signed. |
| 8 | |
| 9 | Component contract mirrored 1:1 (see C:\Users\Vayun\.llms\plans\maos_emergency_app.plan.md): |
| 10 | view/edit activities answering the same platform actions (EDIT_EMERGENCY_INFO plus |
| 11 | the legacy EDIT_MEDICAL_INFO filter on the same editor), the Settings |
| 12 | suggestion alias, the ia.emergency injection alias, the SystemUI SOS entry alias |
| 13 | (LAUNCH_EMERGENCY, MANAGE_SENSOR_PRIVACY-guarded like stock), the search |
| 14 | indexables provider, the FileProvider for avatar photos, and the gesture provider |
| 15 | speaking the settingslib EmergencyNumberUtils call() protocol against our own |
| 16 | authorities. |
| 17 | |
| 18 | Privileged-only declarations (MANAGE_USERS, WRITE_SECURE_SETTINGS, CALL_PRIVILEGED, |
| 19 | READ_PRIVILEGED_PHONE_STATE) follow the parentalcontrols/screentime precedent: declared |
| 20 | with ProtectedPermissions ignored, used only inside runCatching with an explicit denied |
| 21 | path. They stay inert until the MAOS build promotes this app; nothing crashes without |
| 22 | them. The one deliberate omission is EmergencyDialerTrampoline (DIAL_EMERGENCY), which |
| 23 | GrapheneOS itself ships disabled - we delegate call placement to Settings, we are not |
| 24 | a dialer. |
| 25 | --> |
| 26 | <!-- Countdown vibration waveform during the SOS countdown. --> |
| 27 | <uses-permission android:name="android.permission.VIBRATE" /> |
| 28 | <!-- The SOS receiver fires the call broadcast from the background alarm. --> |
| 29 | <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" /> |
| 30 | <!-- The SOS countdown runs as a foreground service with its notification. --> |
| 31 | <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> |
| 32 | <!-- specialUse foreground subtype for the SOS countdown service. --> |
| 33 | <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" /> |
| 34 | <!-- Reads the SIM emergency-number list so the SOS screen names the real number. --> |
| 35 | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> |
| 36 | <!-- Privileged half of emergency-number lookup. Inert without priv-app promotion. --> |
| 37 | <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" |
| 38 | tools:ignore="ProtectedPermissions" /> |
| 39 | <!-- Places the fallback emergency call when Settings' emergency provider is absent. --> |
| 40 | <uses-permission android:name="android.permission.CALL_PHONE" /> |
| 41 | <!-- Guards the gesture provider, mirroring GrapheneOS. Inert without promotion. --> |
| 42 | <uses-permission android:name="android.permission.CALL_PRIVILEGED" |
| 43 | tools:ignore="ProtectedPermissions" /> |
| 44 | <!-- Emergency contacts are read from the contacts provider. Runtime grant. --> |
| 45 | <uses-permission android:name="android.permission.READ_CONTACTS" /> |
| 46 | <!-- Owner name/icon on the view screen. Graceful fallback without it. --> |
| 47 | <uses-permission android:name="android.permission.MANAGE_USERS" |
| 48 | tools:ignore="ProtectedPermissions" /> |
| 49 | <!-- Gesture provider persists EMERGENCY_GESTURE_* to Settings.Secure. Priv-only. --> |
| 50 | <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" |
| 51 | tools:ignore="ProtectedPermissions" /> |
| 52 | <!-- The SOS alarm must fire at the exact countdown end. --> |
| 53 | <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" /> |
| 54 | <!-- Re-arms nothing persistent, but the countdown alarm must survive reboot windows. --> |
| 55 | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
| 56 | <!-- SOS countdown and restriction-trip notices. A normal runtime permission. --> |
| 57 | <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> |
| 58 | |
| 59 | <!-- |
| 60 | Read-only Personal Health Record access, to surface allergies and current medications from |
| 61 | Health Connect on the view card. Requested from the edit screen and allowed to be refused; |
| 62 | only grantable on Android 15 with an updated Health Connect module, so on older devices the |
| 63 | card simply shows the stored fields. Mirrors the health app's medical read permissions. |
| 64 | --> |
| 65 | <uses-permission android:name="android.permission.health.READ_MEDICAL_DATA_ALLERGIES_INTOLERANCES" /> |
| 66 | <uses-permission android:name="android.permission.health.READ_MEDICAL_DATA_MEDICATIONS" /> |
| 67 | <uses-permission android:name="android.permission.health.READ_MEDICAL_DATA_CONDITIONS" /> |
| 68 | |
| 69 | <!-- Not requested, deliberately: no INTERNET. Medical info, contacts and the SOS |
| 70 | countdown are all local; the call itself goes through the telephony stack. --> |
| 71 | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" |
| 72 | tools:node="remove" /> |
| 73 | |
| 74 | <application |
| 75 | android:allowBackup="false" |
| 76 | android:dataExtractionRules="@xml/data_extraction_rules" |
| 77 | android:defaultToDeviceProtectedStorage="true" |
| 78 | android:directBootAware="true" |
| 79 | android:icon="@mipmap/ic_launcher" |
| 80 | android:label="@string/app_name" |
| 81 | android:roundIcon="@mipmap/ic_launcher" |
| 82 | android:supportsRtl="true" |
| 83 | android:theme="@style/Theme.General"> |
| 84 | <!-- |
| 85 | Read-only view: medical info + emergency contacts, reachable over the lock screen. |
| 86 | Answers android.telephony.action.EMERGENCY_ASSISTANCE like GrapheneOS's |
| 87 | ViewInfoActivity. No launcher entry - reached from Settings, the lock screen and |
| 88 | the SOS flow, the same way EmergencyInfo is. |
| 89 | --> |
| 90 | <activity |
| 91 | android:name=".ui.ViewInfoActivity" |
| 92 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 93 | android:exported="true" |
| 94 | android:label="@string/app_name" |
| 95 | android:launchMode="singleTask" |
| 96 | android:showWhenLocked="true" |
| 97 | android:taskAffinity="com.android.settings" |
| 98 | android:theme="@style/Theme.General"> |
| 99 | <intent-filter> |
| 100 | <action android:name="android.telephony.action.EMERGENCY_ASSISTANCE" /> |
| 101 | <category android:name="android.intent.category.DEFAULT" /> |
| 102 | </intent-filter> |
| 103 | </activity> |
| 104 | |
| 105 | <!-- |
| 106 | Edit entry: contacts + medical info. Answers android.settings.EDIT_EMERGENCY_INFO |
| 107 | like GrapheneOS's EditInfoActivity, and also android.emergency.EDIT_MEDICAL_INFO |
| 108 | like its EditMedicalInfoActivity: stock splits those across two activities, but |
| 109 | our editor already covers both, so both filters land here and the legacy action |
| 110 | keeps resolving. |
| 111 | --> |
| 112 | <activity |
| 113 | android:name=".ui.EditInfoActivity" |
| 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/app_name" |
| 117 | android:launchMode="singleTask" |
| 118 | android:taskAffinity="com.android.settings" |
| 119 | android:theme="@style/Theme.General"> |
| 120 | <intent-filter> |
| 121 | <action android:name="android.settings.EDIT_EMERGENCY_INFO" /> |
| 122 | <category android:name="android.intent.category.DEFAULT" /> |
| 123 | </intent-filter> |
| 124 | <intent-filter> |
| 125 | <action android:name="android.emergency.EDIT_MEDICAL_INFO" /> |
| 126 | <category android:name="android.intent.category.DEFAULT" /> |
| 127 | </intent-filter> |
| 128 | </activity> |
| 129 | |
| 130 | <!-- |
| 131 | Settings first-run suggestion, independent of the edit activity so it can be |
| 132 | disabled once any info or contact is set (see EmergencyRepository). Mirrors |
| 133 | GrapheneOS's EditInfoSuggestion alias. |
| 134 | --> |
| 135 | <activity-alias |
| 136 | android:name=".ui.EditInfoSuggestion" |
| 137 | android:exported="true" |
| 138 | android:label="@string/app_name" |
| 139 | android:targetActivity=".ui.EditInfoActivity"> |
| 140 | <intent-filter> |
| 141 | <action android:name="android.intent.action.MAIN" /> |
| 142 | <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" /> |
| 143 | </intent-filter> |
| 144 | <meta-data |
| 145 | android:name="com.android.settings.dismiss" |
| 146 | android:value="11,15,30" /> |
| 147 | <meta-data |
| 148 | android:name="com.android.settings.title" |
| 149 | android:resource="@string/settings_suggestion_title" /> |
| 150 | <meta-data |
| 151 | android:name="com.android.settings.summary" |
| 152 | android:resource="@string/settings_suggestion_body" /> |
| 153 | <meta-data |
| 154 | android:name="com.android.settings.icon" |
| 155 | android:resource="@mipmap/ic_launcher" /> |
| 156 | </activity-alias> |
| 157 | |
| 158 | <!-- |
| 159 | The Settings > Safety & emergency row. Mirrors GrapheneOS's EmergencyInfoActivity |
| 160 | alias: same IA_SETTINGS action, same ia.emergency category, same order and profile. |
| 161 | --> |
| 162 | <activity-alias |
| 163 | android:name=".ui.EmergencyInfoAlias" |
| 164 | android:exported="false" |
| 165 | android:icon="@mipmap/ic_launcher" |
| 166 | android:label="@string/app_name" |
| 167 | android:targetActivity=".ui.EditInfoActivity"> |
| 168 | <intent-filter> |
| 169 | <action android:name="com.android.settings.action.IA_SETTINGS" /> |
| 170 | <category android:name="android.intent.category.DEFAULT" /> |
| 171 | </intent-filter> |
| 172 | <meta-data |
| 173 | android:name="com.android.settings.category" |
| 174 | android:value="com.android.settings.category.ia.emergency" /> |
| 175 | <meta-data |
| 176 | android:name="com.android.settings.order" |
| 177 | android:value="60" /> |
| 178 | <meta-data |
| 179 | android:name="com.android.settings.icon" |
| 180 | android:resource="@mipmap/ic_launcher" /> |
| 181 | <meta-data |
| 182 | android:name="com.android.settings.icon_tintable" |
| 183 | android:value="true" /> |
| 184 | <meta-data |
| 185 | android:name="com.android.settings.summary" |
| 186 | android:resource="@string/injection_summary_empty" /> |
| 187 | <meta-data |
| 188 | android:name="com.android.settings.profile" |
| 189 | android:value="primary_profile_only" /> |
| 190 | </activity-alias> |
| 191 | |
| 192 | <!-- |
| 193 | The SOS countdown screen, reached from the power-button gesture via SystemUI |
| 194 | (see the SosEntryPoint alias below). Not exported: only the platform gesture |
| 195 | path (or our own notification action) starts it explicitly. turnScreenOn wakes |
| 196 | the device when the gesture fires with the screen off; noHistory keeps back |
| 197 | from returning to the countdown; finishing without cancel hands the countdown |
| 198 | to the foreground service. All three mirror stock's EmergencyActionActivity. |
| 199 | --> |
| 200 | <activity |
| 201 | android:name=".ui.SosActivity" |
| 202 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 203 | android:directBootAware="true" |
| 204 | android:excludeFromRecents="true" |
| 205 | android:exported="false" |
| 206 | android:launchMode="singleInstance" |
| 207 | android:noHistory="true" |
| 208 | android:showWhenLocked="true" |
| 209 | android:turnScreenOn="true" |
| 210 | android:theme="@style/Theme.General" /> |
| 211 | |
| 212 | <!-- |
| 213 | SystemUI entry point for the power-button SOS gesture. Mirrors stock's |
| 214 | EmergencyAction alias: exported, MANAGE_SENSOR_PRIVACY-guarded, answering |
| 215 | com.android.systemui.action.LAUNCH_EMERGENCY. SystemUI resolves this action |
| 216 | with MATCH_SYSTEM_ONLY and prefers config_preferredEmergencySosPackage, which |
| 217 | MAOS leaves empty, so the first (only) match wins - no SystemUI patch needed. |
| 218 | The target stays non-exported exactly like stock's EmergencyActionActivity. |
| 219 | --> |
| 220 | <activity-alias |
| 221 | android:name=".ui.SosEntryPoint" |
| 222 | android:directBootAware="true" |
| 223 | android:exported="true" |
| 224 | android:label="@string/sos_channel_name" |
| 225 | android:permission="android.permission.MANAGE_SENSOR_PRIVACY" |
| 226 | android:targetActivity=".ui.SosActivity"> |
| 227 | <intent-filter> |
| 228 | <action android:name="com.android.systemui.action.LAUNCH_EMERGENCY" /> |
| 229 | <category android:name="android.intent.category.DEFAULT" /> |
| 230 | </intent-filter> |
| 231 | </activity-alias> |
| 232 | |
| 233 | <!-- |
| 234 | SOS countdown service: notification + exact alarm + vibration + warning sound. |
| 235 | Not exported: started explicitly by the SOS screen and the receiver. |
| 236 | specialUse, following screentime's FocusService: this is not an ongoing call |
| 237 | (phoneCall type would need FOREGROUND_SERVICE_PHONE_CALL and misdescribes a |
| 238 | countdown), it keeps the gesture countdown alive while the screen is off. |
| 239 | --> |
| 240 | <service |
| 241 | android:name=".service.SosCountdownService" |
| 242 | android:directBootAware="true" |
| 243 | android:exported="false" |
| 244 | android:foregroundServiceType="specialUse"> |
| 245 | <property |
| 246 | android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" |
| 247 | android:value="Counts down to placing an emergency call so the gesture survives the screen turning off." /> |
| 248 | </service> |
| 249 | |
| 250 | <!-- |
| 251 | SOS outcomes: MAKE places the call (via Settings' emergency provider, falling back |
| 252 | to an explicit emergency-call intent) and CANCEL stops the service. Not exported: |
| 253 | both are explicit-class intents from our own notification, alarm and screen. |
| 254 | --> |
| 255 | <receiver |
| 256 | android:name=".receiver.SosActionReceiver" |
| 257 | android:exported="false"> |
| 258 | <intent-filter> |
| 259 | <action android:name="com.vayunmathur.emergency.broadcast.MAKE_EMERGENCY_CALL" /> |
| 260 | <action android:name="com.vayunmathur.emergency.broadcast.CANCEL_EMERGENCY_COUNTDOWN" /> |
| 261 | </intent-filter> |
| 262 | </receiver> |
| 263 | |
| 264 | <!-- Settings search indexing for the emergency rows. --> |
| 265 | <provider |
| 266 | android:name=".platform.EmergencySearchIndexablesProvider" |
| 267 | android:authorities="com.vayunmathur.emergency" |
| 268 | android:exported="true" |
| 269 | android:grantUriPermissions="true" |
| 270 | android:multiprocess="false" |
| 271 | android:permission="android.permission.READ_SEARCH_INDEXABLES"> |
| 272 | <intent-filter> |
| 273 | <action android:name="android.content.action.SEARCH_INDEXABLES_PROVIDER" /> |
| 274 | </intent-filter> |
| 275 | </provider> |
| 276 | |
| 277 | <!-- Avatar photo sharing for the medical-info editor. --> |
| 278 | <provider |
| 279 | android:name="androidx.core.content.FileProvider" |
| 280 | android:authorities="com.vayunmathur.emergency.files" |
| 281 | android:exported="false" |
| 282 | android:grantUriPermissions="true"> |
| 283 | <meta-data |
| 284 | android:name="android.support.FILE_PROVIDER_PATHS" |
| 285 | android:resource="@xml/file_paths" /> |
| 286 | </provider> |
| 287 | |
| 288 | <!-- |
| 289 | Gesture state for Settings: number override, gesture/sound toggles, UI-showing |
| 290 | heartbeat. Mirrors GrapheneOS's EmergencyGestureContentProvider call() protocol; |
| 291 | CALL_PRIVILEGED guards it the same way. Query/insert/update/delete throw. |
| 292 | Both authorities serve the same class/state: ours for the MAOS build (whose |
| 293 | SettingsLib is rewired to it) and the stock com.android.emergency.gesture for |
| 294 | unpatched Settings, whose ContentResolver.call() throws IllegalArgumentException |
| 295 | on an unknown authority and crashes Settings on resume. Safe while stock |
| 296 | EmergencyInfo is absent (MAOS removes it); a co-installed stock app would |
| 297 | conflict at install time instead of silently shadowing. |
| 298 | --> |
| 299 | <provider |
| 300 | android:name=".platform.GestureProvider" |
| 301 | android:authorities="com.vayunmathur.emergency.gesture;com.android.emergency.gesture" |
| 302 | android:exported="true" |
| 303 | android:permission="android.permission.CALL_PRIVILEGED" /> |
| 304 | |
| 305 | <!-- |
| 306 | Health Connect requires an app that reads medical data to answer the permissions |
| 307 | rationale intent, and to expose a VIEW_PERMISSION_USAGE entry point. Both mirror the |
| 308 | health app: the rationale screen can be empty, and the alias points Settings at it. |
| 309 | --> |
| 310 | <activity |
| 311 | android:name=".ui.PermissionsRationaleActivity" |
| 312 | android:exported="true"> |
| 313 | <intent-filter> |
| 314 | <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" /> |
| 315 | </intent-filter> |
| 316 | </activity> |
| 317 | |
| 318 | <activity-alias |
| 319 | android:name="ViewPermissionUsageActivity" |
| 320 | android:exported="true" |
| 321 | android:permission="android.permission.START_VIEW_PERMISSION_USAGE" |
| 322 | android:targetActivity=".ui.PermissionsRationaleActivity"> |
| 323 | <intent-filter> |
| 324 | <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" /> |
| 325 | <category android:name="android.intent.category.HEALTH_PERMISSIONS" /> |
| 326 | </intent-filter> |
| 327 | </activity-alias> |
| 328 | </application> |
| 329 | |
| 330 | <!-- Avatar capture in the medical-info editor. --> |
| 331 | <queries> |
| 332 | <intent> |
| 333 | <action android:name="android.media.action.IMAGE_CAPTURE" /> |
| 334 | </intent> |
| 335 | <intent> |
| 336 | <action android:name="android.intent.action.GET_CONTENT" /> |
| 337 | <data android:mimeType="image/*" /> |
| 338 | </intent> |
| 339 | </queries> |
| 340 | </manifest> |