summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2020-07-14 12:38:19 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2020-07-14 12:51:28 +0900
commit1e0a49cd9e0e6a167d78f41a8997f946643135b7 (patch)
treef67ef4fc1774daeeac61b8343cfcc167fa397868
parent4a9be451bca422716c5e7d6952f29bb720ab7a88 (diff)
downloadapp-manager-1e0a49cd9e0e6a167d78f41a8997f946643135b7.tar.gz
app-manager-1e0a49cd9e0e6a167d78f41a8997f946643135b7.tar.bz2
app-manager-1e0a49cd9e0e6a167d78f41a8997f946643135b7.zip
Fix functions related to attach/detach window
- Separates errors - Adds descriptions about errors Change-Id: I019b236699c579450d8673a8fa0eb347840dbb57 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--include/app_manager_extension.h11
-rw-r--r--src/app_manager.c24
2 files changed, 29 insertions, 6 deletions
diff --git a/include/app_manager_extension.h b/include/app_manager_extension.h
index 4f244ac..5b24761 100644
--- a/include/app_manager_extension.h
+++ b/include/app_manager_extension.h
@@ -148,7 +148,11 @@ int app_manager_get_focused_app_context(app_context_h *app_context);
* otherwise a negative error value
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_MANAGER_ERROR_IO_ERROR Internal I/O error
+ * @retval #APP_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_MANAGER_ERROR_NO_SUCH_APP No such application
+ * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ *
*/
int app_manager_attach_window(const char *parent_app_id, const char *child_app_id);
@@ -161,7 +165,10 @@ int app_manager_attach_window(const char *parent_app_id, const char *child_app_i
* otherwise a negative error value
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_MANAGER_ERROR_IO_ERROR Internal I/O error
+ * @retval #APP_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_MANAGER_ERROR_NO_SUCH_APP No such application
+ * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
*/
int app_manager_detach_window(const char *app_id);
diff --git a/src/app_manager.c b/src/app_manager.c
index f6cdb7c..cd0cd25 100644
--- a/src/app_manager.c
+++ b/src/app_manager.c
@@ -64,6 +64,22 @@ static const char *app_manager_error_to_string(app_manager_error_e error)
}
}
+static int __aul_error_convert(int error)
+{
+ switch (error) {
+ case AUL_R_EINVAL:
+ return APP_MANAGER_ERROR_INVALID_PARAMETER;
+ case AUL_R_EILLACC:
+ return APP_MANAGER_ERROR_PERMISSION_DENIED;
+ case AUL_R_ENOENT:
+ return APP_MANAGER_ERROR_NO_SUCH_APP;
+ case AUL_R_ENOMEM:
+ return APP_MANAGER_ERROR_OUT_OF_MEMORY;
+ default:
+ return APP_MANAGER_ERROR_IO_ERROR;
+ }
+}
+
int app_manager_error(app_manager_error_e error, const char *function, const char *description)
{
if (description)
@@ -651,8 +667,8 @@ API int app_manager_attach_window(const char *parent_app_id, const char *child_a
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
ret = aul_window_attach(parent_app_id, child_app_id);
- if (ret != 0)
- return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
+ if (ret != AUL_R_OK)
+ return app_manager_error(__aul_error_convert(ret), __FUNCTION__, NULL);
return APP_MANAGER_ERROR_NONE;
}
@@ -665,8 +681,8 @@ API int app_manager_detach_window(const char *app_id)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
ret = aul_window_detach(app_id);
- if (ret != 0)
- return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
+ if (ret != AUL_R_OK)
+ return app_manager_error(__aul_error_convert(ret), __FUNCTION__, NULL);
return APP_MANAGER_ERROR_NONE;
}