diff --git a/engine/src/flutter/ci/firebase_testlab.sh b/engine/src/flutter/ci/firebase_testlab.sh index 808035040b8..9bd8f10074a 100755 --- a/engine/src/flutter/ci/firebase_testlab.sh +++ b/engine/src/flutter/ci/firebase_testlab.sh @@ -33,3 +33,16 @@ gcloud --project flutter-infra firebase test android run \ --results-bucket=gs://flutter_firebase_testlab \ --results-dir="engine_scenario_test/$GIT_REVISION/$BUILD_ID" \ --device model=flame,version=29 + +errors=$(gsutil cat gs://flutter_firebase_testlab/engine_scenario_test/$GIT_REVISION/$BUILD_ID/\*/logcat | grep "[FE]/flutter" | true) +if [[ ! -z $errors ]]; then + echo "Errors detected in logcat:" + echo "$errors" + exit 1 +fi + +result_size=$(gsutil du gs://flutter_firebase_testlab/engine_scenario_test/$GIT_REVISION/$BUILD_ID/\*/game_loop_results/results_scenario_0.json | cut -d " " -f1) +if [[ $result_size == "0" ]]; then + echo "Failed to produce a timeline." + exit 1 +fi diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java index 67570302bad..ce1e4779b1e 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -236,8 +236,20 @@ public class FlutterRenderer implements TextureRegistry { isDisplayingFlutterUi = false; } - // TODO(mattcarroll): describe the native behavior that this invokes + /** + * Notifies Flutter that the viewport metrics, e.g. window height and width, have changed. + * + *
If the width, height, or devicePixelRatio are less than or equal to 0, this update is
+ * ignored.
+ *
+ * @param viewportMetrics The metrics to send to the Dart application.
+ */
public void setViewportMetrics(@NonNull ViewportMetrics viewportMetrics) {
+ // We might get called with just the DPR if width/height aren't available yet.
+ // Just ignore, as it will get called again when width/height are set.
+ if (!viewportMetrics.validate()) {
+ return;
+ }
Log.v(
TAG,
"Setting viewport metrics\n"
@@ -360,5 +372,14 @@ public class FlutterRenderer implements TextureRegistry {
public int systemGestureInsetRight = 0;
public int systemGestureInsetBottom = 0;
public int systemGestureInsetLeft = 0;
+
+ /**
+ * Whether this instance contains valid metrics for the Flutter application.
+ *
+ * @return True if width, height, and devicePixelRatio are > 0; false otherwise.
+ */
+ boolean validate() {
+ return width > 0 && height > 0 && devicePixelRatio > 0;
+ }
}
}
diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java
index 3ec310b5ef1..efb41125add 100644
--- a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java
+++ b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/MemoryLeakTests.java
@@ -26,7 +26,7 @@ public class MemoryLeakTests {
@FailTestOnLeak
public void platformViewHybridComposition_launchActivityFinishAndLaunchAgain() throws Exception {
Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.putExtra("scenario", "platform_view");
+ intent.putExtra("scenario_name", "platform_view");
intent.putExtra("use_android_view", true);
activityRule.launchActivity(intent);
diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java
index 2723ed7b793..04a9601701b 100644
--- a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java
+++ b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformTextureUiTests.java
@@ -33,73 +33,73 @@ public class PlatformTextureUiTests {
@Test
public void testPlatformView() throws Exception {
- intent.putExtra("scenario", "platform_view");
+ intent.putExtra("scenario_name", "platform_view");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewMultiple() throws Exception {
- intent.putExtra("scenario", "platform_view_multiple");
+ intent.putExtra("scenario_name", "platform_view_multiple");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewMultipleBackgroundForeground() throws Exception {
- intent.putExtra("scenario", "platform_view_multiple_background_foreground");
+ intent.putExtra("scenario_name", "platform_view_multiple_background_foreground");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewCliprect() throws Exception {
- intent.putExtra("scenario", "platform_view_cliprect");
+ intent.putExtra("scenario_name", "platform_view_cliprect");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewCliprrect() throws Exception {
- intent.putExtra("scenario", "platform_view_cliprrect");
+ intent.putExtra("scenario_name", "platform_view_cliprrect");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewClippath() throws Exception {
- intent.putExtra("scenario", "platform_view_clippath");
+ intent.putExtra("scenario_name", "platform_view_clippath");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewTransform() throws Exception {
- intent.putExtra("scenario", "platform_view_transform");
+ intent.putExtra("scenario_name", "platform_view_transform");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewOpacity() throws Exception {
- intent.putExtra("scenario", "platform_view_opacity");
+ intent.putExtra("scenario_name", "platform_view_opacity");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewRotate() throws Exception {
- intent.putExtra("scenario", "platform_view_rotate");
+ intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewMultipleWithoutOverlays() throws Exception {
- intent.putExtra("scenario", "platform_view_multiple_without_overlays");
+ intent.putExtra("scenario_name", "platform_view_multiple_without_overlays");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewTwoIntersectingOverlays() throws Exception {
- intent.putExtra("scenario", "platform_view_two_intersecting_overlays");
+ intent.putExtra("scenario_name", "platform_view_two_intersecting_overlays");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewWithoutOverlayIntersection() throws Exception {
- intent.putExtra("scenario", "platform_view_no_overlay_intersection");
+ intent.putExtra("scenario_name", "platform_view_no_overlay_intersection");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
}
diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java
index 63b86677958..0d81e50ade5 100644
--- a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java
+++ b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/PlatformViewUiTests.java
@@ -33,73 +33,73 @@ public class PlatformViewUiTests {
@Test
public void testPlatformView() throws Exception {
- intent.putExtra("scenario", "platform_view");
+ intent.putExtra("scenario_name", "platform_view");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewMultiple() throws Exception {
- intent.putExtra("scenario", "platform_view_multiple");
+ intent.putExtra("scenario_name", "platform_view_multiple");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewMultipleBackgroundForeground() throws Exception {
- intent.putExtra("scenario", "platform_view_multiple_background_foreground");
+ intent.putExtra("scenario_name", "platform_view_multiple_background_foreground");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewCliprect() throws Exception {
- intent.putExtra("scenario", "platform_view_cliprect");
+ intent.putExtra("scenario_name", "platform_view_cliprect");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewCliprrect() throws Exception {
- intent.putExtra("scenario", "platform_view_cliprrect");
+ intent.putExtra("scenario_name", "platform_view_cliprrect");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewClippath() throws Exception {
- intent.putExtra("scenario", "platform_view_clippath");
+ intent.putExtra("scenario_name", "platform_view_clippath");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewTransform() throws Exception {
- intent.putExtra("scenario", "platform_view_transform");
+ intent.putExtra("scenario_name", "platform_view_transform");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewOpacity() throws Exception {
- intent.putExtra("scenario", "platform_view_opacity");
+ intent.putExtra("scenario_name", "platform_view_opacity");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewRotate() throws Exception {
- intent.putExtra("scenario", "platform_view_rotate");
+ intent.putExtra("scenario_name", "platform_view_rotate");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewMultipleWithoutOverlays() throws Exception {
- intent.putExtra("scenario", "platform_view_multiple_without_overlays");
+ intent.putExtra("scenario_name", "platform_view_multiple_without_overlays");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewTwoIntersectingOverlays() throws Exception {
- intent.putExtra("scenario", "platform_view_two_intersecting_overlays");
+ intent.putExtra("scenario_name", "platform_view_two_intersecting_overlays");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
@Test
public void testPlatformViewWithoutOverlayIntersection() throws Exception {
- intent.putExtra("scenario", "platform_view_no_overlay_intersection");
+ intent.putExtra("scenario_name", "platform_view_no_overlay_intersection");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
}
diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java
index 96f91337a03..717ec3940a2 100644
--- a/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java
+++ b/engine/src/flutter/testing/scenario_app/android/app/src/androidTest/java/dev/flutter/scenariosui/SpawnEngineTests.java
@@ -31,7 +31,7 @@ public class SpawnEngineTests {
@Test
public void testSpawnedEngine() throws Exception {
- intent.putExtra("scenario", "spawn_engine_works");
+ intent.putExtra("scenario_name", "spawn_engine_works");
ScreenshotUtil.capture(activityRule.launchActivity(intent));
}
}
diff --git a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java
index 6abd080c1ba..c6e810f320b 100644
--- a/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java
+++ b/engine/src/flutter/testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java
@@ -39,7 +39,6 @@ public class TestActivity extends TestableFlutterActivity {
if (Build.VERSION.SDK_INT > 22) {
requestPermissions(new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
}
- // Run for one minute, get the timeline data, write it, and finish.
final Uri logFileUri = launchIntent.getData();
new Handler()
.postDelayed(
@@ -47,7 +46,6 @@ public class TestActivity extends TestableFlutterActivity {
@Override
public void run() {
writeTimelineData(logFileUri);
-
testFlutterLoaderCallbackWhenInitializedTwice();
}
},
@@ -70,13 +68,14 @@ public class TestActivity extends TestableFlutterActivity {
@Override
public void onFlutterUiDisplayed() {
final Intent launchIntent = getIntent();
- if (!launchIntent.hasExtra("scenario")) {
- return;
- }
MethodChannel channel =
new MethodChannel(getFlutterEngine().getDartExecutor(), "driver", JSONMethodCodec.INSTANCE);
Map