Skip to content

[Mono.Android] Remove APIs dropped in API-37.2 platform r02 - #13661

Merged
jonathanpeppers merged 2 commits into
mainfrom
jonathanpeppers-bump-platform-37-2-revision
Nov 22, 2026
Merged

jonathanpeppers merged 2 commits into
mainfrom
jonathanpeppers-bump-platform-37-2-revision

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Context: https://issuetracker.google.com/issues/584834598
Context: #13388

Google republished the Android 37.2 platform as platform-37.2_r02. It removes APIs that were in platform-37.2_r01, which our API-37.2 binding is built from:

  • The android.app.personalcontext.* and android.service.personalcontext.* packages
  • The android.agenticon package
  • Notification.FLAG_AGENT_TASK_INTERACTION_*, Notification.getAgentInteractionFlags(), Notification.Builder.setAgentInteractionFlags(), and NotificationListenerService.Ranking.getAgentInteractionFlags()
  • StatusBarManager.ACTION_AGENT_TASK_MAIN, canSetAgentTask(), getAgentStateScreenLocation(), isAgentTaskFeatureSupported(), isAgentTaskLaunchSupported(), and setAgentTask()

These bindings call Java members that no longer exist on r02 devices, so remove them. Update platform-37.2_r01 to platform-37.2_r02 in androidsdk.targets, the same bump as in #13388, and remove the related map.csv, methodmap.csv, and metadata entries.

This change must also go to servicing, so it binds only changes that do not break C# code. r02 also has these changes, which are intentionally not bound:

  • New: Manifest.permission.READ_UPDATE_ENGINE_LOGS and ViewGroup.requestChildRectangleOnScreen(View, Rect, boolean, int).
  • PolicyIdentifier is no longer final. Unsealing it in C# makes its (IntPtr, JniHandleOwnership) constructor protected, which adds public API.
  • The HandlerThread(String, int) parameter is renamed from priority to linuxPriority. This breaks C# callers that use named arguments.

The only binding change kept is [Obsolete] on PolicyIdentifier.CreateForTesting(), because r02 deprecates it.

api-37.2.xml and api-37.2.params.txt were regenerated with class-parse, api-xml-adjuster, api-merge, and java-source-utils against r01 and r02. The r01 output was compared with the committed files to confirm the tools reproduce them; then only the r01 → r02 removals and the deprecation were applied.

Validation:

  • build.cmd Prepare: passed; downloaded platform-37.2_r02.zip, SHA-1 matches repository2-3.xml.
  • dotnet-local.cmd build Microsoft.Android.slnx: passed.
  • dotnet-local.cmd build src/Mono.Android/Mono.Android.csproj -p:AndroidApiLevel=37.2 -p:AndroidPlatformId=37.2 -p:AndroidFrameworkVersion=v17.2: passed, 0 errors; CheckApiCompatibility for v17.2 (against v17.1) passed.

Context: https://issuetracker.google.com/issues/584834598
Context: #13388

Google republished the Android 37.2 platform as `platform-37.2_r02`. It removes APIs that were in `platform-37.2_r01`, which our API-37.2 binding is built from:

  * The `android.app.personalcontext.*` and `android.service.personalcontext.*` packages
  * The `android.agenticon` package
  * `Notification.FLAG_AGENT_TASK_INTERACTION_*`, `Notification.getAgentInteractionFlags()`, `Notification.Builder.setAgentInteractionFlags()`, and `NotificationListenerService.Ranking.getAgentInteractionFlags()`
  * `StatusBarManager.ACTION_AGENT_TASK_MAIN`, `canSetAgentTask()`, `getAgentStateScreenLocation()`, `isAgentTaskFeatureSupported()`, `isAgentTaskLaunchSupported()`, and `setAgentTask()`

These bindings call Java members that no longer exist on r02 devices, so remove them. Update `platform-37.2_r01` to `platform-37.2_r02` in `androidsdk.targets`, the same bump as in #13388, and remove the related `map.csv`, `methodmap.csv`, and `metadata` entries.

