summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImran Zaman <imran.zaman@intel.com>2012-07-06 13:12:16 +0300
committerImran Zaman <imran.zaman@intel.com>2012-07-06 13:12:16 +0300
commiteccb4b05019c419d66978179f44297c7b0e79710 (patch)
tree026782ae7946e5a7355221324a82fe6a715cf939
parent0f4b9658ad24fffa8a2edf78e09cf686c4bbb84d (diff)
downloadwrt-plugins-tizen-1.0_post.tar.gz
wrt-plugins-tizen-1.0_post.tar.bz2
wrt-plugins-tizen-1.0_post.zip
Application FW - install/uninstall/update APIs implementation1.0_post
Change-Id: Ic3edc05a87822a8da5ba8d7819b0e129cbe6b8fd
-rwxr-xr-xCMakeLists.txt11
-rw-r--r--packaging/wrt-plugins-tizen.spec1
-rwxr-xr-xsrc/platform/API/Application/ApplicationInformation.cpp19
-rwxr-xr-xsrc/platform/API/Application/ApplicationInformation.h6
-rwxr-xr-xsrc/platform/API/Application/ApplicationInstallInfo.cpp73
-rwxr-xr-xsrc/platform/API/Application/ApplicationInstallInfo.h56
-rwxr-xr-xsrc/platform/API/Application/EventApplicationInstall.h106
-rwxr-xr-xsrc/platform/API/Application/IApplication.cpp3
-rwxr-xr-xsrc/platform/API/Application/IApplication.h8
-rwxr-xr-xsrc/platform/API/Application/config.cmake1
-rwxr-xr-xsrc/platform/Tizen/Application/Application.cpp306
-rwxr-xr-xsrc/platform/Tizen/Application/Application.h13
-rw-r--r--src/platform/Tizen/Application/ApplicationCrypto.cpp105
-rw-r--r--src/platform/Tizen/Application/ApplicationCrypto.h52
-rwxr-xr-xsrc/platform/Tizen/Application/config.cmake24
-rwxr-xr-xsrc/standards/Tizen/Application/ApplicationAnswerReceiver.cpp95
-rwxr-xr-xsrc/standards/Tizen/Application/ApplicationAnswerReceiver.h8
-rwxr-xr-xsrc/standards/Tizen/Application/ApplicationConverter.cpp82
-rwxr-xr-xsrc/standards/Tizen/Application/ApplicationConverter.h3
-rwxr-xr-xsrc/standards/Tizen/Application/CMakeLists.txt1
-rwxr-xr-xsrc/standards/Tizen/Application/JSApplication.cpp209
-rwxr-xr-xsrc/standards/Tizen/Application/JSApplication.h18
-rwxr-xr-xsrc/standards/Tizen/Application/JSApplicationInformation.cpp14
-rwxr-xr-xsrc/standards/Tizen/Application/JSApplicationInformation.h4
-rwxr-xr-xsrc/standards/Tizen/Application/JSApplicationInstallInfo.cpp187
-rwxr-xr-xsrc/standards/Tizen/Application/JSApplicationInstallInfo.h90
-rwxr-xr-xsrc/standards/Tizen/Application/config.xml5
-rwxr-xr-xsrc/standards/Tizen/Application/plugin_config.cpp40
-rwxr-xr-xsrc/standards/Tizen/Application/plugin_config.h5
29 files changed, 1531 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3b3ec8..b03c4b1 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,17 @@ ELSE(DPL_LOG)
ENDIF(DPL_LOG)
###############################################################################
+# Enable/disable widget decryption
+OPTION(WGT_DECRYPTION "Widget decryption status" OFF)
+
+IF(WGT_DECRYPTION)
+ MESSAGE(STATUS "Widget decryption enabled")
+ ADD_DEFINITIONS(-DWIDGET_DECRYPTION_ENABLED)
+ELSE(WGT_DECRYPTION)
+ MESSAGE(STATUS "Widget decryption disabled")
+ENDIF(WGT_DECRYPTION)
+
+###############################################################################
# Set build type (Release by default)
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE Release)
diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec
index b84054b..1496030 100644
--- a/packaging/wrt-plugins-tizen.spec
+++ b/packaging/wrt-plugins-tizen.spec
@@ -39,6 +39,7 @@ BuildRequires: pkgconfig(capi-social-call-log)
BuildRequires: pkgconfig(capi-telephony-call)
BuildRequires: pkgconfig(capi-system-sensor)
BuildRequires: pkgconfig(capi-system-power)
+BuildRequires: pkgconfig(pkgmgr)
BuildRequires: expat-devel
BuildRequires: cmake
BuildRequires: gettext-devel
diff --git a/src/platform/API/Application/ApplicationInformation.cpp b/src/platform/API/Application/ApplicationInformation.cpp
index 7079159..c5ce122 100755
--- a/src/platform/API/Application/ApplicationInformation.cpp
+++ b/src/platform/API/Application/ApplicationInformation.cpp
@@ -77,6 +77,25 @@ void ApplicationInformation::setShow(const bool &show)
m_show = show;
}
+time_t ApplicationInformation::getInstallDate() const
+{
+ return m_installDate;
+}
+
+void ApplicationInformation::setInstallDate(const time_t &date)
+{
+ m_installDate = date;
+}
+
+long ApplicationInformation::getSize() const
+{
+ return m_installSize;
+}
+
+void ApplicationInformation::setSize(const long &size)
+{
+ m_installSize = size;
+}
}
}
diff --git a/src/platform/API/Application/ApplicationInformation.h b/src/platform/API/Application/ApplicationInformation.h
index 0d1b447..111927d 100755
--- a/src/platform/API/Application/ApplicationInformation.h
+++ b/src/platform/API/Application/ApplicationInformation.h
@@ -48,6 +48,10 @@ class ApplicationInformation
void setVersion(const std::string &version);
bool getShow() const;
void setShow(const bool &show);
+ time_t getInstallDate() const;
+ void setInstallDate(const time_t &date);
+ long getSize() const;
+ void setSize(const long &size);
private:
std::string m_name;
@@ -55,6 +59,8 @@ class ApplicationInformation
std::string m_iconPath;
std::string m_version;
bool m_show;
+ time_t m_installDate;
+ long m_installSize;
};
}
}
diff --git a/src/platform/API/Application/ApplicationInstallInfo.cpp b/src/platform/API/Application/ApplicationInstallInfo.cpp
new file mode 100755
index 0000000..ce0b6fa
--- /dev/null
+++ b/src/platform/API/Application/ApplicationInstallInfo.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ApplicationInstallInfo.h"
+
+namespace TizenApis {
+namespace Api {
+namespace Application {
+ApplicationInstallInfo::ApplicationInstallInfo()
+{
+}
+
+ApplicationInstallInfo::~ApplicationInstallInfo()
+{
+}
+
+std::string ApplicationInstallInfo::getFilePath() const
+{
+ return m_filePath;
+}
+
+void ApplicationInstallInfo::setFilePath(const std::string &filePath)
+{
+ m_filePath = filePath;
+}
+
+std::string ApplicationInstallInfo::getAlgorithm() const
+{
+ return m_algorithm;
+}
+
+void ApplicationInstallInfo::setAlgorithm(const std::string &algorithm)
+{
+ m_algorithm = algorithm;
+}
+
+std::string ApplicationInstallInfo::getKey() const
+{
+ return m_key;
+}
+
+void ApplicationInstallInfo::setKey(const std::string &version)
+{
+ m_key = version;
+}
+
+std::string ApplicationInstallInfo::getPackageFormat() const
+{
+ return m_packageFormat;
+}
+
+void ApplicationInstallInfo::setPackageFormat(const std::string &packageFormat)
+{
+ m_packageFormat = packageFormat;
+}
+
+
+}
+}
+}
diff --git a/src/platform/API/Application/ApplicationInstallInfo.h b/src/platform/API/Application/ApplicationInstallInfo.h
new file mode 100755
index 0000000..517daed
--- /dev/null
+++ b/src/platform/API/Application/ApplicationInstallInfo.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TIZENAPIS_API_APPLICATION_INSTALL_INFO_H_
+#define TIZENAPIS_API_APPLICATION_INSTALL_INFO_H_
+
+#include <string>
+#include <vector>
+#include <dpl/log/log.h>
+#include <dpl/shared_ptr.h>
+
+namespace TizenApis {
+namespace Api {
+namespace Application {
+
+class ApplicationInstallInfo;
+typedef DPL::SharedPtr<ApplicationInstallInfo> ApplicationInstallInfoPtr;
+
+class ApplicationInstallInfo
+{
+ public:
+ ApplicationInstallInfo();
+ ~ApplicationInstallInfo();
+
+ std::string getFilePath() const;
+ void setFilePath(const std::string &filepath);
+ std::string getAlgorithm() const;
+ void setAlgorithm(const std::string &algorithm);
+ std::string getKey() const;
+ void setKey(const std::string &key);
+ std::string getPackageFormat() const;
+ void setPackageFormat(const std::string &packageFormat);
+
+ private:
+ std::string m_filePath;
+ std::string m_algorithm;
+ std::string m_key;
+ std::string m_packageFormat;
+};
+}
+}
+}
+#endif
diff --git a/src/platform/API/Application/EventApplicationInstall.h b/src/platform/API/Application/EventApplicationInstall.h
new file mode 100755
index 0000000..659520d
--- /dev/null
+++ b/src/platform/API/Application/EventApplicationInstall.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TIZENAPIS_API_EVENT_APPLICATION_INSTALL_H_
+#define TIZENAPIS_API_EVENT_APPLICATION_INSTALL_H_
+
+
+
+#include <Commons/IEvent.h>
+#include <dpl/shared_ptr.h>
+#include "ApplicationInstallInfo.h"
+#include <dpl/log/log.h>
+
+namespace TizenApis {
+namespace Api {
+namespace Application {
+
+class EventApplicationInstall: public WrtDeviceApis::Commons::IEvent<EventApplicationInstall> {
+
+private:
+ ApplicationInstallInfoPtr m_appInstallInfo;
+ ApplicationInformationPtr m_appinfo;
+ std::string m_appId;
+ int m_callbackType;
+ int m_eventType;
+
+public:
+/* CALLBACK TYPE */
+ static const int APPLICATION_INSTALL_UNKNOWN = 0;
+ static const int APPLICATION_INSTALL_INSTALL_CALLBACK = 1;
+ static const int APPLICATION_INSTALL_UNINSTALL_CALLBACK = 2;
+ static const int APPLICATION_INSTALL_UPDATE_CALLBACK = 3;
+/* EVENT TYPE */
+ static const int APPLICATION_INSTALL_INSTALL = 4;
+ static const int APPLICATION_INSTALL_UNINSTALL = 5;
+ static const int APPLICATION_INSTALL_UPDATE = 6;
+ public:
+
+ void setAppInstallInfo(ApplicationInstallInfoPtr &appInstallInfo){
+ m_appInstallInfo = appInstallInfo;
+ }
+
+ ApplicationInstallInfoPtr getAppInstallInfo() const{
+ return m_appInstallInfo;
+ }
+ void setApplicationInformation(const ApplicationInformationPtr appinfo)
+ {
+ m_appinfo = appinfo;
+ }
+
+ ApplicationInformationPtr getApplicationInformation() const
+ {
+ return m_appinfo;
+ }
+
+ void setAppId(std::string appId)
+ {
+ m_appId = appId;
+ }
+
+ std::string getAppId() const
+ {
+ return m_appId;
+ }
+
+ void setCallbackType(int callbacktype){
+ m_callbackType = callbacktype;
+ }
+
+ int getCallbackType() const{
+ return m_callbackType;
+ }
+
+ void setEventType(int type){
+ m_eventType = type;
+ }
+
+ int getEventType(){
+ return m_eventType;
+ }
+
+ EventApplicationInstall()
+ {
+ }
+};
+
+typedef DPL::SharedPtr<EventApplicationInstall> EventApplicationInstallPtr;
+
+} // Application
+} // Api
+} // TizenApis
+
+#endif
diff --git a/src/platform/API/Application/IApplication.cpp b/src/platform/API/Application/IApplication.cpp
index a3357d9..2954a9d 100755
--- a/src/platform/API/Application/IApplication.cpp
+++ b/src/platform/API/Application/IApplication.cpp
@@ -26,7 +26,8 @@ IApplication::IApplication() :
EventRequestReceiver<EventListInstalledApplications>(ThreadEnum::APPLICATION_THREAD),
EventRequestReceiver<EventManageApplication>(ThreadEnum::APPLICATION_THREAD),
EventRequestReceiver<EventGetApplication>(ThreadEnum::APPLICATION_THREAD),
- EventRequestReceiver<EventLaunchService>(ThreadEnum::APPLICATION_THREAD)
+ EventRequestReceiver<EventLaunchService>(ThreadEnum::APPLICATION_THREAD),
+ EventRequestReceiver<EventApplicationInstall>(ThreadEnum::APPLICATION_THREAD)
{
}
diff --git a/src/platform/API/Application/IApplication.h b/src/platform/API/Application/IApplication.h
index f265376..4a7f7be 100755
--- a/src/platform/API/Application/IApplication.h
+++ b/src/platform/API/Application/IApplication.h
@@ -24,6 +24,7 @@
#include "EventGetApplication.h"
#include "EventInstalledApplicationChanged.h"
#include "EventLaunchService.h"
+#include "EventApplicationInstall.h"
namespace TizenApis {
namespace Api {
@@ -37,7 +38,8 @@ class EventLaunchService;
class IApplication: public WrtDeviceApis::Commons::EventRequestReceiver<EventListInstalledApplications>,
public WrtDeviceApis::Commons::EventRequestReceiver<EventManageApplication>,
public WrtDeviceApis::Commons::EventRequestReceiver<EventGetApplication>,
- public WrtDeviceApis::Commons::EventRequestReceiver<EventLaunchService>
+ public WrtDeviceApis::Commons::EventRequestReceiver<EventLaunchService>,
+ public WrtDeviceApis::Commons::EventRequestReceiver<EventApplicationInstall>
{
public:
virtual ~IApplication();
@@ -49,6 +51,9 @@ public:
virtual void removeApplicationInformationEventListener(const EventInstalledApplicationChangedEmitter::IdType id) = 0;
virtual void launchService(const EventLaunchServicePtr& event) = 0;
virtual void getApplicationService(const EventLaunchServicePtr& event) = 0;
+ virtual void install(const EventApplicationInstallPtr& event) = 0;
+ virtual void uninstall(const EventApplicationInstallPtr& event) = 0;
+ virtual void update(const EventApplicationInstallPtr& event) = 0;
protected:
IApplication();
@@ -57,6 +62,7 @@ public:
virtual void OnRequestReceived(const EventManageApplicationPtr& event) = 0;
virtual void OnRequestReceived(const EventGetApplicationPtr& event) = 0;
virtual void OnRequestReceived(const EventLaunchServicePtr& event) = 0;
+ virtual void OnRequestReceived(const EventApplicationInstallPtr& event) = 0;
};
diff --git a/src/platform/API/Application/config.cmake b/src/platform/API/Application/config.cmake
index dbd3b34..8fc8593 100755
--- a/src/platform/API/Application/config.cmake
+++ b/src/platform/API/Application/config.cmake
@@ -7,5 +7,6 @@ set(SRCS_PLATFORM_API_APPLICATION
${CURRENT_PATH}/ApplicationEvent.cpp
${CURRENT_PATH}/ApplicationService.cpp
${CURRENT_PATH}/ApplicationServiceData.cpp
+ ${CURRENT_PATH}/ApplicationInstallInfo.cpp
PARENT_SCOPE
)
diff --git a/src/platform/Tizen/Application/Application.cpp b/src/platform/Tizen/Application/Application.cpp
index 97d0b70..1a6b5f5 100755
--- a/src/platform/Tizen/Application/Application.cpp
+++ b/src/platform/Tizen/Application/Application.cpp
@@ -31,6 +31,10 @@
#include <API/Application/ApplicationService.h>
#include <dpl/log/log.h>
+#include <package-manager.h>
+
+#include "ApplicationCrypto.h"
+
namespace TizenApis {
namespace Platform {
namespace Application {
@@ -171,6 +175,33 @@ namespace {
return result;
}
+ static void addPackageData(const char* package, ApplicationInformationPtr appinfo)
+ {
+ //TODO: check what should be the package type to be used here
+ pkgmgr_info *pkg_info = pkgmgr_info_new("wgt", package);
+ if (pkg_info == NULL) {
+ pkg_info = pkgmgr_info_new("deb", package);
+ }
+ if (pkg_info != NULL) {
+ char *installed_date = pkgmgr_info_get_string(pkg_info, "installed_time");
+ char *installed_size = pkgmgr_info_get_string(pkg_info, "installed_size");
+ if (installed_date) {
+ time_t date = (time_t)strtol(installed_date, (char**)NULL, 10);
+ appinfo->setInstallDate(date);
+ free(installed_date);
+ LogDebug("addPackageData for pkgname :"<<package<<" with date :" << date);
+ }
+ if (installed_size) {
+ long size = (long)strtol(installed_size, (char**)NULL, 10);
+ appinfo->setSize(size);
+ free(installed_size);
+ LogDebug("addPackageData for pkgname :"<<package<<" with size :" << size);
+ }
+ pkgmgr_info_free(pkg_info);
+ pkg_info = NULL;
+ }
+
+ }
static bool installedAppListCallback(const char *package, void *user_data)
{
@@ -192,7 +223,9 @@ namespace {
appinfo->setIconPath(iconPath);
appinfo->setVersion(version);
appinfo->setShow(show);
-
+
+ addPackageData(package,appinfo);
+
event->addApplicationInformation(appinfo);
if (name)
free(name);
@@ -345,6 +378,49 @@ namespace {
return true;
}
+ static int installAppResultCallback(int req_id, const char *pkg_type,
+ const char *pkg_name, const char *key, const char *val,
+ const void *pmsg, void *priv_data)
+ {
+
+
+ LogDebug("installAppResultCallback called with req_id: [" << req_id
+ << "] pkg_type: [" << pkg_type << "] pkg_name: [" << pkg_name << "] key: [" << key << "] val: [" << val << "]");
+
+ if (key && strncmp(key, "end", strlen("end")) == 0) {
+ int result = EXIT_SUCCESS;
+ if (strncasecmp(val, "ok", strlen("ok")) != 0) {
+ result = EXIT_FAILURE; //error_code
+ }
+
+ if(priv_data != NULL) {
+ ((Application*)priv_data)->installAppAnswer(req_id,pkg_type,pkg_name,key,val,pmsg,result);
+ }
+ }
+
+ return 0;
+ }
+
+ static int isAppInstalled(char *pkgname)
+ {
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ char *str = NULL;
+ ret = ail_package_get_appinfo(pkgname, &handle);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &str);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+ ret = ail_package_destroy_appinfo(handle);
+ if (ret != AIL_ERROR_OK) {
+ return -1;
+ }
+
+ return 0;
+ }
}
Application::Application() :
@@ -456,6 +532,32 @@ void Application::getApplicationService(const EventLaunchServicePtr& event)
EventRequestReceiver<EventLaunchService>::PostRequest(event);
}
+void Application::install(const EventApplicationInstallPtr& event)
+{
+ if (m_initialized == false) {
+ initialize();
+ }
+
+ EventRequestReceiver<EventApplicationInstall>::PostRequest(event);
+}
+
+void Application::uninstall(const EventApplicationInstallPtr& event)
+{
+ if (m_initialized == false) {
+ initialize();
+ }
+
+ EventRequestReceiver<EventApplicationInstall>::PostRequest(event);
+}
+
+void Application::update(const EventApplicationInstallPtr& event)
+{
+ if (m_initialized == false) {
+ initialize();
+ }
+
+ EventRequestReceiver<EventApplicationInstall>::PostRequest(event);
+}
void Application::InstalledApplicationChanged(app_manger_event_type_e event_type, const char *package)
{
@@ -490,6 +592,8 @@ void Application::InstalledApplicationChanged(app_manger_event_type_e event_type
appinfo->setIconPath(iconPath);
appinfo->setVersion(version);
appinfo->setShow(show);
+
+ addPackageData(package,appinfo);
}
switch (event_type) {
@@ -573,6 +677,92 @@ void Application::callKillEventCallback(int pid)
EventRequestReceiver<EventManageApplication>::ManualAnswer(event);
}
}
+
+void Application::installAppAnswer(int req_id,
+ const char* pkg_type,
+ const char* pkg_name,
+ const char* key,
+ const char* val,
+ const void* pmsg,
+ int result)
+{
+ if (m_eventAppInstallPtr == NULL) {
+ return;
+ }
+
+ switch(m_eventAppInstallPtr->getEventType()) {
+ case EventApplicationInstall::APPLICATION_INSTALL_INSTALL:
+ case EventApplicationInstall::APPLICATION_INSTALL_UPDATE: {
+ /* TODO: this needs to be either done in package manager or here
+ * 1- delete the store file if decryption is done
+ * 2- retrieve the installed date and size from package manager for the given package
+ * 3- retrieve the rest of the info (e.g. name, version, iconPath) from app-manager (if not already in there,
+ * need to store the info there)
+ * 4- construct the result to be passed onto the user
+ * */
+ if (result == EXIT_SUCCESS) {
+ ApplicationInstallInfoPtr appInstallInfo = m_eventAppInstallPtr->getAppInstallInfo();
+
+ char *name = NULL;
+ char *appId = NULL;
+ char *iconPath = NULL;
+ char *version = NULL;
+
+ const char * cpkg_name = pkg_name;
+ appId = getIdFromPackage(cpkg_name);
+
+ ApplicationInformationPtr appinfo(new ApplicationInformation());
+ if( app_manager_get_app_name(cpkg_name, &name) < 0 ||
+ app_manager_get_app_icon_path(cpkg_name, &iconPath) < 0 ) {
+ LogError("can not get the information of "<<appId<<" package");
+ m_eventAppInstallPtr->setExceptionCode(Commons::ExceptionCodes::NotFoundException);
+ } else {
+ if(app_manager_get_app_version(cpkg_name, &version) < 0) {
+ LogWarning("can not get the version information of "<<appId<<" package");
+ }
+ appinfo->setName(name);
+ appinfo->setAppId(appId);
+ appinfo->setIconPath(iconPath);
+ appinfo->setVersion(version);
+ appinfo->setShow(getShowFromPackage(cpkg_name));
+
+ addPackageData(cpkg_name,appinfo);
+
+ m_eventAppInstallPtr->setApplicationInformation(appinfo);
+
+ }
+
+ if (name) free(name);
+ if (appId) free(appId);
+ if (iconPath) free(iconPath);
+ if (version) free(version);
+ } else {
+ LogError("Application installation failed for pkgname :"<<pkg_name<<" package");
+ m_eventAppInstallPtr->setExceptionCode(Commons::ExceptionCodes::PlatformException);
+ }
+ LogDebug("Send Response for APPLICATION_INSTALL_INSTALL/UPDATE request");
+ EventRequestReceiver<EventApplicationInstall>::ManualAnswer(m_eventAppInstallPtr);
+ break;
+ }
+ case EventApplicationInstall::APPLICATION_INSTALL_UNINSTALL: {
+ if (result == EXIT_FAILURE) {
+ LogError("Application uninstallation failed for pkgname :"<<pkg_name<<" package");
+ m_eventAppInstallPtr->setExceptionCode(Commons::ExceptionCodes::PlatformException);
+ }
+ LogDebug("Send Response for APPLICATION_INSTALL_UNINSTALL request");
+ EventRequestReceiver<EventApplicationInstall>::ManualAnswer(m_eventAppInstallPtr);
+ break;
+ }
+ default:
+ LogError("[ERROR] UNKNOWN EVENT TYPE");
+ m_eventAppInstallPtr->setExceptionCode(Commons::ExceptionCodes::UnknownException);
+ EventRequestReceiver<EventApplicationInstall>::ManualAnswer(m_eventAppInstallPtr);
+ break;
+ }
+
+}
+
+
void Application::OnRequestReceived(const EventManageApplicationPtr& event)
{
switch (event->getEventType()) {
@@ -707,6 +897,8 @@ void Application::OnRequestReceived(const EventGetApplicationPtr& event)
appinfo->setIconPath(iconPath);
appinfo->setVersion(version);
appinfo->setShow(getShowFromPackage(package));
+ addPackageData(package,appinfo);
+
event->setApplicationInformation(appinfo);
}
@@ -963,6 +1155,118 @@ void Application::OnRequestReceived(const EventLaunchServicePtr& event)
}
}
+void Application::OnRequestReceived(const EventApplicationInstallPtr& event)
+{
+ switch(event->getEventType()) {
+ case EventApplicationInstall::APPLICATION_INSTALL_INSTALL:
+ case EventApplicationInstall::APPLICATION_INSTALL_UPDATE: {
+
+ LogDebug("APPLICATION_INSTALL_INSTALL/APPLICATION_INSTALL_UPDATE request received");
+ ApplicationInstallInfoPtr appInstallInfo = event->getAppInstallInfo();
+ std::string filePath = appInstallInfo->getFilePath();
+
+#ifdef WIDGET_DECRYPTION_ENABLED
+ std::string algo = appInstallInfo->getAlgorithm();
+ std::string key = appInstallInfo->getKey();
+ if (!algo.empty() && !key.empty()) {
+
+ std::string decFilePath = filePath.substr(0,filePath.find(".wgt")) + "-dec.wgt";
+ LogDebug("App key: " << key << " algo: " << algo << " decpath: " <<decFilePath);
+ if (ApplicationCrypto::wgtDecrypt(filePath.c_str(),decFilePath.c_str(), key.c_str(), 7) != 0) {
+ LogError("[ERROR] Decryption of wgt file failed");
+ event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
+ break;
+ }
+ filePath = decFilePath;
+ }
+#endif
+ pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
+ if(pc == NULL){
+ LogError("[ERROR] pkgmgr_client_install - unable to create client object");
+ event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
+ break;
+ }
+ int ret = pkgmgr_client_install(pc,
+ appInstallInfo->getPackageFormat().c_str(),
+ NULL, //not used for wgt
+ filePath.c_str(), //(decrypted) wgt file location
+ NULL, //not used for wgt
+ PM_QUIET, //use PM_QUIET. If set to PM_DEFAULT, pkgmgr show system pop up window
+ installAppResultCallback,
+ this);
+ if(ret < PKGMGR_R_OK){
+ LogError("[ERROR] pkgmgr_client_install FAIL :" << ret);
+ event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException);
+ break;
+ }
+ m_eventAppInstallPtr = event;
+ m_eventAppInstallPtr->switchToManualAnswer();
+ LogDebug("Waiting for response for APPLICATION_INSTALL_INSTALL/APPLICATION_INSTALL_UPDATE request");
+ break;
+ }
+ case EventApplicationInstall::APPLICATION_INSTALL_UNINSTALL: {
+ LogDebug("APPLICATION_INSTALL_UNINSTALL request received");
+ ApplicationInstallInfoPtr appInstallInfo = event->getAppInstallInfo();
+ std::string strId = event->getAppId();
+ const char* appId = strId.c_str();
+ char *package = getPackageById(appId);
+ if(package == NULL) {
+ LogError("package not found for appid :"<<appId);
+ event->setExceptionCode(Commons::ExceptionCodes::NotFoundException);
+ break;
+ }
+
+ pkgmgr_info *pkg_info = pkgmgr_info_new("wgt", package);
+ if(pkg_info == NULL) {
+ LogError("package info cannnot be retrieved for appid :"<<appId);
+ event->setExceptionCode(Commons::ExceptionCodes::NotFoundException);
+ free(package); package = NULL;
+ break;
+ }
+ char *name = pkgmgr_info_get_string(pkg_info, "pkg_name");
+ free(package); package = NULL;
+ pkgmgr_info_free(pkg_info); pkg_info = NULL;
+ if(name == NULL || isAppInstalled(name) != 0) {
+ LogError("can not get name of "<<appId<<" package");
+ event->setExceptionCode(Commons::ExceptionCodes::NotFoundException);
+ if (name) {
+ free(name); name = NULL;
+ }
+ break;
+ }
+
+ LogDebug("APPLICATION_INSTALL_UNINSTALL package_name: " << name);
+ pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
+ if(pc == NULL){
+ LogError("[ERROR] pkgmgr_client_uninstall - unable to create client object");
+ event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
+ free(name); name = NULL;
+ break;
+ }
+ int ret = pkgmgr_client_uninstall(pc,
+ "wgt", //package type it can be deb and wgt. We should set to "wgt".
+ name, //name of the package
+ PM_QUIET, //use PM_QUIET. If set to PM_DEFAULT, pkgmgr show system pop up window
+ installAppResultCallback,
+ this);
+ free(name); name = NULL;
+ if(ret < PKGMGR_R_OK){
+ LogError("[ERROR] pkgmgr_client_uninstall FAIL :" << ret);
+ event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException);
+ break;
+ }
+ m_eventAppInstallPtr = event;
+ m_eventAppInstallPtr->switchToManualAnswer();
+ LogDebug("Waiting for response for APPLICATION_INSTALL_UNINSTALL request");
+ break;
+ }
+ default:
+ LogError("[ERROR] UNKNOWN EVENT TYPE");
+ event->setExceptionCode(Commons::ExceptionCodes::UnknownException);
+ break;
+ }
+}
+
void Application::initialize()
{
if (!m_initialized) {
diff --git a/src/platform/Tizen/Application/Application.h b/src/platform/Tizen/Application/Application.h
index d3b3b19..40f88cd 100755
--- a/src/platform/Tizen/Application/Application.h
+++ b/src/platform/Tizen/Application/Application.h
@@ -50,15 +50,27 @@ public:
virtual void removeApplicationInformationEventListener(const EventInstalledApplicationChangedEmitter::IdType id);
virtual void launchService(const EventLaunchServicePtr& event);
virtual void getApplicationService(const EventLaunchServicePtr& event);
+ virtual void install(const EventApplicationInstallPtr& event);
+ virtual void uninstall(const EventApplicationInstallPtr& event);
+ virtual void update(const EventApplicationInstallPtr& event);
+
void launchServiceManualAnswer(service_h request, service_h reply, service_result_e result);
void InstalledApplicationChanged(app_manger_event_type_e event_type,const char *package);
void callKillEventCallback(int pid);
+ void installAppAnswer(int req_id,
+ const char* pkg_type,
+ const char* pkg_name,
+ const char* key,
+ const char* val,
+ const void* pmsg,
+ int result);
protected:
virtual void OnRequestReceived(const EventListInstalledApplicationsPtr& event);
virtual void OnRequestReceived(const EventManageApplicationPtr& event);
virtual void OnRequestReceived(const EventGetApplicationPtr& event);
virtual void OnRequestReceived(const EventLaunchServicePtr& event);
+ virtual void OnRequestReceived(const EventApplicationInstallPtr& event);
private:
void initialize();
@@ -71,6 +83,7 @@ private:
std::map<std::string, std::string> m_installedApplicationList;
std::map<int, EventManageApplicationPtr> m_killEventMap;
mutable DPL::Mutex m_killMapLock;
+ Api::Application::EventApplicationInstallPtr m_eventAppInstallPtr;
};
}
diff --git a/src/platform/Tizen/Application/ApplicationCrypto.cpp b/src/platform/Tizen/Application/ApplicationCrypto.cpp
new file mode 100644
index 0000000..3f1c9eb
--- /dev/null
+++ b/src/platform/Tizen/Application/ApplicationCrypto.cpp
@@ -0,0 +1,105 @@
+/*
+ * Decrypt and re-encrypt WGT packages.
+ *
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Author: Jussi Laako <jussi.laako@linux.intel.com>
+ */
+
+#ifdef WIDGET_DECRYPTION_ENABLED
+
+#include <cstdio>
+#include <fstream>
+#include <string>
+#include <exception>
+#include <dpl/log/log.h>
+
+#include "ApplicationCrypto.h"
+
+class wgtexcept
+{
+ std::string msg;
+
+ public:
+ wgtexcept (const char *emsg) throw () :
+ msg(emsg)
+ { }
+ virtual ~wgtexcept () throw ()
+ { }
+ virtual const char * what() const throw ()
+ { return msg.c_str(); }
+};
+
+namespace TizenApis {
+namespace Platform {
+namespace Application {
+
+using namespace Botan;
+
+LibraryInitializer * ApplicationCrypto::m_initializer = 0;
+
+ApplicationCrypto::ApplicationCrypto()
+{
+}
+
+ApplicationCrypto::~ApplicationCrypto()
+{
+}
+
+int ApplicationCrypto::wgtDecrypt (const char *inFile,
+ const char *outFile,
+ const char *key64,
+ int padding)
+{
+ int res = -1;
+ size_t sizeRead;
+ unsigned char block[16];
+ unsigned char buf[4096];
+ FILE *fileIn = NULL;
+
+ try
+ {
+ if (!m_initializer) {
+ m_initializer = new LibraryInitializer();
+ }
+
+ fileIn = fopen(inFile, "rb");
+ if (fileIn == NULL) {
+ LogError("Error: Invalid file");
+ return -1;
+ }
+ if (fread(block, sizeof(block), 1, fileIn) < 1)
+ throw wgtexcept("fread()");
+
+ InitializationVector iv(block, sizeof(block));
+ SymmetricKey key(base64_decode(std::string(key64)));
+
+ BlockCipherModePaddingMethod *pad = (padding == 7) ?
+ static_cast<BlockCipherModePaddingMethod *> (new PKCS7_Padding) :
+ static_cast<BlockCipherModePaddingMethod *> (new Null_Padding);
+
+ std::ofstream streamOut(outFile, std::ios::binary);
+ Pipe pipeDec(
+ new CBC_Decryption(new AES_256, pad, key, iv),
+ new DataSink_Stream(streamOut));
+
+ pipeDec.start_msg();
+ while ((sizeRead = fread(buf, 1, sizeof(buf), fileIn)) > 0)
+ pipeDec.write(buf, sizeRead);
+ pipeDec.end_msg();
+ res = 0;
+ }
+ catch (std::exception &x)
+ {
+ LogError("Error: wgt_crypto_decrypt(): " << x.what());
+ }
+
+ if (fileIn)
+ fclose(fileIn);
+ return res;
+}
+
+}
+}
+}
+#endif
diff --git a/src/platform/Tizen/Application/ApplicationCrypto.h b/src/platform/Tizen/Application/ApplicationCrypto.h
new file mode 100644
index 0000000..d19856c
--- /dev/null
+++ b/src/platform/Tizen/Application/ApplicationCrypto.h
@@ -0,0 +1,52 @@
+/*
+ * Decrypt and re-encrypt WGT packages.
+ *
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Author: Jussi Laako <jussi.laako@linux.intel.com>
+ */
+
+#ifndef TIZENAPIS_PLATFORM_APPLICATION_CRYPTO_H_
+#define TIZENAPIS_PLATFORM_APPLICATION_CRYPTO_H_
+
+#ifdef WIDGET_DECRYPTION_ENABLED
+
+#include <botan/botan.h>
+#include <botan/aes.h>
+#include <botan/base64.h>
+#include <botan/cbc.h>
+
+namespace TizenApis {
+namespace Platform {
+namespace Application {
+
+class ApplicationCrypto {
+
+public:
+ virtual ~ApplicationCrypto();
+ /**
+ * Decrypt WGT file with given base-64 encoded key.
+ *
+ * \param infile Input filename
+ * \param outfile Output filename
+ * \param key Base-64 encoded null-terminated key string
+ * \param padding Type of padding, 0=zeros, 7=pkcs7
+ * \return Returns 0 on success
+ */
+ static int wgtDecrypt (const char *inFile,
+ const char *outFile,
+ const char *key64,
+ int padding);
+private:
+ ApplicationCrypto();
+ static Botan::LibraryInitializer *m_initializer;
+};
+
+}
+}
+}
+
+#endif
+
+#endif /* WGT_CRYPTO_H */
+
diff --git a/src/platform/Tizen/Application/config.cmake b/src/platform/Tizen/Application/config.cmake
index a00a3e5..2cf9156 100755
--- a/src/platform/Tizen/Application/config.cmake
+++ b/src/platform/Tizen/Application/config.cmake
@@ -4,24 +4,36 @@ pkg_search_module(capi-appfw-app-manager REQUIRED capi-appfw-app-manager)
pkg_search_module(capi-appfw-application REQUIRED capi-appfw-application)
pkg_search_module(wrt-deviceapis-commons REQUIRED wrt-deviceapis-commons)
pkg_search_module(wrt-deviceapis-commons-javascript REQUIRED wrt-deviceapis-commons-javascript)
+pkg_search_module(pkgmgr REQUIRED pkgmgr)
-set(INCLUDES_PLATFORM_IMPLEMENTATION_APPLICATION
+set(INCLUDES_PLATFORM_IMPLEMENTATION_APPLICATION_BASE
${capi-appfw-app-manager_INCLUDE_DIRS}
${capi-appfw-application_INCLUDE_DIRS}
${wrt-deviceapis-commons_INCLUDE_DIRS}
${wrt-deviceapis-commons-javascript_INCLUDE_DIRS}
- PARENT_SCOPE
+ ${pkgmgr_INCLUDE_DIRS}
)
-set(LIBS_PLATFORM_IMPLEMENTATION_APPLICATION
+set(LIBS_PLATFORM_IMPLEMENTATION_APPLICATION_BASE
${capi-appfw-app-manager_LIBRARIES}
${capi-appfw-application_LIBRARIES}
${wrt-deviceapis-commons_LIBRARIES}
${wrt-deviceapis-commons-javascript_LIBRARIES}
- PARENT_SCOPE
+ ${pkgmgr_LIBRARIES}
)
-set(SRCS_PLATFORM_IMPLEMENTATION_APPLICATION
+set(SRCS_PLATFORM_IMPLEMENTATION_APPLICATION_BASE
${CURRENT_PATH}/Application.cpp
- PARENT_SCOPE
)
+
+IF("${WGT_DECRYPTION}" STREQUAL "ON")
+ pkg_search_module(botan REQUIRED botan-1.10)
+ LIST(APPEND INCLUDES_PLATFORM_IMPLEMENTATION_APPLICATION_BASE ${botan_INCLUDE_DIRS})
+ LIST(APPEND LIBS_PLATFORM_IMPLEMENTATION_APPLICATION_BASE ${botan_LIBRARIES})
+ LIST(APPEND SRCS_PLATFORM_IMPLEMENTATION_APPLICATION_BASE ${CURRENT_PATH}/ApplicationCrypto.cpp)
+ENDIF("${WGT_DECRYPTION}" STREQUAL "ON")
+
+set(INCLUDES_PLATFORM_IMPLEMENTATION_APPLICATION ${INCLUDES_PLATFORM_IMPLEMENTATION_APPLICATION_BASE} PARENT_SCOPE)
+set(LIBS_PLATFORM_IMPLEMENTATION_APPLICATION ${LIBS_PLATFORM_IMPLEMENTATION_APPLICATION_BASE} PARENT_SCOPE)
+set(SRCS_PLATFORM_IMPLEMENTATION_APPLICATION ${SRCS_PLATFORM_IMPLEMENTATION_APPLICATION_BASE} PARENT_SCOPE)
+
diff --git a/src/standards/Tizen/Application/ApplicationAnswerReceiver.cpp b/src/standards/Tizen/Application/ApplicationAnswerReceiver.cpp
index 63bde9a..41ada65 100755
--- a/src/standards/Tizen/Application/ApplicationAnswerReceiver.cpp
+++ b/src/standards/Tizen/Application/ApplicationAnswerReceiver.cpp
@@ -36,6 +36,7 @@ ApplicationAnswerReceiver::ApplicationAnswerReceiver(const CommonsJavaScript::JS
EventAnswerReceiver<EventListInstalledApplications> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
EventAnswerReceiver<EventManageApplication> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
EventAnswerReceiver<EventLaunchService> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+ EventAnswerReceiver<EventApplicationInstall> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
m_callbackManager(callbackManager) {
}
@@ -43,15 +44,26 @@ ApplicationAnswerReceiver::ApplicationAnswerReceiver(const LaunchServicePrivateD
EventAnswerReceiver<EventListInstalledApplications> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
EventAnswerReceiver<EventManageApplication> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
EventAnswerReceiver<EventLaunchService> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+ EventAnswerReceiver<EventApplicationInstall> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
m_privateData(launchServiceCallbackManager) {
LogDebug("<<<");
}
-
+
+ApplicationAnswerReceiver::ApplicationAnswerReceiver(const ApplicationInformationEventPrivateDataPtr &appInstallCallbackManager) :
+ EventAnswerReceiver<EventListInstalledApplications> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+ EventAnswerReceiver<EventManageApplication> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+ EventAnswerReceiver<EventLaunchService> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+ EventAnswerReceiver<EventApplicationInstall> (WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+ m_appInstallPrivateData(appInstallCallbackManager) {
+ LogDebug("<<<");
+}
+
ApplicationAnswerReceiver::~ApplicationAnswerReceiver() {
}
void ApplicationAnswerReceiver::OnAnswerReceived(const EventListInstalledApplicationsPtr &event)
{
+ LogDebug("<<<");
JSContextRef context = m_callbackManager->getContext();
if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
@@ -192,6 +204,87 @@ void ApplicationAnswerReceiver::OnAnswerReceived(const EventLaunchServicePtr &ev
LogDebug(">>>");
}
+void ApplicationAnswerReceiver::OnAnswerReceived(const EventApplicationInstallPtr &event)
+{
+ LogDebug("<<<");
+ ApplicationInformationEventPrivateDataPtr privateData =
+ DPL::StaticPointerCast<ApplicationInformationEventPrivateData>(event->getPrivateData());
+ if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
+ LogDebug("OnAnswerReceived");
+ Try {
+ LogDebug("Event Type: " << event->getEventType());
+ if (event->getEventType() == EventApplicationInstall::APPLICATION_INSTALL_INSTALL) {
+ CommonsJavaScript::JSCallbackManagerPtr callbackManager = privateData->getOnInstalled();
+ if (callbackManager) {
+ ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(callbackManager->getContext());
+ JSValueRef jsresult = converter->toJSValueRef(event->getApplicationInformation());
+ callbackManager->callOnSuccess(jsresult);
+ }
+ } else if (event->getEventType() == EventApplicationInstall::APPLICATION_INSTALL_UNINSTALL) {
+ CommonsJavaScript::JSCallbackManagerPtr callbackManager = privateData->getOnUninstalled();
+ if (callbackManager) {
+ ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(callbackManager->getContext());
+ LogDebug("Uninstalled AppId: " << event->getAppId());
+ JSValueRef jsresult = converter->toJSValueRef(event->getAppId());
+ callbackManager->callOnSuccess(jsresult);
+ }
+ } else if (event->getEventType() == EventApplicationInstall::APPLICATION_INSTALL_UPDATE) {
+ CommonsJavaScript::JSCallbackManagerPtr callbackManager = privateData->getOnUpdated();
+ if (callbackManager) {
+ ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(callbackManager->getContext());
+ JSValueRef jsresult = converter->toJSValueRef(event->getApplicationInformation());
+ callbackManager->callOnSuccess(jsresult);
+ }
+ } else {
+ LogError("unknown event type");
+ CommonsJavaScript::JSCallbackManagerPtr callbackManager = privateData->getOnInstalled();
+ if (callbackManager) {
+ JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(callbackManager->getContext(),JSTizenException::UNKNOWN_ERROR,"unknown error");
+ callbackManager->callOnError(errorObject);
+ }
+ }
+
+ } Catch(WrtDeviceApis::Commons::Exception) {
+ LogError("error during function executing");
+ }
+ } else {
+ LogDebug("Operation failed. Exception code: " << event->getExceptionCode());
+
+ JSValueRef errorObject = NULL;
+ CommonsJavaScript::JSCallbackManagerPtr callbackManager;
+ if (event->getEventType() == EventApplicationInstall::APPLICATION_INSTALL_INSTALL) {
+ callbackManager = privateData->getOnInstalled();
+ } else if (event->getEventType() == EventApplicationInstall::APPLICATION_INSTALL_UNINSTALL) {
+ callbackManager = privateData->getOnUninstalled();
+ } else if (event->getEventType() == EventApplicationInstall::APPLICATION_INSTALL_UPDATE) {
+ callbackManager = privateData->getOnUpdated();
+ } else {
+ callbackManager = privateData->getOnInstalled();
+ }
+
+ if(callbackManager != NULL) {
+ JSContextRef context = callbackManager->getContext();
+
+ WrtDeviceApis::Commons::ExceptionCodes::Enumeration exception = event->getExceptionCode();
+ switch (exception) {
+ case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException:
+ errorObject = JSTizenExceptionFactory::makeErrorObject(context,JSTizenException::NOT_FOUND_ERROR,"given package is not found");
+ break;
+ case WrtDeviceApis::Commons::ExceptionCodes::PlatformException:
+ errorObject = JSTizenExceptionFactory::makeErrorObject(context,JSTizenException::UNKNOWN_ERROR,"platform exception");
+ break;
+ default:
+ errorObject = JSTizenExceptionFactory::makeErrorObject(context,JSTizenException::UNKNOWN_ERROR,"unknown error");
+ break;
+ }
+ callbackManager->callOnError(errorObject);
+ }
+ }
+ LogDebug(">>>");
+}
+
+
+
}
}
}
diff --git a/src/standards/Tizen/Application/ApplicationAnswerReceiver.h b/src/standards/Tizen/Application/ApplicationAnswerReceiver.h
index 9c208d9..841bf28 100755
--- a/src/standards/Tizen/Application/ApplicationAnswerReceiver.h
+++ b/src/standards/Tizen/Application/ApplicationAnswerReceiver.h
@@ -24,7 +24,9 @@
#include <API/Application/EventListInstalledApplications.h>
#include <API/Application/EventLaunchService.h>
#include <API/Application/EventManageApplication.h>
+#include <API/Application/EventApplicationInstall.h>
#include "LaunchServicePrivateData.h"
+#include "ApplicationInformationEventPrivateData.h"
namespace TizenApis {
namespace Tizen1_0 {
@@ -35,21 +37,25 @@ using namespace WrtDeviceApis::CommonsJavaScript;
class ApplicationAnswerReceiver :
public WrtDeviceApis::Commons::EventAnswerReceiver< Api::Application::EventListInstalledApplications>,
public WrtDeviceApis::Commons::EventAnswerReceiver< Api::Application::EventManageApplication>,
- public WrtDeviceApis::Commons::EventAnswerReceiver< Api::Application::EventLaunchService>
+ public WrtDeviceApis::Commons::EventAnswerReceiver< Api::Application::EventLaunchService>,
+ public WrtDeviceApis::Commons::EventAnswerReceiver< Api::Application::EventApplicationInstall>
{
public:
explicit ApplicationAnswerReceiver(const JSCallbackManagerPtr &callbackManager);
explicit ApplicationAnswerReceiver(const LaunchServicePrivateDataPtr &ApplicatoinServiceCallback);
+ explicit ApplicationAnswerReceiver(const ApplicationInformationEventPrivateDataPtr &ApplicationInstallCallback);
virtual ~ApplicationAnswerReceiver();
protected:
void OnAnswerReceived(const Api::Application::EventListInstalledApplicationsPtr &event);
void OnAnswerReceived(const Api::Application::EventManageApplicationPtr &event);
void OnAnswerReceived(const Api::Application::EventLaunchServicePtr &event);
+ void OnAnswerReceived(const Api::Application::EventApplicationInstallPtr &event);
private:
JSCallbackManagerPtr m_callbackManager;
LaunchServicePrivateDataPtr m_privateData;
+ ApplicationInformationEventPrivateDataPtr m_appInstallPrivateData;
};
}
diff --git a/src/standards/Tizen/Application/ApplicationConverter.cpp b/src/standards/Tizen/Application/ApplicationConverter.cpp
index 964a97f..d4de46b 100755
--- a/src/standards/Tizen/Application/ApplicationConverter.cpp
+++ b/src/standards/Tizen/Application/ApplicationConverter.cpp
@@ -29,6 +29,7 @@
#include "JSApplicationServiceData.h"
#include "JSApplicationServiceData.h"
#include "JSApplicationService.h"
+#include "JSApplicationInstallInfo.h"
namespace {
const char* APPLICATOIN_ATTRIBUTE_NAME = "name";
@@ -37,12 +38,18 @@ namespace {
const char* APPLICATOIN_ATTRIBUTE_ICONF_PATH = "iconPath";
const char* APPLICATOIN_ATTRIBUTE_VERSION = "version";
const char* APPLICATOIN_ATTRIBUTE_SHOW = "show";
+ const char* APPLICATOIN_ATTRIBUTE_INSTALL_DATE = "installDate";
+ const char* APPLICATOIN_ATTRIBUTE_INSTALL_SIZE = "size";
const char* APPLICATOIN_ATTRIBUTE_EXTRA_KEY = "key";
const char* APPLICATOIN_ATTRIBUTE_EXTRA_VALUE = "value";
const char* APPLICATOIN_ATTRIBUTE_OPERATION = "operation";
const char* APPLICATOIN_ATTRIBUTE_URI = "uri";
const char* APPLICATOIN_ATTRIBUTE_MIME = "mime";
const char* APPLICATOIN_ATTRIBUTE_EXTRADATA = "extraData";
+ const char* APPLICATOIN_INSTALL_ATTRIBUTE_FILEPATH = "filePath";
+ const char* APPLICATOIN_INSTALL_ATTRIBUTE_ALGORITHM = "algorithm";
+ const char* APPLICATOIN_INSTALL_ATTRIBUTE_KEY = "key";
+ const char* APPLICATOIN_INSTALL_ATTRIBUTE_PACKAGE_FORMAT = "packageFormat";
}
namespace TizenApis {
@@ -57,6 +64,7 @@ std::vector<std::string> ApplicationConverter::m_allowedApplicationInformation;
std::vector<std::string> ApplicationConverter::m_allowedApplicationContext;
std::vector<std::string> ApplicationConverter::m_allowedApplicationService;
std::vector<std::string> ApplicationConverter::m_allowedApplicationServiceData;
+std::vector<std::string> ApplicationConverter::m_allowedApplicationInstallInfo;
ApplicationConverter::ApplicationConverter(JSContextRef context) : Converter(context)
{
@@ -92,6 +100,8 @@ ApplicationInformationPtr ApplicationConverter::toApplicationInformation(const J
const ScopedJSStringRef iconPathStr(JSStringCreateWithUTF8CString(APPLICATOIN_ATTRIBUTE_ICONF_PATH));
const ScopedJSStringRef versionStr(JSStringCreateWithUTF8CString(APPLICATOIN_ATTRIBUTE_VERSION));
const ScopedJSStringRef showStr(JSStringCreateWithUTF8CString(APPLICATOIN_ATTRIBUTE_SHOW));
+ const ScopedJSStringRef installDateStr(JSStringCreateWithUTF8CString(APPLICATOIN_ATTRIBUTE_INSTALL_DATE));
+ const ScopedJSStringRef installSizeStr(JSStringCreateWithUTF8CString(APPLICATOIN_ATTRIBUTE_INSTALL_SIZE));
JSObjectRef jsObject = toJSObjectRef(jsValue);
@@ -100,12 +110,16 @@ ApplicationInformationPtr ApplicationConverter::toApplicationInformation(const J
JSValueRef iconPathData = JSObjectGetProperty(m_context, jsObject, iconPathStr.get(), NULL);
JSValueRef versionData = JSObjectGetProperty(m_context, jsObject, versionStr.get(), NULL);
JSValueRef showData = JSObjectGetProperty(m_context, jsObject, showStr.get(), NULL);
+ JSValueRef installDateData = JSObjectGetProperty(m_context, jsObject, installDateStr.get(), NULL);
+ JSValueRef installSizeData = JSObjectGetProperty(m_context, jsObject, installSizeStr.get(), NULL);
std::string name;
std::string appid;
std::string iconPath;
std::string version;
bool show;
+ time_t installDate;
+ long installSize;
ApplicationInformationPtr result(new ApplicationInformation());
if (!result) {
@@ -132,10 +146,69 @@ ApplicationInformationPtr ApplicationConverter::toApplicationInformation(const J
show = toBool(showData);
result->setShow(show);
}
-
+ if (!JSValueIsUndefined(m_context, installDateData)) {
+ installDate = toDateTimeT(installDateData);
+ result->setInstallDate(installDate);
+ }
+ if (!JSValueIsUndefined(m_context, installSizeData)) {
+ installSize = toLong(installSizeData);
+ result->setSize(installSize);
+ }
return result;
}
+ApplicationInstallInfoPtr ApplicationConverter::toApplicationInstallInfo(const JSValueRef &jsValue)
+{
+ if(JSApplicationInstallInfo::isObjectOfClass(m_context, jsValue))
+ return JSApplicationInstallInfo::getApplicationInstallInfo(m_context, jsValue);
+
+ CommonsJavaScript::Validator validator(m_context);
+ if (!validator.checkArrayKeys(m_allowedApplicationInstallInfo, jsValue)) {
+ LogError("invalid properties in contact object");
+ ThrowMsg(Commons::ConversionException, "Wrong attribute");
+ }
+
+ const ScopedJSStringRef filePathStr(JSStringCreateWithUTF8CString(APPLICATOIN_INSTALL_ATTRIBUTE_FILEPATH));
+ const ScopedJSStringRef algorithmStr(JSStringCreateWithUTF8CString(APPLICATOIN_INSTALL_ATTRIBUTE_ALGORITHM));
+ const ScopedJSStringRef keyStr(JSStringCreateWithUTF8CString(APPLICATOIN_INSTALL_ATTRIBUTE_KEY));
+ const ScopedJSStringRef packageFormatStr(JSStringCreateWithUTF8CString(APPLICATOIN_INSTALL_ATTRIBUTE_PACKAGE_FORMAT));
+
+ JSObjectRef jsObject = toJSObjectRef(jsValue);
+
+ JSValueRef filePathData = JSObjectGetProperty(m_context, jsObject, filePathStr.get(), NULL);
+ JSValueRef algorithmData = JSObjectGetProperty(m_context, jsObject, algorithmStr.get(), NULL);
+ JSValueRef keyData = JSObjectGetProperty(m_context, jsObject, keyStr.get(), NULL);
+ JSValueRef packageFormatData = JSObjectGetProperty(m_context, jsObject, packageFormatStr.get(), NULL);
+
+ ApplicationInstallInfoPtr result(new ApplicationInstallInfo());
+ if (!result) {
+ Throw(Commons::ConversionException);
+ }
+
+ if (!JSValueIsUndefined(m_context, filePathData)) {
+ result->setFilePath(toString(filePathData));
+ }
+ if (!JSValueIsUndefined(m_context, algorithmData)) {
+ result->setAlgorithm(toString(algorithmData));
+ }
+ if (!JSValueIsUndefined(m_context, keyData)) {
+ result->setKey(toString(keyData));
+ }
+ if (!JSValueIsUndefined(m_context, packageFormatData)) {
+ result->setPackageFormat(toString(packageFormatData));
+ }
+
+ return result;
+}
+
+JSValueRef ApplicationConverter::toJSValueRef(const ApplicationInstallInfoPtr &arg)
+{
+ if(arg == NULL) {
+ Throw(Commons::ConversionException);
+ }
+ return CommonsJavaScript::JSUtils::makeObject(m_context, JSApplicationInstallInfo::getClassRef(), arg);
+}
+
JSValueRef ApplicationConverter::toJSValueRef(const ApplicationInformationArrayPtr &arg)
{
if(arg == NULL) {
@@ -377,6 +450,8 @@ bool ApplicationConverter::initializeAllowedProperties()
m_allowedApplicationInformation.push_back(APPLICATOIN_ATTRIBUTE_APP_ID);
m_allowedApplicationInformation.push_back(APPLICATOIN_ATTRIBUTE_ICONF_PATH);
m_allowedApplicationInformation.push_back(APPLICATOIN_ATTRIBUTE_VERSION);
+ m_allowedApplicationInformation.push_back(APPLICATOIN_ATTRIBUTE_INSTALL_DATE);
+ m_allowedApplicationInformation.push_back(APPLICATOIN_ATTRIBUTE_INSTALL_SIZE);
m_allowedApplicationService.push_back(APPLICATOIN_ATTRIBUTE_OPERATION);
m_allowedApplicationService.push_back(APPLICATOIN_ATTRIBUTE_URI);
@@ -388,6 +463,11 @@ bool ApplicationConverter::initializeAllowedProperties()
m_allowedApplicationServiceData.push_back(APPLICATOIN_ATTRIBUTE_EXTRA_KEY);
m_allowedApplicationServiceData.push_back(APPLICATOIN_ATTRIBUTE_EXTRA_VALUE);
+ m_allowedApplicationInstallInfo.push_back(APPLICATOIN_INSTALL_ATTRIBUTE_FILEPATH);
+ m_allowedApplicationInstallInfo.push_back(APPLICATOIN_INSTALL_ATTRIBUTE_ALGORITHM);
+ m_allowedApplicationInstallInfo.push_back(APPLICATOIN_INSTALL_ATTRIBUTE_KEY);
+ m_allowedApplicationInstallInfo.push_back(APPLICATOIN_INSTALL_ATTRIBUTE_PACKAGE_FORMAT);
+
return true;
}
diff --git a/src/standards/Tizen/Application/ApplicationConverter.h b/src/standards/Tizen/Application/ApplicationConverter.h
index b1803db..d83ea65 100755
--- a/src/standards/Tizen/Application/ApplicationConverter.h
+++ b/src/standards/Tizen/Application/ApplicationConverter.h
@@ -51,12 +51,15 @@ public:
JSValueRef toJSValueRef(const std::vector<Api::Application::ApplicationServiceDataPtr> &arg);
std::vector<Api::Application::ApplicationServiceDataPtr> toApplicationServiceDataArray(const JSValueRef &jsValue);
+ Api::Application::ApplicationInstallInfoPtr toApplicationInstallInfo(const JSValueRef &jsValue);
+ JSValueRef toJSValueRef(const Api::Application::ApplicationInstallInfoPtr &arg);
private:
bool initializeAllowedProperties();
static std::vector<std::string> m_allowedApplicationInformation;
static std::vector<std::string> m_allowedApplicationContext;
static std::vector<std::string> m_allowedApplicationService;
static std::vector<std::string> m_allowedApplicationServiceData;
+ static std::vector<std::string> m_allowedApplicationInstallInfo;
};
diff --git a/src/standards/Tizen/Application/CMakeLists.txt b/src/standards/Tizen/Application/CMakeLists.txt
index b8cdc60..db30d89 100755
--- a/src/standards/Tizen/Application/CMakeLists.txt
+++ b/src/standards/Tizen/Application/CMakeLists.txt
@@ -26,6 +26,7 @@ set(SRCS_IMPL
JSApplicationEvent.cpp
JSApplicationService.cpp
JSApplicationServiceData.cpp
+ JSApplicationInstallInfo.cpp
LaunchServicePrivateData.cpp
)
diff --git a/src/standards/Tizen/Application/JSApplication.cpp b/src/standards/Tizen/Application/JSApplication.cpp
index 1096e9c..ade9d91 100755
--- a/src/standards/Tizen/Application/JSApplication.cpp
+++ b/src/standards/Tizen/Application/JSApplication.cpp
@@ -31,6 +31,7 @@
#include <API/Application/EventManageApplication.h>
#include <API/Application/EventGetApplication.h>
#include <API/Application/EventLaunchService.h>
+#include <API/Application/EventApplicationInstall.h>
#include "plugin_config.h"
#include "ApplicationAnswerReceiver.h"
#include "ApplicationListener.h"
@@ -90,6 +91,9 @@ JSStaticFunction JSApplication::m_function[] = {
{ "removeAppInfoEventListener",JSApplication::removeAppInfoEventListener,kJSPropertyAttributeNone },
{ "launchService",JSApplication::launchService,kJSPropertyAttributeNone },
{ "getAppService",JSApplication::getAppService,kJSPropertyAttributeNone },
+ { "install",JSApplication::install,kJSPropertyAttributeNone },
+ { "uninstall",JSApplication::uninstall,kJSPropertyAttributeNone },
+ { "update",JSApplication::update,kJSPropertyAttributeNone },
{ 0, 0, 0 }
};
@@ -855,6 +859,211 @@ JSValueRef JSApplication::removeAppInfoEventListener(JSContextRef context,
return JSValueMakeUndefined(context);
}
+JSValueRef JSApplication::install(JSContextRef context,
+ JSObjectRef object,
+ JSObjectRef thisObject,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception)
+{
+ JSApplicationPriv *priv = static_cast<JSApplicationPriv*> (JSObjectGetPrivate(thisObject));
+ if (!priv) {
+ JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mistmatch error.");
+ }
+
+ AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_INSTALL_APP);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+ if (argumentCount < 2) {
+ LogError("Wrong parameters");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mistmatch error.");
+ }
+
+ Try {
+ ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context);
+ ApplicationInstallInfoPtr appInstallInfo;
+ appInstallInfo = converter->toApplicationInstallInfo(arguments[0]);
+
+ JSObjectRef cbObj = converter->toJSObjectRef(arguments[1]);
+ JSValueRef onInstalled = JSUtils::getJSPropertyOrUndefined(context, cbObj, "oninstalled");
+
+ ApplicationUtil util(context, exception);
+ if (!util.isFunction(onInstalled)) {
+ LogError("Wrong parameters");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
+ }
+
+ JSContextRef gContext = priv->getContext();
+ JSCallbackManagerPtr onInstalledCbm = JSCallbackManager::createObject(gContext, onInstalled);
+ if (argumentCount > 2) {
+ if (util.isFunction(arguments[2])) {
+ onInstalledCbm->setOnError(arguments[2]);
+ } else if (!util.isNullOrUndefined(arguments[2])) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error.");
+ }
+ }
+
+ ApplicationInformationEventPrivateDataPtr privateData(new ApplicationInformationEventPrivateData(onInstalledCbm, onInstalledCbm, onInstalledCbm));
+
+ IApplicationPtr applications(priv->getObject());
+ EventApplicationInstallPtr event(new EventApplicationInstall());
+ event->setEventType(EventApplicationInstall::APPLICATION_INSTALL_INSTALL);
+ event->setPrivateData(StaticPointerCast<IEventPrivateData> (privateData));
+ event->setAppInstallInfo(appInstallInfo);
+ event->setForAsynchronousCall(new ApplicationAnswerReceiver(privateData));
+
+ applications->install(event);
+
+ } Catch (WrtDeviceApis::Commons::ConversionException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
+ } Catch (WrtDeviceApis::Commons::UnsupportedException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not supported");
+ } Catch (WrtDeviceApis::Commons::InvalidArgumentException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid value error");
+ } Catch (WrtDeviceApis::Commons::Exception) {
+ LogError("Exception: " << _rethrown_exception.GetMessage() << " Code: " << _rethrown_exception.getCode());
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error");
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+JSValueRef JSApplication::uninstall(JSContextRef context,
+ JSObjectRef object,
+ JSObjectRef thisObject,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception)
+{
+ JSApplicationPriv *priv = static_cast<JSApplicationPriv*> (JSObjectGetPrivate(thisObject));
+ if (!priv) {
+ JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mistmatch error.");
+ }
+
+ AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_UNINSTALL_APP);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+ if (argumentCount < 2) {
+ LogError("Wrong parameters");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mistmatch error.");
+ }
+
+ Try {
+ ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context);
+ std::string appid = converter->toString(arguments[0]);
+
+ JSObjectRef cbObj = converter->toJSObjectRef(arguments[1]);
+ JSValueRef onUninstalled = JSUtils::getJSPropertyOrUndefined(context, cbObj, "onuninstalled");
+
+ ApplicationUtil util(context, exception);
+ if (!util.isFunction(onUninstalled)) {
+ LogError("Wrong parameters");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
+ }
+
+ JSContextRef gContext = priv->getContext();
+ JSCallbackManagerPtr onUninstalledCbm = JSCallbackManager::createObject(gContext, onUninstalled);
+ if (argumentCount > 2) {
+ if (util.isFunction(arguments[2])) {
+ onUninstalledCbm->setOnError(arguments[2]);
+ } else if (!util.isNullOrUndefined(arguments[2])) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error.");
+ }
+ }
+
+ ApplicationInformationEventPrivateDataPtr privateData(new ApplicationInformationEventPrivateData(onUninstalledCbm, onUninstalledCbm, onUninstalledCbm));
+
+ IApplicationPtr applications(priv->getObject());
+ EventApplicationInstallPtr event(new EventApplicationInstall());
+ event->setEventType(EventApplicationInstall::APPLICATION_INSTALL_UNINSTALL);
+ event->setPrivateData(StaticPointerCast<IEventPrivateData> (privateData));
+ event->setAppId(appid);
+ event->setForAsynchronousCall(new ApplicationAnswerReceiver(privateData));
+
+ applications->uninstall(event);
+
+ } Catch (WrtDeviceApis::Commons::ConversionException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
+ } Catch (WrtDeviceApis::Commons::UnsupportedException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not supported");
+ } Catch (WrtDeviceApis::Commons::InvalidArgumentException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid value error");
+ } Catch (WrtDeviceApis::Commons::Exception) {
+ LogError("Exception: " << _rethrown_exception.GetMessage() << " Code: " << _rethrown_exception.getCode());
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error");
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+JSValueRef JSApplication::update(JSContextRef context,
+ JSObjectRef object,
+ JSObjectRef thisObject,
+ size_t argumentCount,
+ const JSValueRef arguments[],
+ JSValueRef* exception)
+{
+ JSApplicationPriv *priv = static_cast<JSApplicationPriv*> (JSObjectGetPrivate(thisObject));
+ if (!priv) {
+ JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mistmatch error.");
+ }
+
+ AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_UPDATE_APP);
+ TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+ if (argumentCount < 2) {
+ LogError("Wrong parameters");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mistmatch error.");
+ }
+
+ Try {
+ ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context);
+ ApplicationInstallInfoPtr appInstallInfo = converter->toApplicationInstallInfo(arguments[0]);
+
+ JSObjectRef cbObj = converter->toJSObjectRef(arguments[1]);
+ JSValueRef onUpdated = JSUtils::getJSPropertyOrUndefined(context, cbObj, "onupdated");
+
+ ApplicationUtil util(context, exception);
+ if (!util.isFunction(onUpdated)) {
+ LogError("Wrong parameters");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
+ }
+
+ JSContextRef gContext = priv->getContext();
+ JSCallbackManagerPtr onUpdatedCbm = JSCallbackManager::createObject(gContext, onUpdated);
+ if (argumentCount > 2) {
+ if (util.isFunction(arguments[2])) {
+ onUpdatedCbm->setOnError(arguments[2]);
+ } else if (!util.isNullOrUndefined(arguments[2])) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error.");
+ }
+ }
+
+ ApplicationInformationEventPrivateDataPtr privateData(new ApplicationInformationEventPrivateData(onUpdatedCbm, onUpdatedCbm, onUpdatedCbm));
+
+ IApplicationPtr applications(priv->getObject());
+ EventApplicationInstallPtr event(new EventApplicationInstall());
+ event->setEventType(EventApplicationInstall::APPLICATION_INSTALL_UPDATE);
+ event->setPrivateData(StaticPointerCast<IEventPrivateData> (privateData));
+ event->setAppInstallInfo(appInstallInfo);
+ event->setForAsynchronousCall(new ApplicationAnswerReceiver(privateData));
+
+ applications->update(event);
+
+ } Catch (WrtDeviceApis::Commons::ConversionException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
+ } Catch (WrtDeviceApis::Commons::UnsupportedException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not supported");
+ } Catch (WrtDeviceApis::Commons::InvalidArgumentException) {
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid value error");
+ } Catch (WrtDeviceApis::Commons::Exception) {
+ LogError("Exception: " << _rethrown_exception.GetMessage() << " Code: " << _rethrown_exception.getCode());
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error");
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
}
}
diff --git a/src/standards/Tizen/Application/JSApplication.h b/src/standards/Tizen/Application/JSApplication.h
index 887b140..a7aad93 100755
--- a/src/standards/Tizen/Application/JSApplication.h
+++ b/src/standards/Tizen/Application/JSApplication.h
@@ -122,6 +122,24 @@ private:
const JSValueRef arguments[], JSValueRef* exception);
/**
+ * Install an application
+ */
+ static JSValueRef install(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
+ const JSValueRef arguments[], JSValueRef* exception);
+
+ /**
+ * Uninstall an application
+ */
+ static JSValueRef uninstall(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
+ const JSValueRef arguments[], JSValueRef* exception);
+
+ /**
+ * Update an application
+ */
+ static JSValueRef update(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
+ const JSValueRef arguments[], JSValueRef* exception);
+
+ /**
* This structure contains properties and callbacks that define a type of object.
*/
static JSClassDefinition m_classInfo;
diff --git a/src/standards/Tizen/Application/JSApplicationInformation.cpp b/src/standards/Tizen/Application/JSApplicationInformation.cpp
index 2947d6c..910780a 100755
--- a/src/standards/Tizen/Application/JSApplicationInformation.cpp
+++ b/src/standards/Tizen/Application/JSApplicationInformation.cpp
@@ -40,6 +40,8 @@ const char* APPLICATION_INFORMATION_APP_ID = "id";
const char* APPLICATION_INFORMATION_ICONPATH = "iconPath";
const char* APPLICATION_INFORMATION_VERSION = "version";
const char* APPLICATION_INFORMATION_SHOW = "show";
+const char* APPLICATION_INFORMATION_INSTALL_DATE = "installDate";
+const char* APPLICATION_INFORMATION_INSTALL_SIZE = "size";
} //private namespace
@@ -71,6 +73,8 @@ JSStaticValue JSApplicationInformation::m_property[] = {
{ APPLICATION_INFORMATION_ICONPATH, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ APPLICATION_INFORMATION_VERSION, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ APPLICATION_INFORMATION_SHOW, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { APPLICATION_INFORMATION_INSTALL_DATE, getProperty, NULL, kJSPropertyAttributeReadOnly },
+ { APPLICATION_INFORMATION_INSTALL_SIZE, getProperty, NULL, kJSPropertyAttributeReadOnly },
{ 0, 0, 0, 0 }
};
@@ -86,7 +90,9 @@ JSValueRef JSApplicationInformation::createJSObject(JSContextRef context,
const std::string &appId,
const std::string &iconPath,
const std::string &version,
- const bool &show)
+ const bool &show,
+ const time_t &installDate,
+ const long &size)
{
ApplicationInformationPtr privateData = ApplicationInformationPtr(new ApplicationInformation());
privateData->setName(name);
@@ -94,6 +100,8 @@ JSValueRef JSApplicationInformation::createJSObject(JSContextRef context,
privateData->setIconPath(iconPath);
privateData->setVersion(version);
privateData->setShow(show);
+ privateData->setInstallDate(installDate);
+ privateData->setSize(size);
JSApplicationInformationPriv *priv = new JSApplicationInformationPriv(context, privateData);
@@ -176,6 +184,10 @@ JSValueRef JSApplicationInformation::getProperty(JSContextRef context,
return converter.toJSValueRef(privateData->getVersion());
} else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INFORMATION_SHOW)) {
return converter.toJSValueRef(privateData->getShow());
+ } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INFORMATION_INSTALL_DATE)) {
+ return converter.toJSValueRef(privateData->getInstallDate());
+ } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INFORMATION_INSTALL_SIZE)) {
+ return converter.toJSValueRefLong(privateData->getSize());
}
} Catch(WrtDeviceApis::Commons::Exception) {
diff --git a/src/standards/Tizen/Application/JSApplicationInformation.h b/src/standards/Tizen/Application/JSApplicationInformation.h
index e906f38..b5b7b71 100755
--- a/src/standards/Tizen/Application/JSApplicationInformation.h
+++ b/src/standards/Tizen/Application/JSApplicationInformation.h
@@ -40,7 +40,9 @@ public:
const std::string &package,
const std::string &iconPath,
const std::string &version,
- const bool &show);
+ const bool &show,
+ const time_t &installDate,
+ const long &size);
static bool isObjectOfClass(JSContextRef context, JSValueRef value);
diff --git a/src/standards/Tizen/Application/JSApplicationInstallInfo.cpp b/src/standards/Tizen/Application/JSApplicationInstallInfo.cpp
new file mode 100755
index 0000000..0025807
--- /dev/null
+++ b/src/standards/Tizen/Application/JSApplicationInstallInfo.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cassert>
+#include <memory>
+#include <dpl/log/log.h>
+#include <CommonsJavaScript/JSUtils.h>
+#include <CommonsJavaScript/Converter.h>
+#include <Commons/Exception.h>
+#include <Tizen/Common/JSTizenExceptionFactory.h>
+#include <Tizen/Common/JSTizenException.h>
+#include <API/Application/ApplicationInstallInfo.h>
+#include "JSApplicationInstallInfo.h"
+
+namespace TizenApis {
+namespace Tizen1_0 {
+namespace Application {
+
+using namespace WrtDeviceApis;
+using namespace Api::Application;
+using namespace TizenApis::Commons;
+
+
+namespace {
+const char* APPLICATION_INSTALL_INFO_FILEPATH = "filePath";
+const char* APPLICATION_INSTALL_INFO_ALGORITHM = "algorithm";
+const char* APPLICATION_INSTALL_INFO_KEY = "key";
+const char* APPLICATION_INSTALL_INFO_PACKAGEFORMAT = "packageFormat";
+
+} //private namespace
+
+JSClassRef JSApplicationInstallInfo::m_classRef = NULL;
+
+//TODO: recheck
+JSClassDefinition JSApplicationInstallInfo::m_classInfo = {
+ 0,
+ kJSClassAttributeNone,
+ "ApplicationInstallInfo",
+ 0,
+ m_property,
+ 0,
+ initialize,
+ finalize,
+ NULL, //HasProperty,
+ getProperty, //GetProperty,
+ NULL, //SetProperty,
+ NULL, //DeleteProperty,
+ NULL, //GetPropertyNames,
+ NULL, //CallAsFunction,
+ NULL, //CallAsConstructor,
+ NULL,
+ NULL, //ConvertToType
+};
+
+JSStaticValue JSApplicationInstallInfo::m_property[] = {
+ { APPLICATION_INSTALL_INFO_FILEPATH, getProperty, NULL, kJSPropertyAttributeNone },
+ { APPLICATION_INSTALL_INFO_ALGORITHM, getProperty, NULL, kJSPropertyAttributeNone },
+ { APPLICATION_INSTALL_INFO_KEY, getProperty, NULL, kJSPropertyAttributeNone },
+ { APPLICATION_INSTALL_INFO_PACKAGEFORMAT, getProperty, NULL, kJSPropertyAttributeNone },
+ { 0, 0, 0, 0 }
+};
+
+JSClassRef JSApplicationInstallInfo::getClassRef() {
+ if (!m_classRef) {
+ m_classRef = JSClassCreate(&m_classInfo);
+ }
+ return m_classRef;
+}
+
+JSValueRef JSApplicationInstallInfo::createJSObject(JSContextRef context,
+ const std::string &filePath,
+ const std::string &algorithm,
+ const std::string &key,
+ const std::string &packageFormat)
+{
+ ApplicationInstallInfoPtr privateData = ApplicationInstallInfoPtr(new ApplicationInstallInfo());
+ privateData->setFilePath(filePath);
+ privateData->setAlgorithm(algorithm);
+ privateData->setKey(key);
+ privateData->setPackageFormat(packageFormat);
+
+ JSApplicationInstallInfoPriv *priv = new JSApplicationInstallInfoPriv(context, privateData);
+
+ JSObjectRef jsValueRef = JSObjectMake(context, getClassRef(), static_cast<void*>(priv));
+ if (NULL == jsValueRef) {
+ LogError("object creation error");
+ return JSValueMakeUndefined(context);
+ }
+
+ return jsValueRef;
+}
+
+void JSApplicationInstallInfo::initialize(JSContextRef context, JSObjectRef object)
+{
+ LogInfo(">> initialize");
+}
+
+void JSApplicationInstallInfo::finalize(JSObjectRef object)
+{
+ LogInfo(">> finalize");
+ JSApplicationInstallInfoPriv* priv = static_cast<JSApplicationInstallInfoPriv*>(JSObjectGetPrivate(object));
+ JSObjectSetPrivate(object, NULL);
+ LogDebug("Deleting JSApplicationInstallInfo object");
+ delete priv;
+}
+
+bool JSApplicationInstallInfo::isObjectOfClass(JSContextRef context, JSValueRef value)
+{
+ return JSValueIsObjectOfClass(context, value, getClassRef());
+}
+
+ApplicationInstallInfoPtr JSApplicationInstallInfo::getPrivData(JSObjectRef object)
+{
+ JSApplicationInstallInfoPriv *priv = static_cast<JSApplicationInstallInfoPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ ApplicationInstallInfoPtr result = priv->getObject();
+ if (!result) {
+ ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+ }
+ return result;
+}
+
+ApplicationInstallInfoPtr JSApplicationInstallInfo::getApplicationInstallInfo(JSContextRef context, JSValueRef value)
+{
+ if (!isObjectOfClass(context, value)) {
+ Throw(WrtDeviceApis::Commons::InvalidArgumentException);
+ }
+
+ JSObjectRef object = JSValueToObject(context, value, NULL);
+ if (!object) {
+ Throw(WrtDeviceApis::Commons::InvalidArgumentException);
+ }
+
+ JSApplicationInstallInfoPriv *priv = static_cast<JSApplicationInstallInfoPriv*>(JSObjectGetPrivate(object));
+ if (!priv) {
+ Throw(WrtDeviceApis::Commons::NullPointerException);
+ }
+
+ return priv->getObject();
+}
+
+JSValueRef JSApplicationInstallInfo::getProperty(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception)
+{
+ Try {
+ CommonsJavaScript::Converter converter(context);
+ ApplicationInstallInfoPtr privateData = getPrivData(object);
+
+ if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INSTALL_INFO_FILEPATH)) {
+ return converter.toJSValueRef(privateData->getFilePath());
+ } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INSTALL_INFO_ALGORITHM)) {
+ return converter.toJSValueRef(privateData->getAlgorithm());
+ } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INSTALL_INFO_KEY)) {
+ return converter.toJSValueRef(privateData->getKey());
+ } else if (JSStringIsEqualToUTF8CString(propertyName, APPLICATION_INSTALL_INFO_PACKAGEFORMAT)) {
+ return converter.toJSValueRef(privateData->getPackageFormat());
+ }
+
+ } Catch(WrtDeviceApis::Commons::Exception) {
+ LogError("Exception: " << _rethrown_exception.GetMessage());
+ JSTizenExceptionFactory::postException(context, exception,JSTizenException::INVALID_VALUES_ERROR, "Invalid value error");
+ }
+
+ return JSValueMakeUndefined(context);
+}
+
+
+}
+}
+}
diff --git a/src/standards/Tizen/Application/JSApplicationInstallInfo.h b/src/standards/Tizen/Application/JSApplicationInstallInfo.h
new file mode 100755
index 0000000..2858a3f
--- /dev/null
+++ b/src/standards/Tizen/Application/JSApplicationInstallInfo.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TIZENAPIS_TIZEN_JS_APPLICATION_INSTALL_INFO_H_
+#define TIZENAPIS_TIZEN_JS_APPLICATION_INSTALL_INFO_H_
+
+#include <JavaScriptCore/JavaScript.h>
+#include <CommonsJavaScript/PrivateObject.h>
+#include <dpl/shared_ptr.h>
+#include <API/Application/ApplicationInstallInfo.h>
+
+namespace TizenApis {
+namespace Tizen1_0 {
+namespace Application {
+
+typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<Api::Application::ApplicationInstallInfoPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSApplicationInstallInfoPriv;
+
+class JSApplicationInstallInfo {
+public:
+ /*
+ * This initializes this JS class in the JS Engine.
+ */
+ static JSClassRef getClassRef();
+
+ static JSValueRef createJSObject(JSContextRef context,
+ const std::string &filePath,
+ const std::string &algorithm,
+ const std::string &key,
+ const std::string &packageFormat);
+
+ static bool isObjectOfClass(JSContextRef context, JSValueRef value);
+
+ static Api::Application::ApplicationInstallInfoPtr
+ getApplicationInstallInfo(JSContextRef context, JSValueRef value);
+
+private:
+ /**
+ * The callback invoked when an object is first created.
+ */
+ static void initialize(JSContextRef context, JSObjectRef object);
+
+ /**
+ * The callback invoked when an object is finalized.
+ */
+ static void finalize(JSObjectRef object);
+
+ /**
+ * This structure contains properties and callbacks that define a type of object.
+ */
+ static JSClassDefinition m_classInfo;
+
+ /**
+ * This structure describes a statically declared function property.
+ */
+ static JSStaticFunction m_functions[];
+
+ /**
+ * This member variable contains the initialization values for the static properties of this class.
+ * The values are given according to the data structure JSPropertySpec
+ */
+ static JSStaticValue m_property[];
+
+ static JSClassRef m_classRef;
+
+ static Api::Application::ApplicationInstallInfoPtr getPrivData(JSObjectRef object);
+
+ static JSValueRef getProperty(JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef* exception);
+
+};
+
+}
+}
+}
+#endif
diff --git a/src/standards/Tizen/Application/config.xml b/src/standards/Tizen/Application/config.xml
index 1db5eed..6d9817b 100755
--- a/src/standards/Tizen/Application/config.xml
+++ b/src/standards/Tizen/Application/config.xml
@@ -32,4 +32,9 @@
<device-capability>application.read</device-capability>
</api-feature>
+ <api-feature>
+ <name>http://tizen.org/api/application.install</name>
+ <device-capability>application.install</device-capability>
+ </api-feature>
+
</plugin-properties>
diff --git a/src/standards/Tizen/Application/plugin_config.cpp b/src/standards/Tizen/Application/plugin_config.cpp
index 02ff68c..ea853d0 100755
--- a/src/standards/Tizen/Application/plugin_config.cpp
+++ b/src/standards/Tizen/Application/plugin_config.cpp
@@ -28,10 +28,12 @@
#define APPLICATION_FEATURE_API_LAUNCH "http://tizen.org/api/application.launch"
#define APPLICATION_FEATURE_API_KILL "http://tizen.org/api/application.kill"
#define APPLICATION_FEATURE_API_READ "http://tizen.org/api/application.read"
+#define APPLICATION_FEATURE_API_INSTALL "http://tizen.org/api/application.install"
#define APPLICATION_DEVICE_CAP_LAUNCH "application.launch"
#define APPLICATION_DEVICE_CAP_KILL "application.kill"
#define APPLICATION_DEVICE_CAP_READ "application.read"
+#define APPLICATION_DEVICE_CAP_INSTALL "application.install"
using namespace WrtDeviceApis::Commons;
@@ -54,15 +56,18 @@ static FunctionMapping createApplicationFunctions()
ACE_CREATE_DEVICE_CAP(DEVICE_CAP_APPLICATION_LAUNCH, APPLICATION_DEVICE_CAP_LAUNCH);
ACE_CREATE_DEVICE_CAP(DEVICE_CAP_APPLICATION_KILL, APPLICATION_DEVICE_CAP_KILL);
ACE_CREATE_DEVICE_CAP(DEVICE_CAP_APPLICATION_READ, APPLICATION_DEVICE_CAP_READ);
+ ACE_CREATE_DEVICE_CAP(DEVICE_CAP_APPLICATION_INSTALL, APPLICATION_DEVICE_CAP_INSTALL);
ACE_CREATE_DEVICE_CAPS_LIST(EMPTY_DEVICE_LIST);
ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_APPLICATION_LAUNCH);
ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_APPLICATION_KILL);
ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_APPLICATION_READ);
+ ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_APPLICATION_INSTALL);
ACE_ADD_DEVICE_CAP(DEVICE_LIST_APPLICATION_LAUNCH, DEVICE_CAP_APPLICATION_LAUNCH);
ACE_ADD_DEVICE_CAP(DEVICE_LIST_APPLICATION_KILL, DEVICE_CAP_APPLICATION_KILL);
ACE_ADD_DEVICE_CAP(DEVICE_LIST_APPLICATION_READ, DEVICE_CAP_APPLICATION_READ);
+ ACE_ADD_DEVICE_CAP(DEVICE_LIST_APPLICATION_INSTALL, DEVICE_CAP_APPLICATION_INSTALL);
/**
* Api Features
@@ -71,6 +76,7 @@ static FunctionMapping createApplicationFunctions()
ACE_CREATE_FEATURE(FEATURE_APPLICATION_LAUNCH, APPLICATION_FEATURE_API_LAUNCH);
ACE_CREATE_FEATURE(FEATURE_APPLICATION_KILL, APPLICATION_FEATURE_API_KILL);
ACE_CREATE_FEATURE(FEATURE_APPLICATION_READ, APPLICATION_FEATURE_API_READ);
+ ACE_CREATE_FEATURE(FEATURE_APPLICATION_INSTALL, APPLICATION_FEATURE_API_INSTALL);
ACE_CREATE_FEATURE_LIST(APPLICATION_FEATURES_APPLICATION_LAUNCH);
ACE_ADD_API_FEATURE(APPLICATION_FEATURES_APPLICATION_LAUNCH, FEATURE_APPLICATION);
@@ -86,6 +92,10 @@ static FunctionMapping createApplicationFunctions()
ACE_ADD_API_FEATURE(APPLICATION_FEATURES_APPLICATION_READ, FEATURE_APPLICATION_KILL);
ACE_ADD_API_FEATURE(APPLICATION_FEATURES_APPLICATION_READ, FEATURE_APPLICATION_READ);
+ ACE_CREATE_FEATURE_LIST(APPLICATION_FEATURES_APPLICATION_INSTALL);
+ ACE_ADD_API_FEATURE(APPLICATION_FEATURES_APPLICATION_INSTALL, FEATURE_APPLICATION);
+ ACE_ADD_API_FEATURE(APPLICATION_FEATURES_APPLICATION_INSTALL, FEATURE_APPLICATION_INSTALL);
+
ACE_CREATE_FEATURE_LIST(APPLICATION_FEATURES_APPLICATION);
ACE_ADD_API_FEATURE(APPLICATION_FEATURES_APPLICATION, FEATURE_APPLICATION);
@@ -250,6 +260,36 @@ static FunctionMapping createApplicationFunctions()
APPLICATION_FUNCTION_API_HIDE,
hideFunc));
+ // install
+ AceFunction installFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_INSTALL_APP,
+ APPLICATION_FUNCTION_API_INSTALL_APP,
+ APPLICATION_FEATURES_APPLICATION_INSTALL,
+ DEVICE_LIST_APPLICATION_INSTALL);
+ applicationMapping.insert(std::make_pair(
+ APPLICATION_FUNCTION_API_INSTALL_APP,
+ installFunc));
+
+ // uninstall
+ AceFunction uninstallFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_UNINSTALL_APP,
+ APPLICATION_FUNCTION_API_UNINSTALL_APP,
+ APPLICATION_FEATURES_APPLICATION_INSTALL,
+ DEVICE_LIST_APPLICATION_INSTALL);
+ applicationMapping.insert(std::make_pair(
+ APPLICATION_FUNCTION_API_UNINSTALL_APP,
+ uninstallFunc));
+
+ // update
+ AceFunction updateFunc = ACE_CREATE_FUNCTION(
+ FUNCTION_UPDATE_APP,
+ APPLICATION_FUNCTION_API_UPDATE_APP,
+ APPLICATION_FEATURES_APPLICATION_INSTALL,
+ DEVICE_LIST_APPLICATION_INSTALL);
+ applicationMapping.insert(std::make_pair(
+ APPLICATION_FUNCTION_API_UPDATE_APP,
+ updateFunc));
+
return applicationMapping;
diff --git a/src/standards/Tizen/Application/plugin_config.h b/src/standards/Tizen/Application/plugin_config.h
index e000886..6503b38 100755
--- a/src/standards/Tizen/Application/plugin_config.h
+++ b/src/standards/Tizen/Application/plugin_config.h
@@ -21,6 +21,11 @@
#include <string>
#include <Commons/FunctionDeclaration.h>
+// feature : install
+#define APPLICATION_FUNCTION_API_INSTALL_APP "install"
+#define APPLICATION_FUNCTION_API_UNINSTALL_APP "uninstall"
+#define APPLICATION_FUNCTION_API_UPDATE_APP "update"
+
// feature : launch
#define APPLICATION_FUNCTION_API_LAUNCH "launch"
#define APPLICATION_FUNCTION_API_LAUNCH_SERVICE "launchService"