summaryrefslogtreecommitdiff
path: root/include/app_control_internal.h
blob: 99aa5373470cb866c0a01e988345b8c5178aa31c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
 * Copyright (c) 2014 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
#define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__

#include <bundle.h>

#include <app_control.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file app_control_internal.h
 */

/**
 * @addtogroup CAPI_APP_CONTROL_MODULE
 * @{
 */

/**
 * @brief Definition for app_control data: Connect the previous app with the next app when the sub-app is terminated.
 * @details If a sub-app is terminated, framework will connect the previous app with the next app.
 *          By default, this flag is 'false'
 */
#define APP_CONTROL_DATA_REROUTE "__K_REROUTE__"

/**
 * @brief Definition for app_control data: The flag for attaching app.
 * @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.
 *          By default, this flag is 'false'
 */
#define APP_CONTROL_DATA_SHIFT_WINDOW "__K_SHIFT_WINDOW"

/**
 * @brief Definition for app_control data : The flag for supporting recycling processes.
 * @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.
 *
 */
#define APP_CONTROL_DATA_RECYCLE "__K_RECYCLE"

/**
 * @brief Definition for app_control data : The value for supporting relocating launched app under the callee app.
 * @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.
 * @remarks The value should be an app ID for main app which has been launched before, otherwise it will be ignored.
 */
#define APP_CONTROL_DATA_RELOCATE_BELOW "__K_RELOCATE_BELOW"

/**
 * @brief Definition for app_control data: The value for supporting background launch mode.
 * @details By default, this flag is 'disable'. Once it is set to 'enable', A window of callee app doesn't appear on the screen.
 */
#define APP_CONTROL_DATA_BACKGROUND_LAUNCH "__K_BG_LAUNCH"

/**
 * @brief Replaces all data in the app_control with the bundle
 *
 * @remarks This function clears all data in the app_control and adds all key-value pairs in the bundle into the app_control
 * @param [in] app_control The app_control handle
 * @param [in] data The bundle handle
 * @return 0 on success, otherwise a negative error value.
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @see	app_control_export_as_bundle()
 * @code
 *
 * #include <bundle.h>
 * #include <app_control.h>
 *
 * app_control_h app_control = NULL;
 * app_control_create(&app_control);
 * app_control_import_from_bundle(app_control, b);
 *
 * @endcode
 *
 */
int app_control_import_from_bundle(app_control_h app_control, bundle *data);

/**
 * @brief Returns a new bundle containing all data contained int the app_control
 *
 * @remarks The @a data must be released with bundle_free() by you.
 * @param [in] app_control The app_control handle
 * @param [out] data The bundle handle
 * @return 0 on success, otherwise a negative error value.
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @see	app_control_import_from_bundle()
 * @code
 *
 * #include <bundle.h>
 * #include <app_control.h>
 *
 * bundle* b = NULL;
 * app_control_export_as_bundle(app_control, &b);
 *
 * @endcode
 */
int app_control_export_as_bundle(app_control_h app_control, bundle **data);

int app_control_create_request(bundle *data, app_control_h *app_control);

int app_control_create_event(bundle *data, app_control_h *app_control);

int app_control_to_bundle(app_control_h app_control, bundle **data);

/**
 * @brief Sets the window ID of the application.
 *
 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
 * @param[in] app_control The app_control handle
 * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
 * @see app_control_get_window()
 */
int app_control_set_window(app_control_h app_control, unsigned int id);

/**
 * @brief Gets the window ID of the application.
 *
 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
 * @param[in] app_control The app_control handle
 * @param[out] id The window ID of the caller application
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
 * @see app_control_set_app_id()
 */
int app_control_get_window(app_control_h app_control, unsigned int *id);

/**
 * @brief Requests the specified callee window to be transient for the caller window.
 *
 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
 * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
 * @param[in] app_control The app_control handle
 * @param[in] callee_id The callee window ID
 * @param[in] cbfunc The callback function to be called when the transient is requested
 * @param[in] data A data pointer to pass to the callback function
 * @return @c 0 on success,
 *         otherwise a negative error value.
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 */
int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);

/**
 * @platform
 * @brief Sets the ID of default application associated with operation, mime-type and uri.
 *
 * @since_tizen 3.0
 * @privlevel platform
 * @privilege %http://tizen.org/privilege/systemsettings.admin
 * @param[in] app_control The app_control handle
 * @param[in] app_id The ID of the application
 *
 * @return 0 on success, otherwise a negative error value
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
 * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 *
 */
int app_control_set_defapp(app_control_h app_control, const char *app_id);

/**
 * @platform
 * @brief Unsets default application control setting of an application.
 *
 * @details When an user call this API, all the default application settings for the app_id are unset.
 *
 * @since_tizen 3.0
 * @privlevel platform
 * @privilege %http://tizen.org/privilege/systemsettings.admin
 * @param[in] app_id The ID of the application
 *
 * @return 0 on success, otherwise a negative error value
 * @retval #APP_CONTROL_ERROR_NONE Successful
 * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
 * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
 * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
 *
 */
int app_control_unset_defapp(const char *app_id);
/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */