From: tscholb Date: Fri, 23 May 2025 04:16:50 +0000 (+0900) Subject: Relaunch widget when widget_instance_launch is failed X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_7.0;p=platform%2Fcore%2Fuifw%2Fwidget-viewer-dali.git Relaunch widget when widget_instance_launch is failed Change-Id: Id6ff25f5df2b6203c62261c117c7d706f5362085 --- diff --git a/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp b/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp index 5058b77..dc30975 100644 --- a/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp +++ b/widget_viewer_dali/internal/widget_view/widget_view_impl.cpp @@ -73,6 +73,9 @@ namespace const int DEFAULT_FONT_PIXEL_SIZE = 30; // Referred platform widget viewer evas +const int RELAUNCH_COUNT_MAX = 3; +const int RELAUNCH_TIME = 500; + #define GET_LOCALE_TEXT(string) dgettext(PKGNAME, string) #if defined(DEBUG_ENABLED) @@ -245,7 +248,8 @@ WidgetView::WidgetView() mPreviewEnable( true ), mIsReadyToRender(false), mCornerRadius(Vector4::ZERO), - mCornerRadiusPolicy(1.0f) + mCornerRadiusPolicy(1.0f), + mRelaunchTryCount(0) { } @@ -274,7 +278,8 @@ WidgetView::WidgetView( const std::string& widgetId, const std::string& contentI mPreviewEnable( true ), mIsReadyToRender(false), mCornerRadius(Vector4::ZERO), - mCornerRadiusPolicy(1.0f) + mCornerRadiusPolicy(1.0f), + mRelaunchTryCount(0) { } @@ -1506,6 +1511,13 @@ void WidgetView::CloseRemoteSurface() mWatcherHandle = NULL; mRemoteSurface = NULL; mPid = -1; + + mRelaunchTryCount = 0; + if(mRelaunchTimer) + { + mRelaunchTimer.Stop(); + mRelaunchTimer.Reset(); + } } } @@ -1921,6 +1933,18 @@ bool WidgetView::LaunchWidget() mPid = widget_instance_launch( mInstanceId.c_str(), (char *)mContentInfo.c_str(), mWidth, mHeight ); if( mPid < 0) { + if(!mRelaunchTimer) + { + // Delete WidgetVisual for relaunch widget + mResizeRequired = true; + RemoveWidgetRenderer(); + CloseRemoteSurface(); + + mRelaunchTimer = Timer::New(RELAUNCH_TIME); + mRelaunchTimer.TickSignal().Connect(this, &WidgetView::OnRelaunch); + mRelaunchTimer.Start(); + } + ShowLoadingState( false ); ShowRetryState( true ); @@ -2085,6 +2109,31 @@ void WidgetView::OnSizeAnimation( Animation& animation, const Vector3& targetSiz widget_instance_resize(mInstanceId.c_str(), targetSize.x, targetSize.y); } +bool WidgetView::OnRelaunch() +{ + DALI_LOG_RELEASE_INFO("OnRelaunch: Try WidgetView Relaunch [%s] [%p]\n", mWidgetId.c_str(), this ); + + mPid = widget_instance_launch( mInstanceId.c_str(), (char *)mContentInfo.c_str(), mWidth, mHeight ); + if(mPid < 0 && mRelaunchTryCount <= RELAUNCH_COUNT_MAX ) + { + DALI_LOG_RELEASE_INFO("OnRelaunch: widget_instance_launch is failed. try again(%d/%d) [%s] [%p]\n", mRelaunchTryCount, RELAUNCH_COUNT_MAX, mWidgetId.c_str(), this ); + mRelaunchTryCount ++; + return true; + } + + if(mPid >= 0) + { + + DALI_LOG_RELEASE_INFO("OnRelaunch: widget_instance_launch is succesed. [%s] [%p]\n", mWidgetId.c_str(), this ); + } + + // Reset Relaunch Data + mRelaunchTryCount = 0; + mRelaunchTimer.Stop(); + mRelaunchTimer.Reset(); + return false; +} + WidgetView::WidgetViewAccessible::WidgetViewAccessible(Dali::Actor self) : ControlAccessible(self) { diff --git a/widget_viewer_dali/internal/widget_view/widget_view_impl.h b/widget_viewer_dali/internal/widget_view/widget_view_impl.h index af11b96..4837dd5 100644 --- a/widget_viewer_dali/internal/widget_view/widget_view_impl.h +++ b/widget_viewer_dali/internal/widget_view/widget_view_impl.h @@ -34,8 +34,10 @@ #include #include #include +#include #include + namespace Dali { @@ -480,6 +482,11 @@ private: */ void OnUpdateArea( Dali::PropertyNotification& source ); + /** + * @brief Callback when widgetview need to relaunch + */ + bool OnRelaunch(); + // Undefined WidgetView( const WidgetView& ); @@ -556,6 +563,10 @@ private: Vector4 mCornerRadius; /// < Corner radius float mCornerRadiusPolicy; /// < Corner radius policy + // For re-launch widgetviewer + Dali::Timer mRelaunchTimer; + int mRelaunchTryCount; + // Notification for property change confirmation Dali::PropertyNotification mPositionUpdateNotification; Dali::PropertyNotification mSizeUpdateNotification;