Allow datacontrol element in ui-application 85/40585/2 accepted/tizen/3.0.2015.q2/common/20150609.181931 accepted/tizen/common/20150609.084312 accepted/tizen/mobile/20150609.085833 accepted/tizen/tv/20150612.003514 accepted/tizen/wearable/20150609.085854 submit/tizen/20150605.114228 submit/tizen_3.0.2015.q2_common/20150609.170642 submit/tizen_tv/20150611.000000
authorSangyoon Jang <s89.jang@samsung.com>
Fri, 5 Jun 2015 08:26:25 +0000 (17:26 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Fri, 5 Jun 2015 08:31:26 +0000 (17:31 +0900)
Change-Id: I726facf89fb434a554203645f987bf9baca99c0f
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
parser/manifest.xsd.in
parser/pkgmgr_parser.c
parser/pkgmgr_parser_db.c

index 8cfcc19..84e1fe7 100644 (file)
           <xs:element ref="packages:category"/>
           <xs:element ref="packages:metadata"/>
                  <xs:element ref="packages:permission"/>
+                 <xs:element ref="packages:datacontrol"/>
         </xs:choice>
       </xs:sequence>
       <xs:attribute name="appid" use="required" type="xs:string"/>
index 8d5ef0d..8921f56 100644 (file)
@@ -2125,6 +2125,16 @@ static void __ps_free_uiapplication(uiapplication_x *uiapplication)
                        permission = tmp;
                }
        }
+       /*Free DataControl*/
+       if (uiapplication->datacontrol) {
+               datacontrol_x *datacontrol = uiapplication->datacontrol;
+               datacontrol_x *tmp = NULL;
+               while(datacontrol != NULL) {
+                       tmp = datacontrol->next;
+                       __ps_free_datacontrol(datacontrol);
+                       datacontrol = tmp;
+               }
+       }
        /* _PRODUCT_LAUNCHING_ENHANCED_ START */
        if (uiapplication->indicatordisplay) {
                free((void *)uiapplication->indicatordisplay);
@@ -3258,6 +3268,7 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
        metadata_x *tmp9 = NULL;
        image_x *tmp10 = NULL;
        permission_x *tmp11 = NULL;
+       datacontrol_x *tmp12 = NULL;
 
        if (xmlTextReaderGetAttribute(reader, XMLCHAR("appid"))) {
                uiapplication->appid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appid")));
@@ -3508,6 +3519,15 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
                        memset(notification, '\0', sizeof(notification_x));
                        LISTADD(uiapplication->notification, notification);
                        ret = __ps_process_notification(reader, notification);
+               } else if (!strcmp(ASCII(node), "datacontrol")) {
+                       datacontrol_x *datacontrol = malloc(sizeof(datacontrol_x));
+                       if (datacontrol == NULL) {
+                               _LOGD("Malloc Failed\n");
+                               return -1;
+                       }
+                       memset(datacontrol, '\0', sizeof(datacontrol_x));
+                       LISTADD(uiapplication->datacontrol, datacontrol);
+                       ret = __ps_process_datacontrol(reader, datacontrol);
                } else
                        return -1;
                if (ret < 0) {
@@ -3560,6 +3580,10 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
                LISTHEAD(uiapplication->permission, tmp11);
                uiapplication->permission = tmp11;
        }
+       if (uiapplication->datacontrol) {
+               LISTHEAD(uiapplication->datacontrol, tmp12);
+               uiapplication->datacontrol = tmp12;
+       }
 
        return ret;
 }
index 02f1674..8f6c89f 100644 (file)
@@ -283,6 +283,7 @@ static int __insert_uiapplication_share_allowed_info(manifest_x *mfx);
 static int __insert_serviceapplication_share_allowed_info(manifest_x *mfx);
 static int __insert_uiapplication_share_request_info(manifest_x *mfx);
 static int __insert_serviceapplication_share_request_info(manifest_x *mfx);
+static int __insert_uiapplication_datacontrol_info(manifest_x *mfx);
 static int __insert_serviceapplication_datacontrol_info(manifest_x *mfx);
 static void __insert_serviceapplication_locale_info(gpointer data, gpointer userdata);
 static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata);
@@ -1076,6 +1077,39 @@ static int __insert_uiapplication_appsvc_info(manifest_x *mfx)
        return 0;
 }
 
+static int __insert_uiapplication_datacontrol_info(manifest_x *mfx)
+{
+       uiapplication_x *up = mfx->uiapplication;
+       datacontrol_x *dc = NULL;
+       int ret = -1;
+       char query[MAX_QUERY_LEN] = {'\0'};
+
+       while(up != NULL)
+       {
+               dc = up->datacontrol;
+               while(dc != NULL)
+               {
+                       snprintf(query, MAX_QUERY_LEN,
+                                       "insert into package_app_data_control(app_id, providerid, access, type) " \
+                                       "values('%s', '%s', '%s', '%s')",\
+                                       mfx->uiapplication->appid,
+                                       dc->providerid,
+                                       dc->access,
+                                       dc->type);
+
+                       ret = __exec_query(query);
+                       if (ret == -1) {
+                               _LOGD("Package UiApp Data Control DB Insert Failed\n");
+                               return -1;
+                       }
+                       memset(query, '\0', MAX_QUERY_LEN);
+                       dc = dc->next;
+               }
+               up = up->next;
+       }
+       return 0;
+}
+
 static int __insert_uiapplication_share_request_info(manifest_x *mfx)
 {
        uiapplication_x *up = mfx->uiapplication;
@@ -1784,6 +1818,9 @@ static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
                return -1;
 
        /*Insert in the package_app_data_control DB*/
+       ret = __insert_uiapplication_datacontrol_info(mfx);
+       if (ret == -1)
+               return -1;
        ret = __insert_serviceapplication_datacontrol_info(mfx);
        if (ret == -1)
                return -1;