Skip to content

[release/11.0.1xx] [AndroidSdk] Add explicit emulator process environment - #13683

Merged
jonathanpeppers merged 1 commit into
release/11.0.1xxfrom
jonathanpeppers-backport-emulator-environment
Nov 20, 2026
Merged

jonathanpeppers merged 1 commit into
release/11.0.1xxfrom
jonathanpeppers-backport-emulator-environment

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Backport of #13467.

Add EmulatorRunner.CreateWithProcessEnvironment to copy a caller's complete process environment and working directory for emulator launch and AVD listing. Existing constructor behavior is unchanged.

Resolve the PublicAPI conflicts by adding only the new declaration to the release branch's netstandard2.0, net10.0, and net11.0 unshipped baselines. Preserve all existing release declarations. No issue is linked; #13467 is the source PR.

Validation (Windows, SDK 11.0.100):

  • dotnet test tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj --filter FullyQualifiedName~EmulatorRunnerTests -v minimal — passed, 25 tests; exercised the netstandard2.0 library.
  • dotnet test tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj --filter FullyQualifiedName~EmulatorRunnerTests -v minimal -p:AndroidToolsDisableMultiTargeting=false -p:DotNetTargetFrameworkVersion=10.0 — passed, 25 tests; exercised the net10.0 library.
  • dotnet test tests\Xamarin.Android.Tools.AndroidSdk-Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj --filter FullyQualifiedName~EmulatorRunnerTests -v minimal -p:AndroidToolsDisableMultiTargeting=false -p:DotNetStableTargetFramework=net11.0 — passed, 25 tests; exercised the net11.0 library.

The two Unix-only tests were skipped on Windows in each run.


Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

…ment

Manual backport of #13467 (660f039). Preserve release API declarations and existing caller behavior.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 16:48

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

No active review issues are recorded for the backport adding caller-supplied environment and working-directory settings to emulator launch and AVD listing.

No open issues 🎉

What changed in this PR

Backports #13467 to the release branch, letting Android SDK tooling use a caller-supplied environment and working directory for emulator launch and AVD listing without changing existing constructor behavior.

Changes:

  • Adds EmulatorRunner.CreateWithProcessEnvironment to snapshot the supplied process settings.
  • Adds the new API to all three release baselines while preserving existing declarations.
  • Tests copied settings and legacy behavior, and moves launch-argument checks into the existing boot test.
File Description
tests/​Xamarin.Android.Tools.AndroidSdk-Tests/​EmulatorRunnerTests.cs Tests environment and directory handling; consolidates argument assertions.
src/​Xamarin.Android.Tools.AndroidSdk/​Runners/​EmulatorRunner.cs Adds the factory and applies copied settings to launch and listing.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​netstandard2.0/​PublicAPI.Unshipped.txt Declares the new factory for netstandard2.0.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​net11.0/​PublicAPI.Unshipped.txt Declares the new factory for net11.0.
src/​Xamarin.Android.Tools.AndroidSdk/​PublicAPI/​net10.0/​PublicAPI.Unshipped.txt Declares the new factory for net10.0.

Review effort: Balanced

@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@jonathanpeppers
jonathanpeppers enabled auto-merge (squash) November 20, 2026 20:06

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed 3ac1170a against release/11.0.1xx at 71caa3ae. This is a static, read-only review.

LGTM. This is a faithful backport of #13467. EmulatorRunner.cs here is byte-identical to the #13467 merge commit (660f039) and to current main, and the test changes match upstream.

  • The new static EmulatorRunner.CreateWithProcessEnvironment(string, ProcessStartInfo, Action<TraceLevel,string>? logger = null) declaration matches the implementation exactly in the netstandard2.0, net10.0 and net11.0 PublicAPI.Unshipped.txt files (line 185). Those are the target frameworks this branch builds. There are no duplicate or Shipped entries, and the main-only AdbRunner.CreateWithProcessEnvironment entry was correctly left out.
  • The environment and working directory are copied when the runner is created and applied to both LaunchEmulator and ListAvdNamesAsync. The existing constructor path is unchanged, so BootAndroidEmulator (new EmulatorRunner(emulatorPath, logger: logger)) is unaffected.
  • The consolidated BootEmulator_AppearsAfterPolling test keeps the -avd, -no-snapshot-load and additional-args assertions from the removed tests, and the Unix-only tests keep their [Platform] guards.
  • The three commits that landed on release/11.0.1xx since the merge base don't touch any of these files.

Non-blocking: the removed tests also happened to cover the "emulator launched but never appeared" timeout branch. Upstream made the same trade-off.

@jonathanpeppers
jonathanpeppers merged commit ea3a55f into release/11.0.1xx Nov 20, 2026
45 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-backport-emulator-environment branch November 20, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants