-
Notifications
You must be signed in to change notification settings - Fork 6k
Don't pause Animator when lifecycle state paused #30969
Don't pause Animator when lifecycle state paused #30969
Conversation
a6959b1 to
963bad7
Compare
963bad7 to
61683c2
Compare
|
This seems like it means we'll call |
@dnfield void handleAppLifecycleStateChanged(AppLifecycleState state) {
assert(state != null);
_lifecycleState = state;
switch (state) {
case AppLifecycleState.resumed:
case AppLifecycleState.inactive:
_setFramesEnabledState(true);
break;
case AppLifecycleState.paused:
case AppLifecycleState.detached:
_setFramesEnabledState(false);
break;
}
}Therefore, after the App enters the background, void scheduleFrame() {
if (_hasScheduledFrame || !framesEnabled)
return;This PR is mainly to allow void scheduleForcedFrame() {
// TODO(chunhtai): Removes the if case once the issue is fixed
// https://github.com/flutter/flutter/issues/45131
if (!framesEnabled)
return;Simplifying the logic of |
|
I'm a big fan of this in that case. I'd appreciate input from @chinmaygarde and @iskakaushik (and of course @gaaclarke and @chunhtai if they have any input) |
| engine->OnOutputSurfaceCreated(); | ||
| // this implies we can re-use the last | ||
| // frame to trigger begin frame rather | ||
| // than re-generating the layer tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this since the framework ought to handle frame scheduling now. If it is redundant, we can get rid of the RunNowOrPostTask call completely. We can do this in a later patch if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(@ColdPaleLight feel free to add the waiting for tree to go green label if you think this is good to go, I'm holding off on adding it in case you plan to address this now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this in a later patch.
Fix issue:
flutter/flutter#45131
flutter/flutter#91717
Detail: flutter/flutter#45131 (comment)
Pre-launch Checklist
writing and running engine tests.
///).