Update change log and spec for wrt-plugins-tizen_0.4.41
authorDongjin Choi <milkelf.choi@samsung.com>
Wed, 12 Jun 2013 13:16:14 +0000 (22:16 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Wed, 12 Jun 2013 13:16:14 +0000 (22:16 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue] N/A
[Problem] findMessages with plainBody bug fix
[Cause] findMessages with plainBody bug fix
[Solution] findMessages with plainBody bug fix

[Issue] N/A
[Problem] Incomming MMS listener bug fix and Conversation listener bug fix
[Cause] Incomming MMS listener bug fix and Conversation listener bug fix
[Solution] Incomming MMS listener bug fix and Conversation listener bug fix

[Issue] N/A
[Problem] N/A
[Cause] N/A
[Solution] add on_frame_load_callback and on_frame_unload_callback to unregister asynchronized and synchronized callbacks when frame is unloaded.

[Issue] tct fail newly added.
[Problem] '%' sign is not supproted, but it is described in spec
[Cause] not implemented.
[Solution] implementation.

[Issue] N/A
[Problem] sendMessage with email with successCallback once
[Cause] emailId and emailHandle were mixed during access to m_requests storage
[Solution] All access operations were modified to use emailHandle

[Issue] tct fail due to path change.
[Problem] resolve error.
[Cause] unexpected platform path change.
[Solution] path modification.

[Issue#] N/A
[Problem] return value is not same with Native API
[Cause] N/A
[Solution] Add "/" to end of shared path

[Issue] N/A
[Problem] findConversation bug fix for from filter
[Cause] findConversation bug fix for from filter
[Solution] findConversation bug fix for from filter

[Issue] N/A
[Problem] N/A
[Cause] N/A
[Solution] Add time profiling code for Download and Push module.

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

27 files changed:
packaging/wrt-plugins-tizen.spec
src/Application/ApplicationManager.cpp
src/Download/DownloadManager.cpp
src/Download/JSDownloadManager.cpp
src/Filesystem/Converter.cpp
src/Filesystem/Converter.h
src/Filesystem/Manager.cpp
src/Filesystem/NodeFilterMatcher.cpp
src/Messaging/Conversation.cpp
src/Messaging/ConversationQueryGenerator.cpp
src/Messaging/Email.cpp
src/Messaging/JSConversation.cpp
src/Messaging/JSMessageFolder.cpp
src/Messaging/JSMessagingService.cpp
src/Messaging/JSMessagingServiceManager.cpp
src/Messaging/JSMessagingStorage.cpp
src/Messaging/MailSender.cpp
src/Messaging/MailSender.h
src/Messaging/MessageFolder.cpp
src/Messaging/MessageQueryGenerator.cpp
src/Messaging/Messaging.cpp
src/Messaging/MessagingService.cpp
src/Messaging/MessagingServiceManager.cpp
src/Messaging/messageDB/MessageStorageReader.cpp
src/Push/JSPushManager.cpp
src/Push/PushManager.cpp
src/SecureElement/plugin_initializer.cpp

index 0a02448..3f7e876 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.40
+Version:    0.4.41
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 3c06851..47ce3b8 100644 (file)
@@ -859,7 +859,7 @@ std::string ApplicationManager::getAppSharedURI(const std::string id)
                ThrowMsg(UnknownException, "Fail to get rotpath");
        }
 
-       std::string sharedURI = TIZENAPIS_APP_FILE_SCHEME + std::string(root_path) + TIZENAPIS_APP_SLASH + TIZENAPIS_APP_SHARED;
+       std::string sharedURI = TIZENAPIS_APP_FILE_SCHEME + std::string(root_path) + TIZENAPIS_APP_SLASH + TIZENAPIS_APP_SHARED + TIZENAPIS_APP_SLASH;
        free(pkg_name);
 
        pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h);
index 3abdbd9..b29104b 100644 (file)
 #include <download.h>
 
 #include <Logger.h>
+#include <TimeTracer.h>
 #include <FilesystemUtils.h>
 
 #include "DownloadState.h"
 #include "DownloadNetworkType.h"
 #include "DownloadManager.h"
 
+#ifdef ENABLE_TIME_TRACER
+#define _P(T, x) \
+       (TIME_TRACER_ITEM_BEGIN("DOWNLOAD_" #T "_PLATFORM", 0), x); \
+       TIME_TRACER_ITEM_END("DOWNLOAD_" #T "_PLATFORM", 0);
+#else
+#define _P(T, x) x
+#endif
+
 namespace DeviceAPI {
 namespace Download {
 
 static std::string _get_download_error(int err)
 {
        bool success = false;
-    std::string msg = "";
-
-    switch (err) {
-        case DOWNLOAD_ERROR_INVALID_PARAMETER:
-            msg = "Invalid parameter";
-            break;
-        case DOWNLOAD_ERROR_OUT_OF_MEMORY:
-            msg = "Out of memory";
-            break;
-        case DOWNLOAD_ERROR_NETWORK_UNREACHABLE:
-            msg = "Network is unreachable";
-            break;
-        case DOWNLOAD_ERROR_CONNECTION_TIMED_OUT:
-            msg = "Http session time-out";
-            break;
-        case DOWNLOAD_ERROR_NO_SPACE:
-            msg = "No space left on device";
-            break;
-        case DOWNLOAD_ERROR_FIELD_NOT_FOUND:
-            msg = "Specified field not found";
-            break;
-        case DOWNLOAD_ERROR_INVALID_STATE:
-            msg = "Invalid state";
-            break;
-        case DOWNLOAD_ERROR_CONNECTION_FAILED:
-            msg = "Connection failed";
-            break;
-        case DOWNLOAD_ERROR_INVALID_URL:
-            msg = "Invalid URL";
-            break;
-        case DOWNLOAD_ERROR_INVALID_DESTINATION:
-            msg = "Invalid destination";
-            break;
-        case DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS:
-            msg = "Full of available simultaneous downloads";
-            break;
-        case DOWNLOAD_ERROR_QUEUE_FULL:
-            msg = "Full of available downloading items from server";
-            break;
-        case DOWNLOAD_ERROR_ALREADY_COMPLETED:
-            msg = "The download is already completed";
-            break;
-        case DOWNLOAD_ERROR_FILE_ALREADY_EXISTS:
-            msg = "It is failed to rename the downloaded file";
-            break;
-        case DOWNLOAD_ERROR_CANNOT_RESUME:
-            msg = "It cannot resume";
-            break;
-        case DOWNLOAD_ERROR_TOO_MANY_REDIRECTS:
-            msg = "In case of too may redirects from http response header";
-            break;
-        case DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE:
-            msg = "The download cannot handle the http status value";
-            break;
-        case DOWNLOAD_ERROR_REQUEST_TIMEOUT:
-            msg = "There are no action after client create a download id";
-            break;
-        case DOWNLOAD_ERROR_RESPONSE_TIMEOUT:
-            msg = "It does not call start API in some time although the download is created";
-            break;
-        case DOWNLOAD_ERROR_SYSTEM_DOWN:
-            msg = "There are no response from client after rebooting download daemon";
-            break;
-        case DOWNLOAD_ERROR_ID_NOT_FOUND:
-            msg = "The download id is not existed in download service module";
-            break;
-        case DOWNLOAD_ERROR_NO_DATA:
-            msg = "No data because the set API is not called";
-            break;
-        case DOWNLOAD_ERROR_IO_ERROR:
-            msg = "Internal I/O error";
-            break;
-        case DOWNLOAD_ERROR_NONE:
-            success = true;
-            break;
-        default:
-            msg = "Unknown error";
-    }
-
-    if (!success) {
-       LOGE("Platform error %d <%s>", err, msg.c_str());
-    }
-
-    return msg;
+       std::string msg = "";
+
+       switch (err) {
+               case DOWNLOAD_ERROR_INVALID_PARAMETER:
+                       msg = "Invalid parameter";
+                       break;
+               case DOWNLOAD_ERROR_OUT_OF_MEMORY:
+                       msg = "Out of memory";
+                       break;
+               case DOWNLOAD_ERROR_NETWORK_UNREACHABLE:
+                       msg = "Network is unreachable";
+                       break;
+               case DOWNLOAD_ERROR_CONNECTION_TIMED_OUT:
+                       msg = "Http session time-out";
+                       break;
+               case DOWNLOAD_ERROR_NO_SPACE:
+                       msg = "No space left on device";
+                       break;
+               case DOWNLOAD_ERROR_FIELD_NOT_FOUND:
+                       msg = "Specified field not found";
+                       break;
+               case DOWNLOAD_ERROR_INVALID_STATE:
+                       msg = "Invalid state";
+                       break;
+               case DOWNLOAD_ERROR_CONNECTION_FAILED:
+                       msg = "Connection failed";
+                       break;
+               case DOWNLOAD_ERROR_INVALID_URL:
+                       msg = "Invalid URL";
+                       break;
+               case DOWNLOAD_ERROR_INVALID_DESTINATION:
+                       msg = "Invalid destination";
+                       break;
+               case DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS:
+                       msg = "Full of available simultaneous downloads";
+                       break;
+               case DOWNLOAD_ERROR_QUEUE_FULL:
+                       msg = "Full of available downloading items from server";
+                       break;
+               case DOWNLOAD_ERROR_ALREADY_COMPLETED:
+                       msg = "The download is already completed";
+                       break;
+               case DOWNLOAD_ERROR_FILE_ALREADY_EXISTS:
+                       msg = "It is failed to rename the downloaded file";
+                       break;
+               case DOWNLOAD_ERROR_CANNOT_RESUME:
+                       msg = "It cannot resume";
+                       break;
+               case DOWNLOAD_ERROR_TOO_MANY_REDIRECTS:
+                       msg = "In case of too may redirects from http response header";
+                       break;
+               case DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE:
+                       msg = "The download cannot handle the http status value";
+                       break;
+               case DOWNLOAD_ERROR_REQUEST_TIMEOUT:
+                       msg = "There are no action after client create a download id";
+                       break;
+               case DOWNLOAD_ERROR_RESPONSE_TIMEOUT:
+                       msg = "It does not call start API in some time although the download is created";
+                       break;
+               case DOWNLOAD_ERROR_SYSTEM_DOWN:
+                       msg = "There are no response from client after rebooting download daemon";
+                       break;
+               case DOWNLOAD_ERROR_ID_NOT_FOUND:
+                       msg = "The download id is not existed in download service module";
+                       break;
+               case DOWNLOAD_ERROR_NO_DATA:
+                       msg = "No data because the set API is not called";
+                       break;
+               case DOWNLOAD_ERROR_IO_ERROR:
+                       msg = "Internal I/O error";
+                       break;
+               case DOWNLOAD_ERROR_NONE:
+                       success = true;
+                       break;
+               default:
+                       msg = "Unknown error";
+       }
+
+       if (!success) {
+               LOGE("Platform error %d <%s>", err, msg.c_str());
+       }
+
+       return msg;
 }
 
 typedef struct {
@@ -341,16 +350,18 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
                throw InvalidValuesException("Invalid DownloadRequest.url.");
        }
 
-       ret = download_create(&downloadId);
+       ret = _P(start_download_create, download_create(&downloadId));
        if (ret != DOWNLOAD_ERROR_NONE) {
                throw UnknownException(("Platform error while creating download. " + _get_download_error(ret)).c_str());
        }
 
-       ret = download_set_url(downloadId, url.c_str());
+       // set url
+       ret = _P(start_download_set_url, download_set_url(downloadId, url.c_str()));
        if (ret != DOWNLOAD_ERROR_NONE) {
                throw UnknownException(("Platform error while setting url. " + _get_download_error(ret)).c_str());
        }
 
+       // set destination
        if (!destination.empty()) {
                std::string fullPath;
                try {
@@ -360,35 +371,27 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
                        LOGW("Converting virtual path is failed. [%s]", destination.c_str());
                        fullPath = destination;
                }
-               ret = download_set_destination(downloadId, fullPath.c_str());
+               ret = _P(start_download_set_destination, download_set_destination(downloadId, fullPath.c_str()));
                if (ret != DOWNLOAD_ERROR_NONE) {
                        throw UnknownException(("Platform error while setting destination. " + _get_download_error(ret)).c_str());
                }
        }
 
+       // set fileName
        if (!fileName.empty()) {
-               ret = download_set_file_name(downloadId, fileName.c_str());
+               ret = _P(start_download_set_file_name, download_set_file_name(downloadId, fileName.c_str()));
                if (ret != DOWNLOAD_ERROR_NONE) {
                        throw UnknownException(("Platform error while setting fileName. " + _get_download_error(ret)).c_str());
                }
        }
 
-       ret = download_set_state_changed_cb(downloadId, download_state_changed_cb, this);
-       if (ret != DOWNLOAD_ERROR_NONE) {
-               throw UnknownException(("Platform error while setting state changed callback. " + _get_download_error(ret)).c_str());
-       }
-
-       ret = download_set_progress_cb(downloadId, download_progress_cb, this);
-       if (ret != DOWNLOAD_ERROR_NONE) {
-               throw UnknownException(("Platform error while setting progress callback. " + _get_download_error(ret)).c_str());
-       }
-
+       // set networkType
        if (!networkType.empty() && networkType != TIZEN_ENUM_DOWNLOAD_NETWORK_TYPE_ALL) {
                ret = DOWNLOAD_ERROR_NONE;
                if (networkType == TIZEN_ENUM_DOWNLOAD_NETWORK_TYPE_CELLULAR) {
-                       ret = download_set_network_type(downloadId, DOWNLOAD_NETWORK_DATA_NETWORK);
+                       ret = _P(start_download_set_network_type, download_set_network_type(downloadId, DOWNLOAD_NETWORK_DATA_NETWORK));
                } else if (networkType == TIZEN_ENUM_DOWNLOAD_NETWORK_TYPE_WIFI) {
-                       ret = download_set_network_type(downloadId, DOWNLOAD_NETWORK_WIFI);
+                       ret = _P(start_download_set_network_type, download_set_network_type(downloadId, DOWNLOAD_NETWORK_WIFI));
                } else {
                        throw TypeMismatchException("Wrong DownloadNetworkType.");
                }
@@ -397,15 +400,27 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download
                }
        }
 
+       // set httpHeaders
        std::map<std::string, std::string>::const_iterator iter;
        for (iter = httpHeader.begin(); iter != httpHeader.end(); ++iter) {
-               ret = download_add_http_header_field(downloadId, iter->first.c_str(), iter->second.c_str());
+               ret = _P(start_download_add_http_header_field, download_add_http_header_field(downloadId, iter->first.c_str(), iter->second.c_str()));
                if (ret != DOWNLOAD_ERROR_NONE) {
                        throw UnknownException(("Platform error while setting http header fields. " + _get_download_error(ret)).c_str());
                }
        }
 
-       ret = download_start(downloadId);
+       // set listeners
+       ret = _P(start_download_set_state_changed_cb, download_set_state_changed_cb(downloadId, download_state_changed_cb, this));
+       if (ret != DOWNLOAD_ERROR_NONE) {
+               throw UnknownException(("Platform error while setting state changed callback. " + _get_download_error(ret)).c_str());
+       }
+
+       ret = _P(start_download_set_progress_cb, download_set_progress_cb(downloadId, download_progress_cb, this));
+       if (ret != DOWNLOAD_ERROR_NONE) {
+               throw UnknownException(("Platform error while setting progress callback. " + _get_download_error(ret)).c_str());
+       }
+
+       ret = _P(start_download_start, download_start(downloadId));
        if (ret != DOWNLOAD_ERROR_NONE) {
                throw UnknownException(("Platform error while starting download. " + _get_download_error(ret)).c_str());
        }
@@ -419,7 +434,7 @@ void DownloadManager::cancel(long downloadId)
 {
        int ret;
 
-       ret = download_cancel(downloadId);
+       ret = _P(cancel, download_cancel(downloadId));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -434,7 +449,7 @@ void DownloadManager::pause(long downloadId)
 {
        int ret;
 
-       ret = download_pause(downloadId);
+       ret = _P(pause, download_pause(downloadId));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -449,7 +464,7 @@ void DownloadManager::resume(long downloadId)
 {
        int ret;
 
-       ret = download_start(downloadId);
+       ret = _P(resume, download_start(downloadId));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -466,7 +481,7 @@ std::string DownloadManager::getState(long downloadId)
        download_state_e state;
        std::string result;
 
-       ret = download_get_state(downloadId, &state);
+       ret = _P(getState, download_get_state(downloadId, &state));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -518,7 +533,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
        char *fieldValue = NULL;
        int fieldLength = 0;
 
-       ret = download_get_url(downloadId, &url);
+       ret = _P(getDownloadRequest, download_get_url(downloadId, &url));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -528,7 +543,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
                throw UnknownException(("Platform error while getting url. " + _get_download_error(ret)).c_str());
        }
 
-       ret = download_get_destination(downloadId, &destination);
+       ret = _P(getDownloadRequest, download_get_destination(downloadId, &destination));
        if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -538,7 +553,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
                throw UnknownException(("Platform error while getting destination. " + _get_download_error(ret)).c_str());
        }
 
-       ret = download_get_file_name(downloadId, &fileName);
+       ret = _P(getDownloadRequest, download_get_file_name(downloadId, &fileName));
        if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -548,7 +563,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
                throw UnknownException(("Platform error while getting fileName. " + _get_download_error(ret)).c_str());
        }
 
-       ret = download_get_network_type(downloadId, &networkTypeValue);
+       ret = _P(getDownloadRequest, download_get_network_type(downloadId, &networkTypeValue));
        if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -558,7 +573,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
                throw UnknownException(("Platform error while getting network type. " + _get_download_error(ret)).c_str());
        }
 
-       ret = download_get_http_header_field_list(downloadId, &fieldNames, &fieldLength);
+       ret = _P(getDownloadRequest, download_get_http_header_field_list(downloadId, &fieldNames, &fieldLength));
        if (ret != DOWNLOAD_ERROR_NONE && ret != DOWNLOAD_ERROR_NO_DATA) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -570,7 +585,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId)
 
        std::map<std::string, std::string> httpHeader;
        for (i = 0; i < fieldLength; i++) {
-               ret = download_get_http_header_field(downloadId, fieldNames[i], &fieldValue);
+               ret = _P(getDownloadRequest, download_get_http_header_field(downloadId, fieldNames[i], &fieldValue));
                if (ret != DOWNLOAD_ERROR_NONE) {
                        LOGW("Platform error while getting http header field. %s", _get_download_error(ret).c_str());
                }
@@ -630,7 +645,7 @@ std::string DownloadManager::getMIMEType(long downloadId)
        char *mimeType = NULL;
        std::string result("");
 
-       ret = download_get_mime_type(downloadId, &mimeType);
+       ret = _P(getMIMEType, download_get_mime_type(downloadId, &mimeType));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -656,7 +671,7 @@ void DownloadManager::setListener(long downloadId, DownloadCallback *downloadCal
 {
        int ret;
 
-       ret = download_set_state_changed_cb(downloadId, download_state_changed_cb, this);
+       ret = _P(setListener, download_set_state_changed_cb(downloadId, download_state_changed_cb, this));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
@@ -666,7 +681,7 @@ void DownloadManager::setListener(long downloadId, DownloadCallback *downloadCal
                throw UnknownException(("Platform error while setting state changed callback. " + _get_download_error(ret)).c_str());
        }
 
-       ret = download_set_progress_cb(downloadId, download_progress_cb, this);
+       ret = _P(setListener, download_set_progress_cb(downloadId, download_progress_cb, this));
        if (ret != DOWNLOAD_ERROR_NONE) {
                if (ret == DOWNLOAD_ERROR_ID_NOT_FOUND) {
                        throw NotFoundException("download id could not found.");
index e3d899f..85fba3e 100644 (file)
@@ -113,9 +113,12 @@ JSValueRef JSDownloadManager::startDownload(JSContextRef context,
         JSValueRef* exception)
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
     // Access Check
+    TIME_TRACER_ITEM_BEGIN("DOWNLOAD_start_ACE", 0);
     AceSecurityStatus status = DOWNLOAD_CHECK_ACCESS(DOWNLOAD_FUNCTION_API_START);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+    TIME_TRACER_ITEM_END("DOWNLOAD_start_ACE", 0);
 
     try {
         // Private Object
index 1324637..2a9e833 100755 (executable)
@@ -138,6 +138,34 @@ IPathPtr Converter::toPath(const JSValueRef& arg)
                ReThrowMsg(Commons::ConversionException, "Not a valid path.");
        }
 }
+std::string Converter::checkPercentSign(std::string& arg)
+{      
+       size_t pos = 0;
+
+       pos = arg.find("%");
+
+       if (pos == std::string::npos) 
+       {
+               return arg;
+       }
+       else if (arg[arg.size() - 1] == '%') 
+       {
+               arg[arg.size() - 1] = ')';      
+
+               if (arg[0] == '%') 
+               {
+                       arg[0] = '(';
+               }
+               else 
+               {
+                       arg.insert(0, "^");
+                       arg.insert(1, "(");
+               }
+
+               return arg;
+       }
+       ThrowMsg(Commons::ConversionException, "Invalid Filter");
+}
 
 NodeFilterPtr Converter::toNodeFilter(const JSValueRef& arg)
 {
@@ -147,7 +175,8 @@ NodeFilterPtr Converter::toNodeFilter(const JSValueRef& arg)
        JSValueRef prop = NULL;
        prop = JSUtils::getJSProperty(m_context, filter, PROPERTY_FILEFILTER_NAME);
        if (prop) {
-               result->setName(toString(prop));
+               std::string nameFilter = toString(prop);
+               result->setName(checkPercentSign(nameFilter));
        }
 
        prop = JSUtils::getJSProperty(m_context, filter, PROPERTY_FILEFILTER_START_CREATED);
index 0e11502..70bd4cb 100755 (executable)
@@ -61,6 +61,7 @@ public:
        
        JSValueRef toStorageType(const short type);
        JSValueRef toStorageState(const short state);
+       std::string checkPercentSign(std::string& arg);
        JSValueRef toJSValueRef(
                const StoragePropertiesPtr &arg,
                JSContextRef context);
index 12d60c8..4fdf5f5 100644 (file)
@@ -42,7 +42,7 @@ const char* PATH_DOCUMENTS = "/opt/usr/media/Documents";
 const char* PATH_SOUNDS = "/opt/usr/media/Sounds";
 const char* PATH_IMAGES = "/opt/usr/media/Images";
 const char* PATH_VIDEOS = "/opt/usr/media/Videos";
-const char* PATH_RINGTONE = "/opt/share/settings/Ringtones/";
+const char* PATH_RINGTONE = "/opt/usr/share/settings/Ringtones";
 }
 
 using namespace WrtDeviceApis;
index b8a183f..317217d 100755 (executable)
@@ -51,11 +51,14 @@ bool NodeFilterMatcher::match(const INodePtr& value,
     return true;
 }
 
+
 bool NodeFilterMatcher::matchString(const std::string& value,
         const OptionalString& filter)
 {
     if (!filter.IsNull()) {
-        return pcrecpp::RE(*filter).PartialMatch(value);
+               pcrecpp::RE_Options reoption;
+               reoption.set_caseless(true);
+        return pcrecpp::RE(*filter, reoption).PartialMatch(value);
     }
     return true;
 }
index a01494c..bc9e3db 100644 (file)
@@ -28,7 +28,7 @@
 // this is msgInternalTypes
 #define MAX_THREAD_DATA_LEN    128
 
-using namespace DPL;
+
 
 namespace DeviceAPI {
 namespace Messaging {
index a4a1176..b1fafdb 100755 (executable)
 namespace DeviceAPI {
                namespace Messaging {
 
-                       const std::string ConversationQueryGenerator::QUERY_PREFIX_SMS   = "WHERE B.SMS_CNT > 0 AND A.CONV_ID = B.CONV_ID AND (";
-                       const std::string ConversationQueryGenerator::QUERY_PREFIX_MMS   = "WHERE B.MMS_CNT > 0 AND A.CONV_ID = B.CONV_ID AND (";                       
+                       const std::string ConversationQueryGenerator::QUERY_PREFIX_SMS   = "WHERE B.SMS_CNT > 0 AND (A.CONV_ID = B.CONV_ID) AND (B.CONV_ID = C.CONV_ID) AND (";
+                       const std::string ConversationQueryGenerator::QUERY_PREFIX_MMS   = "WHERE B.MMS_CNT > 0 AND (A.CONV_ID = B.CONV_ID) AND (B.CONV_ID = C.CONV_ID) AND (";                 
                        const std::string ConversationQueryGenerator::QUERY_PREFIX_EMAIL = "WHERE ";
                        const std::string ConversationQueryGenerator::QUERY_SUFFIX_SMS_MMS   = ") ";
                        const std::string ConversationQueryGenerator::QUERY_SUFFIX_EMAIL = "";
 
-                       const std::string ConversationQueryGenerator::STRING_DIRECTION = "B.MSG_DIRECTION";
+                       const std::string ConversationQueryGenerator::STRING_DIRECTION = "C.MSG_DIRECTION";
 
                ConversationQueryGenerator::ConversationQueryGenerator():MessageQueryGenerator() {
                }
@@ -56,7 +56,7 @@ namespace DeviceAPI {
 
                        attributeMap.insert(
                                                                                        std::pair<std::string, std::string>(
-                                                                                                       ConversationFilterValidatorFactory::ATTRIBUTE_ID,          "A.ADDRESS_ID"));
+                                                                                                       ConversationFilterValidatorFactory::ATTRIBUTE_ID,          "B.CONV_ID"));
                        if(getMode() == MODE_SMS)
                        {
                                attributeMap.insert(
index 98b8302..e6c0a11 100644 (file)
@@ -750,6 +750,11 @@ void Email::updateBody()
                {
                        fwrite(getHtmlBody().c_str(), strlen(getHtmlBody().c_str()), 1, f);
                }
+               else if(strlen(getBodyRef().c_str()) > 0)
+               {
+                       // htmlbody is empty and plainBody exist. copy plainBody to htmlBody
+                       fwrite(getBodyRef().c_str(), strlen(getBodyRef().c_str()), 1, f);
+               }
                else
                {
                        // htmlBody is empty.
index eb29d8a..6077bfd 100755 (executable)
@@ -32,7 +32,7 @@
 
 
 using namespace std;
-using namespace DPL;
+
 using namespace DeviceAPI::Messaging;
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
index b80c3b3..c3e8a59 100644 (file)
@@ -35,7 +35,7 @@
 #include "ConverterMessage.h"
 
 using namespace std;
-using namespace DPL;
+
 using namespace DeviceAPI::Messaging;
 using namespace DeviceAPI::Common;
 using namespace WrtDeviceApis::Commons;
index 5205514..4a650d5 100644 (file)
@@ -45,7 +45,7 @@
 #include "plugin_config.h"
 
 using namespace std;
-using namespace DPL;
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
index 4f38771..aa4aeed 100644 (file)
@@ -39,7 +39,7 @@
 #include "MessagingErrorMsg.h"
 
 using namespace std;
-using namespace DPL;
+
 using namespace DeviceAPI::Messaging;
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -169,7 +169,7 @@ JSValueRef JSMessagingServiceManager::getMessagingServices(JSContextRef context,
 
         IMessagingServiceManagerPtr messagingServiceManager(priv->getObject());
 
-        event->setPrivateData(StaticPointerCast<IEventPrivateData> (callbackManager)); //callback manager
+        event->setPrivateData(DPL::StaticPointerCast<IEventPrivateData> (callbackManager)); //callback manager
         event->setForAsynchronousCall(&MessagingController::getInstance());
 
         event->setEventType(EventGetMessagingService::MESSAGING_SERVICE_MANAGER_EVENT_TYPE_ALL);
index 06e2895..736b60d 100644 (file)
@@ -47,7 +47,7 @@
 
 
 using namespace std;
-using namespace DPL;
+
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
 using namespace DeviceAPI::Tizen;
index adc8a83..dc41a55 100644 (file)
@@ -87,21 +87,11 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event)
     NetworkStatusPtr msg(new NetworkStatus(event.GetArg0()));
     int mailId = msg->getMailId();
     LoggerD("status : " << msg->getStatus() << " mailId : " << mailId);
-    int handle = 0;
+    int handle = -1;
 
     if ( msg->getStatus() == NOTI_SEND_FINISH || msg->getStatus() == NOTI_SEND_FAIL)
     {
-               //find handle
-               SendRequestsIterator it = m_requests.begin();
-               for (; it != m_requests.end() ; it++)
-               {
-                       if ( it->second.mail->getUID() == mailId)
-                       {
-                               handle = it->first;
-                               LoggerD("handle : " << handle);
-                               break;
-                       }
-               }
+        handle = getHandle(mailId);
 
                if (msg->getStatus() == NOTI_SEND_FAIL)
                {
@@ -157,8 +147,8 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event)
                 
             }
                 mail->setMessageStatus(MESSAGE_STATUS_SENT);
-            LoggerI("E-mail sent: " << mailId);
-            m_requests.erase(mailId);
+            LoggerD("E-mail sent handle: " << handle << " mailid: " << mailId);
+            m_requests.erase(handle);
             break;
         }
 
@@ -205,12 +195,15 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event)
             }
                 mail->setMessageStatus(MESSAGE_STATUS_FAILED);
                 
-            LoggerI("Sending e-mail: " << mailId <<
+            LoggerD("Sending e-mail: " << mailId <<
                     " failed with error: " << msg->getErrorCode());
-            m_requests.erase(mailId);
+            LoggerD("E-mail error handle: " << handle);
+            m_requests.erase(handle);
             break;
         }
         }
+    } else {
+        LoggerW("Can't find handle " << handle);
     }
 }
 
@@ -282,7 +275,6 @@ int MailSender::sendInternal(const IEmailPtr& mail)
        
     if (EMAIL_ERROR_NONE != error) {
                LoggerD("Send Fail error = " << error );
-               m_requests.erase(mailId);
                mail->setMessageStatus(MESSAGE_STATUS_SENDING); 
                ThrowMsg(WrtDeviceApis::Commons::PlatformException,
                         "Failed to initialize send request. [" << error << "]");
@@ -290,10 +282,12 @@ int MailSender::sendInternal(const IEmailPtr& mail)
     }
     else
     {
-               m_requests.insert(std::make_pair(email_handle, SendRequestData(email_handle, mail)));
+        LoggerD("m_requests.insert(" << email_handle << ")");
+        m_requests.insert(std::make_pair(email_handle,
+                                         SendRequestData(email_handle, mail)));
     }
 
-    LoggerD("emf Handle : " << email_handle 
+    LoggerD("emf Handle : " << email_handle
 << "requests size :" << m_requests.size() );
   
     return email_handle;       
@@ -308,7 +302,27 @@ void MailSender::cancelInternal(const SendRequestData& data)
                  data.mail->getIdRef());
     }
 
-    m_requests.erase(data.handle);
+    LoggerD("m_requests.erase(" << data.handle << ")");
+    m_requests.erase( data.handle );
+}
+
+
+int MailSender::getHandle(int mailId)
+{
+    //find handle
+    int handle = -1;
+    SendRequestsIterator it = m_requests.begin();
+    for (; it != m_requests.end() ; it++)
+    {
+        if ( it->second.mail->getUID() == mailId)
+        {
+            handle = it->first;
+            LoggerD("handle : " << handle);
+            break;
+        }
+    }
+    return handle;
 }
+
 }
 }
index a3f18d8..f469969 100755 (executable)
@@ -69,8 +69,8 @@ class MailSender : private DPL::Event::EventListener<DBus::MessageEvent>
 
     int sendInternal(const IEmailPtr& data);
     void cancelInternal(const SendRequestData& data);
+    int getHandle(int mailId);
 
-  private:
     DPL::ScopedPtr<DPL::Thread> m_dbusThread;
     DBus::ConnectionPtr m_dbus;
     SendRequests m_requests;
index aa96385..8ff5b86 100755 (executable)
@@ -28,7 +28,7 @@ extern "C" {
 #include <msg_transport.h>
 }
 
-using namespace DPL;
+
 
 namespace DeviceAPI {
 namespace Messaging {
index b487c55..5d1cc86 100644 (file)
@@ -556,10 +556,10 @@ namespace DeviceAPI {
                                        }
                                }else if(m_mode == MODE_SMS || m_mode == MODE_MMS ){
                                        if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_FROM)==0){
-                                               retClause = "("+emfAttributeName + " ='"+ valueString + "' AND " + getMessageDirectionString() + "=1)";
+                                               retClause = "(("+emfAttributeName + " ='"+ valueString + "') AND " + getMessageDirectionString() + "=1)";
                                                break;
                                        }else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TO)==0){
-                                               retClause = "("+emfAttributeName + " ='"+ valueString + "' AND " + getMessageDirectionString() + "=0)";
+                                               retClause = "(("+emfAttributeName + " ='"+ valueString + "') AND " + getMessageDirectionString() + "=0)";
                                                break;
                                        }else if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)==0){
                                                retClause = emfAttributeName + "=" + createDateTimeTypeForSmsMms(value); //TODO need to check
index 6647c6f..e4f41b7 100644 (file)
@@ -1619,22 +1619,26 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                                 else if(storageChangeType == MSG_STORAGE_CHANGE_UPDATE)
                                 {
                                     LoggerD("MSG_STORAGE_CHANGE_UPDATE");
-                                   event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                    event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
                                 }
                                 this_->m_onMessageReceived.emit(event);
                             }
