@@ -155,18 +155,13 @@ - (instancetype)initWithName:(NSString*)labelPrefix
155155 object: nil ];
156156
157157 [center addObserver: self
158- selector: @selector (applicationDidEnterBackground: )
159- name: UIApplicationDidEnterBackgroundNotification
160- object: nil ];
161-
162- [center addObserver: self
163- selector: @selector (applicationBecameActive: )
164- name: UIApplicationDidBecomeActiveNotification
158+ selector: @selector (applicationWillEnterForeground: )
159+ name: UIApplicationWillEnterForegroundNotification
165160 object: nil ];
166161
167162 [center addObserver: self
168- selector: @selector (applicationWillResignActive : )
169- name: UIApplicationWillResignActiveNotification
163+ selector: @selector (applicationDidEnterBackground : )
164+ name: UIApplicationDidEnterBackgroundNotification
170165 object: nil ];
171166
172167 [center addObserver: self
@@ -610,7 +605,8 @@ - (BOOL)createShell:(NSString*)entrypoint
610605 _threadHost->io_thread ->GetTaskRunner () // io
611606 );
612607
613- _isGpuDisabled = [UIApplication sharedApplication ].applicationState != UIApplicationStateActive;
608+ _isGpuDisabled =
609+ [UIApplication sharedApplication ].applicationState == UIApplicationStateBackground;
614610 // Create the shell. This is a blocking operation.
615611 std::unique_ptr<flutter::Shell> shell = flutter::Shell::Create (
616612 /* platform_data=*/ std::move (platformData),
@@ -886,15 +882,12 @@ - (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey {
886882
887883#pragma mark - Notifications
888884
889- - (void )applicationBecameActive : (NSNotification *)notification {
885+ - (void )applicationWillEnterForeground : (NSNotification *)notification {
890886 [self setIsGpuDisabled: NO ];
891887}
892888
893- - (void )applicationWillResignActive : (NSNotification *)notification {
894- [self setIsGpuDisabled: YES ];
895- }
896-
897889- (void )applicationDidEnterBackground : (NSNotification *)notification {
890+ [self setIsGpuDisabled: YES ];
898891 [self notifyLowMemory ];
899892}
900893
0 commit comments