The request arrived, but Settings stayed open
On September 1, 2026, opening Settings from home page two on a physical device and pressing HOME left Settings open. Sending a HOME Intent directly did the same. The app’s entry Activity, MainActivity, received the request, so we traced what happened afterward.
Trace who handles a request after receipt
Receiving an external request and performing the required action are separate events. Follow the receiver beyond the entry log and check whether it exists on the current screen. Settings cannot rely on a handler that exists only inside home.
Return home from a layer shared by all screens
We moved HOME handling into shared navigation management. The request reduces screen history to home. Home resets its temporary interaction state once it appears again.
Letting shared navigation manage transitions and each screen manage its own state avoids directly manipulating the internals of an absent screen.
Separate similar actions with different purposes
Returning to the first page through HOME differs from restoring the last page during normal redisplay. Combining them into “always show page one” risks fixing one behavior while breaking the other.
Code from the Fix
The following excerpts illustrate the fix; some examples omit surrounding code.
LaunchedEffect(homeRequests) {
homeRequests.collect {
homeResetRequested = true
backStack.returnToRoot()
}
}
Change the screen on which the request arrives
Send the same request while Settings or the app list is open, not only while home is displayed. Combining screens and pages helps expose a missing receiver.
Notifications, incoming links, and connection changes can use the same reasoning. Place handlers according to when they need to exist, rather than the visual screen hierarchy.
No comments:
Post a Comment