-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mono.Android] Fix some incorrect enums. #7670
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jpobst
force-pushed
the
enum-audit
branch
3 times, most recently
from
January 5, 2023 20:52
cfac5b0
to
0396dfa
Compare
jonpryor
pushed a commit
to dotnet/java-interop
that referenced
this pull request
Jan 7, 2023
…1070) Context: dotnet/android#7670 While auditing the `Mono.Android.dll`, we've found that some constants were added to the wrong enums. Consider [`xamarin-android/src/Mono.Android/map.csv`][0], lines 739-743: E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_ACTIVE,10,Android.App.Usage.StandbyBucket,Active,remove, E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_FREQUENT,30,Android.App.Usage.StandbyBucket,Frequent,remove, E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_RARE,40,Android.App.Usage.StandbyBucket,Rare,remove, E,30,android/app/usage/UsageStatsManager.STANDBY_BUCKET_RESTRICTED,45,Android.App.Usage.UsageStatsInterval,Restricted,remove, E,28,android/app/usage/UsageStatsManager.STANDBY_BUCKET_WORKING_SET,20,Android.App.Usage.StandbyBucket,WorkingSet,remove, `STANDBY_BUCKET_RESTRICTED` should have been added to `StandbyBucket` instead of `UsageStatsInterval`. To fix this in a backwards-compatible way, we can add it to both enums: E,30,android/app/usage/UsageStatsManager.STANDBY_BUCKET_RESTRICTED,45,Android.App.Usage.StandbyBucket,Restricted,remove, A,30,,45,Android.App.Usage.UsageStatsInterval,Restricted,remove, However, we have no way to mark `UsageStatsInterval.Restricted` as `[Obsolete]`, so people may still unintentionally use it. Add a new field to our csv that allows us to set a constant's `@deprecated-since` field, the `30` at the end: A,30,,45,Android.App.Usage.UsageStatsInterval,Restricted,remove,,30 This allows us to generate: [global::System.Runtime.Versioning.ObsoletedOSPlatform ("android30.0")] Restricted = 45 Additionally, when the cause is that we accidentally added an invalid value to the enum, we should provide a better obsolete message, letting the user know that the value will not function. This is done by setting `@deprecated-since` to `-1`: A,30,,45,Android.App.Usage.UsageStatsInterval,Restricted,remove,,-1 resulting in: [global::System.Obsolete (@"This value was incorrectly added to the enumeration and is not a valid value")] Restricted = 45 [0]: https://github.com/xamarin/xamarin-android/blob/cc70ce20aff6934532a8cb6a7bddbf3710fd7e1c/src/Mono.Android/map.csv
jpobst
force-pushed
the
enum-audit
branch
3 times, most recently
from
January 12, 2023 15:21
deb7119
to
c0c5c93
Compare
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 18, 2023
* main: [Mono.Android] Android.Telecom.InCallService.SetAudioRoute() + enum (dotnet#7711) [Mono.Android] Fix some incorrect enums. (dotnet#7670) [Xamarin.Android.Build.Tasks] _Microsoft.Android.Resource.Designer namespace (dotnet#7681) LEGO: Merge pull request 7713 [Xamarin.Android.Build.Tasks] lazily populate Resource lookup (dotnet#7686)
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 19, 2023
* main: [ci] Pass token when building Designer tests (dotnet#7715) [Mono.Android] Android.Telecom.InCallService.SetAudioRoute() + enum (dotnet#7711) [Mono.Android] Fix some incorrect enums. (dotnet#7670) [Xamarin.Android.Build.Tasks] _Microsoft.Android.Resource.Designer namespace (dotnet#7681) LEGO: Merge pull request 7713 [Xamarin.Android.Build.Tasks] lazily populate Resource lookup (dotnet#7686)
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 26, 2023
* main: (32 commits) [monodroid] Replace `exit()` with `abort()` in native code (dotnet#7734) Bump to xamarin/Java.Interop/main@8a1ae57 (dotnet#7738) [build] bump `$(AndroidNet7Version)` (dotnet#7737) Bump to xamarin/Java.Interop/main@1366d99 (dotnet#7718) [Xamarin.Android.Build.Tasks] fix AndroidGenerateResourceDesigner (dotnet#7721) Bump to xamarin/monodroid@50faac94 (dotnet#7725) Revert "[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (dotnet#7642)" (dotnet#7726) [marshal methods] Properly support arrays of arrays (dotnet#7707) Bump to dotnet/installer@9962c6a 8.0.100-alpha.1.23063.11 (dotnet#7677) [Actions] Add action to bump the hash used for the unified pipeline (dotnet#7712) Bump to xamarin/xamarin-android-tools/main@099fd95 (dotnet#7709) [ci] Move build stages into yaml templates (dotnet#7553) [Xamarin.Android.Build.Tasks] fix NRE in `<GenerateResourceCaseMap/>` (dotnet#7716) [ci] Pass token when building Designer tests (dotnet#7715) [Mono.Android] Android.Telecom.InCallService.SetAudioRoute() + enum (dotnet#7711) [Mono.Android] Fix some incorrect enums. (dotnet#7670) [Xamarin.Android.Build.Tasks] _Microsoft.Android.Resource.Designer namespace (dotnet#7681) LEGO: Merge pull request 7713 [Xamarin.Android.Build.Tasks] lazily populate Resource lookup (dotnet#7686) [Xamarin.Android.Build.Tasks] skip XA1034 logic in some cases (dotnet#7680) ...
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using Android's API-33
annotations.zip
, some missing and incorrect enum mappings were found.Missed Enumeration
Enums that were previously left as constants have been enumified and have had the old members added back to the API with manual additions code marked with
[Obsolete]
.to
Incorrect Enumeration
Other constants were assigned to the wrong enumeration. These have been marked as
[Obsolete]
and new values have been added to the correct enumeration.Example:
to: