Skip to content

chore: sync upstream PR #8275 - fix(android): preserve file chooser callback across activity recreation#99

Open
riderx wants to merge 2 commits into
plusfrom
sync/upstream-pr-8275
Open

chore: sync upstream PR #8275 - fix(android): preserve file chooser callback across activity recreation#99
riderx wants to merge 2 commits into
plusfrom
sync/upstream-pr-8275

Conversation

@riderx

@riderx riderx commented Jul 14, 2026

Copy link
Copy Markdown
Member

Upstream PR Sync

This PR syncs changes from an external contributor's PR on the official Capacitor repository.

Original PR

  • PR: #8275
  • Title: fix(android): preserve file chooser callback across activity recreation
  • Author: @Suryansh0910

Automation

  • CI will run automatically
  • Manual review is required before merging
  • Auto-merge is disabled until an equivalent review gate is available
  • A new release will be published automatically

Synced from upstream by Capacitor+ Bot

Suryansh0910 and others added 2 commits December 5, 2025 00:05
Fixes ionic-team#8246

When the Android system destroys and recreates the Activity while a file
picker is open (due to backgrounding or memory pressure), the ValueCallback
reference is lost, causing file uploads to fail silently.

This fix stores the file chooser callbacks in static variables so they
survive activity recreation. When the activity result is received:
- If the instance callback exists, it's used normally
- If the instance callback is null, the static pending callback is used

Changes:
- Added static variables to store pending file path callback, image URI,
  and file chooser type
- Added FileChooserType enum to track which picker was opened
- Added handlePendingFileChooserResult() to handle results when activity
  was recreated
- Added clearPendingFileChooserState() to clean up static state
- Updated showImageCapturePicker(), showVideoCapturePicker(), and
  showFilePicker() to store callbacks before launching
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 66b73a0d-ebf4-4e47-ae07-4198614792ef

📥 Commits

Reviewing files that changed from the base of the PR and between 63026cc and f5d635e.

📒 Files selected for processing (1)
  • android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Beta npm build

Maintainers can publish one Capacitor Plus workspace package from this PR to npm for fast testing.

Comment /publish-beta <package> after the PR checks are green.

Examples:

/publish-beta core
/publish-beta cli
/publish-beta @capacitor-plus/core

If exactly one workspace package changed, /publish-beta without a package will use that package.

Packages:

  • core (@capacitor-plus/core)
  • cli (@capacitor-plus/cli)
  • android (@capacitor-plus/android)
  • ios (@capacitor-plus/ios)

The workflow will:

  • publish a prerelease package on the beta tag
  • add a pinned pr-99 dist-tag for the selected package
  • update this comment with the install command

Security note: beta publish is only enabled for branches inside this repository.

@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.

Risk: medium. Not approving: this Android file-chooser lifecycle fix is user-facing and uses static callback state without test evidence, above the low-risk approval threshold. Cursor Bugbot was not present; human review is needed before merge.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver External

@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.

Risk: medium. Approved: Cursor Bugbot was not present on this PR; CodeRabbit and CI completed with no findings requiring human review. No reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Approver

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