Move to internal.h some func prototypes
[platform/core/api/application.git] / include / app_control_internal.h
1 /*
2  * Copyright (c) 2014 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
18 #define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
19
20 #include <bundle.h>
21
22 #include <app_control.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @file app_control_internal.h
30  */
31
32 /**
33  * @addtogroup CAPI_APP_CONTROL_MODULE
34  * @{
35  */
36
37 /**
38  * @brief Definition for app_control data: Connect the previous app with the next app when the sub-app is terminated.
39  * @details If a sub-app is terminated, framework will connect the previous app with the next app.
40  *          By default, this flag is 'false'
41  */
42 #define APP_CONTROL_DATA_REROUTE "__K_REROUTE__"
43
44 /**
45  * @brief Definition for app_control data: The flag for attaching app.
46  * @details If this flag is set, callee app will be attached to caller app for a while and it will be detached when callee app is lowered.
47  *          By default, this flag is 'false'
48  */
49 #define APP_CONTROL_DATA_SHIFT_WINDOW "__K_SHIFT_WINDOW"
50
51 /**
52  * @brief Definition for app_control data : The flag for supporting recycling processes.
53  * @details By default, this flag is 'false'. Once it is set to 'true', launched sub-app process will be reused even if it was lowered later.
54  *
55  */
56 #define APP_CONTROL_DATA_RECYCLE "__K_RECYCLE"
57
58 /**
59  * @brief Definition for app_control data : The value for supporting relocating launched app under the callee app.
60  * @details By default, this value is NULL. Once it is set to app ID, that application will be relocated under the callee app after callee app is resumed.
61  * @remarks The value should be an app ID for main app which has been launched before, otherwise it will be ignored.
62  */
63 #define APP_CONTROL_DATA_RELOCATE_BELOW "__K_RELOCATE_BELOW"
64
65 /**
66  * @brief Replaces all data in the app_control with the bundle
67  *
68  * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
69  * @param [in] app_control The app_control handle
70  * @param [in] data The bundle handle
71  * @return 0 on success, otherwise a negative error value.
72  * @retval #APP_CONTROL_ERROR_NONE Successful
73  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
74  * @see app_control_export_as_bundle()
75  * @code
76  *
77  * #include <bundle.h>
78  * #include <app_control.h>
79  *
80  * app_control_h app_control = NULL;
81  * app_control_create(&app_control);
82  * app_control_import_from_bundle(app_control, b);
83  *
84  * @endcode
85  *
86  */
87 int app_control_import_from_bundle(app_control_h app_control, bundle *data);
88
89 /**
90  * @brief Returns a new bundle containing all data contained int the app_control
91  *
92  * @remarks The @a data must be released with bundle_free() by you.
93  * @param [in] app_control The app_control handle
94  * @param [out] data The bundle handle
95  * @return 0 on success, otherwise a negative error value.
96  * @retval #APP_CONTROL_ERROR_NONE Successful
97  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
98  * @see app_control_import_from_bundle()
99  * @code
100  *
101  * #include <bundle.h>
102  * #include <app_control.h>
103  *
104  * bundle* b = NULL;
105  * app_control_export_as_bundle(app_control, &b);
106  *
107  * @endcode
108  */
109 int app_control_export_as_bundle(app_control_h app_control, bundle **data);
110
111 int app_control_create_request(bundle *data, app_control_h *app_control);
112
113 int app_control_create_event(bundle *data, app_control_h *app_control);
114
115 int app_control_to_bundle(app_control_h app_control, bundle **data);
116
117 /**
118  * @brief Sets the window ID of the application.
119  *
120  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
121  * @param[in] app_control The app_control handle
122  * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
123  * @return @c 0 on success,
124  *         otherwise a negative error value
125  * @retval #APP_CONTROL_ERROR_NONE Successful
126  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
127  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
128  * @see app_control_get_window()
129  */
130 int app_control_set_window(app_control_h app_control, unsigned int id);
131
132 /**
133  * @brief Gets the window ID of the application.
134  *
135  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
136  * @param[in] app_control The app_control handle
137  * @param[out] id The window ID of the caller application
138  * @return @c 0 on success,
139  *         otherwise a negative error value
140  * @retval #APP_CONTROL_ERROR_NONE Successful
141  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
142  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
143  * @see app_control_set_app_id()
144  */
145 int app_control_get_window(app_control_h app_control, unsigned int *id);
146
147 /**
148  * @brief Requests the specified callee window to be transient for the caller window.
149  *
150  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
151  * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
152  * @param[in] app_control The app_control handle
153  * @param[in] callee_id The callee window ID
154  * @param[in] cbfunc The callback function to be called when the transient is requested
155  * @param[in] data A data pointer to pass to the callback function
156  * @return @c 0 on success,
157  *         otherwise a negative error value.
158  * @retval #APP_CONTROL_ERROR_NONE Successful
159  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
160  */
161 int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
162
163 /**
164  * @platform
165  * @brief Sets the ID of default application associated with operation, mime-type and uri.
166  *
167  * @since_tizen 3.0
168  * @privlevel platform
169  * @privilege %http://tizen.org/privilege/systemsettings.admin
170  * @param[in] app_control The app_control handle
171  * @param[in] app_id The ID of the application
172  *
173  * @return 0 on success, otherwise a negative error value
174  * @retval #APP_CONTROL_ERROR_NONE Successful
175  * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
176  * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
177  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
178  *
179  */
180 int app_control_set_defapp(app_control_h app_control, const char *app_id);
181
182 /**
183  * @platform
184  * @brief Unsets default application control setting of an application.
185  *
186  * @details When an user call this API, all the default application settings for the app_id are unset.
187  *
188  * @since_tizen 3.0
189  * @privlevel platform
190  * @privilege %http://tizen.org/privilege/systemsettings.admin
191  * @param[in] app_id The ID of the application
192  *
193  * @return 0 on success, otherwise a negative error value
194  * @retval #APP_CONTROL_ERROR_NONE Successful
195  * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
196  * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
197  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
198  *
199  */
200 int app_control_unset_defapp(const char *app_id);
201 /**
202  * @}
203  */
204
205 #ifdef __cplusplus
206 }
207 #endif
208
209 #endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */
210