diff --git a/dev/benchmarks/platform_views_layout/lib/main.dart b/dev/benchmarks/platform_views_layout/lib/main.dart
index d8d81e93b27..64f7729cbc4 100644
--- a/dev/benchmarks/platform_views_layout/lib/main.dart
+++ b/dev/benchmarks/platform_views_layout/lib/main.dart
@@ -7,8 +7,6 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
-import 'android_platform_view.dart';
-
void main() {
runApp(
const PlatformViewApp()
@@ -17,13 +15,9 @@ void main() {
class PlatformViewApp extends StatefulWidget {
const PlatformViewApp({
- Key key,
- this.enableHybridCompositionOnAndroid = false,
+ Key key
}) : super(key: key);
- /// Whether to use render the Android view as a platform view or a texture.
- final bool enableHybridCompositionOnAndroid;
-
@override
PlatformViewAppState createState() => PlatformViewAppState();
@@ -89,17 +83,9 @@ class DummyPlatformView extends StatelessWidget {
viewType: viewType,
);
} else if (Platform.isAndroid) {
- final PlatformViewApp app = PlatformViewApp.of(context).widget;
- assert(app != null);
- if (app.enableHybridCompositionOnAndroid) {
- nativeView = const AndroidPlatformView(
- viewType: viewType,
- );
- } else {
- nativeView = const AndroidView(
- viewType: viewType,
- );
- }
+ nativeView = const AndroidView(
+ viewType: viewType,
+ );
} else {
assert(false, 'Invalid platform');
}
diff --git a/dev/benchmarks/platform_views_layout/test_driver/android_view_scroll_perf.dart b/dev/benchmarks/platform_views_layout/test_driver/android_view_scroll_perf.dart
index d3d36e4ac52..31062143677 100644
--- a/dev/benchmarks/platform_views_layout/test_driver/android_view_scroll_perf.dart
+++ b/dev/benchmarks/platform_views_layout/test_driver/android_view_scroll_perf.dart
@@ -10,8 +10,6 @@ import 'package:platform_views_layout/main.dart' as app;
void main() {
enableFlutterDriverExtension();
runApp(
- const app.PlatformViewApp(
- enableHybridCompositionOnAndroid: true,
- )
+ const app.PlatformViewApp()
);
}
diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/README.md b/dev/benchmarks/platform_views_layout_hybrid_composition/README.md
new file mode 100644
index 00000000000..cb35ed6efd8
--- /dev/null
+++ b/dev/benchmarks/platform_views_layout_hybrid_composition/README.md
@@ -0,0 +1,26 @@
+# platform_views_layout_hybrid_composition
+
+## Scrolling benchmark
+
+To run the scrolling benchmark on a device:
+
+```
+flutter drive --profile test_driver/scroll_perf.dart
+```
+
+Results should be in the file `build/platform_views_scroll_perf_hybrid_composition.timeline_summary.json`.
+
+More detailed logs should be in `build/platform_views_scroll_perf_hybrid_composition.timeline.json`.
+
+
+## Startup benchmark
+
+To measure startup time on a device:
+
+```
+flutter run --profile --trace-startup
+```
+
+Results should be in the logs.
+
+Additional results should be in the file `build/start_up_info.json`.
diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/build.gradle b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/build.gradle
new file mode 100644
index 00000000000..b3b148868c9
--- /dev/null
+++ b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/build.gradle
@@ -0,0 +1,46 @@
+// Copyright 2014 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.
+
+def localProperties = new Properties()
+def localPropertiesFile = rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ localPropertiesFile.withInputStream { stream ->
+ localProperties.load(stream)
+ }
+}
+
+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.")
+}
+
+apply plugin: 'com.android.application'
+apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
+android {
+ compileSdkVersion 28
+
+ lintOptions {
+ disable 'InvalidPackage'
+ }
+
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion 28
+ versionCode 1
+ versionName "0.0.1"
+ }
+
+ 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 '../..'
+}
diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/AndroidManifest.xml b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..0343ef316c4
--- /dev/null
+++ b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformView.java b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformView.java
new file mode 100644
index 00000000000..08f9e225f73
--- /dev/null
+++ b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformView.java
@@ -0,0 +1,31 @@
+// Copyright 2014 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.
+
+package dev.benchmarks.platform_views_layout_hybrid_composition;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.view.View;
+import android.widget.TextView;
+import io.flutter.plugin.platform.PlatformView;
+
+public class DummyPlatformView implements PlatformView {
+ private final TextView textView;
+
+ @SuppressWarnings("unchecked")
+ DummyPlatformView(final Context context, int id) {
+ textView = new TextView(context);
+ textView.setTextSize(72);
+ textView.setBackgroundColor(Color.rgb(255, 255, 255));
+ textView.setText("DummyPlatformView");
+ }
+
+ @Override
+ public View getView() {
+ return textView;
+ }
+
+ @Override
+ public void dispose() {}
+}
diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformViewActivity.java b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformViewActivity.java
new file mode 100644
index 00000000000..eeb4a2f959c
--- /dev/null
+++ b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformViewActivity.java
@@ -0,0 +1,19 @@
+// Copyright 2014 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.
+
+package dev.benchmarks.platform_views_layout_hybrid_composition;
+
+import androidx.annotation.NonNull;
+import io.flutter.embedding.android.FlutterActivity;
+import io.flutter.embedding.engine.FlutterEngine;
+
+public class DummyPlatformViewActivity extends FlutterActivity {
+ @Override
+ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
+ flutterEngine
+ .getPlatformViewsController()
+ .getRegistry()
+ .registerViewFactory("benchmarks/platform_views_layout_hybrid_composition/DummyPlatformView", new DummyPlatformViewFactory());
+ }
+}
diff --git a/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformViewFactory.java b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformViewFactory.java
new file mode 100644
index 00000000000..a546aadc5bb
--- /dev/null
+++ b/dev/benchmarks/platform_views_layout_hybrid_composition/android/app/src/main/java/dev/bechmarks/platform_views_layout/DummyPlatformViewFactory.java
@@ -0,0 +1,42 @@
+// Copyright 2014 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.
+
+package dev.benchmarks.platform_views_layout_hybrid_composition;
+
+import android.content.Context;
+import androidx.annotation.Nullable;
+import io.flutter.plugin.common.MessageCodec;
+import io.flutter.plugin.common.StringCodec;
+import io.flutter.plugin.platform.PlatformView;
+import io.flutter.plugin.platform.PlatformViewFactory;
+import java.nio.ByteBuffer;
+
+public final class DummyPlatformViewFactory extends PlatformViewFactory {
+ DummyPlatformViewFactory() {
+ super(
+ new MessageCodec