diff --git a/dev/bots/firebase_testlab.sh b/dev/bots/firebase_testlab.sh
index f4d778cd9c..138ebea4c5 100755
--- a/dev/bots/firebase_testlab.sh
+++ b/dev/bots/firebase_testlab.sh
@@ -8,6 +8,7 @@
tests=(
"dev/integration_tests/release_smoke_test"
"dev/integration_tests/abstract_method_smoke_test"
+ "dev/integration_tests/android_embedding_2"
)
# The devices where the tests are run.
diff --git a/dev/integration_tests/android_embedding_2/.gitignore b/dev/integration_tests/android_embedding_2/.gitignore
new file mode 100644
index 0000000000..437cb45872
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/.gitignore
@@ -0,0 +1,36 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.buildlog/
+.history
+.svn/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+.dart_tool/
+.flutter-plugins
+.packages
+.pub-cache/
+.pub/
+/build/
+
+# Web related
+lib/generated_plugin_registrant.dart
+
+# Exceptions to above rules.
+!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
diff --git a/dev/integration_tests/android_embedding_2/.metadata b/dev/integration_tests/android_embedding_2/.metadata
new file mode 100644
index 0000000000..7a53726c2a
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/.metadata
@@ -0,0 +1,10 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: 1946fc4da0f80c522d7e3ae7d4f7309908ed86f2
+ channel: unknown
+
+project_type: app
diff --git a/dev/integration_tests/android_embedding_2/README.md b/dev/integration_tests/android_embedding_2/README.md
new file mode 100644
index 0000000000..b1d2a43de3
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/README.md
@@ -0,0 +1,9 @@
+# App using Android Embedding 2
+
+A new Flutter project using the Android embedding 2.
+
+This smoke test uses the following plugins:
+
+| Plugin | Android Embedding |
+|--------------------|-------------------|
+| battery: 0.3.0+5 | 1 |
diff --git a/dev/integration_tests/android_embedding_2/android/.gitignore b/dev/integration_tests/android_embedding_2/android/.gitignore
new file mode 100644
index 0000000000..2f2a790389
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/.gitignore
@@ -0,0 +1,6 @@
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
\ No newline at end of file
diff --git a/dev/integration_tests/android_embedding_2/android/app/build.gradle b/dev/integration_tests/android_embedding_2/android/app/build.gradle
new file mode 100644
index 0000000000..1b936907c7
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/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_2"
+ 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/debug/AndroidManifest.xml b/dev/integration_tests/android_embedding_2/android/app/src/debug/AndroidManifest.xml
new file mode 100644
index 0000000000..bbe2d9d616
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/AndroidManifest.xml b/dev/integration_tests/android_embedding_2/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..63499d957f
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
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_2/android/app/src/main/java/dev/flutter/plugins/GeneratedPluginRegistrant.java
new file mode 100644
index 0000000000..deee86207a
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/main/java/dev/flutter/plugins/GeneratedPluginRegistrant.java
@@ -0,0 +1,17 @@
+package dev.flutter.plugins;
+
+import androidx.annotation.NonNull;
+import io.flutter.embedding.engine.FlutterEngine;
+import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
+
+/**
+ * Generated file. Do not edit.
+ * This file is generated by the Flutter tool based on the
+ * plugins that support the Android platform.
+ */
+public final class GeneratedPluginRegistrant {
+ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
+ ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
+ io.flutter.plugins.battery.BatteryPlugin.registerWith(shimPluginRegistry.registrarFor("io.flutter.plugins.battery.BatteryPlugin"));
+ }
+}
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
new file mode 100644
index 0000000000..e7050b9bb2
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/main/kotlin/com/example/android_embedding_2/MainActivity.kt
@@ -0,0 +1,12 @@
+package com.example.android_embedding_2
+
+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_2/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 0000000000..304732f884
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/main/res/values/styles.xml b/dev/integration_tests/android_embedding_2/android/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000000..00fa4417cf
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml b/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml
new file mode 100644
index 0000000000..bbe2d9d616
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/app/src/profile/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/dev/integration_tests/android_embedding_2/android/build.gradle b/dev/integration_tests/android_embedding_2/android/build.gradle
new file mode 100644
index 0000000000..3100ad2d55
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/build.gradle
@@ -0,0 +1,31 @@
+buildscript {
+ ext.kotlin_version = '1.3.50'
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+rootProject.buildDir = '../build'
+subprojects {
+ project.buildDir = "${rootProject.buildDir}/${project.name}"
+}
+subprojects {
+ project.evaluationDependsOn(':app')
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/dev/integration_tests/android_embedding_2/android/gradle.properties b/dev/integration_tests/android_embedding_2/android/gradle.properties
new file mode 100644
index 0000000000..38c8d4544f
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/gradle.properties
@@ -0,0 +1,4 @@
+org.gradle.jvmargs=-Xmx1536M
+android.enableR8=true
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/dev/integration_tests/android_embedding_2/android/gradle/wrapper/gradle-wrapper.properties b/dev/integration_tests/android_embedding_2/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..296b146b73
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Jun 23 08:50:38 CEST 2017
+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_embedding_2/android/settings.gradle b/dev/integration_tests/android_embedding_2/android/settings.gradle
new file mode 100644
index 0000000000..5a2f14fb18
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/settings.gradle
@@ -0,0 +1,15 @@
+include ':app'
+
+def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+
+def plugins = new Properties()
+def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
+if (pluginsFile.exists()) {
+ pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
+}
+
+plugins.each { name, path ->
+ def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
+ include ":$name"
+ project(":$name").projectDir = pluginDirectory
+}
diff --git a/dev/integration_tests/android_embedding_2/android/settings_aar.gradle b/dev/integration_tests/android_embedding_2/android/settings_aar.gradle
new file mode 100644
index 0000000000..e7b4def49c
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/android/settings_aar.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/dev/integration_tests/android_embedding_2/lib/main.dart b/dev/integration_tests/android_embedding_2/lib/main.dart
new file mode 100644
index 0000000000..62c2fa3bd0
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/lib/main.dart
@@ -0,0 +1,17 @@
+// Copyright 2019 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/widgets.dart';
+
+void main() {
+ runApp(
+ const Center(
+ child: Text(
+ 'Android Embedding 2',
+ textDirection: TextDirection.ltr,
+ ),
+ ),
+ );
+ print('Test suceeded');
+}
diff --git a/dev/integration_tests/android_embedding_2/pubspec.yaml b/dev/integration_tests/android_embedding_2/pubspec.yaml
new file mode 100644
index 0000000000..5a6077aef6
--- /dev/null
+++ b/dev/integration_tests/android_embedding_2/pubspec.yaml
@@ -0,0 +1,103 @@
+name: android_embedding_2
+description: A new Flutter project.
+
+# The following defines the version and build number for your application.
+# A version number is three numbers separated by dots, like 1.2.43
+# followed by an optional build number separated by a +.
+# Both the version and the builder number may be overridden in flutter
+# build by specifying --build-name and --build-number, respectively.
+# In Android, build-name is used as versionName while build-number used as versionCode.
+# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
+# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
+# Read more about iOS versioning at
+# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
+version: 1.0.0+1
+
+environment:
+ sdk: ">=2.1.0 <3.0.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+ # This plugin is using Android Embedding 1
+ battery: 0.3.0+5
+ # TODO(egarciad): Add a plugin that uses Android Embedding 2
+
+ # The following adds the Cupertino Icons font to your application.
+ # Use with the CupertinoIcons class for iOS style icons.
+ cupertino_icons: 0.1.2
+
+ collection: 1.14.11 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ meta: 1.1.7 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+
+# For information on the generic Dart part of this file, see the
+# following page: https://dart.dev/tools/pub/pubspec
+
+# The following section is specific to Flutter.
+
+ archive: 2.0.10 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ args: 1.5.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ async: 2.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ boolean_selector: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ charcode: 1.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ convert: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ crypto: 2.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ image: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ matcher: 0.12.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ path: 1.6.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ pedantic: 1.8.0+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ petitparser: 2.4.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ quiver: 2.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ source_span: 1.5.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ stack_trace: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ stream_channel: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ string_scanner: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ test_api: 0.2.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+ xml: 3.5.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
+
+flutter:
+
+ # The following line ensures that the Material Icons font is
+ # included with your application, so that you can use the icons in
+ # the material Icons class.
+ uses-material-design: true
+
+ # To add assets to your application, add an assets section, like this:
+ # assets:
+ # - images/a_dot_burr.jpeg
+ # - images/a_dot_ham.jpeg
+
+ # An image asset can refer to one or more resolution-specific "variants", see
+ # https://flutter.dev/assets-and-images/#resolution-aware.
+
+ # For details regarding adding assets from package dependencies, see
+ # https://flutter.dev/assets-and-images/#from-packages
+
+ # To add custom fonts to your application, add a fonts section here,
+ # in this "flutter" section. Each entry in this list should have a
+ # "family" key with the font family name, and a "fonts" key with a
+ # list giving the asset and other descriptors for the font. For
+ # example:
+ # fonts:
+ # - family: Schyler
+ # fonts:
+ # - asset: fonts/Schyler-Regular.ttf
+ # - asset: fonts/Schyler-Italic.ttf
+ # style: italic
+ # - family: Trajan Pro
+ # fonts:
+ # - asset: fonts/TrajanPro.ttf
+ # - asset: fonts/TrajanPro_Bold.ttf
+ # weight: 700
+ #
+ # For details regarding fonts from package dependencies,
+ # see https://flutter.dev/custom-fonts/#from-packages
+
+# PUBSPEC CHECKSUM: 23a5
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 bc1305e0bb..00cce24f55 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,6 +16,7 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
+ {{^useNewAndroidEmbedding}}