Skip to content

Android Multi-window - #24397

Draft
MartinZikmund wants to merge 64 commits into
masterfrom
dev/mazi/androidmultiwin
Draft

MartinZikmund wants to merge 64 commits into
masterfrom
dev/mazi/androidmultiwin

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: #8341

PR Type:

✨ Feature

What changed? 🚀

Stacked on #24042 (Skia-Android multi-window ready, targeting 7.0). This PR contains those
commits plus the ones below; it targets master so CI runs, and shrinks to its own commits once
#24042 merges. Release split: #24042 ships in 7.0 and carries every public-surface change live
multi-window needs; this PR targets 7.1+ and is binary compatible with 7.0 (everything it adds is
internal or additive).

Turns on live multi-window for Skia-Android: SupportsMultipleWindows is true, and every
secondary Window is hosted by its own ApplicationActivity, launched in a task of its own
(NewDocument | MultipleTask) and tagged with the window's id.

  • Launch and adoption: activating a secondary window asks Android for a task; the activity that
    starts adopts the window by id, builds its render stack and only then reports the window shown (activation
    is raised on request, as on UIKit). A close while the launch is pending cancels it. An activity started for a window this
    process does not know (closed meanwhile, or restored after process death while another activity
    drives the main window) finishes instead of taking the main window over.
  • Closing: secondary windows close for good and release everything process-wide state held
    (XamlRootMap, native elements, title-bar/DPI/theme subscriptions). The main window keeps the
    single-window semantics it has on master (hidden, content kept, shown again on the next launch),
    because Android keeps the process after the main task finishes. This also fixes a crash where
    relaunching after the main task finished re-adopted a closed window.
  • App lifecycle: EnteredBackground/Suspending fire when the last activity stops, not per window.
  • Per-window plumbing: titles set before activation, native elements loaded before activation,
    accessibility (explore-by-touch) and light-dismiss popups are scoped to the owning window; the
    foreground activity is claimed on top-resume; caption-bar insets in freeform windows.
  • Back: SystemNavigationManager is process-wide, so it only serves the main window; a secondary
    window keeps the system behavior (back closes it).
  • Clipboard.ContainsText() asks the clip description rather than reading the clipboard (no
    "pasted from your clipboard" notice on every focus change), and is compiled for every Uno.WinRT
    variant (tvOS was missing it).
  • MultiWindowShowcase sample.

Known gaps (process-wide IME binding before activation, InputPane occlusion, DisplayInformation,
StatusBar insets listener, deep-link re-handling, native-view Context after re-creation) are listed
in specs/053-android-multiwindow-ready/plan.md; each has an additive fix.

Validation

  • Compile: Uno.UI.Runtime.Skia.Android for net10.0-android builds clean, including a strict
    build (analyzers on); Uno.UI.RuntimeTests.Skia builds.
  • Runtime tests: Given_AndroidSkiaXamlRootHost covers releasing a window closed before
    activation, keeping a title set before activation, and main vs secondary close semantics on the
    Android Skia lane. Tests that activate a secondary window are skipped on Android: the new task
    backgrounds the test runner.
  • On-device: two live windows have not been exercised on an emulator in this pass; use the
    MultiWindowShowcase sample.

PR Checklist ✅

🤖 Generated with Claude Code

https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4

@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/build Categorizes an issue or PR as relevant to build infrastructure area/automation Categorizes an issue or PR as relevant to project automation kind/documentation labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 8m 40s —— View job


Review complete

  • Gather context (diff, AGENTS.md rules, changed files)
  • Review Android multi-window activity/window lifecycle changes
  • Review DependencyProperty / event / async discipline
  • Review cross-platform correctness (file suffixes, ApiExtensibility)
  • Review test coverage (new runtime tests)
  • Review SamplesApp sample + XAML formatting
  • Post inline comments for findings
  • Post summary

Verdict: fix-first

The core de-singletoning work (per-window NativeWindowWrapper, per-window AndroidSkiaXamlRootHost/input sources, BaseActivity foreground-registry, ContextHelper split) is solid, well-documented via code comments, and matches the Win32/X11/AppleUIKit patterns it's modeled on. DependencyProperty usage, event shapes (EventHandler/EventHandler<T>, no event Action), and platform-suffix discipline all look correct. No blocking correctness bugs found in the hot input/render/lifecycle paths I traced end-to-end (activity re-creation, secondary-window launch/adopt/close, IME/text-input per-window resolution).

5 findings posted inline, most-severe first:

  1. Scope mismatch (highest severity): AndroidSkiaWindowFactory.SupportsMultipleWindows ships as true with a fully-wired live second-Activity path and a MultiWindowShowcase sample, but the PR's own specs/053-android-multiwindow-ready/plan.md says this flag stays false and calls live two-window support (plus its on-device validation) an explicit out-of-scope follow-up. The plan's validation section also states on-device testing wasn't performed. Either the plan doc is stale and needs updating to reflect the actual (larger) shipped scope and what was validated, or the flag flip is premature.
  2. Nullability suppressed, not handled: ~7 ContextHelper.Current call sites across Uno.WinRT got a mechanical ! to silence the new nullable warning, right as this PR makes Current genuinely null more often (foreground-tracking vs. the old sticky last-activity behavior). MemoryManager.Android.cs is the clearest concrete risk since its callers are public APIs pollable at any time.
  3. Plausible cross-window render-state bug: Compositor.GetSharedCompositor().IsSoftwareRenderer is set as ambient/shared state on every render-view construction — safe on every other Skia host (one window per process) but Android is now the first host where a second window's construction can re-run this and potentially downgrade state an already-live window depends on.
  4. Test coverage gap: the new runtime test only validates single-window steady state; none of the multi-window-specific invariants (activity handover between two live windows, distinct per-window input sources, secondary-window close not affecting the main window) are exercised — consistent with the plan's admitted validation gap in finding Setting Image.Source to local image (added as "Content" to Assets/ folder in UWP project) leads to WASM app never going past the Splashscreen #1.
  5. Minor: 11 files picked up a stray UTF-8 BOM as an edit artifact — cosmetic, easy cleanup.

Nothing here blocks discussion, but #1 in particular should be resolved (doc update or scope walk-back) before merge given it's a direct contradiction between the shipped behavior and the PR's own design record.
· Branch: dev/mazi/androidmultiwin

Comment thread src/Uno.WinRT/ContextHelper.cs Resolved
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 232104 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Examples.png-dark
    • DisplayInformation.png-dark
    • Examples.png
    • ContextRequested.png-dark
    • ExpanderColorValidationPage.png-dark
    • ContextRequested.png
    • ExpanderColorValidationPage.png
    • ImageIconPage.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ElementLevelTheme.png-dark
  • skia-windows-screenshots: 2310 changed over 2404

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarButtonWithIconTest.png
    • AppWindowPositionAndSize.png-dark
    • Attributed_text_FontSize_Changing.png
    • AutomationProperties_AutomationId.png-dark
    • AutoSuggestBox_Reason.png-dark
    • BasicAutoSuggestBox.png-dark
    • Battery.png-dark
    • BenchmarkDotNet.png
    • BitmapImage_vs_SvgImageSource.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • Border_Clipped_Change_Property.png-dark
    • Border_Clipped_Change_Property.png
    • Border_Corner_Overlap.png-dark
    • Border_Corner_Overlap.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Canvas_In_Canvas.png-dark
    • Canvas_In_Canvas.png
    • Circle.png-dark
    • Circle.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • UITests.Uno_Web.Http.CookieManagerTests

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/androidmultiwin branch from 8bd4fed to 4e8a5e0 Compare September 15, 2026 09:43
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 2m 36s —— View job


Review complete

  • Gather context (diff since last review, new commits)
  • Check whether prior findings were addressed
  • Review new/changed code since last pass
  • Post inline comments for new findings (none — see below)
  • Post summary

Verdict: fix-first (unchanged)

