Skip to content

Deprecate Util.SDK_INT in favor of Build.VERSION.SDK_INT #2285

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

Merged
merged 3 commits into from
Apr 22, 2025

Conversation

MGaetan89
Copy link
Contributor

Util.SDK_INT was introduced to be able to simulate any SDK version during tests. This is possible by using Robolectric's @Config(sdk) annotation.
All usages of Util.SDK_INT have been replaced by Build.VERSION.SDK_INT.

This is a similar change to what was done in #2107.

@MGaetan89 MGaetan89 force-pushed the deprecate_util_sdkint branch 6 times, most recently from bbb8d60 to 4b6edd6 Compare April 2, 2025 17:10
@MGaetan89 MGaetan89 force-pushed the deprecate_util_sdkint branch 3 times, most recently from 59780a8 to 59bd21d Compare April 14, 2025 13:09
@tonihei
Copy link
Collaborator

tonihei commented Apr 17, 2025

Thanks for trying to replace all these usages :)

The value was in fact not only used for Robolectric, but also to allow special logic for pre-releases of Android that don't have a real version number yet. We haven't used this field for that purpose in years though, and if we wanted to, we could just use a more localized check while the pre-release hasn't got its new number.

`Util.SDK_INT` was introduced to be able to simulate any SDK version during tests.
This is possible by using Robolectric's `@Config(sdk)` annotation.
All usages of `Util.SDK_INT` have been replaced by `Build.VERSION.SDK_INT`.

This is a similar change to what was done in androidx#2107.
@tonihei tonihei force-pushed the deprecate_util_sdkint branch from 59bd21d to bfa8c0d Compare April 17, 2025 14:56
@tonihei tonihei force-pushed the deprecate_util_sdkint branch from bfa8c0d to 340264e Compare April 17, 2025 14:59
Deprecatations don't need to be noted
@tonihei tonihei self-assigned this Apr 17, 2025
@copybara-service copybara-service bot merged commit 4d9f479 into androidx:main Apr 22, 2025
1 check passed
@MGaetan89 MGaetan89 deleted the deprecate_util_sdkint branch April 22, 2025 11:54
@androidx androidx locked and limited conversation to collaborators Jun 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants