mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Stop pumping frames in applicationWillResignActive (#7450)
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
This commit is contained in:
parent
abbc34e148
commit
d1d8b4d416
@ -436,24 +436,24 @@
|
||||
|
||||
- (void)applicationBecameActive:(NSNotification*)notification {
|
||||
TRACE_EVENT0("flutter", "applicationBecameActive");
|
||||
if (_viewportMetrics.physical_width)
|
||||
[self surfaceUpdated:YES];
|
||||
[[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"];
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification*)notification {
|
||||
TRACE_EVENT0("flutter", "applicationWillResignActive");
|
||||
[self surfaceUpdated:NO];
|
||||
[[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"];
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(NSNotification*)notification {
|
||||
TRACE_EVENT0("flutter", "applicationDidEnterBackground");
|
||||
[self surfaceUpdated:NO];
|
||||
[[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"];
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(NSNotification*)notification {
|
||||
TRACE_EVENT0("flutter", "applicationWillEnterForeground");
|
||||
if (_viewportMetrics.physical_width)
|
||||
[self surfaceUpdated:YES];
|
||||
[[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"];
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user