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 34 "UpsideDownCake" #47609

Merged
merged 33 commits into from
Nov 8, 2023

Conversation

gmackall
Copy link
Member

@gmackall gmackall commented Nov 2, 2023

This should not land until flutter/buildroot#790 (re)lands, and I swap the buildroot url back to the latest commit. ~Reland of PR to update buildroot at flutter/buildroot#792. ~ <- landed, and changed the buildroot commit to the latest in DEPS

Upgrades to android api 34

Also:

  1. Upgrades to java 17 in DEPS/ci, because the linter now requires it.
  2. Stops running some roboelectric tests on android apis 16-18, because Roboelectric indicated those versions were unsupported and we don't support them either.
  3. Applies the four trivial new suggestions from the newer linter.
  4. Updates the baseline lint to include the new non-trivial lint (fixed in a different PR).
  5. Changes some instances where we were hardcoding android apis as numbers (e.g. `sdk = 16') to use version codes (see the comment below).

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

DEPS Outdated Show resolved Hide resolved
@@ -73,7 +73,7 @@ Future<int> runLint(ArgParser argParser, ArgResults argResults) async {
<!-- WILL AUTOMATICALLY FIND ALL .java FILES AND INCLUDE THEM HERE -->
<project>
<sdk dir="${androidSdkDir.path}" />
<module name="FlutterEngine" android="true" library="true" compile-sdk-version="android-T">
<module name="FlutterEngine" android="true" library="true" compile-sdk-version="android-U">
Copy link
Member Author

Choose a reason for hiding this comment

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

android-U is a guess here. I'm assuming the format is just first letter of the version name, but I can't find documentation

@gmackall gmackall changed the title Upgrade to android14 Upgrade Android SDK to 34 "UpsideDownCake" Nov 2, 2023
@gmackall
Copy link
Member Author

gmackall commented Nov 2, 2023

Some tests are failing with the message

ninja: Entering directory `/b/s/w/ir/cache/builder/src/out/android_profile'
ninja: error: '../../third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c', needed by 'obj/third_party/android_tools/ndk/sources/android/cpufeatures/cpu_features.cpu-features.o', missing and no known rule to make it

That file exists for me locally, and the build succeeds. Need to figure out whats going on here, guessing I need to dive into ci/recipes to figure out

@gmackall
Copy link
Member Author

gmackall commented Nov 7, 2023

Some tests are failing with the message

ninja: Entering directory `/b/s/w/ir/cache/builder/src/out/android_profile'
ninja: error: '../../third_party/android_tools/ndk/sources/android/cpufeatures/cpu-features.c', needed by 'obj/third_party/android_tools/ndk/sources/android/cpufeatures/cpu_features.cpu-features.o', missing and no known rule to make it

That file exists for me locally, and the build succeeds. Need to figure out whats going on here, guessing I need to dive into ci/recipes to figure out

The answer here was that the cipd package creation script doesn't work on m1 macs, as long as we specify an ndk version <23. So the 34v2 version that got uploaded to cipd was malformed. A new version (34v3) should fix the problem

@gmackall
Copy link
Member Author

gmackall commented Nov 7, 2023

Many roboelectric tests were failing because they couldn't be run on jelly bean api levels, ex:

io.flutter.plugin.platform.SingleViewPresentationTest > returnsOuterContextInputMethodManager[17] FAILED
    java.lang.RuntimeException: java.lang.RuntimeException: Failed to parse package ../../../../../out/android_jit_release_x86/robolectric_tests/build/intermediates/apk_for_local_test/debugUnitTest/apk-for-local-test.ap_: ../../../../../out/android_jit_release_x86/robolectric_tests/build/intermediates/apk_for_local_test/debugUnitTest/apk-for-local-test.ap_ (at Binary XML file line #5): Requires newer sdk version #19 (current version is #17)
        at org.robolectric.shadows.ShadowPackageParser.callParsePackage(ShadowPackageParser.java:68)
        at org.robolectric.android.internal.AndroidTestEnvironment.loadAppPackage_measured(AndroidTestEnvironment.java:410)
        at org.robolectric.android.internal.AndroidTestEnvironment.lambda$loadAppPackage$3(AndroidTestEnvironment.java:382)
        at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
        at org.robolectric.android.internal.AndroidTestEnvironment.loadAppPackage(AndroidTestEnvironment.java:382)
        at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:279)
        at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$0(AndroidTestEnvironment.java:251)
        at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
        at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$1(AndroidTestEnvironment.java:248)
        at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183)
        at org.robolectric.RuntimeEnvironment.getApplication(RuntimeEnvironment.java:79)
        at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:216)
        at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:340)
        at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:281)
        at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:99)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

        Caused by:
        java.lang.RuntimeException: Failed to parse package ../../../../../out/android_jit_release_x86/robolectric_tests/build/intermediates/apk_for_local_test/debugUnitTest/apk-for-local-test.ap_: ../../../../../out/android_jit_release_x86/robolectric_tests/build/intermediates/apk_for_local_test/debugUnitTest/apk-for-local-test.ap_ (at Binary XML file line #5): Requires newer sdk version #19 (current version is #17)
            at org.robolectric.shadows.ShadowPackageParser.callParsePackage(ShadowPackageParser.java:61)
            ... 18 more

We don't support these api levels, so I've changed the tests to stop testing on those api levels. Let me know if you are opposed.

I also changed some places where we were using numbers to represent an api level (e.g. sdk = 16) to use build codes (e.g. sdk = Build.VERSION_CODES.KITKAT). I'm planning on preferring this format whenever I encounter a place to choose, unless people have other opinions (I don't have a particularly strong opinion, other than that we should only use one. Otherwise discovering places to make changes through search is very tedious).

@gmackall gmackall marked this pull request as ready for review November 8, 2023 17:05
@gmackall gmackall requested a review from a team November 8, 2023 17:05
auto-submit bot pushed a commit to flutter/buildroot that referenced this pull request Nov 8, 2023
Re-land #790 now that flutter/engine#47609 is approved and passing checks
@gmackall gmackall added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 8, 2023
@auto-submit auto-submit bot merged commit aec3b0f into flutter:main Nov 8, 2023
26 checks passed
@zanderso zanderso added the revert Label used to revert changes in a closed and merged pull request. label Nov 8, 2023
auto-submit bot pushed a commit that referenced this pull request Nov 8, 2023
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Nov 8, 2023
auto-submit bot added a commit that referenced this pull request Nov 8, 2023
Reverts #47609
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
~**This should not land until flutter/buildroot#790 (re)lands, and I swap the buildroot url back to the latest commit.**~ ~Reland of PR to update buildroot at flutter/buildroot#792. ~ <- landed, and changed the buildroot commit to the latest in DEPS

Upgrades to android api 34

Also:
1. Upgrades to java 17 in DEPS/ci, because the linter now requires it.
2. Stops running some roboelectric tests on android apis 16-18, because Roboelectric indicated those versions were unsupported and we don't support them either.
3. Applies the four trivial new suggestions from the newer linter.
4. Updates the baseline lint to include the new non-trivial lint ([fixed in a different PR](https://github.com/flutter/engine/pull/47817/files)).
5. Changes some instances where we were hardcoding android apis as numbers (e.g. `sdk = 16') to use version codes (see the [comment below](#47609 (comment))).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 8, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 9, 2023
…138116)