This change must also go to servicing, so it binds only changes that do not break C# code. r02 also has these changes, which are intentionally not bound:

  * New: `Manifest.permission.READ_UPDATE_ENGINE_LOGS` and `ViewGroup.requestChildRectangleOnScreen(View, Rect, boolean, int)`.
  * `PolicyIdentifier` is no longer `final`. Unsealing it in C# makes its `(IntPtr, JniHandleOwnership)` constructor `protected`, which adds public API.
  * The `HandlerThread(String, int)` parameter is renamed from `priority` to `linuxPriority`. This breaks C# callers that use named arguments.

The only binding change kept is `[Obsolete]` on `PolicyIdentifier.CreateForTesting()`, because r02 deprecates it.

`api-37.2.xml` and `api-37.2.params.txt` were regenerated with `class-parse`, `api-xml-adjuster`, `api-merge`, and `java-source-utils` against r01 and r02. The r01 output was compared with the committed files to confirm the tools reproduce them; then only the r01 → r02 removals and the deprecation were applied.

Validation:

  * `build.cmd Prepare`: passed; downloaded `platform-37.2_r02.zip`, SHA-1 matches `repository2-3.xml`.
  * `dotnet-local.cmd build Microsoft.Android.slnx`: passed.
  * `dotnet-local.cmd build src/Mono.Android/Mono.Android.csproj -p:AndroidApiLevel=37.2 -p:AndroidPlatformId=37.2 -p:AndroidFrameworkVersion=v17.2`: passed, 0 errors; `CheckApiCompatibility` for v17.2 (against v17.1) passed.

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

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.

🟡 Changes recommended

An API-37.2 rebuild without cleaning can retain deleted types because stale generated files and Compile items remain included.

1 open issue
What changed in this PR

Aligns Mono.Android’s API-37.2 bindings with Android platform r02, removing bindings for unavailable Java APIs while leaving unrelated C# API changes out of scope for servicing.

Changes:

  • Removes personal-context, agent-icon, and related notification/status-bar bindings.
  • Cleans up associated metadata and mappings; marks PolicyIdentifier.CreateForTesting() obsolete.
  • Updates the platform archive and checksum to r02, matching #13388.
File Description
src/​Mono.Android/​Profiles/​api-37.2.xml Removes dropped APIs and records the deprecation.
src/​Mono.Android/​Profiles/​api-37.2.params.txt Removes parameter metadata for deleted APIs.
src/​Mono.Android/​methodmap.csv Removes enum conversions for deleted members.
src/​Mono.Android/​metadata Removes unused namespace replacements.
src/​Mono.Android/​map.csv Removes associated enum and constant mappings.
src/​androidsdk/​androidsdk.targets Pins the r02 platform archive and checksum.

Review effort: Balanced

