Skip to content

Guard statusBarShow/statusBarHide against detached decorView (#57342)#57342

Closed
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D107934787
Closed

Guard statusBarShow/statusBarHide against detached decorView (#57342)#57342
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D107934787

Conversation

@alanleedev

@alanleedev alanleedev commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary:

statusBarShow() and statusBarHide() access the window's decorView, which throws IllegalArgumentException when the decorView is not attached to the window manager. This can happen for extra windows (dialogs/popups) whose decorView is detached independently of the host activity's lifecycle, or when status bar visibility is updated during teardown.

Guard both functions with if (!decorView.isAttachedToWindow) return so the fix protects every caller at the source. The guard is a no-op during normal operation (the decorView is always attached) and only short-circuits during the teardown race.

Changelog:
[Android][Fixed] - Prevent IllegalArgumentException crash in statusBarShow/statusBarHide when the window decorView is detached

Reviewed By: Abbondanzo

Differential Revision: D107934787

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 25, 2026
@meta-codesync

meta-codesync Bot commented Jun 25, 2026

Copy link
Copy Markdown

@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107934787.

…7342)

Summary:
Pull Request resolved: react#57342

`statusBarShow()` and `statusBarHide()` access the window's `decorView`, which throws `IllegalArgumentException` when the decorView is not attached to the window manager. This can happen for extra windows (dialogs/popups) whose decorView is detached independently of the host activity's lifecycle, or when status bar visibility is updated during teardown.

Guard both functions with `if (!decorView.isAttachedToWindow) return` so the fix protects every caller at the source. The guard is a no-op during normal operation (the decorView is always attached) and only short-circuits during the teardown race.

Changelog:
[Android][Fixed] - Prevent `IllegalArgumentException` crash in `statusBarShow`/`statusBarHide` when the window decorView is detached

Reviewed By: Abbondanzo

Differential Revision: D107934787
@meta-codesync meta-codesync Bot changed the title Guard statusBarShow/statusBarHide against detached decorView Guard statusBarShow/statusBarHide against detached decorView (#57342) Jun 25, 2026
@meta-codesync meta-codesync Bot closed this in a54b04e Jun 25, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jun 25, 2026
@meta-codesync

meta-codesync Bot commented Jun 25, 2026

Copy link
Copy Markdown

This pull request has been merged in a54b04e.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant