Skip to content

[net11] Disable Play Store auto-updates on CI Android emulators - #40357

Merged
kubaflo merged 1 commit into
net11from
kubaflo-net11-disable-playstore-autoupdate
Nov 18, 2026
Merged

kubaflo merged 1 commit into
net11from
kubaflo-net11-disable-playstore-autoupdate

Conversation

@kubaflo

@kubaflo kubaflo commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

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!

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

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

CI hardening only: no product, test, or assertion changes.

The Android UI-test emulators use google_apis_playstore images (API 30 and API 36, eng/pipelines/common/ui-tests.yml). A few minutes after boot, the Play Store (Finsky, reason=auto_update) downloads and installs a newer Google Play services APK. No Google account is needed for this. Replacing com.google.android.gms makes every process that loaded its dynamite/Chimera modules restart itself. The MAUI HostApp is one of those processes:

PackageManager: Force stopping com.google.android.gms ... pkg removed
DynamiteLoaderV2Impl / ChimeraModuleLdr: Module config changed, forcing restart due to module googlecertificates | maps_dynamite
Sending signal. PID: <app> SIG: 9
ActivityManager: Process com.microsoft.maui.uitests (pid <app>) has died: fg TOP

The running UI test then fails in TearDown with "The app was expected to be running still". The in-job retry usually recovers, but the crash costs a retry. It can also fail the job when the kill lands during the retry.

This PR disables the Play Store package on CI emulators in PrepareDevice, using pm disable-user --user 0 com.android.vending. That call works without root on user builds.

  • Google Play services itself stays enabled and unchanged.
  • The disabled state persists across the emulator recovery restarts, because they don't wipe data.
  • It runs only under IsCIBuild(), so local developer emulators aren't touched.
  • On images without the Play Store, SafeAdbShell just logs the harmless pm error.

CI evidence

The same sequence appears in the drop logcats of three app crashes that the in-job retry recovered, in candidate UI build 1686708:

  • Material3 on API 36: GMS replaced about 4 minutes after emulator start.
  • SafeAreaEdges on API 36.
  • Border/Button on API 30: GMS replaced about 13 minutes after start.

The same retry-recovered crashes occur on net11 UI build 1685487, so this isn't branch-specific. Across the observed jobs, the update landed about 4–14 minutes after emulator start. PrepareDevice runs about 1 minute after start, before that window.

Local validation

Fresh -wipe-data boots of google_apis_playstore arm64 AVDs (pixel_5), checked every minute for GMS installs, GMS package removals, and the GMS version:

Run Result over the monitoring window
API 30 baseline Play Store self-updated at about 11 min. GMS updated 20.18.17 → 26.45.31 at about 13 min, with "pkg removed" and ChimeraModuleLdr "forcing restart" kills.
API 30 + pm disable-user 20 min: 0 installs, 0 GMS removals, still 20.18.17
API 36 baseline GMS updated 25.07.34 → 26.45.31 at about 4 min
API 36 + pm disable-user, applied about 20 s after boot 15 min: 0 installs, 0 GMS removals, still 25.07.34

dotnet cake eng/devices/android.cake --target=uitest-prepare --dryrun compiles the script. The full cake path is validated by this PR's actual maui-pr-uitests run.

Issues Fixed

No issue filed; this fixes flaky Android UI-test CI (app killed by a Google Play services auto-update).

Play Store images auto-update Google Play services minutes after boot.
Replacing com.google.android.gms force-restarts every process that loaded
its modules, killing the app under test mid-run. Disable
com.android.vending in PrepareDevice on CI so GMS stays at the image version.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 03:01 — 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 -- 40357

Or

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

@azure-pipelines

This comment has been minimized.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 03:02 — with GitHub Actions Inactive
@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 03:04 — 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 Nov 18, 2026
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool November 18, 2026 03:06 — with GitHub Actions Inactive
@kubaflo

kubaflo commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/rebase

@kubaflo

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@MauiBot

MauiBot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@kubaflo — existing-test verification; Setup did not capture a tested commit.

Result INCONCLUSIVE Platform Android


🧪 Gate analysis — click to expand

⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect.

No interpretable test-group summary was produced. No additional test execution is inferred.

Setup did not capture a verified PR head; no commit is claimed as tested.

No immutable without-fix baseline was prepared.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 18, 2026

@github-actions github-actions Bot 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.

Expert Review — 0 findings

Reviewed commit 2d76f65.

@kubaflo

kubaflo commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

CI validation of 2d76f65 (maui-pr-uitests 1687006, from raw job logs)

  • Android: all 33 jobs completed and succeeded. Each of the 33 PrepareDevice logs shows Package com.android.vending new state: disabled-user.
  • GMS crash markers: 0 in this build, against 3 per recent baseline net11 build. The marker is HostApp SIGKILL/"process died" while Play Store updates com.google.android.gms.
  • Other platforms: 7 iOS/Mac jobs failed (CarouselView, CollectionView1/2/4, Layout, Navigation). This PR changes only the Android PrepareDevice path in eng/devices/android.cake, so those failures are outside its scope. The build is still in progress for 1 remaining non-Android job.

@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 Nov 18, 2026
@MauiBot

MauiBot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@kubaflo — existing-test verification; Setup did not capture a tested commit.

Result INCONCLUSIVE Platform Android


🧪 Gate analysis — click to expand

⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect.

No interpretable test-group summary was produced. No additional test execution is inferred.

Setup did not capture a verified PR head; no commit is claimed as tested.

No immutable without-fix baseline was prepared.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 18, 2026

@github-actions github-actions Bot 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.

Expert Review — 0 findings

Reviewed commit 2d76f65.

Source assessment incomplete (4/5 dimensions); finding count is partial.

@kubaflo
kubaflo merged commit 99996d6 into net11 Nov 18, 2026
179 of 191 checks passed
@kubaflo
kubaflo deleted the kubaflo-net11-disable-playstore-autoupdate branch November 18, 2026 10:44
@kubaflo kubaflo mentioned this pull request Nov 18, 2026
1 task
marcelomoresco pushed a commit to marcelomoresco/dotnet-maui that referenced this pull request Nov 18, 2026
…et#40357)

<!-- 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

CI hardening only: no product, test, or assertion changes.

The Android UI-test emulators use `google_apis_playstore` images (API 30
and API 36, `eng/pipelines/common/ui-tests.yml`). A few minutes after
boot, the Play Store (Finsky, `reason=auto_update`) downloads and
installs a newer Google Play services APK. No Google account is needed
for this. Replacing `com.google.android.gms` makes every process that
loaded its dynamite/Chimera modules restart itself. The MAUI HostApp is
one of those processes:

```
PackageManager: Force stopping com.google.android.gms ... pkg removed
DynamiteLoaderV2Impl / ChimeraModuleLdr: Module config changed, forcing restart due to module googlecertificates | maps_dynamite
Sending signal. PID: <app> SIG: 9
ActivityManager: Process com.microsoft.maui.uitests (pid <app>) has died: fg TOP
```

The running UI test then fails in TearDown with "The app was expected to
be running still". The in-job retry usually recovers, but the crash
costs a retry. It can also fail the job when the kill lands during the
retry.

This PR disables the Play Store package on CI emulators in
`PrepareDevice`, using `pm disable-user --user 0 com.android.vending`.
That call works without root on user builds.
- Google Play services itself stays enabled and unchanged.
- The disabled state persists across the emulator recovery restarts,
because they don't wipe data.
- It runs only under `IsCIBuild()`, so local developer emulators aren't
touched.
- On images without the Play Store, `SafeAdbShell` just logs the
harmless `pm` error.

#### CI evidence

The same sequence appears in the drop logcats of three app crashes that
the in-job retry recovered, in candidate UI build
[1686708](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1686708):
- Material3 on API 36: GMS replaced about 4 minutes after emulator
start.
- SafeAreaEdges on API 36.
- Border/Button on API 30: GMS replaced about 13 minutes after start.

The same retry-recovered crashes occur on `net11` UI build
[1685487](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685487),
so this isn't branch-specific. Across the observed jobs, the update
landed about 4–14 minutes after emulator start. `PrepareDevice` runs
about 1 minute after start, before that window.

#### Local validation

Fresh `-wipe-data` boots of `google_apis_playstore` arm64 AVDs
(pixel_5), checked every minute for GMS installs, GMS package removals,
and the GMS version:

| Run | Result over the monitoring window |
| --- | --- |
| API 30 baseline | Play Store self-updated at about 11 min. GMS updated
20.18.17 → 26.45.31 at about 13 min, with "pkg removed" and
ChimeraModuleLdr "forcing restart" kills. |
| API 30 + `pm disable-user` | 20 min: 0 installs, 0 GMS removals, still
20.18.17 |
| API 36 baseline | GMS updated 25.07.34 → 26.45.31 at about 4 min |
| API 36 + `pm disable-user`, applied about 20 s after boot | 15 min: 0
installs, 0 GMS removals, still 25.07.34 |

`dotnet cake eng/devices/android.cake --target=uitest-prepare --dryrun`
compiles the script. The full cake path is validated by this PR's actual
`maui-pr-uitests` run.

### Issues Fixed

No issue filed; this fixes flaky Android UI-test CI (app killed by a
Google Play services auto-update).

<!--
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: Copilot App <223556219+Copilot@users.noreply.github.com>
SuthiYuvaraj pushed a commit to SuthiYuvaraj/maui that referenced this pull request Nov 23, 2026
…et#40357)

<!-- 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

CI hardening only: no product, test, or assertion changes.

The Android UI-test emulators use `google_apis_playstore` images (API 30
and API 36, `eng/pipelines/common/ui-tests.yml`). A few minutes after
boot, the Play Store (Finsky, `reason=auto_update`) downloads and
installs a newer Google Play services APK. No Google account is needed
for this. Replacing `com.google.android.gms` makes every process that
loaded its dynamite/Chimera modules restart itself. The MAUI HostApp is
one of those processes:

```
PackageManager: Force stopping com.google.android.gms ... pkg removed
DynamiteLoaderV2Impl / ChimeraModuleLdr: Module config changed, forcing restart due to module googlecertificates | maps_dynamite
Sending signal. PID: <app> SIG: 9
ActivityManager: Process com.microsoft.maui.uitests (pid <app>) has died: fg TOP
```

The running UI test then fails in TearDown with "The app was expected to
be running still". The in-job retry usually recovers, but the crash
costs a retry. It can also fail the job when the kill lands during the
retry.

This PR disables the Play Store package on CI emulators in
`PrepareDevice`, using `pm disable-user --user 0 com.android.vending`.
That call works without root on user builds.
- Google Play services itself stays enabled and unchanged.
- The disabled state persists across the emulator recovery restarts,
because they don't wipe data.
- It runs only under `IsCIBuild()`, so local developer emulators aren't
touched.
- On images without the Play Store, `SafeAdbShell` just logs the
harmless `pm` error.

#### CI evidence

The same sequence appears in the drop logcats of three app crashes that
the in-job retry recovered, in candidate UI build
[1686708](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1686708):
- Material3 on API 36: GMS replaced about 4 minutes after emulator
start.
- SafeAreaEdges on API 36.
- Border/Button on API 30: GMS replaced about 13 minutes after start.

The same retry-recovered crashes occur on `net11` UI build
[1685487](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685487),
so this isn't branch-specific. Across the observed jobs, the update
landed about 4–14 minutes after emulator start. `PrepareDevice` runs
about 1 minute after start, before that window.

#### Local validation

Fresh `-wipe-data` boots of `google_apis_playstore` arm64 AVDs
(pixel_5), checked every minute for GMS installs, GMS package removals,
and the GMS version:

