add launch_mode attribute to support app_group 32/40232/1
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 1 Jun 2015 08:30:10 +0000 (17:30 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 1 Jun 2015 08:30:10 +0000 (17:30 +0900)
add launch_mode attribute and new api to get application's launch_mode
in package_app_info.
New API: pkgmgrinfo_appinfo_get_launch_mode

Change-Id: I2e4d0db2c6b7a4b7002bb854c1a04741daedcc09
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
include/pkgmgr-info.h
parser/manifest.xsd.in
parser/pkgmgr_parser.c
parser/pkgmgr_parser.h
parser/pkgmgr_parser_db.c
src/pkgmgr-info.c

index db2f235..4df7bc4 100644 (file)
@@ -1162,6 +1162,45 @@ static int get_pkg_installed_time(const char *pkgid)
 int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
+ * @brief      This API gets the launch mode of package from the package ID
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle  pointer to package info handle
+ * @param[out] mode            pointer to hold launch mode of package
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post               pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see                pkgmgrinfo_pkginfo_get_pkgid()
+ * @see                pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_launch_mode(const char *pkgid)
+{
+       int ret = 0;
+       char *launch_mode = NULL;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_get_launch_mode(handle, &mode);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       printf("launch mode: %s\n", mode);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode);
+
+/**
  * @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
  * @brief      This API gets the store client id of package from the package ID
  *
index 7fac267..8cfcc19 100644 (file)
          <xs:attribute name="component-type" type="xs:string"/>
          <xs:attribute name="submode" type="xs:boolean"/>
          <xs:attribute name="submode-mainid" type="xs:string"/>
+     <xs:attribute name="launch_mode" type="packages:LaunchType"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="ime-application">
          <xs:enumeration value="setting"/>
         </xs:restriction>
   </xs:simpleType>
+  <xs:simpleType name="LaunchType">
+       <xs:restriction base="xs:string">
+         <xs:enumeration value="caller"/>
+         <xs:enumeration value="single"/>
+         <xs:enumeration value="group"/>
+        </xs:restriction>
+  </xs:simpleType>
   <xs:simpleType name="ResolutionType">
        <xs:restriction base="xs:string">
          <xs:enumeration value="xhigh"/>
index 24d2ce8..c28dfa3 100644 (file)
@@ -3484,6 +3484,13 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
        }
        if (xmlTextReaderGetAttribute(reader, XMLCHAR("submode-mainid")))
                uiapplication->submode_mainid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("submode-mainid")));
+       if (xmlTextReaderGetAttribute(reader, XMLCHAR("launch_mode"))) {
+               uiapplication->launch_mode = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("launch_mode")));
+               if (uiapplication->launch_mode == NULL)
+                       uiapplication->launch_mode = strdup("caller");
+       } else {
+               uiapplication->launch_mode = strdup("caller");
+       }
 
        depth = xmlTextReaderDepth(reader);
        while ((ret = __next_child_element(reader, depth))) {
index cbbf806..c1cf572 100644 (file)
@@ -387,6 +387,7 @@ typedef struct uiapplication_x {
        const char *preload;
        const char *submode;
        const char *submode_mainid;
+       const char *launch_mode;
        struct label_x *label;
        struct icon_x *icon;
        struct image_x *image;
@@ -401,6 +402,7 @@ typedef struct uiapplication_x {
        struct datacontrol_x *datacontrol;
        struct uiapplication_x *prev;
        struct uiapplication_x *next;
+
 } uiapplication_x;
 
 typedef struct serviceapplication_x {
index 83383f5..dcd4c89 100644 (file)
@@ -129,6 +129,7 @@ sqlite3 *pkgmgr_cert_db;
                                                "app_preload text DEFAULT 'false', " \
                                                "app_submode text DEFAULT 'false', " \
                                                "app_submode_mainid text, " \
+                                               "app_launch_mode text NOT NULL DEFAULT 'caller', " \
                                                "component_type text, " \
                                                "package text not null, " \
                                                "FOREIGN KEY(package) " \
@@ -828,8 +829,8 @@ static int __insert_uiapplication_info(manifest_x *mfx)
                         "insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
                        "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_screenreader, app_mainapp , app_recentimage, " \
                        "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, "\
-                       "app_preload, app_submode, app_submode_mainid, component_type, package) " \
-                       "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+                       "app_preload, app_submode, app_submode_mainid, component_type, package, app_launch_mode) " \
+                       "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
                         up->appid,
                         "uiapp",
                         up->exec,
@@ -854,7 +855,8 @@ static int __insert_uiapplication_info(manifest_x *mfx)
                         up->submode,
                         __get_str(up->submode_mainid),
                         up->component_type,
-                        mfx->package);
+                        mfx->package,
+                        up->launch_mode);
 
                ret = __exec_query(query);
                if (ret == -1) {
index 6b6a5e9..f5b2926 100644 (file)
@@ -1152,6 +1152,11 @@ static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->uiapplication->submode_mainid = strdup(coltxt[i]);
                        else
                                info->manifest_info->uiapplication->submode_mainid = NULL;
+               } else if (strcmp(colname, "app_launch_mode") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->launch_mode = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->launch_mode = NULL;
                } else
                        continue;
        }
@@ -1835,6 +1840,11 @@ static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colnam
                                                                info->manifest_info->uiapplication->submode_mainid = strdup(coltxt[j]);
                                                        else
                                                                info->manifest_info->uiapplication->submode_mainid = NULL;
+                                               } else if (strcmp(colname[j], "app_launch_mode") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->launch_mode = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->launch_mode = NULL;
                                                } else
                                                        continue;
                                        }
@@ -2084,6 +2094,11 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                        info->uiapp_info->submode_mainid = strdup(coltxt[i]);
                                else
                                        info->uiapp_info->submode_mainid = NULL;
+                       } else if (strcmp(colname[i], "app_launch_mode") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->launch_mode = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->launch_mode = NULL;
                        } else
                                continue;
                }
@@ -5780,6 +5795,19 @@ API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+       retvm_if(mode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       if (info->uiapp_info->launch_mode)
+               *mode = (char *)(info->uiapp_info->launch_mode);
+       else
+               return PMINFO_R_ERROR;
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid, const char *type, uid_t uid, char **appid, char **access)
 {
        retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");