Skip to content
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

Upgrade android SDK to API 32 #33524

Merged
merged 14 commits into from
Jun 2, 2022
Merged

Conversation

GaryQian
Copy link
Contributor

@GaryQian GaryQian commented May 21, 2022

Engine uses android API 32 as well as updated support tools.

Package: https://chrome-infra-packages.appspot.com/p/flutter/android/sdk/all

Resolves flutter/flutter#103713

This patch contains lint forward fixes as well as ignores to address the new lints added in http://tools.android.com/tips/lint-checks

@Nullable BinaryMessenger.BinaryMessageHandler handler,
@Nullable TaskQueue taskQueue) {
messenger.setMessageHandler(channel, handler, taskQueue);
@Nullable TaskQueue taskQueue,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, what is the linter trying to enforce?

@Nullable BinaryMessageHandler handler,
@Nullable TaskQueue taskQueue) {
@Nullable TaskQueue taskQueue,
@Nullable BinaryMessageHandler handler) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is certainly a breaking change :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I wanted your opinion on this. There is a family of kotlin compatibility checks that enforces lambdas to be at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could just ignore this lint as it the only way to resolve it is to follow its suggestions

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is pretty severe change. I think we would need to disable this specific linter check, and file an issue for modernizing the embedding, so it's more Kotlin friendly. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm!

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

message="Field requires API level 21 (current min is 16): `android.view.HapticFeedbackConstants#CLOCK_TICK`"
errorLine1=" view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
message="Field requires API level 21 (current min is 16): `android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS`"
Copy link

@blasten blasten Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be removed if we specify a TargetApi(21) annotation in ?

private void setSystemChromeSystemUIOverlayStyle(

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment for the ones below, but using the specified min API

@@ -7,5 +7,13 @@
compatible all the way back to API 16. See
https://developer.android.com/studio/write/java8-support.html#supported_features -->
<ignore regexp="^Try-with-resources requires API level 19"/>
</issue>
</issue>
<issue id="UnknownNullness" severity="ignore" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also part of the Kotlin interop, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one in particular causes something on the order of ~500 errors

@@ -135,6 +90,7 @@
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/TextInputChannel.java" />
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java" />
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/KeyEventChannel.java" />
<src file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/SpellCheckChannel.java" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this file can get out of sync. what about adding some code to ensure that if this file has uncommitted changes in the current git tree then android_lint fails?

It could go here: https://github.com/flutter/engine/blob/2962099077b36704071802ea5595f4a016a1c214/tools/android_lint/bin/main.dart

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a separate issue, so if you want to do this, feel free to do it in a different PR

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GaryQian GaryQian added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jun 2, 2022
@fluttergithubbot fluttergithubbot merged commit c617fd7 into flutter:main Jun 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 2, 2022
houhuayong pushed a commit to houhuayong/engine that referenced this pull request Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests platform-android waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flutter still uses Android SDK version 31 instead of most recent 32
3 participants