From 50c82c816b12fd235903f016b86a3041fd05cd2f Mon Sep 17 00:00:00 2001 From: stupidfive Date: Tue, 14 May 2019 02:29:05 +0800 Subject: [PATCH] Terminate debug background task on expiry (flutter/engine#8930) When backgrounding an app in debug mode, we make a request for additional background time for the app with a background task. This prevents us from losing the devfs session used for hot reload. In the case where the app is backgrounded beyond the additional time provided by iOS, it's required that we end the background task or the app will be terminated by the OS. We previously ended the background task only on foregrounding, but failed to do so on expiry of the task. --- .../ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm index 99f3ff7fab..054e8b5556 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm @@ -94,6 +94,7 @@ static BOOL isPowerOfTwo(NSUInteger x) { _debugBackgroundTask = [application beginBackgroundTaskWithName:@"Flutter debug task" expirationHandler:^{ + [application endBackgroundTask:_debugBackgroundTask]; FML_LOG(WARNING) << "\nThe OS has terminated the Flutter debug connection for being " "inactive in the background for too long.\n\n"