When a Screen Changes, Update Where Requests Go

Sunday, October 25, 2026

Android Hitoma Launcher Technical

t f B! P L

Version(s) containing the fix: 2.4.0.

A new screen was requesting work from an old one

Opening widget configuration could throw an IllegalStateException in Android’s activity-result mechanism. On September 23, 2026, we found that the component holding home interaction state was still asking an old screen to launch configuration after the screen had been recreated. Its supposedly registered launch endpoint was already invalid.

Android can recreate an Activity during rotation while keeping a ViewModel that stores input and interaction state. Retaining the old screen’s operations along with that state can send requests to an endpoint that is no longer usable.

Keep state, but update the screen reference

We separated retained interaction state from requests to the current screen. When the screen changes, the request target is replaced and old result callbacks are removed. Results go to the current receiver.

Ignoring the exception leaves the stale target in place. The remedy is to reconnect to the usable screen rather than hide the failure.

Old cleanup must not remove a new connection

Replacement and cleanup need not happen in the expected order. Cleanup from an old screen can arrive after a new screen connects and accidentally remove the current connection.

Before disconnecting, check whether the target being removed is still the current target. Cleanup for the old screen must leave the new connection alone.

Code from the Fix

The following excerpts illustrate the fix; some examples omit surrounding code.

fun detach(previous: SetupAppWidget) {
    if (delegate !== previous) return
    previous.onSuccess = {}
    previous.onFailure = {}
    previous.onPinSuccess = {}
    delegate = null
}

Look at what retained objects keep referencing

When passing operations into a long-lived object, check whether they reference a screen or a connection. Keeping a value does not necessarily mean keeping the object that used to handle it.

The same reasoning applies beyond screens. References to replaceable targets should be updateable, and cleanup should identify its target. Screen replacement and restoration after process death still require separate designs.

References

Search This Blog

QooQ