| Run | Result over the monitoring window |
| --- | --- |
| API 30 baseline | Play Store self-updated at about 11 min. GMS updated
20.18.17 → 26.45.31 at about 13 min, with "pkg removed" and
ChimeraModuleLdr "forcing restart" kills. |
| API 30 + `pm disable-user` | 20 min: 0 installs, 0 GMS removals, still
20.18.17 |
| API 36 baseline | GMS updated 25.07.34 → 26.45.31 at about 4 min |
| API 36 + `pm disable-user`, applied about 20 s after boot | 15 min: 0
installs, 0 GMS removals, still 25.07.34 |

`dotnet cake eng/devices/android.cake --target=uitest-prepare --dryrun`
compiles the script. The full cake path is validated by this PR's actual
`maui-pr-uitests` run.

### Issues Fixed

No issue filed; this fixes flaky Android UI-test CI (app killed by a
Google Play services auto-update).

<!--
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: Copilot App <223556219+Copilot@users.noreply.github.com>
SuthiYuvaraj pushed a commit to SuthiYuvaraj/maui that referenced this pull request Nov 23, 2026
…et#40357)

<!-- 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

CI hardening only: no product, test, or assertion changes.

The Android UI-test emulators use `google_apis_playstore` images (API 30
and API 36, `eng/pipelines/common/ui-tests.yml`). A few minutes after
boot, the Play Store (Finsky, `reason=auto_update`) downloads and
installs a newer Google Play services APK. No Google account is needed
for this. Replacing `com.google.android.gms` makes every process that
loaded its dynamite/Chimera modules restart itself. The MAUI HostApp is
one of those processes:

```
PackageManager: Force stopping com.google.android.gms ... pkg removed
DynamiteLoaderV2Impl / ChimeraModuleLdr: Module config changed, forcing restart due to module googlecertificates | maps_dynamite
Sending signal. PID: <app> SIG: 9
ActivityManager: Process com.microsoft.maui.uitests (pid <app>) has died: fg TOP
```

The running UI test then fails in TearDown with "The app was expected to
be running still". The in-job retry usually recovers, but the crash
costs a retry. It can also fail the job when the kill lands during the
retry.

This PR disables the Play Store package on CI emulators in
`PrepareDevice`, using `pm disable-user --user 0 com.android.vending`.
That call works without root on user builds.
- Google Play services itself stays enabled and unchanged.
- The disabled state persists across the emulator recovery restarts,
because they don't wipe data.
- It runs only under `IsCIBuild()`, so local developer emulators aren't
touched.
- On images without the Play Store, `SafeAdbShell` just logs the
harmless `pm` error.

#### CI evidence

The same sequence appears in the drop logcats of three app crashes that
the in-job retry recovered, in candidate UI build
[1686708](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1686708):
- Material3 on API 36: GMS replaced about 4 minutes after emulator
start.
- SafeAreaEdges on API 36.
- Border/Button on API 30: GMS replaced about 13 minutes after start.

The same retry-recovered crashes occur on `net11` UI build
[1685487](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685487),
so this isn't branch-specific. Across the observed jobs, the update
landed about 4–14 minutes after emulator start. `PrepareDevice` runs
about 1 minute after start, before that window.

#### Local validation

Fresh `-wipe-data` boots of `google_apis_playstore` arm64 AVDs
(pixel_5), checked every minute for GMS installs, GMS package removals,
and the GMS version:

| Run | Result over the monitoring window |
| --- | --- |
| API 30 baseline | Play Store self-updated at about 11 min. GMS updated
20.18.17 → 26.45.31 at about 13 min, with "pkg removed" and
ChimeraModuleLdr "forcing restart" kills. |
| API 30 + `pm disable-user` | 20 min: 0 installs, 0 GMS removals, still
20.18.17 |
| API 36 baseline | GMS updated 25.07.34 → 26.45.31 at about 4 min |
| API 36 + `pm disable-user`, applied about 20 s after boot | 15 min: 0
installs, 0 GMS removals, still 25.07.34 |

