The OS Started Home Before Test Preparation

Friday, November 6, 2026

Android Hitoma Launcher Technical

t f B! P L

Source version containing this test-environment fix: 2.1.2.

Test ordering did not control every launch

A launcher screen could crash before an on-device instrumentation test started. Hilt, which supplies dependencies, reported “The component was not created. Check that you have added the HiltAndroidRule.” Hilt preparation had order=0 and Compose screen preparation had order=1, so the order was correct. On September 14, 2026, we investigated launches from the OS.

There are entry points outside the test

An app selected as the default home can be started by the OS without a test launching it. The early OS launch needed to be considered separately from ordinary test actions.

When changing test configuration, distinguish settings for the test APK from those for the target APK. Changing one does not update the other.

Receive only test-time OS launches in an empty screen

In test-managed Activity creation, we replace only OS HOME launches with an empty screen requiring no injected dependencies. Direct launches from ordinary screen tests use the real screen. Production configuration remains unchanged.

The replacement is limited to testing, the home-screen target, and an OS HOME launch so other entry points are preserved.

Check the bypassed behavior through another route

The workaround does not open the real screen through an OS HOME request. Production HOME behavior must therefore be checked with the normal application, without that replacement.

Stabilizing a test can hide the path where a problem occurs. Consider what the workaround stops exercising as well as what it makes possible.

Code from the Fix

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

val activityClassName = if (
    className == MainActivity::class.java.name &&
    intent.action == Intent.ACTION_MAIN &&
    intent.hasCategory(Intent.CATEGORY_HOME)
) {
    Activity::class.java.name
} else {
    className
}

Include externally started work in ordering problems

Correctly ordering preparation and execution does not control every external event. Distinguishing work your code starts from work started by the OS or another app helps organize startup failures.

References

Search This Blog

QooQ