This push adds only two small commits since the previous review round:

  1. e0f5bd85 — adds the OnSystemUiVisibilityChangeListener package-diff-ignore entry to the 6.7 IgnoreSet (build/PackageDiffIgnore.xml:3820) alongside the existing 6.6 entry (line 2385). Correctly scoped to the right IgnoreSet block (3547–4978), not a duplicate — fine.
  2. 4e8a5e0f — fully qualifies ActivityFlags as global::Android.Content.ActivityFlags in ApplicationActivity.cs:75 to resolve a CS0104 ambiguity against AndroidX.Activity.ActivityFlags (both namespaces are using'd in that file). Minimal, correctly targeted, no other unqualified ActivityFlags reference remains in the file.

Both are narrow, low-risk build/compile fixes — no new correctness, lifecycle, or test-coverage issues introduced by them, so no new inline comments.

Prior findings — still unresolved

I re-checked the five findings from the previous review pass against the current tree; none have been addressed yet, so they still stand (not re-posted inline to avoid duplicating the existing threads):

  1. Scope mismatch (highest severity): AndroidSkiaWindowFactory.SupportsMultipleWindows is still true, while specs/053-android-multiwindow-ready/plan.md:41 still states it "stays false" and lists live two-window support as an explicit out-of-scope follow-up. This contradiction is unresolved.
  2. Nullability suppressed, not handled: all ~15 ContextHelper.Current! null-forgiving call sites across Uno.WinRT (MemoryManager.Android.cs:55, DisplayInformation.Android.cs:126/213, StorageFile.Android.cs:66/92, SimpleOrientationSensor.Android.cs ×7, Gamepad.Android.cs:188, StoreContext.Android.cs:33, WebAuthenticationBrokerProvider.Android.cs:28, DataTransferManager.Android.cs:58) are unchanged.
  3. Plausible cross-window render-state bug: UnoSKCanvasView.cs:46 and UnoSKVulkanView.cs:67 still write Compositor.GetSharedCompositor().IsSoftwareRenderer as ambient/shared state on every render-view construction.
  4. Test coverage gap: Given_AndroidSkiaXamlRootHost.cs still only exercises single-window steady state; no test opens a second window to cover activity handover, distinct per-window input sources, or secondary-window close isolation.
  5. Minor — Clipboard.cs:57 still uses GetContent()?.Contains(StandardDataFormats.Text) == true instead of ?? false; MultiWindowShowcase.xaml.cs:54 still writes the static _windowCount field directly from an instance method; the UTF-8 BOM introduced on the previously-listed files (confirmed still present, e.g. CompositionTarget.Rendering.cs, AndroidSkiaXamlRootHost.cs) is also still there.

Nothing here is new — this is a status check confirming the outstanding items from the 2026-09-04 review still need a decision (doc update vs. scope walk-back for #1 in particular) before merge.
· Branch: dev/mazi/androidmultiwin

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 233737 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2310, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • Buttons.png-dark
    • Buttons.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • DisplayInformation.png-dark
    • Examples.png-dark
  • skia-windows-screenshots: 2310 changed over 2410

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBar_KeyBoard.png-dark
    • ApplicationViewSizing.png-dark
    • AppWindowFeatures.png-dark
    • AppWindowTitleBar Properties.png-dark
    • Arrange_Performance01.png
    • Attributed_text_Supserscript.png
    • AutoBorderStretchwithleftmargin.png
    • AutomationProperties_AutomationId.png
    • AutoSizedTopLeft.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBox_Reason.png
    • AutoSuggestBox_SoftKeboard.png-dark
    • Basics_Automated.png
    • BasicThemeResources.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BitmapIcon_Foreground.png-dark
    • BorderCenteredwithmargins.png-dark
    • BorderCenteredwithmargins.png
    • BorderRightwithmargins.png-dark
    • BorderRightwithmargins.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 233737 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/androidmultiwin branch from 4e8a5e0 to 75a4462 Compare September 16, 2026 07:37
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 36s —— View job


Review complete

  • Gather context (diff since 2026-09-15 review, new commits)
  • Check whether prior findings were addressed
  • Review new/changed code since last pass
  • Post inline comments for new findings
  • Post summary

Verdict: fix-first

8 new commits landed since the last pass. Good progress on prior findings:

  • Nullability finding — resolved. 93fd1fa3 root-causes it rather than re-suppressing: app-scoped Uno.WinRT callers (memory info, sensors, gamepad input, store ID, raw resources) now use ContextHelper.ApplicationContext instead of a forced-non-null Current; activity-scoped callers (DisplayInformation, WebAuthenticationBrokerProvider, share UI, asset app ID) now actually check for null and degrade gracefully. 11993107 also fixes the underlying handover bug the nullability was masking — BaseActivity's foreground handover could pick an already-destroyed/finishing activity from the un-pruned instance registry; it now filters on !IsDestroyed && !IsFinishing.
  • Clipboard == true — resolved (9a532fb5, now ?? false).
  • Two more root-cause fixes landed in this batch (not previously flagged, look correct): c9b373ac guards UnoSKVulkanView.SurfaceDestroyed against running after TeardownRenderer already disposed state; 4fd54c12 fixes native-hosted views disappearing across activity re-creation by re-parenting them into the new native layer.

New findings from this batch:

  1. AndroidSkiaNativeElementHostingExtension.cs — the new static _attachedViews dictionary (added by 4fd54c12 to support view re-adoption across activity re-creation) is only pruned via the graceful DetachNativeElement/LeaveImpl path. NativeWindowWrapper.Android.cs's CloseCore closes a secondary window via FinishAndRemoveTask() directly, without unloading its content tree first, so any native-hosted element in a closed secondary window leaks its _attachedViews entry (and transitively pins the finished activity) for the rest of the process's life. This is a new leak surface specific to the secondary-window-close path this PR introduces.
  2. MultiWindowShowcase.xaml.cs — the refactor(samples): Take the window index from a helper commit (97c29900) added GetNextWindowIndex() but never wired it up; OnOpenWindow still writes ++_windowCount directly. The static-field-write-from-instance-method finding is still live; the helper is dead code.
  3. specs/053-android-multiwindow-ready/plan.md — the scope-mismatch finding was addressed by rewording the "out of scope" section to say the live second-Activity work "now lands here", but the doc wasn't fully reconciled: a few lines later it still asserts "SupportsMultipleWindows stays false" and the validation section still calls "Two live windows... a follow-up." The doc now contradicts itself rather than matching the shipped true flag.

Still unresolved from the prior round (unchanged by this batch, not re-flagged inline):

CI: the Azure DevOps Uno.UI - CI build reported failing on 2026-09-15 11:25 (before this batch); GitHub-side checks for the latest push are still in progress at review time, so I can't confirm whether that failure is resolved.
· Branch: dev/mazi/androidmultiwin

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/androidmultiwin branch from 75a4462 to 9c98134 Compare September 16, 2026 08:05
MartinZikmund and others added 22 commits October 3, 2026 11:09
Opening two secondary windows and closing them left "Open secondary Window" dead,
throwing "A secondary window can only be opened while an activity is running" on
every later click.

BaseActivity.Current is claimed from create/start/restart/resume and cleared by
ResignCurrent on pause/stop/destroy. With one window that is complete: the only
activity always re-claims it on the way back. With several, the others stay started
and resumed while the foreground one closes, so none of them ever runs that path --
the closing activity clears the static and nothing sets it again. Traced on a tablet:

  TopResumed 3 = False (current 3)
  ResignCurrent 3 (current 3)          <- cleared
  TopResumed 1 = True (current <null>) <- handover ignored

OnTopResumedActivityChanged is the authoritative foreground handover between live
activities, and it was the one lifecycle callback not claiming Current. Claim it
there. This also re-points ContextHelper.Current when the user switches windows,
which SetAsCurrent already owns.

Not covered by a runtime test: the harness drives a single activity, so two live
windows cannot be staged there. Verified on a Pixel Tablet emulator by replaying the
report -- open two, close both, re-open -- which now succeeds with no exception.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013abHtN84G3yMS8oM4JxYEF
(cherry picked from commit 4419dcc)
Closing a secondary window took three clicks on its Close button. Android was
dropping the events before the app ever saw them:

  Not creating InputTarget for ... PopupWindow:..., no input channel
  Dropping event because no targets were found: MotionEvent

LayoutProvider observes layout and insets through an invisible PopupWindow and
relied on Width = 0 to stay clear of touch. That is not enough: the dispatcher
still selects the popup as the target for a touch over it, finds it has no input
channel, and drops the event outright instead of falling through. One popup is
created per activity, so every open window costs another swallowed tap -- which is
why the count grew with the number of windows.

Mark it not focusable and not touchable so it is never a candidate target.

Verified on a tablet emulator: open, close and re-open a secondary window all
respond to a single press, with zero dropped events across the run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013abHtN84G3yMS8oM4JxYEF
(cherry picked from commit 094c066)
UpdateCanPasteClipboardContent runs on every TextBox focus change and called
Clipboard.GetContent() purely to decide whether Paste should be enabled. Reading the
clipboard is user-visible on Android 12+, which answered with a "pasted from your
clipboard" notice on app launch and again whenever focus returned to a text box.

Clipboard.ContainsText() answers from the clipboard's description where the platform
can tell without reading -- on Android PrimaryClipDescription, which does not count
as a read -- and falls back to the previous content check elsewhere, so no other
target changes behaviour. Pasting still reads, which is when the notice belongs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013abHtN84G3yMS8oM4JxYEF
(cherry picked from commit 0c8a7c1)
AppWindowClosing exercises closing semantics and its secondary window is deliberately
bare, which makes it a poor way to see multi-window working. This one opens windows
that are visibly distinct -- their own accent, index and running clock -- so several
of them side by side show at a glance that each is a separate visual tree rendering
on its own.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_013abHtN84G3yMS8oM4JxYEF
(cherry picked from commit 47c7fa4)
AndroidX.Activity also exposes an ActivityFlags type, so the unqualified
reference was ambiguous with Android.Content.ActivityFlags (CS0104).
The global:: alias is needed because Android resolves to
Microsoft.Android inside the Microsoft.UI.Xaml namespace.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RcQhNLcUU4zKcbgRaWZUAR
(cherry picked from commit 5101df7)
The plan listed the live second Activity as an out-of-scope follow-up,
which this branch delivers.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RcQhNLcUU4zKcbgRaWZUAR
(cherry picked from commit 3236c64)
The helper was added without switching the caller, so it was dead code
and the instance method still wrote the static field. The plan also kept
two lines asserting the narrower scope, contradicting the paragraph
recording that the live second activity lands here.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RcQhNLcUU4zKcbgRaWZUAR
(cherry picked from commit ecbe3bb)
Closing a window finishes the task hosting it rather than unloading its
tree, so the presenters never detach their native elements and the
tracking entries kept the views -- and through them the finished
activity -- alive for the rest of the process.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01RcQhNLcUU4zKcbgRaWZUAR
(cherry picked from commit aa3a3c2)
Uno.UI builds once and calls Clipboard.ContainsText, but it lived in
Clipboard.cs, which the tvOS variant compiles out. Focusing a TextBox on
tvOS then threw MissingMethodException. Move it to a file every variant
compiles, falling back to GetContent where the platform cannot answer
from the clip description. Android reads the description through the
application context, which is all a ClipboardManager needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
Each window is an activity, and stopping one raised the app-wide
EnteredBackground and Suspending while other windows were still visible.
Track the started activities and raise them only when none is left, and
not for a configuration-driven re-creation, whose replacement starts
right away.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
- Report a secondary window shown and activated only once an activity
  adopted it; a close before that cancels the launch, and an activity
  started for a window nobody knows finishes instead of taking over the
  main window from a live activity (process-death restore).
- Keep the main window reusable across close, as on single-window
  targets: Android keeps the process and the next launch shows it again.
  Closing it finishes its activity rather than leaving it blank.
- Release a permanently closed window: unregister its XamlRoot, native
  elements and process-wide subscriptions, whether the app or the system
  closed it, and report a system close only once.
- Keep a title set before the window had an activity.
- Place native elements loaded before the window had an activity.
- Route back and close popups per window: the process-wide
  SystemNavigationManager only serves the main window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
The explore-by-touch helper hit-tested and navigated the main window's
tree from every render view, so TalkBack in a secondary window acted on
the main window's elements.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
Closing a window that never had an activity releases its host, a title
set before activation is kept, and only secondary windows close for good.
Activating a secondary window on Android starts a task of its own, which
backgrounds the test runner, so tests that do are skipped there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
Clipboard is static in WinAppSDK, and the sync generator rejects a
non-static declaration of it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
tvOS now declares Clipboard for ContainsText, so the class is no longer
not-implemented there as a whole; its members still are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
SetContent described plain text as "text/plaintext", which is not a MIME
type Android or other apps know, so the clip description never reported
text: other apps did not see Uno's clips as text, and ContainsText kept
Paste disabled for Uno's own. Write text/plain, and still recognize the
old label on clips written by earlier versions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
Gating the activation on WasShown broke secondary windows on UIKit, which
defers its show until the scene connects in the same way and relied on the
activation being raised on request. Android no longer needs the gate: a
close from an Activated handler now cancels the pending launch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DtsKbXbA642EduoduiNtt4
Route the started-activity count through an Interlocked helper and filter CancelLaunch with Where.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G7PsEU6gSpLZXrYuK8WWpt
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/androidmultiwin branch from 56924ce to 127fdb7 Compare October 3, 2026 09:10
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 1m 52s —— View job


Review complete

  • Gather context (diff since last review round, new commits)
  • Check whether the P1 Activated-dedup finding from the last round was addressed
  • Review new/changed code since last pass
  • Check CI status
  • Post inline comments for new findings (none — see below)
  • Post summary

Verdict: fix-first (unchanged)

No new commits landed content-wise since the last full review pass. git log --oneline origin/master..HEAD shows the same 64 commits as before, in the same order, with the same messages (chore: Address Android multi-window review nits, fix: Keep raising Activated when a show is deferred, fix(android): Label clipboard text as text/plain, …) — only their SHAs changed (e.g. 56924cec→127fdb71, af700471→da15d09c), which is the signature of a rebase onto an updated master rather than new work. I confirmed this directly against the code rather than trusting the message match:

  • BaseActivity.cs still has AdjustStartedCount (Interlocked.Add) and Volatile.Read(ref _startedCount) — the CodeQL static-field fix from the last round is intact.
  • ApplicationActivity.cs's CancelLaunch still filters via .Where(...) — also intact.
  • NativeWindowWrapper.Android.cs's Show(bool) override and TryActivate() in BaseWindowImplementation.cs are byte-for-byte what was already reviewed.

That last point matters because it means the one standing P1 finding is still open on this exact code: BaseWindowImplementation.TryActivate() (src/Uno.UI/UI/Xaml/Window/Implementations/BaseWindowImplementation.cs:393-395) calls NativeWindowWrapper?.Show(true) then unconditionally OnActivationStateChanged(CodeActivated) — not gated on WasShown. For an Android secondary window, Show(true) only fires the async LaunchForWindow intent and returns while _activity is still null (NativeWindowWrapper.Android.cs:280-298), so Activated fires once before any native window exists and caches _lastActivationState = CodeActivated. When the real activity later resumes and raises the genuine native activation, the dedup check in OnActivationStateChanged (line 239) swallows it. This was flagged 2026-09-29, and the author's reply on that thread explained the revert was needed to avoid regressing UIKit's own deferred-show path — but the Android-specific dedup side effect itself doesn't appear to have a code change addressing it, so it's being carried forward rather than re-posted as a new inline comment (the existing thread on NativeWindowWrapper.Android.cs:290 is still open and accurately describes the current code).

Not re-flagging anything else: nullability, Clipboard.ContainsText(), the _attachedViews/native-element leak, static-field-writes, the 7 P1 multi-window lifecycle findings (morning4coffe-dev), and the tvOS Clipboard static-declaration CI failure all remain resolved and unchanged. Documented trade-offs also unchanged: ambient IsSoftwareRenderer write, per-window SystemNavigationManager scoping (tracked as a follow-up), the narrow process-death-restore residual on ApplicationActivity.cs (pending confirmation it's an accepted trade-off), and on-device two-live-window validation still not performed.

CI for this fresh push was still queued/in-progress at review time (CodeQL, WinAppSDK Sync Generator Check, Check Links, Code Quality, PR Labeler all pending; XAML Style Check passed). The prior Uno.UI - CI failure on build 236918 (2026-10-02T10:55) predates this push and I have no visibility into whether it was transient (screenshot-diff related) or a real build break — worth checking Azure DevOps directly since no code changed here to address it.
· Branch: dev/mazi/androidmultiwin


private class InAppReviewListener : Java.Lang.Object, IOnCompleteListener
{
private StoreContext _storeContext;
_vulkanContext.Dispose();
if (_nativeWindow != IntPtr.Zero)
{
ANativeWindow_release(_nativeWindow);
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 237227 found UI Test snapshots differences: skia-linux-screenshots: 119, skia-windows-screenshots: 129

Details
  • skia-linux-screenshots: 119 changed over 2454

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • DisplayInformation.png-dark
    • DynamicFont.png-dark
    • DynamicFont.png
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ElementLevelTheme.png-dark
    • ExpanderColorValidationPage.png
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
  • skia-windows-screenshots: 129 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • DeferLoadStrategyWithTemplateBinding.png-dark
    • DeferLoadStrategyWithTemplateBinding.png
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Examples.png
    • ImageBrushLocalAsset.png-dark
    • ImageBrushLocalAsset.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • ImageBrush_Formats.png-dark
    • ImageBrush_Formats.png
    • Image_Fixed_Size_Alignment.png-dark

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 237227 has failed on Uno.UI - CI.

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

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants