Skip to content

Commit

Permalink
Upgrade Engine Android SDK to 35 (flutter#53574)
Browse files Browse the repository at this point in the history
**REVIEW BUT DO NOT MERGE:** Will merge after flutter/buildroot#870 lands.

1: Updates engine to use Android 35. Part of flutter/flutter#150215.
Engine step of https://github.com/flutter/flutter/blob/master/docs/platforms/android/Upgrading-Engine's-Android-API-version.md.

2: Updates test runner AGP version to 8.5, engine Gradle version to 8.9 to accommodate update.

3: Fixes lint and suppresses deprecation warnings caused by the update. None of the deprecations are unknown by the team (they are handled in the code), but the tests emitted warnings.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
  • Loading branch information
camsim99 authored Jul 24, 2024
1 parent 8523740 commit 5d0e134
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 20 deletions.
6 changes: 3 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '327906297b49980748ea1956019829e7c434a03e',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '91c259d5ee56c24fb870cf7be7d041bb9b8e139f',

'src/flutter/third_party/depot_tools':
Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '580b4ff3f5cd0dcaa2eacda28cefe0f45320e8f7',
Expand Down Expand Up @@ -734,7 +734,7 @@ deps = {
{
# See tools/gradle/README.md for update instructions.
# Version here means the CIPD tag.
'version': 'version:8.3',
'version': 'version:8.9',
'package': 'flutter/gradle'
}
],
Expand Down Expand Up @@ -774,7 +774,7 @@ deps = {
'packages': [
{
'package': 'flutter/android/sdk/all/${{platform}}',
'version': 'version:34v7'
'version': 'version:35v1'
}
],
'condition': 'download_android_deps',
Expand Down
4 changes: 2 additions & 2 deletions ci/test/ban_generated_plugin_registrant_java_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ trap cleanup EXIT
echo "PASS: ban_generated_plugin_registrant_java failed as expected"

# Create a file in SRC_DIR/third_party, that should be OK.
echo "Creating file ./src/third_party/GeneratedPluginRegistrant.java"
touch "$SRC_DIR/third_party/GeneratedPluginRegistrant.java"
echo "Creating file ./src/flutter/third_party/GeneratedPluginRegistrant.java"
touch "$SRC_DIR/flutter/third_party/GeneratedPluginRegistrant.java"

# Run the ban script, expecting it to succeed.
"$FLUTTER_DIR/ci/ban_generated_plugin_registrant_java.sh" > /dev/null 2>&1 || {
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.flutter.app" android:versionCode="1" android:versionName="0.0.1">

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
apply plugin: "com.android.library"

android {
compileSdkVersion 34
compileSdk 35

defaultConfig {
minSdkVersion 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public interface PlatformViewsHandler {
* The ID returned by {@code createForTextureLayer} to indicate that the requested texture mode
* was not available and the view creation fell back to {@code PlatformViewLayer} mode.
*
* This can only be returned if the {@link PlatformViewCreationRequest} sets
* This can only be returned if the {@code PlatformViewCreationRequest} sets
* {@code TEXTURE_WITH_HYBRID_FALLBACK} as the requested display mode.
*/
static final long NON_TEXTURE_FALLBACK = -2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,9 @@ public void itForwardsOnUserLeaveHintToFlutterEngine() {
}

@Test
@SuppressWarnings("deprecation")
// TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_LOW,
// TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL
public void itNotifiesDartExecutorAndSendsMessageOverSystemChannelWhenToldToTrimMemory() {
// Create the real object that we're testing.
FlutterActivityAndFragmentDelegate delegate = new FlutterActivityAndFragmentDelegate(mockHost);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ public void itRemovesListenerWhenSurfaceTextureEntryReleased() {
}

@Test
@SuppressWarnings("deprecation")
// TRIM_MEMORY_COMPLETE
public void itNotifySurfaceTextureEntryWhenMemoryPressureWarning() {
// Setup the test.
FlutterRenderer flutterRenderer = engineRule.getFlutterEngine().getRenderer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public void platformPlugin_hasStrings() {
}

@Config(sdk = API_LEVELS.API_29)
@SuppressWarnings("deprecation")
// setStatusBarColor, setNavigationBarColor, setNavigationBarDividerColor,
// setStatusBarContrastEnforced, setNavigationBarContrastEnforced
@Test
public void setNavigationBarDividerColor() {
View fakeDecorView = mock(View.class);
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/android/test_runner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:8.0.1"
classpath "com.android.tools.build:gradle:8.5.0"
}
}

Expand Down Expand Up @@ -33,7 +33,7 @@ println "=========================================="

android {
namespace 'io.flutter.app.test'
compileSdkVersion 34
compileSdk 35

defaultConfig {
minSdkVersion 21
Expand Down
4 changes: 2 additions & 2 deletions testing/android/native_activity/native_activity.gni
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import("//build/config/android/config.gni")
import("//flutter/tools/templater/templater.gni")

android_buildtools =
"//flutter/third_party/android_tools/sdk/build-tools/34.0.0"
"//flutter/third_party/android_tools/sdk/build-tools/35.0.0-rc4"
aapt2 = "$android_buildtools/aapt2"
zipalign = "$android_buildtools/zipalign"
apksigner = "$android_buildtools/apksigner"
android_jar =
"//flutter/third_party/android_tools/sdk/platforms/android-34/android.jar"
"//flutter/third_party/android_tools/sdk/platforms/android-35/android.jar"
src_root = "//flutter/testing/android/native_activity"

# A drop in replacement for an executable or shared library target. Providing a
Expand Down
6 changes: 3 additions & 3 deletions testing/scenario_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ android {
// The others are irrelevant for a test application.
disable 'UnpackedNativeCode','MissingApplicationIcon','GoogleAppIndexingApiWarning','GoogleAppIndexingWarning','GradleDependency','NewerVersionAvailable','Registered'
}
buildToolsVersion = '34.0.0'
compileSdkVersion 34
buildToolsVersion = '35.0.0-rc4'
compileSdk 35
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
applicationId 'dev.flutter.scenarios'
minSdkVersion 21
targetSdkVersion 34
targetSdkVersion 35
versionCode 1
versionName '1.0'
testInstrumentationRunner 'dev.flutter.TestRunner'
Expand Down
6 changes: 3 additions & 3 deletions tools/android_sdk/packages.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
platforms;android-34:platforms
platforms;android-35:platforms
cmdline-tools;latest:cmdline-tools
build-tools;34.0.0:build-tools
build-tools;35.0.0-rc4:build-tools
platform-tools:platform-tools
tools:tools
ndk;26.1.10909125:ndk
ndk;26.3.11579264:ndk
2 changes: 1 addition & 1 deletion tools/cipd/android_embedding_bundle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ allprojects {
apply plugin: "com.android.application"

android {
compileSdkVersion 34
compileSdk 35
}

configurations {
Expand Down
2 changes: 1 addition & 1 deletion tools/javadoc/gen_javadoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main():
os.makedirs(args.out_dir)

android_jar_path = os.path.join(
args.src_dir, 'flutter', 'third_party', 'android_tools', 'sdk', 'platforms', 'android-34',
args.src_dir, 'flutter', 'third_party', 'android_tools', 'sdk', 'platforms', 'android-35',
'android.jar'
)
if not os.path.exists(android_jar_path):
Expand Down

0 comments on commit 5d0e134

Please sign in to comment.