Skip to content

Conversation

@olmpya12
Copy link
Contributor

@olmpya12 olmpya12 commented Nov 9, 2025

Android: Fix white bar by enabling immersive fullscreen (API 30+)

After upgrading to Qt 6.10 / NDK 27, Android stopped applying immersive
flags, causing visible white bars (system nav/status areas) below the Qt window on tablets.

image

This patch restores true fullscreen behavior on Android 11+ using the
WindowInsetsController API.

Changes:

  • Added QGCActivity.goImmersive() with WindowInsetsController.hide()
  • Called goImmersive() from onCreate() and onWindowFocusChanged()
  • Applies only on API >= 30

Result: QGroundControl launches in proper immersive fullscreen mode on
Android.
WhatsApp Image 2025-11-09 at 12 21 17_76fb24df

Test: Samsung s7 fe and samsung a63
Further: on Samsung a63 test there is a white gap in the camera area I dont know its on purpose or not but this commit fix the issue on the tablet

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…ller (API 30+)

Problem
-------
After upgrading to Qt 6.10 / NDK 27, Android started reserving system
UI space again (navigation/status bars), leaving a visible white strip
outside the Qt window. Previous builds implicitly/explicitly hid bars,
but no immersive flags were applied in the current tree.

Cause
-----
Qt now defaults to edge-to-edge without hiding system bars. Since we
weren’t requesting immersive mode, Android kept the nav/status areas
visible, appearing as white gaps on tablets.

Fix
---
Use the modern WindowInsetsController API (API 30+) to enter immersive
mode and allow swipe-to-reveal of system bars:

- Added goImmersive():
  * getWindow().setDecorFitsSystemWindows(false)
  * insetsController.hide(Type.statusBars | Type.navigationBars)
  * setSystemBarsBehavior(BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE)

- Call goImmersive() from onCreate() and onWindowFocusChanged(true)

Notes
-----
- This change only applies on API 30+ (guarded by Build.VERSION.SDK_INT).
  Older devices keep current behavior (no legacy flags added in this commit).
- No theme or color changes included; this strictly restores full
  screen usage by hiding system bars on Android 11+.

Result
------
QGC launches fully immersive on API 30+ devices (no white bars at top
or bottom). Users can swipe from the edge to transiently reveal system
bars, per Android guidelines.
@HTRamsey HTRamsey requested a review from Copilot November 12, 2025 18:30
Copilot finished reviewing on behalf of HTRamsey November 12, 2025 18:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the white bar issue that appeared on Android tablets after upgrading to Qt 6.10 and NDK 27 by implementing true immersive fullscreen mode using Android's WindowInsetsController API (Android 11+).

Key Changes:

  • Added goImmersive() method that hides status and navigation bars using the modern WindowInsetsController API
  • Integrated immersive mode into the activity lifecycle by calling it in onCreate() and onWindowFocusChanged()

@HTRamsey
Copy link
Collaborator

HTRamsey commented Nov 12, 2025

Looking at Qt source I think there's a built in Qt way to do this because it has the same code you added in QtDisplayManager.java

@olmpya12
Copy link
Contributor Author

@HTRamsey yep it seems just using built in way working too.

@HTRamsey
Copy link
Collaborator

Could you check if this does anything?

flags: Qt.platform.os === "android"
           ? Qt.Window | Qt.ExpandedClientAreaHint
           : Qt.Window

@olmpya12
Copy link
Contributor Author

@HTRamsey Yep using flags also solve it

Copilot finished reviewing on behalf of HTRamsey November 14, 2025 02:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

@HTRamsey
Copy link
Collaborator

Sorry can you try one more thing: just do this flags: Qt.Window | Qt.ExpandedClientAreaHint | Qt.NoTitleBarBackgroundHint.

@olmpya12
Copy link
Contributor Author

@HTRamsey yep this one also works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants