Skip to content

[Android] Configure image drag support for BlazorWebView - #37975

Merged
kubaflo merged 4 commits into
inflight/currentfrom
fix/37971-android-webview-drag-provider
Sep 2, 2026
Merged

kubaflo merged 4 commits into
inflight/currentfrom
fix/37971-android-webview-drag-provider

Conversation

@danroth27

@danroth27 danroth27 commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Android WebView image dragging requires AndroidX WebKit's DropDataContentProvider. Without it, draggable images in a MAUI BlazorWebView produce DOM drag activity but no usable provider-backed image data.

This change:

  • Adds the centrally versioned Xamarin.AndroidX.WebKit 1.16.0.1 dependency for Android MAUI BlazorWebView builds. This version matches main's AndroidX Core 1.19.0.1 dependency graph.
  • Registers androidx.webkit.DropDataContentProvider with the required ${applicationId}.DropDataProvider authority.
  • Enables registration by default and lets apps that declare the provider themselves opt out with <MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>.
  • Clarifies that the property controls automatic manifest registration only; the AndroidX dependency remains available for app-owned declarations.
  • Emits suppressible warning MAUI1002 when AndroidManifestMerger=legacy, because that merger ignores AndroidManifestOverlay items.
  • Adds an Android device test that verifies the provider metadata, instantiates it through ContentResolver, and initializes its WebView bridge.
  • Adds a packaged-app integration test for both default registration and the opt-out merged manifest.

Compatibility and Scope

Identical existing app declarations merge into one provider entry. Apps with a differing/custom declaration can disable MAUI's overlay with MauiEnableAndroidWebViewDragDrop=false.

The provider remains scoped to Microsoft.AspNetCore.Components.WebView.Maui rather than Microsoft.Maui.Core so this fix does not add a WebKit dependency and manifest entry to every Android MAUI app. Plain WebView and HybridWebView can be considered separately if broader automatic registration is desired.

Android Files may still reject dragging files out of the app with "You can't move files from another app"; that destination behavior is outside MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no BlazorWebView DOM-context support, and JavaScript-synthesized drag events would not exercise the native Android provider. The device and integration tests instead cover the provider's runtime and build-time contracts deterministically.

Validation

  • Rebased onto current main and aligned WebKit with the updated AndroidX dependency graph.
  • Confirmed Xamarin.AndroidX.WebKit 1.16.0.1 is available from dotnet-public and completed a fresh isolated restore.
  • Verified the default MSBuild evaluation includes the provider overlay and MauiEnableAndroidWebViewDragDrop=false omits it.
  • Verified an identical app-owned provider declaration merges to one provider entry.
  • Verified AndroidManifestMerger=legacy emits suppressible warning MAUI1002.
  • Ran the Android BlazorWebView device tests on a Pixel API 36 emulator before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed. ImageDragDropContentProviderIsAvailable passed.
  • Built the rebased integration-test project successfully.
  • Fixed the initial integration-test CI failure by rebuilding the opt-out case from a clean obj directory instead of changing BaseIntermediateOutputPath, which had caused both generated-source trees to be compiled.

What Not to Do

  • Do not replace the AndroidX provider with a trivial managed ContentProvider; it bridges into Chromium's internal classloader implementation.
  • Do not vendor the WebKit AAR or add NuGet.org to MAUI's package sources.
  • Do not describe MauiEnableAndroidWebViewDragDrop as a dependency opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

@danroth27
danroth27 temporarily deployed to copilot-pat-pool August 28, 2026 19:41 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37975

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37975"

@danroth27
danroth27 temporarily deployed to copilot-pat-pool August 28, 2026 19:41 — with GitHub Actions Inactive
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@danroth27
danroth27 temporarily deployed to copilot-pat-pool August 28, 2026 19:43 — with GitHub Actions Inactive
@danroth27
danroth27 temporarily deployed to copilot-pat-pool August 28, 2026 19:45 — with GitHub Actions Inactive
@danroth27
danroth27 temporarily deployed to copilot-pat-pool August 28, 2026 19:46 — with GitHub Actions Inactive
@github-actions github-actions Bot added area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/android labels Aug 28, 2026
@danroth27
danroth27 temporarily deployed to copilot-pat-pool August 28, 2026 19:46 — with GitHub Actions Inactive
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 28, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 5 findings

See inline comments for details.

Comment thread eng/AndroidX.targets Resolved
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-failed AI could not verify tests catch the bug s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Aug 29, 2026
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 30, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 7 findings

See inline comments for details.

MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-fix-win AI found a better alternative fix than the PR and removed s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-review-in-progress AI review is currently running for this PR labels Aug 30, 2026

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

Could you please check the ai's suggestions?

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 31, 2026
@danroth27
danroth27 marked this pull request as ready for review August 31, 2026 23:34
mattleibow and others added 3 commits September 2, 2026 01:04
Add runtime provider acquisition, default and opt-out manifest coverage, and an actionable warning for the legacy Android manifest merger.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the review follow-up focused on the new drag-drop coverage without reformatting unrelated assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Align WebKit with the rebased AndroidX Core 1.19 graph, make the legacy-merger warning suppressible, and rebuild the opt-out integration case from a clean obj directory.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the fix/37971-android-webview-drag-provider branch from 4955ce8 to 3a6309c Compare September 1, 2026 23:16
Copilot AI review requested due to automatic review settings September 1, 2026 23:16

Copilot AI 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.

🟢 Approval recommended

The implementation matches the PR description, is scoped to BlazorWebView on Android, and includes both device and integration test coverage for the new manifest/provider behavior.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@mattleibow

Copy link
Copy Markdown
Member

/azp run maui-pr

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@kubaflo
kubaflo changed the base branch from main to inflight/current September 2, 2026 22:10
@kubaflo
kubaflo merged commit 854509d into inflight/current Sep 2, 2026
35 checks passed
@kubaflo
kubaflo deleted the fix/37971-android-webview-drag-provider branch September 2, 2026 22:11
@github-actions github-actions Bot added this to the .NET 11.0-preview7 milestone Sep 2, 2026
kubaflo pushed a commit that referenced this pull request Sep 3, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 6, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 7, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 8, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 9, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 11, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 15, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 18, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 21, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 27, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
kubaflo pushed a commit that referenced this pull request Sep 27, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

Android WebView image dragging requires AndroidX WebKit's
`DropDataContentProvider`. Without it, draggable images in a MAUI
`BlazorWebView` produce DOM drag activity but no usable provider-backed
image data.

This change:

- Adds the centrally versioned `Xamarin.AndroidX.WebKit` 1.16.0.1
dependency for Android MAUI BlazorWebView builds. This version matches
main's AndroidX Core 1.19.0.1 dependency graph.
- Registers `androidx.webkit.DropDataContentProvider` with the required
`${applicationId}.DropDataProvider` authority.
- Enables registration by default and lets apps that declare the
provider themselves opt out with
`<MauiEnableAndroidWebViewDragDrop>false</MauiEnableAndroidWebViewDragDrop>`.
- Clarifies that the property controls automatic manifest registration
only; the AndroidX dependency remains available for app-owned
declarations.
- Emits suppressible warning `MAUI1002` when
`AndroidManifestMerger=legacy`, because that merger ignores
`AndroidManifestOverlay` items.
- Adds an Android device test that verifies the provider metadata,
instantiates it through `ContentResolver`, and initializes its WebView
bridge.
- Adds a packaged-app integration test for both default registration and
the opt-out merged manifest.

Identical existing app declarations merge into one provider entry. Apps
with a differing/custom declaration can disable MAUI's overlay with
`MauiEnableAndroidWebViewDragDrop=false`.

The provider remains scoped to
`Microsoft.AspNetCore.Components.WebView.Maui` rather than
`Microsoft.Maui.Core` so this fix does not add a WebKit dependency and
manifest entry to every Android MAUI app. Plain `WebView` and
`HybridWebView` can be considered separately if broader automatic
registration is desired.

Android Files may still reject dragging files out of the app with "You
can't move files from another app"; that destination behavior is outside
MAUI and is unchanged.

No Appium UI test was added. The existing MAUI UI-test host has no
BlazorWebView DOM-context support, and JavaScript-synthesized drag
events would not exercise the native Android provider. The device and
integration tests instead cover the provider's runtime and build-time
contracts deterministically.

- Rebased onto current `main` and aligned WebKit with the updated
AndroidX dependency graph.
- Confirmed `Xamarin.AndroidX.WebKit` 1.16.0.1 is available from
`dotnet-public` and completed a fresh isolated restore.
- Verified the default MSBuild evaluation includes the provider overlay
and `MauiEnableAndroidWebViewDragDrop=false` omits it.
- Verified an identical app-owned provider declaration merges to one
provider entry.
- Verified `AndroidManifestMerger=legacy` emits suppressible warning
`MAUI1002`.
- Ran the Android BlazorWebView device tests on a Pixel API 36 emulator
before the rebase: 26 tests run, 22 passed, 4 ignored, 0 failed.
`ImageDragDropContentProviderIsAvailable` passed.
- Built the rebased integration-test project successfully.
- Fixed the initial integration-test CI failure by rebuilding the
opt-out case from a clean `obj` directory instead of changing
`BaseIntermediateOutputPath`, which had caused both generated-source
trees to be compiled.

- Do not replace the AndroidX provider with a trivial managed
`ContentProvider`; it bridges into Chromium's internal classloader
implementation.
- Do not vendor the WebKit AAR or add NuGet.org to MAUI's package
sources.
- Do not describe `MauiEnableAndroidWebViewDragDrop` as a dependency
opt-out; NuGet dependencies are fixed when the package is built.

Fixes #37971

---------

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ecbe107-8703-4352-a1c6-e4f722cb9b28
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-blazor Blazor Hybrid / Desktop, BlazorWebView platform/android s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Configure DropDataContentProvider for BlazorWebView image dragging

5 participants