Test the Android embedding v2 (#42708) * Test the Android embedding v2 * Update integration tests * Split into shards
diff --git a/.cirrus.yml b/.cirrus.yml index d5698f6..9eb90de 100644 --- a/.cirrus.yml +++ b/.cirrus.yml
@@ -235,45 +235,41 @@ container: cpu: 4 memory: 12G - - name: integration_tests_gradle1-linux + - name: gradle_tests-linux-shard-1 env: SHARD: integration_tests SUBSHARD: gradle1 test_script: - # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they - # might include non-ASCII characters which makes Gradle crash. - # See: https://github.com/flutter/flutter/issues/24935 - # This is a temporary workaround until we figure how to properly configure - # a UTF8 locale on Cirrus (or until the Gradle bug is fixed). - # TODO(amirh): Set the locale to UTF8. - - echo "$CIRRUS_CHANGE_MESSAGE" > /tmp/cirrus_change_message.txt - - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt - - export CIRRUS_CHANGE_MESSAGE="" - - export CIRRUS_COMMIT_MESSAGE="" - dart --enable-asserts ./dev/bots/test.dart - - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` container: cpu: 4 memory: 12G - - name: integration_tests_gradle2-linux + - name: gradle_tests-linux-shard-2 env: SHARD: integration_tests SUBSHARD: gradle2 test_script: - # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they - # might include non-ASCII characters which makes Gradle crash. - # See: https://github.com/flutter/flutter/issues/24935 - # This is a temporary workaround until we figure how to properly configure - # a UTF8 locale on Cirrus (or until the Gradle bug is fixed). - # TODO(amirh): Set the locale to UTF8. - - echo "$CIRRUS_CHANGE_MESSAGE" > /tmp/cirrus_change_message.txt - - echo "$CIRRUS_COMMIT_MESSAGE" > /tmp/cirrus_commit_message.txt - - export CIRRUS_CHANGE_MESSAGE="" - - export CIRRUS_COMMIT_MESSAGE="" - dart --enable-asserts ./dev/bots/test.dart - - export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt` - - export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt` + container: + cpu: 4 + memory: 12G + - name: gradle_embedding_v2_tests-linux-shard-1 + env: + SHARD: integration_tests + SUBSHARD: gradle1 + ENABLE_ANDROID_EMBEDDING_V2: 'true' + test_script: + - dart --enable-asserts ./dev/bots/test.dart + container: + cpu: 4 + memory: 12G + - name: gradle_embedding_v2_tests-linux-shard-2 + env: + SHARD: integration_tests + SUBSHARD: gradle2 + ENABLE_ANDROID_EMBEDDING_V2: 'true' + test_script: + - dart --enable-asserts ./dev/bots/test.dart container: cpu: 4 memory: 12G @@ -433,7 +429,7 @@ - CMD /S /C "IF EXIST "bin\cache\pkg\tests\" RMDIR /S /Q bin\cache\pkg\tests" - git clone https://github.com/flutter/tests.git bin\cache\pkg\tests - dart --enable-asserts dev\customer_testing\run_tests.dart --skip-on-fetch-failure --skip-template bin/cache/pkg/tests/registry/*.test - - name: integration_tests_gradle1-windows + - name: gradle_tests-windows-shard-1 env: SHARD: integration_tests SUBSHARD: gradle1 @@ -442,7 +438,7 @@ container: cpu: 4 memory: 12G - - name: integration_tests_gradle2-windows + - name: gradle_tests-windows-shard-2 env: SHARD: integration_tests SUBSHARD: gradle2 @@ -451,6 +447,26 @@ container: cpu: 4 memory: 12G + - name: gradle_embedding_v2_tests-windows-shard-1 + env: + SHARD: integration_tests + SUBSHARD: gradle1 + ENABLE_ANDROID_EMBEDDING_V2: 'true' + test_script: + - dart --enable-asserts dev\bots\test.dart + container: + cpu: 4 + memory: 12G + - name: gradle_embedding_v2_tests-windows-shard-2 + env: + SHARD: integration_tests + SUBSHARD: gradle2 + ENABLE_ANDROID_EMBEDDING_V2: 'true' + test_script: + - dart --enable-asserts dev\bots\test.dart + container: + cpu: 4 + memory: 12G task: use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' @@ -627,8 +643,14 @@ - tool_tests_integration-linux - build_tests-linux - integration_tests-linux - - integration_tests_gradle1-linux - - integration_tests_gradle2-linux + - gradle_tests-linux-shard-1 + - gradle_tests-linux-shard-2 + - gradle_embedding_v2_tests-linux-shard-1 + - gradle_embedding_v2_tests-linux-shard-2 + - gradle_tests-windows-shard-1 + - gradle_tests-windows-shard-2 + - gradle_embedding_v2_tests-windows-shard-1 + - gradle_embedding_v2_tests-windows-shard-2 - release_smoke_tests build_script: "$CIRRUS_WORKING_DIR/dev/ci/docker_linux/docker_build.sh" login_script: "$CIRRUS_WORKING_DIR/dev/ci/docker_linux/docker_login.sh"
diff --git a/dev/bots/firebase_testlab.sh b/dev/bots/firebase_testlab.sh index 138ebea..98f1020 100755 --- a/dev/bots/firebase_testlab.sh +++ b/dev/bots/firebase_testlab.sh
@@ -8,7 +8,7 @@ tests=( "dev/integration_tests/release_smoke_test" "dev/integration_tests/abstract_method_smoke_test" - "dev/integration_tests/android_embedding_2" + "dev/integration_tests/android_embedding_v2_smoke_test" ) # The devices where the tests are run.
diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 755dcfa..9914dd2 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart
@@ -925,8 +925,6 @@ // TODO(jmagman): Re-enable once flakiness is resolved. // await _runDevicelabTest('module_test_ios'); } - // This does less work if the subshard isn't Android. - await _androidPluginTest(); } } @@ -949,44 +947,30 @@ return androidSdkRoot; } -Future<void> _androidPluginTest() async { - if (androidSdkRoot == null) { - print('No Android SDK detected, skipping Android Plugin test.'); - return; - } - - final Map<String, String> env = <String, String> { - 'ANDROID_HOME': androidSdkRoot, - 'ANDROID_SDK_ROOT': androidSdkRoot, - }; - - await _runDevicelabTest('plugin_test', env: env); -} - Future<void> _androidGradleTests(String subShard) async { // TODO(dnfield): gradlew is crashing on the cirrus image and it's not clear why. if (androidSdkRoot == null || Platform.isWindows) { print('No Android SDK detected or on Windows, skipping Android gradle test.'); return; } - - final Map<String, String> env = <String, String> { + final Map<String, String> defaultEnv = <String, String>{ 'ANDROID_HOME': androidSdkRoot, 'ANDROID_SDK_ROOT': androidSdkRoot, + 'ENABLE_ANDROID_EMBEDDING_V2': Platform.environment['ENABLE_ANDROID_EMBEDDING_V2'] ?? '', }; - if (subShard == 'gradle1') { - await _runDevicelabTest('gradle_plugin_light_apk_test', env: env); - await _runDevicelabTest('gradle_plugin_fat_apk_test', env: env); - await _runDevicelabTest('gradle_r8_test', env: env); - await _runDevicelabTest('gradle_non_android_plugin_test', env: env); - await _runDevicelabTest('gradle_jetifier_test', env: env); + await _runDevicelabTest('gradle_plugin_light_apk_test', env: defaultEnv); + await _runDevicelabTest('gradle_plugin_fat_apk_test', env: defaultEnv); + await _runDevicelabTest('gradle_r8_test', env: defaultEnv); + await _runDevicelabTest('gradle_non_android_plugin_test', env: defaultEnv); + await _runDevicelabTest('gradle_jetifier_test', env: defaultEnv); } if (subShard == 'gradle2') { - await _runDevicelabTest('gradle_plugin_bundle_test', env: env); - await _runDevicelabTest('module_test', env: env); - await _runDevicelabTest('module_host_with_custom_build_test', env: env); - await _runDevicelabTest('build_aar_module_test', env: env); + await _runDevicelabTest('gradle_plugin_bundle_test', env: defaultEnv); + await _runDevicelabTest('module_test', env: defaultEnv); + await _runDevicelabTest('module_host_with_custom_build_test', env: defaultEnv); + await _runDevicelabTest('build_aar_module_test', env: defaultEnv); + await _runDevicelabTest('plugin_test', env: defaultEnv); } }
diff --git a/dev/devicelab/bin/tasks/module_host_with_custom_build_test.dart b/dev/devicelab/bin/tasks/module_host_with_custom_build_test.dart index 4f9e915..2615ae0 100644 --- a/dev/devicelab/bin/tasks/module_host_with_custom_build_test.dart +++ b/dev/devicelab/bin/tasks/module_host_with_custom_build_test.dart
@@ -13,6 +13,8 @@ final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew'; final String gradlewExecutable = Platform.isWindows ? gradlew : './$gradlew'; +final bool useAndroidEmbeddingV2 = Platform.environment['ENABLE_ANDROID_EMBEDDING_V2'] == 'true'; + /// Tests that the Android app containing a Flutter module can be built when /// it has custom build types and flavors. Future<void> main() async { @@ -53,7 +55,14 @@ final Directory hostAppDir = Directory(path.join(tempDir.path, 'hello_host_app_with_custom_build')); mkdir(hostAppDir); recursiveCopy( - Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'module_host_with_custom_build')), + Directory( + path.join( + flutterDirectory.path, + 'dev', + 'integration_tests', + useAndroidEmbeddingV2 ? 'module_host_with_custom_build_v2_embedding' : 'module_host_with_custom_build', + ), + ), hostAppDir, ); copy(
diff --git a/dev/devicelab/bin/tasks/module_test.dart b/dev/devicelab/bin/tasks/module_test.dart index 6ea447f..a6cd77e 100644 --- a/dev/devicelab/bin/tasks/module_test.dart +++ b/dev/devicelab/bin/tasks/module_test.dart
@@ -13,9 +13,12 @@ final String gradlew = Platform.isWindows ? 'gradlew.bat' : 'gradlew'; final String gradlewExecutable = Platform.isWindows ? gradlew : './$gradlew'; +final bool useAndroidEmbeddingV2 = Platform.environment['ENABLE_ANDROID_EMBEDDING_V2'] == 'true'; + /// Tests that the Flutter module project template works and supports /// adding Flutter to an existing Android app. Future<void> main() async { + print(useAndroidEmbeddingV2); await task(() async { section('Find Java'); @@ -143,7 +146,14 @@ final Directory hostApp = Directory(path.join(tempDir.path, 'hello_host_app')); mkdir(hostApp); recursiveCopy( - Directory(path.join(flutterDirectory.path, 'dev', 'integration_tests', 'android_host_app')), + Directory( + path.join( + flutterDirectory.path, + 'dev', + 'integration_tests', + useAndroidEmbeddingV2 ? 'android_host_app_v2_embedding' : 'android_host_app', + ), + ), hostApp, ); copy(
diff --git a/dev/integration_tests/android_embedding_2/android/app/build.gradle b/dev/integration_tests/android_embedding_2/android/app/build.gradle index 1b93690..ec56e4f 100644 --- a/dev/integration_tests/android_embedding_2/android/app/build.gradle +++ b/dev/integration_tests/android_embedding_2/android/app/build.gradle
@@ -38,7 +38,7 @@ defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.android_embedding_2" + applicationId "com.example.android_embedding_v2_smoke_test" minSdkVersion 21 targetSdkVersion 28 versionCode flutterVersionCode.toInteger()
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/debug/AndroidManifest.xml b/dev/integration_tests/android_embedding_2/android/app/src/debug/AndroidManifest.xml index bbe2d9d..a4c94b1 100644 --- a/dev/integration_tests/android_embedding_2/android/app/src/debug/AndroidManifest.xml +++ b/dev/integration_tests/android_embedding_2/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,5 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android_embedding_2"> + package="com.example.android_embedding_v2_smoke_test"> <!-- Flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. -->
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/kotlin/com/example/android_embedding_2/MainActivity.kt b/dev/integration_tests/android_embedding_2/android/app/src/main/kotlin/com/example/android_embedding_2/MainActivity.kt index e7050b9..8bf423a 100644 --- a/dev/integration_tests/android_embedding_2/android/app/src/main/kotlin/com/example/android_embedding_2/MainActivity.kt +++ b/dev/integration_tests/android_embedding_2/android/app/src/main/kotlin/com/example/android_embedding_2/MainActivity.kt
@@ -1,4 +1,4 @@ -package com.example.android_embedding_2 +package com.example.android_embedding_v2_smoke_test import androidx.annotation.NonNull; import dev.flutter.plugins.GeneratedPluginRegistrant
diff --git a/dev/integration_tests/android_embedding_2/.gitignore b/dev/integration_tests/android_embedding_v2_smoke_test/.gitignore similarity index 100% rename from dev/integration_tests/android_embedding_2/.gitignore rename to dev/integration_tests/android_embedding_v2_smoke_test/.gitignore
diff --git a/dev/integration_tests/android_embedding_2/.metadata b/dev/integration_tests/android_embedding_v2_smoke_test/.metadata similarity index 100% rename from dev/integration_tests/android_embedding_2/.metadata rename to dev/integration_tests/android_embedding_v2_smoke_test/.metadata
diff --git a/dev/integration_tests/android_embedding_2/README.md b/dev/integration_tests/android_embedding_v2_smoke_test/README.md similarity index 100% rename from dev/integration_tests/android_embedding_2/README.md rename to dev/integration_tests/android_embedding_v2_smoke_test/README.md
diff --git a/dev/integration_tests/android_embedding_2/android/.gitignore b/dev/integration_tests/android_embedding_v2_smoke_test/android/.gitignore similarity index 100% rename from dev/integration_tests/android_embedding_2/android/.gitignore rename to dev/integration_tests/android_embedding_v2_smoke_test/android/.gitignore
diff --git a/dev/integration_tests/android_embedding_v2_smoke_test/android/app/build.gradle b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/build.gradle new file mode 100644 index 0000000..ec56e4f --- /dev/null +++ b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/build.gradle
@@ -0,0 +1,67 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 28 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.android_embedding_v2_smoke_test" + minSdkVersion 21 + targetSdkVersion 28 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' +}
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/debug/AndroidManifest.xml similarity index 82% copy from dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml copy to dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/debug/AndroidManifest.xml index bbe2d9d..a4c94b1 100644 --- a/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml +++ b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/debug/AndroidManifest.xml
@@ -1,5 +1,5 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android_embedding_2"> + package="com.example.android_embedding_v2_smoke_test"> <!-- Flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. -->
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/AndroidManifest.xml b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/AndroidManifest.xml similarity index 92% rename from dev/integration_tests/android_embedding_2/android/app/src/main/AndroidManifest.xml rename to dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/AndroidManifest.xml index 63499d9..d1dca73 100644 --- a/dev/integration_tests/android_embedding_2/android/app/src/main/AndroidManifest.xml +++ b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android_embedding_2"> + package="com.example.android_embedding_v2_smoke_test"> <!-- io.flutter.app.FlutterApplication is an android.app.Application that calls FlutterMain.startInitialization(this); in its onCreate method. In most cases you can leave this as-is, but you if you want to provide @@ -7,7 +7,7 @@ FlutterApplication and put your custom class here. --> <application android:name="io.flutter.app.FlutterApplication" - android:label="android_embedding_2"> + android:label="android_embedding_v2_smoke_test"> <activity android:name=".MainActivity" android:launchMode="singleTop"
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/java/dev/flutter/plugins/GeneratedPluginRegistrant.java b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/java/dev/flutter/plugins/GeneratedPluginRegistrant.java similarity index 100% rename from dev/integration_tests/android_embedding_2/android/app/src/main/java/dev/flutter/plugins/GeneratedPluginRegistrant.java rename to dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/java/dev/flutter/plugins/GeneratedPluginRegistrant.java
diff --git a/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/kotlin/com/example/android_embedding_v2_smoke_test/MainActivity.kt b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/kotlin/com/example/android_embedding_v2_smoke_test/MainActivity.kt new file mode 100644 index 0000000..8bf423a --- /dev/null +++ b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/kotlin/com/example/android_embedding_v2_smoke_test/MainActivity.kt
@@ -0,0 +1,12 @@ +package com.example.android_embedding_v2_smoke_test + +import androidx.annotation.NonNull; +import dev.flutter.plugins.GeneratedPluginRegistrant +import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.engine.FlutterEngine + +class MainActivity: FlutterActivity() { + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +}
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/res/drawable/launch_background.xml b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from dev/integration_tests/android_embedding_2/android/app/src/main/res/drawable/launch_background.xml rename to dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/res/drawable/launch_background.xml
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/res/values/styles.xml b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/res/values/styles.xml similarity index 100% rename from dev/integration_tests/android_embedding_2/android/app/src/main/res/values/styles.xml rename to dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/main/res/values/styles.xml
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/profile/AndroidManifest.xml similarity index 83% rename from dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml rename to dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/profile/AndroidManifest.xml index bbe2d9d..a4c94b1 100644 --- a/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml +++ b/dev/integration_tests/android_embedding_v2_smoke_test/android/app/src/profile/AndroidManifest.xml
@@ -1,5 +1,5 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android_embedding_2"> + package="com.example.android_embedding_v2_smoke_test"> <!-- Flutter needs it to communicate with the running application to allow setting breakpoints, to provide hot reload, etc. -->
diff --git a/dev/integration_tests/android_embedding_2/android/build.gradle b/dev/integration_tests/android_embedding_v2_smoke_test/android/build.gradle similarity index 100% rename from dev/integration_tests/android_embedding_2/android/build.gradle rename to dev/integration_tests/android_embedding_v2_smoke_test/android/build.gradle
diff --git a/dev/integration_tests/android_embedding_2/android/gradle.properties b/dev/integration_tests/android_embedding_v2_smoke_test/android/gradle.properties similarity index 100% rename from dev/integration_tests/android_embedding_2/android/gradle.properties rename to dev/integration_tests/android_embedding_v2_smoke_test/android/gradle.properties
diff --git a/dev/integration_tests/android_embedding_2/android/gradle/wrapper/gradle-wrapper.properties b/dev/integration_tests/android_embedding_v2_smoke_test/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from dev/integration_tests/android_embedding_2/android/gradle/wrapper/gradle-wrapper.properties rename to dev/integration_tests/android_embedding_v2_smoke_test/android/gradle/wrapper/gradle-wrapper.properties
diff --git a/dev/integration_tests/android_embedding_2/android/settings.gradle b/dev/integration_tests/android_embedding_v2_smoke_test/android/settings.gradle similarity index 100% rename from dev/integration_tests/android_embedding_2/android/settings.gradle rename to dev/integration_tests/android_embedding_v2_smoke_test/android/settings.gradle
diff --git a/dev/integration_tests/android_embedding_2/android/settings_aar.gradle b/dev/integration_tests/android_embedding_v2_smoke_test/android/settings_aar.gradle similarity index 100% rename from dev/integration_tests/android_embedding_2/android/settings_aar.gradle rename to dev/integration_tests/android_embedding_v2_smoke_test/android/settings_aar.gradle
diff --git a/dev/integration_tests/android_embedding_2/lib/main.dart b/dev/integration_tests/android_embedding_v2_smoke_test/lib/main.dart similarity index 100% rename from dev/integration_tests/android_embedding_2/lib/main.dart rename to dev/integration_tests/android_embedding_v2_smoke_test/lib/main.dart
diff --git a/dev/integration_tests/android_embedding_2/pubspec.yaml b/dev/integration_tests/android_embedding_v2_smoke_test/pubspec.yaml similarity index 98% rename from dev/integration_tests/android_embedding_2/pubspec.yaml rename to dev/integration_tests/android_embedding_v2_smoke_test/pubspec.yaml index 5a6077a..5ac8ee8 100644 --- a/dev/integration_tests/android_embedding_2/pubspec.yaml +++ b/dev/integration_tests/android_embedding_v2_smoke_test/pubspec.yaml
@@ -1,4 +1,4 @@ -name: android_embedding_2 +name: android_embedding_v2_smoke_test description: A new Flutter project. # The following defines the version and build number for your application.
diff --git a/dev/integration_tests/android_host_app_v2_embedding/README.md b/dev/integration_tests/android_host_app_v2_embedding/README.md new file mode 100644 index 0000000..1523329 --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/README.md
@@ -0,0 +1,8 @@ +# Android host app + +Android host app for a Flutter module created using +``` +$ flutter create -t module hello +``` +and placed in a sibling folder to (a clone of) the host app. +Used by the `module_test.dart` device lab test.
diff --git a/dev/integration_tests/android_host_app_v2_embedding/app/build.gradle b/dev/integration_tests/android_host_app_v2_embedding/app/build.gradle new file mode 100644 index 0000000..4ca5af3 --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/app/build.gradle
@@ -0,0 +1,23 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + + defaultConfig { + applicationId "io.flutter.add2app" + minSdkVersion 16 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } +} + +dependencies { + implementation project(':flutter') +}
diff --git a/dev/integration_tests/android_host_app_v2_embedding/app/src/main/AndroidManifest.xml b/dev/integration_tests/android_host_app_v2_embedding/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..dd1f37f --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/app/src/main/AndroidManifest.xml
@@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="io.flutter.add2app"> + + <application android:allowBackup="false" + tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon"> + <activity android:name=".MainActivity" /> + </application> +</manifest>
diff --git a/dev/integration_tests/android_host_app_v2_embedding/app/src/main/java/io/flutter/add2app/MainActivity.java b/dev/integration_tests/android_host_app_v2_embedding/app/src/main/java/io/flutter/add2app/MainActivity.java new file mode 100644 index 0000000..9c3fcc0 --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/app/src/main/java/io/flutter/add2app/MainActivity.java
@@ -0,0 +1,13 @@ +package io.flutter.add2app; + +import androidx.annotation.NonNull; +import dev.flutter.plugins.GeneratedPluginRegistrant; +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.engine.FlutterEngine; + +public class MainActivity extends FlutterActivity { + @Override + public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +}
diff --git a/dev/integration_tests/android_host_app_v2_embedding/build.gradle b/dev/integration_tests/android_host_app_v2_embedding/build.gradle new file mode 100644 index 0000000..9ed16f9 --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/build.gradle
@@ -0,0 +1,20 @@ +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +}
diff --git a/dev/integration_tests/android_host_app_v2_embedding/gradle.properties b/dev/integration_tests/android_host_app_v2_embedding/gradle.properties new file mode 100644 index 0000000..47a56de --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/gradle.properties
@@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536m +android.useAndroidX=true +android.enableJetifier=true
diff --git a/dev/integration_tests/android_host_app_v2_embedding/gradle/wrapper/gradle-wrapper.properties b/dev/integration_tests/android_host_app_v2_embedding/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f6c8f50 --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@ +#Mon Jun 25 14:13:36 CEST 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
diff --git a/dev/integration_tests/android_host_app_v2_embedding/settings.gradle b/dev/integration_tests/android_host_app_v2_embedding/settings.gradle new file mode 100644 index 0000000..ecc9eb9 --- /dev/null +++ b/dev/integration_tests/android_host_app_v2_embedding/settings.gradle
@@ -0,0 +1,3 @@ +include ':app' +setBinding(new Binding([gradle: this])) +evaluate(new File(settingsDir.parentFile, 'hello/.android/include_flutter.groovy'))
diff --git a/dev/integration_tests/android_module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java b/dev/integration_tests/android_module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java new file mode 100644 index 0000000..9c3fcc0 --- /dev/null +++ b/dev/integration_tests/android_module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java
@@ -0,0 +1,13 @@ +package io.flutter.add2app; + +import androidx.annotation.NonNull; +import dev.flutter.plugins.GeneratedPluginRegistrant; +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.engine.FlutterEngine; + +public class MainActivity extends FlutterActivity { + @Override + public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +}
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md b/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md new file mode 100644 index 0000000..85b8874 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/README.md
@@ -0,0 +1,8 @@ +# Android host app + +Android host app for a Flutter module created using +``` +$ flutter create -t module hello +``` +and placed in a sibling folder to (a clone of) the host app. +Used by the `module_host_with_custom_build_test.dart` device lab test.
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle new file mode 100644 index 0000000..c551a54 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/build.gradle
@@ -0,0 +1,42 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + compileOptions { + sourceCompatibility 1.8 + targetCompatibility 1.8 + } + defaultConfig { + applicationId "io.flutter.addtoapp" + minSdkVersion 16 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + // Test build types. + buildTypes { + staging { + initWith debug + // This is required because the `:flutter` project doesn't define this custom build type. + // Without the fallback, the Android plugin will make Gradle exit with the following error: + // `Unable to find a matching variant of project :flutter` + matchingFallbacks = ['debug'] + } + prod { + initWith release + matchingFallbacks = ['release'] + } + } + // Test flavors. + flavorDimensions "version" + productFlavors { + demo { + dimension "version" + } + } +} + +dependencies { + implementation project(':flutter') +}
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/AndroidManifest.xml b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5a8fa32 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/AndroidManifest.xml
@@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="io.flutter.addtoapp"> + + <application android:allowBackup="false" + tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon"> + <activity android:name=".MainActivity" /> + </application> +</manifest>
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java new file mode 100644 index 0000000..9c3fcc0 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/app/src/main/java/io/flutter/addtoapp/MainActivity.java
@@ -0,0 +1,13 @@ +package io.flutter.add2app; + +import androidx.annotation.NonNull; +import dev.flutter.plugins.GeneratedPluginRegistrant; +import io.flutter.embedding.android.FlutterActivity; +import io.flutter.embedding.engine.FlutterEngine; + +public class MainActivity extends FlutterActivity { + @Override + public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +}
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/build.gradle b/dev/integration_tests/module_host_with_custom_build_v2_embedding/build.gradle new file mode 100644 index 0000000..e006ab4 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/build.gradle
@@ -0,0 +1,20 @@ +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.2.1' + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +}
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/gradle.properties b/dev/integration_tests/module_host_with_custom_build_v2_embedding/gradle.properties new file mode 100644 index 0000000..47a56de --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/gradle.properties
@@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536m +android.useAndroidX=true +android.enableJetifier=true
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/gradle/wrapper/gradle-wrapper.properties b/dev/integration_tests/module_host_with_custom_build_v2_embedding/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..807a9a8 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@ +#Mon Jun 25 14:13:36 CEST 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
diff --git a/dev/integration_tests/module_host_with_custom_build_v2_embedding/settings.gradle b/dev/integration_tests/module_host_with_custom_build_v2_embedding/settings.gradle new file mode 100644 index 0000000..ecc9eb9 --- /dev/null +++ b/dev/integration_tests/module_host_with_custom_build_v2_embedding/settings.gradle
@@ -0,0 +1,3 @@ +include ':app' +setBinding(new Binding([gradle: this])) +evaluate(new File(settingsDir.parentFile, 'hello/.android/include_flutter.groovy'))
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart index 1a82922..4d26cb9 100644 --- a/packages/flutter_tools/lib/src/commands/create.dart +++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -623,7 +623,7 @@ 'description': projectDescription, 'dartSdk': '$flutterRoot/bin/cache/dart-sdk', 'androidX': androidX, - 'useNewAndroidEmbedding': featureFlags.isNewAndroidEmbeddingEnabled, + 'useAndroidEmbeddingV2': featureFlags.isAndroidEmbeddingV2Enabled, 'androidMinApiLevel': android.minApiLevel, 'androidSdkVersion': android_sdk.minimumAndroidSdkVersion, 'androidFlutterJar': '$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar',
diff --git a/packages/flutter_tools/lib/src/features.dart b/packages/flutter_tools/lib/src/features.dart index 332506d..d3237d7 100644 --- a/packages/flutter_tools/lib/src/features.dart +++ b/packages/flutter_tools/lib/src/features.dart
@@ -36,8 +36,8 @@ /// Whether flutter desktop for Windows is enabled. bool get isWindowsEnabled => isEnabled(flutterWindowsDesktopFeature); - /// Whether the new Android embedding is enabled. - bool get isNewAndroidEmbeddingEnabled => isEnabled(flutterNewAndroidEmbeddingFeature); + /// Whether the Android embedding V2 is enabled. + bool get isAndroidEmbeddingV2Enabled => isEnabled(flutterAndroidEmbeddingV2Feature); /// Whether a particular feature is enabled for the current channel. /// @@ -71,7 +71,7 @@ flutterMacOSDesktopFeature, flutterWindowsDesktopFeature, flutterBuildPluginAsAarFeature, - flutterNewAndroidEmbeddingFeature, + flutterAndroidEmbeddingV2Feature, ]; /// The [Feature] for flutter web. @@ -133,9 +133,10 @@ ); /// The [Feature] for generating projects using the new Android embedding. -const Feature flutterNewAndroidEmbeddingFeature = Feature( - name: 'flutter create generates projects using the new Android embedding', - configSetting: 'enable-new-android-embedding', +const Feature flutterAndroidEmbeddingV2Feature = Feature( + name: 'flutter create generates projects using the Android embedding V2', + environmentOverride: 'ENABLE_ANDROID_EMBEDDING_V2', + configSetting: 'enable-android-embedding-v2', master: FeatureChannelSetting( available: true, enabledByDefault: false,
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index a582d8d..9568e58 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart
@@ -617,7 +617,7 @@ _overwriteFromTemplate(fs.path.join( 'module', 'android', - featureFlags.isNewAndroidEmbeddingEnabled ? 'library_new_embedding' : 'library', + featureFlags.isAndroidEmbeddingV2Enabled ? 'library_new_embedding' : 'library', ), ephemeralDirectory); _overwriteFromTemplate(fs.path.join('module', 'android', 'gradle'), ephemeralDirectory); gradle.injectGradleWrapperIfNeeded(ephemeralDirectory); @@ -631,7 +631,7 @@ 'projectName': parent.manifest.appName, 'androidIdentifier': parent.manifest.androidPackage, 'androidX': usesAndroidX, - 'useNewAndroidEmbedding': featureFlags.isNewAndroidEmbeddingEnabled, + 'useAndroidEmbeddingV2': featureFlags.isAndroidEmbeddingV2Enabled, }, printStatusWhenWriting: false, overwriteExisting: true,
diff --git a/packages/flutter_tools/templates/app/android-java.tmpl/app/src/main/java/androidIdentifier/MainActivity.java.tmpl b/packages/flutter_tools/templates/app/android-java.tmpl/app/src/main/java/androidIdentifier/MainActivity.java.tmpl index 6506de1..9371a79 100644 --- a/packages/flutter_tools/templates/app/android-java.tmpl/app/src/main/java/androidIdentifier/MainActivity.java.tmpl +++ b/packages/flutter_tools/templates/app/android-java.tmpl/app/src/main/java/androidIdentifier/MainActivity.java.tmpl
@@ -1,6 +1,6 @@ package {{androidIdentifier}}; -{{#useNewAndroidEmbedding}} +{{#useAndroidEmbeddingV2}} {{#androidX}} import androidx.annotation.NonNull; {{/androidX}} @@ -17,8 +17,8 @@ GeneratedPluginRegistrant.registerWith(flutterEngine); } } -{{/useNewAndroidEmbedding}} -{{^useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}} +{{^useAndroidEmbeddingV2}} import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; @@ -30,4 +30,4 @@ GeneratedPluginRegistrant.registerWith(this); } } -{{/useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}}
diff --git a/packages/flutter_tools/templates/app/android-kotlin.tmpl/app/src/main/kotlin/androidIdentifier/MainActivity.kt.tmpl b/packages/flutter_tools/templates/app/android-kotlin.tmpl/app/src/main/kotlin/androidIdentifier/MainActivity.kt.tmpl index fe04735..de068cf 100644 --- a/packages/flutter_tools/templates/app/android-kotlin.tmpl/app/src/main/kotlin/androidIdentifier/MainActivity.kt.tmpl +++ b/packages/flutter_tools/templates/app/android-kotlin.tmpl/app/src/main/kotlin/androidIdentifier/MainActivity.kt.tmpl
@@ -1,6 +1,6 @@ package {{androidIdentifier}} -{{#useNewAndroidEmbedding}} +{{#useAndroidEmbeddingV2}} {{#androidX}} import androidx.annotation.NonNull; {{/androidX}} @@ -16,8 +16,8 @@ GeneratedPluginRegistrant.registerWith(flutterEngine); } } -{{/useNewAndroidEmbedding}} -{{^useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}} +{{^useAndroidEmbeddingV2}} import android.os.Bundle import io.flutter.app.FlutterActivity import io.flutter.plugins.GeneratedPluginRegistrant @@ -28,4 +28,4 @@ GeneratedPluginRegistrant.registerWith(this) } } -{{/useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}}
diff --git a/packages/flutter_tools/templates/app/android.tmpl/app/src/main/AndroidManifest.xml.tmpl b/packages/flutter_tools/templates/app/android.tmpl/app/src/main/AndroidManifest.xml.tmpl index 00cce24..c64711b 100644 --- a/packages/flutter_tools/templates/app/android.tmpl/app/src/main/AndroidManifest.xml.tmpl +++ b/packages/flutter_tools/templates/app/android.tmpl/app/src/main/AndroidManifest.xml.tmpl
@@ -16,7 +16,7 @@ android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> - {{^useNewAndroidEmbedding}} + {{^useAndroidEmbeddingV2}} <!-- This keeps the window background of the activity showing until Flutter renders its first frame. It can be removed if there is no splash screen (such as the default splash screen @@ -24,18 +24,18 @@ <meta-data android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" android:value="true" /> - {{/useNewAndroidEmbedding}} + {{/useAndroidEmbeddingV2}} <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - {{#useNewAndroidEmbedding}} + {{#useAndroidEmbeddingV2}} <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> - {{/useNewAndroidEmbedding}} + {{/useAndroidEmbeddingV2}} </application> </manifest>
diff --git a/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/AndroidManifest.xml.tmpl b/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/AndroidManifest.xml.tmpl index 3ef4d25..ae956a4 100644 --- a/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/AndroidManifest.xml.tmpl +++ b/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/AndroidManifest.xml.tmpl
@@ -36,12 +36,12 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> - {{#useNewAndroidEmbedding}} + {{#useAndroidEmbeddingV2}} <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> - {{/useNewAndroidEmbedding}} + {{/useAndroidEmbeddingV2}} </application> </manifest>
diff --git a/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/java/androidIdentifier/host/MainActivity.java.tmpl b/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/java/androidIdentifier/host/MainActivity.java.tmpl index bc7daff..32963b3 100644 --- a/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/java/androidIdentifier/host/MainActivity.java.tmpl +++ b/packages/flutter_tools/templates/module/android/host_app_common/app.tmpl/src/main/java/androidIdentifier/host/MainActivity.java.tmpl
@@ -1,7 +1,7 @@ package {{androidIdentifier}}.host; import android.os.Bundle; -{{#useNewAndroidEmbedding}} +{{#useAndroidEmbeddingV2}} {{#androidX}} import androidx.annotation.NonNull; {{/androidX}} @@ -18,8 +18,8 @@ GeneratedPluginRegistrant.registerWith(flutterEngine); } } -{{/useNewAndroidEmbedding}} -{{^useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}} +{{^useAndroidEmbeddingV2}} import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; @@ -30,4 +30,4 @@ GeneratedPluginRegistrant.registerWith(this); } } -{{/useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}}
diff --git a/packages/flutter_tools/templates/plugin/android-java.tmpl/src/main/java/androidIdentifier/pluginClass.java.tmpl b/packages/flutter_tools/templates/plugin/android-java.tmpl/src/main/java/androidIdentifier/pluginClass.java.tmpl index f6c9d52..b6a7297 100644 --- a/packages/flutter_tools/templates/plugin/android-java.tmpl/src/main/java/androidIdentifier/pluginClass.java.tmpl +++ b/packages/flutter_tools/templates/plugin/android-java.tmpl/src/main/java/androidIdentifier/pluginClass.java.tmpl
@@ -1,6 +1,6 @@ package {{androidIdentifier}}; -{{#useNewAndroidEmbedding}} +{{#useAndroidEmbeddingV2}} {{#androidX}} import androidx.annotation.NonNull; {{/androidX}} @@ -29,9 +29,13 @@ result.notImplemented(); } } + + @Override + public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { + } } -{{/useNewAndroidEmbedding}} -{{^useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}} +{{^useAndroidEmbeddingV2}} import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; @@ -55,4 +59,4 @@ } } } -{{/useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}}
diff --git a/packages/flutter_tools/templates/plugin/android-kotlin.tmpl/src/main/kotlin/androidIdentifier/pluginClass.kt.tmpl b/packages/flutter_tools/templates/plugin/android-kotlin.tmpl/src/main/kotlin/androidIdentifier/pluginClass.kt.tmpl index af45d9c..1147f1c 100644 --- a/packages/flutter_tools/templates/plugin/android-kotlin.tmpl/src/main/kotlin/androidIdentifier/pluginClass.kt.tmpl +++ b/packages/flutter_tools/templates/plugin/android-kotlin.tmpl/src/main/kotlin/androidIdentifier/pluginClass.kt.tmpl
@@ -1,6 +1,6 @@ package {{androidIdentifier}} -{{#useNewAndroidEmbedding}} +{{#useAndroidEmbeddingV2}} {{#androidX}} import androidx.annotation.NonNull; {{/androidX}} @@ -15,7 +15,7 @@ /** {{pluginClass}} */ public class {{pluginClass}}: FlutterPlugin, MethodCallHandler { - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPluginBinding) { + override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { val channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "{{projectName}}") channel.setMethodCallHandler({{pluginClass}}()); } @@ -27,9 +27,12 @@ result.notImplemented() } } + + override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { + } } -{{/useNewAndroidEmbedding}} -{{^useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}} +{{^useAndroidEmbeddingV2}} import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel.MethodCallHandler @@ -53,4 +56,4 @@ } } } -{{/useNewAndroidEmbedding}} +{{/useAndroidEmbeddingV2}}
diff --git a/packages/flutter_tools/test/src/testbed.dart b/packages/flutter_tools/test/src/testbed.dart index 7f9ab08..c7298ab 100644 --- a/packages/flutter_tools/test/src/testbed.dart +++ b/packages/flutter_tools/test/src/testbed.dart
@@ -699,7 +699,7 @@ this.isMacOSEnabled = false, this.isWebEnabled = false, this.isWindowsEnabled = false, - this.isNewAndroidEmbeddingEnabled = false, + this.isAndroidEmbeddingV2Enabled = false, }); @override @@ -715,7 +715,7 @@ final bool isWindowsEnabled; @override - final bool isNewAndroidEmbeddingEnabled; + final bool isAndroidEmbeddingV2Enabled; @override bool isEnabled(Feature feature) { @@ -728,8 +728,8 @@ return isMacOSEnabled; case flutterWindowsDesktopFeature: return isWindowsEnabled; - case flutterNewAndroidEmbeddingFeature: - return isNewAndroidEmbeddingEnabled; + case flutterAndroidEmbeddingV2Feature: + return isAndroidEmbeddingV2Enabled; } return false; }