Skip to content

Fix crash when opening floating settings (BadTokenException)#982

Merged
Nain57 merged 1 commit into
Nain57:dev-4.0.0-beta05-fixesfrom
BoringMan314:fix/overlay-dialog-bad-token
Jul 15, 2026
Merged

Fix crash when opening floating settings (BadTokenException)#982
Nain57 merged 1 commit into
Nain57:dev-4.0.0-beta05-fixesfrom
BoringMan314:fix/overlay-dialog-bad-token

Conversation

@BoringMan314

Copy link
Copy Markdown
Contributor

Summary

  • Fix a crash when tapping the floating menu gear/settings button that throws WindowManager\$BadTokenException: Unable to add window -- token null is not valid.
  • Root cause: OverlayDialog enabled useWindowContext = true in 9fbe6af (IME toolbar on emulator). On some real devices, BottomSheetDialog.show() then fails with an invalid window token.
  • Change: stop forcing window context for OverlayDialog (keep BaseOverlay.useWindowContext available for cases that need it), and restore SOFT_INPUT_ADJUST_RESIZE | SOFT_INPUT_STATE_HIDDEN so soft-keyboard behavior does not regress.

Changes

  • OverlayDialog.kt: drop useWindowContext = true; add applySoftInputMode() with adjustResize + hidden IME state.

Notes

  • Reproduced on Sony XQ-AT52 (Android 12) with 4.0.0-beta04; dropbox stack pointed at Dialog.showBadTokenException. The main floating menu (useWindowContext = false) was unaffected.

Disable OverlayDialog useWindowContext (breaks BottomSheetDialog.show on some devices) and restore adjustResize for soft keyboard.
@Nain57
Nain57 changed the base branch from master to dev-4.0.0-beta05-fixes July 15, 2026 08:29
@Nain57

Nain57 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Tested OK on emulator & OnePlus 10 Pro.
Thanks for your contribution

@Nain57
Nain57 merged commit ade0720 into Nain57:dev-4.0.0-beta05-fixes Jul 15, 2026
1 check passed
@Nain57 Nain57 mentioned this pull request Jul 15, 2026
@BoringMan314
BoringMan314 deleted the fix/overlay-dialog-bad-token branch July 21, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants