Skip to content

ref(feedback): Extend Dialog instead of AlertDialog in SentryUserFeedbackForm - #6338

Open
runningcode wants to merge 4 commits into
9.x.xfrom
no/feedback-form-extend-dialog
Open

runningcode wants to merge 4 commits into
9.x.xfrom
no/feedback-form-extend-dialog

Conversation

@runningcode

@runningcode runningcode commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

SentryUserFeedbackForm now extends android.app.Dialog instead of android.app.AlertDialog. The form never used AlertDialog's title, message, buttons or custom-view slots. It replaced the whole content with its own layout in onCreate.

The default theme stays the same. For themeResId == 0, Dialog falls back to android:dialogTheme, so the form resolves android:alertDialogTheme itself, as AlertDialog did. The platform's Theme.Material.Dialog sets no minimum window width, so under it the window stays at the 320dp preferred dialog width. On a 411dp-wide phone that made the form 18% narrower in portrait and about half as wide in landscape.

AlertDialog also always requested FEATURE_NO_TITLE, because it draws its own title. The form now requests it itself. Otherwise themes that don't set windowNoTitle, like Theme.Material.Dialog, add an empty system title bar above the form's own title.

This also drops the FLAG_ALT_FOCUSABLE_IM workaround from #5359. AlertDialog set that flag because it found no text input in its own content, which hid the soft keyboard. Dialog never sets it. The existing test that checks the flag is absent still passes.

💡 Motivation and Context

Changing the superclass breaks binary and source compatibility for anyone calling AlertDialog-only methods on the form (setButton, setMessage, setView, getButton, ...), so it waits for v9.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry-android-core:testReleaseUnitTest :sentry-samples:sentry-samples-android:compileReleaseKotlin :sentry-android-integration-tests:sentry-uitest-android:compileReleaseAndroidTestKotlin
  • On an API 37 emulator, compared the sample app's form with the AlertDialog version in portrait and landscape: same window width, no FLAG_ALT_FOCUSABLE_IM on the window, and the keyboard shows when tapping the description field. With Theme_Material_Dialog passed to the Builder, no system title bar appears.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • Mention the new superclass in the v8 → v9 migration guide (JAVA-732).

🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

JAVA-494

@sentry

sentry Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode runningcode added the next-major This should only be merged in the next major version. label Oct 21, 2026
@runningcode
runningcode force-pushed the no/feedback-form-extend-dialog branch 2 times, most recently from ced4589 to 0eb7685 Compare October 22, 2026 12:41
@runningcode
runningcode marked this pull request as ready for review October 22, 2026 15:21
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sentry_dialog_user_feedback);
final @Nullable Window window = getWindow();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is not needed for Dialog anymore?

@romtsn romtsn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with one question

runningcode and others added 2 commits October 27, 2026 13:01
…backForm

The form never used AlertDialog's title, message, buttons or custom
view; it replaces the content with its own layout in onCreate.

Dialog falls back to dialogTheme for theme 0, while AlertDialog uses
alertDialogTheme, so the form now resolves alertDialogTheme itself to
keep the default look unchanged. The FLAG_ALT_FOCUSABLE_IM workaround
goes away because only AlertDialog set that flag.

Resolves JAVA-494

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/feedback-form-extend-dialog branch from 4be78a0 to 425a0fe Compare October 27, 2026 12:03
@runningcode
runningcode force-pushed the no/feedback-form-extend-dialog branch from 425a0fe to fb8022f Compare October 28, 2026 14:30

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fb8022f. Configure here.

AlertDialog always requested FEATURE_NO_TITLE because it draws its own
title. Plain Dialog does not, so themes that don't set windowNoTitle,
like Theme.Material.Dialog, added an empty system title bar above the
form's own title.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

next-major This should only be merged in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants