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

Switch to FlutterSurfaceView if no Android view is in the frame #19487

Merged
merged 9 commits into from
Jul 6, 2020

Conversation

blasten
Copy link

@blasten blasten commented Jul 3, 2020

Description

This is the last part to address flutter/flutter#58291. When an Android view is present in the frame, we switch the surface from FlutterSurfaceView to FlutterImageView. When no Android view is present, then we switch back to previous surface.

cc @jason-simmons

Related Issues

Fixes flutter/flutter#58291

Tests

I added the following tests: Unit tests (WIP)

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

@blasten blasten requested a review from iskakaushik July 3, 2020 03:09
@blasten blasten changed the title Switch to previous surface Switch to FlutterSurfaceView if no Android view is in the frame Jul 6, 2020
@blasten blasten requested a review from jason-simmons July 6, 2020 04:29
@blasten blasten marked this pull request as ready for review July 6, 2020 04:29
// Skip a frame if the embedding is switching surfaces.
auto should_submit_current_frame =
previous_frame_view_count_ > 0 || current_frame_view_count == 0;
if (should_submit_current_frame) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is false, when the Java side is switching from FlutterSurfaceView to FlutterImageView.

// this becomes true if all the required surfaces have images available.
//
// This is used to decide if the platform views can be rendered in the current frame.
// If one of the surfaces don't have an image, the frame may be incomplete and must be dropped.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "doesn't"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

// Show platform views only if the surfaces have images available in this frame,
// and if the platform view is rendered in this frame.
//
// Otherwise, hide the platform view, but don't remove it from view hierarchy yet as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "the view hierarchy"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@blasten blasten added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Jul 6, 2020
@blasten
Copy link
Author

blasten commented Jul 6, 2020

Linux Web Engine is failing on

/home/swarming/.pub-cache/hosted/pub.dartlang.org/test_core-0.3.4/lib/test_core.dart:69:5: Error: 'unawaited' is imported from both 'package:meta/meta.dart' and 'package:test_api/src/utils.dart'.
    unawaited(Future.error('Dummy exception to set exit code.'));

That appears to be fixed upstream.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes platform-android waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic switch between FlutterSurfaceView/FlutterTextureView and FlutterImageView
4 participants