Skip to content

[Mono.Android] Enumify, stabilize API-37.2 - #12633

Merged
jonathanpeppers merged 5 commits into
dotnet:mainfrom
jonpryor:dev/jonpryor/jonp-enumify-api-37.2
Sep 3, 2026
Merged

[Mono.Android] Enumify, stabilize API-37.2#12633
jonathanpeppers merged 5 commits into
dotnet:mainfrom
jonpryor:dev/jonpryor/jonp-enumify-api-37.2

Conversation

@jonpryor

Copy link
Copy Markdown
Contributor

Context: 1162306
Context: https://github.com/jpobst/BindingStudio
Context: #10005

Commit 1162306 mentioned:

Step 1: bind it!
Step 2: Enumify it, make stable.

This is Step 2 for API-37.2.

Use jpobst/BindingStudio to begin enumifying API-37.2.

Note: current dotnet/java-interop emits an "extra" , on map.csv output, which would make for a "noisy" diff (every line changed!). The diff size is reduced by removing trailing commas:

tr -d '\r' < src/Mono.Android/map.csv > src/Mono.Android/new-map.csv
sed 's/,$//' < src/Mono.Android/new-map.csv > src/Mono.Android/map.csv

This keeps the diff to a reasonable size.

Sanity check: during enumification, this should have no matches:

 git grep '\.[A-Z][a-z]\.' src/Mono.Android/map.csv

Two-letter namespace parts should be all upper-case.

TODO (lol): update map.csv to current BindingStudio output after this is merged.

Additionally, rename the following Java package parts:

  • contentsafety => ContentSafety
  • personalcontext => PersonalContext
  • multisensory => MultiSensory
  • authenticationpolicy => AuthenticationPolicy

For example, Java android.service.personalcontext becomes C# Android.Service.PersonalContext.


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

Context: 1162306
Context: https://github.com/jpobst/BindingStudio
Context: dotnet#10005
Commit 1162306 mentioned:
> Step 1: bind it!
> Step 2: Enumify it, make stable.
This is Step 2 for API-37.2.
Use jpobst/BindingStudio to enumify API-37.2.
Note: current dotnet/java-interop emits an "extra" `,` on `map.csv`
output, which would make for a "noisy" diff (every line changed!).
The diff size is reduced by removing trailing commas:
tr -d '\r' < src/Mono.Android/map.csv > src/Mono.Android/new-map.csv
sed 's/,$//' < src/Mono.Android/new-map.csv > src/Mono.Android/map.csv
This keeps the diff to a reasonable size.
Sanity check: during enumification, this should have no matches:
git grep '\.[A-Z][a-z]\.' src/Mono.Android/map.csv
Two-letter namespace parts should be all upper-case.
TODO (lol): update `map.csv` to current BindingStudio output after
this is merged.
Additionally, rename the following Java package parts:
* `contentsafety` => `ContentSafety`
* `personalcontext` => `PersonalContext`
* `multisensory` => `MultiSensory`
* `authenticationpolicy` => `AuthenticationPolicy`
For example, Java `android.service.personalcontext` becomes
C# `Android.Service.PersonalContext`.
Furthermore, for "methodmap.csv", BindingStudio emits JNI names with
`/` as the package-part separator, not Java names with `.` as the
separator. Please remember the instructions to manually fix this as
mentioned in `HowToAddNewApiLevel.md`.
Finally (?), as *mentioned* in `HowToAddNewApiLevel`, update
manifest-attribute-codegen by running:
./dotnet-local.sh build -t:GenerateManifestAttributes build-tools/manifest-attribute-codegen/manifest-attribute-codegen.csproj
@jonpryor
jonpryorforce-pushed the dev/jonpryor/jonp-enumify-api-37.2 branch from b66a05e to 6c6ea8eCompareSeptember 2, 2026 00:36
@jonpryor
jonpryor marked this pull request as ready for review September 2, 2026 00:36
@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actionsBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #12633

@github-actionsgithub-actionsBot 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.

❌ Reject

Found 3 errors affecting generated/public API shape:

  • manifest-definition.xml was regenerated from an incomplete platform history, rewriting legacy introduction levels to API 35 and dropping older-only entries.
  • Four new enum families use namespace casing inconsistent with their existing bound packages.
  • InsightBranding.Builder.setColor() uses the icon discriminator enum instead of the color discriminator enum.

The enumification coverage and updated workflow guidance are otherwise useful, but these generated API defects need correction before merge.

CI: Azure build #1577851 is red; the only failing surfaced lane is MAUI Tests MAUI Integration, while the remaining 42 checks pass. Detailed Azure timeline access was unavailable in this runner, so I could not determine whether that lane is related to this PR.

Generated by Android PR Reviewer for #12633 · gpt56 · 247 AIC · ⌖ 9.18 AIC · ⊞ 25.7K
Comment /review to run again

Comment threadbuild-tools/manifest-attribute-codegen/manifest-definition.xml Outdated
Comment threadsrc/Mono.Android/map.csv Outdated
Comment threadsrc/Mono.Android/methodmap.csv Outdated
Regenerate manifest definitions with all historical SDK platforms and restore metadata for legacy-only attributes. Keep new enum namespaces consistent with existing bindings and use the correct InsightBranding color discriminator.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4300e551-3e6c-494d-8670-9abb460aea7d
@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actionsBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #12633