-                            if((this_->m_onConversationReceived.size() > 0) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT)){
-                                if(conversation->getMessageCount() == 1)
+                            if(this_->m_onConversationReceived.size() > 0){
+                                int emitCheck = 0;
+                                LoggerD("Message Status = " << message->getMessageStatus());
+                                if((conversation->getMessageCount() == 1)  && (storageChangeType == MSG_STORAGE_CHANGE_INSERT))
                                 {
+                                    emitCheck = 1;
                                     LoggerD("MSG_STORAGE_CHANGE_INSERT");
                                     event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+                                    this_->m_onConversationReceived.emit(event);
                                 }
-                                if(conversation->getMessageCount() > 1)
+                                if(emitCheck == 0 && (message->getMessageStatus()!=MESSAGE_STATUS_SENT))
                                 {
-                                    LoggerD("MSG_STORAGE_CHANGE_INSERT but Conversation Count > 1");
+                                    LoggerD("MSG_STORAGE_CHANGE_INSERT, Conversation Count > 1 or MSG_STORAGE_CHANGE_UPDATE");
                                     event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                    this_->m_onConversationReceived.emit(event);
                                 }
-                                this_->m_onConversationReceived.emit(event);
                             }
                         }
                         else
@@ -1647,7 +1651,9 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                         if(msgType  != MSG_TYPE_MMS_NOTI)
                         {
                             int msgId = 0;
+                            int mmsDirection = 0;
                             msg_get_int_value(msg, MSG_MESSAGE_ID_INT, &msgId);
+                            msg_get_int_value(msg, MSG_MESSAGE_DIRECTION_INT, &mmsDirection);
                             IMessagePtr message = MessageFactory::createMessage(
                                                                                 MMS,
                                                                                 msgId,
@@ -1668,22 +1674,34 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle,
                                 else if(storageChangeType == MSG_STORAGE_CHANGE_UPDATE)
                                 {
                                     LoggerD("MSG_STORAGE_CHANGE_UPDATE");
-                                   event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                    if(mmsDirection == 1) // check incomming mms
+                                    {
+                                        LoggerD("mmsDirection == 1");
+                                        event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+                                    }
+                                    else
+                                    {
+                                        event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                    }
                                 }
                                 this_->m_onMessageReceived.emit(event);
                             }
-                            if((this_->m_onConversationReceived.size() > 0) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT)){
-                                if(conversation->getMessageCount() == 1)
+                            if(this_->m_onConversationReceived.size() > 0){
+                                int emitCheck = 0;
+                                LoggerD("Message Status = " << message->getMessageStatus());
+                                if((conversation->getMessageCount() == 1)  && (storageChangeType == MSG_STORAGE_CHANGE_INSERT))
                                 {
+                                    emitCheck = 1;
                                     LoggerD("MSG_STORAGE_CHANGE_INSERT");
                                     event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
+                                    this_->m_onConversationReceived.emit(event);
                                 }
-                                if(conversation->getMessageCount() > 1)
+                                if(emitCheck == 0 && (message->getMessageStatus()!=MESSAGE_STATUS_SENT))
                                 {
-                                    LoggerD("MSG_STORAGE_CHANGE_INSERT but Conversation Count > 1");
+                                    LoggerD("MSG_STORAGE_CHANGE_INSERT, Conversation Count > 1 or MSG_STORAGE_CHANGE_UPDATE");
                                     event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED);
+                                    this_->m_onConversationReceived.emit(event);
                                 }
-                                this_->m_onConversationReceived.emit(event);
                             }
                         }
                         else
index c6738e4..eef97fa 100644 (file)
@@ -27,7 +27,7 @@
 #include <email-api.h>
 #include <Logger.h>
 
-using namespace DPL;
+
 using namespace std;
 
 namespace DeviceAPI {
index ca3ef70..db34065 100644 (file)
@@ -31,7 +31,6 @@
 #include <PlatformException.h>
 
 using namespace std;
-using namespace DPL;
 using namespace DeviceAPI::Common;
 
 namespace DeviceAPI {
index 1c120c7..84e9202 100644 (file)
@@ -392,7 +392,7 @@ int MessageStorageReader::queryConversation(const std::string& whereClause, cons
 //     LOGD("<<< whereClause:[%s]",whereClause.c_str());
        if(whereClause.length()==0){
 //             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
-               tmpWhereClause.append("WHERE (B.SMS_CNT > 0 OR B.MMS_CNT > 0) AND A.CONV_ID = B.CONV_ID ");
+               tmpWhereClause.append("WHERE (B.SMS_CNT > 0 OR B.MMS_CNT > 0) AND (A.CONV_ID = B.CONV_ID) AND (B.CONV_ID = C.CONV_ID) ");
 //             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }else{
 //             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
@@ -410,9 +410,9 @@ int MessageStorageReader::queryConversation(const std::string& whereClause, cons
 //             LOGD("<<< tmpWhereClause:[%s]", tmpWhereClause.c_str());
        }
 
-       oStream << "SELECT B.CONV_ID, B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \
+       oStream << "SELECT distinct(B.CONV_ID), B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \
 B.MAIN_TYPE, B.SUB_TYPE, B.MSG_DIRECTION, B.DISPLAY_TIME, B.DISPLAY_NAME, B.MSG_TEXT \
-FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, "  << MSGFW_CONVERSATION_TABLE_NAME  << " B ";
+FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, "  << MSGFW_CONVERSATION_TABLE_NAME  << " B, " << MSGFW_MESSAGE_TABLE_NAME " C ";
 
        oStream << tmpWhereClause;
        stringSqlQuery = oStream.str();
index 76d6a8f..4bc71e7 100644 (file)
@@ -100,8 +100,11 @@ JSValueRef JSPushManager::registerService(JSContextRef context,
         JSValueRef* exception)
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+    TIME_TRACER_ITEM_BEGIN("PUSH_registerService_ACE", 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_REGISTER_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+    TIME_TRACER_ITEM_END("PUSH_registerService_ACE", 0);
 
     try {
         // Private Object
@@ -160,8 +163,11 @@ JSValueRef JSPushManager::unregisterService(JSContextRef context,
         JSValueRef* exception)
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+    TIME_TRACER_ITEM_BEGIN("PUSH_unregisterService_ACE", 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_UNREGISTER_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+    TIME_TRACER_ITEM_END("PUSH_unregisterService_ACE", 0);
 
     try {
         // Private Object
@@ -209,8 +215,11 @@ JSValueRef JSPushManager::connectService(JSContextRef context,
         JSValueRef* exception)
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+    TIME_TRACER_ITEM_BEGIN("PUSH_connectService_ACE", 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_CONNECT_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+    TIME_TRACER_ITEM_END("PUSH_connectService_ACE", 0);
 
     try {
         // Private Object
@@ -252,8 +261,11 @@ JSValueRef JSPushManager::disconnectService(JSContextRef context,
         JSValueRef* exception)
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+    TIME_TRACER_ITEM_BEGIN("PUSH_disconnectService_ACE", 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_DISCONNECT_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+    TIME_TRACER_ITEM_END("PUSH_disconnectService_ACE", 0);
 
     try {
         // Private Object
@@ -285,8 +297,11 @@ JSValueRef JSPushManager::getRegistrationId(JSContextRef context,
         JSValueRef* exception)
 {
        TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
+    TIME_TRACER_ITEM_BEGIN("PUSH_getRegistrationId_ACE", 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_GET_REGISTRATION_ID);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+    TIME_TRACER_ITEM_END("PUSH_getRegistrationId_ACE", 0);
 
     try {
         // Private Object
index 344cf8b..bf967e7 100644 (file)
 #include "PushManager.h"
 
 #include <Logger.h>
+#include <TimeTracer.h>
+
+#ifdef ENABLE_TIME_TRACER
+#define _P(T, x) \
+    (TIME_TRACER_ITEM_BEGIN("PUSH_" #T "_PLATFORM", 0), x); \
+    TIME_TRACER_ITEM_END("PUSH_" #T "_PLATFORM", 0);
+#else
+#define _P(T, x) x
+#endif
 
 using namespace DeviceAPI::Common;
 
@@ -348,13 +357,13 @@ void PushManager::registerService(ApplicationControlPtr appControl, MultiCallbac
     int ret;
     service_h service;
 
-    ret = service_create(&service);
+    ret = _P(registerService, service_create(&service));
     if (ret != SERVICE_ERROR_NONE) {
         throw UnknownException(("Platform error while creating service. " + _get_internal_error(ret)).c_str());
     }
 
     if (appControl->getOperation().compare("") != 0) {
-        ret = service_set_operation(service, appControl->getOperation().c_str());
+        ret = _P(registerService, service_set_operation(service, appControl->getOperation().c_str()));
         if (ret != SERVICE_ERROR_NONE) {
             throw UnknownException(("Platform error while setting operation to appControl. " + _get_internal_error(ret)).c_str());
         }
@@ -363,20 +372,20 @@ void PushManager::registerService(ApplicationControlPtr appControl, MultiCallbac
     }
 
     if (appControl->getUri().compare("") != 0) {
-        ret = service_set_uri(service, appControl->getUri().c_str());
+        ret = _P(registerService, service_set_uri(service, appControl->getUri().c_str()));
         if (ret != SERVICE_ERROR_NONE) {
             LOGW("Platform error while setting uri to appControl. %s", _get_internal_error(ret).c_str());
         }
     }
 
     if (appControl->getMime().compare("") != 0) {
-        ret = service_set_mime(service, appControl->getMime().c_str());
+        ret = _P(registerService, service_set_mime(service, appControl->getMime().c_str()));
         if (ret != SERVICE_ERROR_NONE) {
             LOGW("Platform error while setting mime to appControl. %s", _get_internal_error(ret).c_str());
         }
     }
 
-    ret = service_set_app_id(service, m_appId.c_str());
+    ret = _P(registerService, service_set_app_id(service, m_appId.c_str()));
     if (ret != SERVICE_ERROR_NONE) {
         throw UnknownException(("Platform error while setting appId to appControl. " + _get_internal_error(ret)).c_str());
     }
@@ -404,12 +413,12 @@ void PushManager::registerService(ApplicationControlPtr appControl, MultiCallbac
                 }
 
                 if (size == 1) {
-                    ret = service_add_extra_data(service, (const char*)key.c_str(), arr[0]);
+                    ret = _P(registerService, service_add_extra_data(service, (const char*)key.c_str(), arr[0]));
                     if (ret != SERVICE_ERROR_NONE) {
                         LOGW("Platform error while adding extra data to appControl. %s", _get_internal_error(ret).c_str());
                     }
                 } else {
-                    ret = service_add_extra_data_array(service, (const char*)key.c_str(), arr, size);
+                    ret = _P(registerService, service_add_extra_data_array(service, (const char*)key.c_str(), arr, size));
                     if (ret != SERVICE_ERROR_NONE) {
                         LOGW("Platform error while adding extra data array to appControl. %s", _get_internal_error(ret).c_str());
                     }
@@ -424,13 +433,13 @@ void PushManager::registerService(ApplicationControlPtr appControl, MultiCallbac
 
     m_registrationCallback = callback;
 
-    ret = push_register(m_connectionHandle, service, push_registration_result_cb, this);
+    ret = _P(registerService, push_register(m_connectionHandle, service, push_registration_result_cb, this));
     if (ret != PUSH_ERROR_NONE) {
-        service_destroy(service);
+        _P(registerService, service_destroy(service));
         throw UnknownException(("Platform error while registering the application to the push service. " + _get_internal_error(ret)).c_str());
     }
 
-    service_destroy(service);
+    _P(registerService, service_destroy(service));
 }
 
 void PushManager::unregisterService(MultiCallbackUserDataPtr callback)
@@ -439,7 +448,7 @@ void PushManager::unregisterService(MultiCallbackUserDataPtr callback)
 
     m_unregistrationCallback = callback;
 
-    ret = push_deregister(m_connectionHandle, push_unregistration_result_cb, this);
+    ret = _P(unregisterService, push_deregister(m_connectionHandle, push_unregistration_result_cb, this));
     if (ret != PUSH_ERROR_NONE) {
         throw UnknownException(("Platform error while unregistering the application from the push service. " + _get_internal_error(ret)).c_str());
     }
@@ -465,7 +474,7 @@ std::string PushManager::getRegistrationId()
     char *regId = NULL;
     std::string str = "";
 
-    ret = push_get_registration_id(m_connectionHandle, &regId);
+    ret = _P(getRegistrationId, push_get_registration_id(m_connectionHandle, &regId));
     if (ret != PUSH_ERROR_NONE) {
         LOGW("Platform error while getting registration id. %s", _get_internal_error(ret).c_str());
     } else {
index 6e9905a..dcc5651 100644 (file)
@@ -18,6 +18,8 @@
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
 #include "JSSEService.h"
+#include "SEAsyncCallbackManager.h"
+#include "SEListenerManager.h"
 #include <Logger.h>
 
 namespace DeviceAPI {
@@ -52,8 +54,22 @@ void on_widget_stop_callback(int widgetId)
     }
 }
 
+void on_frame_load_callback(const void * context)
+{
+       LoggerD("[Tizen\\SE] on_frame_load_callback (" << context << ")");
+}
+
+void on_frame_unload_callback(const void * context)
+{
+       LoggerD("[Tizen\\SE] on_frame_unload_callback (" << context << ")");
+       SEAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
+       SEListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
+}
+
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
 PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
+PLUGIN_ON_FRAME_LOAD(on_frame_load_callback)
+PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback)
 
 PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "seService", (js_class_template_getter)DeviceAPI::SecureElement::JSSEService::getClassRef, NULL)