Repository navigation
Stop pumping frames in applicationWillResignActive - #7450
Conversation
According to Apple's OpenGL ES Programming guide [1], applications should pause any animations in applicationWillResignActive. Any GL calls after applicationDidEnterBackground will cause the app to be terminated immedidately by iOS. The surfaceUpdated:YES call is moved to the handler for the applicationDidBecomeActive notification to handle cases where the application becomes inactive then active again without being backgrounded (e.g. home button double-tap then return to app directly). [1] https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ImplementingaMultitasking-awareOpenGLESApplication/ImplementingaMultitasking-awareOpenGLESApplication.html#//apple_ref/doc/uid/TP40008793-CH5-SW1
|
Attempt at fixing flutter/flutter#14178, though I haven't been able to repro locally. |
|
|
||
| - (void)applicationDidEnterBackground:(NSNotification*)notification { | ||
| TRACE_EVENT0("flutter", "applicationDidEnterBackground"); | ||
| [self surfaceUpdated:NO]; |
There was a problem hiding this comment.
Wow, I was sure we did some tweaks in the past to make sure it's not this late.
There was a problem hiding this comment.
We did changes on the framework side, but that's async.
|
|
||
| - (void)applicationWillEnterForeground:(NSNotification*)notification { | ||
| TRACE_EVENT0("flutter", "applicationWillEnterForeground"); | ||
| if (_viewportMetrics.physical_width) |
There was a problem hiding this comment.
This may cause some jank when coming back.
There was a problem hiding this comment.
Never mind. The bug I was thinking of was on the VC level, not application level
|
I don't have a strong opinion on the way back.
The doc doesn't sound so strict on the way back. If you tested it and it doesn't look janky, LGTM. |
|
Thanks. |
flutter-team-archive/engine@abbc34e...17a90fb git log abbc34e..17a90fb --no-merges --oneline 17a90fb Roll src/third_party/skia 3395f00ef6ee..60a2f675ddce (1 commits) (flutter-team-archive/engine#7458) 3ee3035 Roll src/third_party/skia 160422338c10..3395f00ef6ee (1 commits) (flutter-team-archive/engine#7457) 426e342 Roll src/third_party/skia 9a97c96c9c3a..160422338c10 (1 commits) (flutter-team-archive/engine#7456) 2aa95d3 Roll src/third_party/skia 2ee498c6749a..9a97c96c9c3a (1 commits) (flutter-team-archive/engine#7455) d1d8b4d Stop pumping frames in applicationWillResignActive (flutter-team-archive/engine#7450) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff ([email protected]), and stop the roller if necessary.
flutter-team-archive/engine@abbc34e...17a90fb git log abbc34e..17a90fb --no-merges --oneline 17a90fb Roll src/third_party/skia 3395f00ef6ee..60a2f675ddce (1 commits) (flutter-team-archive/engine#7458) 3ee3035 Roll src/third_party/skia 160422338c10..3395f00ef6ee (1 commits) (flutter-team-archive/engine#7457) 426e342 Roll src/third_party/skia 9a97c96c9c3a..160422338c10 (1 commits) (flutter-team-archive/engine#7456) 2aa95d3 Roll src/third_party/skia 2ee498c6749a..9a97c96c9c3a (1 commits) (flutter-team-archive/engine#7455) d1d8b4d Stop pumping frames in applicationWillResignActive (flutter-team-archive/engine#7450) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff ([email protected]), and stop the roller if necessary.
According to Apple's OpenGL ES Programming guide, applications
should pause any animations in applicationWillResignActive. Any GL calls
after applicationDidEnterBackground will cause the app to be terminated
immedidately by iOS.
The surfaceUpdated:YES call is moved to the handler for the
applicationDidBecomeActive notification to handle cases where the
application becomes inactive then active again without being
backgrounded (e.g. home button double-tap then return to app directly).