@github-actionsgithub-actionsBot 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.

⚠️ Needs Changes

Found 1 error, 2 warnings, and 1 suggestion. The main blocker is the missed SelectionPosition.Builder.setOffsetType enumification; the 37.2 stability fallback and KeyPair public type casing should also be corrected before this API becomes stable. The generated method map still contains several exact duplicates despite the newly documented uniq step.

The package-name normalization and expanded API 37.2 mapping coverage are otherwise well-scoped. Azure build #1579370 is still in progress; no check had failed when reviewed.

Generated by Android PR Reviewer for #12633 · gpt56 · 368.7 AIC · ⌖ 23.5 AIC · ⊞ 25.7K
Comment /review to run again

Comment threadConfiguration.props
Comment threadsrc/Mono.Android/methodmap.csv Outdated
Comment threadsrc/Mono.Android/methodmap.csv Outdated
Comment threadsrc/Mono.Android/map.csv Outdated
Keep the standalone stability fallback aligned with API 37.2, complete matching enum mappings, remove duplicate generated rows, and use consistent KeyPair casing.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4300e551-3e6c-494d-8670-9abb460aea7d
@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actionsBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #12633

@github-actionsgithub-actionsBot 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.

❌ Reject

Found 2 errors in methodmap.csv: all 247 API 37.2 additions retain BindingStudio action columns that the generator parser does not support, and screenBrightnessUnit is encoded as a method parameter rather than a field mapping. Together these leave the intended enumifications unapplied while this PR marks API 37.2 stable.

The namespace normalization, constant mappings, and workflow guidance are otherwise useful and well scoped.

CI: Azure build #1579514 is still in progress. Two surfaced checks have passed, six are running, one is queued, and none has failed; detailed Azure status was unavailable because the runner could not initialize its Azure CLI profile.

Generated by Android PR Reviewer for #12633 · gpt56 · 201.2 AIC · ⌖ 20.2 AIC · ⊞ 25.7K
Comment /review to run again

Comment threadsrc/Mono.Android/methodmap.csv Outdated
Comment threadsrc/Mono.Android/methodmap.csv Outdated
Convert BindingStudio action rows to the six-column method-map format consumed by the generator, correct the screenBrightnessUnit field mapping, and document the required normalization step.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4300e551-3e6c-494d-8670-9abb460aea7d
@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actionsBot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #12633

@github-actionsgithub-actionsBot 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.

⚠️ Needs Changes

Found 1 warning: InsightActionDetailsActionType is generated as a regular enum even though its ACTION_HAS_* values form the bitmask returned by getActionTypes(). Marking that enum family as flags will keep the newly stable managed API faithful to the platform.

The namespace normalization, corrected six-column method mappings, and getter/setter enum coverage otherwise look consistent.

CI: Azure build #1579627 is still in progress. Three surfaced checks have passed, five are running, one is queued, and none has failed.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • azcliprod.blob.core.windows.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
allowed:
- defaults
- "azcliprod.blob.core.windows.net"

See Network Configuration for more information.

Generated by Android PR Reviewer for #12633 · gpt56 · 349.6 AIC · ⌖ 8.86 AIC · ⊞ 25.7K
Comment /review to run again

Comment threadsrc/Mono.Android/map.csv Outdated
Generate InsightActionDetailsActionType as a flags enum because the platform combines its independent action bits.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4300e551-3e6c-494d-8670-9abb460aea7d
@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actionsBot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #12633

@github-actionsgithub-actionsBot 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.

⚠️ Needs Changes

Found 1 suggestion in the documented method-map workflow: rerunning the append-based process can introduce non-adjacent duplicates that the subsequent uniq command cannot remove.

The API 37.2 enum mappings, namespace replacements, stability pointers, and revision-qualified manifest metadata are otherwise internally consistent, and the defects raised by earlier reviews are fixed.

CI: Azure build #1579652 is red: 41 of 44 checks pass, while MAUI Tests MAUI Integration, Windows > Build & Smoke Test, and the aggregate dotnet-android check fail. Detailed Azure timeline access was unavailable in this runner, so I could not attribute those failures to this PR; CI must be investigated before merge.

Generated by Android PR Reviewer for #12633 · gpt56 · 428.9 AIC · ⌖ 8.94 AIC · ⊞ 25.7K
Comment /review to run again

sed 's/^E,//;s,/,.,g;s/\$/./g' > src/Mono.Android/new-methodmap2.csv
```

Copy the contents of `new-methodmap2.csv` and *append* to `src/Mono.Android/methodmap.csv`.

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 — Appending the generated block makes this workflow non-idempotent: rerunning it for the same API appends the same mappings again, and the uniq command below only removes adjacent duplicates, so it will not remove a duplicated block. Please either replace the existing API-level block or use an order-preserving whole-file deduplication step after appending.

Rule: Generation workflows should be repeatable

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.

I think this is fine, it's a doc.

@jonathanpeppersjonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Sep 3, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member

We can ignore MAUI Tests MAUI Integration, it doesn't work on forks until this (just merged):

@jonathanpeppers
jonathanpeppers merged commit 9608c4d into dotnet:mainSep 3, 2026
42 of 44 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-reviewThis 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

@jonpryor@jonathanpeppers@dalexsoto