From: Heeyong Song Date: Fri, 17 May 2019 05:48:00 +0000 (+0900) Subject: Pause adaptor when the window is hidden while initailizing X-Git-Tag: dali_1.4.22~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=5808300699a6948cd7e4dd6c4d277766aea3c262 Pause adaptor when the window is hidden while initailizing Change-Id: Iad1329258de520a333380bd89a36f568a2e35b28 --- diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 5ddb445..6bce4d5 100755 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -836,7 +836,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; @@ -848,13 +848,13 @@ 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 ) { bool allWindowsHidden = true; @@ -868,17 +868,29 @@ void Adaptor::OnWindowHidden() } // Only pause the adaptor when all the windows are hidden - if ( allWindowsHidden ) + if( allWindowsHidden ) { - Pause(); + if( mState == RUNNING ) + { + Pause(); - // Adaptor cannot be resumed until any window is shown - mState = PAUSED_WHILE_HIDDEN; + // Adaptor cannot be resumed until any 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: Some windows are shown. Don't pause adaptor.\n" ); } } 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 ); } } @@ -920,9 +932,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; + + Pause(); - DALI_LOG_RELEASE_INFO( "Adaptor::NotifySceneCreated\n" ); + 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 edd2e40..29bb7d5 100755 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -616,11 +616,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. }; using SceneHolderPtr = IntrusivePtr< Dali::Internal::Adaptor::SceneHolder >;