@@ -50,8 +50,6 @@ Engine::Engine(
5050 settings_ (std::move(settings)),
5151 animator_(std::move(animator)),
5252 runtime_controller_(std::move(runtime_controller)),
53- activity_running_(true ),
54- have_surface_(false ),
5553 font_collection_(font_collection),
5654 image_decoder_(task_runners, image_decoder_task_runner, io_manager),
5755 task_runners_(std::move(task_runners)),
@@ -280,30 +278,11 @@ tonic::DartErrorHandleType Engine::GetUIIsolateLastError() {
280278 return runtime_controller_->GetLastError ();
281279}
282280
283- void Engine::OnOutputSurfaceCreated () {
284- have_surface_ = true ;
285- ScheduleFrame ();
286- }
287-
288- void Engine::OnOutputSurfaceDestroyed () {
289- have_surface_ = false ;
290- StopAnimator ();
291- }
292-
293281void Engine::SetViewportMetrics (const ViewportMetrics& metrics) {
294- bool dimensions_changed =
295- viewport_metrics_.physical_height != metrics.physical_height ||
296- viewport_metrics_.physical_width != metrics.physical_width ||
297- viewport_metrics_.device_pixel_ratio != metrics.device_pixel_ratio ;
298282 viewport_metrics_ = metrics;
299283 runtime_controller_->SetViewportMetrics (viewport_metrics_);
300284 if (animator_) {
301- if (dimensions_changed) {
302- animator_->SetDimensionChangePending ();
303- }
304- if (have_surface_) {
305- ScheduleFrame ();
306- }
285+ ScheduleFrame ();
307286 }
308287}
309288
@@ -339,20 +318,12 @@ bool Engine::HandleLifecyclePlatformMessage(PlatformMessage* message) {
339318 const auto & data = message->data ();
340319 std::string state (reinterpret_cast <const char *>(data.GetMapping ()),
341320 data.GetSize ());
342- if (state == " AppLifecycleState.paused" ||
343- state == " AppLifecycleState.detached" ) {
344- activity_running_ = false ;
345- StopAnimator ();
346- } else if (state == " AppLifecycleState.resumed" ||
347- state == " AppLifecycleState.inactive" ) {
348- activity_running_ = true ;
349- StartAnimatorIfPossible ();
350- }
351321
352322 // Always schedule a frame when the app does become active as per API
353323 // recommendation
354324 // https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622956-applicationdidbecomeactive?language=objc
355- if (state == " AppLifecycleState.resumed" && have_surface_) {
325+ if (state == " AppLifecycleState.resumed" ||
326+ state == " AppLifecycleState.inactive" ) {
356327 ScheduleFrame ();
357328 }
358329 runtime_controller_->SetLifecycleState (state);
@@ -455,16 +426,6 @@ void Engine::SetAccessibilityFeatures(int32_t flags) {
455426 runtime_controller_->SetAccessibilityFeatures (flags);
456427}
457428
458- void Engine::StopAnimator () {
459- animator_->Stop ();
460- }
461-
462- void Engine::StartAnimatorIfPossible () {
463- if (activity_running_ && have_surface_) {
464- animator_->Start ();
465- }
466- }
467-
468429std::string Engine::DefaultRouteName () {
469430 if (!initial_route_.empty ()) {
470431 return initial_route_;
@@ -473,7 +434,6 @@ std::string Engine::DefaultRouteName() {
473434}
474435
475436void Engine::ScheduleFrame (bool regenerate_layer_tree) {
476- StartAnimatorIfPossible ();
477437 animator_->RequestFrame (regenerate_layer_tree);
478438}
479439
0 commit comments