Update wrt_0.8.86
authorjihoon.chung <jihoon.chung@samsung.com>
Thu, 23 Aug 2012 23:26:17 +0000 (08:26 +0900)
committerjihoon.chung <jihoon.chung@samsung.com>
Thu, 23 Aug 2012 23:26:17 +0000 (08:26 +0900)
25 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt
data/default_icon_tizen.png [new file with mode: 0644]
data/default_icon_wac.png [moved from data/wrt_widget_default_icon.png with 100% similarity]
debian/changelog
packaging/wrt.spec
src/CMakeLists.txt
src/api_new/CMakeLists.txt
src/api_new/core_module.cpp
src/api_new/core_module.h
src/api_new/i_runnable_widget_object.h
src/api_new/runnable_widget_object.cpp
src/api_new/runnable_widget_object.h
src/view/common/CMakeLists.txt
src/view/common/application_launcher.cpp
src/view/common/view_logic_apps_support.cpp
src/view/common/window_data.cpp
src/view/common/window_data.h
src/view/i_view_module.h
src/view/webkit/view_logic.cpp
src/view/webkit/view_logic.h
src/wrt-client/wrt-client.cpp
src/wrt-client/wrt-client.h
src/wrt-launcher/CMakeLists.txt [changed mode: 0755->0644]
src/wrt-launcher/wrt-launcher.cpp

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..8eaac43
--- /dev/null
@@ -0,0 +1,42 @@
+build_log
+*.log
+*.pyc
+usr
+opt
+*.o
+*.os
+*.exe
+packages
+binaries
+*.ipk
+*~
+*.lo
+.libs
+.deps
+*.la
+Makefile.in
+Makefile
+Documentation/html/
+build-stamp
+*.cmake
+CMakeFiles
+CMakeCache.txt
+data/*.edj
+cmake_build_tmp/
+.cproject
+.project
+debian/files
+debian/tmp/
+debian/wrt/*
+debian/wrt.debhelper.log
+debian/wrt.install
+debian/wrt.postinst
+debian/wrt.postinst.debhelper
+debian/wrt.postrm.debhelper
+debian/wrt.substvars
+debian/wrt-dbg/
+debian/wrt-dbg.substvars
+debian/wrt-test/
+debian/wrt-test.debhelper.log
+debian/wrt-test.substvars
+
index ab2fab2..8013b07 100644 (file)
@@ -146,7 +146,10 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/parental.png
     DESTINATION /usr/etc/wrt/
     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE
     )
-INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/wrt_widget_default_icon.png
+INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/default_icon_tizen.png
+    DESTINATION share/wrt-engine/
+    )
+INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/default_icon_wac.png
     DESTINATION share/wrt-engine/
     )
 INSTALL(FILES   ${CMAKE_SOURCE_DIR}/data/userAgentProfile.xml
diff --git a/data/default_icon_tizen.png b/data/default_icon_tizen.png
new file mode 100644 (file)
index 0000000..1c3ecd6
Binary files /dev/null and b/data/default_icon_tizen.png differ
index 8b454b1..efd71b9 100644 (file)
@@ -1,3 +1,18 @@
+wrt (0.8.86) unstable; urgency=low
+
+  * [Engine] Splash screen code separated
+  * [Engine] Replace Legacy API to Managed API (#1, aul to capi-appfw-application)
+  * [Engine] Add default icon for tizen
+  * [Engine] Change orientation argument
+  * [Engine] Move checkWACTestCertifiedWidget() to wrt-client side
+  * [Engine] Move localizeWidgetModel() to wrt-client side
+  * [Engine] Move debug settings to wrt-client
+
+  * Git : slp/pkgs/w/wrt
+  * Tag : wrt_0.8.86
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Thu, 23 Aug 2012 16:24:06 +0900
+
 wrt (0.8.85) unstable; urgency=low
 
   * [Engine] WRT API, Widget Controlller and Logic removed
index 6898f5d..7ba425c 100644 (file)
@@ -1,7 +1,7 @@
-#sbs-git:slp/pkgs/w/wrt wrt 0.8.85
+#sbs-git:slp/pkgs/w/wrt wrt 0.8.86
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.85
+Version:    0.8.86
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -36,7 +36,9 @@ BuildRequires:  pkgconfig(libsoup-2.4)
 BuildRequires:  pkgconfig(ace-client)
 BuildRequires:  pkgconfig(notification)
 BuildRequires:  pkgconfig(libprivilege-control)
+BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(capi-system-haptic)
+BuildRequires:  pkgconfig(capi-web-url-download)
 BuildRequires:  pkgconfig(wrt-plugin-loading)
 BuildRequires:  pkgconfig(wrt-plugin-js-overlay)
 
index 7d3ae04..87bca15 100755 (executable)
@@ -89,12 +89,12 @@ SET(WRT_BASIC_DEP
     ecore-input
     evas
     eina
+    ewebkit2
     elementary
     vconf
     cert-svc
     libsoup-2.4
     ui-gadget-1
-    aul
     libidn
     xmlsec1
     secure-storage
index 2e3cf0a..b393b83 100644 (file)
@@ -25,6 +25,9 @@ SET_TARGET_PROPERTIES(${TARGET_CORE_MODULE_LIB} PROPERTIES
 
 PKG_CHECK_MODULES(CORE_MODULE_DEP
     libprivilege-control
+    ewebkit2
+    wrt-plugin-js-overlay
+    dpl-efl
     REQUIRED
 )
 
index cca5328..fc89d13 100644 (file)
@@ -16,6 +16,7 @@
 /**
  * @file    core_module.cpp
  * @author  Przemyslaw Ciezkowski (p.ciezkowski@samsung.com)
+ * @author  Andrzej Surdej (a.surdej@samsung.com)
  * @version 1.0
  * @brief   File contains definitions of wrt core module.
  */
@@ -29,6 +30,7 @@
 #include <dpl/assert.h>
 #include <dpl/exception.h>
 #include <dpl/popup/popup_controller.h>
+#include <dpl/singleton_impl.h>
 #include <libxml/parser.h>
 #include "localization_setting.h"
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <widget_deserialize_model.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 
+#include <WebKit2/EWebKit2.h>
+
+IMPLEMENT_SINGLETON(WRT::CoreModule)
+
 namespace { //Anonymous
 
+const char * const bundlePath = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so";
+
 std::string cutOffFileName(const std::string& path)
 {
     size_t found = path.find_last_of("/");
@@ -91,78 +99,140 @@ bool checkPaths()
 
 namespace WRT {
 
-namespace CoreModule {
-
-bool Init()
+class CoreModuleImpl
 {
-    DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
-    LogDebug("Initialize");
-    if (!checkPaths()) {
-        LogError("Required path does not exist");
-        return false;
+public:
+
+    CoreModuleImpl() : m_initialized(false), m_ewkContext(NULL)
+    {
+        LogDebug("enter");
+    }
+
+    ~CoreModuleImpl()
+    {
+        LogError("Core module implementation destroyed");
     }
-    Try
+
+    bool Init()
+    {
+        if (!m_initialized) {
+            DPL::Log::LogSystemSingleton::Instance().SetTag("WRT");
+            LogDebug("Initialize");
+            if (!checkPaths()) {
+                LogError("Required path does not exist");
+                return false;
+            }
+            Try
+            {
+                GlobalContext::TouchArchitecture();
+
+                ADD_PROFILING_POINT("attach databases", "start");
+                MainThreadSingleton::Instance().AttachDatabases();
+                ADD_PROFILING_POINT("attach databases", "stop");
+
+                ADD_PROFILING_POINT("xml_parser_init", "start");
+                xmlInitParser();
+                ADD_PROFILING_POINT("xml_parser_init", "stop");
+
+                // Initialize popup manager
+                ADD_PROFILING_POINT("popup_manager_init", "start");
+                DPL::Popup::PopupManagerSingleton::Instance().Initialize(
+                    DPL::Popup::PopupRendererPtr(new DPL::Popup::PopupRenderer));
+                ADD_PROFILING_POINT("popup_manager_init", "stop");
+
+                // Initialize Language Subtag registry
+                ADD_PROFILING_POINT("language_rst_init", "start");
+                LocalizationSetting::Initialize();
+                ADD_PROFILING_POINT("language_rst_init", "stop");
+
+
+                // Needed settings for WKContext are located here
+                // create Ewk_Context
+                Ewk_Context* newEwkContext =
+                    ewk_context_new_with_injected_bundle_path(bundlePath);
+                if (!newEwkContext) {
+                    LogError("Failed to create Ewk_Context");
+                    ThrowMsg(DPL::Exception, "Failed to create ewk context");
+                }
+                    // cache model setting
+                ewk_context_cache_model_set(newEwkContext,
+                                            EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
+                m_ewkContext = newEwkContext;
+
+                LogDebug("Initialize finished");
+            } catch (const DPL::Exception& ex) {
+                LogError("Internal Error during screen preparation:");
+                DPL::Exception::DisplayKnownException(ex);
+                /* TODO:
+                 * Do deinitialization: check on which step exception occured
+                 * and deinitialize only initialized parts.
+                */
+                return false;
+            }
+            m_initialized = true;
+        }
+        return true;
+    }
+
+    void Terminate()
     {
-        GlobalContext::TouchArchitecture();
-
-        ADD_PROFILING_POINT("attach databases", "start");
-        MainThreadSingleton::Instance().AttachDatabases();
-        ADD_PROFILING_POINT("attach databases", "stop");
-
-        ADD_PROFILING_POINT("xml_parser_init", "start");
-        xmlInitParser();
-        ADD_PROFILING_POINT("xml_parser_init", "stop");
-
-        // Initialize popup manager
-        ADD_PROFILING_POINT("popup_manager_init", "start");
-        DPL::Popup::PopupManagerSingleton::Instance().Initialize(
-            DPL::Popup::PopupRendererPtr(new DPL::Popup::PopupRenderer));
-        ADD_PROFILING_POINT("popup_manager_init", "stop");
-
-        // Initialize Language Subtag registry
-        ADD_PROFILING_POINT("language_rst_init", "start");
-        LocalizationSetting::Initialize();
-        ADD_PROFILING_POINT("language_rst_init", "stop");
-
-        LogDebug("Initialize finished");
-    } catch (const DPL::Exception& ex) {
-        LogError("Internal Error during screen preparation:");
-        DPL::Exception::DisplayKnownException(ex);
-        /* TODO:
-         * Do deinitialization: check on which step exception occured
-         * and deinitialize only initialized parts.
-        */
-        return false;
+        if (m_ewkContext) {
+            LogInfo("finalizeEwkContext called");
+            ewk_context_delete(m_ewkContext);
+            m_ewkContext = 0;
+        }
+        MainThreadSingleton::Instance().DetachDatabases();
+        // Deinitialize popup manager
+        DPL::Popup::PopupManagerSingleton::Instance().Deinitialize();
+
+        LogInfo("Cleanup libxml2 global values.");
+        xmlCleanupParser();
+        m_initialized = false;
     }
-    return true;
+
+    RunnableWidgetObjectPtr getRunnableWidgetObject(const WidgetHandle& handle)
+    {
+        RunnableWidgetObjectPtr runnable;
+        WidgetModelPtr model = Domain::deserializeWidgetModel(handle);
+        if (!!model) {
+            runnable.reset(new RunnableWidgetObject(model, m_ewkContext));
+        }
+        return runnable;
+    }
+
+private:
+    bool m_initialized;
+    Ewk_Context* m_ewkContext;
+};
+
+CoreModule::CoreModule() : m_impl(new CoreModuleImpl())
+{
 }
 
-void Terminate()
+CoreModule::~CoreModule()
 {
-    MainThreadSingleton::Instance().DetachDatabases();
-    // Deinitialize popup manager
-    DPL::Popup::PopupManagerSingleton::Instance().Deinitialize();
+}
 
-    LogInfo("Cleanup libxml2 global values.");
-    xmlCleanupParser();
+bool CoreModule::Init()
+{
+    return m_impl->Init();
 }
 
-RunnableWidgetObjectPtr getRunnableWidgetObject(
-    const WidgetHandle& handle)
+void CoreModule::Terminate()
 {
-    RunnableWidgetObjectPtr runnable;
-    WidgetModelPtr model = Domain::deserializeWidgetModel(handle);
-    if (!!model) {
-        runnable.reset(new RunnableWidgetObject(model));
-    }
-    return runnable;
+    return m_impl->Terminate();
+}
+
+RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(const WidgetHandle& handle)
+{
+    return m_impl->getRunnableWidgetObject(handle);
 }
 
-RunnableWidgetObjectPtr getRunnableWidgetObject(const std::string& packageName)
+RunnableWidgetObjectPtr CoreModule::getRunnableWidgetObject(const std::string& packageName)
 {
     DPL::OptionalString pkgName(DPL::FromUTF8String(packageName));
     try {
-        return CoreModule::getRunnableWidgetObject(
+        return m_impl->getRunnableWidgetObject(
                 WrtDB::WidgetDAOReadOnly::getHandle(pkgName));
     } catch (WrtDB::WidgetDAOReadOnly::Exception::WidgetNotExist) {
         LogDebug("Widget not found.");
@@ -170,6 +240,4 @@ RunnableWidgetObjectPtr getRunnableWidgetObject(const std::string& packageName)
     }
 }
 
-} //namespace CoreModule
-
 } /* namespace WRT */
index 0f24d92..28fd94f 100644 (file)
@@ -16,6 +16,7 @@
 /**
  * @file    core_module.cpp
  * @author  Przemyslaw Ciezkowski (p.ciezkowski@samsung.com)
+ * @authir  Andrzej Surdej (a.surdej@gmail.com)
  * @version 1.0
  * @brief   File contains declarations of wrt core module.
  */
 
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 #include "i_runnable_widget_object.h"
+#include <dpl/singleton.h>
+#include <memory>
 
 namespace WRT {
 
-namespace CoreModule {
+class CoreModuleImpl; // forward declaration
+
+class CoreModule
+{
+  public:
     /**
      * Initialize needed by WRT components (database etc).
      * Will not throw exception. elm_init() is NOT called in this function.
@@ -58,7 +65,15 @@ namespace CoreModule {
      */
     RunnableWidgetObjectPtr getRunnableWidgetObject(
             const std::string& packageName);
-} //namespace CoreModule
+  private:
+    CoreModule();
+    ~CoreModule();
+    std::unique_ptr<CoreModuleImpl> m_impl;
+
+    friend class DPL::Singleton<CoreModule>;
+};
+
+typedef DPL::Singleton<CoreModule> CoreModuleSingleton;
 
 } /* namespace WRT */
 #endif /* CORE_MODULE_H_ */
index cb247d9..f725565 100644 (file)
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 #include <memory>
 #include <Evas.h>
+#include <widget_launch_struct.h>
+#include <widget_model.h>
 
 namespace WRT {
-
-typedef void (*FinishedCallbackFunction)(bool success, void *userData);
-struct FinishedCallback {
-    FinishedCallbackFunction callback;
-    void* userData;
-};
+typedef std::shared_ptr<WidgetModel> WidgetModelPtr;
 
 class IRunnableWidgetObject {
 public:
@@ -51,18 +48,11 @@ public:
      */
     virtual void PrepareView(Evas_Object *buffer = NULL) = 0;
     /**
-     * Sets debug mode on/off. When it is on, RT signal is send
-     * to wrt-launcher for given pid.
-     * @param debugMode
-     * @param sdkLauncherPid
-     */
-    virtual void SetDebugMode(bool debugMode, int sdkLauncherPid) = 0;
-    /**
      * Shows widget asynchronously. Callback will be called when
      * webkit generates website.
      * @param callback
      */
-    virtual void Show(FinishedCallback callback) = 0;
+    virtual void Show(WidgetLaunchStruct launchStruct) = 0;
     /**
      * Hides widget. To show it again Reset must be called.
      */
@@ -81,6 +71,11 @@ public:
      * Resets widgets after calling Hide().
      */
     virtual void Reset() = 0;
+    /**
+     * Retrieve widget's model
+     * @return WidgetModelPtr
+     */
+    virtual WidgetModelPtr GetModel() = 0;
 };
 
 typedef std::shared_ptr<IRunnableWidgetObject> RunnableWidgetObjectPtr;
index d371425..fa17046 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include "runnable_widget_object.h"
-#include <widget_localize_model.h>
 #include <privilege-control.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include "global_logic.h"
@@ -35,6 +34,7 @@
 #include <profiling_util.h>
 #include <signal.h>
 #include <common/window_data.h>
+#include "webkit/bundles/plugin_module_support.h"
 
 namespace { //Anonymous
 
@@ -80,18 +80,14 @@ const std::string INVALID_LOCALE = _("IDS_IM_POP_INVALID_WIDGET_LOCALE");
 const std::string STILL_AUTHORIZING = _("IDS_IM_POP_AUTHORIZING_ING_ATNT");
 const unsigned int UID_ROOT = 0;
 
-struct LaunchCallbackData {
-    WRT::FinishedCallback callback;
-    SDKDebugData* debugData;
-    WRT::RunnableWidgetObject* widgetObject;
-};
 } // namespace anonymous
 
 
 namespace WRT {
 
-RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model) :
-        m_widgetModel(model), m_debugMode(false), m_sdkLauncherPid(0) {
+RunnableWidgetObject::RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* context) :
+        m_widgetModel(model),
+        m_ewkContext(context) {
     // If current uid is 'root', change privilege to apps
     if (UID_ROOT == getuid()) {
         // Set privilege by pkgname
@@ -113,28 +109,11 @@ bool RunnableWidgetObject::CheckBeforeLaunch()
         set_process_config(DPL::ToUTF8String(widgetModel->PkgName.Get()).c_str());
     #endif
 
-    // WAC Waikiki Beta Release Core Specification: Widget Runtime
-    // 10 Dec 2010
-    //
-    // WR-4710 The WRT MUST enable debug functions only for WAC test widgets
-    // i.e. the functions must not be usable for normal WAC widgets, even when
-    // a WAC test widget is executing.
-    ADD_PROFILING_POINT("DeveloperModeCheck", "start");
-
-    if (!CheckWACTestCertififedWidget())
-    {
-        return false;
-    }
-    ADD_PROFILING_POINT("DeveloperModeCheck", "stop");
-
     if (m_widgetModel->StartURL.Get().IsNull()) {
         LogWarning("Widget is invalid in currently selected locales");
         return false;
     }
 
-    // Widget is not running, localized data can be updated
-    LocalizeWidgetModel();
-
     // Inform view controller about new widget model displaying
     ADD_PROFILING_POINT("OCSPCheck", "start");
 
@@ -176,92 +155,40 @@ void RunnableWidgetObject::PrepareView(Evas_Object *buffer)
         ADD_PROFILING_POINT("view_logic_init", "start");
         m_view = ViewModule::getView();
 
-        WrtDB::WidgetDAOReadOnly dao(m_widgetModel->Handle.Get());
-        DPL::OptionalString img_path(dao.getSplashImgSrc());
-        if (!img_path.IsNull()) {
-           m_windowData->setSplashImagePath((DPL::ToUTF8String(*img_path)).c_str());
+        m_splashScreen.reset(new ViewModule::SplashScreenSupport(m_windowData->m_win));
+        if (m_splashScreen->createSplashScreen(m_widgetModel->Handle.Get())) {
+            m_splashScreen->startSplashScreen();
+
+            // TODO get rid of conformant and splash image
+            m_view->createWebView(
+                m_ewkContext,
+                m_windowData->m_win,
+                m_windowData->m_conformant,
+                DPL::MakeDelegate(
+                    m_splashScreen.get(),
+                    &ViewModule::SplashScreenSupport::stopSplashScreen)
+            );
+        } else {
+            m_view->createWebView(m_ewkContext,
+                                  m_windowData->m_win,
+                                  m_windowData->m_conformant);
         }
-
-        m_view->createWebView(m_windowData->m_win,
-                              m_windowData->m_conformant,
-                              m_windowData->m_splashImage);
         evas_object_show(m_windowData->m_win);
         initializeWindowModes();
     } else {
         LogDebug("Buffer is not null, passing to view");
         m_view = ViewModule::getView();
-        m_view->createWebView(buffer, NULL, NULL);
+        m_view->createWebView(m_ewkContext, buffer, NULL, NULL);
     }
     m_view->initialize();
     m_view->prepareView(m_widgetModel.get());
     ADD_PROFILING_POINT("view_logic_init", "stop");
 }
 
-void RunnableWidgetObject::SetDebugMode(bool debugMode, int sdkLauncherPid)
-{
-    m_debugMode = debugMode;
-    m_sdkLauncherPid = sdkLauncherPid;
-}
-
-void RunnableWidgetObject::LaunchWidgetCallback(WidgetHandle widgetHandle,
-        CommonError::Type result,
-        const std::string& errorMsg,
-        UserParam userParam) {
-    LogDebug("Calling callback");
-    LaunchCallbackData* launch =
-            static_cast<LaunchCallbackData *>(userParam);
-
-    if (result == CommonError::WrtSuccess) {
-        LogDebug("Launch succesfull");
-        launch->callback.callback(true, launch->callback.userData);
-    } else {
-        LogError("Launch unsuccesfull: " << errorMsg);
-        launch->callback.callback(false, launch->callback.userData);
-    }
-
-    if(launch->debugData->debugMode == true)
-    {
-        LogDebug("Send RT signal to wrt-launcher(pid: "
-                << launch->widgetObject->m_sdkLauncherPid << ", result: "
-                << result);
-        union sigval sv;
-        // send real time signal with result to wrt-launcher
-        if(result == CommonError::WrtSuccess)
-        {
-            LogDebug("userData->portnum : " << launch->debugData->portnum);
-            sv.sival_int = launch->debugData->portnum;
-        }
-        else
-        {
-           sv.sival_int = -1;
-        }
-        sigqueue(launch->widgetObject->m_sdkLauncherPid, SIGRTMIN, sv);
-    }
-
-    LogDebug("Cleaning RunnableWidgetObject launch resources...");
-
-    delete launch->debugData->pid;
-    delete launch->debugData;
-    delete launch;
-}
-
-void RunnableWidgetObject::Show(FinishedCallback callback)
+void RunnableWidgetObject::Show(WidgetLaunchStruct launchStruct)
 {
-    SDKDebugData* debugData = new SDKDebugData;
-    debugData->debugMode = m_debugMode;
-    debugData->pid = new unsigned long(getpid());
-    LaunchCallbackData* userData = new LaunchCallbackData();
-    userData->debugData = debugData;
-    userData->callback = callback;
-    userData->widgetObject = this;
-    WidgetLaunchStruct launch(
-            userData->debugData->pid,
-            &LaunchWidgetCallback,
-            userData,
-            userData->debugData,
-            "");
     connectElmCallback();
-    m_view->setLaunchFinishedCallback(launch);
+    m_view->setLaunchFinishedCallback(launchStruct);
     m_view->showWidget();
     if (m_windowData) {
         m_windowData->emitSignalForUserLayout(EDJE_SHOW_BACKWARD_SIGNAL, "");
@@ -316,46 +243,9 @@ void RunnableWidgetObject::Reset()
     }
 }
 
-bool RunnableWidgetObject::CheckWACTestCertififedWidget()
-{
-    Assert(!!m_widgetModel);
-    // WAC test widget
-    // A widget signed with a WAC-issued test certificate as described in
-    // Developer Mode.
-
-    bool developerWidget = m_widgetModel->IsTestWidget.Get();
-    bool developerMode =
-        GlobalLogicSingleton::Instance().GetGlobalModel()->DeveloperMode.Get();
-
-    LogDebug("Is WAC test widget: " << developerWidget);
-    LogDebug("Is developer Mode: " << developerMode);
-
-    if (developerWidget) {
-        if(!developerMode)
-        {
-            LogError("WAC test certified developer widget is needed for " <<
-                    "developer mode");
-            return false;
-        }else{
-            //TODO: WR-4660 (show popup about developer widget
-            //      during launch
-            LogInfo("POPUP: THIS IS TEST WIDGET!");
-        }
-    }
-    return true;
-}
-
-void RunnableWidgetObject::LocalizeWidgetModel() {
-    Domain::localizeWidgetModel(m_widgetModel);
-    m_widgetModel->RunningName.Set(m_widgetModel->Name.Get());
-    m_widgetModel->RunningIcon.Set(m_widgetModel->Icon.Get());
-    m_widgetModel->RunningStartURL.Set(m_widgetModel->StartURL.Get());
-    m_widgetModel->RunningShortName.Set(m_widgetModel->ShortName.Get());
-    m_widgetModel->RunningDescription.Set(m_widgetModel->Description.Get());
-    m_widgetModel->RunningLicense.Set(m_widgetModel->License.Get());
-    m_widgetModel->RunningLicenseHref.Set(m_widgetModel->LicenseHref.Get());
-    m_widgetModel->RunningStartFileInfo.Set(
-        m_widgetModel->StartFileInfo.Get());
+WidgetModelPtr RunnableWidgetObject::GetModel() {
+    Assert(m_widgetModel);
+    return m_widgetModel;
 }
 
 void RunnableWidgetObject::initializeWindowModes()
@@ -438,9 +328,7 @@ void RunnableWidgetObject::connectElmCallback()
 RunnableWidgetObject::~RunnableWidgetObject()
 {
     LogDebug("");
-    if (m_view) {
-        m_view->destroyWebView();
-    }
+    PluginModuleSupport::shutdown(m_ewkContext);
 }
 
 } /* namespace WRT */
index 00e481a..7df7828 100644 (file)
 #include <i_view_module.h>
 #include <common_error.h>
 #include <widget_launch_struct.h>
+#include <common/view_logic_splash_screen_support.h>
+
+#include <WebKit2/ewk_context.h>
 
 class WindowData;
 
 namespace WRT {
-typedef std::shared_ptr<WidgetModel> WidgetModelPtr;
 
 class RunnableWidgetObject : public IRunnableWidgetObject
 {
 public:
-    RunnableWidgetObject(WidgetModelPtr &model);
+    RunnableWidgetObject(WidgetModelPtr &model, Ewk_Context* context);
     bool CheckBeforeLaunch();
     void PrepareView(Evas_Object *buffer = NULL);
-    void SetDebugMode(bool debugMode, int sdkLauncherPid);
-    void Show(FinishedCallback callback); //asynchronous function
+    void Show(WidgetLaunchStruct launchStruct); //asynchronous function
     void Hide();
     void Suspend();
     void Resume();
     void Reset();
+    WidgetModelPtr GetModel();
     virtual ~RunnableWidgetObject();
 private:
     static void LaunchWidgetCallback(WidgetHandle widgetHandle,
@@ -64,13 +66,11 @@ private:
     void connectElmCallback();
 
     WidgetModelPtr m_widgetModel;
-    bool checkWACTestCertififedWidget();
     void localizeWidgetModel();
     ViewModule::IViewModulePtr m_view;
+    Ewk_Context* m_ewkContext;
     std::unique_ptr<WindowData> m_windowData;
-    bool m_debugMode;
-    int m_sdkLauncherPid;
-
+    std::unique_ptr<ViewModule::SplashScreenSupport> m_splashScreen;
 };
 
 } /* namespace WRT */
index 203142b..3deba78 100644 (file)
@@ -20,11 +20,13 @@ SET(TARGET_VIEW_COMMON_LIB_STATIC "wrt-view-common")
 
 PKG_CHECK_MODULES(VIEW_COMMON_DEP
     appsvc
-    aul
+    capi-appfw-app-manager
     capi-system-haptic
+    capi-web-url-download
     dpl-efl
     dpl-event-efl
     eina
+    elementary
     evas
     libcurl    # uri unescape
     libiri
@@ -35,6 +37,7 @@ PKG_CHECK_MODULES(VIEW_COMMON_DEP
     ui-gadget-1
     vcore
     wrt-commons-auto-save-dao-rw
+    dpl-wrt-dao-ro
     wrt-security
     ace-client
     REQUIRED
@@ -52,6 +55,7 @@ SET(VIEW_COMMON_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_apps_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_custom_header_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_splash_screen_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_debugger_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_geolocation_support.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_password_support.cpp
index 3251bb0..af6c11b 100644 (file)
@@ -21,7 +21,9 @@
  */
 
 #include "application_launcher.h"
-#include <aul.h>
+#include <app.h>
+#include <app_manager.h>
+#include <url_download.h>
 #include <youtubehd.h>
 #include <dpl/singleton_impl.h>
 #include <appsvc.h>
@@ -31,8 +33,8 @@ IMPLEMENT_SINGLETON(ApplicationLauncher)
 using namespace WrtDB;
 
 namespace {
-const char * const BUNDLE_PATH = "path";
-const char * const BUNDLE_COOKIE = "cookie";
+const char * const SERVICE_EXTRA_DATA_KEY_PATH = "path";
+const char * const SERVICE_EXTRA_DATA_KEY_COOKIE = "cookie";
 
 const char * const SCHEME_TYPE_YOUTUBE = "vnd.youtube";
 const char * const SCHEME_TYPE_RTSP = "rtsp";
@@ -78,40 +80,72 @@ void ApplicationLauncher::OnEventReceived(
             return;
         }
 
-        bundle* bundle = bundle_create();
+        service_h serviceHandle = NULL;
+        int ret = SERVICE_ERROR_NONE;
 
-        if (NULL == bundle) {
-            LogError("Fail to create bundle");
+        // create service
+        ret = service_create(&serviceHandle);
+        if (SERVICE_ERROR_NONE != ret && NULL == serviceHandle) {
+            LogError("Fail to create service");
             return;
         }
-        if (appsvc_set_uri(bundle, url.c_str())) {
-            LogError("Fail to add bundle for path");
-            bundle_free(bundle);
+
+        // set service operation
+        ret = service_set_operation(serviceHandle, SERVICE_OPERATION_DOWNLOAD);
+        if (SERVICE_ERROR_NONE != ret) {
+            LogError("Fail to set operation [" << ret << "]");
+            service_destroy(serviceHandle);
+            return;
+        }
+
+        // set service uri
+        ret = service_set_uri(serviceHandle, url.c_str());
+        if (SERVICE_ERROR_NONE != ret) {
+            LogError("Fail to set uri [" << ret << "]");
+            service_destroy(serviceHandle);
             return;
         }
+
+        // set cookie
         if (cookie != "null") {
-            if (bundle_add(bundle, BUNDLE_COOKIE, cookie.c_str())) {
-                LogError("Fail to add bundle for cookie");
-                bundle_free(bundle);
+            ret = service_add_extra_data(serviceHandle,
+                                         SERVICE_EXTRA_DATA_KEY_COOKIE,
+                                         cookie.c_str());
+            if (SERVICE_ERROR_NONE != ret) {
+                LogError("Fail to add cookie [" << ret << "]");
+                service_destroy(serviceHandle);
                 return;
             }
         }
-        if (aul_launch_app(PKG_NAME_DOWNLOAD_PROVIDER.c_str(), bundle) < 0) {
-            LogError("aul_launch_app is failed");
+
+        //launch service
+        ret = service_send_launch_request(serviceHandle, NULL, NULL);
+        if (SERVICE_ERROR_NONE != ret) {
+            LogError("Fail to launch service [" << ret << "]");
+            service_destroy(serviceHandle);
+            return;
         }
-        bundle_free(bundle);
+
+        LogDebug("Success launch " << SERVICE_OPERATION_DOWNLOAD);
+        service_destroy(serviceHandle);
+        return;
     } else if (PKG_NAME_VIDEO_PLAYER == pkgName) {
-        if (aul_app_is_running(PKG_NAME_VT_MAIN.c_str()))
+        bool isRunning = false;
+        if (APP_MANAGER_ERROR_NONE !=
+            app_manager_is_running(PKG_NAME_VT_MAIN.c_str(), &isRunning))
         {
-            LogError("video-call is running......");
+            LogError("Fail to get app running information");
+            return;
+        }
+        if (true == isRunning) {
+            LogError("video-call is running");
             return;
         }
 
         std::string scheme(event.GetArg1());
         std::string uri(event.GetArg2());
         std::string cookie(event.GetArg3());
-        const char* videoPath;
-        int aulRVal = AUL_R_ERROR;
+        const char* url;
 
         if ("null" == scheme) {
             LogError("scheme is empty");
@@ -125,55 +159,75 @@ void ApplicationLauncher::OnEventReceived(
         LogDebug("scheme: " << scheme);
         if (SCHEME_TYPE_YOUTUBE == scheme) {
             YouTubeHD *youtube = new YouTubeHD(m_widgetHandle);
-            videoPath = youtube->getYouTubeHD(uri.c_str());
+            url = youtube->getYouTubeHD(uri.c_str());
             delete youtube;
         } else if (SCHEME_TYPE_RTSP == scheme ||
                     (SCHEME_TYPE_HTML5_VIDEO == scheme))
         {
-            videoPath = uri.c_str();
+            url = uri.c_str();
         } else {
             LogError("scheme is invalid!!");
             return;
         }
 
-        bundle *bundle = bundle_create();
-        if (bundle == NULL) {
-            LogError("Fail to create bundle");
-            bundle_free(bundle);
+        service_h serviceHandle = NULL;
+        int ret = SERVICE_ERROR_NONE;
+
+        // create service
+        ret = service_create(&serviceHandle);
+        if (SERVICE_ERROR_NONE != ret && NULL == serviceHandle) {
+            LogError("Fail to create service");
             return;
         }
 
-        if (! videoPath || strlen(videoPath)==0) {
-            LogError("getYouTubeHD is FAILED!!");
-            bundle_free(bundle);
+        // set url
+        if (!url || strlen(url) == 0) {
+            LogError("Fail to get url");
+            service_destroy(serviceHandle);
             return;
         }
-        LogDebug("videoPath: " << videoPath);
-        if (bundle_add(bundle, BUNDLE_PATH, videoPath) < 0) {
-            LogError("bundle_add is FAIL!!");
-            bundle_free(bundle);
+        ret = service_add_extra_data(serviceHandle,
+                                     SERVICE_EXTRA_DATA_KEY_PATH,
+                                     url);
+        if (SERVICE_ERROR_NONE != ret) {
+            LogError("Fail to set url [" << ret << "]");
+            service_destroy(serviceHandle);
             return;
         }
 
+        // set cookie
         if (SCHEME_TYPE_HTML5_VIDEO == scheme) {
             if ("null" != cookie) {
-                LogDebug("cookie: " << cookie);
-                if (bundle_add(bundle, BUNDLE_COOKIE, cookie.c_str()) < 0) {
-                    LogError("cookie is empty");
-                    bundle_free(bundle);
+                ret = service_add_extra_data(serviceHandle,
+                                             SERVICE_EXTRA_DATA_KEY_COOKIE,
+                                             cookie.c_str());
+                if (SERVICE_ERROR_NONE != ret) {
+                    LogError("Fail to add cookie [" << ret << "]");
+                    service_destroy(serviceHandle);
                     return;
                 }
             }
         }
 
-        aulRVal = aul_launch_app(PKG_NAME_VIDEO_PLAYER.c_str(), bundle);
-        if (AUL_R_OK > aulRVal) {
-            LogError("aul_launch_app is failed! aulRVal: " << aulRVal);
+        // set package
+        ret = service_set_package(serviceHandle, PKG_NAME_VIDEO_PLAYER.c_str());
+        if (SERVICE_ERROR_NONE != ret) {
+            LogError("Fail to set package [" << ret << "]");
+            service_destroy(serviceHandle);
+            return;
         }
-        if (bundle_free(bundle)) {
-            LogDebug("bundle_free is FAILED!!");
+
+        //launch service
+        ret = service_send_launch_request(serviceHandle, NULL, NULL);
+        if (SERVICE_ERROR_NONE != ret) {
+            LogError("Fail to launch service [" << ret << "]");
+            service_destroy(serviceHandle);
+            return;
         }
 
+        LogDebug("Success launch " << PKG_NAME_VIDEO_PLAYER);
+        service_destroy(serviceHandle);
+        return;
     }
 }
 
index 740e27c..c828adc 100644 (file)
@@ -109,6 +109,16 @@ class AppsSupportImplementation
             appsvc_set_operation(args, APPSVC_OPERATION_VIEW);
             appsvc_set_mime(args, mimeType.c_str());
             appsvc_set_uri(args, uri.c_str());
+        } else if (!strcasecmp(mimeType.c_str(), "video/mp4") ||
+                   !strcasecmp(mimeType.c_str(), "vidoe/3gp"))
+        {
+            CONTROLLER_POST_EVENT(
+                ApplicationLauncher,
+                ApplicationLauncherEvents::LaunchApplicationByPkgname(
+                    ApplicationLauncherPkgname::PKG_NAME_VIDEO_PLAYER,
+                    SCHEME_TYPE_HTML5_VIDEO,
+                    uri,
+                    "null"));
         } else {
             LogInfo("Not Supported MIME type in WRT");
             return false;
index 25b1b46..b82345b 100755 (executable)
@@ -82,7 +82,6 @@ void WindowData::init()
     m_conformant = createConformant(m_user_layout);
     evas_object_show(m_conformant);
     m_progress = createProgress(m_user_layout);
-    m_splashImage = createSplashImage(m_user_layout);
 
     result = ug_init(
         static_cast<Display*>(ecore_x_display_get()),
@@ -106,24 +105,6 @@ void WindowData::unsetEvasObjectForLayout()
     elm_object_content_unset(m_conformant);
 }
 
-void WindowData::setSplashImagePath(const char * image_path)
-{
-    if (image_path) {
-        LogInfo("splash screen image path : " << image_path);
-
-        if (elm_icon_file_set(m_splashImage, image_path, NULL)) {
-            if (elm_icon_animated_available_get(m_splashImage)) {
-                elm_icon_animated_set(m_splashImage, EINA_TRUE);
-                elm_icon_animated_play_set(m_splashImage, EINA_FALSE);
-            } else {
-                elm_icon_animated_set(m_splashImage, EINA_FALSE);
-            }
-        } else {
-            LogError("loading splash image has been failed");
-        }
-    }
-}
-
 void WindowData::loadingOn()
 {
     LogInfo("loadingOn");
@@ -364,21 +345,6 @@ void WindowData::alignProgressPosition()
     evas_object_move(m_progress, alignedX, alignedY);
 }
 
-Evas_Object* WindowData::createSplashImage(Evas_Object* parent)
-{
-    Assert(parent != NULL && "Parent for splash image is null");
-
-    Evas_Coord x, y, w, h;
-    evas_object_geometry_get(m_win, &x, &y, &w, &h);
-
-    Evas_Object* splashImage = elm_icon_add(parent);
-
-    evas_object_resize(splashImage, w, h);
-    evas_object_image_fill_set(splashImage, 0, 0, w, h);
-
-    return splashImage;
-}
-
 void WindowData::addNaviBackButtonCallback(
         const char* event,
         CallbackType callback,
index 0d62499..61af80c 100755 (executable)
@@ -63,7 +63,6 @@ class WindowData : private DPL::Noncopyable
   public:
     Evas_Object* m_win;
     Evas_Object* m_conformant;
-    Evas_Object* m_splashImage;
 
     explicit WindowData(unsigned long pid, bool manualInit=false);
     virtual ~WindowData();
@@ -71,7 +70,6 @@ class WindowData : private DPL::Noncopyable
     void init();
     void setEvasObjectForLayout(Evas_Object* evas_object);
     void unsetEvasObjectForLayout();
-    void setSplashImagePath(const char * image_path);
     void loadingOn();
     void loadingOff();
     void moveProgress();
@@ -119,7 +117,6 @@ class WindowData : private DPL::Noncopyable
     Evas_Object* createUserLayout(Evas_Object* parent);
     Evas_Object* createConformant(Evas_Object* parent);
     Evas_Object* createProgress(Evas_Object* parent);
-    Evas_Object* createSplashImage(Evas_Object* parent);
     void alignProgressPosition();
     void createTitle(const char* data);
     void removeTitle();
index 3899b89..08a0b7d 100644 (file)
@@ -22,7 +22,9 @@
 
 #include <memory>
 #include <string>
+#include <dpl/fast_delegate.h>
 #include <common/evas_object.h>
+#include <WebKit2/ewk_context.h>
 
 #ifndef WRT_SRC_VIEW_I_VIEW_MODULE_H_
 #define WRT_SRC_VIEW_I_VIEW_MODULE_H_
@@ -32,8 +34,9 @@ class WidgetModel; //FORWARD DECLARATION
 struct WidgetLaunchStruct; //FORWARD DECLARATION
 struct OperationStatusStruct; //FORWARD DECLARATION
 struct InitScreenStruct; //FORWARD DECLARATION
-namespace ViewModule
-{
+namespace ViewModule {
+
+typedef DPL::FastDelegate0<void> ProgresFinishedCallback;
 
 /** \brief Interface to ViewModule. Object of IViewModule type is returned from
  *  ViewModuleMgr factory.
@@ -41,9 +44,10 @@ namespace ViewModule
 class IViewModule
 {
 public:
-    virtual void createWebView(Evas_Object* window,
+    virtual void createWebView(Ewk_Context* context,
+                               Evas_Object* window,
                                Evas_Object* conformant = NULL,
-                               Evas_Object* splashImage = NULL) = 0;
+                               ProgresFinishedCallback cb = NULL) = 0;
     virtual void destroyWebView() = 0;
     virtual void initialize() = 0;
     virtual void terminate() = 0;
index 8ad207e..2abe235 100644 (file)
@@ -102,22 +102,14 @@ const char * const EWK_VIBRATION_CANCEL = "vibration,cancel";
 
 }
 
-void ViewLogic::createWebView(Evas_Object* window,
+void ViewLogic::createWebView(Ewk_Context* context,
+                              Evas_Object* window,
                               Evas_Object* conformant,
-                              Evas_Object* splashImage)
+                              ViewModule::ProgresFinishedCallback cb)
 {
     LogDebug("");
-    m_splashImage = splashImage;
-    if (m_splashImage) {
-        LogInfo("splashImageOn");
-        if (elm_icon_animated_get(m_splashImage) == EINA_TRUE) {
-            elm_icon_animated_play_set(m_splashImage, EINA_TRUE);
-        }
-        evas_object_show(m_splashImage);
-
-    }
-
-    initializeEwkContext();
+    m_finishedCallback = cb;
+    initializeEwkContext(context);
     Assert(NULL != m_ewkContext);
     Assert(window);
     m_window = window;
@@ -246,7 +238,6 @@ void ViewLogic::hideWidget()
     //    evas_object_del(*it);
     //}
     m_ewkViewList.clear();
-    PluginModuleSupport::shutdown(m_ewkContext);
 }
 
 void ViewLogic::suspendWidget(
@@ -384,28 +375,16 @@ void ViewLogic::goBack()
     }
 }
 
-void ViewLogic::initializeEwkContext(void)
+void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
 {
     LogInfo("initializeEwkContext called");
-    // Needed settings for WKContext are located here
-    // create Ewk_Context
-    Ewk_Context* newEwkContext =
-        ewk_context_new_with_injected_bundle_path(bundlePath);
-    if (!newEwkContext) {
-        LogError("Failed to create Ewk_Context");
-        Assert(false);
-    }
-
+    Assert(newEwkContext && "Ewk_Context provided can not be null");
     // bundle callback setting
     ewk_context_message_from_injected_bundle_callback_set(
         newEwkContext,
         contextMessageFromInjectedBundleCallback,
         static_cast<void*>(this));
 
-    // cache model setting
-    ewk_context_cache_model_set(newEwkContext,
-                                EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
-
     // proxy server setting
     char *proxyAddress = vconf_get_str(VCONFKEY_NETWORK_PROXY);
     if ((!proxyAddress) || (strlen(proxyAddress) == 0)
@@ -473,8 +452,7 @@ ViewLogic::ViewLogic():
     m_appsSupport(new ViewModule::AppsSupport()),
     m_vibrationSupport(new ViewModule::VibrationSupport()),
     m_window(NULL),
-    m_conformant(NULL),
-    m_splashImage(NULL)
+    m_conformant(NULL)
 {
 }
 
@@ -1204,16 +1182,9 @@ void ViewLogic::didFinishProgressCallback(WKPageRef /*page*/,
                                                 const void* clientinfo)
 {
     LogDebug("didFinishProgressCallback");
-    Assert(clientinfo);
-    ViewLogic* This = static_cast<ViewLogic*>(const_cast<void*>(clientinfo));
-
-    if (This->m_splashImage) {
-        LogInfo("splashImageOff");
-        if (elm_icon_animated_get(This->m_splashImage) == EINA_TRUE) {
-            elm_icon_animated_play_set(This->m_splashImage, EINA_FALSE);
-        }
-        evas_object_hide(This->m_splashImage);
-    }
+    ViewLogic const * const view = static_cast<ViewLogic const * const>(clientinfo);
+    if (!view->m_finishedCallback.empty())
+        view->m_finishedCallback();
 }
 
 void ViewLogic::createWindowCallback(
@@ -1610,7 +1581,7 @@ Eina_Bool ViewLogic::orientationLockCallback(
     } else if(orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
         LogDebug("orientation is portrait-secondary");
         elm_win_rotation_with_resize_set(This->m_window, 180);
-        ewk_view_orientation_send(obj, -180);
+        ewk_view_orientation_send(obj, 180);
     } else if(orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
         LogDebug("orientation is landscape-secondary");
         elm_win_rotation_with_resize_set(This->m_window, 90);
index 2aec278..3e3d373 100644 (file)
@@ -43,9 +43,10 @@ class SchemeSupport;
 class ViewLogic : public ViewModule::IViewModule
 {
   public:
-    void createWebView(Evas_Object* window,
+    void createWebView(Ewk_Context* context,
+                       Evas_Object* window,
                        Evas_Object* conformant = NULL,
-                       Evas_Object* splashImage = NULL);
+                       ViewModule::ProgresFinishedCallback cb = NULL);
     void destroyWebView();
     void initialize();
     void terminate();
@@ -59,7 +60,7 @@ class ViewLogic : public ViewModule::IViewModule
     void goBack();
 
     // Ewk_Context operations
-    void initializeEwkContext(void);
+    void initializeEwkContext(Ewk_Context* context);
     void finalizeEwkContext();
     ViewLogic();
     virtual ~ViewLogic();
@@ -258,13 +259,14 @@ class ViewLogic : public ViewModule::IViewModule
     Evas_Object* m_currentEwkView;
     Evas_Object* m_window;
     Evas_Object* m_conformant;
-    Evas_Object* m_splashImage;
     WidgetModel* m_model;
     std::string m_currentUri;
     std::string m_blockedUri;
     bool m_emptyView;
     std::string m_theme;
 
+    ViewModule::ProgresFinishedCallback m_finishedCallback;
+
     std::unique_ptr<SchemeSupport> m_schemeSupport;
     std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
     std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
index e84d868..f3b52d5 100644 (file)
@@ -21,6 +21,8 @@
 #include <dpl/optional_typedefs.h>
 #include <common/application_data.h>
 #include <core_module.h>
+#include <global_logic.h>
+#include <widget_localize_model.h>
 
 WrtClient::WrtClient(int argc, char **argv) :
     Application(argc, argv, "wrt-client", false),
@@ -224,7 +226,7 @@ void WrtClient::OnEventReceived(const NextStepEvent& /*event*/)
 void WrtClient::initStep()
 {
     LogDebug("");
-    if (WRT::CoreModule::Init()) {
+    if (WRT::CoreModuleSingleton::Instance().Init()) {
         m_initialized = true;
     } else {
         m_returnStatus = ReturnStatus::Failed;
@@ -234,9 +236,71 @@ void WrtClient::initStep()
             NextStepEvent());
 }
 
-void WrtClient::LaunchCallback(bool success, void *data) {
-    WrtClient* wrtClient = static_cast<WrtClient*>(data);
-    if (success) {
+void WrtClient::localizeWidgetModel() {
+    Assert(!!m_widget);
+    WRT::WidgetModelPtr model = m_widget->GetModel();
+    Assert(!!model);
+    Domain::localizeWidgetModel(model);
+    model->RunningName.Set(model->Name.Get());
+    model->RunningIcon.Set(model->Icon.Get());
+    model->RunningStartURL.Set(model->StartURL.Get());
+    model->RunningShortName.Set(model->ShortName.Get());
+    model->RunningDescription.Set(model->Description.Get());
+    model->RunningLicense.Set(model->License.Get());
+    model->RunningLicenseHref.Set(model->LicenseHref.Get());
+    model->RunningStartFileInfo.Set(
+        model->StartFileInfo.Get());
+}
+
+bool WrtClient::checkWACTestCertififedWidget()
+{
+    // WAC Waikiki Beta Release Core Specification: Widget Runtime
+    // 10 Dec 2010
+    //
+    // WR-4710 The WRT MUST enable debug functions only for WAC test widgets
+    // i.e. the functions must not be usable for normal WAC widgets, even when
+    // a WAC test widget is executing.
+    ADD_PROFILING_POINT("DeveloperModeCheck", "start");
+    Assert(!!m_widget);
+    WRT::WidgetModelPtr model = m_widget->GetModel();
+    Assert(!!model);
+    // WAC test widget
+    // A widget signed with a WAC-issued test certificate as described in
+    // Developer Mode.
+
+    bool developerWidget = model->IsTestWidget.Get();
+    bool developerMode =
+        GlobalLogicSingleton::Instance().GetGlobalModel()->DeveloperMode.Get();
+
+    LogDebug("Is WAC test widget: " << developerWidget);
+    LogDebug("Is developer Mode: " << developerMode);
+
+    if (developerWidget) {
+        if(!developerMode)
+        {
+            LogError("WAC test certified developer widget is needed for " <<
+                    "developer mode");
+            return false;
+        }else{
+            //TODO: WR-4660 (show popup about developer widget
+            //      during launch
+            LogInfo("POPUP: THIS IS TEST WIDGET!");
+        }
+    }
+    ADD_PROFILING_POINT("DeveloperModeCheck", "stop");
+    return true;
+}
+
+void WrtClient::staticWrtLaunchWidgetCallback(int /*handle*/,
+                                              CommonError::Type status,
+                                              const std::string& errorMsg,
+                                              void* userdata)
+{
+    WrtLaunchData* userData = static_cast<WrtLaunchData*>(userdata);
+    WrtClient* wrtClient = static_cast<WrtClient*>(userData->wrtClientContext);
+    SDKDebugData* debug = userData->sdkDebugData;
+
+    if (status == CommonError::WrtSuccess) {
         LogDebug("Launch succesfull");
 
         wrtClient->m_launched = true;
@@ -245,7 +309,7 @@ void WrtClient::LaunchCallback(bool success, void *data) {
         printf("launched\n");
         fflush(stdout);
     } else {
-        LogError("Launch unsuccesfull");
+        LogError("Launch unsuccesfull: " << errorMsg);
 
         printf("failed\n");
 
@@ -254,14 +318,38 @@ void WrtClient::LaunchCallback(bool success, void *data) {
         wrtClient->DPL::Event::ControllerEventHandler<NextStepEvent>::
                 PostEvent(NextStepEvent());
     }
+
+    if(debug->debugMode)
+    {
+        LogDebug("Send RT signal to wrt-launcher(pid: "
+                << wrtClient->m_sdkLauncherPid << ", status: " << status);
+        union sigval sv;
+        /* send real time signal with result to wrt-launcher */
+        if(status == CommonError::WrtSuccess)
+        {
+            LogDebug("userData->portnum : " << debug->portnum);
+            sv.sival_int = debug->portnum;
+        }
+        else
+        {
+           sv.sival_int = -1;
+        }
+        sigqueue(wrtClient->m_sdkLauncherPid, SIGRTMIN, sv);
+    }
+
     ApplicationDataSingleton::Instance().freeBundle();
+
+    LogDebug("Cleaning wrtClient launch resources...");
+    delete debug->pid;
+    delete debug;
+    delete userData;
 }
 
 void WrtClient::launchStep()
 {
     LogDebug("Launching widget ...");
 
-    m_widget = WRT::CoreModule::getRunnableWidgetObject(m_handle);
+    m_widget = WRT::CoreModuleSingleton::Instance().getRunnableWidgetObject(m_handle);
     if (!m_widget) {
         LogError("RunnableWidgetObject is NULL, stop launchStep");
         DPL::Event::ControllerEventHandler<NextStepEvent>::PostEvent(
@@ -283,6 +371,15 @@ void WrtClient::launchStep()
         return;
     }
 
+    // Widget is not running, localized data can be updated
+    localizeWidgetModel();
+
+    if (!checkWACTestCertififedWidget())
+    {
+        LogWarning("WAC Certificate failed, stop launchStep");
+        return;
+    }
+
     m_widgetState = WidgetState_Authorizing;
     if (!m_widget->CheckBeforeLaunch()) {
         LogError("CheckBeforeLaunch failed, stop launchStep");
@@ -293,11 +390,19 @@ void WrtClient::launchStep()
     LogInfo("Widget launch accepted. Entering running state");
     m_widgetState = WidgetState_Running;
     m_widget->PrepareView();
-    m_widget->SetDebugMode(m_debugMode, m_sdkLauncherPid);
-    WRT::FinishedCallback callback;
-    callback.callback = &LaunchCallback;
-    callback.userData = this;
-    m_widget->Show(callback);
+    SDKDebugData* debugData = new SDKDebugData;
+    debugData->debugMode = m_debugMode;
+    debugData->pid = new unsigned long(getpid());
+    WrtLaunchData* userData = new WrtLaunchData;
+    userData->wrtClientContext = this;
+    userData->sdkDebugData = debugData;
+    WidgetLaunchStruct launch(
+            debugData->pid,
+            &staticWrtLaunchWidgetCallback,
+            userData,
+            debugData,
+            "");
+    m_widget->Show(launch);
 }
 
 void WrtClient::shutdownStep()
@@ -307,7 +412,7 @@ void WrtClient::shutdownStep()
         m_widgetState = WidgetState_Stopped;
         m_widget->Hide();
         m_widget.reset();
-        WRT::CoreModule::Terminate();
+        WRT::CoreModuleSingleton::Instance().Terminate();
         m_initialized = false;
     }
     Quit();
index 1994fe4..d3f69ff 100644 (file)
@@ -22,7 +22,7 @@
 #include <dpl/type_list.h>
 #include <dpl/task.h>
 #include <bundle.h>
-#include <runnable_widget_object.h>
+#include <i_runnable_widget_object.h>
 #include "widget_state.h"
 
 DECLARE_GENERIC_EVENT_0(NextStepEvent)
@@ -63,6 +63,8 @@ class WrtClient :
     void                   showHelpAndQuit();
     bool                   checkArgument();
     void                   setSdkLauncherDebugData();
+    bool                   checkWACTestCertififedWidget();
+    void                   localizeWidgetModel();
 
     // Events
     virtual void         OnEventReceived(const NextStepEvent& event);
@@ -72,7 +74,10 @@ class WrtClient :
     void                 launchStep();
     void                 shutdownStep();
 
-    static void LaunchCallback(bool success, void *data);
+    static void          staticWrtLaunchWidgetCallback(int,
+                                              CommonError::Type,
+                                              const std::string&,
+                                              void*);
     // Private data
     int m_handle;
     bool m_launched;
old mode 100755 (executable)
new mode 100644 (file)
index ee88d0a..5f5d773
@@ -20,8 +20,7 @@ SET(LAUNCHER_SRCS
 )
 
 PKG_CHECK_MODULES(LAUNCHER_PKGS
-    aul
-    bundle
+    capi-appfw-app-manager
     dpl-efl
     dpl-db-efl
     dpl-wrt-dao-rw
index c26a326..69f3be3 100644 (file)
@@ -15,8 +15,8 @@
  */
 #include <iostream>
 #include <string>
-#include <aul.h>
-#include <bundle.h>
+#include <app.h>
+#include <app_manager.h>
 #include <string.h>
 #include <getopt.h>
 #include <stdlib.h>
@@ -38,7 +38,6 @@
 #define WEBAPP_DEFAULT_UID  5000
 #define WEBAPP_DEFAULT_GID  5000
 #define LOGGING_DEFAULT_GID 6509
-#define WRT_CHANGE_CLIENT_SH "wrt_change_client.sh";
 #define RETURN_ERROR -1
 
 static const char *program;
@@ -72,8 +71,7 @@ typedef struct
 
 static void free_widget_info(widget_info* widget_info)
 {
-    if(widget_info)
-    {
+    if (widget_info) {
         delete[] widget_info->guid;
         delete[] widget_info->name;
         delete[] widget_info->version;
@@ -92,8 +90,7 @@ static char* new_strdup(const char *str)
 
 static bool display_widget_info()
 {
-    if (NULL == g_dbConnection)
-    {
+    if (NULL == g_dbConnection) {
         Try {
             g_dbConnection.Reset(new DBConnection());
             g_dbConnection->AttachDatabase();
@@ -107,13 +104,12 @@ static bool display_widget_info()
     WidgetHandleList widgetList = WrtDB::WidgetDAOReadOnly::getHandleList();
 
     printf("%3s%12s%32s%16s%64s%32s\n",
-            "No", "ID", "Name", "Version", "GUID", "Package Name");
+           "No", "ID", "Name", "Version", "GUID", "Package Name");
     printf("%3s%12s%32s%16s%64s%32s\n",
-            "--", "--", "----", "-------", "----", "------------");
+           "--", "--", "----", "-------", "----", "------------");
 
     int number = 1;
-    FOREACH(iterator, widgetList)
-    {
+    FOREACH(iterator, widgetList) {
         widget_info *info = new widget_info;
         memset(info, 0x00, sizeof(widget_info));
 
@@ -129,37 +125,29 @@ static bool display_widget_info()
         if (dl.IsNull()) {
             DPL::String languageTag(L"");
             localizedInfo = dao.getLocalizedInfo(languageTag);
-        }
-        else
-        {
+        } else {
             localizedInfo = dao.getLocalizedInfo(*dl);
         }
 
         widget_name = localizedInfo.name;
 
         /*end get WidgetName*/
-
-        if(!widget_name.IsNull())
-        {
+        if (!widget_name.IsNull()) {
             info->name = new_strdup(DPL::ToUTF8String(*widget_name).c_str());
         }
-        if(!version.IsNull())
-        {
+        if (!version.IsNull()) {
             info->version = new_strdup(DPL::ToUTF8String(*version).c_str());
-        }
-        else
-        {
+        } else {
             std::string installedWidgetVersionString;
             installedWidgetVersionString = "";
             info->version = new_strdup(installedWidgetVersionString.c_str());
         }
-        if(!guid.IsNull())
-        {
-            info->guid= new_strdup(DPL::ToUTF8String(*guid).c_str());
+        if (!guid.IsNull()) {
+            info->guid = new_strdup(DPL::ToUTF8String(*guid).c_str());
         }
-        if(!package_name.IsNull())
-        {
-            info->pkg_name= new_strdup(DPL::ToUTF8String(*package_name).c_str());
+        if (!package_name.IsNull()) {
+            info->pkg_name =
+                new_strdup(DPL::ToUTF8String(*package_name).c_str());
         }
         printf("%3i%12i%32s%16s%64s%32s\n",
                number++,
@@ -172,54 +160,45 @@ static bool display_widget_info()
         free_widget_info(info);
     }
 
-   return 1;
+    return 1;
 }
 
 static void print_help(FILE *stream, int /*exit_code*/)
 {
-      fprintf(stream, "Usage : %s [ ... ]\n", program);
-      fprintf(stream,
-                    "   -h                       --help              Display this usage information.\n"
-                    "   -l                       --list              Display installed widgets handle and name list\n"
-                    "   -s [GUID]or[PkgName]     --start             Launch widget with package name or GUID\n"
-                    "   -k [GUID]or[PkgName]     --kill              Kill widget with package name or GUID\n"
-                    "   -d                       --debug             Activate debug mode\n"
-                    "   -t [second]              --timeout           Set timeout of response from widget in debug mode\n"
-                    "   -v [1]or[0]              --developer-mode    Set developermode\n"
-                    "   -c [1]or[0]              --compliance-mode   Set compliancemode\n"
-                    "   -i [imei]                --fake-imei         Set fakeimei\n"
-                    "   -m [meid]                --fake-meid         Set fakemeid\n"
-                    "   -w [PkgName]             --change-wkmode     Change webkit mode\n"
-                    "    if you emit this option, 5 seconds is set in debug mode\n"
-      );
-}
-
-static int kill_widget(const aul_app_info *info, void *data)
-{
-    char *pkgname = (char *) data;
-    if(strcmp(info->pkg_name, pkgname) == 0)
-        return aul_terminate_pid(info->pid);
-    else return -1;
+    fprintf(stream, "Usage : %s [ ... ]\n", program);
+    fprintf(stream,
+            "   -h                       --help              Display this usage information.\n"
+            "   -l                       --list              Display installed widgets handle and name list\n"
+            "   -s [GUID]or[PkgName]     --start             Launch widget with package name or GUID\n"
+            "   -k [GUID]or[PkgName]     --kill              Kill widget with package name or GUID\n"
+            "   -d                       --debug             Activate debug mode\n"
+            "   -t [second]              --timeout           Set timeout of response from widget in debug mode\n"
+            "   -v [1]or[0]              --developer-mode    Set developermode\n"
+            "   -c [1]or[0]              --compliance-mode   Set compliancemode\n"
+            "   -i [imei]                --fake-imei         Set fakeimei\n"
+            "   -m [meid]                --fake-meid         Set fakemeid\n"
+            "    if you emit this option, 5 seconds is set in debug mode\n"
+            );
 }
 
 static void sighandler(int signo, siginfo_t *si, void *data);
 
 int main(int argc, char* argv[])
 {
-    int ret = -1;
-    bundle *b = NULL;
     int next_opt, opt_idx = 0;
     int timeout = TIMEOUT_DEFAULT;
-    char pkgname[256]="";
-    char temp_arg[256]="";
+    char pkgname[256] = "";
+    char temp_arg[256] = "";
     char pid[6] = "";
     char op = '\0';
     struct sigaction sigact;
 
+    service_h serviceHandle = NULL;
+    int ret = SERVICE_ERROR_NONE;
+
     program = argv[0];
 
-    static struct option long_options[] =
-    {
+    static struct option long_options[] = {
         {"help", no_argument, 0, 'h'},
         {"list", no_argument, 0, 'l'},
         {"start", required_argument, 0, 's'},
@@ -230,12 +209,10 @@ int main(int argc, char* argv[])
         {"compliance-mode", required_argument, 0, 'c'},
         {"fake-imei", required_argument, 0, 'i'},
         {"fake-meid", required_argument, 0, 'm'},
-        {"change-wkmode", required_argument, 0, 'w'},
         {0, 0, 0, 0}
     };
 
-    if(argv[1] == NULL)
-    {
+    if (argv[1] == NULL) {
         /* exit if any argument doesn't exist */
         print_help(stdout, 0);
         return -1;
@@ -253,147 +230,145 @@ int main(int argc, char* argv[])
     }
 
     do {
-        next_opt = getopt_long(argc, argv,"hls:k:dt:v:c:i:m:w:", long_options, &opt_idx);
+        next_opt = getopt_long(argc,
+                               argv,
+                               "hls:k:dt:v:c:i:m:",
+                               long_options,
+                               &opt_idx);
+
+        switch (next_opt) {
+        case 'h':
+            print_help(stdout, 0);
+            break;
 
-        switch(next_opt)
-        {
-            case 'h':
-                print_help(stdout, 0);
-                break;
+        case 'l':
+            if (!display_widget_info()) {
+                printf("Fail to display the list of installed widgets");
+                return -1;
+            }
+            break;
 
-            case 'l':
-                if(!display_widget_info())
-                {
-                    printf("Fail to display the list of installed widgets");
-                    return -1;
-                }
-                break;
+        case 's':
+        case 'k':
+            strncpy(temp_arg, optarg, strlen(optarg));
+            op = next_opt;
+            break;
 
-            case 's':
-            case 'k':
-                strncpy(temp_arg, optarg, strlen(optarg));
-                op = next_opt;
-                break;
+        case 't':
+            timeout = atoi(optarg);
+            if (timeout < 0 ) {
+                timeout = TIMEOUT_DEFAULT;
+            }
+            break;
 
-            case 't':
-                timeout = atoi(optarg);
-                if(timeout < 0 )
-                    timeout = TIMEOUT_DEFAULT;
-                break;
+        case 'd':
+            // create service
+            ret = service_create(&serviceHandle);
+            if (SERVICE_ERROR_NONE != ret && NULL == serviceHandle) {
+                LogError("Fail to create service");
+                return FALSE;
+            }
 
-            case 'd':
-                // create bundle data
-                b = bundle_create();
-                bundle_add(b, "debug", "true");
-                snprintf(pid, sizeof(pid), "%d", getpid());
-                bundle_add(b, "pid", pid);
-                break;
+            // set debug mode
+            ret = service_add_extra_data(serviceHandle,
+                                         "debug",
+                                         "true");
+            if (SERVICE_ERROR_NONE != ret) {
+                LogError("Fail to set debug mode [" << ret << "]");
+                service_destroy(serviceHandle);
+                return FALSE;
+            }
+
+            // set pid
+            snprintf(pid, sizeof(pid), "%d", getpid());
+            ret = service_add_extra_data(serviceHandle,
+                                         "pid",
+                                         pid);
+            if (SERVICE_ERROR_NONE != ret) {
+                LogError("Fail to set pid [" << ret << "]");
+                service_destroy(serviceHandle);
+                return FALSE;
+            }
+            break;
 
-            case 'v':
-                strncpy(temp_arg, optarg, strlen(optarg));
-                if (NULL == g_dbConnection)
-                {
-                    Try {
-                        g_dbConnection.Reset(new DBConnection());
-                        g_dbConnection->AttachDatabase();
-                    }
-                    Catch (DPL::DB::SqlConnection::Exception::Base) {
-                        LogDebug("Fail to connect DB");
-                        return FALSE;
-                    }
+        case 'v':
+            strncpy(temp_arg, optarg, strlen(optarg));
+            if (NULL == g_dbConnection) {
+                Try {
+                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection->AttachDatabase();
                 }
-                if(!strcmp("1", temp_arg))
-                {
-                    WrtDB::GlobalDAO::SetDeveloperMode(true);
+                Catch (DPL::DB::SqlConnection::Exception::Base) {
+                    LogDebug("Fail to connect DB");
+                    return FALSE;
                 }
-                else
-                {
-                    WrtDB::GlobalDAO::SetDeveloperMode(false);
+            }
+            if (!strcmp("1", temp_arg)) {
+                WrtDB::GlobalDAO::SetDeveloperMode(true);
+            } else {
+                WrtDB::GlobalDAO::SetDeveloperMode(false);
+            }
+            break;
+        case 'c':
+            strncpy(temp_arg, optarg, strlen(optarg));
+            if (NULL == g_dbConnection) {
+                Try {
+                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection->AttachDatabase();
                 }
-                break;
-            case 'c':
-                strncpy(temp_arg, optarg, strlen(optarg));
-                if (NULL == g_dbConnection)
-                {
-                    Try {
-                        g_dbConnection.Reset(new DBConnection());
-                        g_dbConnection->AttachDatabase();
-                    }
-                    Catch (DPL::DB::SqlConnection::Exception::Base) {
-                        LogDebug("Fail to connect DB");
-                        return FALSE;
-                    }
+                Catch (DPL::DB::SqlConnection::Exception::Base) {
+                    LogDebug("Fail to connect DB");
+                    return FALSE;
                 }
-                if(!strcmp("1", temp_arg))
-                {
-                    WrtDB::GlobalDAO::setComplianceMode(true);
+            }
+            if(!strcmp("1", temp_arg)) {
+                WrtDB::GlobalDAO::setComplianceMode(true);
+            } else {
+                WrtDB::GlobalDAO::setComplianceMode(false);
+            }
+            break;
+        case 'i':
+            strncpy(temp_arg, optarg, strlen(optarg));
+            if (NULL == g_dbConnection) {
+                Try {
+                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection->AttachDatabase();
                 }
-                else
-                {
-                    WrtDB::GlobalDAO::setComplianceMode(false);
+                Catch (DPL::DB::SqlConnection::Exception::Base) {
+                    LogDebug("Fail to connect DB");
+                    return FALSE;
                 }
-                break;
-            case 'i':
-                strncpy(temp_arg, optarg, strlen(optarg));
-                if (NULL == g_dbConnection)
-                {
-                    Try {
-                        g_dbConnection.Reset(new DBConnection());
-                        g_dbConnection->AttachDatabase();
-                    }
-                    Catch (DPL::DB::SqlConnection::Exception::Base) {
-                        LogDebug("Fail to connect DB");
-                        return FALSE;
-                    }
+            }
+            WrtDB::GlobalDAO::setComplianceFakeImei(temp_arg);
+            break;
+        case 'm':
+            strncpy(temp_arg, optarg, strlen(optarg));
+            if (NULL == g_dbConnection) {
+                Try {
+                    g_dbConnection.Reset(new DBConnection());
+                    g_dbConnection->AttachDatabase();
                 }
-                WrtDB::GlobalDAO::setComplianceFakeImei(temp_arg);
-                break;
-            case 'm':
-                strncpy(temp_arg, optarg, strlen(optarg));
-                if (NULL == g_dbConnection)
-                {
-                    Try {
-                        g_dbConnection.Reset(new DBConnection());
-                        g_dbConnection->AttachDatabase();
-                    }
-                    Catch (DPL::DB::SqlConnection::Exception::Base) {
-                        LogDebug("Fail to connect DB");
-                        return FALSE;
-                    }
+                Catch (DPL::DB::SqlConnection::Exception::Base) {
+                    LogDebug("Fail to connect DB");
+                    return FALSE;
                 }
-                WrtDB::GlobalDAO::setComplianceFakeMeid(temp_arg);
-                break;
-
-            case 'w':
-            {
-                strncpy(temp_arg, optarg, strlen(optarg));
-                // run mode change script
-                // wrt_change_client.sh <pkgname>
-                std::stringstream sstr;
-                sstr << WRT_CHANGE_CLIENT_SH;
-                sstr << " ";
-                sstr << temp_arg;
-
-                std::string  scriptCommand = sstr.str();
-                system(scriptCommand.c_str());
             }
+            WrtDB::GlobalDAO::setComplianceFakeMeid(temp_arg);
             break;
 
-            case -1:
-                break;
+        case -1:
+            break;
 
-            default:
-                print_help(stdout, 0);
-                break;
+        default:
+            print_help(stdout, 0);
+            break;
         }
-    }while (next_opt != -1);
+    } while (next_opt != -1);
 
-    if((op == 's')||(op == 'k'))
-    {
+    if ((op == 's') || (op == 'k')) {
         const char *temp = NULL;
 
-        if (NULL == g_dbConnection)
-        {
+        if (NULL == g_dbConnection) {
             Try {
                 g_dbConnection.Reset(new DBConnection());
                 g_dbConnection->AttachDatabase();
@@ -405,57 +380,50 @@ int main(int argc, char* argv[])
         }
 
         WidgetHandleList widgetList = WrtDB::WidgetDAOReadOnly::getHandleList();
-        FOREACH(iterator, widgetList)
-        {
+        FOREACH(iterator, widgetList) {
             WrtDB::WidgetDAOReadOnly dao(*iterator);
             WrtDB::WidgetGUID d_guid = dao.getGUID();
             DPL::OptionalString d_pkgname = dao.getPkgname();
-           if(!d_guid.IsNull() && !strcmp(DPL::ToUTF8String(*d_guid).c_str(), temp_arg))
+            if (!d_guid.IsNull() &&
+                !strcmp(DPL::ToUTF8String(*d_guid).c_str(), temp_arg))
             {
                 DPL::Optional<DPL::String> package_name = dao.getPkgname();
                 temp = DPL::ToUTF8String(*package_name).c_str();
                 break;
             }
-            if(!strcmp(DPL::ToUTF8String(*d_pkgname).c_str(), temp_arg))
-            {
+            if (!strcmp(DPL::ToUTF8String(*d_pkgname).c_str(), temp_arg)) {
                 DPL::Optional<DPL::String> package_name = dao.getPkgname();
                 temp = DPL::ToUTF8String(*package_name).c_str();
                 break;
             }
-       }
+        }
 
-        if(temp !=NULL)
-        {
+        if (temp != NULL) {
             strncpy(pkgname, (char *)temp, strlen(temp));
-        }
-        else
-        {
+        } else {
             printf("result: %s\n", "failed");
             return -1;
         }
     }
 
-    if(op == 's')
-    {
+    if (op == 's') {
         /* check if this is request for debug mode, or not */
-        if(b != NULL)
-        {
+        if (serviceHandle != NULL) {
             /* wait for return from the widget */
             sigemptyset(&sigact.sa_mask);
             sigact.sa_flags = SA_SIGINFO;
             sigact.sa_restorer = NULL;
             sigact.sa_sigaction = sighandler;
 
-            if (sigaction(SIGRTMIN, &sigact, 0) == 1)
-            {
-               printf("signal error\n");
-               return -1;
+            if (sigaction(SIGRTMIN, &sigact, 0) == 1) {
+                printf("signal error\n");
+                return -1;
             }
         }
 
-        if(strlen(pkgname) > 0)
-        {
-            // do setuid to '5000' uid to communicate with webapp using RT signal.
+        if (strlen(pkgname) > 0) {
+            // do setuid to '5000' uid to communicate
+            //with webapp using RT signal.
             gid_t group_list[1];
             group_list[0] = LOGGING_DEFAULT_GID;
 
@@ -469,42 +437,73 @@ int main(int argc, char* argv[])
                 return -1;
             }
 
-            ret = aul_launch_app(pkgname, b);
-        }
-        else
-        {
+            // set package
+            ret = service_set_package(serviceHandle, pkgname);
+            if (SERVICE_ERROR_NONE != ret) {
+                LogError("Fail to set package [" << ret << "]");
+                service_destroy(serviceHandle);
+                return -1;
+            }
+
+            //launch service
+            ret = service_send_launch_request(serviceHandle, NULL, NULL);
+            if (SERVICE_ERROR_NONE != ret) {
+                LogError("Fail to launch service [" << ret << "]");
+                service_destroy(serviceHandle);
+                return -1;
+            }
+
+            service_destroy(serviceHandle);
+        } else {
             printf("result: %s\n", "failed");
             return -1;
         }
 
-        if(b != NULL)
-        {
+        if (serviceHandle != NULL) {
             // wait RTS signal from widget by 5 second
             sleep(timeout);
             printf("result: %s\n", "failed");
             return -1;
         }
 
-        if(ret > 0)
-        {
+        if (ret > 0) {
             printf("result: %s\n", "launched");
-        }
-        else
-        {
+        } else {
             printf("result: %s\n", "failed");
             return -1;
         }
-    }
-    else if(op == 'k')
-    {
-        ret = aul_app_get_running_app_info(kill_widget, pkgname);
+    } else if (op == 'k') {
+        bool isRunning = false;
 
-        if(AUL_R_OK == ret)
-        {
-            printf("result: %s\n", "killed");
+        //checks whether the application is running
+        ret = app_manager_is_running(pkgname, &isRunning);
+        if (APP_MANAGER_ERROR_NONE != ret) {
+            printf("result: %s\n", "failed");
+            return -1;
         }
-        else
-        {
+
+        if (true == isRunning) {
+            // get app_context for running application
+            // app_context must be released with app_context_destroy
+            app_context_h appCtx = NULL;
+            ret = app_manager_get_app_context(pkgname, &appCtx);
+            if (APP_MANAGER_ERROR_NONE != ret) {
+                printf("result: %s\n", "failed");
+                return -1;
+            }
+
+            // terminate app_context_h
+            ret = app_manager_terminate_app(appCtx);
+            if (APP_MANAGER_ERROR_NONE != ret) {
+                printf("result: %s\n", "failed");
+                app_context_destroy(appCtx);
+                return -1;
+            } else {
+                printf("result: %s\n", "killed");
+                app_context_destroy(appCtx);
+                return 0;
+            }
+        } else {
             printf("result: %s\n", "failed");
             return -1;
         }
@@ -516,24 +515,20 @@ int main(int argc, char* argv[])
 static void sighandler(int signo, siginfo_t *si, void* /*data*/)
 {
     /* check if this signal is type of RTS */
-    if(si->si_code == SI_QUEUE)
-    {
+    if (si->si_code == SI_QUEUE) {
         //int port;
         //printf("RTS pid : %d\n", si->si_pid);
         //port = (int) si->si_value.sival_ptr;
         //printf("RTS debug port : %d\n", port);
         // This sival_int is wrt's status (like WRT_SUCCESS..)
         // enum WRT_SUCCESS is 0
-        if(si->si_value.sival_int > 0)
-        {
+        if (si->si_value.sival_int > 0) {
             printf("port: %d\n", (int)si->si_value.sival_int);
             printf("result: %s\n", "launched");
-         }
-        else
+        } else {
             printf("result: %s\n", "failed");
-    }
-    else
-    {
+        }
+    } else {
         printf("Not RT signal : %d\n", signo);
     }
     exit (0);