From 3c63b0c4226db79784b86b625bf24d00341a3ae2 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 17 May 2019 14:48:00 +0900 Subject: [PATCH] [5.0] Pause adaptor when the window is hidden while initailizing Change-Id: Iad1329258de520a333380bd89a36f568a2e35b28 --- dali/internal/adaptor/common/adaptor-impl.cpp | 41 ++++++++++++++++++++------- dali/internal/adaptor/common/adaptor-impl.h | 11 +++---- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 0ee7e43..959f6f5 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -877,7 +877,7 @@ void Adaptor::RequestProcessEventsOnIdle( bool forceProcess ) void Adaptor::OnWindowShown() { - if ( PAUSED_WHILE_HIDDEN == mState ) + if( PAUSED_WHILE_HIDDEN == mState ) { // Adaptor can now be resumed mState = PAUSED; @@ -889,22 +889,30 @@ void Adaptor::OnWindowShown() } else { - DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: Not shown [%d]\n", mState ); + DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowShown: Adaptor is not paused state.[%d]\n", mState ); } } void Adaptor::OnWindowHidden() { - if ( RUNNING == mState ) + if( RUNNING == mState || READY == mState ) { - Pause(); + if( mState == RUNNING ) + { + Pause(); - // Adaptor cannot be resumed until the window is shown - mState = PAUSED_WHILE_HIDDEN; + // Adaptor cannot be resumed until the window is shown + mState = PAUSED_WHILE_HIDDEN; + } + else // mState is READY + { + // Pause the adaptor after the state gets RUNNING + mState = PAUSED_WHILE_INITIALIZING; + } } else { - DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowHidden: Not hidden [%d]\n", mState ); + DALI_LOG_RELEASE_INFO( "Adaptor::OnWindowHidden: Adaptor is not running state.[%d]\n", mState ); } } @@ -942,9 +950,22 @@ void Adaptor::NotifySceneCreated() // Process after surface is created (registering to remote surface provider if required) SurfaceInitialized(); - mState = RUNNING; + if( mState != PAUSED_WHILE_INITIALIZING ) + { + mState = RUNNING; + + DALI_LOG_RELEASE_INFO( "Adaptor::NotifySceneCreated: Adaptor is running\n" ); + } + else + { + mState = RUNNING; - DALI_LOG_RELEASE_INFO( "Adaptor::NotifySceneCreated\n" ); + Pause(); + + mState = PAUSED_WHILE_HIDDEN; + + DALI_LOG_RELEASE_INFO( "Adaptor::NotifySceneCreated: Adaptor is paused\n" ); + } } void Adaptor::NotifyLanguageChanged() diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 26c3bb7..1d1754a 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -632,11 +632,12 @@ private: // Types enum State { - READY, ///< Initial state before Adaptor::Start is called. - RUNNING, ///< Adaptor is running. - PAUSED, ///< Adaptor has been paused. - PAUSED_WHILE_HIDDEN, ///< Adaptor is paused while window is hidden (& cannot be resumed until window is shown). - STOPPED, ///< Adaptor has been stopped. + READY, ///< Initial state before Adaptor::Start is called. + RUNNING, ///< Adaptor is running. + PAUSED, ///< Adaptor has been paused. + PAUSED_WHILE_HIDDEN, ///< Adaptor is paused while window is hidden (& cannot be resumed until window is shown). + PAUSED_WHILE_INITIALIZING, ///< Adaptor is paused while application is initializing. + STOPPED, ///< Adaptor has been stopped. }; // A structure to encapsulate each Window instance for the Adaptor to track them -- 2.7.4