Fix app_info_create for backward compatibility 90/142990/6
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 8 Aug 2017 05:29:12 +0000 (14:29 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 9 Aug 2017 01:25:32 +0000 (01:25 +0000)
- Temporary fix to app_info_create retrieves app info
  with alias id

Change-Id: I57972f2a4e6c7eecc3cb30d1b4f89a372608bfc6
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/app_info.c

index c4f0c1a..9998830 100644 (file)
@@ -25,6 +25,7 @@
 #include <package-manager.h>
 #include <dlog.h>
 #include <cynara-client.h>
+#include <aul_svc.h>
 
 #include "app_info.h"
 #include "app_manager.h"
@@ -319,6 +320,7 @@ API int app_info_create(const char *app_id, app_info_h *app_info)
        app_info_h info = NULL;
        int retval = 0;
        char *main_appid = NULL;
+       char *real_appid = NULL;
 
        if (app_id == NULL || app_info == NULL)
                return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
@@ -327,6 +329,18 @@ API int app_info_create(const char *app_id, app_info_h *app_info)
        if (info == NULL)
                return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
 
+       if (aul_svc_get_appid_by_alias_appid(app_id, &real_appid) ==
+                       AUL_SVC_RET_OK && real_appid != NULL) {
+               retval = pkgmgrinfo_appinfo_get_usr_appinfo(real_appid,
+                               getuid(), &appinfo);
+               free(real_appid);
+               if (!retval) {
+                       info->app_id = strdup(app_id);
+                       info->pkg_app_info = appinfo;
+                       *app_info = info;
+                       return APP_MANAGER_ERROR_NONE;
+               }
+       }
        retval = pkgmgrinfo_appinfo_get_usr_appinfo(app_id, getuid(), &appinfo);
        if (!retval) {
                info->app_id = strdup(app_id);