flutter/engine@b3af5d6...233bd62

2023-11-08 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Upgrade Android SDK to 34 "UpsideDownCake"" (flutter/engine#47834)
2023-11-08 skia-flutter-autoroll@skia.org Roll Skia from e585bb68893b to 1241a903cd33 (2 revisions) (flutter/engine#47830)
2023-11-08 34871572+gmackall@users.noreply.github.com Upgrade Android SDK to 34 "UpsideDownCake" (flutter/engine#47609)
2023-11-08 chris@bracken.jp [macOS] Allocate textures as unique_ptr earlier (flutter/engine#47786)
2023-11-08 flar@google.com Reland "[Impeller] add support for Skia concept of RRect::isSimple needed for DL dispatching" (flutter/engine#47824)
2023-11-08 skia-flutter-autoroll@skia.org Roll Skia from e2b8ebe16203 to e585bb68893b (7 revisions) (flutter/engine#47826)
2023-11-08 jonahwilliams@google.com [Impeller] Add support for specialization constants (III). (flutter/engine#47765)
2023-11-08 30870216+gaaclarke@users.noreply.github.com [Impeller] Documented the 2 step in the gaussian blur. (flutter/engine#47822)

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 bdero@google.com,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
auto-submit bot pushed a commit that referenced this pull request Nov 9, 2023
The difference between this PR and the original is the change to the `AndroidManifest.xml`. For context, right before the original PR landed, [a change to upgrade the target sdk](#47683) in the manifest from 31 to 33 landed. It also removed the lint complaining about using an old target sdk version from the baseline lint file. So this change upgrading the sdk, but not the target sdk in the manifest, triggered the lint again.

For the rest of the PR, [see the description of the original PR](#47609).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
auto-submit bot pushed a commit that referenced this pull request Nov 20, 2023
…cking write access, improve comments to add context (#47989)

Script used to upload 34v7 with ndk 26.1.10909125 
Added documentation for how to check for write access before running script. 
Added documentation for why the ndk is in a non standard location. 
Protected against silent ndk failure caused by a failure to download ndk on m1 macs #47609 (comment)
Clean up os override so that script does not dirty the environment variables in a shell where it is run.  

See flutter/flutter#117973 for more detail on why a newer ndk is required.
auto-submit bot pushed a commit that referenced this pull request Nov 29, 2023
…#47817)

See #47609 (comment) for context.

It isn't clear to me what the file descriptor here is actually doing, so I'm not actually too sure about this fix. Can it just be deleted?

Update: it seems to me that the motivation here is that `ClipData.Item.coerceToText` [consumes a `SecurityException` here](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/content/ClipData.java;l=411;bpv=0;bpt=1), with just a log line that isn't particularly descriptive. And basically we want to run into that same exception so we can [provide a more helpful log line](https://github.com/flutter/engine/blob/00db306f6f7b42b5664d604f33a0de426edf7109/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java#L525), so we do the same thing that the underlying `coerceToText` method does?

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants