Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 84238c4

Browse files
author
Jonah Williams
authored
[scenarios] test disabling surface clear. (#52128)
I suspect that the change to clear the surface is the result of the scenario app instability. just a guess: the screenshots looks like we're missing the platform view. maybe the clearing of the surface is causing an extra frame to be pushed. That frame is getting picked up in the golden due to a race condition that is hard to hit locally Testing disabling of this functionality in the golden test. If this pass a real fix involves some sort of hook into the rendering to verify it has fully completed before screenshotting.
1 parent a6acfa4 commit 84238c4

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ public class FlutterRenderer implements TextureRegistry {
6262
*/
6363
@VisibleForTesting public static boolean debugForceSurfaceProducerGlTextures = false;
6464

65+
/** Whether to disable clearing of the Surface used to render platform views. */
66+
@VisibleForTesting public static boolean debugDisableSurfaceClear = false;
67+
6568
private static final String TAG = "FlutterRenderer";
6669

6770
@NonNull private final FlutterJNI flutterJNI;

shell/platform/android/io/flutter/plugin/platform/PlatformViewWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import androidx.annotation.VisibleForTesting;
2727
import io.flutter.Log;
2828
import io.flutter.embedding.android.AndroidTouchProcessor;
29+
import io.flutter.embedding.engine.renderer.FlutterRenderer;
2930
import io.flutter.util.ViewUtils;
3031

3132
/**
@@ -63,7 +64,7 @@ public PlatformViewWrapper(
6364
this.renderTarget = renderTarget;
6465

6566
Surface surface = renderTarget.getSurface();
66-
if (surface != null) {
67+
if (surface != null && !FlutterRenderer.debugDisableSurfaceClear) {
6768
final Canvas canvas = surface.lockHardwareCanvas();
6869
try {
6970
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);

testing/scenario_app/android/app/src/androidTest/java/dev/flutter/TestRunner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public void onCreate(@Nullable Bundle arguments) {
2424
"--impeller-backend=" + arguments.getString("impeller-backend", "vulkan")
2525
};
2626
}
27+
FlutterRenderer.debugDisableSurfaceClear = true;
2728
if ("true".equals(arguments.getString("force-surface-producer-surface-texture"))) {
2829
// Set a test flag to force the SurfaceProducer to use SurfaceTexture.
2930
FlutterRenderer.debugForceSurfaceProducerGlTextures = true;

0 commit comments

Comments
 (0)