Skip to content

Commit

Permalink
[flutter_releases] Flutter stable 2.8.1 Engine Cherrypicks (#30355)
Browse files Browse the repository at this point in the history
* 'Update Dart SDK to 1278bd5'

* Update cirrus secret.

* [iOS] Destroy the engine prior to application termination. (#29295)

* Update licenses hash.

* Update shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm

Co-authored-by: Jenn Magder <magder@google.com>

Co-authored-by: Wu Zhong <zhongwuzw@qq.com>
Co-authored-by: Jenn Magder <magder@google.com>
  • Loading branch information
3 people authored Dec 16, 2021
1 parent 40a99c5 commit 890a5fc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gcp_credentials: ENCRYPTED[!48cff44dd32e9cc412d4d381c7fe68d373ca04cf2639f8192d21cb1a9ab5e21129651423a1cf88f3fd7fe2125c1cabd9!]
gcp_credentials: ENCRYPTED[!cc769765170bebc37e0556e2da5915ca64ee37f4ec8c966ec147e2f59578b476c99e457eafce4e2f8b1a4e305f7096b8!]

# LINUX
task:
Expand Down
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '3d2629cd0310df74bdf260d828ed3c75f25db889',
'dart_revision': '1278bd5adb6a857580f137e47bc521976222f7b9',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/licenses_third_party
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: fbed5705076e0a8ed5942eaed257e0bc
Signature: a92ff326020b0e5d29148bd8e830fb6c

UNUSED LICENSES:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ - (void)setupNotificationCenterObservers {
name:UIApplicationWillResignActiveNotification
object:nil];

[center addObserver:self
selector:@selector(applicationWillTerminate:)
name:UIApplicationWillTerminateNotification
object:nil];

[center addObserver:self
selector:@selector(applicationDidEnterBackground:)
name:UIApplicationDidEnterBackgroundNotification
Expand Down Expand Up @@ -790,6 +795,11 @@ - (void)applicationWillResignActive:(NSNotification*)notification {
[self goToApplicationLifecycle:@"AppLifecycleState.inactive"];
}

- (void)applicationWillTerminate:(NSNotification*)notification {
[self goToApplicationLifecycle:@"AppLifecycleState.detached"];
[self.engine destroyContext];
}

- (void)applicationDidEnterBackground:(NSNotification*)notification {
TRACE_EVENT0("flutter", "applicationDidEnterBackground");
[self surfaceUpdated:NO];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ - (void)handlePressEvent:(FlutterUIPressProxy*)press
- (void)scrollEvent:(UIPanGestureRecognizer*)recognizer;
- (void)updateViewportMetrics;
- (void)onUserSettingsChanged:(NSNotification*)notification;
- (void)applicationWillTerminate:(NSNotification*)notification;
- (void)goToApplicationLifecycle:(nonnull NSString*)state;
@end

@interface FlutterViewControllerTest : XCTestCase
Expand Down Expand Up @@ -167,6 +169,20 @@ - (void)testViewDidDisappearDoesntPauseEngineWhenNotTheViewController {
OCMReject([viewControllerMock surfaceUpdated:[OCMArg any]]);
}

- (void)testAppWillTerminateViewDidDestroyTheEngine {
FlutterEngine* mockEngine = OCMPartialMock([[FlutterEngine alloc] init]);
[mockEngine createShell:@"" libraryURI:@"" initialRoute:nil];
FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:mockEngine
nibName:nil
bundle:nil];
id viewControllerMock = OCMPartialMock(viewController);
OCMStub([viewControllerMock goToApplicationLifecycle:@"AppLifecycleState.detached"]);
OCMStub([mockEngine destroyContext]);
[viewController applicationWillTerminate:nil];
OCMVerify([viewControllerMock goToApplicationLifecycle:@"AppLifecycleState.detached"]);
OCMVerify([mockEngine destroyContext]);
}

- (void)testViewDidDisappearDoesPauseEngineWhenIsTheViewController {
id lifecycleChannel = OCMClassMock([FlutterBasicMessageChannel class]);
FlutterEnginePartialMock* mockEngine = [[FlutterEnginePartialMock alloc] init];
Expand Down

0 comments on commit 890a5fc

Please sign in to comment.