2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __RUA_MANAGER_H__
18 #define __RUA_MANAGER_H__
20 #include <app_control.h>
21 #include <rua_context.h>
23 #include <rua_types.h>
30 * @brief Called to get the RUA information once for each launched application.
32 * @remarks After this callback returns, the handle of the RUA information handle is freed.
33 * Therefore, if you want to use the handle after returning this callback, you MUST copy it by using rua_info_clone() function.
35 * @param[in] info The RUA information handle
36 * @param[in] user_data The user data passed from the foreach function
37 * @return @c true to continue with the next iteration of the loop, \n
38 * otherwise @c false to break out of the loop
40 * @see rua_manager_foreach_rua_info()
41 * @see rua_manager_foreach_all_rua_info()
43 typedef bool (*rua_manager_rua_info_cb)(rua_info_h info, void *user_data);
46 * @brief Retrieves all launched applications information.
49 * @privilege %http://tizen.org/privilege/packagemanager.info
51 * @param[in] callback The callback function to invoke
52 * @param[in] user_data The user data to be passed to the callback function
53 * @return @c 0 on success,
54 * otherwise a negative error value
56 * @see rua_info_foreach_cb()
58 int rua_manager_foreach_rua_info(rua_manager_rua_info_cb callback, void *user_data);
61 * @brief Deletes the RUA information.
64 * @param[in] info The RUA information handle
65 * @return @c 0 on success,
66 * otherwise a negative error value
68 * @remarks This function is only available for platform level signed applications.
70 int rua_manager_delete_rua_info(rua_info_h info);
73 * @brief Deletes all RUA informations.
76 * @return @c 0 on success,
77 * otherwise a negative error value
79 * @remarks This function is only available for platform level signed applications.
81 int rua_manager_delete_all_rua_info(void);
84 * @brief Gets the app_control handle from the given RUA information handle.
86 * @remarks You should release @a app_control using app_control_destroy().
88 * @param[in] info The RUA information handle
89 * @param[out] app_control The app_control handle
90 * @return @c 0 on success,
91 * otherwise a negative error value
93 * @see rua_info_foreach()
94 * @see rua_info_usr_foreach()
95 * @see app_control_send_launch_request()
96 * @see app_control_send_launch_request_async()
97 * @see app_control_destroy()
99 int rua_manager_get_app_control_from_rua_info(rua_info_h info, app_control_h *app_control);
102 * @brief Gets the RUA context handle from the given RUA information handle.
104 * @remarks You should release @a context using rua_context_destroy().
106 * @param[in] info The RUA information handle
107 * @param[out] context The RUA context handle
108 * @return @c 0 on success,
109 * otherwise a negative error value
111 * @see rua_info_foreach()
112 * @see rua_info_usr_foreach()
113 * @see rua_context_destroy()
115 int rua_manager_get_rua_context_from_rua_info(rua_info_h info, rua_context_h *context);
118 * @brief Checks whether the instance with the given RUA context handle is running or not.
121 * @param[in] context The RUA context handle
122 * @param[out] running @c true if the instance is running, \n
123 * otherwise @c false if not running
124 * @return @c 0 on success,
125 * otherwise a negative error value
127 int rua_manager_is_running(rua_context_h context, bool *running);
130 * @brief Resumes the instance.
133 * @privilege %http://tizen.org/privilege/appmanager.launch
135 * @param[in] context The RUA context handle
136 * @return @c 0 on success,
137 * otherwise a negative error value
139 int rua_manager_resume(rua_context_h context);
142 * @brief Terminates the instance.
144 * @privlevel platform
145 * @privilege %http://tizen.org/privilege/appmanager.kill
147 * @param[in] context The RUA context handle
148 * @return @c 0 on succes,
149 * otherwise a negative error value
151 int rua_manager_terminate(rua_context_h context);
157 #endif /*__RUA_MANAGER_H__*/