[Fix] Allow device to be removed when in default service accepted/tizen/unified/20190826.225907 accepted/tizen/unified/20190829.101441 submit/tizen/20190826.140219 submit/tizen/20190827.131417
authorAbhay agarwal <ay.agarwal@samsung.com>
Mon, 26 Aug 2019 04:57:42 +0000 (10:27 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 26 Aug 2019 13:55:43 +0000 (22:55 +0900)
Change-Id: I95f7209e7d25d8b4408ccacd5c92d632a6d8e6ed
Signed-off-by: Abhay agarwal <ay.agarwal@samsung.com>
include/ua-api.h
ua-api/src/ua-common.c
ua-daemon/src/ua-manager-common.c
ua-daemon/src/ua-manager-core.c

index cbeadd7..bc0d2fb 100644 (file)
@@ -155,6 +155,7 @@ typedef enum {
        UAM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
        UAM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
        UAM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+       UAM_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Resource busy */
        UAM_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
        UAM_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /**< Now in progress */
        UAM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
index 7e2117c..4bf3793 100644 (file)
@@ -120,7 +120,9 @@ const char *_uam_error_to_str(int error)
        switch (error) {
        CASE_TO_STR(UAM_ERROR_NONE)
        CASE_TO_STR(UAM_ERROR_INVALID_PARAMETER)
+       CASE_TO_STR(UAM_ERROR_OUT_OF_MEMORY)
        CASE_TO_STR(UAM_ERROR_PERMISSION_DENIED)
+       CASE_TO_STR(UAM_ERROR_RESOURCE_BUSY)
        CASE_TO_STR(UAM_ERROR_TIMED_OUT)
        CASE_TO_STR(UAM_ERROR_NOW_IN_PROGRESS)
        CASE_TO_STR(UAM_ERROR_NOT_SUPPORTED)
@@ -130,7 +132,6 @@ const char *_uam_error_to_str(int error)
        CASE_TO_STR(UAM_ERROR_NOT_FOUND)
        CASE_TO_STR(UAM_ERROR_ALREADY_REGISTERED)
        CASE_TO_STR(UAM_ERROR_DB_FAILED)
-       CASE_TO_STR(UAM_ERROR_NOT_REGISTERED)
        default:
                return "UNKNOWN ERROR";
        }
index 9a7422c..71fec4d 100644 (file)
@@ -124,6 +124,7 @@ const char *_uam_manager_error_to_str(int error)
        CASE_TO_STR(UAM_ERROR_NONE)
        CASE_TO_STR(UAM_ERROR_INVALID_PARAMETER)
        CASE_TO_STR(UAM_ERROR_OUT_OF_MEMORY)
+       CASE_TO_STR(UAM_ERROR_RESOURCE_BUSY)
        CASE_TO_STR(UAM_ERROR_PERMISSION_DENIED)
        CASE_TO_STR(UAM_ERROR_TIMED_OUT)
        CASE_TO_STR(UAM_ERROR_NOW_IN_PROGRESS)
index a2b94d5..7b24294 100644 (file)
@@ -922,10 +922,9 @@ static int __uam_remove_device(int user_id, uam_db_device_info_t *device,
                return ret;
        }
 
-       if (0 != count) {
-               ret = UAM_ERROR_NOW_IN_PROGRESS;
-               UAM_ERR("__uam_remove_device failed with %s",
-                               _uam_manager_error_to_str(ret));
+       if (1 < count) {
+               ret = UAM_ERROR_RESOURCE_BUSY;
+               UAM_WARN("other service uses this device ref:[%d]", count);
                return ret;
        }