Skip to content

ReplaceSurfaceProducer.Callback.onSurfaceCreated with onSurfaceAvailable when published to stable #155131

@matanlurey

Description

@matanlurey

Callback.SurfaceProducer.onSurfaceCreated reads:

Invoked when a previous surface is now invalid and a new surface is now available.

Unfortunately this (a) is not a true statement and (b) the method name sucks.

What this really is:

public FlutterRenderer(@NonNull FlutterJNI flutterJNI) {
  this.flutterJNI = flutterJNI;
  this.flutterJNI.addIsDisplayingFlutterUiListener(flutterUiDisplayListener);
  ProcessLifecycleOwner.get()
      .getLifecycle()
      .addObserver(
          new DefaultLifecycleObserver() {
            @Override
            public void onResume(@NonNull LifecycleOwner owner) {
              Log.v(TAG, "onResume called; notifying SurfaceProducers");
              for (ImageReaderSurfaceProducer producer : imageReaderProducers) {
                if (producer.callback != null) {
                  producer.callback.onSurfaceCreated();
                }
              }
            }
          });
  }

A resume is not directly correlated with a surface creation.

Some possible ideas:

  1. Only call the method when the surface was previously destroyed
  2. Rename the method onSurfaceAvailable or onSurfaceResumed

/cc @johnmccutchan @jonahwilliams @reidbaker

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.platform-androidAndroid applications specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions