Keep rendering to screen in iOS inactive state (flutter/engine#25196)
Co-authored-by: Aaron Clarke <gaaclarke>
This commit is contained in:
@@ -154,21 +154,16 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
|
||||
name:UIApplicationDidReceiveMemoryWarningNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(applicationWillEnterForeground:)
|
||||
name:UIApplicationWillEnterForegroundNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(applicationDidEnterBackground:)
|
||||
name:UIApplicationDidEnterBackgroundNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(applicationBecameActive:)
|
||||
name:UIApplicationDidBecomeActiveNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(applicationWillResignActive:)
|
||||
name:UIApplicationWillResignActiveNotification
|
||||
object:nil];
|
||||
|
||||
[center addObserver:self
|
||||
selector:@selector(onLocaleUpdated:)
|
||||
name:NSCurrentLocaleDidChangeNotification
|
||||
@@ -610,7 +605,8 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS
|
||||
_threadHost->io_thread->GetTaskRunner() // io
|
||||
);
|
||||
|
||||
_isGpuDisabled = [UIApplication sharedApplication].applicationState != UIApplicationStateActive;
|
||||
_isGpuDisabled =
|
||||
[UIApplication sharedApplication].applicationState == UIApplicationStateBackground;
|
||||
// Create the shell. This is a blocking operation.
|
||||
std::unique_ptr<flutter::Shell> shell = flutter::Shell::Create(
|
||||
/*platform_data=*/std::move(platformData),
|
||||
@@ -886,15 +882,12 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS
|
||||
|
||||
#pragma mark - Notifications
|
||||
|
||||
- (void)applicationBecameActive:(NSNotification*)notification {
|
||||
- (void)applicationWillEnterForeground:(NSNotification*)notification {
|
||||
[self setIsGpuDisabled:NO];
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification*)notification {
|
||||
[self setIsGpuDisabled:YES];
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(NSNotification*)notification {
|
||||
[self setIsGpuDisabled:YES];
|
||||
[self notifyLowMemory];
|
||||
}
|
||||
|
||||
|
||||
@@ -743,12 +743,12 @@ static void sendFakeTouchEvent(FlutterEngine* engine,
|
||||
|
||||
- (void)applicationWillResignActive:(NSNotification*)notification {
|
||||
TRACE_EVENT0("flutter", "applicationWillResignActive");
|
||||
[self surfaceUpdated:NO];
|
||||
[self goToApplicationLifecycle:@"AppLifecycleState.inactive"];
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(NSNotification*)notification {
|
||||
TRACE_EVENT0("flutter", "applicationDidEnterBackground");
|
||||
[self surfaceUpdated:NO];
|
||||
[self goToApplicationLifecycle:@"AppLifecycleState.paused"];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user