This reverts commit d372814f78.
This commit is contained in:
@@ -335,13 +335,19 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
||||
_setFramesEnabledState(true);
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
case AppLifecycleState.detached:
|
||||
_setFramesEnabledState(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> _handleLifecycleMessage(String message) async {
|
||||
// TODO(chunhtai): remove the workaround once the issue is fixed
|
||||
// https://github.com/flutter/flutter/issues/39832
|
||||
if (message == 'AppLifecycleState.detached')
|
||||
return null;
|
||||
|
||||
handleAppLifecycleStateChanged(_parseAppLifecycleMessage(message));
|
||||
return null;
|
||||
}
|
||||
@@ -354,8 +360,6 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
||||
return AppLifecycleState.resumed;
|
||||
case 'AppLifecycleState.inactive':
|
||||
return AppLifecycleState.inactive;
|
||||
case 'AppLifecycleState.detached':
|
||||
return AppLifecycleState.detached;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -807,11 +811,6 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
|
||||
/// Consider using [scheduleWarmUpFrame] instead if the goal is to update the
|
||||
/// rendering as soon as possible (e.g. at application startup).
|
||||
void scheduleForcedFrame() {
|
||||
// TODO(chunhtai): Removes the if case once the issue is fixed
|
||||
// https://github.com/flutter/flutter/issues/45131
|
||||
if (!_framesEnabled)
|
||||
return;
|
||||
|
||||
if (_hasScheduledFrame)
|
||||
return;
|
||||
assert(() {
|
||||
|
||||
@@ -68,9 +68,13 @@ void main() {
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
|
||||
expect(observer.lifecycleState, AppLifecycleState.inactive);
|
||||
|
||||
|
||||
message = const StringCodec().encodeMessage('AppLifecycleState.detached');
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
|
||||
expect(observer.lifecycleState, AppLifecycleState.detached);
|
||||
// TODO(chunhtai): this should be detached once the issue is fixed
|
||||
// https://github.com/flutter/flutter/issues/39832
|
||||
// The binding drops detached message for now.
|
||||
expect(observer.lifecycleState, AppLifecycleState.inactive);
|
||||
});
|
||||
|
||||
testWidgets('didPushRoute callback', (WidgetTester tester) async {
|
||||
@@ -105,16 +109,6 @@ void main() {
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
|
||||
message = const StringCodec().encodeMessage('AppLifecycleState.detached');
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
|
||||
message = const StringCodec().encodeMessage('AppLifecycleState.inactive');
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
|
||||
expect(tester.binding.hasScheduledFrame, isTrue);
|
||||
await tester.pump();
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
|
||||
message = const StringCodec().encodeMessage('AppLifecycleState.paused');
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
@@ -122,9 +116,9 @@ void main() {
|
||||
tester.binding.scheduleFrame();
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
|
||||
// TODO(chunhtai): fix this test after workaround is removed
|
||||
// https://github.com/flutter/flutter/issues/45131
|
||||
tester.binding.scheduleForcedFrame();
|
||||
expect(tester.binding.hasScheduledFrame, isTrue);
|
||||
await tester.pump();
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
|
||||
int frameCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user