2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 __APPINFO_PROVIDER_H_
18 #define __APPINFO_PROVIDER_H_
24 * @brief Iterator used to obtain all running apps.
26 typedef struct app_info_iterator app_info_iterator_t;
29 * @brief Go to next element of iterator.
30 * @param[in] iter Iterator struct.
32 bool app_info_iterator_next(app_info_iterator_t *iter);
35 * @brief Gets app id from iterator.
36 * @param[in] iter Iterator struct.
38 const char *app_info_iterator_get_app_id(app_info_iterator_t *iter);
41 * @brief Gets pid of app from iterator.
42 * @param[in] iter Iterator struct.
44 int app_info_iterator_get_pid(app_info_iterator_t *iter);
47 * @brief Frees resource used by iterator.
48 * @param[in] iter Iterator struct.
50 void app_info_iterator_free(app_info_iterator_t *iter);
53 * @brief Returns list of running Tizen applications.
55 * @return app_info_iterator, NULL when no apps are running or on error.
57 * @remark function is thread safe
58 * @remark returned value should be released with @app_info_iterator_free
60 app_info_iterator_t *app_info_provider_get_running_applications();
63 * @brief Searches Tizen applications main process id.
65 * @return pid (>0) on success, -1 if app_id was not found
67 * @remark function is thread safe
68 * @remark app_provide_init should be called beforehead
70 int app_info_provider_find_main_pid(const char *app_id);
73 * @brief Searches for Tizen application app_id with given pid.
75 * @return app_id, NULL on if pid was not found or not owned by any Tizen application
77 * @remark function is thread safe
78 * @remark app_provide_init should be called beforehead
79 * @remark the returned value should be released with @free
81 char *app_info_provider_find_app_id(int pid);
84 * @brief Initializes app provider internals
86 * @return 0 on success, other value on error.
88 int app_provider_init();
91 * @brief Shutdowns app provider internals
93 void app_provider_shutdown();