Add datasharing privilege for provider add callback 46/191846/5
authorhyunho <hhstark.kang@samsung.com>
Wed, 24 Oct 2018 10:34:53 +0000 (19:34 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Mon, 3 Dec 2018 01:17:16 +0000 (01:17 +0000)
Change-Id: If51bccdf472bd2d537ca4119ed504b5b529279a0
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watchface-complication-provider/complication-provider.cc
watchface-complication-provider/include/watchface-complication-provider.h

index 77f41fa..54b9aff 100644 (file)
@@ -44,13 +44,14 @@ ComplicationProvider::Impl::Impl(ComplicationProvider* parent,
   : parent_(parent), provider_id_(provider_id),
   gdbus_(std::unique_ptr<IGDBus>(ComplicationConnector::GetInst(mock).CreateGDBus(mock))),
   mock_(mock) {
+  int ret = util::CheckPrivilege(PRIVILEGE_DATASHARING);
   subscribe_id_ = gdbus_.get()->SubscribeSignal(
     IGDBus::Complication, provider_id_, -1, this);
 
   std::list<std::string> privilege_list;
   required_privileges_.push_back(std::string(PRIVILEGE_DATASHARING));
 
-  int ret = DBManager::GetSupportTypes(provider_id_, &supported_types_);
+  ret = DBManager::GetSupportTypes(provider_id_, &supported_types_);
   if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
     LOGE("fail to get support types");
     THROW(ret);
index 9b60e13..1a7417f 100644 (file)
@@ -105,6 +105,9 @@ typedef void (*watchface_complication_provider_update_requested_cb)(
 /**
  * @brief Adds the callback function to be executed when the update requested.
  * @since_tizen 5.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/datasharing
+ * @remarks Since 5.5, %http://tizen.org/privilege/datasharing is required.
  * @param[in] provider_id The id of the provider
  * @param[in] callback The callback function
  * @param[in] user_data The user data passed from the callback function
@@ -115,6 +118,7 @@ typedef void (*watchface_complication_provider_update_requested_cb)(
  * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
  * @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
  * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
  * @see watchface_complication_provider_remove_update_requested_cb()
  * @par Sample code:
  * @code