summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaekyu Park <jk7744.park@samsung.com>2016-05-27 16:55:38 +0900
committerJaekyu Park <jk7744.park@samsung.com>2016-05-27 16:55:38 +0900
commit0cbdbd0ff734cd9b70cd45a9ebbcbbcc97f5af17 (patch)
treecb0abd55192e5c967555fea0b0a731db52b7009d
parent7a7a9ed6644cc5a152ec5baca9e28dacb697861c (diff)
downloadapp-manager-tizen_2.4.tar.gz
app-manager-tizen_2.4.tar.bz2
app-manager-tizen_2.4.zip
-rw-r--r--include/app_info.h12
-rw-r--r--include/app_manager.h18
-rw-r--r--src/app_context.c42
-rw-r--r--src/app_manager_internal.h2
4 files changed, 13 insertions, 61 deletions
diff --git a/include/app_info.h b/include/app_info.h
index 234054a..15b0e9b 100644
--- a/include/app_info.h
+++ b/include/app_info.h
@@ -120,8 +120,6 @@ typedef enum
/**
* @brief Creates the application information handle.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[in] app_id The application ID
* @param[out] app_info The application information handle
* @return @c 0 on success,
@@ -130,7 +128,6 @@ typedef enum
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #APP_MANAGER_ERROR_NO_SUCH_APP The app is not installed
* @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @see app_manager_foreach_app_info()
* @see app_manager_get_app_info()
*/
@@ -194,8 +191,6 @@ int app_info_get_label(app_info_h app_info, char **label);
/**
* @brief Gets the localed name of the application.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @remarks You must release localed name using free().
* @param[in] app_id The application ID
* @param[in] locale The locale information
@@ -205,7 +200,6 @@ int app_info_get_label(app_info_h app_info, char **label);
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
*/
int app_info_get_localed_label(const char *app_id, const char *locale, char **label);
@@ -349,8 +343,6 @@ int app_info_clone(app_info_h *clone, app_info_h app_info);
* @brief Creates the application information filter handle from DB.
* All filter properties will be ANDed.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[out] handle The pointer to the application info filter handle
* @return @c 0 on success,
* otherwise a negative error value
@@ -358,7 +350,6 @@ int app_info_clone(app_info_h *clone, app_info_h app_info);
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
* @retval #APP_MANAGER_ERROR_IO_ERROR I/O error
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
*/
int app_info_filter_create(app_info_filter_h *handle);
@@ -432,8 +423,6 @@ int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filter_cb
/**
* @brief Creates the application's metadata information filter handle from DB.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[out] handle The pointer to the application metadata info filter handle
* @return @c 0 on success,
* otherwise a negative error value
@@ -441,7 +430,6 @@ int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filter_cb
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
* @retval #APP_MANAGER_ERROR_IO_ERROR I/O error
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
*/
int app_info_metadata_filter_create(app_info_metadata_filter_h *handle);
diff --git a/include/app_manager.h b/include/app_manager.h
index 8b649a5..0a8583e 100644
--- a/include/app_manager.h
+++ b/include/app_manager.h
@@ -93,8 +93,6 @@ typedef bool (*app_manager_app_info_cb) (app_info_h app_info, void *user_data);
/**
* @brief Registers a callback function to be invoked when the applications get launched or terminated.
* @since_tizen 2.4
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[in] callback The callback function to register
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
@@ -102,7 +100,6 @@ typedef bool (*app_manager_app_info_cb) (app_info_h app_info, void *user_data);
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @post It will invoke app_manager_app_context_event_cb() when the application is launched or terminated.
* @see app_manager_unset_app_context_event_cb()
* @see app_manager_app_context_event_cb()
@@ -120,15 +117,12 @@ void app_manager_unset_app_context_event_cb(void);
/**
* @brief Retrieves all application contexts of running applications.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @post This function invokes app_manager_app_context_cb() for each application context.
* @see app_manager_app_context_cb()
*/
@@ -137,8 +131,6 @@ int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *u
/**
* @brief Gets the application context for the given ID of the application.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @remarks This function returns #APP_MANAGER_ERROR_NO_SUCH_APP if the application with the given application ID is not running. \n
* You must release @a app_context using app_context_destroy().
* @param[in] app_id The ID of the application
@@ -149,15 +141,12 @@ int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *u
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @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_get_app_context(const char *app_id, app_context_h *app_context);
/**
* @brief Gets the ID of the application for the given process ID.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @remarks This function returns #APP_MANAGER_ERROR_NO_SUCH_APP if the application with the given process ID is not valid. \n
* You must release @a app_id using free().
* @param[in] pid The process ID of the application
@@ -167,7 +156,6 @@ int app_manager_get_app_context(const char *app_id, app_context_h *app_context);
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #APP_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
*/
int app_manager_get_app_id(pid_t pid, char **app_id);
@@ -221,15 +209,12 @@ int app_manager_request_terminate_bg_app(app_context_h app_context);
/**
* @brief Retrieves all installed applications information.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @param[in] callback The callback function to invoke
* @param[in] user_data The user data to be passed to the callback function
* @return @c 0 on success,
* otherwise a negative error value
* @retval #APP_MANAGER_ERROR_NONE Successful
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_MANAGER_ERROR_PERMISSION_DENIED Permission denied
* @post This function invokes app_manager_app_info_cb() for each application information.
* @see app_manager_app_info_cb()
*/
@@ -238,8 +223,6 @@ int app_manager_foreach_app_info(app_manager_app_info_cb callback, void *user_da
/**
* @brief Gets the application information for the given application ID.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @privlevel public
- * @privilege %http://tizen.org/privilege/packagemanager.info
* @remarks You must release @a app_info using app_info_destroy().
* @param[in] app_id The ID of the application
* @param[out] app_info The application information for the given application ID
@@ -249,7 +232,6 @@ int app_manager_foreach_app_info(app_manager_app_info_cb callback, void *user_da
* @retval #APP_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @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_get_app_info(const char *app_id, app_info_h *app_info);
diff --git a/src/app_context.c b/src/app_context.c
index 9326079..b6516dc 100644
--- a/src/app_context.c
+++ b/src/app_context.c
@@ -40,8 +40,6 @@
static int app_context_create(const char *app_id, pid_t pid, app_context_h *app_context);
-static int app_context_get_app_context_by_pid(pid_t pid, app_context_h *app_context);
-
struct app_context_s {
char *app_id;
pid_t pid;
@@ -149,31 +147,6 @@ int app_context_get_app_context(const char *app_id, app_context_h *app_context)
return app_context_create(retrieval_context.app_id, retrieval_context.pid, app_context);
}
-static int app_context_get_app_context_by_pid(pid_t pid, app_context_h *app_context)
-{
- int retval;
- char appid[APPID_MAX] = {0, };
-
- if (pid < 0 || app_context == NULL)
- {
- return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
-
- if (aul_app_get_appid_bypid(pid, appid, sizeof(appid)) != AUL_R_OK)
- {
- return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL);
- }
-
- retval = app_context_get_app_context(appid, app_context);
-
- if (retval != APP_MANAGER_ERROR_NONE)
- {
- return app_manager_error(retval, __FUNCTION__, NULL);
- }
-
- return APP_MANAGER_ERROR_NONE;
-}
-
static int app_context_create(const char *app_id, pid_t pid, app_context_h *app_context)
{
app_context_h app_context_created;
@@ -389,13 +362,18 @@ static void app_context_pid_table_entry_destroyed_cb(void * data)
}
}
-static int app_context_launched_event_cb(pid_t pid, void *data)
+static int app_context_launched_event_cb(pid_t pid, const char *app_id, void *data)
{
app_context_h app_context;
+ if (pid < 0 || app_id == NULL)
+ {
+ return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+ }
+
app_context_lock_event_cb_context();
- if (app_context_get_app_context_by_pid(pid, &app_context) == APP_MANAGER_ERROR_NONE)
+ if (app_context_create(app_id, pid, &app_context) == APP_MANAGER_ERROR_NONE)
{
if (event_cb_context != NULL && event_cb_context->pid_table != NULL)
{
@@ -456,6 +434,7 @@ int app_context_set_event_cb(app_manager_app_context_event_cb callback, void *us
if (event_cb_context == NULL)
{
+ app_context_unlock_event_cb_context();
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
}
@@ -463,13 +442,16 @@ int app_context_set_event_cb(app_manager_app_context_event_cb callback, void *us
if (event_cb_context->pid_table == NULL)
{
+ free(event_cb_context);
+ event_cb_context = NULL;
+ app_context_unlock_event_cb_context();
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "failed to initialize pid-table");
}
app_context_foreach_app_context(app_context_load_all_app_context_cb_locked, NULL);
aul_listen_app_dead_signal(app_context_terminated_event_cb, NULL);
- aul_listen_app_launch_signal(app_context_launched_event_cb, NULL);
+ aul_listen_app_launch_signal_v2(app_context_launched_event_cb, NULL);
}
diff --git a/src/app_manager_internal.h b/src/app_manager_internal.h
index 42ffb96..8004e16 100644
--- a/src/app_manager_internal.h
+++ b/src/app_manager_internal.h
@@ -11,7 +11,7 @@
* 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.
+ * limitations under the License.
*/
#ifndef __TIZEN_APPFW_APP_MANAGER_INTERNAL_H