Skip to content

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Apr 26, 2022

xref b/230429702

See #101544

We can get multiple calls to handleMetricsChanged during application startup. These calls may happen at any point, sometimes before runApp is called. Before a render object is attached to the root RenderView, we should avoid forcing a frame to be scheduled, as it may cause a black flickering and dismissal of the splash screen too early on Android.

Depending on what branch 101544 landed in, we may need to look at cherry picking this change in.

/cc @jiahaog fyi

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Apr 26, 2022
@dnfield
Copy link
Contributor Author

dnfield commented Apr 26, 2022

/cc @blasten @jmagman FYI

@dnfield
Copy link
Contributor Author

dnfield commented Apr 26, 2022

from the internal bug, you can see this pretty clearly: an app that looks like this:

void main() {
  WidgetsFlutterBinding.ensureInitialized();
}

Eventually produces this:

04-26 15:09:49.265 13249 13284 I flutter : The Dart VM service is listening on http://127.0.0.1:37133/26c8TuvQXOs=/
04-26 15:09:49.440 13249 13273 I flutter : scheduleForcedFrame() called. Current phase is SchedulerPhase.idle.
04-26 15:09:49.443 13249 13273 I flutter : #0      debugPrintStack (package:flutter/src/foundation/assertions.dart:1196)
04-26 15:09:49.444 13249 13273 I flutter : #1      SchedulerBinding.scheduleForcedFrame (package:flutter/src/scheduler/binding.dart:819)
04-26 15:09:49.444 13249 13273 I flutter : #2      RendererBinding.handleMetricsChanged (package:flutter/src/rendering/binding.dart:241)
04-26 15:09:49.444 13249 13273 I flutter : #3      WidgetsBinding.handleMetricsChanged (package:flutter/src/widgets/binding.dart:568)
04-26 15:09:49.444 13249 13273 I flutter : #4      _invoke (dart:ui/hooks.dart:148)
04-26 15:09:49.444 13249 13273 I flutter : #5      PlatformDispatcher._updateWindowMetrics (dart:ui/platform_dispatcher.dart:246)
04-26 15:09:49.444 13249 13273 I flutter : #6      _updateWindowMetrics (dart:ui/hooks.dart:33)
04-26 15:09:49.488 13249 13273 I flutter : scheduleForcedFrame() called. Current phase is SchedulerPhase.idle.
04-26 15:09:49.488 13249 13273 I flutter : #0      debugPrintStack (package:flutter/src/foundation/assertions.dart:1196)
04-26 15:09:49.488 13249 13273 I flutter : #1      SchedulerBinding.scheduleForcedFrame (package:flutter/src/scheduler/binding.dart:819)
04-26 15:09:49.488 13249 13273 I flutter : #2      RendererBinding.handleMetricsChanged (package:flutter/src/rendering/binding.dart:241)
04-26 15:09:49.488 13249 13273 I flutter : #3      WidgetsBinding.handleMetricsChanged (package:flutter/src/widgets/binding.dart:568)
04-26 15:09:49.488 13249 13273 I flutter : #4      _invoke (dart:ui/hooks.dart:148)
04-26 15:09:49.488 13249 13273 I flutter : #5      PlatformDispatcher._updateWindowMetrics (dart:ui/platform_dispatcher.dart:246)
04-26 15:09:49.489 13249 13273 I flutter : #6      _updateWindowMetrics (dart:ui/hooks.dart:33)
04-26 15:09:49.604   901   953 I ActivityTaskManager: Displayed com.google.android.flutter.samples.helloflutter/.MainActivity: +612ms

On Android.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@dnfield
Copy link
Contributor Author

dnfield commented Apr 26, 2022

@zanderso FYI - since it seems like b63c4a6 is not currently part of any branch but master I am not filing a CP request. However, if b63c4a6 makes its way into a CP, we should also CP this change.

@zanderso
Copy link
Member

zanderso commented Apr 26, 2022

Yes, it was in a CP: #102193, so we'll need a CP for this as well.

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@dnfield
Copy link
Contributor Author

dnfield commented Apr 26, 2022

Filed #102583

engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 27, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 28, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Apr 28, 2022
egramond pushed a commit to egramond/flutter that referenced this pull request May 5, 2022
muditatandon pushed a commit to muditatandon/flutter that referenced this pull request May 5, 2022
muditatandon added a commit that referenced this pull request May 5, 2022
…103101)

* Add the new hash

* [flutter.js] Wait for reg.update, then activate sw (if not active yet). (#101464)

* Avoid scheduling a forced frame when there is no child to the renderView (#102556)

* Migrate AppBar to Material 3 (#101884)

* Keeping the super parameters

* Fixing semi-colon issue

Co-authored-by: David Iglesias <[email protected]>
Co-authored-by: Dan Field <[email protected]>
Co-authored-by: Darren Austin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants