emergency: add Route host for view and edit, keep SOS activity (#nav)
- Commit
5e6e32289410e64960c704c0dc5d6ad850f3c8d0- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-16 19:59 UTC (19 days ago)
- Parents
8493b34
Emergency had no Route or MainNavigation at all: ViewInfoActivity, EditInfoActivity and SosActivity were three ComponentActivity shells, so which surface was showing lived in the activity stack - invisible to the Route system and impossible to re-route when a second Settings entry arrived while one was already running. Add Route (Sos / ViewInfo / EditInfo), a MainActivity host (MaActivity, singleTask) rendering Navigation.kt over a rememberNavBackStack, and MainActivity.routeFor mapping entry intents to start routes, following the screentime host. Direct editor entries stack ViewInfo below EditInfo so back returns to the view card; onNewIntent re-routes a running host instead of stacking a second activity, and the host refreshes the shared EmergencyViewModel on resume as both old activities did. EditInfoPage (the pick/permission launcher wiring) is now called from the EditInfo entry instead of EditInfoActivity. Per-entry decisions, from mapping every manifest entry first: - EMERGENCY_ASSISTANCE (ViewInfoActivity): becomes an alias onto the host. The host itself carries the old activity's showWhenLocked, directBootAware, singleTask and settings taskAffinity, so the view card still opens over the lock screen before unlock; the alias keeps the name, exported flag, label and filter. - EDIT_EMERGENCY_INFO and EDIT_MEDICAL_INFO (EditInfoActivity): alias onto the host, both filters preserved. The editor is only launched from Settings after unlock, so sharing the host's showWhenLocked does not expose editing on the lock screen. - EditInfoSuggestion (FIRST_IMPRESSION) and EmergencyInfoAlias (IA_SETTINGS ia.emergency, with its order/category/summary/profile meta-data): retargeted from EditInfoActivity to the host, filters and meta-data untouched. - LAUNCH_EMERGENCY (SosEntryPoint alias, MANAGE_SENSOR_PRIVACY) and SosActivity: STAYS a separate activity, deliberately not routed into the host. It is singleInstance, turnScreenOn, showWhenLocked, noHistory, excludeFromRecents and directBootAware: merging it into the singleTask host would either break the power-gesture wake and countdown-recents behaviour or infect the Settings host with them. Instead SosActivity renders Route.Sos through a one-destination SosNavigation host, so the destination is a real Route without weakening the countdown. SosCoordinator, the countdown screen, SosCountdownService and SosActionReceiver are unchanged, and SosActivity.intent/intentForDeadline/remainingForIntent keep their exact semantics (deadline intents still age in real time). - PermissionsRationaleActivity and the ViewPermissionUsage alias: unchanged. They are Health Connect system contract surfaces (an intentionally bare rationale screen), not user navigation. SosNotifications and SosCountdownService still start SosActivity by explicit class intent, which still resolves. Tests: ActivitiesTest launches the host with the assistance and edit intents instead of the removed activities, asserts routeFor for both edit actions plus the default, and checks direct-boot on the host; the SOS activity tests are untouched. Verified: ./gradlew :emergency:compileDevKotlin :emergency:testDevUnitTest green.
Diff
emergency/AGENTS.md
diff --git a/emergency/AGENTS.md b/emergency/AGENTS.mdindex 2069ea1254..3688271d97 100644--- a/emergency/AGENTS.md+++ b/emergency/AGENTS.md@@ -6,7 +6,7 @@ _Install: ./install emergency (dev by default)._ <!-- last-reviewed: 2026-10-16 --> - Gradle: :emergency / dir: emergency/ - Package roots present: ui, data, domain, platform, service, notifications-- Entry files: ui/SosScreen.kt + ui/ViewInfoScreen.kt (no MainActivity/Route — system SOS surfaces, not a nav app)+- Entry files: MainActivity.kt, Route.kt, Navigation.kt + ui/SosScreen.kt (SosActivity stays separate; see Navigation.kt) - Deps: (none declared) - Metadata: metadata_data/emergency.md (present) - Rust: no / screenshotTest: yes@@ -14,7 +14,7 @@ _Install: ./install emergency (dev by default)._ ## Overview **Purpose:** OS emergency surfaces — lockscreen medical info (Health Connect allergies/meds), emergency contacts, SOS countdown with slide-cancel + warning sound. 100% offline. **Key features:** `data/EmergencyRepository` (info, imported FHIR medical, contacts) → `platform/SosCoordinator` → `service/SosCountdownService` + `receiver/SosActionReceiver` → `notifications/SosNotifications`; gesture trigger provider + number lookup with override.-**Entry points:** `ui/SosScreen.kt` / `ui/ViewInfoScreen.kt` → `platform/SosCoordinator.kt` → `service/SosCountdownService.kt` → `data/EmergencyRepository.kt`.+**Entry points:** `MainActivity.kt` (ViewInfo/EditInfo host) + `ui/SosScreen.kt` SosActivity (Route.Sos host) → `platform/SosCoordinator.kt` → `service/SosCountdownService.kt` → `data/EmergencyRepository.kt`. **Gotchas:** - `receiver/` is NOT a closed package root — pending migration; don't add more files there - SOS dials the real local emergency number — never trigger calls in tests, previews, or screenshots@@ -22,6 +22,9 @@ _Install: ./install emergency (dev by default)._ ## Key files ### ui/ — SOS + info surfaces (the entries)+- com/vayunmathur/emergency/MainActivity.kt+- com/vayunmathur/emergency/Route.kt+- com/vayunmathur/emergency/Navigation.kt - com/vayunmathur/emergency/ui/SosScreen.kt - com/vayunmathur/emergency/ui/ViewInfoScreen.kt - com/vayunmathur/emergency/ui/EditInfoScreen.kt
emergency/src/main/AndroidManifest.xml
diff --git a/emergency/src/main/AndroidManifest.xml b/emergency/src/main/AndroidManifest.xmlindex b7a4032b02..2628247f25 100644--- a/emergency/src/main/AndroidManifest.xml+++ b/emergency/src/main/AndroidManifest.xml@@ -92,8 +92,20 @@ ViewInfoActivity. No launcher entry - reached from Settings, the lock screen and the SOS flow, the same way EmergencyInfo is. -->+ <!--+ The single info host. Every former activity entry point below is an alias+ onto this host, keeping its own label, exported flag, intent-filter and+ Settings meta-data; MainActivity.routeFor turns the arriving intent into+ the start route (ViewInfo for EMERGENCY_ASSISTANCE, EditInfo for the edit+ actions). singleTask so a second Settings tap re-routes the running host+ via onNewIntent instead of stacking hosts. showWhenLocked and+ directBootAware are preserved from the old ViewInfoActivity so the view+ card still opens over the lock screen before unlock; the editor is only+ launched from Settings after unlock. SOS deliberately does NOT route+ here: SosActivity keeps its own entry below.+ --> <activity- android:name=".ui.ViewInfoActivity"+ android:name=".MainActivity" android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:directBootAware="true" android:exported="true"@@ -101,12 +113,20 @@ android:launchMode="singleTask" android:showWhenLocked="true" android:taskAffinity="com.android.settings"- android:theme="@style/Theme.General">+ android:theme="@style/Theme.General" />++ <!-- The lock-screen view card, answering EMERGENCY_ASSISTANCE. -->+ <activity-alias+ android:name=".ui.ViewInfoActivity"+ android:directBootAware="true"+ android:exported="true"+ android:label="@string/app_name"+ android:targetActivity=".MainActivity"> <intent-filter> <action android:name="android.telephony.action.EMERGENCY_ASSISTANCE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>- </activity>+ </activity-alias> <!-- Edit entry: contacts + medical info. Answers android.settings.EDIT_EMERGENCY_INFO@@ -115,14 +135,12 @@ our editor already covers both, so both filters land here and the legacy action keeps resolving. -->- <activity+ <!-- The editor entry: EDIT_EMERGENCY_INFO plus the legacy EDIT_MEDICAL_INFO. -->+ <activity-alias android:name=".ui.EditInfoActivity"- android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:exported="true" android:label="@string/app_name"- android:launchMode="singleTask"- android:taskAffinity="com.android.settings"- android:theme="@style/Theme.General">+ android:targetActivity=".MainActivity"> <intent-filter> <action android:name="android.settings.EDIT_EMERGENCY_INFO" /> <category android:name="android.intent.category.DEFAULT" />@@ -131,7 +149,7 @@ <action android:name="android.emergency.EDIT_MEDICAL_INFO" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>- </activity>+ </activity-alias> <!-- Settings first-run suggestion, independent of the edit activity so it can be@@ -142,7 +160,7 @@ android:name=".ui.EditInfoSuggestion" android:exported="true" android:label="@string/app_name"- android:targetActivity=".ui.EditInfoActivity">+ android:targetActivity=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" />@@ -170,7 +188,7 @@ android:exported="false" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"- android:targetActivity=".ui.EditInfoActivity">+ android:targetActivity=".MainActivity"> <intent-filter> <action android:name="com.android.settings.action.IA_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" />
emergency/src/main/java/com/vayunmathur/emergency/MainActivity.kt
diff --git a/emergency/src/main/java/com/vayunmathur/emergency/MainActivity.kt b/emergency/src/main/java/com/vayunmathur/emergency/MainActivity.ktnew file mode 100644index 0000000000..005ff62734--- /dev/null+++ b/emergency/src/main/java/com/vayunmathur/emergency/MainActivity.kt@@ -0,0 +1,71 @@+package com.vayunmathur.emergency++import android.content.Intent+import androidx.activity.viewModels+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.setValue+import com.vayunmathur.emergency.platform.EmergencyViewModel+import com.vayunmathur.library.ui.MaActivity++/**+ * The single info host, reached from Settings and the lock screen.+ *+ * Every former activity entry point is an alias onto this host (see the+ * manifest): the emergency-assistance action lands on [Route.ViewInfo]+ * and the edit actions on [Route.EditInfo], and [routeFor] turns the+ * arriving intent into the start destination. Intents that arrive while+ * the host is already running are re-routed through [pendingRoute]+ * instead of stacking a second activity. The host is showWhenLocked and+ * directBootAware so the view card keeps working over the lock screen+ * before unlock, exactly as ViewInfoActivity did; the editor is only+ * ever launched from Settings after unlock. The SOS countdown stays in+ * SosActivity: its singleInstance, turnScreenOn, noHistory and+ * excludeFromRecents semantics must not leak into this host, and this+ * host's singleTask Settings task must not leak into the countdown.+ */+class MainActivity : MaActivity() {++ private val viewModel: EmergencyViewModel by viewModels()++ private var initialRoute: Route = Route.ViewInfo+ private var pendingRoute by mutableStateOf<Route?>(null)++ override fun onCreateBeforeContent() {+ initialRoute = routeFor(intent)+ }++ @Composable+ override fun Content() {+ Navigation(+ viewModel = viewModel,+ initialRoute = initialRoute,+ externalRoute = pendingRoute,+ onExternalRouteConsumed = { pendingRoute = null },+ )+ }++ override fun onNewIntent(intent: Intent) {+ super.onNewIntent(intent)+ setIntent(intent)+ pendingRoute = routeFor(intent)+ }++ override fun onResume() {+ super.onResume()+ viewModel.refresh()+ }++ companion object {+ const val ACTION_EDIT_EMERGENCY_INFO = "android.settings.EDIT_EMERGENCY_INFO"+ const val ACTION_EDIT_MEDICAL_INFO = "android.emergency.EDIT_MEDICAL_INFO"+ const val ACTION_EMERGENCY_ASSISTANCE = "android.telephony.action.EMERGENCY_ASSISTANCE"++ /** The route an entry intent names; the view card is the default landing. */+ fun routeFor(intent: Intent?): Route = when (intent?.action) {+ ACTION_EDIT_EMERGENCY_INFO, ACTION_EDIT_MEDICAL_INFO -> Route.EditInfo+ else -> Route.ViewInfo+ }+ }+}
emergency/src/main/java/com/vayunmathur/emergency/Navigation.kt
diff --git a/emergency/src/main/java/com/vayunmathur/emergency/Navigation.kt b/emergency/src/main/java/com/vayunmathur/emergency/Navigation.ktnew file mode 100644index 0000000000..91cfea95ba--- /dev/null+++ b/emergency/src/main/java/com/vayunmathur/emergency/Navigation.kt@@ -0,0 +1,71 @@+package com.vayunmathur.emergency++import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.lifecycle.compose.collectAsStateWithLifecycle+import com.vayunmathur.emergency.platform.EmergencyViewModel+import com.vayunmathur.emergency.platform.SosCoordinator+import com.vayunmathur.emergency.ui.EditInfoPage+import com.vayunmathur.emergency.ui.SosScreen+import com.vayunmathur.emergency.ui.ViewInfoScreen+import com.vayunmathur.library.util.DetailPage+import com.vayunmathur.library.util.FullscreenPage+import com.vayunmathur.library.util.ListPage+import com.vayunmathur.library.util.MainNavigation+import com.vayunmathur.library.util.rememberNavBackStack++/**+ * Navigation host for the info surfaces: view and edit.+ *+ * The SOS countdown is not hosted here: it keeps its own activity (see+ * SosActivity in the manifest) and renders through [SosNavigation], so the+ * shared graph has all three destinations without the countdown inheriting+ * this host's task or the host inheriting the countdown's lock-screen,+ * single-instance, no-history semantics.+ */+@Composable+fun Navigation(+ viewModel: EmergencyViewModel,+ initialRoute: Route = Route.ViewInfo,+ externalRoute: Route? = null,+ onExternalRouteConsumed: () -> Unit = {},+) {+ val backStack = if (initialRoute == Route.ViewInfo) {+ rememberNavBackStack<Route>(Route.ViewInfo)+ } else {+ rememberNavBackStack<Route>(Route.ViewInfo, initialRoute)+ }++ LaunchedEffect(externalRoute) {+ val route = externalRoute ?: return@LaunchedEffect+ when (route) {+ Route.ViewInfo -> backStack.reset(Route.ViewInfo)+ Route.EditInfo -> backStack.reset(Route.ViewInfo, Route.EditInfo)+ Route.Sos -> Unit // never routed into this host; SosActivity owns it+ }+ onExternalRouteConsumed()+ }++ MainNavigation(backStack) {+ entry<Route.ViewInfo>(metadata = ListPage()) {+ val state by viewModel.state.collectAsStateWithLifecycle()+ ViewInfoScreen(state = state)+ }+ entry<Route.EditInfo>(metadata = DetailPage()) {+ EditInfoPage(viewModel = viewModel)+ }+ }+}++/** The one-destination SOS host inside SosActivity. */+@Composable+fun SosNavigation(coordinator: SosCoordinator) {+ val backStack = rememberNavBackStack<Route>(Route.Sos)+ MainNavigation(backStack) {+ entry<Route.Sos>(metadata = FullscreenPage()) {+ val state by coordinator.state.collectAsStateWithLifecycle()+ SosScreen(state = state, actions = coordinator)+ }+ }+}
emergency/src/main/java/com/vayunmathur/emergency/Route.kt
diff --git a/emergency/src/main/java/com/vayunmathur/emergency/Route.kt b/emergency/src/main/java/com/vayunmathur/emergency/Route.ktnew file mode 100644index 0000000000..1f8fab75d5--- /dev/null+++ b/emergency/src/main/java/com/vayunmathur/emergency/Route.kt@@ -0,0 +1,20 @@+package com.vayunmathur.emergency++import com.vayunmathur.library.util.NavKey+import kotlinx.serialization.Serializable++@Serializable+/** Navigation destinations for the emergency surfaces. */+sealed interface Route : NavKey {+ @Serializable+ /** The SOS countdown. Hosted by SosActivity, not the main host (see its manifest entry). */+ data object Sos : Route++ @Serializable+ /** Read-only medical info and contacts, reachable over the lock screen. */+ data object ViewInfo : Route++ @Serializable+ /** The medical-info and emergency-contacts editor. */+ data object EditInfo : Route+}
emergency/src/main/java/com/vayunmathur/emergency/ui/EditInfoScreen.kt
diff --git a/emergency/src/main/java/com/vayunmathur/emergency/ui/EditInfoScreen.kt b/emergency/src/main/java/com/vayunmathur/emergency/ui/EditInfoScreen.ktindex d17bfc812a..a9e4282db0 100644--- a/emergency/src/main/java/com/vayunmathur/emergency/ui/EditInfoScreen.kt+++ b/emergency/src/main/java/com/vayunmathur/emergency/ui/EditInfoScreen.kt@@ -2,13 +2,8 @@ package com.vayunmathur.emergency.ui import android.Manifest import android.content.Intent-import android.os.Bundle import android.provider.ContactsContract-import androidx.activity.ComponentActivity import androidx.activity.compose.rememberLauncherForActivityResult-import androidx.activity.compose.setContent-import androidx.activity.enableEdgeToEdge-import androidx.activity.viewModels import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding@@ -52,29 +47,9 @@ import com.vayunmathur.library.ui.appBarScrollBehavior * `READ_CONTACTS`, requested here. Allergies and medications are never typed here - * they are read from Health Connect, which this screen only offers to connect. */-class EditInfoActivity : ComponentActivity() {-- private val viewModel: EmergencyViewModel by viewModels()-- override fun onCreate(savedInstanceState: Bundle?) {- super.onCreate(savedInstanceState)- enableEdgeToEdge()- setContent {- DynamicTheme {- EditInfoPage(viewModel = viewModel)- }- }- }-- override fun onResume() {- super.onResume()- viewModel.refresh()- }-}- /** Binds the ViewModel to the stateless screen, owning the pick/permission launchers. */ @Composable-private fun EditInfoPage(viewModel: EmergencyViewModel) {+fun EditInfoPage(viewModel: EmergencyViewModel) { val state by viewModel.state.collectAsStateWithLifecycle() val pickContact = rememberLauncherForActivityResult( ActivityResultContracts.StartActivityForResult(),
emergency/src/main/java/com/vayunmathur/emergency/ui/SosScreen.kt
diff --git a/emergency/src/main/java/com/vayunmathur/emergency/ui/SosScreen.kt b/emergency/src/main/java/com/vayunmathur/emergency/ui/SosScreen.ktindex bfd51eb6da..773af55071 100644--- a/emergency/src/main/java/com/vayunmathur/emergency/ui/SosScreen.kt+++ b/emergency/src/main/java/com/vayunmathur/emergency/ui/SosScreen.kt@@ -30,7 +30,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider-import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vayunmathur.emergency.R import com.vayunmathur.emergency.platform.SosActions import com.vayunmathur.emergency.platform.SosCoordinator@@ -72,8 +71,7 @@ class SosActivity : ComponentActivity() { enableEdgeToEdge() setContent { DynamicTheme {- val state by coordinator.state.collectAsStateWithLifecycle()- SosScreen(state = state, actions = coordinator)+ com.vayunmathur.emergency.SosNavigation(coordinator) } } }
emergency/src/main/java/com/vayunmathur/emergency/ui/ViewInfoScreen.kt
diff --git a/emergency/src/main/java/com/vayunmathur/emergency/ui/ViewInfoScreen.kt b/emergency/src/main/java/com/vayunmathur/emergency/ui/ViewInfoScreen.ktindex 770966c240..0f828fd7d5 100644--- a/emergency/src/main/java/com/vayunmathur/emergency/ui/ViewInfoScreen.kt+++ b/emergency/src/main/java/com/vayunmathur/emergency/ui/ViewInfoScreen.kt@@ -1,10 +1,5 @@ package com.vayunmathur.emergency.ui -import android.os.Bundle-import androidx.activity.ComponentActivity-import androidx.activity.compose.setContent-import androidx.activity.enableEdgeToEdge-import androidx.activity.viewModels import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth@@ -18,7 +13,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp-import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.vayunmathur.emergency.R import com.vayunmathur.emergency.data.AllergyCriticality import com.vayunmathur.emergency.data.EmergencyInfo@@ -29,43 +23,11 @@ import com.vayunmathur.emergency.data.normalizeOrganDonor import com.vayunmathur.emergency.platform.EmergencyUiState import com.vayunmathur.emergency.platform.EmergencyViewModel import com.vayunmathur.library.ui.Card-import com.vayunmathur.library.ui.DynamicTheme import com.vayunmathur.library.ui.LazyListScaffold import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.ui.verticalShape -/**- * Read-only emergency info, reachable over the lock screen.- *- * Answers `android.telephony.action.EMERGENCY_ASSISTANCE` like GrapheneOS's- * ViewInfoActivity: the owner's medical details and emergency contacts for a first- * responder. Editing lives only in Settings (the ia.emergency injection) - there is- * deliberately no edit entry here and no top bar: a responder reads this under stress,- * so the content starts at the top and every datum is a large centered segment in a- * labelled group. Groups use [verticalShape] so each reads as one block.- */-class ViewInfoActivity : ComponentActivity() {-- private val viewModel: EmergencyViewModel by viewModels()-- override fun onCreate(savedInstanceState: Bundle?) {- super.onCreate(savedInstanceState)- enableEdgeToEdge()- setContent {- DynamicTheme {- val state by viewModel.state.collectAsStateWithLifecycle()- ViewInfoScreen(state = state)- }- }- }-- override fun onResume() {- super.onResume()- viewModel.refresh()- }-}- /** The read-only info + contacts view. Stateless; the activity wires the ViewModel. */ @Composable fun ViewInfoScreen(state: EmergencyUiState) {
emergency/src/test/java/com/vayunmathur/emergency/ui/ActivitiesTest.kt
diff --git a/emergency/src/test/java/com/vayunmathur/emergency/ui/ActivitiesTest.kt b/emergency/src/test/java/com/vayunmathur/emergency/ui/ActivitiesTest.ktindex 1d30a715fb..a37ab6d73e 100644--- a/emergency/src/test/java/com/vayunmathur/emergency/ui/ActivitiesTest.kt+++ b/emergency/src/test/java/com/vayunmathur/emergency/ui/ActivitiesTest.kt@@ -1,6 +1,8 @@ package com.vayunmathur.emergency.ui import android.content.Context+import com.vayunmathur.emergency.MainActivity+import com.vayunmathur.emergency.Route import android.content.Intent import androidx.test.core.app.ApplicationProvider import org.junit.runner.RunWith@@ -63,19 +65,29 @@ class ActivitiesTest { } @Test- fun `view info activity is direct-boot aware for pre-unlock responders`() {+ fun `host activity is direct-boot aware for pre-unlock responders`() { // The lock-screen card must open after a reboot before the owner has // unlocked: the repository reads device-protected storage for exactly // this, which only works if the activity may run in direct-boot mode. val info = ctx.packageManager.getActivityInfo(- android.content.ComponentName(ctx, ViewInfoActivity::class.java), 0,+ android.content.ComponentName(ctx, MainActivity::class.java), 0, ) assertTrue(info.directBootAware) } @Test- fun `view info activity renders and refreshes on resume`() {- val controller = Robolectric.buildActivity(ViewInfoActivity::class.java)+ fun `entry intents route to view and edit destinations`() {+ assertEquals(Route.ViewInfo, MainActivity.routeFor(Intent(MainActivity.ACTION_EMERGENCY_ASSISTANCE)))+ assertEquals(Route.EditInfo, MainActivity.routeFor(Intent(MainActivity.ACTION_EDIT_EMERGENCY_INFO)))+ assertEquals(Route.EditInfo, MainActivity.routeFor(Intent(MainActivity.ACTION_EDIT_MEDICAL_INFO)))+ assertEquals(Route.ViewInfo, MainActivity.routeFor(null))+ }++ @Test+ fun `view info entry renders and refreshes on resume`() {+ val controller = Robolectric.buildActivity(+ MainActivity::class.java, Intent(MainActivity.ACTION_EMERGENCY_ASSISTANCE),+ ) val activity = controller.create().start().resume().visible().get() ShadowLooper.idleMainLooper() assertNotNull(activity)@@ -85,8 +97,10 @@ class ActivitiesTest { } @Test- fun `edit info activity renders and refreshes on resume`() {- val controller = Robolectric.buildActivity(EditInfoActivity::class.java)+ fun `edit info entry renders and refreshes on resume`() {+ val controller = Robolectric.buildActivity(+ MainActivity::class.java, Intent(MainActivity.ACTION_EDIT_EMERGENCY_INFO),+ ) val activity = controller.create().start().resume().visible().get() ShadowLooper.idleMainLooper() assertNotNull(activity)