Skip to content

feat(harmonyos): support immersive full screen - #2014

Merged
houko merged 4 commits into
mainfrom
feat/harmony-immersive-1124
Nov 23, 2026
Merged

houko merged 4 commits into
mainfrom
feat/harmony-immersive-1124

Conversation

@houko

@houko houko commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #1124

What

Immersive full screen on HarmonyOS.

  • StatusBarConfig.Immersive reaches the host as the third value of the sb op.
  • While immersive is on, the host calls setWindowSystemBarEnable([]) and setSpecificSystemBarEnabled('navigationIndicator', false). When it ends, the host restores the status bar (unless Hidden is set), the navigation bar and the indicator.
  • Behavior change outside immersive mode: the host used to call setWindowSystemBarEnable(['status']) (or [] for Hidden), which always hid the three-button navigation bar. It now keeps 'navigation' enabled, so that bar shows on three-button devices, and Hidden hides only the status bar. The changelog records this.
  • EntryAbility already lays the window out full screen, so content stays under the bars in both states.
  • The two requests (setWindowSystemBarEnable and setSpecificSystemBarEnabled) are tracked separately. Each one is made only when its request changes. Before, the bars were set on every batch and avoidAreaChange, which would hide them again right after an edge-swipe reveal. A failed request is retried only on the next batch that carries the status bar, never on avoidAreaChange. A rejection that arrives after a newer request is ignored. So a device that refuses the navigation indicator call cannot re-hide revealed bars or retry on every frame.
  • The safe area reads the TYPE_CUTOUT avoid area on all four sides, so a punch-hole camera stays an inset when the status bar is hidden, including at the bottom in reverse portrait. Outside immersive mode, the system bars' areas (with their side areas in landscape) are insets too. In immersive mode only the cutout counts, so bars revealed by an edge swipe lie over the content, as on Android, and the layout does not jump as they show and hide. The safe area is re-read when immersive mode starts or ends.
  • Committed host: rebuilt with cmd/nsgo/harmony/host/build.sh, using the OpenHarmony 7.0 public SDK (26.0.0.38) and hvigor 6.26.20. The ArkTS compiles against API 26.

Tests

  • TestStatusBarSendsImmersive (js/wasm).
  • TestHostSystemBarsAndCutout (cmd/nsgo/harmony): a source check that the host reads all four cutout sides, makes the two bar requests through separate trackers, and leaves the bars' areas out while immersive. No test runs the ArkTS itself.
  • cmd/nsgo/harmony: 22 passed, including TestCommittedHostMatchesTemplates.

Still open on #1124

None of these are checked on a HarmonyOS device: bars hiding and coming back, the edge-swipe reveal (including whether the revealed bars change the avoid areas), three-button navigation, the retry behavior when a bar request fails, and cutout insets in both orientations. The physical iPhone and Android API 28/29 checks from #1141 are also still open. The roadmap row lists them.

Screenshots

None. Not captured on a HarmonyOS device.

@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first size/M enhancement New feature or request documentation Improvements or additions to documentation iOS Android core tsx cli ci labels Nov 22, 2026
@houko
houko force-pushed the feat/harmony-immersive-1124 branch from e0708c8 to de0f25d Compare November 22, 2026 14:31
The status bar item now carries the immersive request to the ArkTS host, which hides the status bar with setWindowSystemBarEnable([]) and the navigation indicator with setSpecificSystemBarEnabled while it is on, and shows both again when it ends. The window is already laid out full screen from launch, so the content keeps running under the bars and their avoid areas report what they cover in either state.

The host sets the bars only when the request changes. avoidAreaChange fires when an edge swipe reveals hidden bars for a moment, and setting them again on that event or on the next batch would hide them at once.

The safe area now includes the display cutout's avoid area, so a punch-hole camera stays an inset once the status bar over it is hidden, and landscape reports the cutout's left or right inset instead of 0.

The committed HAP host is not rebuilt here: no machine at hand has the API 26 SDK that cmd/nsgo/harmony/host/build.sh needs, so TestCommittedHostMatchesTemplates fails until it is run.

Refs #1124.
…ion bar

The host now forgets the bars it asked for when setWindowSystemBarEnable or setSpecificSystemBarEnabled fails, so the next batch or avoid area change asks again instead of leaving the window in the wrong state.

Outside immersive mode the host keeps 'navigation' in setWindowSystemBarEnable, so three-button navigation stays when immersive mode ends or the app hides only its status bar; immersive mode hides it with the other bars.

The left and right safe-area insets take the system bars' side avoid areas as well as the cutout's, so a side navigation bar in landscape is an inset.

The docs and the mobile.Immersive comment describe what the HarmonyOS host asks the system to do rather than an edge-swipe reveal nobody has checked on a device.

The committed HAP host is still not rebuilt: no machine at hand has the API 26 SDK build.sh needs, so TestCommittedHostMatchesTemplates fails until it is run.

Refs #1124.
… immersive mode

The host tracks the setWindowSystemBarEnable and setSpecificSystemBarEnabled requests on their own. A request is made when what it asks for changes, and a failed one only again for the next batch that carries the status bar, never for an avoid area change. A rejection that arrives after a newer request is ignored. A device that refuses the navigation indicator call therefore no longer makes the bars again on every avoid area change, which hid them right after an edge-swipe reveal.

While immersive mode is on, the safe area keeps only the display cutout: bars an edge swipe reveals lie over the content, as on Android, instead of moving the layout as they show and again as they hide. The safe area is read again when immersive mode starts or ends, and the cutout's bottom area now counts, so a punch-hole at the bottom in reverse portrait is an inset.

The changelog records that the three-button navigation bar now stays outside immersive mode and that Hidden hides only the status bar. The Immersive comment, the architecture notes and the roadmap row describe the navigation bar and what is still unchecked on a device.

Refs #1124.
Built with cmd/nsgo/harmony/host/build.sh, the OpenHarmony 7.0 public SDK (26.0.0.38) and hvigor 6.26.20.
@houko
houko force-pushed the feat/harmony-immersive-1124 branch from de0f25d to e510401 Compare November 23, 2026 00:04
@houko
houko marked this pull request as ready for review November 23, 2026 00:04
@houko
houko merged commit d1a6499 into main Nov 23, 2026
18 of 21 checks passed
@houko
houko deleted the feat/harmony-immersive-1124 branch November 23, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android ci cli conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation enhancement New feature or request iOS size/M tsx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant