Replace app_context API with app_info API for getting package ID 06/222906/3 accepted/tizen/unified/20200203.125817 submit/tizen/20200131.043421
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 21 Jan 2020 09:03:07 +0000 (18:03 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 28 Jan 2020 03:44:52 +0000 (12:44 +0900)
P200120-04045

Change-Id: Id21ffee103b37ec9374e0f5655e3fe73ea7557e2

provider/download-provider-security.c

index be59667..8902008 100644 (file)
@@ -59,27 +59,28 @@ static char *_dp_get_pkg_id(dp_credential cred)
 {
        char *app_id = NULL;
        char *pkg_id = NULL;
-       app_context_h context;
+       app_info_h app_info = NULL;
 
        if (app_manager_get_app_id(cred.pid, &app_id) != APP_MANAGER_ERROR_NONE) {
                TRACE_ERROR("Failed to get application ID");
                return NULL;
        }
 
-       if (app_manager_get_app_context(app_id, &context) != APP_MANAGER_ERROR_NONE) {
-               TRACE_ERROR("Failed to get application ID");
+       if (app_info_create(app_id, &app_info) != APP_MANAGER_ERROR_NONE) {
+               TRACE_ERROR("Failed to create app_info");
                free(app_id);
                return NULL;
        }
 
-       if (app_context_get_package_id(context, &pkg_id) != APP_MANAGER_ERROR_NONE) {
-               TRACE_ERROR("Failed to get application ID");
-               app_context_destroy(context);
+       if (app_info_get_package(app_info, &pkg_id) != APP_MANAGER_ERROR_NONE) {
+               TRACE_ERROR("Failed to get package ID");
+               app_info_destroy(app_info);
                free(app_id);
+               free(pkg_id);
                return NULL;
        }
 
-       app_context_destroy(context);
+       app_info_destroy(app_info);
        free(app_id);
 
        return pkg_id;