`dotnet cake eng/devices/android.cake --target=uitest-prepare --dryrun`
compiles the script. The full cake path is validated by this PR's actual
`maui-pr-uitests` run.

### Issues Fixed

No issue filed; this fixes flaky Android UI-test CI (app killed by a
Google Play services auto-update).

<!--
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: Copilot App <223556219+Copilot@users.noreply.github.com>
SuthiYuvaraj pushed a commit to SuthiYuvaraj/maui that referenced this pull request Nov 25, 2026
…et#40357)

<!-- 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

CI hardening only: no product, test, or assertion changes.

The Android UI-test emulators use `google_apis_playstore` images (API 30
and API 36, `eng/pipelines/common/ui-tests.yml`). A few minutes after
boot, the Play Store (Finsky, `reason=auto_update`) downloads and
installs a newer Google Play services APK. No Google account is needed
for this. Replacing `com.google.android.gms` makes every process that
loaded its dynamite/Chimera modules restart itself. The MAUI HostApp is
one of those processes:

```
PackageManager: Force stopping com.google.android.gms ... pkg removed
DynamiteLoaderV2Impl / ChimeraModuleLdr: Module config changed, forcing restart due to module googlecertificates | maps_dynamite
Sending signal. PID: <app> SIG: 9
ActivityManager: Process com.microsoft.maui.uitests (pid <app>) has died: fg TOP
```

The running UI test then fails in TearDown with "The app was expected to
be running still". The in-job retry usually recovers, but the crash
costs a retry. It can also fail the job when the kill lands during the
retry.

This PR disables the Play Store package on CI emulators in
`PrepareDevice`, using `pm disable-user --user 0 com.android.vending`.
That call works without root on user builds.
- Google Play services itself stays enabled and unchanged.
- The disabled state persists across the emulator recovery restarts,
because they don't wipe data.
- It runs only under `IsCIBuild()`, so local developer emulators aren't
touched.
- On images without the Play Store, `SafeAdbShell` just logs the
harmless `pm` error.

#### CI evidence

The same sequence appears in the drop logcats of three app crashes that
the in-job retry recovered, in candidate UI build
[1686708](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1686708):
- Material3 on API 36: GMS replaced about 4 minutes after emulator
start.
- SafeAreaEdges on API 36.
- Border/Button on API 30: GMS replaced about 13 minutes after start.

The same retry-recovered crashes occur on `net11` UI build
[1685487](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685487),
so this isn't branch-specific. Across the observed jobs, the update
landed about 4–14 minutes after emulator start. `PrepareDevice` runs
about 1 minute after start, before that window.

#### Local validation

Fresh `-wipe-data` boots of `google_apis_playstore` arm64 AVDs
(pixel_5), checked every minute for GMS installs, GMS package removals,
and the GMS version:

| Run | Result over the monitoring window |
| --- | --- |
| API 30 baseline | Play Store self-updated at about 11 min. GMS updated
20.18.17 → 26.45.31 at about 13 min, with "pkg removed" and
ChimeraModuleLdr "forcing restart" kills. |
| API 30 + `pm disable-user` | 20 min: 0 installs, 0 GMS removals, still
20.18.17 |
| API 36 baseline | GMS updated 25.07.34 → 26.45.31 at about 4 min |
| API 36 + `pm disable-user`, applied about 20 s after boot | 15 min: 0
installs, 0 GMS removals, still 25.07.34 |

`dotnet cake eng/devices/android.cake --target=uitest-prepare --dryrun`
compiles the script. The full cake path is validated by this PR's actual
`maui-pr-uitests` run.

### Issues Fixed

No issue filed; this fixes flaky Android UI-test CI (app killed by a
Google Play services auto-update).

<!--
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: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 2d76f659 Deployed Nov 18, 2026 by kubaflo via conclusion #3060
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants