Use io.flutter.Build.API_LEVELS rather than android.os.Build.VERSION_CODES#51171
Use io.flutter.Build.API_LEVELS rather than android.os.Build.VERSION_CODES#51171auto-submit[bot] merged 14 commits intoflutter:mainfrom
io.flutter.Build.API_LEVELS rather than android.os.Build.VERSION_CODES#51171Conversation
matanlurey
left a comment
There was a problem hiding this comment.
As long as we're consistent one way or another (and it works with our linting strategy), I'm LGTM.
shell/platform/android/io/flutter/view/AccessibilityBridge.java
Outdated
Show resolved
Hide resolved
camsim99
left a comment
There was a problem hiding this comment.
Also LGTM! Glad to have something consistent moving forward.
|
This seems like a step backwards in terms of code readability. Before: "Build.VERSION_FOO" We lose our ability to search for something meaningful. Why are we making this change? At the very least, why don't we introduce our own "AndroidBuild.VERSION_N" for all N and use that instead of the raw integer? |
johnmccutchan
left a comment
There was a problem hiding this comment.
See my comment on the issue.
I think this works for me - but I'd want the raw integer in there, e.g. |
|
I have two reasons for wanting this change:
|
gmackall
left a comment
There was a problem hiding this comment.
LGTM! Glad we found a solution that maximizes both searchability and readability
|
Thanks for making my requested changes @dnfield |
|
|
||
| /** A replacement of utilities from android.os.Build. */ | ||
| public class Build { | ||
| /** For use in place of the Android VERSION CODES class. */ |
There was a problem hiding this comment.
Rewrite the comment so if someone searched for the official class they would find this:
/** For use in place of Build.VERSION_CODES class */
There was a problem hiding this comment.
I can do that, but I'll have to special case the forbidden imports script to allow it in this file.
There was a problem hiding this comment.
Can the linter detect that text is contained inside of a comment?
| /** A mandatory plugin that handles mouse cursor requests. */ | ||
| @TargetApi(Build.VERSION_CODES.N) | ||
| @RequiresApi(Build.VERSION_CODES.N) | ||
| @TargetApi(24) |
There was a problem hiding this comment.
I lost track of what these were - I'll update them all.
| */ | ||
| @TargetApi(Build.VERSION_CODES.M) | ||
| @RequiresApi(Build.VERSION_CODES.M) | ||
| @TargetApi(23) |
| @Override | ||
| @TargetApi(Build.VERSION_CODES.N) | ||
| @RequiresApi(Build.VERSION_CODES.N) | ||
| @TargetApi(24) |
| @@ -253,7 +255,7 @@ private void closeCurrentImage() { | |||
|
|
|||
| @TargetApi(29) | |||
| minSdk = API_LEVELS.API_24, | ||
| shadows = {}) | ||
| @RunWith(AndroidJUnit4.class) | ||
| @TargetApi(24) |
| @Config(manifest = Config.NONE) | ||
| @RunWith(AndroidJUnit4.class) | ||
| @TargetApi(P) | ||
| @TargetApi(28) |
| @RunWith(AndroidJUnit4.class) | ||
| @TargetApi(Build.VERSION_CODES.N) | ||
| @RequiresApi(Build.VERSION_CODES.N) | ||
| @TargetApi(24) |
Build.VERSION_CODESio.flutter.Build.API_LEVELS rather than android.os.Build.VERSION_CODES
| @@ -81,7 +82,7 @@ public void itDescribesNonTextFieldsWithAContentDescription() { | |||
| } | |||
|
|
|||
| @Config(sdk = 28) | |||
There was a problem hiding this comment.
I think all the @config values in this file should change to API_LEVELS.*
|
|
||
| @Test | ||
| @SdkSuppress(minSdkVersion = VERSION_CODES.M) | ||
| @SdkSuppress(minSdkVersion = 23) |
There was a problem hiding this comment.
Why are these not API_LEVELS?
| FLUTTER_LOG_CLASS) or CheckBadFiles( | ||
| bad_trace_files, 'android[x].tracing.Trace', FLUTTER_TRACE_CLASS | ||
| ) or CheckBadFiles( | ||
| bad_version_codes_files, 'android.os.Build.VERSION_CODES', |
There was a problem hiding this comment.
Consider adding either a description here or a pointer to why these are considered bad files.
There was a problem hiding this comment.
Added some comments.
|
auto label is removed for flutter/engine/51171, due to - The status or check suite Linux linux_android_debug_engine has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…ld.VERSION_CODES` (flutter/engine#51171)
flutter/engine@05fdf94...e099277 2024-03-08 dnfield@google.com Use `io.flutter.Build.API_LEVELS` rather than `android.os.Build.VERSION_CODES` (flutter/engine#51171) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Updates the linting script to ban the use of
VERSION_CODES.We currently have a mish-mash of using the integers, using
VERSION_CODES, and even how we import the version codes. This makes it more confusing when doing things like #51070 - I think it is clearer to see22thanLOLLIPOP_MR1.I'd like to get LGTM (or at least no opinion) from all the requested reviewers here.