Update change log and spec for wrt-plugins-tizen_0.4.36
authorDongjin Choi <milkelf.choi@samsung.com>
Wed, 29 May 2013 11:12:13 +0000 (20:12 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Wed, 29 May 2013 11:12:13 +0000 (20:12 +0900)
[Issue#] N/A
[Problem] Unnecessary header files are included
[Solution] Fixed including of unnecessary header files
[SCMRequest] N/A

[Issue] N/A
[Problem] handle only 1 private object gc.
[Cause] N/A
[Solution] implementation.

[Issue#] N/A
[Problem] If send or write NDEFMessage after modifying NDEFMessage's records,the modification isn't adapted.
[Solution] re-making NDEFMessage when sending or writing NDEFMessage

[Issue#] N/A
[Problem] When call setter api, use virtual & absolute path. But, it is ambiguous.
[Solution] Remove set virtual path code

[Issue#] N/A
[Problem] Unstable thread when preloaded.
[Cause] DS thread not generated as expected.
[Solution] Don't use a DS thread for all function calls.

[Issue#] N/A
[Problem] Terminated TCT abnormally
[Cause] platform sent invalid values
[Solution] add validator

[Issue#] N/A
[Problem] Docomo App (menuapp) is not launched
[Cause] exception is thrown when try to get cert info of rpm type application
[Solution] return empty array instead of exception

[Issue#] N/A
[Problem] Calendar duration not updated when changing its value after initialization.
[Cause] Private object not shared between calendar event and time duration object.
[Solution] Revise the time duration handling routine to share its private object.

[Issue#] N/A
[Problem] Two TCT cases failed.
[Cause] Wrong rrule until date routine.
[Solution] Fix wrong until date initialization routine and add unit TC case for this.

[Issue#] N/A
[Problem] event callback is called after plugin unloading. and that make system crash
[Cause] N/A
[Solution] unset event callback after use

[Issue#] N/A
[Problem] When smnack is enabled, application size is not returned
[Cause] Smack access deny is occured
[Solution] use new API to get size data from pkg server

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

UnitTest Done.

29 files changed:
packaging/wrt-plugins-tizen.spec
src/Application/AppManagerWrapper.cpp
src/Application/ApplicationController.cpp
src/Application/ApplicationManager.cpp
src/Application/JSApplicationInformation.cpp
src/Calendar/CalendarConverter.cpp
src/Calendar/EventWrapper.cpp
src/Calendar/JSCalendarItemProperties.cpp
src/Callhistory/ResponseDispatcher.cpp
src/Callhistory/plugin_config.cpp
src/Contact/ContactsSvcChangeListenerManager.cpp
src/DataControl/DataControlAsyncCallbackManager.h
src/DataControl/MappedDataControlConsumer.cpp
src/DataControl/SqlDataControlConsumer.cpp
src/DataSync/DataSyncManager.h
src/DataSync/IDataSyncManager.cpp
src/Filesystem/Converter.cpp
src/Filesystem/ResponseDispatcher.cpp
src/NFC/NFCConverter.cpp
src/Package/JSPackageInformation.cpp
src/Package/PackageInformation.cpp
src/Package/PackageInformation.h
src/Package/PackageManager.cpp
src/Package/PackageManager.h
src/SystemSetting/JSSystemSetting.cpp [changed mode: 0644->0755]
src/TimeUtil/JSTimeDuration.cpp [changed mode: 0644->0755]
src/TimeUtil/JSTimeDuration.h
src/TimeUtil/TimeUtilConverter.cpp [changed mode: 0644->0755]
src/TimeUtil/TimeUtilConverter.h

index 141e6ef..7243995 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.35
+Version:    0.4.36
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 5401dc0..27e8bcf 100644 (file)
@@ -284,96 +284,41 @@ void AppManagerWrapper::unregisterAppListChangedCallbacks()
        m_manager_handle = NULL;
 }
 
-// @20130125-wscho: current pkgmanager has a problem while db operation.
-// So, below function is temporal function. all attribute should be filled to appInfoObject
-// when that is created.
-// See ApplicationManager.cpp
 bool AppManagerWrapper::initializeAppInfo(ApplicationInformationPtr &appInfo)
 {
-       std::string appId = appInfo->getAppId();
+       LoggerD("Enter");
+
        char* packageId = NULL;
        int ret = 0;
 
-       ret = package_manager_get_package_id_by_app_id(appId.c_str(), &packageId);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE)
-       {
+       ret = package_manager_get_package_id_by_app_id(appInfo->getAppId().c_str(), &packageId);
+       if ((ret != PACKAGE_MANAGER_ERROR_NONE) || (packageId == NULL)) {
                LoggerE("Fail to get package id");
-       }
-
-// Below code is already run on ApplicationManager.cpp
-#if 0
-       char* name = NULL;
-       char* iconPath = NULL;  
-       bool noDisplay = false;
-       pkgmgrinfo_appinfo_h appinfo_h;
-
-       ret = pkgmgrinfo_appinfo_get_appinfo(appId.c_str(), &appinfo_h);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get appinfo");
-       }
-
-       ret = pkgmgrinfo_appinfo_get_label(appinfo_h, &name);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get name");
-       }
-       appInfo->setName(name);
-
-       ret = pkgmgrinfo_appinfo_get_icon(appinfo_h, &iconPath);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get icon");
-       }
-       appInfo->setIconPath(iconPath);
-
-       ret = pkgmgrinfo_appinfo_is_nodisplay(appinfo_h, &noDisplay);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get nodisplay");
-       }
-       appInfo->setShow(!noDisplay);
-
-       ret = pkgmgrinfo_appinfo_foreach_category(appinfo_h, category_cb, (void*)appInfo.Get());
-       if (ret < 0)
-       {
-               LoggerE("Fail to get categories");
-       }
-       
-       ret = pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
-       if (ret < 0)
-       {
-               LoggerE("Fail to destroy ");
-       }
-#endif
-
-       char *version = NULL;
-       int total_size = 0;
-       int installed_time = 0;
-       pkgmgrinfo_pkginfo_h pkginfo_h;
-
-       ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &pkginfo_h);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get package info");
-       }
-
-       ret = pkgmgrinfo_pkginfo_get_version(pkginfo_h, &version);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get version");
-       }
-       appInfo->setVersion(version);
+       } else {
+               // get installed size from package server (to solve smack issue)
+               pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
+               if (pc == NULL) {
+                       LoggerE("Fail to create pkgmgr client");
+               } else {
+                       ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, pc, NULL, packageId, NULL, NULL, NULL);
+                       if (ret < 0) {
+                               LoggerE("Fail to get installed size");
+                       } else {
+                               appInfo->setInstallSize(ret);
+                       }
 
-       ret = pkgmgrinfo_pkginfo_get_total_size(pkginfo_h, &total_size);
-       if (ret == PMINFO_R_OK) {
-               LoggerE("Fail to get installed size");
-               appInfo->setInstallSize(total_size);
-       }
+                       pkgmgr_client_free(pc);
+                       pc = NULL;
+               }
 
-       ret = pkgmgrinfo_pkginfo_get_installed_time(pkginfo_h, &installed_time);
-       if (ret == PMINFO_R_OK) {
-               LoggerE("Fail to get installed date");
-               appInfo->setInstallDate(installed_time);
+               if (packageId) {
+                       free(packageId);
+               }
        }
 
-       pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h);
-
+       // if error occured, retry? or not?
        appInfo->setInitialize();
+
        return true;
 }
 
index be98d0d..8246cd9 100644 (file)
 #include "JSApplicationEventCallbackManager.h"
 #include "ApplicationAsyncCallbackManager.h"
 #include "ApplicationInformationEventPrivateData.h"
+
+// to unset event callback for kill() API
+#include <app_manager.h>
+
 #include <Logger.h>
 
 namespace DeviceAPI {
@@ -152,6 +156,9 @@ void ApplicationAsyncAnswerHandler::launch(const EventApplicationLaunchPtr &even
 
 void ApplicationAsyncAnswerHandler::kill(const EventApplicationKillPtr &event)
 {
+       // unset event callback to avoid additional event comes
+       app_manager_unset_app_context_event_cb();
+
        JSCallbackManagerPtr callbackManager =
                        DPL::StaticPointerCast<JSCallbackManager>(event->getPrivateData());
        if (!callbackManager) {
index 231e45e..cd62762 100644 (file)
@@ -257,54 +257,6 @@ namespace {
                return true;
        }
 
-#if 0
-       // @20130125-wscho: current pkgmanager has a problem while db operation.
-       // So, if enable below code, foreach callback of "pkgmgrinfo_appinfo_get_installed_list"
-       // is not running.
-       // So, temporally, we get version, total size, installed time on first access for that attribute.
-       // See JSApplicationInformation.cpp
-       static void set_additional_app_info(ApplicationInformationPtr &appInfo, const char* packageId)
-       {
-               int ret = 0;
-               char *version = NULL;
-               int total_size = 0;
-               int installed_time = 0;
-               pkgmgrinfo_pkginfo_h pkginfo_h;
-
-               ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &pkginfo_h);
-               if (ret != PMINFO_R_OK) {
-                       LoggerD("Fail to get package info. skip getting info");
-                       return;
-               }
-
-               ret = pkgmgrinfo_pkginfo_get_version(pkginfo_h, &version);
-               if ((ret != PMINFO_R_OK) || (version == NULL)) {
-                       LoggerD("Fail to get version");
-               } else {
-                       appInfo->setVersion(version);
-               }
-
-               ret = pkgmgrinfo_pkginfo_get_total_size(pkginfo_h, &total_size);
-               if (ret != PMINFO_R_OK) {
-                       LoggerD("Fail to get total size");
-               } else {
-                       appInfo->setInstallSize(total_size);
-               }
-
-               ret = pkgmgrinfo_pkginfo_get_installed_time(pkginfo_h, &installed_time);
-               if (ret != PMINFO_R_OK) {
-                       LoggerD("Fail to get installed time");
-               } else {
-                       appInfo->setInstallDate(installed_time);
-               }
-
-               ret = pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h);
-               if (ret != PMINFO_R_OK) {
-                       LoggerD("Fail to get destroy pkginfo");
-               }
-       }
-#endif
-
        static ApplicationInformationPtr create_app_info(pkgmgrinfo_appinfo_h handle)
        {
                char* appId = NULL;
@@ -355,25 +307,33 @@ namespace {
                        appInfo->setPackageId(pkgId);
                }
 
+               char *version = NULL;
+               int installed_time = 0;
+               pkgmgrinfo_pkginfo_h pkginfo_h;
 
-// @20130125-wscho: current pkgmanager has a problem while db operation.
-// So, if enable below code, foreach callback of "pkgmgrinfo_appinfo_get_installed_list"
-// is not running.
-// So, temporally, we get version, total size, installed time on first access for that attribute.
-// See JSApplicationInformation.cpp
-#if 0
-               ret = pkgmgrinfo_appinfo_get_pkgname(handle, &packageId);
-               if (ret != PMINFO_R_OK)
-               {
-                       LoggerD("Fail to get package id");
-                       return appInfo;
-               }
+               ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgId, &pkginfo_h);
+               if (ret != PMINFO_R_OK) {
+                       LoggerE("Fail to get package info");
+               } else {
+                       ret = pkgmgrinfo_pkginfo_get_version(pkginfo_h, &version);
+                       if (ret != PMINFO_R_OK) {
+                               LoggerE("Fail to get version");
+                       } else {
+                               appInfo->setVersion(version);
+                       }
 
-               set_additional_app_info(appInfo, packageId);
-#endif
+                       ret = pkgmgrinfo_pkginfo_get_installed_time(pkginfo_h, &installed_time);
+                       if (ret != PMINFO_R_OK) {
+                               LoggerE("Fail to get installed date");
+                       } else {
+                               appInfo->setInstallDate(installed_time);
+                       }
 
+                       pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h);
+               }
+
+               // remark : attribute "total size" is set at first attribute access time for performance.
                return appInfo;
-               
        }
        
        
@@ -439,6 +399,9 @@ ApplicationManager::~ApplicationManager()
        }
 
        gLaunchAppControlPendingEventMap.eraseKey(this);
+
+       // unset context event callback which is registered by kill().
+       app_manager_unset_app_context_event_cb();
 }
 
 void ApplicationManager::launch(const EventApplicationLaunchPtr& event)
@@ -829,7 +792,7 @@ ApplicationCertArrayPtr ApplicationManager::getAppCerts(const std::string id)
        TIME_TRACER_ITEM_BEGIN("(getAppCerts)package_info_foreach_cert_info", 0);
        result = package_info_foreach_cert_info(pkg_info, package_cert_cb, (void*)certArray.Get());
        TIME_TRACER_ITEM_END("(getAppCerts)package_info_foreach_cert_info", 0);
-       if (result != PACKAGE_MANAGER_ERROR_NONE)
+       if ((result != PACKAGE_MANAGER_ERROR_NONE) && (result != PACKAGE_MANAGER_ERROR_IO_ERROR))
        {
                ThrowMsg(UnknownException, "Can not get package cert info");
        }
index 31da6ef..97eb882 100644 (file)
@@ -178,18 +178,16 @@ JSValueRef JSApplicationInformation::getProperty(JSContextRef context,
                        return converter.toJSValueRef(privateData->getCategories());
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_PACKAGE_ID)) {
                        return converter.toJSValueRef(privateData->getPackageId());
+               } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_VERSION)) {
+                       return converter.toJSValueRef(privateData->getVersion());
+               } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_INSTALL_DATE)) {
+                       return converter.toJSValueRef(privateData->getInstallDate());
                } else {
-// below code is temporal. if package manager issue is solved, rollback this code.
-#if 1          // below code is used to fill attribute lazy
                        if (!privateData->isInitialized()) {
                                AppManagerWrapperSingleton::Instance().initializeAppInfo(privateData);
                        }
-#endif
-                       if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_VERSION)) {
-                               return converter.toJSValueRef(privateData->getVersion());
-                       } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_INSTALL_DATE)) {
-                               return converter.toJSValueRef(privateData->getInstallDate());
-                       } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_INSTALL_SIZE)) {
+
+                       if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_INFORMATION_INSTALL_SIZE)) {
                                return converter.toJSValueRefLong(privateData->getInstallSize());
                        } 
                }
index c13b5a7..9bc0a6d 100755 (executable)
@@ -343,7 +343,7 @@ EventRecurrenceRulePtr CalendarConverter::toEventRecurrenceRule(JSValueRef rrule
             result->setEndDate((long long int) (timeUtilConverter.getTimeInMilliseconds(untilDateData)/1000));
             result->setTimeZone(timeUtilConverter.getPropertiesInTZDate(untilDateData).timezone);
         } else {
-            result->setEndDate(0);
+            result->setEndDate(UNDEFINED_TIME);
         }
     }
     if (!JSValueIsUndefined(m_context, occurrenceCountData)) {
@@ -843,25 +843,12 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo
     }
 
     if (!JSValueIsUndefined(m_context, durationData) && !JSValueIsNull(m_context, durationData)) {
-        long long length = timeUtilConverter.getDurationLength(durationData);
-        int unit = timeUtilConverter.getDurationUnit(durationData);
+               DurationPropertiesPtr duration = timeUtilConverter.getDuration(durationData);
+        long long length = duration->length;
+        int unit = duration->unit;
         LoggerD("duration length: "<<length<<", unit "<<unit);
-        if( MSECS_UNIT==unit ) {
-                   result->setEndTime(result->getStartTime() + length/1000);
-               } else if( SECONDS_UNIT==unit ) {
-            result->setEndTime(result->getStartTime() + length);
-        } else if ( MINUTES_UNIT==unit ) {
-            result->setEndTime(result->getStartTime() + length*60);
-        } else if ( HOURS_UNIT==unit ) {
-            result->setEndTime(result->getStartTime() + length*60*60);
-        } else if ( DAYS_UNIT==unit ) {
-            result->setEndTime(result->getStartTime() + length*24*60*60);
-        } else {
-            ThrowMsg(ConversionException, "Wrong duration unit.");
-        }
 
-               result->getDuration()->length = length;
-               result->getDuration()->unit = unit;
+               result->setDuration(duration);
     }
     if (!JSValueIsUndefined(m_context, locationData)) {
         result->setLocation(toString(locationData));
index cab98f0..b60b730 100755 (executable)
@@ -15,6 +15,7 @@
 // limitations under the License.
 //
 
+
 #include <sstream>
 #include <algorithm>
 #include <time.h>
@@ -23,6 +24,7 @@
 #include "Calendar.h"
 #include "CalendarUtility.h"
 #include <Logger.h>
+#include <DurationProperties.h>
 
 using namespace WrtDeviceApis::Commons;
 
@@ -478,7 +480,28 @@ void EventWrapper::setEndTimeToPlatformEvent()
     int ret;
     long long int time = m_abstractEvent->getEndTime();
     if (time == UNDEFINED_TIME) {
-        time = m_abstractEvent->getStartTime();
+               if(0<m_abstractEvent->getDuration()->length) {
+               long long length = m_abstractEvent->getDuration()->length;
+               int unit = m_abstractEvent->getDuration()->unit;
+
+               if( DeviceAPI::Time::SECONDS_UNIT==unit ) {
+                   time = m_abstractEvent->getStartTime() + length;
+               } else if ( DeviceAPI::Time::MINUTES_UNIT==unit ) {
+                   time = m_abstractEvent->getStartTime() + length*60;
+               } else if ( DeviceAPI::Time::HOURS_UNIT==unit ) {
+                   time = m_abstractEvent->getStartTime() + length*60*60;
+               } else if ( DeviceAPI::Time::DAYS_UNIT==unit ) {
+                   time = m_abstractEvent->getStartTime() + length*24*60*60;
+               } else if ( DeviceAPI::Time::MSECS_UNIT==unit ) {
+                   time = m_abstractEvent->getStartTime() + length/1000;
+               } else {
+                   LoggerD("Wrong duration unit: "<<unit);
+               }
+                       LoggerD("Set the end time from the duration: "<<time);
+               } else {
+               time = m_abstractEvent->getStartTime();
+                       LoggerD("Set the end time from the start time: "<<time);
+               }
     }
 
     calendar_time_s cal;
index 31fbaf9..28c912e 100755 (executable)
@@ -22,6 +22,7 @@
 #include <JSWebAPIErrorFactory.h>
 #include <SecurityExceptions.h>
 #include <TimeUtilConverter.h>
+#include <JSTimeDuration.h>
 #include <JSTZDate.h>
 #include <JSSimpleCoordinates.h>
 #include "EventAlarm.h"
@@ -808,14 +809,10 @@ JSValueRef JSCalendarItemProperties::getPropertyDuration(JSContextRef context,
     Try
     {
         CalendarEventPtr item = getPrivateObject(object);
-        TimeUtilConverter converter(context);
 
-               DurationProperties duration;
                if(UNDEFINED_TIME!=item->getDuration()->length) {
-                       duration.length = item->getDuration()->length;
-                       duration.unit = item->getDuration()->unit;
-                       LoggerD("Duration length: "<<duration.length<<", unit: "<<duration.unit);
-                       return converter.makeDurationObject( duration );
+                       LoggerD("Duration length: "<<item->getDuration()->length<<", unit: "<<item->getDuration()->unit);
+                       return JSTimeDuration::createJSObject(context, item->getDuration());
                }
 
                // Alternatively generate the duration object using start/end time.
@@ -826,10 +823,13 @@ JSValueRef JSCalendarItemProperties::getPropertyDuration(JSContextRef context,
 
         long long length = item->getEndTime() - item->getStartTime(); // in seconds only
         LoggerD("item->getStartTime():"<< item->getStartTime() << ", length:" << length);
-               duration.length = length;
-               duration.unit = SECONDS_UNIT;
 
-        return converter.makeDurationObject( duration );
+               DurationPropertiesPtr durationPtr(new DurationProperties());
+               durationPtr->length = length;
+               durationPtr->unit = SECONDS_UNIT;
+               item->setDuration(durationPtr);
+
+               return JSTimeDuration::createJSObject(context, durationPtr);
     }
     Catch(Exception)
     {
@@ -847,30 +847,18 @@ bool JSCalendarItemProperties::setPropertyDuration(JSContextRef context,
     Try
     {
         CalendarEventPtr event = getPrivateObject(object);
-        TimeUtilConverter converter(context);
-        long long length = converter.getDurationLength(value);
-        int unit = converter.getDurationUnit(value);
+        TimeUtilConverter timeUtilConverter(context);
+
+               DurationPropertiesPtr duration = timeUtilConverter.getDuration(value);
+        long long length = duration->length;
+        int unit = duration->unit;
         if (length < 0) {
             DeviceAPI::Common::JSWebAPIErrorFactory::postException(context, exception, DeviceAPI::Common::JSWebAPIErrorFactory::INVALID_VALUES_ERROR);
             return false;
         }
-        if( SECONDS_UNIT==unit ) {
-            event->setEndTime(event->getStartTime() + length);
-        } else if ( MINUTES_UNIT==unit ) {
-            event->setEndTime(event->getStartTime() + length*60);
-        } else if ( HOURS_UNIT==unit ) {
-            event->setEndTime(event->getStartTime() + length*60*60);
-        } else if ( DAYS_UNIT==unit ) {
-            event->setEndTime(event->getStartTime() + length*24*60*60);
-        } else if ( MSECS_UNIT==unit ) {
-            event->setEndTime(event->getStartTime() + length/1000);
-        } else {
-            DeviceAPI::Common::JSWebAPIErrorFactory::postException(context, exception, DeviceAPI::Common::JSWebAPIErrorFactory::INVALID_VALUES_ERROR);
-            return false;
-        }
 
-               event->getDuration()->length = length;
-               event->getDuration()->unit = unit;
+        LoggerD("length: "<<length<< ", unit:" <<unit);
+               event->setDuration(duration);
 
         return true;
     }
index 8002c0f..c11a9c2 100755 (executable)
@@ -16,7 +16,6 @@
 //
  
 #include "ResponseDispatcher.h"
-#include <dpl/assert.h>
 #include <Commons/Exception.h>
 #include <Commons/IEvent.h>
 #include <CommonsJavaScript/JSUtils.h>
index ca0128b..5f09245 100755 (executable)
@@ -19,7 +19,6 @@
 #include <map>
 #include <utility>
 
-#include <dpl/assert.h>
 #include <Commons/FunctionDefinition.h>
 #include <Commons/FunctionDeclaration.h>
 #include <Commons/Exception.h>
index 69e1bbc..8c5f127 100755 (executable)
@@ -218,7 +218,18 @@ void ContactsSvcChangeListenerManager::contactsDbChangedCallback(const char* vie
 
 void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view_uri, char* changes, void* user_data)
 {
-       LoggerD("entered");
+       LoggerD("entered : " << changes);
+
+       if(changes == NULL)
+       {
+               LoggerW("changes is NULL");
+               return;
+       }else{
+               if(strlen(changes) == 0){
+                       LoggerW("changes is empty");
+                       return;
+               }
+       }
 
        if(user_data == NULL)
        {
@@ -517,25 +528,27 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes)
 
        int tmpUpdatedType = 0;
        int tmpUpdatedContactId = 0;
-       char* ptr;
-       char* sub_ptr;
-
-       ptr = strtok(changes, ",");
+       char* sub_ptr = NULL;
 
-       sub_ptr = strtok(ptr, ":");
-       tmpUpdatedType = atoi((const char*)sub_ptr);
-       sub_ptr = strtok(NULL, ptr);
-       tmpUpdatedContactId = atoi((const char*)sub_ptr);
-       idList.insert(pair<int, int>(tmpUpdatedType, tmpUpdatedContactId));
+       char* tmp = g_strdup(changes);
+       LoggerD("tmp : " << tmp);
 
-       while(ptr = strtok(NULL, changes))
+       sub_ptr = strtok(tmp, " ,:");
+       while(sub_ptr != NULL)
        {
-               sub_ptr = strtok(ptr, ":");
-               tmpUpdatedType = atoi((const char*)sub_ptr);
-               sub_ptr = strtok(NULL, ptr);
-               tmpUpdatedContactId = atoi((const char*)sub_ptr);
-               idList.insert(pair<int, int>(tmpUpdatedType, tmpUpdatedContactId));
+               if(validate("^[0-9]+$", sub_ptr, VALIDATE_MATCH_CASELESS))
+               {
+                       tmpUpdatedType = atoi((const char*)sub_ptr);
+                       sub_ptr = strtok(NULL, " ,:");
+                       if(validate("^[0-9]+$", sub_ptr, VALIDATE_MATCH_CASELESS))
+                       {
+                               tmpUpdatedContactId = atoi((const char*)sub_ptr);
+                               idList.insert(pair<int, int>(tmpUpdatedType, tmpUpdatedContactId));
+                       }
+               }
+               sub_ptr = strtok(NULL, " ,:");
        }
+       g_free(tmp);
 
        PersonsChangeListenerSet::iterator callbacksIter = m_personsChangeListenerSet.begin();
        for(; callbacksIter != m_personsChangeListenerSet.end(); callbacksIter++)
index b2308ba..29cec97 100755 (executable)
@@ -31,8 +31,6 @@ class DataControlAsyncCallbackManager : public DeviceAPI::Common::AsyncCallbackM
 public:
        DataControlAsyncCallbackManager()
        {
-               m_sqlDataControlGC = false;
-               m_mappedDataControlGC = false;
        }
 
        virtual ~DataControlAsyncCallbackManager()
@@ -40,10 +38,52 @@ public:
                cleanupSQLUserData();
        }
        
-       bool isSQLDataControlGC() { return m_sqlDataControlGC;}
-       bool isMappedDataControlGC() { return m_mappedDataControlGC;}
-       void setSQLDataControlGC(bool gc) { m_sqlDataControlGC = gc;}
-       void setMappedDataControlGC(bool gc) { m_mappedDataControlGC = gc;}
+       bool isSQLDataControlGC(void* address) 
+       { 
+               LoggerD(address);
+
+               if (m_sqlDataControlGCMap.find(address) == m_sqlDataControlGCMap.end())
+               {
+                       return true;
+               }
+
+               return m_sqlDataControlGCMap[address];
+       }
+       bool isMappedDataControlGC(void* address) 
+       { 
+               LoggerD(address);
+
+               if (m_mappedDataControlGCMap.find(address) == m_sqlDataControlGCMap.end())
+               {
+                       return true;
+               }
+
+               return m_mappedDataControlGCMap[address];
+       }
+       void setSQLDataControlGC(void* address, bool gc) 
+       { 
+               LoggerD(address);
+                       
+               DPL::Mutex::ScopedLock lock(&m_mutex);                  
+               if (gc && m_sqlDataControlGCMap.find(address) != m_sqlDataControlGCMap.end())
+               {
+                       m_mappedDataControlGCMap.erase(address);
+               }
+               m_sqlDataControlGCMap[address] = gc;
+       }
+
+       void setMappedDataControlGC(void* address, bool gc) 
+       { 
+               LoggerD(address);
+               
+               DPL::Mutex::ScopedLock lock(&m_mutex);                  
+               if (gc && m_mappedDataControlGCMap.find(address) != m_mappedDataControlGCMap.end())
+               {
+                       m_mappedDataControlGCMap.erase(address);
+               }
+               m_mappedDataControlGCMap[address] = gc;
+       }
+       
        bool checkReqIdUnique(std::string key) 
        {
                if (m_callbackSQLUserDataMap.find(key) == m_callbackSQLUserDataMap.end())
@@ -131,8 +171,8 @@ private:
                }
        }
        DPL::Mutex m_mutex;
-       bool m_sqlDataControlGC;
-       bool m_mappedDataControlGC;
+       std::map<void*, bool> m_sqlDataControlGCMap;
+       std::map<void*, bool> m_mappedDataControlGCMap;
        std::map<std::string, void*> m_callbackSQLUserDataMap;
        
 };
index 2423e82..a63649a 100644 (file)
@@ -115,15 +115,15 @@ static void MappedDataControlGetValueCallback(bundle* b, int request_code, appsv
                }
 
                pendingEvent = (EventGetValuePendingEvent *)data;
-               
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC())
+               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-
-               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+               
                event = pendingEvent->getEvent();
 
                if (b == NULL)
@@ -260,15 +260,15 @@ static void MappedDataControlAddValueCallback(bundle* b, int request_code, appsv
                }
 
                pendingEvent = (EventAddValuePendingEvent *)data;
+               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
 
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC())
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-                               
-               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+               
                event = pendingEvent->getEvent();
 
                if (b == NULL)
@@ -335,15 +335,15 @@ static void MappedDataControlRemoveValueCallback(bundle* b, int request_code, ap
                }
 
                pendingEvent = (EventRemoveValuePendingEvent *)data;
-
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC())
+               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+               
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-                               
-               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+               
                event = pendingEvent->getEvent();
 
                if (b == NULL)
@@ -411,15 +411,15 @@ static void MappedDataControlUpdateValueCallback(bundle* b, int request_code, ap
                }
                
                pendingEvent = (EventUpdateValuePendingEvent *)data;
-
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC())
+               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+               
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isMappedDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-               
-               consumer = (MappedDataControlConsumer*)pendingEvent->getThisObject();
+                               
                event = pendingEvent->getEvent();
 
                if (b == NULL)
@@ -478,14 +478,14 @@ MappedDataControlConsumer::MappedDataControlConsumer(std::string& provId, std::s
        m_type = type;;
        m_dataId = dataId;
        m_providerId = provId;
-       DataControlAsyncCallbackManagerSingleton::Instance().setMappedDataControlGC(false);
+       DataControlAsyncCallbackManagerSingleton::Instance().setMappedDataControlGC((void*)this, false);
 
 }
 
 MappedDataControlConsumer::~MappedDataControlConsumer() 
 {
        LoggerD("Enter");
-       DataControlAsyncCallbackManagerSingleton::Instance().setMappedDataControlGC(true);
+       DataControlAsyncCallbackManagerSingleton::Instance().setMappedDataControlGC((void*)this, true);
        
 }
 
index a2cbeb5..fd22114 100644 (file)
@@ -125,15 +125,14 @@ static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_res
                }
 
                pendingEvent = (EventSelectPendingEvent *)DataControlAsyncCallbackManagerSingleton::Instance().removeSQLUserData(bundleKey);
-       
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC())
+               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
+
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-               
-               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
                event = pendingEvent->getEvent();
                
                std::vector<std::string> result = getDataArrayFromBundle(b, OSP_K_ARG);
@@ -200,15 +199,15 @@ static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_res
                }
 
                pendingEvent = (EventInsertPendingEvent *)DataControlAsyncCallbackManagerSingleton::Instance().removeSQLUserData(bundleKey);
+               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
 
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC())
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-                               
-               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
+               
                event = pendingEvent->getEvent();
 
                std::vector<std::string> result = getDataArrayFromBundle(b, OSP_K_ARG);
@@ -258,12 +257,6 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res
 {
        LoggerD("Enter");
 
-       if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC())
-       {
-               LoggerD("private object is garbage collected");
-               return;
-       }
-
        EventDeletePendingEvent* pendingEvent = NULL;
        SQLDataControlConsumer *consumer = NULL;
        EventDeletePtr event;
@@ -284,15 +277,15 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res
                }
 
                pendingEvent = (EventDeletePendingEvent *)DataControlAsyncCallbackManagerSingleton::Instance().removeSQLUserData(bundleKey);
+               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
 
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC())
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-               
-               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
+
                event = pendingEvent->getEvent();
 
                std::vector<std::string> result = getDataArrayFromBundle(b, OSP_K_ARG);
@@ -356,14 +349,15 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res
                }
 
                pendingEvent = (EventUpdatePendingEvent *)DataControlAsyncCallbackManagerSingleton::Instance().removeSQLUserData(bundleKey);    
-               
-               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC())
+               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
+
+               if (DataControlAsyncCallbackManagerSingleton::Instance().isSQLDataControlGC((void*)consumer))
                {
                        LoggerD("private object is garbage collected");
                        delete pendingEvent;
                        return;
                }
-               consumer = (SQLDataControlConsumer*)pendingEvent->getThisObject();
+               
                event = pendingEvent->getEvent();
 
                std::vector<std::string> result = getDataArrayFromBundle(b, OSP_K_ARG);
@@ -417,13 +411,13 @@ SQLDataControlConsumer::SQLDataControlConsumer(std::string& provId, std::string&
 
        m_currentAppId = getCurrentApplicationId();
        createResultDir();
-       DataControlAsyncCallbackManagerSingleton::Instance().setSQLDataControlGC(false);
+       DataControlAsyncCallbackManagerSingleton::Instance().setSQLDataControlGC((void*)this, false);
 }
 
 SQLDataControlConsumer::~SQLDataControlConsumer() 
 {
        LoggerD("Enter");
-       DataControlAsyncCallbackManagerSingleton::Instance().setSQLDataControlGC(true);
+       DataControlAsyncCallbackManagerSingleton::Instance().setSQLDataControlGC((void*)this, true);
 }
 
 DPL::Mutex SQLDataControlConsumer::m_mutex;
index c8528e0..603cf5a 100755 (executable)
@@ -36,6 +36,46 @@ class DataSyncManager : public IDataSyncManager
     DataSyncManager();
     virtual ~DataSyncManager();
 
+       virtual void addProfile(const IEventAddProfilePtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void updateProfile(const IEventUpdateProfilePtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void removeProfile(const IEventRemoveProfilePtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void getMaxProfilesNum(const IEventGetMaxProfilesNumPtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void getProfilesNum(const IEventGetProfilesNumPtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void getProfile(const IEventGetProfilePtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void getAllProfiles(const IEventGetAllProfilesPtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void startSync(const IEventStartSyncPtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void stopSync(const IEventStopSyncPtr &event) {
+               OnRequestReceived(event);
+       }
+
+       virtual void getLastSyncStatistics(const IEventGetLastSyncStatisticsPtr &event) {
+               OnRequestReceived(event);
+       }
+
     std::map<std::string, OnDataSyncStateChangedEmitterPtr> m_changeEmitters;
 
   protected:
index 4e4f454..2aaf91f 100755 (executable)
@@ -23,16 +23,16 @@ namespace DeviceAPI {
 namespace DataSync {
 
 IDataSyncManager::IDataSyncManager() :
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventAddProfile >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateProfile >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventRemoveProfile >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetMaxProfilesNum >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetProfilesNum >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetProfile >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetAllProfiles >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventStartSync >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventStopSync >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD),
-    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetLastSyncStatistics >(WrtDeviceApis::Commons::ThreadEnum::DOWNLOAD_THREAD)
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventAddProfile >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateProfile >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventRemoveProfile >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetMaxProfilesNum >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetProfilesNum >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetProfile >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetAllProfiles >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventStartSync >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventStopSync >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD),
+    WrtDeviceApis::Commons::EventRequestReceiver< IEventGetLastSyncStatistics >(WrtDeviceApis::Commons::ThreadEnum::NULL_THREAD)
 {
 }
 
index 3501f5d..1324637 100755 (executable)
@@ -22,6 +22,7 @@
 #include "IPath.h"
 #include <Commons/Exception.h>
 #include <CommonsJavaScript/JSUtils.h>
+#include <CommonsJavaScript/ScopedJSStringRef.h>
 #include "FilesystemUtils.h"
 #include "JSFile.h"
 #include "Encodings.h"
@@ -284,7 +285,15 @@ JSValueRef Converter::toJSValueRef(
                        break;
                }
 
-               JSObjectRef jsObject = JSStorage::createJSObject(context, tmpStorage);
+               JSObjectRef jsObject = JSObjectMake(m_context, NULL, NULL);
+               const ScopedJSStringRef labelStr(JSStringCreateWithUTF8CString("label"));
+               const ScopedJSStringRef typeStr(JSStringCreateWithUTF8CString("type"));
+               const ScopedJSStringRef stateStr(JSStringCreateWithUTF8CString("state"));
+
+               JSObjectSetProperty(m_context, jsObject, labelStr.get(), toJSValueRef(tmpStorage.getLabel()), kJSPropertyAttributeReadOnly, NULL);
+               JSObjectSetProperty(m_context, jsObject, typeStr.get(), toStorageType(tmpStorage.getType()), kJSPropertyAttributeReadOnly, NULL);
+               JSObjectSetProperty(m_context, jsObject, stateStr.get(), toStorageState(tmpStorage.getState()), kJSPropertyAttributeReadOnly, NULL);
+               
                if (!jsObject) {
                        ThrowMsg(Commons::ConversionException, "Could not create JS object.");
                }
index 503115b..4f2d96f 100644 (file)
@@ -18,7 +18,6 @@
 #include "ResponseDispatcher.h"
 
 #include <dpl/assert.h>
-
 #include <Commons/Exception.h>
 #include <Commons/IEvent.h>
 #include <CommonsJavaScript/JSUtils.h>
@@ -70,11 +69,17 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event)
        if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
                event->getResult()->setPermissions(data->getPerms());
                JSFile::PrivateObjectDefPtr privData(new JSFile::PrivateObjectDef(event->getResult(), JSFile::PrivateObjectDef::PermissionList()));
-               INodePtr parent = event->getResult()->getParent();
-               
-               if (parent)
+               try {
+                       INodePtr parent = event->getResult()->getParent();
+                       
+                       if (parent)
+                       {
+                               privData->pushParentPermissions(data->getPerms());
+                       }
+               }
+               catch (...)
                {
-                       privData->pushParentPermissions(data->getPerms());
+                       LoggerD("no parent");
                }
 
                JSObjectRef object = JSUtils::makeObject(data->getCallbackManager()->getContext(), JSFile::getClassRef(), privData);
index c8723dc..3df45e4 100644 (file)
@@ -379,8 +379,8 @@ void *NFCConverter::copiedMessage(const JSObjectRef& obj) {
        }
 
        INdefMessagePtr message = privateObject->getObject();
-
-       return message->makeMessage(message->toByte());
+       std::vector<void *> records = toVectorOfRecordHandles(static_cast<JSValueRef>(message->getRecordesPtr()));
+       return message->makeMessage(records);
 }
 
 NFCChangedCallback NFCConverter::toNFCChangedCallback(const JSValueRef& arg) {
index 421f8d8..c30ee65 100644 (file)
@@ -134,10 +134,6 @@ JSValueRef JSPackageInformation::getProperty(JSContextRef context,
                        return JSUtil::toJSValueRef(context, privateData->m_iconPath);
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_VERSION)) {
                        return JSUtil::toJSValueRef(context, privateData->m_version);
-               } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_TOTAL_SIZE)) {
-                       return JSUtil::toJSValueRef(context, privateData->m_totalSize);
-               } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_DATA_SIZE)) {
-                       return JSUtil::toJSValueRef(context, privateData->m_dataSize);
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_LAST_MODIFIED)) {
                        return JSUtil::makeDateObject(context, privateData->m_lastModified);
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_AUTHOR)) {
@@ -146,6 +142,17 @@ JSValueRef JSPackageInformation::getProperty(JSContextRef context,
                        return JSUtil::toJSValueRef(context, privateData->m_description);
                } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_APP_IDS)) {
                        return JSUtil::toJSValueRef(context, privateData->m_appIds);
+               } else {
+                       // Operation to get size need long time (IPC Delay).
+                       if (!privateData->m_isInitialized) {
+                               privateData->initializePackageInfo();
+                       }
+
+                       if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_TOTAL_SIZE)) {
+                               return JSUtil::toJSValueRef(context, privateData->m_totalSize);
+                       } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_PACKAGE_INFORMATION_DATA_SIZE)) {
+                               return JSUtil::toJSValueRef(context, privateData->m_dataSize);
+                       }
                }
        } catch (const BasePlatformException &err) {
         return JSWebAPIErrorFactory::postException(context, exception, err);
index 0b7259d..e343e1a 100644 (file)
 // limitations under the License.
 //
 
+#include <package-manager.h>
+
 #include "PackageInformation.h"
+#include <Logger.h>
 
 namespace DeviceAPI {
 namespace Package {
 
-PackageInformation::PackageInformation()
+PackageInformation::PackageInformation() :
+       m_isInitialized(false)
 {
 }
 
@@ -28,5 +32,36 @@ PackageInformation::~PackageInformation()
 {
 }
 
+void PackageInformation::initializePackageInfo()
+{
+       LoggerD("Enter : " << m_id);
+
+       pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
+       if (pc == NULL) {
+               LoggerE("Fail to create pkgmgr client");
+       } else {
+               int ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, pc, NULL, m_id.c_str(), NULL, NULL, NULL);
+               if (ret < 0) {
+                       LoggerE("Fail to get total size");
+               } else {
+                       m_totalSize = ret;
+               }
+
+               ret = pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, PM_GET_DATA_SIZE, pc, NULL, m_id.c_str(), NULL, NULL, NULL);
+               if (ret < 0) {
+                       LoggerE("Fail to get data size");
+               } else {
+                       m_dataSize = ret;
+               }
+
+               LoggerD("Before pkgmgr_client_free");
+               pkgmgr_client_free(pc);
+               LoggerD("After pkgmgr_client_free");
+               pc = NULL;
+       }
+
+       m_isInitialized = true;
+}
+
 }
 }
index 4309009..37613e6 100644 (file)
@@ -31,8 +31,8 @@ class PackageInformation
 public:
        PackageInformation();
        ~PackageInformation();
+       void initializePackageInfo();
 
-// TODO: Should I encapsulate below values?
 public:
        string m_id;
        string m_name;
@@ -45,6 +45,7 @@ public:
        string m_type;
        string m_description;
        vector<string> m_appIds;
+       bool m_isInitialized;
 };
 
 }
index ab6a62e..dac54e2 100644 (file)
@@ -234,8 +234,6 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle)
        char* name = NULL;
        char* iconPath = NULL;
        char* version = NULL;
-       int totalSize = 0;
-       int dataSize = 0;
        int lastModified = 0;
        char* type = NULL;
        char* author = NULL;
@@ -273,20 +271,6 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle)
                pkgInfo->m_version = version;
        }
 
-       ret = pkgmgrinfo_pkginfo_get_total_size(handle, &totalSize);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get totalSize");
-       } else {
-               pkgInfo->m_totalSize = totalSize;
-       }
-
-       ret = pkgmgrinfo_pkginfo_get_data_size(handle, &dataSize);
-       if (ret != PMINFO_R_OK) {
-               LoggerE("Fail to get dataSize");
-       } else {
-               pkgInfo->m_dataSize = dataSize;
-       }
-
        ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &lastModified);
        if (ret != PMINFO_R_OK) {
                LoggerE("Fail to get lastModified");
@@ -334,6 +318,8 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle)
                LoggerE("Cannot destroy package info");
        }       
 
+       // REMARK: data size and total size is set at first access time
+
        // REMARK: do not destroy handle. because handle is comes from outside!!
        return pkgInfo;
 }
index e6d6448..b78e1bb 100644 (file)
@@ -49,6 +49,9 @@ public:
     void setExceptionCode(ExceptionCodes::Enumeration exceptionCode);          
        ExceptionCodes::Enumeration getExceptionCode() const;
 
+public:
+       pkgmgr_client *pc;
+
 private:
     vector<PackageInformation> m_pkgInfos;
        ExceptionCodes::Enumeration m_exceptionCode;
old mode 100644 (file)
new mode 100755 (executable)
index bcc0f6a..a780b30
@@ -185,19 +185,6 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object
 
                settingType = converter->toSettingType(arguments[0]);
                settingValue = converter->toString(arguments[1]);
-               Try{
-                       DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(priv->getContext(), settingValue);
-                       if (src)
-                               settingValue = src->getFullPath();
-                       else
-                               settingValue = "";      //set empty string.
-
-                       LoggerD("real path = " << settingValue);
-               }
-               Catch(WrtDeviceApis::Commons::Exception) {
-                       LoggerD("settingValue is not Virtual Path");
-               }
-               
                LoggerD("settingValue = " << settingValue);
                
                ISystemSettingPtr SystemSettings(priv->getObject());
old mode 100644 (file)
new mode 100755 (executable)
index a35c3f4..5e15c3d
@@ -182,6 +182,16 @@ JSObjectRef JSTimeDuration::createJSObject(JSContextRef context,
     return JSObjectMake(context, getClassRef(), priv);
 }
 
+JSObjectRef JSTimeDuration::createJSObject(JSContextRef context,
+        const DurationPropertiesPtr duration)
+{
+    TimeDurationPrivObject *priv = new TimeDurationPrivObject(context, duration);
+    if (!priv) {
+        ThrowMsg(NullPointerException, "Private object is null.");
+    }
+    return JSObjectMake(context, getClassRef(), priv);
+}
+
 JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
        LoggerD("entered");
        TimeUtilConverter convert(ctx);
index fbddf33..6d2565c 100755 (executable)
@@ -52,6 +52,7 @@ class JSTimeDuration
      */
     static const JSClassRef getClassRef();
     static JSObjectRef createJSObject(JSContextRef context, const DurationProperties &durations);
+    static JSObjectRef createJSObject(JSContextRef context, const DurationPropertiesPtr duration);
 
     static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
   private:
old mode 100644 (file)
new mode 100755 (executable)
index 417c6c7..68cb952
@@ -98,6 +98,16 @@ JSObjectRef TimeUtilConverter::makeMillisecondDurationObject(const long long len
        return makeDurationObject(duration);
 }
 
+DurationPropertiesPtr TimeUtilConverter::getDuration(JSValueRef value) {
+       if (!JSValueIsObjectOfClass(m_context, value, JSTimeDuration::getClassRef())) {
+               ThrowMsg(Commons::ConversionException, "Wrong duration object.");
+       }
+
+       TimeDurationPrivObject* privateObject = static_cast<TimeDurationPrivObject*>(JSObjectGetPrivate(toJSObjectRef(value)));
+       DurationPropertiesPtr duration = privateObject->getObject();
+       return duration;
+}
+
 DurationProperties TimeUtilConverter::getDurationPropertis(JSValueRef value) {
        DurationProperties duration;
        duration.length = getDurationLength(value);
index 34ff6db..878311e 100755 (executable)
@@ -49,6 +49,7 @@ class TimeUtilConverter : public Converter
        TZDateProperties getPropertiesInTZDate(JSObjectRef arg);
        JSObjectRef makeDurationObject(const DurationProperties &duration);
        JSObjectRef makeMillisecondDurationObject(const long long length);
+       DurationPropertiesPtr getDuration(JSValueRef value);
        DurationProperties getDurationPropertis(JSValueRef value);
        long long getDurationLength(JSValueRef value);
        long long getDurationLength(JSObjectRef object);