Comment thread src/Mono.Android/Profiles/api-37.2.xml Resolved
jonathanpeppers added a commit to dotnet/android-api-docs that referenced this pull request Nov 19, 2026
Google republished the Android 37.2 platform as platform-37.2_r02
(https://issuetracker.google.com/issues/584834598). dotnet/android#13661
updates the API-37.2 binding to match. Update the docs to that binding:

* Remove the Android.AgentIcon, Android.App.PersonalContext*, and
  Android.Service.PersonalContext* namespaces and their types.
* Remove Android.App.NotificationAgentTaskInteractionFlags.
* Remove the agent-task members from Notification, Notification.Builder,
  NotificationListenerService.Ranking, and StatusBarManager.
* Add [Obsolete("deprecated")] to PolicyIdentifier.CreateForTesting(string).
* Remove the matching entries and NamespaceMapping attributes from
  FrameworksIndex/net-android-37.0.xml and index.xml.

The removal set was verified against `mdoc update --delete` run on a
scratch copy with the r02 Mono.Android.dll; unrelated mdoc churn from
other dotnet/android changes is excluded.

Co-authored-by: Copilot App <[email protected]>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Nov 20, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #13661

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

⚠️ CI pending — no blocking code findings. Findings: 0 ❌ errors, 0 ⚠️ code warnings, 1 💡 inline documentation suggestion.

The changes are narrowly scoped: the withdrawn packages and their enum/method/namespace mappings are removed together, the Notification and StatusBarManager removals match the stated scope, and the only modified surviving XML member is the PolicyIdentifier.createForTesting() deprecation. Whole-file searches found no remaining references to the withdrawn packages or agent-task members in the Mono.Android source. The retained PolicyIdentifier finality and HandlerThread parameter name match the stated compatibility decisions. The platform revision and SHA-256 match #13388. I did not re-flag the resolved, pre-existing local incremental-generation issue.

CI: Of the 7 checks currently reported for build 1692969, 2 passed, 4 are running, and 1 is queued; none is currently failing. Azure build/timeline queries were unavailable, so the overall Azure result is not independently confirmed and this is not a green-CI verdict.

Review limits: The large generated profiles were inspected through diff hunks, relevant surrounding source, and whole-file reference searches rather than an exhaustive line-by-line reading of all 43 MB of changed files. Local builds and regeneration were not rerun; the build results in the description remain author-reported.

Generated by Android PR Reviewer for #13661 · copilot · gpt61 · 39 AIC · ⌖ 4.74 AIC · ⊞ 21K
Comment /review to run again

@@ -14510,7 +14491,7 @@
<typeParameters>
<typeParameter name="T" classBound="java.lang.Object" jni-classBound="Ljava/lang/Object;"></typeParameter>
</typeParameters>
<method abstract="false" deprecated="not deprecated" final="false" name="createForTesting" jni-signature="(Ljava/lang/String;)Landroid/app/admin/PolicyIdentifier;" bridge="false" native="false" return="android.app.admin.PolicyIdentifier&lt;U&gt;" jni-return="Landroid/app/admin/PolicyIdentifier&lt;TU;&gt;;" return-not-null="true" static="true" synchronized="false" synthetic="false" visibility="public">
<method abstract="false" deprecated="deprecated" final="false" name="createForTesting" jni-signature="(Ljava/lang/String;)Landroid/app/admin/PolicyIdentifier;" bridge="false" native="false" return="android.app.admin.PolicyIdentifier&lt;U&gt;" jni-return="Landroid/app/admin/PolicyIdentifier&lt;TU;&gt;;" return-not-null="true" static="true" synchronized="false" synthetic="false" visibility="public">

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.

🤖 💡 Documentation — Could you record the deliberate r01/r02 profile differences in an in-tree maintenance note, rather than only in the PR description? This profile now intentionally keeps PolicyIdentifier final and HandlerThread's priority parameter name while adopting this r02 deprecation. A future regeneration against the newly pinned r02 SDK could silently undo those compatibility decisions. A short note near the relevant metadata/profile maintenance instructions would make the exceptions discoverable when updating bindings.

{Rule: Document non-obvious behavioral decisions; preserve API compatibility}

@jonathanpeppers
jonathanpeppers merged commit 8613c27 into main Nov 22, 2026
38 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-bump-platform-37-2-revision branch November 22, 2026 22:34
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

jonathanpeppers added a commit that referenced this pull request Nov 22, 2026
Context: #13388
Context: #13661
Context: https://issuetracker.google.com/issues/584834598

#13388 bumped `platform-37.2_r01` to `platform-37.2_r02` and changed only the hash. r02 removed public API that `src/Mono.Android/Profiles/api-37.2.xml` still bound, and nobody saw it until #13661. The removed APIs had no `@SystemApi`, `@FlaggedApi`, or `@hide` in r01, so an annotation filter would not catch this. A diff of the two `android.jar` files does.

Add `scripts/diff_platform_api.cs` to the `update-androidsdk-packages` skill:

    dotnet run .github/skills/update-androidsdk-packages/scripts/diff_platform_api.cs -- \
      <old-zip-url> <old-sha256> <new-zip-url> <new-sha1> <new-size>

It checks the old zip against the SHA-256 pinned in `androidsdk.targets` and the new zip against the manifest SHA-1 and size. It hashes every `.class` in both `android.jar` files, runs `javap -protected` on the removed, added, and changed classes, and prints a Markdown report with the new SHA-256. Package-private types are ignored. `javap` does not show parameter names, so a parameter rename is not reported.

New hard rule 8: every revision bump of an existing `_PlatformPackage` entry puts the report in the PR description. If public API was removed or changed, the PR still opens, but its description starts with a "Do not merge" warning to update `api-<level>.xml` first. skill-runner can only change `Configuration.props` and `androidsdk.targets`, so it cannot fix the binding itself; stopping would hide the change in the tracking issue. `skill-runner.md` (lock recompiled), `package-catalog.md`, and a new eval follow the same rule.

Co-authored-by: Copilot App <[email protected]>
jonathanpeppers added a commit that referenced this pull request Nov 23, 2026
…13711)

