Repository navigation
[Android] Run the activity's back press callbacks while a modal is shown - #40621
Conversation
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> <!-- maui-release-normalization:production:11.0.1xx-sr2 --> Restore **`net11`** to the next-cycle CI version after pinning the exact SR2 staging source. Approved candidate merge: `cb744cbefe0ca371b6331e5afb711bd03ce1c37d`. Prepared normalization: `084e9e5a4ce38d205bf9f9cdc6933fbddf7c91e7`. This pinned child commit changes only version metadata: patch 30, CI/non-stable settings, and that same plain version in both bug-template dropdowns. SDK band and release contents are unchanged. **A maintainer must review this PR, run required CI and use Create a merge commit. Do not squash or rebase.** The reconciler does not update the protected integration ref, approve, retarget or merge this PR. Next-lane activation and forward-flow preparation wait for the normalization ancestry to be verified. The automation/release staging ref starts at this candidate source and advances through its separately reviewed servicing PR. A newer maintainer candidate merge supersedes the old generation, never a concurrent unrelated edit. After servicing is merged with Create a merge commit, the real release branch is manually cut at its exact merge. This normalization PR does not authorize signing. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> N/A - staged release configuration. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> <!-- maui-release-normalization:production:11.0.1xx-sr2 --> Restore **`net11`** to the next-cycle CI version after pinning the exact SR2 staging source. Approved candidate merge: `cb744cbefe0ca371b6331e5afb711bd03ce1c37d`. Prepared normalization: `084e9e5a4ce38d205bf9f9cdc6933fbddf7c91e7`. This pinned child commit changes only version metadata: patch 30, CI/non-stable settings, and that same plain version in both bug-template dropdowns. SDK band and release contents are unchanged. **A maintainer must review this PR, run required CI and use Create a merge commit. Do not squash or rebase.** The reconciler does not update the protected integration ref, approve, retarget or merge this PR. Next-lane activation and forward-flow preparation wait for the normalization ancestry to be verified. The automation/release staging ref starts at this candidate source and advances through its separately reviewed servicing PR. A newer maintainer candidate merge supersedes the old generation, never a concurrent unrelated edit. After servicing is merged with Create a merge commit, the real release branch is manually cut at its exact merge. This normalization PR does not authorize signing. Replaces dotnet#40563, which landed the same tree without the pinned commit (squash or rebase merge). This PR may show no remaining file changes; merging it with Create a merge commit records the required ancestry. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> N/A - staged release configuration. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
… height (dotnet#40574) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> Ports the exact fix and regression tests from dotnet#40572 to `net11` for review. Original fix by @devanathan-vaithiyanathan. The SR2 PR remains separate. For horizontal Grid CollectionViews on iOS and Mac Catalyst, measure the first available item when the height is unbounded, skip empty leading groups, and account for the row span and vertical spacing. The existing linear and finite-height behavior is unchanged. Regression coverage includes a four-row grid in an Auto row and a grouped grid with an empty first group. The local iOS device-test build was blocked by a missing workload in the repository SDK (NETSDK1147), so the simulator tests did not run. Mac Catalyst was not run locally. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes dotnet#40466 <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…0578) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change <!-- Enter description of the fix in this section --> Backport dotnet#40481 from `release/11.0.1xx-sr2` to `net11`. The change prevents re-entrant CollectionView remaining-items threshold notifications and skips threshold evaluation when the scrolled event replaces the items source. It includes the original iOS/MacCatalyst device tests. Source commit: `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`. **Validation** - `git diff --cached --check` - passed. - `git diff --cached | git patch-id --stable` - matched the patch ID of source commit `4858add2c0fdb0fc6ccfff39ee2dfde40b61e78d`. - Building `Microsoft.Maui.BuildTasks.slnf` failed locally with `NETSDK1140`: the installed Apple workload accepts platform version 27.2 while the projects request 27.0. - iOS and MacCatalyst device tests were not run locally; CI validation is required. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Relates to dotnet#40467. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. -->
A modal is shown in its own dialog with its own back press dispatcher, and its callback only invoked the MAUI OnBackPressed lifecycle events. Callbacks the app registered on the activity's dispatcher never ran while a modal was open. The dialog now forwards the back press to the activity's dispatcher. While it does, MAUI's own callback on the activity stays enabled and runs the modal's handling instead of the activity navigation, so: - app callbacks run first, as without a modal; - with no enabled app callback, or when one disables itself and dispatches again, the modal is handled as before; - a cancelled modal pop keeps the modal and never reaches the activity's default back action. Fixes dotnet#39559
This comment was marked as resolved.
This comment was marked as resolved.
|
Hey there @marcelomoresco! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Expert Review — 3 findings · ⚠️ 1 breaking change
Reviewed commit 89c1bdf.
Warning
Existing apps would look or behave differently without opting in. See the Behavioral Change Disclosure findings at:
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
) ### Description of Change Backports the Azure DevOps side of `/review run-device-tests` / `/review run-tests` from `main` (#40545) to `net11`, so device tests for `net11` PRs are built with `net11`'s own pipeline. Today `net11`'s `ci-device-tests.yml` can't build `run-devicetests/*` dispatches, and #40621's device tests ended up running as net12 (fixed on the workflow side by #40628, which no longer falls back to `main`'s pipeline). Cherry-picked from #40545, `eng/` only (the workflows run from `main`): - `eng/pipelines/ci-device-tests.yml`: builds `run-devicetests/*` branches and reads `eng/pipelines/common/run-devicetests-request.yml` (new). - `eng/pipelines/arcade/stage-device-tests.yml`: runs only the selected platforms, CoreCLR only, when a dispatch selects them. - `eng/helix_xharness.proj`, `eng/devices/run-windows-devicetests.cmd`: apply the selected test units. - `eng/pipelines/common/variables.yml`: `run-devicetests/*` builds skip the MAUI variable group, like `run-tests/*`. - `eng/pipelines/ci-uitests.yml`, `common/run-tests-request.yml`: the matching UI-side changes from the same PR. The cherry-pick applied cleanly; no net12 values come with it. Normal PR builds are unchanged: every new path is gated on a `run-devicetests/*` source branch. ### Testing `RunTests.Tests.ps1` on `net11`: 60 pass (the variable-group assertion is updated to the new condition, as on `main`). Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
…eline (#40628) ### Description of Change `/review run-tests` on #40621 (targets `net11`) ran its device tests as **net12** (`maui-pr-devicetests (net12.0 CoreCLR Android Helix Tests …)`). `net11`'s `ci-device-tests.yml` can't build `run-devicetests/*` dispatches yet, so the dispatch fell back to the default branch's pipeline: the dispatch commit for #40621's device tests was built on `main` (parent `6fda01fe2a`) with `main`'s `eng/pipelines`, `eng/devices` and `eng/helix_xharness.proj` over the `net11` test-merge. - `Invoke-RunTests.ps1` takes the pipeline only from the PR's target branch. If that pipeline can't build the suite's dispatches, the suite is reported as not queued with the reason. - `Get-RunTestsContext.ps1` checks only the target branch, so a `/review run-tests` on a `net11` PR runs the UI tests and notes that device tests can't run on `net11` yet, instead of running them with the wrong branch. Device tests for `net11` PRs need the dispatch support backported to `net11` (separate PR). ### Testing `RunTests.Tests.ps1`: the fallback test is replaced by one that asserts only the target branch is used; 74 pass. The 2 failures (`Pipeline templates`, `gates the device test pipeline on the dispatch request`) also fail on `main` without this change. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…log refused dispatches (#40631) ### Description of Change **Crash (from #40627).** Every `/review run-tests` dispatch since #40627 fails before posting its comment: ``` Invoke-RunTests.ps1:380 … -RunTestsStatuses -Repository $Repository -Sha $sha) | Where-Object { You cannot call a method on a null-valued expression. ``` `Get-RunTestsStatuses` returns its list as a single object (`return , @(…)`), so `@(Get-RunTestsStatuses …)` nested it and `$_.context` was the whole list. The list is now assigned first, and `context` is read as a string. Seen on #40439 and #40294. **net11 dispatches refused (diagnostics).** Since #40629 merged into `net11`, creating the `run-tests/*` / `run-devicetests/*` branch for `net11` PRs fails with `Resource not accessible by integration (HTTP 403)` (#40619, #40620, #40621). `main` PRs and `net11` dispatches before that pushed fine. The log doesn't say what GitHub objects to, so when the branch can't be created the script now logs the dispatch commit, its parent, the test-merge and its base, and the files the commit changes. That shows the cause on the next run. ### Testing - New Pester test: `Get-RunTestsStatuses` returns a flat list, and `Invoke-RunTests.ps1` no longer wraps it in `@()`. 77 pass; the 2 failures (`Pipeline templates`, `gates the device test pipeline on the dispatch request`) also fail on `main` without this change. - Called `Get-RunTestsStatuses` against a real commit (#40611 head): 7 statuses, filtering works. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…eline (dotnet#40628) ### Description of Change `/review run-tests` on dotnet#40621 (targets `net11`) ran its device tests as **net12** (`maui-pr-devicetests (net12.0 CoreCLR Android Helix Tests …)`). `net11`'s `ci-device-tests.yml` can't build `run-devicetests/*` dispatches yet, so the dispatch fell back to the default branch's pipeline: the dispatch commit for dotnet#40621's device tests was built on `main` (parent `6fda01fe2a`) with `main`'s `eng/pipelines`, `eng/devices` and `eng/helix_xharness.proj` over the `net11` test-merge. - `Invoke-RunTests.ps1` takes the pipeline only from the PR's target branch. If that pipeline can't build the suite's dispatches, the suite is reported as not queued with the reason. - `Get-RunTestsContext.ps1` checks only the target branch, so a `/review run-tests` on a `net11` PR runs the UI tests and notes that device tests can't run on `net11` yet, instead of running them with the wrong branch. Device tests for `net11` PRs need the dispatch support backported to `net11` (separate PR). ### Testing `RunTests.Tests.ps1`: the fallback test is replaced by one that asserts only the target branch is used; 74 pass. The 2 failures (`Pipeline templates`, `gates the device test pipeline on the dispatch request`) also fail on `main` without this change. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
…log refused dispatches (dotnet#40631) ### Description of Change **Crash (from dotnet#40627).** Every `/review run-tests` dispatch since dotnet#40627 fails before posting its comment: ``` Invoke-RunTests.ps1:380 … -RunTestsStatuses -Repository $Repository -Sha $sha) | Where-Object { You cannot call a method on a null-valued expression. ``` `Get-RunTestsStatuses` returns its list as a single object (`return , @(…)`), so `@(Get-RunTestsStatuses …)` nested it and `$_.context` was the whole list. The list is now assigned first, and `context` is read as a string. Seen on dotnet#40439 and dotnet#40294. **net11 dispatches refused (diagnostics).** Since dotnet#40629 merged into `net11`, creating the `run-tests/*` / `run-devicetests/*` branch for `net11` PRs fails with `Resource not accessible by integration (HTTP 403)` (dotnet#40619, dotnet#40620, dotnet#40621). `main` PRs and `net11` dispatches before that pushed fine. The log doesn't say what GitHub objects to, so when the branch can't be created the script now logs the dispatch commit, its parent, the test-merge and its base, and the files the commit changes. That shows the cause on the next run. ### Testing - New Pester test: `Get-RunTestsStatuses` returns a flat list, and `Invoke-RunTests.ps1` no longer wraps it in `@()`. 77 pass; the 2 failures (`Pipeline templates`, `gates the device test pipeline on the dispatch request`) also fail on `main` without this change. - Called `Get-RunTestsStatuses` against a real commit (dotnet#40611 head): 7 statuses, filtering works. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
`/review run-tests` on a `net11` PR now always fails with `POST git/refs`: **HTTP 403** (e.g. #40621, [log](https://github.com/dotnet/maui/actions/runs/45729020215)). The dispatch commit changes no workflow from its `net11` parent, but GitHub refuses `GITHUB_TOKEN`-created branches whose `.github/workflows` differ from the default branch's. Before #40628 dispatches used `main`'s `.github`, which is why they were accepted. **Fix:** for a PR whose target isn't the default branch, the dispatch commit takes `.github/workflows` and its parent from the default branch. The pipeline (`eng/pipelines`), scripts, and device files still come from the PR's target branch, so a `net11` PR still builds as `net11.0`. Workflows don't build anything on these branches. Tests: RunTests.Tests.ps1, 78 pass. The 2 failures also fail on `main` and are unrelated. Co-authored-by: Copilot CI <copilot-ci@microsoft.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…s back press Forwarding a modal's back press to the activity dispatcher had two paths that no longer notified Android.OnBackPressed lifecycle subscribers: - Shell registers a callback for the page below the modal, which consumed the press. It now yields while a modal back press is being dispatched. - When an app callback consumes the press, the subscribers are still notified, while MAUI's own window handler ignores that notification so the modal stays. The device test now runs against a MauiAppCompatActivity and separates consuming the press from dispatching it again with callback and handler counts. It replaces the Controls test, which ran on a test activity that never reaches this path.
This comment has been minimized.
This comment has been minimized.
Selected Tests
🧪 Test selection — click to expand
🧪 UI tests —
|
| Platform | Categories |
|---|---|
| Android | Lifecycle, Navigation, Shell1, Shell2 |
📊 Results — succeeded: 7 passed, 0 failed of 7 jobs
🔗 All test results · Build logs
| Job | Result |
|---|---|
| Android UITests CoreClr Controls (API 30) Lifecycle | ✅ succeeded |
| Android UITests CoreClr Controls (API 30) Navigation | ✅ succeeded |
| Android UITests CoreClr Controls (API 30) Shell1 | ✅ succeeded |
| Android UITests CoreClr Controls (API 30) Shell2 | ✅ succeeded |
| Android UITests Shell Renderer Controls Shell Renderer (API 30) Shell1 | ✅ succeeded |
| Android UITests Shell Renderer Controls Shell Renderer (API 30) Shell2 | ✅ succeeded |
| Build UITests CoreCLR Sample App Build Sample App | ✅ succeeded |
🧪 Device tests — Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.Shell +47 on Android
✅ maui-pr-devicetests #1701051 passed.
GPT-6.2 Sol: Android device tests cover the new activity-callback regression and modal, Shell, navigation, and window lifecycle behavior.
MAI Code 2: Android modal and activity back-press dispatch changes; run modal, navigation, Shell, window, and lifecycle device tests on Android.
🧪 Ran — 51 categories on Android
| Platform | Categories |
|---|---|
| Android | Controls.Lifecycle, Controls.Modal, Controls.NavigationPage, Controls.Shell, Controls.Window, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay |
📊 Results — succeeded: 2 passed, 0 failed of 2 jobs
🔗 All test results · Build logs
| Job | Result |
|---|---|
| net11.0 CoreCLR Android Helix Tests Run DeviceTests Android (CoreCLR) | ✅ succeeded |
| net11.0 CoreCLR ios/catalyst/android Helix Tests Build Device Tests (CoreCLR) | ✅ succeeded |
⏭️ Skipped — what neither suite runs
UI tests — 73 categories, 3 platforms
Platforms not run: iOS, MacCatalyst, Windows
Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Editor, Effects, Essentials, FlyoutPage, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, ManualReview, Maps, Page, Performance, Picker, ProgressBar, RadioButton, RefreshView, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, Window, WebView, Material3
Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.
Device tests — 54 categories, 3 platforms
Platforms not run: iOS, MacCatalyst, Windows
Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Editor, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.FlyoutPage, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Page, Controls.PageTransitions, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.RefreshView, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.WindowOverlay, Controls.Xaml, Graphics, Essentials, BlazorWebView
Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.
🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)
UI tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | Navigation, Shell1, Shell2 |
Navigation, Shell1, Shell2, Lifecycle |
| iOS | — | — |
| MacCatalyst | — | — |
| Windows | — | — |
GPT-6.2 Sol — Android Navigation and Shell UI tests cover modal back presses and the underlying navigation stack.
- ModalNavigationManager and MauiAppCompatActivity change Android back dispatch; Navigation covers modal dismissal and stack fallback.
- ShellItemWrapperFragment must yield while a modal is open; run Shell.
- No other platforms or unrelated UI categories.
MAI Code 2 — Android-only modal back-press dispatch changes; run Android navigation, Shell, and lifecycle UI tests.
- ModalNavigationManager.Android changes modal back handling, so Navigation coverage is required.
- ShellItemWrapperFragment.Android changes Shell fallback behavior, so Shell coverage is required.
- MauiAppCompatActivity and AppHostBuilderExtensions.Android alter Android lifecycle back-button callback dispatch, so Lifecycle coverage is required.
- No iOS, Mac Catalyst, Windows, or unrelated UI categories are affected.
Device tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.FlyoutView, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.Window, Core.WindowOverlay, Controls.Modal, Controls.NavigationPage, Controls.Shell, Controls.Window, Controls.Lifecycle |
Controls.Modal, Controls.NavigationPage, Controls.Shell, Controls.Window, Controls.Lifecycle, Core.Window, Core.Lifecycle |
| iOS | — | — |
| MacCatalyst | — | — |
| Windows | — | — |
GPT-6.2 Sol — Android device tests cover the new activity-callback regression and modal, Shell, navigation, and window lifecycle behavior.
- Run Core unfiltered: ModalBackPressTests.Android.cs has no category trait.
- Run Controls.Modal, NavigationPage and Shell for modal fallback and the underlying stack.
- Run Controls.Window and Lifecycle for the window back hook; no other platforms or projects.
MAI Code 2 — Android modal and activity back-press dispatch changes; run modal, navigation, Shell, window, and lifecycle device tests on Android.
- ModalNavigationManager.Android directly affects modal pops and navigation fallback, requiring Controls.Modal and Controls.NavigationPage.
- ShellItemWrapperFragment.Android changes Shell back handling, requiring Controls.Shell.
- MauiAppCompatActivity and lifecycle event registration drive Window and lifecycle back navigation, requiring Controls.Window, Controls.Lifecycle, Core.Window, and Core.Lifecycle.
- The added test is in the Core Window handler suite; no non-Android device tests or unrelated projects are affected.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
Covers a modal back handler that refuses to pop: the modal stays, the activity isn't finishing, the lifecycle subscriber is notified once per press, and callback and popping counts differ between consuming the press and dispatching it again. A second press without cancellation then pops the modal. The cancellation is represented in the handler, since Window.ModalPopping belongs to Controls.
026eba9
into
dotnet:candidate/11.0.1xx-sr3
Target Branch
Targets
net11: longstanding bug (reported 10.0.100), same code onmain.Description of Change
A modal shows in its own
Dialogwith its own back-press dispatcher, so app callbacks registered on the Activity's dispatcher never ran while a modal was open.The dialog now forwards the back press to the Activity's dispatcher. While it does, MAUI's own Activity callback stays enabled and handles the modal instead of Activity navigation, so:
This addresses the 3 points from the automated review on the earlier closed PRs #39634/#39635 (different author; kubaflo closed the latter as stalled): modal fallback preserved, a self-disabling-and-redispatching callback still falls through to the modal, and a cancelled
ModalPoppingdoesn't close the app. Doesn't useHasEnabledCallbacks.Verification
Android API 36 emulator, Sandbox, real BACK button, 8 scenarios before/after. Only two change: "modal + app callback" (0→1 call, modal stays) and "callback that redispatches" (0→1, modal closes). No callback, disabled callback, cancelled pop, navigation underneath, navigation inside the modal, and no modal: all identical; app never force-closes. New test
BackPressOnModalRunsActivityCallbackscompiles.Not verified: the device test itself, predictive back gesture, Android < 33, third-party Fragment callbacks under the modal (now reachable, same as without a modal).
Issues Fixed
Fixes #39559