Skip to content

[Android] Add integration tests for SystemUiMode transitions #187265

Description

@dbebawy

Title

[Android] Add integration tests for SystemUiMode transitions

Body

Use case

The PlatformPluginTest unit tests are Mockito-based — they verify which APIs are called on a mocked Window/View, but they cannot observe residual decorView state that bleeds across mode switches. This is exactly the gap that allowed #186723 to ship: switching immersiveSticky → edgeToEdge left FLAG_FULLSCREEN/FLAG_HIDE_NAVIGATION set on the decor view from the prior mode, but no unit test could see that because each test instantiated a fresh mock.

We should add Android instrumentation/integration tests that exercise the full transition matrix between SystemUiMode values and assert the resulting window insets / system-bar visibility on a real (or emulated) device.

Proposal

Add a new entrypoint under dev/integration_tests/android_engine_test/ (which already uses SystemChrome.setEnabledSystemUIMode) that drives the following matrix:

→ leanBack → immersive → immersiveSticky → edgeToEdge → manual
leanBack
immersive
immersiveSticky
edgeToEdge
manual

For each cell, after applying mode A then mode B, assert the expected post-state on the host side, e.g.:

  • edgeToEdge: WindowInsetsCompat.Type.systemBars() is visible; window does not fit system windows.
  • immersive/immersiveSticky/leanBack: status + nav bars hidden.
  • manual: only the requested overlays are visible.

These checks can be implemented on the Android side via an instrumentation test that reads WindowInsetsCompat and View.getSystemUiVisibility() after each transition completes.

Coverage targets

  • API 29 (lowest e2e-supported SDK; uses the older setSystemUiVisibility(0) clear path)
  • API 30+ (would use the modern WindowInsetsControllerCompat.show() path if PR #187207 adopts it)
  • API 35/36 with targetSdk at 35/36 (default e2e enforcement; legacy modes are ignored by the OS)

Why now

Two e2e-related changes in quick succession (#183072, #187207) and one P1 regression (#186723) indicate this code path is both fragile and under-tested at the integration level. Per #133074, the remaining modes (leanBack/immersive/immersiveSticky) will also eventually be migrated off deprecated View flags — having a transition-matrix test in place beforehand would catch the same class of bug for those migrations too.

Related

Labels (suggested)

platform-android, team-android, engine, c: tests, P2

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testsengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions