Remove interval for box update and check appid of alarm register
authorYunchan Cho <yunchan.cho@samsung.com>
Tue, 2 Jul 2013 09:42:28 +0000 (18:42 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Thu, 4 Jul 2013 12:22:30 +0000 (21:22 +0900)
[Issue] N/A
[Problem] 1.Interval for update box is not needed any more.
          2.And in case of service from alarm server, appid of alarm register has been not checked
[Cause] 1.requirement for interval has been changed
        2.alarm server didn't provide alarm register's appid to reciever(web-provider)
[Solution] 1.web-provide doesn't check interval whenever it receives update request.
           2.web-provider check alarm register's appid using '__ALARM_MGR_CALLER_APPID' key

Change-Id: I9537fc62fd74a2572a2563b7bdd2a381a0cd9530

src/Core/BoxManager.cpp
src/Daemon/BoxDaemonImpl.cpp

index 54f9540..b6f3e17 100644 (file)
@@ -29,8 +29,6 @@
 #include "BoxData.h"
 #include "BoxManager.h"
 
-#define UPDATE_REQUEST_MIN_TIME    60 // seconds
-
 BoxManager::BoxManager(IBoxPluginFactoryPtr factory)
     : m_boxFactory(factory)
 {
@@ -241,12 +239,6 @@ bool BoxManager::requestUpdateBox(std::string& boxId, std::string& contentInfo)
             continue;
         }
         box = it->second;
-        int interval = requestTime - box->getLastUpdateRequestTime();
-        if (interval < UPDATE_REQUEST_MIN_TIME) {
-            LogD("this update request is skipped");
-            continue;
-        }
-        // set last request time to new one
         box->update(requestTime, contentInfo);
     }
 
index e7766a1..ede2908 100755 (executable)
@@ -40,6 +40,7 @@ static const std::string BOX_SERVICE_SCHEME("box-service://");
 static const std::string OPERATION_UPDATE_BOX(
         "http://tizen.org/appcontrol/operation/dynamicbox/web/update");
 static const std::string CONTENT_INFO_KEY("content-info");
+static const std::string ALARM_CALLER_KEY("__ALARM_MGR_CALLER_APPID");
 
 BoxDaemonImpl::BoxDaemonImpl()
     : m_pluginConnector(BoxPluginConnector::create())
@@ -592,7 +593,12 @@ bool BoxDaemonImpl::isServiceCallerBoxOwner(service_h service)
     char* caller = NULL;
     ret = service_get_caller(service, &caller);
     if (ret != SERVICE_ERROR_NONE) {
-        return false;
+        ret = service_get_extra_data(
+                service, ALARM_CALLER_KEY.c_str(), &caller);
+        if (ret != SERVICE_ERROR_NONE) {
+            LogD("failed to get caller's appid from service");
+            return false;
+        }
     }
     std::string callerAppId(caller);