Context: https://issuetracker.google.com/issues/584834598
Context: #13388

Google republished the Android 37.2 platform as `platform-37.2_r02`. It removes APIs that were in `platform-37.2_r01`, which our API-37.2 binding is built from:

  * The `android.app.personalcontext.*` and `android.service.personalcontext.*` packages
  * The `android.agenticon` package
  * `Notification.FLAG_AGENT_TASK_INTERACTION_*`, `Notification.getAgentInteractionFlags()`, `Notification.Builder.setAgentInteractionFlags()`, and `NotificationListenerService.Ranking.getAgentInteractionFlags()`
  * `StatusBarManager.ACTION_AGENT_TASK_MAIN`, `canSetAgentTask()`, `getAgentStateScreenLocation()`, `isAgentTaskFeatureSupported()`, `isAgentTaskLaunchSupported()`, and `setAgentTask()`

These bindings call Java members that no longer exist on r02 devices, so remove them. Update `platform-37.2_r01` to `platform-37.2_r02` in `androidsdk.targets`, the same bump as in #13388, and remove the related `map.csv`, `methodmap.csv`, and `metadata` entries.

This change must also go to servicing, so it binds only changes that do not break C# code. r02 also has these changes, which are intentionally not bound:

  * New: `Manifest.permission.READ_UPDATE_ENGINE_LOGS` and `ViewGroup.requestChildRectangleOnScreen(View, Rect, boolean, int)`.
  * `PolicyIdentifier` is no longer `final`. Unsealing it in C# makes its `(IntPtr, JniHandleOwnership)` constructor `protected`, which adds public API.
  * The `HandlerThread(String, int)` parameter is renamed from `priority` to `linuxPriority`. This breaks C# callers that use named arguments.

The only binding change kept is `[Obsolete]` on `PolicyIdentifier.CreateForTesting()`, because r02 deprecates it.

`api-37.2.xml` and `api-37.2.params.txt` were regenerated with `class-parse`, `api-xml-adjuster`, `api-merge`, and `java-source-utils` against r01 and r02. The r01 output was compared with the committed files to confirm the tools reproduce them; then only the r01 → r02 removals and the deprecation were applied.

Validation:

  * `build.cmd Prepare`: passed; downloaded `platform-37.2_r02.zip`, SHA-1 matches `repository2-3.xml`.
  * `dotnet-local.cmd build Microsoft.Android.slnx`: passed.
  * `dotnet-local.cmd build src/Mono.Android/Mono.Android.csproj -p:AndroidApiLevel=37.2 -p:AndroidPlatformId=37.2 -p:AndroidFrameworkVersion=v17.2`: passed, 0 errors; `CheckApiCompatibility` for v17.2 (against v17.1) passed.

Co-authored-by: Jonathan Peppers <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants