thunderbird-android icon indicating copy to clipboard operation
thunderbird-android copied to clipboard

Top of screen black when selecting an email

Open leoheitmannruiz opened this issue 4 months ago • 3 comments

Checklist

  • [x] I have used the search function to see if someone else has already submitted the same bug report.
  • [x] I will describe the problem with as much detail as possible.

App

Thunderbird for Android

App version

21.0

Where did you get the app from?

F-Droid

Android version

GrapheneOS 2026071501

Device model

Google Pixel 9a

Steps to reproduce

  1. Select an email (for instance using the default right swipe action)

Expected behavior

The time and battery status and stuff shown by Android at the top of the screen are visible.

Actual behavior

The top of the screen, where Android shows the time and battery status and stuff, is black:

Image Image

Logs

No response

leoheitmannruiz avatar Jul 24 '26 12:07 leoheitmannruiz

Can confirm this on Android 16 on a Motorola Razr as well. Seems to only affect the selection screen. #11323 does appear to be a duplicate.

dani-zilla avatar Aug 03 '26 16:08 dani-zilla

I'd like to work on this. I'll investigate how selection mode updates the system bar appearance on Android 16, add focused regression coverage where practical, and report the exact checks run in the PR. AI assistance will be disclosed in the PR.

cakeni avatar Aug 04 '26 15:08 cakeni

I traced this one, so here is the cause in case it is useful either way.

The black band is AppCompat's status guard. Both Theme2.Main.Light.Common and Theme2.Main.Dark.Common set windowActionModeOverlay, so AppCompatDelegateImpl.updateStatusGuard() gives the contextual action bar a top margin equal to the status bar inset and adds a plain View behind it to cover the gap. It picks the colour of that view like this:

boolean lightStatusBar = (ViewCompat.getWindowSystemUiVisibility(v)
        & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0;
v.setBackgroundColor(lightStatusBar
        ? R.color.abc_decor_view_status_guard_light   // #ffffffff
        : R.color.abc_decor_view_status_guard);       // #ff000000

BaseActivity sets the status bar appearance with WindowInsetsControllerCompat.isAppearanceLightStatusBars. Up to API 34 that also mirrors the appearance onto the deprecated flag, because Impl30.setAppearanceLight() calls setSystemUiFlag() whenever the controller was built from a Window, which is the case here. So AppCompat's check sees it and picks the light guard. From API 35 the implementation switches to Impl35, which applies the appearance only through setSystemBarsAppearance(). Nothing sets the old flag any more, getWindowSystemUiVisibility() returns 0, and the guard falls back to black. Read from androidx.core 1.18.0, the version this project resolves.

That fits the reports. Every confirmation that names an Android version is 15 or newer: Android 16 on a Motorola Razr above, Android 17 on a Pixel 9 Pro in #11323. In the dark theme the guard is black as well, it just does not stand out, which lines up with the comment on #11323 that dark mode looks fine.

It is not GrapheneOS specific. I reproduced it on a stock Android 16 emulator in the light theme. Sampling the status bar area gives #f1edec normally, which is lightSurfaceContainer, the AppBarLayout showing through because the window is drawn edge-to-edge, and #000000 the moment a message is selected. Dumping the view hierarchy while selection mode is open shows the guard as the third child of action_bar_root, an id-less android.view.View at 0,0-1080,63, sitting on top of the app bar.

@cakeni you mentioned wanting to work on this a couple of weeks ago. I already have a fix working and verified, so I opened #11410 rather than sit on it, but if you have something in progress please say so and I will close mine in favour of yours.


Edited to correct the version boundary: I first wrote that WindowInsetsControllerCompat stops setting the deprecated flag from API 30, which is wrong. Impl30 does still set it when it has a Window; the behaviour changes at API 35 with Impl35. The conclusion is the same, but the earlier wording had the cutoff in the wrong place.

snowykte0426 avatar Aug 15 '26 10:08 snowykte0426