[Release] wrt-installer_0.0.89 submit/sdk/20130103.015145
authorJihoon Chung <jihoon.chung@samsung.com>
Thu, 3 Jan 2013 01:50:16 +0000 (10:50 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Thu, 3 Jan 2013 01:50:16 +0000 (10:50 +0900)
81 files changed:
.gitignore [new file with mode: 0644]
configuration/config.tizen.xsd [changed mode: 0644->0755]
configuration/config.xml [changed mode: 0644->0755]
configuration/config.xsd [changed mode: 0644->0755]
debian/changelog
etc/CMakeLists.txt
etc/drm/armv7l/libdrm-service-core-intel.so [deleted symlink]
etc/drm/armv7l/libdrm-service-core-intel.so.0 [deleted symlink]
etc/drm/armv7l/libdrm-service-core-intel.so.0.0.0 [deleted file]
etc/drm/ix86/libdrm-service-core-intel.so [deleted symlink]
etc/drm/ix86/libdrm-service-core-intel.so.0 [deleted symlink]
etc/drm/ix86/libdrm-service-core-intel.so.0.0.0 [deleted file]
etc/wrt_preinstall_widgets.sh
packaging/wrt-installer.spec
packaging/wrt-preinstall-widgets.service [new file with mode: 0644]
src/CMakeLists.txt
src/commons/drm/CPointerArray.h [deleted file]
src/commons/drm/CXMLAttribute.h [deleted file]
src/commons/drm/CXMLElement.h [deleted file]
src/commons/drm/CXMLFile.h [deleted file]
src/commons/drm/InkaTypes.h [deleted file]
src/commons/drm/IntelDrm_Core.h [deleted file]
src/commons/drm/drm-intel-crypto-util.h [deleted file]
src/commons/drm/drm-intel-util.h [deleted file]
src/commons/drm/drm-oem-intel.h [deleted file]
src/commons/wrt_common_types.h
src/configuration_parser/widget_parser.cpp
src/configuration_parser/widget_parser.h
src/jobs/widget_install/ace_registration.cpp [new file with mode: 0644]
src/jobs/widget_install/ace_registration.h [new file with mode: 0644]
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/job_widget_install.h
src/jobs/widget_install/manifest.cpp [changed mode: 0644->0755]
src/jobs/widget_install/manifest.h [changed mode: 0644->0755]
src/jobs/widget_install/task_certificates.cpp
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_commons.cpp
src/jobs/widget_install/task_commons.h
src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/task_database.h
src/jobs/widget_install/task_db_update.cpp [deleted file]
src/jobs/widget_install/task_db_update.h [deleted file]
src/jobs/widget_install/task_encrypt_resource.cpp
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_file_manipulation.h
src/jobs/widget_install/task_manifest_file.cpp [changed mode: 0644->0755]
src/jobs/widget_install/task_manifest_file.h [changed mode: 0644->0755]
src/jobs/widget_install/task_new_db_insert.cpp [deleted file]
src/jobs/widget_install/task_new_db_insert.h [deleted file]
src/jobs/widget_install/task_private_storage.cpp [deleted file]
src/jobs/widget_install/task_recovery.cpp
src/jobs/widget_install/task_unzip.cpp
src/jobs/widget_install/task_widget_config.cpp
src/jobs/widget_install/task_widget_config.h
src/jobs/widget_install/wac_security.cpp
src/jobs/widget_install/wac_security.h
src/jobs/widget_install/widget_install_context.h
src/jobs/widget_install/widget_install_errors.h
src/jobs/widget_install/widget_installer_struct.h
src/jobs/widget_install/widget_unzip.cpp [deleted file]
src/jobs/widget_install/widget_unzip.h [deleted file]
src/jobs/widget_uninstall/job_widget_uninstall.cpp
src/jobs/widget_uninstall/job_widget_uninstall.h
src/jobs/widget_uninstall/task_db_update.cpp
src/jobs/widget_uninstall/task_remove_files.cpp
src/jobs/widget_uninstall/task_remove_files.h
src/jobs/widget_uninstall/uninstaller_context.h
src/jobs/widget_uninstall/widget_uninstaller_struct.h
src/logic/installer_controller.h
src/misc/widget_install_to_external.cpp [new file with mode: 0644]
src/misc/widget_install_to_external.h [new file with mode: 0644]
src/misc/widget_location.cpp
src/misc/widget_location.h
src/pkg-manager/pkgmgr_signal.cpp
src/pkg-manager/pkgmgr_signal.h
src/pkg-manager/pkgmgr_signal_dummy.h [new file with mode: 0644]
src/pkg-manager/pkgmgr_signal_interface.h [moved from src/jobs/widget_install/task_private_storage.h with 50% similarity]
src/wrt-installer/wrt_installer.cpp
src/wrt-installer/wrt_installer.h
src/wrt-installer/wrt_installer_api.cpp
src/wrt-installer/wrt_installer_api.h

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..306ad56
--- /dev/null
@@ -0,0 +1,3 @@
+*~
+\#*#
+.#*
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index a981896..46adddc
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Widget Configuration Document Extensions XSD For TIZEN -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"   xmlns:tizen="http://tizen.org/ns/widgets" targetNamespace="http://tizen.org/ns/widgets">
-
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"   xmlns:tizen="http://tizen.org/ns/widgets" targetNamespace="http://tizen.org/ns/widgets" xmlns:widgets="http://www.w3.org/ns/widgets">
+    <xs:import namespace="http://www.w3.org/ns/widgets" schemaLocation="config.xsd"/>
 <xs:simpleType name="appserviceOperationType">
-    <!--
-    <xs:restriction base="xs:token">
+    <!--               
+    <xs:restriction base="xs:token">           
         <xs:enumeration value="http://tizen.org/appsvc/operation/edit"/>
         <xs:enumeration value="http://tizen.org/appsvc/operation/view"/>
         <xs:enumeration value="http://tizen.org/appsvc/operation/pick"/>
@@ -13,7 +13,7 @@
         <xs:enumeration value="http://tizen.org/appsvc/operation/send"/>
         <xs:enumeration value="http://tizen.org/appsvc/operation/dial"/>
         <xs:enumeration value="http://tizen.org/appsvc/operation/search"/>
-    </xs:restriction>
+    </xs:restriction>          
     -->
     <xs:restriction base="xs:anyURI"/>
 </xs:simpleType>
     </xs:restriction>
 </xs:simpleType>
 
+<xs:simpleType name="liveboxIdType">
+    <xs:restriction base="xs:string">
+        <xs:pattern value="[0-9a-zA-Z]{1,}"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="boxSizeType">
+    <xs:restriction base="xs:token">
+        <xs:enumeration value="1x1"/>
+        <xs:enumeration value="2x1"/>
+        <xs:enumeration value="2x2"/>
+        <xs:enumeration value="4x2"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="pdWidth">
+    <xs:restriction base="xs:int">
+        <xs:minInclusive value="175"/>
+        <xs:maxInclusive value="720"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:simpleType name="pdHeight">
+    <xs:restriction base="xs:int">
+        <xs:minInclusive value="175"/>
+        <xs:maxInclusive value="525"/>
+    </xs:restriction>
+</xs:simpleType>
+
+<xs:element name="content">
+    <xs:complexType>
+        <xs:attribute name="src" use="required" type="xs:anyURI"/>
+    </xs:complexType>
+</xs:element>
+
+<!-- TODO : appservice will be removed. Please use app-control-->
 <xs:element name="appservice">
     <xs:complexType>
         <xs:attribute name="src" type="xs:NCName" use="required"/>
 <xs:element name="setting">
     <xs:complexType>
         <xs:attribute name="screen-orientation" type="tizen:screenOrientationType" use="optional"/> <!-- default: portrait -->
-        <xs:attribute name="contextmenu" type="tizen:activationType" use="optional"/>
-        <xs:attribute name="context-menu" type="tizen:activationType" use="optional"/>
-        <xs:attribute name="background-support" type="tizen:activationType" use="optional"/>
+        <xs:attribute name="context-menu" type="tizen:activationType" use="optional"/> <!-- default: enable -->
+        <xs:attribute name="background-support" type="tizen:activationType" use="optional"/> <!-- default: enable -->
+        <xs:attribute name="encryption" type="tizen:activationType" use="optional"/> <!-- default: disable -->
+        <xs:attribute name="nodisplay" type="widgets:data.boolean" use="optional"/> <!-- default: false -->
+    </xs:complexType>
+</xs:element>
+
+<xs:element name="app-control">
+  <xs:complexType>
+    <xs:sequence>
+      <xs:choice maxOccurs="unbounded">
+        <xs:element ref="packages:src"/>
+        <xs:element ref="packages:operation"/>
+        <xs:element ref="packages:scheme"/>
+        <xs:element ref="packages:mime"/>
+      </xs:choice>
+    </xs:sequence>
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="category">
+  <xs:complexType>
+    <xs:anyAttribute processContents="lax"/>
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="src">
+  <xs:complexType>
+    <xs:attribute name="name" type="xs:NCName" use="required"/>
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="operation">
+  <xs:complexType>
+    <xs:attribute name="name" type="tizen:appserviceOperationType" use="required"/>
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="scheme">
+  <xs:complexType>
+    <xs:attribute name="name" type="xs:string" use="optional"/>
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="mime">
+  <xs:complexType>
+    <xs:attribute name="name" type="xs:string" use="optional"/>
+  </xs:complexType>
+</xs:element>
+
+<xs:element name="livebox">
+    <xs:complexType mixed="true">
+        <xs:all>
+            <xs:element ref="tizen:label"/>
+            <xs:element ref="tizen:icon"/>
+            <xs:element ref="tizen:box"/>
+        </xs:all>     
+        <xs:attribute name="appid" type="tizen:liveboxIdType" use="required"/> 
+        <xs:attribute name="auto_launch" type="widgets:data.boolean" use="optional"/> 
+        <xs:attribute name="period" type="xs:float" use="optional"/> 
+        <xs:attribute name="network" type="widgets:data.boolean" use="optional"/> 
+        <xs:attribute name="nodisplay" type="widgets:data.boolean" use="optional"/> 
+        <xs:attribute name="primary" type="widgets:data.boolean" use="required"/> 
+        <xs:attribute name="timeout" type="xs:int" use="optional"/> 
     </xs:complexType>
 </xs:element>
 
+<xs:element name="label" type="xs:string"/>
+
+<xs:element name="icon">
+    <xs:complexType>
+    <xs:attribute name="src" use="required" type="xs:anyURI"/>
+    </xs:complexType>
+</xs:element>
+
+<xs:element name="box">
+    <xs:complexType mixed="true">
+        <xs:sequence>
+            <xs:element ref="tizen:boxsize" maxOccurs="4"/>
+            <xs:element ref="tizen:pd"/>
+        </xs:sequence>
+        <xs:attribute name="src" use="required" type="xs:anyURI"/>
+    </xs:complexType>
+</xs:element>
+
+<xs:element name="pd">
+    <xs:complexType>
+        <xs:attribute name="src" use="required" type="xs:anyURI"/>
+        <xs:attribute name="width" use="required" type="tizen:pdWidth"/>
+        <xs:attribute name="height" use="required" type="tizen:pdHeight"/>
+    </xs:complexType>
+</xs:element>
+
+<xs:element name="boxsize" type="tizen:boxSizeType">
+    <xs:attribute name="preview" use="optional" type="xs:anyURI"/>
+</xs:element>
+
 </xs:schema>
old mode 100644 (file)
new mode 100755 (executable)
index 4038a23..3e5dc15
@@ -1,23 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" version="2.0 Beta" viewmodes="fullscreen" id="http://tizen.org/cert">
-  <feature name="http://tizen.org/api/accelerometer" required="false"/>
-  <feature name="http://tizen.org/api/account" required="false"/>
-  <feature name="http://tizen.org/api/application" required="false"/>
-  <feature name="http://tizen.org/api/callHistory.read" required="false"/>
-  <feature name="http://tizen.org/api/callHistory.write" required="false"/>
-  <feature name="http://tizen.org/api/deviceapis" required="false"/>
-  <feature name="http://tizen.org/api/deviceinteraction" required="false"/>
-  <feature name="http://tizen.org/api/gallery" required="false"/>
-  <feature name="http://tizen.org/api/gyroscope" required="false"/>
-  <feature name="http://tizen.org/api/intel-messaging" required="false"/>
-  <feature name="http://tizen.org/api/messaging" required="false"/>
-  <feature name="http://tizen.org/api/messaging.send" required="false"/>
-  <feature name="http://tizen.org/api/messaging.read" required="false"/>
-  <feature name="http://tizen.org/api/messaging.write" required="false"/>
-  <feature name="http://tizen.org/api/pim" required ="false"/>
-  <feature name="http://tizen.org/api/orientation" required="false"/>
-  <feature name="http://tizen.org/api/systeminfo" required="false"/>
-  <feature name="http://tizen.org/api/waclog" required="false"/>
+  <feature name="http://tizen.org/privilege/accelerometer" />
+  <feature name="http://tizen.org/privilege/account" />
+  <feature name="http://tizen.org/privilege/application" />
+  <feature name="http://tizen.org/privilege/callHistory.read" />
+  <feature name="http://tizen.org/privilege/callHistory.write" />
+  <feature name="http://tizen.org/privilege/deviceapis" />
+  <feature name="http://tizen.org/privilege/deviceinteraction" />
+  <feature name="http://tizen.org/privilege/gallery" />
+  <feature name="http://tizen.org/privilege/gyroscope" />
+  <feature name="http://tizen.org/privilege/intel-messaging" />
+  <feature name="http://tizen.org/privilege/messaging" />
+  <feature name="http://tizen.org/privilege/messaging.send" />
+  <feature name="http://tizen.org/privilege/messaging.read" />
+  <feature name="http://tizen.org/privilege/messaging.write" />
+  <feature name="http://tizen.org/privilege/pim" />
+  <feature name="http://tizen.org/privilege/orientation" />
+  <feature name="http://tizen.org/privilege/systeminfo" />
+  <feature name="http://tizen.org/privilege/waclog" />
   <name> hello </name>
   <icon src="icon.png" />
 
@@ -32,4 +32,5 @@
   <!-- tizen setting element -->
   <tizen:setting screen-orientation="portrait" />
   <tizen:setting contextmenu="disable" />
+  <tizen:setting nodisplay="false" />
 </widget>
old mode 100644 (file)
new mode 100755 (executable)
index 84d734d..07d19e8
             <xs:enumeration value="false"/>\r
         </xs:restriction>\r
     </xs:simpleType>\r
+    <xs:simpleType name="data.versionNumber">\r
+        <xs:restriction base="xs:string">\r
+            <xs:pattern value="[0-9]{2}.[0-9]{2}.[0-9]{4}"/>\r
+        </xs:restriction>\r
+    </xs:simpleType>\r
     <xs:element name="widget">\r
         <xs:complexType mixed="true">\r
             <xs:choice minOccurs="0" maxOccurs="unbounded">\r
                 <xs:element ref="tizen:appservice"  maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
                 <xs:element ref="tizen:setting"  maxOccurs="unbounded" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
                 <xs:element ref="tizen:application" minOccurs="1" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
+                <xs:element ref="tizen:content"  minOccurs="1" maxOccurs="1" xmlns:tizen="http://tizen.org/ns/widgets"/>\r
                 </xs:choice>\r
             <xs:attribute ref="xml:lang"/>\r
             <xs:attribute name="id" type="xs:anyURI"/>\r
-            <xs:attribute name="version"/>\r
+            <xs:attribute name="version" type="widgets:data.versionNumber"/>\r
             <xs:attribute name="height" type="widgets:data.positiveNumber"/>\r
             <xs:attribute name="width" type="widgets:data.positiveNumber"/>\r
             <xs:attribute name="viewmodes">\r
@@ -79,7 +85,7 @@
                     <xs:list>\r
                         <xs:simpleType>\r
                             <xs:restriction base="xs:token">\r
-                                <xs:enumeration value="windowed"/>\r
+                                <xs:enumeration value="maximized"/>\r
                                 <xs:enumeration value="fullscreen"/>\r
                             </xs:restriction>\r
                         </xs:simpleType>\r
             <xs:choice minOccurs="0" maxOccurs="unbounded">\r
                 <xs:element ref="widgets:param"/>\r
             </xs:choice>\r
-            <xs:attribute name="name" use="required" type="xs:anyURI"/>\r
-            <xs:attribute name="required" type="widgets:data.boolean"/>\r
             <xs:attributeGroup ref="widgets:extension"/>\r
         </xs:complexType>\r
     </xs:element>\r
index e5a18b9..a9505da 100644 (file)
@@ -1,3 +1,178 @@
+wrt-installer (0.0.89) unstable; urgency=low
+
+  * Throw error on no ElementParser
+  * Closed directory
+  * Apply vconf key path builder
+  * Add vconf creation for memory saving mode
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.89
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Wed, 02 Jan 2013 11:17:14 +0900
+
+wrt-installer (0.0.88) unstable; urgency=low
+
+  * Create/Remove vconf for security settings
+  * Remove required attribute and viewmode Change windowed to maximized
+  * auto-launch tag has been changed
+  * livebox configuration valuables has been modified
+  * For livebox configuration
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.88
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 28 Dec 2012 16:59:20 +0900
+
+wrt-installer (0.0.86) unstable; urgency=low
+
+  * Add installation to external location(sdcard)
+  * Remove installed directory and manifest file when installation failed after ace check
+  * Fixed directory installation using pkgcmd
+  * Fixed crash for external installation
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.86
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Wed, 26 Dec 2012 13:45:45 +0900
+
+wrt-installer (0.0.85) unstable; urgency=low
+
+  * Add category element at manifest and config.xml 
+
+ -- KEONGEUN <lke01.lee@samsung.com>  Fri, 21 Dec 2012 16:48:54 +0900
+
+wrt-installer (0.0.84) unstable; urgency=low
+
+  * Fix for unhandled exception
+  * Dummy PkgmgrSignal for command line installation
+  * Support privilege database table
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.84
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Thu, 20 Dec 2012 08:49:25 +0900
+
+wrt-installer (0.0.83) unstable; urgency=low
+
+  * Handle unhandled exceptions in wrt-installer
+  * Support <tizen:privilege>
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.83
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 14 Dec 2012 10:47:26 +0900
+
+wrt-installer (0.0.82) unstable; urgency=low
+
+  * Fixed build break
+  * [systemd] fix build error
+  * Directory install feature fix
+  * Update schema files
+  * [Prevent] Removed warning from Prevent.
+  * [Prevent] Removed warning from Prevent.
+  * Fixed package manager doesn't receive signal for widget update failed.
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.82
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Wed, 12 Dec 2012 15:50:01 +0900
+
+wrt-installer (0.0.81) unstable; urgency=low
+
+  * Merge branch 'systemd'
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.81
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Thu, 06 Dec 2012 14:02:20 +0900
+
+wrt-installer (0.0.80) unstable; urgency=low
+
+  * Distinguish between system headers and project headers.
+  * Add nodisplay setting
+  * arrangement of directory creation.
+  * add to create share directory
+  * Fixed nodisplay when other setting values exist.
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.80
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Wed, 05 Dec 2012 17:23:51 +0900
+
+wrt-installer (0.0.79) unstable; urgency=low
+
+  * Direcotry install feature added to wrt-installer
+  * [Prevent] Handle return value of regcomp.
+  * Removing unused merged code
+  * Pkgname (tizen id) - not null
+  * Platform version check during wgt installation - fixed
+  * Revert "Pkgname (tizen id) - not null"
+  * save installed path to db for preload widget
+  * Fixed certificate of authentication value to base64.
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.79
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Fri, 30 Nov 2012 21:44:41 +0900
+
+wrt-installer (0.0.78) unstable; urgency=low
+
+  * [Prevent] Handle fread return value.
+  * [Prevent] Handle return value from CertificateCollection::sort.
+  * remove temporary drm library and header files.
+  * [Installer] Clean up Flash Parser.
+  * Fixed can't remove preinstall widget during booting
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.78
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Tue, 27 Nov 2012 16:51:00 +0900
+
+wrt-installer (0.0.77) unstable; urgency=low
+
+  * Revert "Platform version check during wgt installation"
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.77
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Fri, 23 Nov 2012 21:19:17 +0900
+
+wrt-installer (0.0.76) unstable; urgency=low
+
+  * Filter output from wrt-installer needs for "expr match" to succeed
+  * Introduce systemd support
+  * Removed deprecated code
+  * Handle return value
+  * Platform version check during wgt installation
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.76
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Fri, 23 Nov 2012 12:01:17 +0900
+
+wrt-installer (0.0.75) unstable; urgency=low
+
+  * Fail to install package
+  * External file removal fix
+  * Removed GetFactoryWidget.
+  * Ace database fulfill implemented
+  * update drm library for temporary
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.75
+
+ -- sy037.kim <sy037kim@soyoung-DeskTop>  Mon, 19 Nov 2012 19:56:28 +0900
+
+wrt-installer (0.0.74) unstable; urgency=low
+
+  * Replace SignatureValidator.
+  * Fixed to set certi information
+
+  * Git : framework/web/wrt-installer
+  * Tag : wrt-installer_0.0.74
+
+ -- Soyoung Kim <sy037.kim@samsung.com>  Thu, 15 Nov 2012 16:46:02 +0900
+
 wrt-installer (0.0.73) unstable; urgency=low
 
   * WidgetHandle removal - part 4
index adccb68..370d4af 100644 (file)
@@ -1,10 +1,3 @@
 SET(ETC_DIR ${PROJECT_SOURCE_DIR}/etc)
 
 INSTALL(PROGRAMS ${ETC_DIR}/wrt_preinstall_widgets.sh DESTINATION /etc/rc.d/init.d)
-
-# Below Code is temporary. When DRM engine is provided it will be removed.
-IF("${ARCH}" MATCHES "arm")
-       INSTALL(FILES ${ETC_DIR}/drm/armv7l/libdrm-service-core-intel.so.0.0.0 DESTINATION lib)
-ELSE("${ARCH}" MATCHES "arm")
-       INSTALL(FILES ${ETC_DIR}/drm/ix86/libdrm-service-core-intel.so.0.0.0 DESTINATION lib)
-ENDIF("${ARCH}" MATCHES "arm")
diff --git a/etc/drm/armv7l/libdrm-service-core-intel.so b/etc/drm/armv7l/libdrm-service-core-intel.so
deleted file mode 120000 (symlink)
index df92fda..0000000
+++ /dev/null
@@ -1 +0,0 @@
-libdrm-service-core-intel.so.0
\ No newline at end of file
diff --git a/etc/drm/armv7l/libdrm-service-core-intel.so.0 b/etc/drm/armv7l/libdrm-service-core-intel.so.0
deleted file mode 120000 (symlink)
index 4af898f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-libdrm-service-core-intel.so.0.0.0
\ No newline at end of file
diff --git a/etc/drm/armv7l/libdrm-service-core-intel.so.0.0.0 b/etc/drm/armv7l/libdrm-service-core-intel.so.0.0.0
deleted file mode 100755 (executable)
index 68b76cf..0000000
Binary files a/etc/drm/armv7l/libdrm-service-core-intel.so.0.0.0 and /dev/null differ
diff --git a/etc/drm/ix86/libdrm-service-core-intel.so b/etc/drm/ix86/libdrm-service-core-intel.so
deleted file mode 120000 (symlink)
index df92fda..0000000
+++ /dev/null
@@ -1 +0,0 @@
-libdrm-service-core-intel.so.0
\ No newline at end of file
diff --git a/etc/drm/ix86/libdrm-service-core-intel.so.0 b/etc/drm/ix86/libdrm-service-core-intel.so.0
deleted file mode 120000 (symlink)
index 4af898f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-libdrm-service-core-intel.so.0.0.0
\ No newline at end of file
diff --git a/etc/drm/ix86/libdrm-service-core-intel.so.0.0.0 b/etc/drm/ix86/libdrm-service-core-intel.so.0.0.0
deleted file mode 100755 (executable)
index d21a059..0000000
Binary files a/etc/drm/ix86/libdrm-service-core-intel.so.0.0.0 and /dev/null differ
index 66c5515..9742d0d 100755 (executable)
@@ -23,8 +23,8 @@ install_widgets() {
        for list in $_wgt_list
        do
                echo "Install $list"
-               return_string=`wrt-installer -i $list`
-        if [ `expr match "$return_string" 'installed'` -gt 0 ]; then
+               return_string=`wrt-installer -il $list`
+        if [ "$return_string" != "${return_string/installed/}" ]; then
             echo "$list widget installation success"
             rm -rf $list
         else
index 4fe6dc8..1e54895 100644 (file)
@@ -1,12 +1,13 @@
-#git:framework/web/wrt-installer wrt-installer 0.0.73
+#git:framework/web/wrt-installer wrt-installer 0.0.89
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.0.73
+Version:    0.0.89
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
 URL:        N/A
 Source0:    %{name}-%{version}.tar.gz
+Source100:  wrt-preinstall-widgets.service
 BuildRequires:  cmake
 BuildRequires:  edje-tools
 BuildRequires:  pkgconfig(libxml-2.0)
@@ -17,9 +18,8 @@ BuildRequires:  pkgconfig(dpl-event-efl)
 BuildRequires:  pkgconfig(dpl-utils-efl)
 BuildRequires:  pkgconfig(dpl-wrt-dao-ro)
 BuildRequires:  pkgconfig(dpl-wrt-dao-rw)
-BuildRequires:  pkgconfig(ecore-x)
-BuildRequires:  pkgconfig(security)
 BuildRequires:  pkgconfig(security-install)
+BuildRequires:  pkgconfig(ecore-x)
 BuildRequires:  pkgconfig(xmlsec1)
 BuildRequires:  pkgconfig(libidn)
 BuildRequires:  pkgconfig(libiri)
@@ -35,11 +35,10 @@ BuildRequires:  pkgconfig(tapi)
 BuildRequires:  pkgconfig(shortcut)
 BuildRequires:  pkgconfig(dpl-encryption)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
-BuildRequires:  pkgconfig(drm-client)
+BuildRequires:  pkgconfig(drm-service-core-intel)
+BuildRequires:  pkgconfig(app2sd)
 Requires: xmlsec1
 
-Provides: libdrm-service-core-intel.so.0
-
 %description
 Description: Wrt Installer for Tizen apps and Wac apps
 
@@ -47,12 +46,6 @@ Description: Wrt Installer for Tizen apps and Wac apps
 %setup -q
 
 %build
-# for drm temporary code
-%ifarch %{ix86}
-BUILD_ARCH_=x86
-%else
-BUILD_ARCH_=arm
-%endif
 
 export LDFLAGS+="-Wl,--rpath=/usr/lib -Wl,--hash-style=both -Wl,--as-needed"
 LDFLAGS="$LDFLAGS"
@@ -60,7 +53,6 @@ LDFLAGS="$LDFLAGS"
 cmake . -DCMAKE_INSTALL_PREFIX=/usr \
         -DDPL_LOG=ON \
         -DCMAKE_PACKAGE_VERSION=%{version} \
-        -DARCH="$BUILD_ARCH_" \
         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}
 make %{?jobs:-j%jobs}
 
@@ -70,6 +62,16 @@ mkdir -p %{buildroot}/usr/share/license
 cp LICENSE %{buildroot}/usr/share/license/%{name}
 %make_install
 
+mkdir -p %{buildroot}%{_libdir}/systemd/user
+install -m 644 %{SOURCE100} %{buildroot}%{_libdir}/systemd/user
+mkdir -p %{buildroot}%{_libdir}/systemd/user/tizen-mobile-session.target.wants
+ln -s ../wrt-preinstall-widgets.service %{buildroot}%{_libdir}/systemd/user/tizen-mobile-session.target.wants
+
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d/
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d/
+ln -s ../init.d/wrt_preinstall_widgets.sh %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh
+ln -s ../init.d/wrt_preinstall_widgets.sh %{buildroot}%{_sysconfdir}/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh
+
 %clean
 rm -rf %{buildroot}
 
@@ -81,18 +83,6 @@ ln -sf /usr/bin/wrt-installer /usr/etc/package-manager/backend/wgt
 
 #for booting recovery
 mkdir -p /opt/share/widget/temp_info
-[ -h /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh ] && rm /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh
-[ -h /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh ] && rm /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh
-ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh
-ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh
-
-# for drm temporary code
-mkdir -p /opt/var/drm/inteldrm
-mkdir -p own 0:5000 /opt/var/drm/inteldrm
-chmod 755 /opt/var/drm/inteldrm
-
-ln -s /usr/lib/libdrm-service-core-intel.so.0.0.0 /usr/lib/libdrm-service-core-intel.so.0
-ln -s /usr/lib/libdrm-service-core-intel.so.0 /usr/lib/libdrm-service-core-intel.so
 
 # for downloadable Application icons path
 mkdir -p /opt/share/icons/default/small
@@ -100,9 +90,11 @@ mkdir -p /opt/share/icons/default/small
 %files
 %manifest wrt-installer.manifest
 %attr(755,root,root) %{_bindir}/wrt-installer
-%attr(775,root,root) %{_initrddir}/wrt_preinstall_widgets.sh
+%attr(775,root,root) %{_initddir}/wrt_preinstall_widgets.sh
+%{_sysconfdir}/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh
+%{_sysconfdir}/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh
 %attr(644,root,root) %{_datadir}/edje/wrt/*
 /usr/etc/package-manager/backendlib/libwgt.so
 %{_datadir}/license/%{name}
-# for drm temporary code
-/usr/lib/*.so*
+%{_libdir}/systemd/user/tizen-mobile-session.target.wants/wrt-preinstall-widgets.service
+%{_libdir}/systemd/user/wrt-preinstall-widgets.service
diff --git a/packaging/wrt-preinstall-widgets.service b/packaging/wrt-preinstall-widgets.service
new file mode 100644 (file)
index 0000000..2bf8181
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=Installation of pre-installed widgets
+ConditionPathExists=/opt/media/Downloads/.preinstallWidgets
+After=xorg.target e17.service
+
+[Service]
+Type=oneshot
+ExecStart=/etc/init.d/wrt_preinstall_widgets.sh
index c9d8e96..6da67e5 100644 (file)
@@ -45,7 +45,6 @@ SET(INSTALLER_INCLUDES
     ${INSTALLER_SRC_DIR}/configuration_parser
     ${INSTALLER_SRC_DIR}/wrt-installer
     ${INSTALLER_SRC_DIR}/commons
-    ${INSTALLER_SRC_DIR}/commons/drm    #this is temporary code for drm
     ${INSTALLER_SRC_DIR}/pkg-manager
 )
 
@@ -66,12 +65,12 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_JOBS}/widget_install/task_unzip.cpp
     ${INSTALLER_JOBS}/widget_install/task_widget_config.cpp
     ${INSTALLER_JOBS}/widget_install/task_database.cpp
+    ${INSTALLER_JOBS}/widget_install/ace_registration.cpp
     ${INSTALLER_JOBS}/widget_install/task_file_manipulation.cpp
     ${INSTALLER_JOBS}/widget_install/task_smack.cpp
     ${INSTALLER_JOBS}/widget_install/task_ace_check.cpp
     ${INSTALLER_JOBS}/widget_install/task_manifest_file.cpp
     ${INSTALLER_JOBS}/widget_install/task_certify.cpp
-    ${INSTALLER_JOBS}/widget_install/task_private_storage.cpp
     ${INSTALLER_JOBS}/widget_install/task_prepare_files.cpp
     ${INSTALLER_JOBS}/widget_install/task_recovery.cpp
     ${INSTALLER_JOBS}/widget_install/task_install_ospsvc.cpp
@@ -96,41 +95,57 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_SRC_DIR}/misc/feature_logic.cpp
     ${INSTALLER_SRC_DIR}/misc/libxml_utils.cpp
     ${INSTALLER_SRC_DIR}/misc/widget_location.cpp
+    ${INSTALLER_SRC_DIR}/misc/widget_install_to_external.cpp
     ${INSTALLER_SRC_DIR}/pkg-manager/pkgmgr_signal.cpp
     )
 
+IF(LB_SUPPORT)
+    SET(INSTALLER_SOURCES
+        ${INSTALLER_SOURCES}
+        )
+    MESSAGE(STATUS "adding definition -DLB_SUPPORT")
+    ADD_DEFINITIONS("-DLB_SUPPORT")
+ENDIF(LB_SUPPORT)
+
 MESSAGE(STATUS "add -DSEP_INSTALLER")
 ADD_DEFINITIONS("-DSEP_INSTALLER")
 
 
 PKG_CHECK_MODULES(INSTALLER_STATIC_DEP
-    libxml-2.0
-    openssl
     dpl-efl
-    cert-svc-vcore
-    security-core
     dpl-event-efl
     dpl-utils-efl
     dpl-wrt-dao-ro
     dpl-wrt-dao-rw
     dpl-encryption
+    wrt-plugins-types
+    pkgmgr-installer
+    pkgmgr-parser
+    REQUIRED
+)
+
+PKG_CHECK_MODULES(SYS_INSTALLER_STATIC_DEP
+    libxml-2.0
+    openssl
+    cert-svc-vcore
     security-install
     ecore-x
     xmlsec1
     libidn
     libiri
     libpcrecpp
-    wrt-plugins-types
     ail
     elementary
-    pkgmgr-installer
-    pkgmgr-parser
     tapi
     shortcut
     capi-appfw-app-manager
-    drm-client
+    drm-service-core-intel
+    app2sd
+    vconf
     REQUIRED
-    )
+)
+
+INCLUDE_DIRECTORIES( SYSTEM ${SYS_INSTALLER_STATIC_DEP_INCLUDE_DIRS})
 
 INCLUDE_DIRECTORIES(
     ${INSTALLER_DEP_INCLUDES}
@@ -144,24 +159,13 @@ ADD_LIBRARY(${TARGET_INSTALLER_STATIC} STATIC
 
 ADD_DEFINITIONS(${INSTALLER_STATIC_DEP_CFLAGS})
 ADD_DEFINITIONS(${INSTALLER_STATIC_DEP_CFLAGS_OTHERS})
+ADD_DEFINITIONS(${SYS_INSTALLER_STATIC_DEP_CFLAGS})
+ADD_DEFINITIONS(${SYS_INSTALLER_STATIC_DEP_CFLAGS_OTHERS})
 
 TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
     ${INSTALLER_STATIC_DEP_LIBRARIES} "-ldl"
+    ${SYS_INSTALLER_STATIC_DEP_LIBRARIES} "-ldl"
     )
 
-
-# Below Code is temporary. When DRM engine is provided it will be removed.
-MESSAGE("ARCH ${ARCH}")
-IF("${ARCH}" MATCHES "arm")
-       TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
-            "-L${PROJECT_SOURCE_DIR}/etc/drm/armv7l -ldrm-service-core-intel" -Wl,--allow-shlib-undefine)
-ELSE("${ARCH}" MATCHES "arm")
-       TARGET_LINK_LIBRARIES(${TARGET_INSTALLER_STATIC}
-            "-L${PROJECT_SOURCE_DIR}/etc/drm/ix86 -ldrm-service-core-intel" -Wl,--allow-shlib-undefine)
-ENDIF("${ARCH}" MATCHES "arm")
-
-SET_TARGET_PROPERTIES(${TARGET_INSTALLER_STATIC} PROPERTIES
-        COMPILE_FLAGS -fPIC)
-
 ADD_SUBDIRECTORY(pkg-manager)
 ADD_SUBDIRECTORY(wrt-installer)
diff --git a/src/commons/drm/CPointerArray.h b/src/commons/drm/CPointerArray.h
deleted file mode 100755 (executable)
index 3e30e79..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-\r
-/********************************************************************************\r
-* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr).                                        *\r
-* All rights reserved.                                                                 * \r
-*                                                                                              * \r
-* No parts of this source code may be in any way copied, reproduced, modified  *\r
-* or distributed without the prior written consent of INKA Entworks, Inc.      *\r
-* CPointerArray.h: interface for the CPointerArray class.                                              *\r
-*********************************************************************************/ \r
-\r
-#ifndef __CPOINTERARRAY_H__\r
-#define __CPOINTERARRAY_H__\r
-\r
-\r
-#if !defined(AFX_CPOINTERARRAY_H__AB67E4BE_A233_4E3E_B257_9830D90326EE__INCLUDED_)\r
-#define AFX_CPOINTERARRAY_H__AB67E4BE_A233_4E3E_B257_9830D90326EE__INCLUDED_\r
-\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-//#include "Shp.h"\r
-#include "InkaTypes.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif /* __cplusplus */\r
-\r
-class CPointerArray  \r
-{\r
-protected:\r
-       LPVOID*                                         m_ppData;\r
-       int                                                     m_nMaxSize;\r
-       int                                                     m_nNumOfData;\r
-\r
-public:\r
-       CPointerArray();\r
-       virtual ~CPointerArray();\r
-\r
-       int                                     Add( LPVOID pData );\r
-       int                                     Remove( int nIndex );\r
-       LPVOID                          Get( int nIndex );\r
-       inline int                      GetCount() { return m_nNumOfData; }\r
-       inline void                     RemoveAll() { m_nNumOfData = 0; }\r
-};\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif  /* __cplusplus */\r
-\r
-#endif // !defined(AFX_CPOINTERARRAY_H__AB67E4BE_A233_4E3E_B257_9830D90326EE__INCLUDED_)\r
-#endif /* __CPOINTERARRAY_H__ */\r
diff --git a/src/commons/drm/CXMLAttribute.h b/src/commons/drm/CXMLAttribute.h
deleted file mode 100755 (executable)
index dda8fe3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-\r
-/********************************************************************************\r
-* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr).                                        *\r
-* All rights reserved.                                                                 * \r
-*                                                                                              * \r
-* No parts of this source code may be in any way copied, reproduced, modified  *\r
-* or distributed without the prior written consent of INKA Entworks, Inc.      *\r
-* CXMLAttribute.h: interface for the CXMLAttribute class.                                              *\r
-*********************************************************************************/ \r
-//#include "Shp.h"\r
-#include "InkaTypes.h"\r
-\r
-#if !defined(AFX_CXMLATTRIBUTE_H__2B925786_3613_47B0_B85D_CAF2053F46DB__INCLUDED_)\r
-#define AFX_CXMLATTRIBUTE_H__2B925786_3613_47B0_B85D_CAF2053F46DB__INCLUDED_\r
-\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-class CXMLAttribute  \r
-{\r
-protected:\r
-       LPTSTR                                                  m_pszName;\r
-       LPTSTR                                                  m_pszValue;\r
-\r
-public:\r
-       CXMLAttribute();\r
-       virtual ~CXMLAttribute();\r
-\r
-       int                                             SetName( LPCTSTR pszName );\r
-       int                                             SetValue( LPCTSTR pszValue );\r
-\r
-       inline LPCTSTR                  GetName() { return m_pszName; }\r
-       inline LPCTSTR                  GetValue() { return m_pszValue; }\r
-};\r
-\r
-#endif // !defined(AFX_CXMLATTRIBUTE_H__2B925786_3613_47B0_B85D_CAF2053F46DB__INCLUDED_)\r
diff --git a/src/commons/drm/CXMLElement.h b/src/commons/drm/CXMLElement.h
deleted file mode 100755 (executable)
index eb74a0c..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-\r
-/********************************************************************************\r
-* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr).                                        *\r
-* All rights reserved.                                                                 * \r
-*                                                                                              * \r
-* No parts of this source code may be in any way copied, reproduced, modified  *\r
-* or distributed without the prior written consent of INKA Entworks, Inc.      *\r
-* CXMLElement.h: interface for the CXMLElement class.                                                  *\r
-*********************************************************************************/ \r
-\r
-#if !defined(AFX_CXMLELEMENT_H__B6A6A39B_1980_4A4F_B68B_E87B53A3EE9B__INCLUDED_)\r
-#define AFX_CXMLELEMENT_H__B6A6A39B_1980_4A4F_B68B_E87B53A3EE9B__INCLUDED_\r
-\r
-//#include "Shp.h"\r
-#include "InkaTypes.h"\r
-#include "CXMLAttribute.h"\r
-#include "CPointerArray.h"\r
-\r
-\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-class CXMLElement  \r
-{\r
-protected:\r
-       LPTSTR                                                  m_pszName;\r
-       LPTSTR                                                  m_pszValue;\r
-       \r
-       CPointerArray                                   m_pChilds;\r
-       CPointerArray                                   m_pAttributes;\r
-       \r
-       int                                             _SearchNodes(  CPointerArray* ppaChildNodes,  CXMLElement* pCurrent,  LPCTSTR pszTagName,  va_list args );\r
-\r
-public:\r
-       CXMLElement();\r
-       virtual ~CXMLElement();\r
-\r
-       int                                     SetName(  LPCTSTR pszName );\r
-       int                                             SetValue(  LPCTSTR pszValue );\r
-       int                                             AddAttribute(  LPCTSTR pszName,  LPCTSTR pszValue );\r
-\r
-       inline LPCTSTR                  GetName() { return m_pszName; }\r
-       inline LPCTSTR                  GetValue() { return m_pszValue; }\r
-\r
-       int                                             AddChild(  CXMLElement* pChild );\r
-       LPCTSTR                                         GetAttribute(  LPCTSTR pszName );\r
-\r
-       inline int                              GetChildCount() { return m_pChilds.GetCount(); }\r
-       inline int                              GetAttributeCount() { return m_pAttributes.GetCount(); }\r
-       inline CXMLElement*             GetChild(  int nIndex ) { return (CXMLElement*)m_pChilds.Get( nIndex ); }\r
-       inline CXMLAttribute*   GetAttribute(  int nIndex ) { return (CXMLAttribute*)m_pAttributes.Get( nIndex ); }\r
-\r
-       int                                                             Find(  CPointerArray* pSearchedChild,  LPCTSTR pszChildName, ... );\r
-};\r
-\r
-#endif // !defined(AFX_CXMLELEMENT_H__B6A6A39B_1980_4A4F_B68B_E87B53A3EE9B__INCLUDED_)\r
diff --git a/src/commons/drm/CXMLFile.h b/src/commons/drm/CXMLFile.h
deleted file mode 100755 (executable)
index 0a3a2e2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-\r
-/********************************************************************************\r
-* Copyright ? 2004-2009 by INKA Entworks, Inc (www.inka.co.kr).                                        *\r
-* All rights reserved.                                                                 * \r
-*                                                                                              * \r
-* No parts of this source code may be in any way copied, reproduced, modified  *\r
-* or distributed without the prior written consent of INKA Entworks, Inc.      *\r
-* CXMLFile.h: interface for the CXMLFile class.                                                                        *\r
-*********************************************************************************/ \r
-\r
-#if !defined(AFX_CXMLFILE_H__21F76587_B9C8_4407_9C16_186F3D47ADE1__INCLUDED_)\r
-#define AFX_CXMLFILE_H__21F76587_B9C8_4407_9C16_186F3D47ADE1__INCLUDED_\r
-\r
-//#include "Shp.h"\r
-#include "InkaTypes.h"\r
-#include "CXMLElement.h"\r
-\r
-#if _MSC_VER > 1000\r
-#pragma once\r
-#endif // _MSC_VER > 1000\r
-\r
-#ifndef IN\r
-       #define IN\r
-#endif\r
-\r
-#ifndef OUT\r
-       #define OUT\r
-#endif\r
-\r
-#define ELEMENT_QUEUE_MAX              2048\r
-class CXMLFile  \r
-{\r
-protected:\r
-       LPCTSTR                                                 m_pszXML;\r
-       CXMLElement*                                    m_paElementQueue[ ELEMENT_QUEUE_MAX ];\r
-       int                                                             m_nQueueIndex;\r
-       CXMLElement*                                    m_pRoot;\r
-       \r
-       int                                     _Parse();\r
-       int                                             _GetElementName(  LPTSTR pszElementName );\r
-       CXMLElement*                            _Pop();\r
-       int                                             _Push( CXMLElement* p );\r
-       int                                             _GetAttributeNameAndValue(  LPTSTR pszName,  LPTSTR pszValue );\r
-\r
-public:\r
-       CXMLFile();\r
-       virtual ~CXMLFile();\r
-\r
-       int                                             LoadFromStream(  LPCTSTR pszXML );\r
-       int                                             LoadFromFile(  LPCTSTR pszFileName );\r
-       inline CXMLElement*             GetRoot() { return m_pRoot; }\r
-};\r
-\r
-#endif // !defined(AFX_CXMLFILE_H__21F76587_B9C8_4407_9C16_186F3D47ADE1__INCLUDED_)\r
diff --git a/src/commons/drm/InkaTypes.h b/src/commons/drm/InkaTypes.h
deleted file mode 100755 (executable)
index d7a9291..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*\r
- * SHP\r
- * Copyright (c) 2000-2007 UMTS Software Lab, Mobile Communication Division,\r
- * Telecommunication Network Business, Samsung Electronics, Inc.\r
- * All rights reserved.\r
- *\r
- * This software is the confidential and proprietary information\r
- * of Samsung Electronics, Inc. ("Confidential Information").  You\r
- * shall not disclose such Confidential Information and shall use\r
- * it only in accordance with the terms of the license agreement\r
- * you entered into with Samsung Electronics. \r
- */\r
-\r
-/** \r
- * @file       InkaTypes.h\r
- * @brief      This file includes definitions of constants, \r
- *                     enumerations, and datastructures for the Inka DRM service.\r
-# @author              Jihyun Lee(ezhyun.lee@samsung.com)\r
-# @author              Donghyun Yoo(marku.yoo@samsung.com)\r
- * @version    1.0\r
- */\r
-\r
-#ifndef INKA_DRM_TYPES_H\r
-#define INKA_DRM_TYPES_H\r
-\r
-//#include "shp.h"\r
-//#include "FileMgr.h"\r
-#include <stdio.h>\r
-#include <stdarg.h>\r
-\r
-#define _T\r
-#define        IF_ERROR_GOTO( error )  if( FAILED( HRESULT_FROM_WIN32( error ) ) ) { nResult = ERRORMSG( error, NULL ); goto finish; }\r
-#define        IF_TRUE_GOTO( cond, error )     if( cond ) { nResult = -1; goto finish; }\r
-\r
-#if defined(_WIN32) || defined(_WIN64) \r
-  #define snprintf _snprintf \r
-  #define vsnprintf _vsnprintf \r
-  #define strcasecmp _stricmp \r
-  #define strncasecmp _strnicmp \r
-#endif\r
-\r
-#ifndef _SHP_SIMUL\r
-typedef void* LPVOID;\r
-typedef const char* LPCTSTR;\r
-typedef unsigned char* LPBYTE;\r
-typedef char TCHAR;\r
-typedef char* LPTSTR;\r
-typedef LPTSTR LPSTR;\r
-typedef LPCTSTR LPCTSTR;\r
-typedef LPCTSTR LPCSTR;\r
-\r
-#define        DWORD           unsigned long\r
-#define        LPBYTE          unsigned char*\r
-#define BYTE           unsigned char\r
-#define UINT           unsigned int\r
-#define ULONG          unsigned long\r
-#define INT32          long\r
-#define INT64          long long\r
-#define TRUE           1\r
-#define FALSE          0\r
-\r
-\r
-typedef char CHAR;\r
-typedef bool BOOL;\r
-\r
-\r
-//typedef HFile HANDLE;\r
-#define ERROR_INVALID_DATA               13L\r
-#define ERROR_INSUFFICIENT_BUFFER        122L    // dderror\r
-//#define CopyMemory AcMemcpy\r
-#define INVALID_HOBJ   NULL\r
-\r
-#endif\r
-\r
-\r
-#endif //INKA_DRM_TYPES_H\r
diff --git a/src/commons/drm/IntelDrm_Core.h b/src/commons/drm/IntelDrm_Core.h
deleted file mode 100755 (executable)
index b8b4b48..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-//typedef      char    CHAR;\r
-//typedef      bool    BOOL;\r
-\r
-typedef struct t_cek\r
-{\r
-       char    *CID;                                   // Content ID ¹öÆÛ Æ÷ÀÎÅÍ\r
-       char    *CEK;                                   // Content Encryption Key ¹öÆÛ Æ÷ÀÎÅÍ\r
-       char    *EncryptionMethod;              // CEK ¾Ë°í¸®Áò\r
-}T_CEK;\r
-\r
-typedef struct t_dro\r
-{\r
-       char                    *CID;                                   // Content ID ¹öÆÛ Æ÷ÀÎÅÍ\r
-       char                    *deviceId;                              // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
-       char                    *digestValue;                           // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
-       char                    *signedValue;                           // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
-       char                    *cert;                          // »ç¿ëÀÚ ½Äº° ¹ÙÀεù. IMEI, MIN °ª ¹ÙÀεù Á¦¾î\r
-       int                             Count;                                  // »ç¿ë È¸¼ö\r
-       char                    *CreatedTimestamp;              // »ç¿ë °¡´É ½ÃÀÛ ÀϽà¹öÆÛ Æ÷ÀÎÅÍ. GMT Ç¥±â\r
-       char                    *ExpiredTimeStamp;              // »ç¿ë °¡´É ¸¸±â ÀϽà¹öÆÛ Æ÷ÀÎÅÍ. GMT Ç¥±â\r
-       char                    *ExpirationDate;                // ÃÖÃÊ »ç¿ë ÀÌÈÄ »ç¿ë °¡´É ½Ã°£.  ½Ã°£ ´ÜÀ§    \r
-}T_DRO;\r
-\r
-typedef struct t_dcf_file_header\r
-{\r
-       unsigned char   Version;\r
-       unsigned char   ContentTypeLen;\r
-       unsigned char   ContentURILen;\r
-       char                    *ContentType;\r
-       char                    *ContentURI;\r
-       unsigned int    HeadersLen;\r
-       unsigned int    DataLen;\r
-       char                    *Headers;\r
-       unsigned int    DataOffset;\r
-}T_DCF_FILE_HEADER;\r
-\r
-// DRO Value size\r
-#define                APPID_SIZE                              16\r
-#define                CEK_SIZE                                512\r
-#define                ENCRYPTION_METHOD_SIZE  512\r
-#define                DEVICEID_SIZE                   256\r
-#define                TIMESTAMP_SIZE                  256\r
-#define                DIGESTVALUE_SIZE                256\r
-#define                SIGNATUREVALUE_SIZE             1024\r
-#define                CERT_SIZE                               1024 * 4\r
-#define                AES_BLOCK_SIZE                  16\r
diff --git a/src/commons/drm/drm-intel-crypto-util.h b/src/commons/drm/drm-intel-crypto-util.h
deleted file mode 100755 (executable)
index eacb1e5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "InkaTypes.h"\r
-//#include "IntelDrm_Core.h"\r
-\r
-#include "stdlib.h"\r
-#include "string.h"\r
-#include "stdio.h"\r
-\r
-#define AES_BLOCK_SIZE 16\r
-\r
-LPSTR Base64Encode(LPBYTE pbData, int nLength);\r
-LPBYTE Base64Decode(LPCSTR pszString, int* pnLength);\r
-\r
-int decrypt_block(unsigned char *iv, unsigned char *cipherText, int cipherTextLen,  unsigned char *cek, int cekLen, unsigned char *plainText);\r
diff --git a/src/commons/drm/drm-intel-util.h b/src/commons/drm/drm-intel-util.h
deleted file mode 100755 (executable)
index 08bb2cd..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "CPointerArray.h"\r
-#include "CXMLAttribute.h"\r
-#include "CXMLElement.h"\r
-#include "CXMLFile.h"\r
-#include "InkaTypes.h"\r
-#include "IntelDrm_Core.h"\r
-#include "drm-intel-crypto-util.h"\r
-\r
-#include "stdlib.h"\r
-#include "string.h"\r
-#include "stdio.h"\r
-\r
-/**   \r
- *  An application can parse CEK XML Foramt.\r
- * \r
- * @param[in]          pszXML          Data String of the CEK information\r
- * @param[out]         t_cek           parsing result to be saved\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int parse_intel_cek(const char* pszXML, T_CEK* t_cek);\r
-\r
-/**   \r
- *  An application can parse DRO XML Foramt.\r
- * \r
- * @param[in]          pszXML          Data String of the DRO information\r
- * @param[out]         t_cek           parsing result to be saved\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int parse_intel_dro(const char* pszXML, T_DRO* t_RO);\r
-\r
-int parse_intel_dro2(const char* pszXML, T_DRO* t_RO);\r
-\r
-/**   \r
- *  An application can parse stored dro.\r
- * \r
- * @param[in]          pFilepath               file path of the internal dro\r
- * @param[out]         t_ro                    parsing result to be saved\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int get_internal_dro(char *pFilepath, T_DRO* t_ro);\r
-\r
-/**   \r
- *  An application can parse stored cek.\r
- * \r
- * @param[in]          pFilepath               file path of the internal cek\r
- * @param[out]         t_cek                   parsing result to be saved\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int get_internal_cek(char *pFilepath, T_CEK* t_cek);\r
-\r
-int delete_internal_cek(char *pAppId);\r
-\r
-int get_dcf_header_info(char *pFilePath, T_DCF_FILE_HEADER *pTdcfHeader);\r
-\r
-bool get_Uintvar(unsigned int *nValue, FILE *pFile);\r
-\r
-int decrypt_package(char *pDcfPath, char *pDecryptedFilePath, unsigned char *pCEK, int cekLen, T_DCF_FILE_HEADER *t_dcf_header);\r
diff --git a/src/commons/drm/drm-oem-intel.h b/src/commons/drm/drm-oem-intel.h
deleted file mode 100755 (executable)
index 80a9bb2..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*\r
- *  drm-intel\r
- *\r
- * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: Sunggun Jung       <sunggun.jung@samsung.com>\r
- * \r
- * This library is free software; you can redistribute it and/or modify it under\r
- * the terms of the GNU Lesser General Public License as published by the\r
- * Free Software Foundation; either version 2.1 of the License, or (at your option)\r
- * any later version.\r
- * \r
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY\r
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
- * License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public License\r
- * along with this library; if not, write to the Free Software Foundation, Inc., 51\r
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\r
- *\r
- */\r
-\r
-/**\r
-* @internal\r
-* @defgroup DRM-INTEL drm-intel\r
-* @{  \r
-*/\r
-#include "drm-intel-util.h"\r
-//#include "drm-intel-crypto-util.h"\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-\r
-/**   \r
- *  An application can install Intel DRM license(DRO).\r
- * \r
- * @param[in]          pDroXML         Data String of the Rights Request\r
- * @param[in]          droBufLen       pDroXML Length\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int drm_oem_intel_install_license(char *pDroXML, int droBufLen);\r
-\r
-/**   \r
- *  An application can uninstall Intel DRM license(DRO).\r
- * \r
- * @param[in]          pAppId          App-id of the rigths which want to un-install\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int drm_oem_intel_uninstall_license(char *pAppId);\r
-\r
-/**   \r
- *  An application can install CEK(Contents Encryption Key).\r
- * \r
- * @param[in]          pCekXML         Data String of the Rights Request\r
- * @param[in]          cekBufLen       pDroXML Length\r
- * @return                     This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int drm_oem_intel_install_cek(char *pCekXML, int cekBufLen);\r
-\r
-/**   \r
- *  An application can get decrypted contents(Apps) which is encrypted\r
- * \r
- * @param[in]  pDcfPath                Intel DRM Package File Path             \r
- * @param[in]  pDecryptedFile  Decrypted File Path\r
- * @return             This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see\r
- * @since\r
- */\r
-int drm_oem_intel_decrypt_package(char *pDcfPath, char *pDecryptedFile);\r
-\r
-/**   \r
- *  An application can get informations of rights (DRO).\r
- * \r
- * @param[in]          pAppId          App-id of the rights which want to know\r
- * @param[out]         pDro            The rights information about the app-id\r
- * @return  This function can return any of the following codes\r
- * DRM_INTEL_SUCCESS = 0        <success \r
- * DRM_INTEL_LIC_VALID = 1      <License is valid \r
- * DRM_INTEL_LIC_SUSPEND = 2    <License is valid but for future use \r
- * DRM_INTEL_INVALID_ARG = -1000   <invalid argument\r
- * DRM_INTEL_PARSING_ERROR = -999      <parsing contents or rights error\r
- * DRM_INTEL_DB_ERROR = -998        <data base error \r
- * DRM_INTEL_INSUFFICIENT_MEMORY = -997      <memory error \r
- * DRM_INTEL_INTERNAL_ERROR = -996     <processing error\r
- * DRM_INTEL_FILE_ERROR = -995       <file error\r
- * DRM_INTEL_LIC_EXPIRED_DATETIME = -994    <Datetime License is expired\r
- * DRM_INTEL_LIC_EXPIRED_COUNT = -993    <Count License is expired \r
- * DRM_INTEL_LIC_NO_LICENCE = -992      <No License\r
- * DRM_INTEL_LIC_IMEI_MISMATCH = -991    <IMEI is mismatching \r
- * DRM_INTEL_LIC_PNUM_MISMATCH = -990    <PNUM is mismatching \r
- * DRM_INTEL_UNKNOWN_ERROR = -1    <dummy error value\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int drm_oem_intel_getLicenseInfo(char *pAppId, T_DRO *pDro);\r
-\r
-/**   \r
- *  An application can get informations of rights (DRO).\r
- * \r
- * @param[in]          pAppId          App-id of the rights which want to know\r
- * @return  This function can return any of the following codes\r
- * DRM_INTEL_SUCCESS = 0        <success \r
- * DRM_INTEL_LIC_VALID = 1      <License is valid \r
- * DRM_INTEL_LIC_SUSPEND = 2    <License is valid but for future use \r
- * DRM_INTEL_INVALID_ARG = -1000   <invalid argument\r
- * DRM_INTEL_PARSING_ERROR = -999      <parsing contents or rights error\r
- * DRM_INTEL_DB_ERROR = -998        <data base error \r
- * DRM_INTEL_INSUFFICIENT_MEMORY = -997      <memory error \r
- * DRM_INTEL_INTERNAL_ERROR = -996     <processing error\r
- * DRM_INTEL_FILE_ERROR = -995       <file error\r
- * DRM_INTEL_LIC_EXPIRED_DATETIME = -994    <Datetime License is expired\r
- * DRM_INTEL_LIC_EXPIRED_COUNT = -993    <Count License is expired \r
- * DRM_INTEL_LIC_NO_LICENCE = -992      <No License\r
- * DRM_INTEL_LIC_IMEI_MISMATCH = -991    <IMEI is mismatching \r
- * DRM_INTEL_LIC_PNUM_MISMATCH = -990    <PNUM is mismatching \r
- * DRM_INTEL_UNKNOWN_ERROR = -1    <dummy error value \r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int drm_oem_intel_consume_license(char *pAppID);\r
-\r
-/**   \r
- *  An application can veify the app's rights.\r
- * \r
- * @param[in]          pAppId          App-id of the rights which want to know\r
- * @return     This function can return any of the following codes\r
- * DRM_INTEL_SUCCESS = 0                <success \r
- * DRM_INTEL_LIC_VALID = 1      <License is valid \r
- * DRM_INTEL_LIC_SUSPEND = 2    <License is valid but for future use \r
- * DRM_INTEL_INVALID_ARG = -1000       <invalid argument\r
- * DRM_INTEL_PARSING_ERROR = -999              <parsing contents or rights error\r
- * DRM_INTEL_DB_ERROR = -998            <data base error \r
- * DRM_INTEL_INSUFFICIENT_MEMORY = -997          <memory error \r
- * DRM_INTEL_INTERNAL_ERROR = -996     <processing error\r
- * DRM_INTEL_FILE_ERROR = -995           <file error\r
- * DRM_INTEL_LIC_EXPIRED_DATETIME = -994        <Datetime License is expired\r
- * DRM_INTEL_LIC_EXPIRED_COUNT = -993    <Count License is expired \r
- * DRM_INTEL_LIC_NO_LICENCE = -992      <No License\r
- * DRM_INTEL_LIC_IMEI_MISMATCH = -991    <IMEI is mismatching \r
- * DRM_INTEL_LIC_PNUM_MISMATCH = -990    <PNUM is mismatching \r
- * DRM_INTEL_UNKNOWN_ERROR = -1        <dummy error value \r
-\r
- * @remarks     \r
- * @see                \r
- * @since         \r
- */\r
-int drm_oem_intel_has_valid_license(char *pAppID);\r
-\r
-/**   \r
- *  An application can check the file is drm enabled or not\r
- * \r
- * @param[in]  pDcfPath                The file path which want to check               \r
-  * @return            This function returns 1 on success or 0 on failure.\r
- * @remarks     \r
- * @see\r
- * @since\r
- */\r
-int drm_oem_intel_isDrmFile(char *pDcfPath);\r
index 49b3100..4fe586f 100644 (file)
@@ -38,4 +38,12 @@ typedef WrtDB::DbWidgetSize WidgetSize;
 
 typedef WrtDB::DbPluginHandle PluginHandle;
 
+enum InstallLocationType
+{
+    INSTALL_LOCATION_TYPE_UNKNOWN = 0,
+    INSTALL_LOCATION_TYPE_NOMAL,
+    INSTALL_LOCATION_TYPE_PRELOAD,
+    INSTALL_LOCATION_TYPE_EXTERNAL
+};
+
 #endif /* PLUGIN_COMMON_TYPES_H */
index 0875ad2..f33004c 100755 (executable)
@@ -943,54 +943,6 @@ class PreferenceParser : public ElementParser
     ConfigParserData& m_data;
 };
 
-class FlashParser : public ElementParser
-{
-  public:
-    virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
-            const DPL::String& /*name*/)
-    {
-        return &IgnoringParser::Create;
-    }
-
-    virtual void Accept(const XmlAttribute& attribute)
-    {
-        if (attribute.name == L"needed") {
-            if (attribute.value == L"true") {
-                m_flashNeeded = true;
-            } else {
-                m_flashNeeded = false;
-            }
-        }
-    }
-
-    virtual void Accept(const Element& /*element*/)
-    {
-        //if empty flash element will be passed, we say true
-        m_data.flashNeeded = true;
-    }
-
-    virtual void Accept(const Text& /*text*/)
-    {
-        ThrowMsg(Exception::ParseError, "flash element must be empty");
-    }
-
-    virtual void Verify()
-    {
-        m_data.flashNeeded = m_flashNeeded;
-    }
-
-    FlashParser(ConfigParserData& data) :
-        ElementParser(),
-        m_flashNeeded(false),
-        m_data(data)
-    {
-    }
-
-  private:
-    bool m_flashNeeded;
-    ConfigParserData& m_data;
-};
-
 class LinkParser : public ElementParser
 {
   public:
@@ -1108,7 +1060,7 @@ class SettingParser : public ElementParser
     ConfigParserData::Setting m_setting;
 };
 
-class ServiceParser : public ElementParser
+class AppControlParser : public ElementParser
 {
   public:
     virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
@@ -1194,7 +1146,7 @@ class ServiceParser : public ElementParser
         m_data.appServiceList.push_back(serviceInfo);
     }
 
-    ServiceParser(ConfigParserData& data) :
+    AppControlParser(ConfigParserData& data) :
         ElementParser(),
         m_src(DPL::OptionalString::Null),
         m_operation(DPL::OptionalString::Null),
@@ -1383,6 +1335,494 @@ class BackgroundParser : public ElementParser
     ConfigParserData& m_data;
 };
 
+class PrivilegeParser : public ElementParser
+{
+  public:
+    virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+            const DPL::String& name)
+    {
+        return &IgnoringParser::Create;
+    }
+
+    virtual void Accept(const Text& /*text*/)
+    {
+    }
+
+    virtual void Accept(const Element& element)
+    {
+        if (element.ns ==
+            ConfigurationNamespace::TizenWebAppNamespaceName)
+        {
+            m_properNamespace = true;
+        }
+        LogDebug("element");
+    }
+
+    virtual void Accept(const XmlAttribute& attribute)
+    {
+        if (m_properNamespace) {
+            if (attribute.name == L"name") {
+                m_feature.name = attribute.value;
+                m_privilege.name = attribute.value;
+            }
+        }
+        m_feature.required = true;
+    }
+
+    virtual void Verify()
+    {
+        LibIri::Wrapper iri(DPL::ToUTF8String(m_feature.name).c_str());
+
+        if (m_feature.name != L"") {
+            if (iri.Validate()) {
+                if (m_data.featuresList.find(m_feature) ==
+                    m_data.featuresList.end()) {
+                    m_data.featuresList.insert(m_feature);
+                } else {
+                    LogDebug("Ignoring feature with name" <<
+                             DPL::ToUTF8String(m_feature.name));
+                }
+            }
+        }
+
+        LibIri::Wrapper iriPrivilege(
+            DPL::ToUTF8String(m_privilege.name).c_str());
+
+        if (m_privilege.name != L"") {
+            if (iriPrivilege.Validate()) {
+                if (m_data.privilegeList.find(m_privilege) ==
+                    m_data.privilegeList.end()) {
+                    m_data.privilegeList.insert(m_privilege);
+                } else {
+                    LogDebug("Ignoring privilege with name" <<
+                             DPL::ToUTF8String(m_privilege.name));
+                }
+            }
+        }
+    }
+
+    PrivilegeParser(ConfigParserData& data) :
+        ElementParser(),
+        m_data(data),
+        m_feature(L""),
+        m_privilege(L""),
+        m_properNamespace(false)
+    {
+    }
+
+  private:
+    ConfigParserData& m_data;
+    ConfigParserData::Feature m_feature;
+    ConfigParserData::Privilege m_privilege;
+    bool m_properNamespace;
+};
+
+class CategoryParser : public ElementParser
+{
+  public:
+    virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                                        const DPL::String& /*name*/)
+    {
+        return &IgnoringParser::Create;
+    }
+
+    virtual void Accept(const XmlAttribute& attribute)
+    {
+        if (attribute.name == L"name") {
+            if (attribute.value.size() > 0) {
+                m_name = attribute.value;
+            }
+        }
+    }
+
+    virtual void Accept(const Element& /*element*/)
+    {
+    }
+
+    virtual void Accept(const Text& /*text*/)
+    {
+    }
+
+    virtual void Verify()
+    {
+        if (m_name.IsNull()) {
+            LogWarning("name attribute of category element is mandatory - ignoring");
+            return;
+        }
+
+        if (m_data.categoryList.find(*m_name) ==
+            m_data.categoryList.end()) {
+            m_data.categoryList.insert(*m_name);
+        }
+    }
+
+    explicit CategoryParser(ConfigParserData& data) :
+        m_data(data)
+    {
+    }
+
+  private:
+    DPL::OptionalString m_name;
+    ConfigParserData& m_data;
+};
+
+class LiveboxParser : public ElementParser
+{
+    public:
+
+    struct BoxLabelParser : public ElementParser
+    {
+        virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                const DPL::String& /*name*/)
+        {
+            return &IgnoringParser::Create;
+        }
+
+        virtual void Accept(const XmlAttribute& attribute)
+        {
+        }
+
+        virtual void Accept(const Element& element)
+        {
+            if (element.ns ==
+                    ConfigurationNamespace::TizenWebAppNamespaceName)
+            {
+                m_properNamespace = true;
+            }
+        }
+
+        virtual void Accept(const Text& text)
+        {
+            if(m_properNamespace)
+                m_label = text.value;
+        }
+
+        virtual void Verify()
+        {
+            m_data.m_label = m_label;
+        }
+
+        BoxLabelParser(ConfigParserData::LiveboxInfo& data) :
+            ElementParser(),
+            m_properNamespace(false),
+            m_data(data)
+        {
+        }
+
+        private:
+        DPL::String m_label;
+        bool m_properNamespace;
+        ConfigParserData::LiveboxInfo& m_data;
+    };
+
+    struct BoxIconParser : public ElementParser
+    {
+        virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                const DPL::String& /*name*/)
+        {
+            return &IgnoringParser::Create;
+        }
+
+        virtual void Accept(const XmlAttribute& attribute)
+        {
+            if(m_properNamespace) {
+                if (attribute.name == L"src") {
+                    m_icon = attribute.value;
+                }
+            }
+        }
+
+        virtual void Accept(const Element& element)
+        {
+            if (element.ns ==
+                    ConfigurationNamespace::TizenWebAppNamespaceName)
+            {
+                m_properNamespace = true;
+            }
+        }
+
+        virtual void Accept(const Text& /*text*/)
+        {
+        }
+
+        virtual void Verify()
+        {
+            m_data.m_icon = m_icon;
+        }
+
+        explicit BoxIconParser(ConfigParserData::LiveboxInfo& data) :
+            ElementParser(),
+            m_properNamespace(false),
+            m_data(data)
+        {
+        }
+
+        private:
+        DPL::String m_icon;
+        bool m_properNamespace;
+        ConfigParserData::LiveboxInfo& m_data;
+    };
+
+    struct BoxContentParser : public ElementParser
+    {
+        struct BoxSizeParser : public ElementParser
+        {
+            virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                    const DPL::String& /*name*/)
+            {
+                return &IgnoringParser::Create;
+            }
+
+            virtual void Accept(const XmlAttribute& attribute)
+            {
+                if(m_properNamespace) {
+                    if (attribute.name == L"preview") {
+                        m_preview = attribute.value;
+                    }
+                }
+            }
+
+            virtual void Accept(const Element& element)
+            {
+                if (element.ns ==
+                        ConfigurationNamespace::TizenWebAppNamespaceName)
+                {
+                    m_properNamespace = true;
+                }
+            }
+
+            virtual void Accept(const Text& text)
+            {
+                if(m_properNamespace)
+                    m_size = text.value;
+            }
+
+            virtual void Verify()
+            {
+                std::pair<DPL::String, DPL::String> boxSize;
+                boxSize.first = m_size;
+                boxSize.second = m_preview;
+                m_data.m_boxSize.push_back(boxSize);
+            }
+
+            explicit BoxSizeParser(ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
+                ElementParser(),
+                m_data(data)
+            {
+            }
+
+            private:
+            DPL::String m_size;
+            DPL::String m_preview;
+            bool m_properNamespace;
+            ConfigParserData::LiveboxInfo::BoxContentInfo& m_data;
+        };
+
+        struct PdParser : public ElementParser
+        {
+            virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                    const DPL::String& name)
+            {
+                return &IgnoringParser::Create;
+            }
+
+            virtual void Accept(const XmlAttribute& attribute)
+            {
+                if(m_properNamespace) {
+                    if (attribute.name == L"src") {
+                        m_src = attribute.value;
+                    } else if (attribute.name == L"width") {
+                        m_width = attribute.value;
+                    } else if (attribute.name == L"height") {
+                        m_height = attribute.value;
+                    }
+                }
+            }
+
+            virtual void Accept(const Element& element)
+            {
+                if (element.ns ==
+                        ConfigurationNamespace::TizenWebAppNamespaceName)
+                {
+                    m_properNamespace = true;
+                }
+            }
+
+            virtual void Accept(const Text& /*text*/)
+            {
+            }
+
+            virtual void Verify()
+            {
+                m_data.m_pdSrc = m_src;
+                m_data.m_pdWidth = m_width;
+                m_data.m_pdHeight = m_height;
+            }
+
+            explicit PdParser(ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
+                ElementParser(),
+                m_properNamespace(false),
+                m_data(data)
+            {
+            }
+
+            private:
+            DPL::String m_src;
+            DPL::String m_width;
+            DPL::String m_height;
+
+            bool m_properNamespace;
+            ConfigParserData::LiveboxInfo::BoxContentInfo& m_data;
+        };
+
+        virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+                const DPL::String& name)
+        {
+            if (name == L"box-size") {
+                return DPL::MakeDelegate(this, &LiveboxParser::BoxContentParser::OnBoxSizeElement);
+            } else if (name == L"pd") {
+                return DPL::MakeDelegate(this, &LiveboxParser::BoxContentParser::OnPdElement);
+            } else{
+                ThrowMsg(Exception::ParseError, "No element parser for name: " << name);
+            }
+        }
+
+        virtual void Accept(const XmlAttribute& attribute)
+        {
+            if (m_properNamespace) {
+                if (attribute.name == L"src")
+                    m_box.m_boxSrc = attribute.value;
+            }
+        }
+
+        virtual void Accept(const Element& element)
+        {
+            if (element.ns ==
+                    ConfigurationNamespace::TizenWebAppNamespaceName)
+            {
+                m_properNamespace = true;
+            }
+        }
+
+        virtual void Accept(const Text& /*text*/)
+        {
+        }
+
+        virtual void Verify()
+        {
+            m_data.m_boxInfo = m_box;
+        }
+
+        explicit BoxContentParser(ConfigParserData::LiveboxInfo& data) :
+            ElementParser(),
+            m_properNamespace(false),
+            m_data(data)
+        {
+        }
+
+        ElementParserPtr OnBoxSizeElement()
+        {
+            return ElementParserPtr(new BoxSizeParser(m_box));
+        }
+
+        ElementParserPtr OnPdElement()
+        {
+            return ElementParserPtr(new PdParser(m_box));
+        }
+
+        private:
+        DPL::String m_src;
+        bool m_properNamespace;
+        ConfigParserData::LiveboxInfo& m_data;
+        ConfigParserData::LiveboxInfo::BoxContentInfo m_box;
+    };
+
+    virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+            const DPL::String& name)
+    {
+        if (name == L"box-label") {
+            return DPL::MakeDelegate(this, &LiveboxParser::OnBoxLabelElement);
+        } else if (name == L"box-icon") {
+            return DPL::MakeDelegate(this, &LiveboxParser::OnBoxIconElement);
+        }  else if (name == L"box-content") {
+            return DPL::MakeDelegate(this, &LiveboxParser::OnBoxContentElement);
+        } else {
+            return &IgnoringParser::Create;
+        }
+    }
+
+    virtual void Accept(const XmlAttribute& attribute)
+    {
+        if (m_properNamespace) {
+            if (attribute.name == L"id") {
+                m_liveboxId = attribute.value;
+            } else if (attribute.name == L"primary") {
+                m_primary = attribute.value;
+            } else if (attribute.name == L"auto-launch") {
+                m_autoLaunch = attribute.value;
+            } else if (attribute.name == L"update-period") {
+                m_updatePeriod = attribute.value;
+            }
+        }
+    }
+
+    virtual void Accept(const Element& element)
+    {
+        if (element.ns ==
+                ConfigurationNamespace::TizenWebAppNamespaceName)
+        {
+            m_properNamespace = true;
+        }
+    }
+
+    virtual void Accept(const Text& /*text*/)
+    {
+    }
+
+    virtual void Verify()
+    {
+        m_livebox.m_liveboxId = m_liveboxId;
+        m_livebox.m_primary = m_primary;
+        m_livebox.m_autoLaunch = m_autoLaunch;
+        m_livebox.m_updatePeriod = m_updatePeriod;
+
+        m_data.m_livebox.push_back(m_livebox);
+    }
+
+    explicit LiveboxParser(ConfigParserData& data) :
+        ElementParser(),
+        m_data(data),
+        m_properNamespace(false)
+    {
+        m_livebox = ConfigParserData::LiveboxInfo();
+    }
+
+    ElementParserPtr OnBoxLabelElement()
+    {
+        return ElementParserPtr(new BoxLabelParser(m_livebox));
+    }
+
+    ElementParserPtr OnBoxIconElement()
+    {
+        return ElementParserPtr(new BoxIconParser(m_livebox));
+    }
+
+    ElementParserPtr OnBoxContentElement()
+    {
+        return ElementParserPtr(new BoxContentParser(m_livebox));
+    }
+
+  private:
+    ConfigParserData& m_data;
+    ConfigParserData::LiveboxInfo m_livebox;
+    DPL::String m_liveboxId;
+    DPL::String m_primary;
+    DPL::String m_autoLaunch;
+    DPL::String m_updatePeriod;
+    bool m_properNamespace;
+
+};
+
 ElementParser::ActionFunc WidgetParser::GetElementParser(const DPL::String& /*ns*/,
         const DPL::String& name)
 {
@@ -1412,14 +1852,21 @@ WidgetParser::WidgetParser(ConfigParserData& data) :
         DPL::MakeDelegate(this, &WidgetParser::OnFeatureElement);
     m_map[L"preference"] =
         DPL::MakeDelegate(this, &WidgetParser::OnPreferenceElement);
-    m_map[L"flash"] = DPL::MakeDelegate(this, &WidgetParser::OnFlashElement);
     m_map[L"link"] = DPL::MakeDelegate(this, &WidgetParser::OnLinkElement);
     m_map[L"setting"] =
         DPL::MakeDelegate(this, &WidgetParser::OnSettingElement);
-    m_map[L"appservice"] = DPL::MakeDelegate(this, &WidgetParser::OnServiceElement);
+    // TODO: appservice will be removed
+    m_map[L"appservice"] = DPL::MakeDelegate(this, &WidgetParser::OnAppControlElement);
     m_map[L"application"] = DPL::MakeDelegate(this, &WidgetParser::OnApplicationElement);
     m_map[L"splash"] = DPL::MakeDelegate(this, &WidgetParser::OnSplashElement);
     m_map[L"background"] = DPL::MakeDelegate(this, &WidgetParser::OnBackgroundElement);
+    m_map[L"privilege"] = DPL::MakeDelegate(this, &WidgetParser::OnPrivilegeElement);
+    m_map[L"appcontrol"] = DPL::MakeDelegate(this,
+            &WidgetParser::OnAppControlElement);
+    m_map[L"category"] = DPL::MakeDelegate(this,
+            &WidgetParser::OnCategoryElement);
+    m_map[L"livebox"] = DPL::MakeDelegate(this, &WidgetParser::OnLiveboxElement);
+
 }
 
 ElementParserPtr WidgetParser::OnNameElement()
@@ -1467,11 +1914,6 @@ ElementParserPtr WidgetParser::OnPreferenceElement()
     return ElementParserPtr(new PreferenceParser(m_data));
 }
 
-ElementParserPtr WidgetParser::OnFlashElement()
-{
-    return ElementParserPtr(new FlashParser(m_data));
-}
-
 ElementParserPtr WidgetParser::OnLinkElement()
 {
     return ElementParserPtr(new LinkParser(m_data));
@@ -1482,11 +1924,6 @@ ElementParserPtr WidgetParser::OnSettingElement()
     return ElementParserPtr(new SettingParser(m_data));
 }
 
-ElementParserPtr WidgetParser::OnServiceElement()
-{
-    return ElementParserPtr(new ServiceParser(m_data));
-}
-
 ElementParserPtr WidgetParser::OnApplicationElement()
 {
     return ElementParserPtr(new ApplicationParser(m_data));
@@ -1502,6 +1939,26 @@ ElementParserPtr WidgetParser::OnBackgroundElement()
     return ElementParserPtr(new BackgroundParser(m_data));
 }
 
+ElementParserPtr WidgetParser::OnPrivilegeElement()
+{
+    return ElementParserPtr(new PrivilegeParser(m_data));
+}
+
+ElementParserPtr WidgetParser::OnAppControlElement()
+{
+    return ElementParserPtr(new AppControlParser(m_data));
+}
+
+ElementParserPtr WidgetParser::OnCategoryElement()
+{
+    return ElementParserPtr(new CategoryParser(m_data));
+}
+
+ElementParserPtr WidgetParser::OnLiveboxElement()
+{
+    return ElementParserPtr(new LiveboxParser(m_data));
+}
+
 void WidgetParser::Accept(const Element& element)
 {
     if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&
index 6ea2ffb..7670388 100755 (executable)
@@ -73,13 +73,15 @@ class WidgetParser : public ElementParser
     ElementParserPtr OnFeatureElement();
     ElementParserPtr OnPreferenceElement();
     ElementParserPtr OnAccessElement();
-    ElementParserPtr OnFlashElement();
     ElementParserPtr OnLinkElement();
     ElementParserPtr OnSettingElement();
-    ElementParserPtr OnServiceElement();
     ElementParserPtr OnApplicationElement();
     ElementParserPtr OnSplashElement();
     ElementParserPtr OnBackgroundElement();
+    ElementParserPtr OnPrivilegeElement();
+    ElementParserPtr OnAppControlElement();
+    ElementParserPtr OnCategoryElement();
+    ElementParserPtr OnLiveboxElement();
 
     virtual ActionFunc GetElementParser(const DPL::String& ns,
             const DPL::String& name);
diff --git a/src/jobs/widget_install/ace_registration.cpp b/src/jobs/widget_install/ace_registration.cpp
new file mode 100644 (file)
index 0000000..00165f1
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    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.
+ */
+/**
+ * @file    ace_registration.cpp
+ * @author  Andrzej Surdej (a.surdej@gmail.com)
+ * @version 1.0
+ * @brief   Translate structures to ace api - implementation file
+ */
+
+#include <ace_registration.h>
+#include <dpl/log/log.h>
+#include <dpl/foreach.h>
+#include <ace_api_install.h>
+
+namespace {
+
+char* toAceString(const DPL::OptionalString& os)
+{
+    if (!os.IsNull())
+        return strdup(DPL::ToUTF8String(*os).c_str());
+    else
+        return NULL;
+}
+
+char* toAceString(const std::string& str)
+{
+    if (!str.empty())
+        return strdup(str.c_str());
+    else
+        return NULL;
+}
+
+} //anonymous namespace
+
+namespace AceApi {
+
+bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
+                               const WrtDB::WidgetRegisterInfo& widgetConfig,
+                               const WrtDB::WidgetCertificateDataList& certList)
+{
+    LogDebug("Updating Ace database");
+    struct widget_info wi;
+    DPL::OptionalString os;
+
+    switch(widgetConfig.webAppType.appType)
+    {
+        case WrtDB::APP_TYPE_WAC20:
+            wi.type = WAC20;
+            break;
+        case WrtDB::APP_TYPE_TIZENWEBAPP:
+            wi.type = Tizen;
+            break;
+        default:
+            LogError("Unknown application type");
+            return false;
+    }
+
+    wi.id = toAceString(widgetConfig.configInfo.widget_id);
+    wi.version = toAceString(widgetConfig.configInfo.version);
+    wi.author = toAceString(widgetConfig.configInfo.authorName);
+    wi.shareHerf = strdup(widgetConfig.shareHref.c_str());
+    LogDebug("Basic data converted. Certificates begin.");
+
+    //one more element for NULL termination
+    LogDebug("Found: " << certList.size() << " certificates");
+    ace_certificate_data** certData = new ace_certificate_data*[certList.size() + 1];
+    certData[certList.size()] = NULL; // last element set to NULL
+
+    int i = 0;
+    FOREACH(it, certList)
+    {
+        certData[i] = new ace_certificate_data;
+        switch (it->owner) {
+        case WrtDB::WidgetCertificateData::AUTHOR :
+            certData[i]->owner = AUTHOR;
+            break;
+        case WrtDB::WidgetCertificateData::DISTRIBUTOR :
+            certData[i]->owner = DISTRIBUTOR;
+            break;
+        default :
+            LogDebug("Unknown owner type of cert");
+            certData[i]->owner = UNKNOWN;
+        }
+        switch (it->type) {
+            case WrtDB::WidgetCertificateData::ENDENTITY :
+                certData[i]->type = ENDENTITY;
+                break;
+            case WrtDB::WidgetCertificateData::ROOT :
+                certData[i]->type = ROOT;
+                break;
+            default :
+                LogError("Unknown type of cert");
+                certData[i]->type = ENDENTITY;
+        }
+        certData[i]->chain_id = it->chainId;
+
+        certData[i]->md5_fp = toAceString(it->strMD5Fingerprint);
+        certData[i]->sha1_fp = toAceString(it->strSHA1Fingerprint);
+        certData[i]->common_name = toAceString(DPL::ToUTF8String(it->strCommonName));
+        ++i;
+    }
+
+    LogDebug("Registerign widget in ace");
+    ace_return_t retval = ACE_ACE_UNKNOWN_ERROR;
+    retval = ace_register_widget(
+        static_cast<ace_widget_handle_t>(widgetHandle), &wi, certData);
+
+    //clean up - WidgetInfo
+    free(wi.author);
+    free(wi.id);
+    free(wi.shareHerf);
+    free(wi.version);
+
+    //free cert list
+    i = 0;
+    while (certData[i] != NULL) {
+        free(certData[i]->common_name);
+        free(certData[i]->md5_fp);
+        free(certData[i]->sha1_fp);
+        delete certData[i];
+        ++i;
+    }
+    delete[] certData;
+    return retval == ACE_OK;
+}
+}
diff --git a/src/jobs/widget_install/ace_registration.h b/src/jobs/widget_install/ace_registration.h
new file mode 100644 (file)
index 0000000..2f4a3b0
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    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.
+ */
+/**
+ * @file    ace_registration.h
+ * @author  Andrzej Surdej (a.surdej@gmail.com)
+ * @version 1.0
+ * @brief   Translate structures to ace api - header file
+ */
+#ifndef WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_
+#define WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_
+
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+
+namespace AceApi {
+
+bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
+                       const WrtDB::WidgetRegisterInfo& widgetConfig,
+                       const WrtDB::WidgetCertificateDataList& certList);
+
+}
+
+#endif /* WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_ */
+
index 5fd9f80..ad57eb7 100644 (file)
  * @brief   Implementation file for main installer task
  */
 #include <memory>
+#include <string>
+#include <sys/time.h>
+#include <ctime>
+#include <cstdlib>
+#include <limits.h>
+#include <regex.h>
 
 #include <dpl/noncopyable.h>
 #include <dpl/abstract_waitable_input_adapter.h>
 #include <dpl/copy.h>
 #include <dpl/assert.h>
 #include <dpl/sstream.h>
-#include <dpl/wrt-dao-ro/common_dao_types.h>
 #include <dpl/file_input.h>
 #include <dpl/utils/wrt_utility.h>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dpl/wrt-dao-rw/global_dao.h> // TODO remove
+#include <dpl/localization/w3c_file_localization.h>
+
+#include <libiriwrapper.h>
+#include <pkg-manager/pkgmgr_signal.h>
+#include <app_manager.h>
+//#include <drm_client.h>
+#include <drm-oem-intel.h> //temporary code
+
 #include "root_parser.h"
 #include "widget_parser.h"
 #include "parser_runner.h"
@@ -43,7 +60,6 @@
 #include <widget_install/task_ace_check.h>
 #include <widget_install/task_smack.h>
 #include <widget_install/task_manifest_file.h>
-#include <widget_install/task_private_storage.h>
 #include <widget_install/task_prepare_files.h>
 #include <widget_install/task_recovery.h>
 #include <widget_install/task_install_ospsvc.h>
 #include <widget_install/task_certificates.h>
 #include <widget_install/task_unzip.h>
 #include <widget_install/task_commons.h>
+
 #include <widget_install/task_plugins_copy.h>
 
 #include <widget_install/widget_install_errors.h>
 #include <widget_install/widget_install_context.h>
-#include <string>
-#include <sys/time.h>
-#include <ctime>
-#include <cstdlib>
-#include <limits.h>
-#include <regex.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/wrt-dao-rw/global_dao.h> // TODO remove
-#include <dpl/localization/w3c_file_localization.h>
-#include <libiriwrapper.h>
-#include <pkg-manager/pkgmgr_signal.h>
-#include <app_manager.h>
-#include <drm_client.h>
-#include <drm-oem-intel.h> //temporary code
+#include <widget_install_to_external.h>
 
 using namespace WrtDB;
 
@@ -83,10 +86,13 @@ const char * const WITH_OSP_XML = "res/wgt/config.xml";
 
 //allowed: a-z, A-Z, 0-9
 const char* REG_TIZENID_PATTERN = "^[a-zA-Z0-9]{10}$";
-const int MAX_TIZENID_LENGTH = 10;
 
 static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
 static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
+const DPL::String SETTING_VALUE_INSTALLTOEXT_NAME =
+    L"install-location-type";
+const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT =
+    L"prefer-external";
 
 class InstallerTaskFail :
     public DPL::TaskDecl<InstallerTaskFail>
@@ -127,6 +133,22 @@ bool hasExtension(const std::string& filename, const std::string& extension) {
     }
     return (0 == filename.compare(fileLen-extLen, extLen, extension));
 }
+
+bool checkTizenIdExist(const std::string& tizenId) {
+    std::string installPath =
+        std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
+        "/" + tizenId;
+    std::string preinstallPath =
+        std::string(GlobalConfig::GetUserPreloadedWidgetPath()) +
+        "/" + tizenId;
+
+    struct stat dirStat;
+    if ((stat(installPath.c_str(), &dirStat) == 0) &&
+            (stat(preinstallPath.c_str(), &dirStat) == 0)) {
+        return true;
+    }
+    return false;
+}
 } // namespace anonymous
 
 namespace Jobs {
@@ -152,24 +174,28 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
 
         // Create installation tasks
         if (m_installerContext.widgetConfig.packagingType !=
-                WrtDB::PKG_TYPE_HOSTED_WEB_APP || !m_isDRM) {
+                WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
+            m_installerContext.widgetConfig.packagingType !=
+                WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
+            !m_isDRM)
+        {
             AddTask(new TaskUnzip(m_installerContext));
         }
 
         AddTask(new TaskWidgetConfig(m_installerContext));
-        if (m_installerContext.widgetConfig.packagingType ==
-                WrtDB::PKG_TYPE_HOSTED_WEB_APP ) {
+        if (m_installerContext.widgetConfig.packagingType  ==
+                WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+        {
             AddTask(new TaskPrepareFiles(m_installerContext));
         }
         AddTask(new TaskCertify(m_installerContext));
         if (m_needEncryption) {
             AddTask(new TaskEncryptResource(m_installerContext));
         }
+
         AddTask(new TaskFileManipulation(m_installerContext));
         // TODO: Update progress information for this task
 
-        AddTask(new TaskPrivateStorage(m_installerContext));
-
         //This is sort of quick solution, because ACE verdicts are based upon
         //data from DAO (DB). So AceCheck for now has to be AFTER DbUpdate
         //task.
@@ -188,19 +214,28 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
         LogInfo("Configure installation updated");
         LogInfo("Widget Update");
         if (m_installerContext.widgetConfig.packagingType !=
-                WrtDB::PKG_TYPE_HOSTED_WEB_APP || !m_isDRM) {
+                WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
+            m_installerContext.widgetConfig.packagingType !=
+                WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
+            !m_isDRM)
+        {
             AddTask(new TaskUnzip(m_installerContext));
         }
 
         AddTask(new TaskWidgetConfig(m_installerContext));
 
         if (m_installerContext.widgetConfig.packagingType ==
-                WrtDB::PKG_TYPE_HOSTED_WEB_APP ) {
+                WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+        {
             AddTask(new TaskPrepareFiles(m_installerContext));
         }
 
         AddTask(new TaskCertify(m_installerContext));
-        AddTask(new TaskUpdateFiles(m_installerContext));
+        if (m_installerContext.widgetConfig.packagingType !=
+            WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+        {
+            AddTask(new TaskUpdateFiles(m_installerContext));
+        }
 
         /* TODO : To backup file, save md5 values */
         AddTask(new TaskSmack(m_installerContext));
@@ -210,7 +245,11 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
                 PKG_TYPE_HYBRID_WEB_APP) {
             AddTask(new TaskInstallOspsvc(m_installerContext));
         }
-        AddTask(new TaskRemoveBackupFiles(m_installerContext));
+        if (m_installerContext.widgetConfig.packagingType !=
+            WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+        {
+            AddTask(new TaskRemoveBackupFiles(m_installerContext));
+        }
         AddTask(new TaskPluginsCopy(m_installerContext));
         AddTask(new TaskDatabase(m_installerContext));
         AddTask(new TaskAceCheck(m_installerContext));
@@ -241,9 +280,10 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
 
     Try
     {
-        std::string tempDir = Jobs::WidgetInstall::createTempPath();
+        std::string tempDir =
+            Jobs::WidgetInstall::createTempPath(m_jobStruct.m_preload);
 
-        bool m_isDRM = isDRMWidget(widgetPath);
+        m_isDRM = isDRMWidget(widgetPath);
         if (true == m_isDRM) {
             LogDebug("decrypt DRM widget");
             if(DecryptDRMWidget(widgetPath, tempDir)) {
@@ -256,12 +296,16 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
 
         m_installerContext.widgetConfig.packagingType =
             checkPackageType(widgetPath, tempDir);
-        ConfigParserData configData = getWidgetDataFromXML(widgetPath, tempDir,
-                m_installerContext.widgetConfig.packagingType, m_isDRM);
+        ConfigParserData configData = getWidgetDataFromXML(
+            widgetPath,
+            tempDir,
+            m_installerContext.widgetConfig.packagingType,
+            m_isDRM);
         LogDebug("widget packaging type : " <<
                 m_installerContext.widgetConfig.packagingType.pkgType);
         WidgetUpdateInfo update = detectWidgetUpdate(configData);
         m_needEncryption = detectResourceEncryption(configData);
+        setInstallLocationType(configData);
 
         // Configure installation
         result = ConfigureInstallation(widgetPath, configData, update, tempDir);
@@ -275,31 +319,35 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
     return result;
 }
 
-std::string JobWidgetInstall::generateTizenId() {
-    std::string allowed("0123456789"
-        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-        "abcdefghijklmnopqrstuvwxyz");
-    std::string tizenId;
-    tizenId.resize(MAX_TIZENID_LENGTH);
-    for (int i = 0; i < MAX_TIZENID_LENGTH; ++i) {
-        tizenId[i] = allowed[rand() % allowed.length()];
-    }
-    return tizenId;
-}
-
 bool JobWidgetInstall::setTizenId(
-        const WrtDB::ConfigParserData &configInfo, ConfigureResult result)
+        const WrtDB::ConfigParserData &configInfo,
+        const WidgetUpdateInfo &update,
+        bool preload)
 {
+    using namespace PackageManager;
     regex_t reg;
-    regcomp(&reg, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED);
-    struct stat dirStat;
+    if(regcomp(&reg, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){
+        LogDebug("Regcomp failed");
+    }
+
+    ConfigureResult result = checkWidgetUpdate(update);
     if(!!configInfo.tizenId) {
         LogDebug("Setting tizenId provided in config.xml: " << configInfo.tizenId);
+        // send start signal of pkgmgr
+        getInstallerStruct().pkgmgrInterface->setPkgname(
+                DPL::ToUTF8String(*(configInfo.tizenId)));
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_START_KEY,
+                PKGMGR_START_INSTALL);
+
+        if (result == ConfigureResult::Failed) {
+            return false;
+        }
+
         if ((regexec(&reg, DPL::ToUTF8String(*(configInfo.tizenId)).c_str(),
              static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
-            ((stat((std::string(GlobalConfig::GetUserInstalledWidgetPath()) + "/"
-                   + DPL::ToUTF8String(*(configInfo.tizenId))).c_str(), &dirStat) == 0)
-             && result != ConfigureResult::Updated))
+            (checkTizenIdExist(DPL::ToUTF8String(*(configInfo.tizenId))) &&
+             result != ConfigureResult::Updated))
         {
             //it is true when tizenId does not fit REG_TIZENID_PATTERN
             LogError("tizen_id provided but not proper.");
@@ -309,33 +357,31 @@ bool JobWidgetInstall::setTizenId(
         m_installerContext.widgetConfig.pkgname = configInfo.tizenId;
 
     } else {
-        std::string tizenId = generateTizenId();
+        WidgetPkgName tizenId = WidgetDAOReadOnly::generateTizenId();
 
         // only for installation, not for update
         if (result == ConfigureResult::Ok) {
             //check if there is package with same name and if generate different name
-            std::string path = GlobalConfig::GetUserInstalledWidgetPath();
-            path += "/";
-
-            std::ostringstream newPath;
-            newPath << path << tizenId;
 
             LogDebug("Checking if tizen id is unique");
             while (true) {
-                if (stat(newPath.str().c_str(), &dirStat) == 0) {
+                if (checkTizenIdExist(DPL::ToUTF8String(tizenId))) {
                     //path exist, chose another one
-                    tizenId = generateTizenId();
-                    newPath.str("");
-                    newPath << path << tizenId;
+                    tizenId = WidgetDAOReadOnly::generateTizenId();
                     continue;
                 }
                 break;
             }
 
-            m_installerContext.widgetConfig.pkgname =
-                DPL::FromUTF8String(tizenId);
+            m_installerContext.widgetConfig.pkgname = tizenId;
         }
         LogInfo("tizen_id name was generated by WRT: " << tizenId);
+        // send start signal of pkgmgr
+        getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String(
+                    *m_installerContext.widgetConfig.pkgname));
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_START_KEY,
+                PKGMGR_START_INSTALL);
     }
     regfree(&reg);
 
@@ -344,18 +390,14 @@ bool JobWidgetInstall::setTizenId(
     return true;
 }
 
-DPL::OptionalString JobWidgetInstall::getNewTizenId() const
-{
-    return m_installerContext.widgetConfig.pkgname;
-}
-
 void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
                                                const std::string& tempPath)
 {
     m_installerContext.locations =
         WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
                 widgetPath, tempPath,
-                m_installerContext.widgetConfig.packagingType);
+                m_installerContext.widgetConfig.packagingType,
+                m_installerContext.locationType);
 
     LogInfo("widgetSource " << widgetPath);
 }
@@ -366,6 +408,27 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
         const WidgetUpdateInfo &update,
         const std::string &tempPath)
 {
+
+    if (!setTizenId(configData, update, m_jobStruct.m_preload)) {
+        return ConfigureResult::Failed;
+    } else {
+        LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
+
+        configureWidgetLocation(widgetSource, tempPath);
+    }
+
+    // Init installer context
+    m_installerContext.installStep = InstallerContext::INSTALL_START;
+    m_installerContext.job = this;
+    m_installerContext.existingWidgetInfo = update.existingWidgetInfo;
+    m_installerContext.widgetConfig.shareHref = std::string();
+
+    return ConfigureResult::Ok;
+}
+
+JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
+        const WidgetUpdateInfo &update)
+{
     LogInfo(
         "Widget install/update: incoming guid = '" <<
         update.incomingGUID << "'");
@@ -375,7 +438,6 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
 
     // Check policy
     WidgetUpdateMode::Type updateTypeCheckBit;
-    JobWidgetInstall::ConfigureResult ret = ConfigureResult::Ok;
 
     if (update.existingWidgetInfo.isExist == false) {
         LogInfo("Widget info does not exist");
@@ -412,7 +474,6 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
             } else {
                 LogInfo(
                     "Widget is already running. Policy is not update according to WAC");
-                LogInfo("Installation aborted: " << widgetSource);
 
                 return ConfigureResult::Failed;
             }
@@ -426,39 +487,17 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
         updateTypeCheckBit = CalcWidgetUpdatePolicy(existingVersion,
                                                     incomingVersion);
         // Calc proceed flag
-        if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0) {
+        if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
+            m_jobStruct.updateMode ==
+                WidgetUpdateMode::PolicyDirectoryForceInstall)
+        {
             LogInfo("Whether widget policy allow proceed ok");
-            ret = ConfigureResult::Updated;
+            return ConfigureResult::Updated;
         }
         else
             return ConfigureResult::Failed;
     }
-
-    if (!setTizenId(configData, ret)) {
-        return ConfigureResult::Failed;
-    } else {
-        using namespace PackageManager;
-        LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
-
-        configureWidgetLocation(widgetSource, tempPath);
-
-        // send start signal of pkgmgr
-        PkgmgrSignalSingleton::Instance().setPkgname(
-                    DPL::ToUTF8String(
-                        *m_installerContext.widgetConfig.pkgname));
-        PkgmgrSignalSingleton::Instance().sendSignal(
-                    PKGMGR_START_KEY,
-                    PKGMGR_START_INSTALL);
-    }
-
-    // Init installer context
-    m_installerContext.installStep = InstallerContext::INSTALL_START;
-    m_installerContext.job = this;
-    m_installerContext.existingWidgetInfo = update.existingWidgetInfo;
-    m_installerContext.widgetConfig.shareHref = std::string();
-
-    // Return result
-    return ret;
+    return ConfigureResult::Ok;
 }
 
 WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
@@ -512,6 +551,12 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
                         new RootParser<WidgetParser>(configInfo,
                             DPL::FromUTF32String(
                                 L"widget"))));
+        } else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
+            parser.Parse(widgetSource + '/' + WITH_OSP_XML,
+                         ElementParserPtr(
+                             new RootParser<WidgetParser>(
+                             configInfo,
+                             DPL::FromUTF32String(L"widget"))));
         } else {
             if (!isDRM) {
                 std::unique_ptr<DPL::ZipInput> zipFile(
@@ -578,6 +623,11 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
         LogError("Failed to parse config.xml file");
         return ConfigParserData();
     }
+    Catch(DPL::ZipInput::Exception::SeekFileFailed)
+    {
+        LogError("Failed to seek widget archive - corrupted package?");
+        return ConfigParserData();
+    }
     return configInfo;
 }
 
@@ -635,7 +685,7 @@ void JobWidgetInstall::SendProgress()
             // send progress signal of pkgmgr
             std::ostringstream percent;
             percent << static_cast<int>(GetProgressPercent());
-            PkgmgrSignalSingleton::Instance().sendSignal(
+            getInstallerStruct().pkgmgrInterface->sendSignal(
                         PKGMGR_PROGRESS_KEY,
                         percent.str());
 
@@ -652,16 +702,26 @@ void JobWidgetInstall::SendFinishedSuccess()
     // TODO : sync should move to separate task.
     sync();
 
+
+    if (INSTALL_LOCATION_TYPE_EXTERNAL == m_installerContext.locationType) {
+        if (false == m_installerContext.existingWidgetInfo.isExist) {
+            WidgetInstallToExtSingleton::Instance().postInstallation(true);
+        } else {
+            WidgetInstallToExtSingleton::Instance().postUpgrade(true);
+        }
+        WidgetInstallToExtSingleton::Instance().deinitialize();
+    }
+
     // remove widget install information file
     unlink(m_installerContext.installInfo.c_str());
 
     //inform widget info
     JobWidgetInstall::displayWidgetInfo();
 
-    DPL::OptionalString tizenId = getNewTizenId();
+    DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname;
 
     // send signal of pkgmgr
-    PkgmgrSignalSingleton::Instance().sendSignal(
+    getInstallerStruct().pkgmgrInterface->sendSignal(
                 PKGMGR_END_KEY,
                 PKGMGR_END_SUCCESS);
 
@@ -678,12 +738,12 @@ void JobWidgetInstall::SendFinishedFailure()
 
     LogError("Error in installation step: " << m_exceptionCaught);
     LogError("Message: " << m_exceptionMessage);
-    DPL::OptionalString tizenId = getNewTizenId();
+    DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname;
 
     LogDebug("Call widget install failure finishedCallback");
 
     // send signal of pkgmgr
-    PkgmgrSignalSingleton::Instance().sendSignal(
+    getInstallerStruct().pkgmgrInterface->sendSignal(
                 PKGMGR_END_KEY,
                 PKGMGR_END_FAILURE);
 
@@ -766,7 +826,12 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
         const std::string &widgetSource,
         const std::string &tempPath)
 {
-    // Check installation type (config.xml or widget.wgt)
+    // Check installation type (direcotory/ or config.xml or widget.wgt)
+    if (WidgetUpdateMode::PolicyDirectoryForceInstall == m_jobStruct.updateMode)
+    {
+        LogDebug("Install directly from directory");
+        return PKG_TYPE_DIRECTORY_WEB_APP;
+    }
     if (hasExtension(widgetSource, XML_EXTENSION)) {
         LogInfo("Hosted app installation");
         return PKG_TYPE_HOSTED_WEB_APP;
@@ -796,6 +861,11 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
             LogDebug("Failed to open widget package");
             return PKG_TYPE_UNKNOWN;
         }
+        Catch(DPL::ZipInput::Exception::SeekFileFailed)
+        {
+            LogError("Failed to seek widget package file");
+            return PKG_TYPE_UNKNOWN;
+        }
 
         Try
         {
@@ -840,6 +910,28 @@ bool JobWidgetInstall::detectResourceEncryption(const WrtDB::ConfigParserData &c
     return false;
 }
 
+void JobWidgetInstall::setInstallLocationType(const
+        WrtDB::ConfigParserData &configData)
+{
+    m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL;
+
+    if (true == m_jobStruct.m_preload) {
+        m_installerContext.locationType =
+            INSTALL_LOCATION_TYPE_PRELOAD;
+    } else {
+        FOREACH(it, configData.settingsList)
+        {
+            if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME &&
+                    it->m_value ==
+                    SETTING_VALUE_INSTALLTOEXT_PREPER_EXT) {
+                LogDebug("This widget will be installed to sd card");
+                m_installerContext.locationType =
+                    INSTALL_LOCATION_TYPE_EXTERNAL;
+            }
+        }
+    }
+}
+
 bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
 {
     /* TODO :
@@ -862,7 +954,7 @@ bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
 bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
         std::string destPath)
 {
-    /* TODO : 
+    /* TODO :
     drm_trusted_sapps_decrypt_package_info_s package_info;
 
     strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
@@ -882,7 +974,7 @@ bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
     }
     */
     if (drm_oem_intel_decrypt_package(const_cast<char*>(widgetPath.c_str()),
-                const_cast<char*>(destPath.c_str())) != 0) { 
+                const_cast<char*>(destPath.c_str())) != 0) {
         return true;
     } else {
         return false;
index fa39392..1f81498 100644 (file)
@@ -72,7 +72,8 @@ class JobWidgetInstall :
             const OptionalWidgetVersion &existingVersion,
             const OptionalWidgetVersion &incomingVersion) const;
     bool setTizenId(const WrtDB::ConfigParserData &configInfo,
-                    ConfigureResult result);
+                    const WidgetUpdateInfo &update,
+                    bool preload);
     void displayWidgetInfo();
     void configureWidgetLocation(const std::string & widgetPath,
                                  const std::string &tempPath);
@@ -81,10 +82,12 @@ class JobWidgetInstall :
             const std::string &widgetSource,
             const std::string &tempPath);
     bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
-    std::string generateTizenId();
+    void setInstallLocationType(const WrtDB::ConfigParserData
+            &configData);
     bool isDRMWidget(std::string widgetPath);
     bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
     ConfigureResult PrePareInstallation(const std::string &widgetPath);
+    ConfigureResult checkWidgetUpdate(const WidgetUpdateInfo &update);
 
   public:
     /**
@@ -93,8 +96,6 @@ class JobWidgetInstall :
     JobWidgetInstall(std::string const & widgetPath,
             const WidgetInstallationStruct &installerStruct);
 
-    DPL::OptionalString getNewTizenId() const;
-
     //overrides
     void SendProgress();
     void SendFinishedSuccess();
old mode 100644 (file)
new mode 100755 (executable)
index f231d02..98adb96
@@ -176,6 +176,7 @@ void Manifest::serialize(xmlTextWriterPtr writer)
         FOREACH(u, this->uiApplication) { u->serialize(writer); }
         FOREACH(i, this->imeApplication) { i->serialize(writer); }
         //FOREACH(f, this->font) { f->serialize(writer); }
+        FOREACH(l, this->livebox) { l->serialize(writer); }
     }
     endElement(writer);
 }
@@ -210,7 +211,7 @@ void ServiceApplication::serialize(xmlTextWriterPtr writer)
         writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
                 i->getLang(), i->hasLang());
     }
-    FOREACH(a, this->applicationService)
+    FOREACH(a, this->appControl)
     {
         a->serialize(writer);
     }
@@ -242,10 +243,16 @@ void UiApplication::serialize(xmlTextWriterPtr writer)
         writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
                 i->getLang(), i->hasLang());
     }
-    FOREACH(a, this->applicationService)
+    FOREACH(a, this->appControl)
     {
         a->serialize(writer);
     }
+    FOREACH(c, this->appCategory)
+    {
+        startElement(writer, "category");
+        writeAttribute(writer, "name", *c);
+        endElement(writer);
+    }
     endElement(writer);
 }
 
@@ -272,9 +279,9 @@ void ImeApplication::serialize(xmlTextWriterPtr writer)
     endElement(writer);
 }
 
-void ApplicationService::serialize(xmlTextWriterPtr writer)
+void AppControl::serialize(xmlTextWriterPtr writer)
 {
-    startElement(writer, "application-service");
+    startElement(writer, "app-control");
     FOREACH(o, this->operation)
     {
         startElement(writer, "operation");
@@ -296,5 +303,83 @@ void ApplicationService::serialize(xmlTextWriterPtr writer)
     endElement(writer);
 }
 
+void LiveBox::serialize(xmlTextWriterPtr writer)
+{
+    startElement(writer, "livebox");
+    if(!this->liveboxId.empty()) {
+        writeAttribute(writer, "appid", this->liveboxId);
+    }
+
+    if(!this->primary.empty()) {
+        writeAttribute(writer, "primary", this->primary);
+    }
+
+    if(!this->updatePeriod.empty()) {
+        writeAttribute(writer, "period", this->updatePeriod);
+    }
+
+    writeAttribute(writer, "abi", "html");
+    writeAttribute(writer, "network", "true");
+    writeAttribute(writer, "nodisplay", "false");
+
+    if(!this->label.empty()) {
+        startElement(writer, "label");
+        writeText(writer, this->label);
+        endElement(writer);
+    }
+
+    if(!this->icon.empty()) {
+        startElement(writer, "icon");
+        writeText(writer, this->icon);
+        endElement(writer);
+    }
+
+    if(!this->autoLaunch.empty()) {
+        startElement(writer, "launch");
+        writeText(writer, this->autoLaunch);
+        endElement(writer);
+    }
+
+    if(!this->box.boxSrc.empty() && !this->box.boxSize.empty())
+    {
+        startElement(writer, "box");
+        writeAttribute(writer, "type", "buffer");
+
+        FOREACH(m, this->box.boxSize)
+        {
+            std::pair<DPL::String, DPL::String> boxSize = *m;
+            startElement(writer, "size");
+            if(!boxSize.second.empty())
+                writeAttribute(writer, "preview", boxSize.second);
+            writeText(writer, boxSize.first);
+            endElement(writer);
+        }
+
+        startElement(writer, "script");
+        writeAttribute(writer, "src", this->box.boxSrc);
+        endElement(writer);
+
+        endElement(writer);
+
+        if(!this->box.pdSrc.empty() && ! this->box.pdWidth.empty() && ! this->box.pdHeight.empty()) {
+            startElement(writer, "pd");
+            writeAttribute(writer, "type", "buffer");
+
+            startElement(writer, "size");
+            DPL::String pdSize = this->box.pdWidth+DPL::String(L"x")+this->box.pdHeight;
+            writeText(writer, pdSize);
+            endElement(writer);
+
+            startElement(writer, "script");
+            writeAttribute(writer, "src", this->box.pdSrc);
+            endElement(writer);
+
+            endElement(writer);
+        }
+    }
+
+    endElement(writer);
+}
+
 } //namespace Jobs
 } //namespace WidgetInstall
old mode 100644 (file)
new mode 100755 (executable)
index 84894dd..ac469d2
@@ -61,6 +61,7 @@ typedef StringWithLang LabelType, IconType, DescriptionType;
 typedef DPL::String NcnameType, NmtokenType, AnySimpleType, LangType;
 typedef DPL::String OperationType, MimeType, UriType, TypeType, PackageType;
 typedef DPL::OptionalString InstallLocationType, CategoriesType;
+typedef DPL::String AppCategoryType;
 
 /**
  * xmllib2 wrappers
@@ -103,10 +104,10 @@ typedef Author AuthorType;
 /**
  * @brief application-service element
  */
-class ApplicationService
+class AppControl
 {
 public:
-    ApplicationService() {}
+    AppControl() {}
     void addOperation(const OperationType &x) { this->operation.push_back(x); }
     void addUri(const UriType &x) { this->uri.push_back(x); }
     void addMime(const MimeType &x) { this->mime.push_back(x); }
@@ -117,7 +118,7 @@ private:
     std::list<MimeType> mime; //attr name AnySimpleType
 };
 
-typedef ApplicationService ApplicationServiceType;
+typedef AppControl AppControlType;
 
 /**
  * @brief ime-application element
@@ -160,9 +161,9 @@ public:
     void setType(const TypeType &x) { this->type = x; }
     void addLabel(const LabelType &x) { this->label.push_back(x); }
     void addIcon(const IconType &x) { this->icon.push_back(x); }
-    void addApplicationService(const ApplicationServiceType &x)
+    void addAppControl(const AppControlType &x)
     {
-        this->applicationService.push_back(x);
+        this->appControl.push_back(x);
     }
     void serialize(xmlTextWriterPtr writer);
 private:
@@ -173,7 +174,7 @@ private:
     TypeType type;
     std::list<LabelType> label; //attr name AnySimpleType
     std::list<IconType> icon; //attr name AnySimpleType
-    std::list<ApplicationServiceType> applicationService; //attr name AnySimpleType
+    std::list<AppControlType> appControl; //attr name AnySimpleType
 };
 
 typedef ServiceApplication ServiceApplicationType;
@@ -195,9 +196,13 @@ public:
     void setCategories(const NcnameType &x) { this->categories = x; }
     void addLabel(const LabelType &x) { this->label.push_back(x); }
     void addIcon(const IconType &x) { this->icon.push_back(x); }
-    void addApplicationService(const ApplicationServiceType &x)
+    void addAppControl(const AppControlType &x)
     {
-        this->applicationService.push_back(x);
+        this->appControl.push_back(x);
+    }
+    void addAppCategory(const AppCategoryType &x)
+    {
+        this->appCategory.push_back(x);
     }
     void serialize(xmlTextWriterPtr writer);
 private:
@@ -211,12 +216,56 @@ private:
     CategoriesType categories;
     std::list<LabelType> label;
     std::list<IconType> icon;
-    std::list<ApplicationServiceType> applicationService;
+    std::list<AppControlType> appControl;
+    std::list<AppCategoryType> appCategory;
 };
 
 typedef UiApplication UiApplicationType;
 
 /**
+ * @brief LiveBox element
+ */
+typedef std::list<std::pair<DPL::String, DPL::String>> boxSizeType;
+
+
+struct BoxInfo
+{
+    NcnameType boxSrc;
+    boxSizeType boxSize;
+    NcnameType pdSrc;
+    NcnameType pdWidth;
+    NcnameType pdHeight;
+};
+typedef BoxInfo BoxInfoType;
+
+class LiveBox
+{
+public:
+    LiveBox() { }
+    void setLiveboxId(const NcnameType &x) { this->liveboxId = x; }
+    void setPrimary(const NcnameType &x) { this->primary = x; }
+    void setAutoLaunch(const NcnameType &x) { this->autoLaunch = x; }
+    void setUpdatePeriod(const NcnameType &x) { this->updatePeriod = x; }
+    void setLabel(const NcnameType &x) { this->label = x; }
+    void setIcon(const NcnameType &x) { this->icon = x; }
+    void setBox(const BoxInfoType &x) { this->box = x; }
+
+    void serialize(xmlTextWriterPtr writer);
+
+private:
+    NcnameType liveboxId;
+    NcnameType primary;
+    NcnameType autoLaunch;
+    NcnameType updatePeriod;
+    NcnameType timeout;
+    NcnameType label;
+    NcnameType icon;
+    BoxInfoType box;
+};
+
+typedef LiveBox LiveBoxInfo;
+
+/**
  * @brief manifest element
  *
  * Manifest xml file representation.
@@ -257,6 +306,11 @@ public:
     }
 //    void addFont(const FontType &x) { this->font.push_back(x); }
 
+    void addLivebox(const LiveBoxInfo &x)
+    {
+        this->livebox.push_back(x);
+    }
+
     void setInstallLocation(const InstallLocationType &x)
     {
         this->installLocation = x;
@@ -275,6 +329,7 @@ private:
     std::list<UiApplicationType> uiApplication;
     std::list<ImeApplicationType> imeApplication;
 //    std::list<FontType> font;
+    std::list<LiveBoxInfo> livebox;
     InstallLocationType installLocation;
     NcnameType package;
     PackageType type;
index a302b64..4e41048 100755 (executable)
@@ -83,49 +83,74 @@ void TaskCertificates::SetCertiInfo(CertificateSource source)
 
     FOREACH(it, certificateChainList)
     {
-        LogDebug("Insert certinfo to pkgmgr db");
+        LogDebug("Insert certinfo to pkgmgr structure");
 
         ValidationCore::CertificateCollection chain;
         if (false == chain.load(*it)) {
             LogError("Chain is broken");
+            ThrowMsg(Exceptions::SetCertificateInfoFailed,
+                    "Failed to Installer Save Certinfo");
         }
 
-        chain.sort();
+        if (!chain.sort()){
+            LogError("Chain failed at sorting");
+        }
 
         ValidationCore::CertificateList list = chain.getCertificateList();
 
-
         FOREACH(certIt, list) 
         {
-            ValidationCore::Crypto::Hash::SHA1 sha1;
-            sha1.Append((*certIt)->getDER());
-            sha1.Finish();
-            std::string sha1String = sha1.ToBase64String();
-
-            if ((*certIt)->isRootCert()) {
-                if (source == SIGNATURE_DISTRIBUTOR) {
-                    LogDebug("Set SIGNATURE_DISTRIBUTOR ");
-                    if((pkgmgr_installer_set_cert_value(
-                                    m_pkgHandle,
-                                    PM_SET_DISTRIBUTOR_ROOT_CERT,
-                                    const_cast<char*>(sha1String.c_str()))) < 0) {
-                        LogError("pkgmgrInstallerSetCertValue fail");
-                        ThrowMsg(Exceptions::SetCertificateInfoFailed,
-                                "Failed to Set CertValue");
+            pkgmgr_instcert_type instCertType;
+
+            if (source == SIGNATURE_DISTRIBUTOR) {
+                std::string
+                    Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName()));
+                size_t found = Name.find("Tizen");
+
+                if (found != std::string::npos) {
+                    LogDebug("Set SIGNATURE_DISTRIBUTOR");
+                    if ((*certIt)->isRootCert()) {
+                        instCertType = PM_SET_DISTRIBUTOR_ROOT_CERT;
+                    } else {
+                        if ((*certIt)->isCA()) {
+                            instCertType = PM_SET_DISTRIBUTOR_INTERMEDIATE_CERT;
+                        } else {
+                            instCertType = PM_SET_DISTRIBUTOR_SIGNER_CERT;
+                        }
+                    }
+                } else {
+                    LogDebug("Set SIGNATURE_DISTRIBUTOR2");
+                    if ((*certIt)->isRootCert()) {
+                        instCertType = PM_SET_DISTRIBUTOR2_ROOT_CERT;
+                    } else {
+                        if ((*certIt)->isCA()) {
+                            instCertType = PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT;
+                        } else {
+                            instCertType = PM_SET_DISTRIBUTOR2_SIGNER_CERT;
+                        }
                     }
                 }
-                else {
-                    LogDebug("set SIGNATURE_AUTHOR");
-                    if((pkgmgr_installer_set_cert_value(
-                                    m_pkgHandle,
-                                    PM_SET_AUTHOR_ROOT_CERT,
-                                    const_cast<char*>(sha1String.c_str()))) < 0) {
-                        LogError("pkgmgrInstallerSetCertValue fail");
-                        ThrowMsg(Exceptions::SetCertificateInfoFailed,
-                                "Failed to Installer Set CertValue");
+            } else {
+                LogDebug("set SIGNATURE_AUTHOR");
+                if ((*certIt)->isRootCert()) {
+                    instCertType = PM_SET_AUTHOR_ROOT_CERT;
+                } else {
+                    if ((*certIt)->isCA()) {
+                        instCertType = PM_SET_AUTHOR_INTERMEDIATE_CERT;
+                    } else {
+                        instCertType = PM_SET_AUTHOR_SIGNER_CERT;
                     }
                 }
             }
+            LogDebug("cert type : " << instCertType);
+            if((pkgmgr_installer_set_cert_value(
+                            m_pkgHandle,
+                            instCertType,
+                            const_cast<char*>(((*certIt)->getBase64()).c_str()))) < 0) {
+                LogError("pkgmgrInstallerSetCertValue fail");
+                ThrowMsg(Exceptions::SetCertificateInfoFailed,
+                        "Failed to Set CertValue");
+            }
         }
     }
 }
index 532c206..40a17cd 100755 (executable)
 #include <dpl/wrt-dao-ro/global_config.h>
 #include "wac_widget_id.h"
 
+#include <vcore/Certificate.h>
 #include <vcore/SignatureReader.h>
 #include <vcore/SignatureFinder.h>
-#include <vcore/SignatureValidator.h>
+#include <vcore/WrtSignatureValidator.h>
 #include <vcore/DeveloperModeValidator.h>
 #include <dpl/utils/wrt_global_settings.h>
 #include <dpl/wrt-dao-ro/global_dao_read_only.h>
@@ -83,11 +84,11 @@ WidgetCertificateData toWidgetCertificateData(const SignatureData &data,
     result.strCommonName = *certificate->getCommonName();
 
     result.strMD5Fingerprint = std::string("md5 ") +
-        SignatureValidator::FingerprintToColonHex(
+        Certificate::FingerprintToColonHex(
             certificate->getFingerprint(Certificate::FINGERPRINT_MD5));
 
     result.strSHA1Fingerprint = std::string("sha-1 ") +
-        SignatureValidator::FingerprintToColonHex(
+        Certificate::FingerprintToColonHex(
             certificate->getFingerprint(Certificate::FINGERPRINT_SHA1));
 
     return result;
@@ -101,10 +102,7 @@ TaskCertify::TaskCertify(InstallerContext &inCont) :
     m_contextData(inCont),
     WidgetInstallPopup(inCont)
 {
-    /* This is temporary comment for certi error
-       After security-server, cert-svc release, should remove comment
     AddStep(&TaskCertify::stepSignature);
-    */
 
     // Block until fixed popup issues
     if (!GlobalSettings::PopupsTestModeEnabled()
@@ -131,7 +129,9 @@ void TaskCertify::processDistributorSignature(const SignatureData &data,
 
     CertificateCollection collection;
     collection.load(data.getCertList());
-    collection.sort();
+    Assert(collection.sort() &&
+            "Certificate collection can't sort");
+
     Assert(collection.isChain() &&
            "Certificate collection is not able to create chain. "
            "It is not possible to verify this signature.");
@@ -186,7 +186,7 @@ void TaskCertify::processAuthorSignature(const SignatureData &data)
 
 void TaskCertify::stepSignature()
 {
-    LogInfo("enter");
+    LogInfo("================ Step: <<Signature>> ENTER ===============");
 
     std::string widgetPath = m_contextData.locations->getTemporaryRootDir() + "/";
 
@@ -199,7 +199,7 @@ void TaskCertify::stepSignature()
     }
 
     SignatureFileInfoSet::reverse_iterator iter = signatureFiles.rbegin();
-    LogInfo("No of signatures: " << signatureFiles.size());
+    LogInfo("Number of signatures: " << signatureFiles.size());
 
     bool firstDistributorSignature = true;
     bool testCertificate = false;
@@ -216,19 +216,28 @@ void TaskCertify::stepSignature()
             xml.initialize(data, GlobalConfig::GetSignatureXmlSchema());
             xml.read(data);
 
-            SignatureValidator validator(!GlobalSettings::OCSPTestModeEnabled(),
-                                         !GlobalSettings::CrlTestModeEnabled(),
-                                         complianceMode);
-            SignatureValidator::Result result =
+            WrtSignatureValidator::AppType appType = WrtSignatureValidator::WAC20;
+
+            if (m_installContext.widgetConfig.webAppType == APP_TYPE_TIZENWEBAPP) {
+                appType = WrtSignatureValidator::TIZEN;
+            }
+
+            WrtSignatureValidator validator(
+                appType,
+                !GlobalSettings::OCSPTestModeEnabled(),
+                !GlobalSettings::CrlTestModeEnabled(),
+                complianceMode);
+
+            WrtSignatureValidator::Result result =
                 validator.check(data, widgetPath);
 
-            if (result == SignatureValidator::SIGNATURE_REVOKED) {
+            if (result == WrtSignatureValidator::SIGNATURE_REVOKED) {
                 LogWarning("Certificate is REVOKED");
                 ThrowMsg(Exceptions::InvalidPackage,
                          "Certificate is REVOKED");
             }
 
-            if (result == SignatureValidator::SIGNATURE_INVALID) {
+            if (result == WrtSignatureValidator::SIGNATURE_INVALID) {
                 LogWarning("Signature is INVALID");
                 // TODO change exception name
                 ThrowMsg(Exceptions::InvalidPackage,
@@ -236,15 +245,15 @@ void TaskCertify::stepSignature()
             }
 
             if (data.isAuthorSignature()) {
-                if (result == SignatureValidator::SIGNATURE_VERIFIED ||
+                if (result == WrtSignatureValidator::SIGNATURE_VERIFIED ||
                     m_contextData.wacSecurity.isDistributorSigned())
                 {
                     processAuthorSignature(data);
-                } else if (result == SignatureValidator::SIGNATURE_DISREGARD) {
+                } else if (result == WrtSignatureValidator::SIGNATURE_DISREGARD) {
                     continue;
                 }
             } else {
-                if (result == SignatureValidator::SIGNATURE_DISREGARD) {
+                if (result == WrtSignatureValidator::SIGNATURE_DISREGARD) {
                     continue;
                 }
                 // now signature _must_ be verified
@@ -300,7 +309,7 @@ void TaskCertify::stepSignature()
         LogInfo("No signature files has been found.");
     }
 
-    LogInfo("================ Step: <<CSignature>> DONE ================");
+    LogInfo("================ Step: <<Signature>> DONE ================");
 
     m_contextData.job->UpdateProgress(
         InstallerContext::INSTALL_DIGSIG_CHECK,
index 10c73e8..fea9ea1 100644 (file)
@@ -43,14 +43,19 @@ const mode_t TEMPORARY_PATH_MODE = 0775;
 } // namespace
 
 
-std::string createTempPath()
+std::string createTempPath(bool preload)
 {
     LogInfo("Step: Creating temporary path");
 
    // Temporary path
    std::ostringstream tempPathBuilder;
 
-   tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+   if (preload) {
+       tempPathBuilder << WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
+   } else {
+       tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+   }
+   tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
    tempPathBuilder << "/";
    tempPathBuilder << TEMPORARY_PATH_POSTFIX;
    tempPathBuilder << "_";
index dbb41eb..5193c3d 100644 (file)
@@ -29,7 +29,8 @@ namespace WidgetInstall {
 
 //TODO make directory like jobs common?
 
-std::string createTempPath();
+std::string createTempPath(bool preload = false);
+std::string createTempPath(bool preload);
 
 void createTempPath(const std::string& path);
 
index f861c85..696a962 100644 (file)
 #include <widget_install/job_widget_install.h>
 #include <widget_install/widget_install_errors.h>
 #include <widget_install/widget_install_context.h>
-//#include <dpl/wrt-dao-ro/config_parser_data.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
+#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/foreach.h>
 #include <dpl/utils/wrt_utility.h>
 #include <dpl/log/log.h>
 #include <dpl/assert.h>
-//#include <dpl/wrt-dao-ro/global_config.h>
 #include <string>
 #include <sstream>
+#include <ace_api_install.h>
+#include <ace_registration.h>
+#include <errno.h>
+#include <string.h>
+#include <vconf.h>
 
 using namespace WrtDB;
 
 namespace Jobs {
 namespace WidgetInstall {
+
 TaskDatabase::TaskDatabase(InstallerContext& context) :
     DPL::TaskDecl<TaskDatabase>(this),
-    m_context(context)
+    m_context(context),
+    m_handleToRemove(INVALID_WIDGET_HANDLE),
+    m_handle(INVALID_WIDGET_HANDLE)
 {
     AddStep(&TaskDatabase::StepRegisterExternalFiles);
-    AddStep(&TaskDatabase::StepDBInsert);
+    AddStep(&TaskDatabase::StepWrtDBInsert);
+    AddStep(&TaskDatabase::StepAceDBInsert);
+    AddStep(&TaskDatabase::StepRemoveExternalFiles);
+    AddStep(&TaskDatabase::StepCreateVconf);
 
     AddAbortStep(&TaskDatabase::StepAbortDBInsert);
 }
 
-void TaskDatabase::StepDBInsert()
+void TaskDatabase::StepWrtDBInsert()
 {
     Try
     {
@@ -59,11 +69,15 @@ void TaskDatabase::StepDBInsert()
 
         if (m_context.existingWidgetInfo.isExist) //update
         {
+            m_handleToRemove = WidgetDAOReadOnly::getHandle(
+                m_context.locations->getPkgname());
             LogInfo("Registering widget... (update)");
             WidgetDAO::registerOrUpdateWidget(
                     m_context.locations->getPkgname(),
                     m_context.widgetConfig,
                     m_context.wacSecurity);
+            m_handle = WidgetDAOReadOnly::getHandle(
+                m_context.locations->getPkgname());
         }
         else //new installation
         {
@@ -72,6 +86,8 @@ void TaskDatabase::StepDBInsert()
                     m_context.locations->getPkgname(),
                     m_context.widgetConfig,
                     m_context.wacSecurity);
+            m_handle = WidgetDAOReadOnly::getHandle(
+                m_context.locations->getPkgname());
         }
 
         FOREACH (cap, m_context.staticPermittedDevCaps) {
@@ -91,6 +107,27 @@ void TaskDatabase::StepDBInsert()
         LogError("Database failure!");
         ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!");
     }
+}
+
+void TaskDatabase::StepAceDBInsert()
+{
+    LogDebug("Inserting Ace database entry. New handle: " << m_handle);
+    if (INVALID_WIDGET_HANDLE != m_handleToRemove) {
+        LogDebug("Removing old insallation. Handle: " << m_handleToRemove);
+        if (ACE_OK != ace_unregister_widget(
+                static_cast<ace_widget_handle_t>(m_handleToRemove)))
+        {
+            LogWarning("Error while removing ace entry for previous insallation");
+        };
+    }
+
+    if(!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
+                                  m_context.wacSecurity.getCertificateList()))
+    {
+        LogError("ace database insert failed");
+        ThrowMsg(Exceptions::NotAllowed, "Update failure. ace_register_widget failed");
+    }
+    LogDebug("Ace data inserted");
 
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_NEW_DB_INSERT,
@@ -104,28 +141,11 @@ void TaskDatabase::StepRegisterExternalFiles()
     {
         WidgetDAO dao(m_context.locations->getPkgname());
         WrtDB::ExternalLocationList externalLocationsDB = dao.getWidgetExternalLocations();
-        LogDebug("Removing external files:");
         FOREACH(file, externalLocationsDB)
         {
             if(std::find(externalLocationsUpdate.begin(), externalLocationsUpdate.end(), *file) == externalLocationsUpdate.end())
             {
-                if(WrtUtilFileExists(*file))
-                {
-                    LogDebug("  -> " << *file);
-                    remove(file->c_str());
-                }
-                else if(WrtUtilDirExists(*file))
-                {
-                    LogDebug("  -> " << *file);
-                    if(!WrtUtilRemove(*file)){
-                        ThrowMsg(Exceptions::RemovingFolderFailure,
-                                "Failed to remove external directory");
-                    }
-                }
-                else
-                {
-                    LogWarning("  -> " << *file << "(no such a path)");
-                }
+                m_externalLocationsToRemove.push_back(*file);
             }
         }
     }
@@ -135,23 +155,97 @@ void TaskDatabase::StepRegisterExternalFiles()
         LogDebug("  -> " << *file);
     }
 
-    //set external lcoations to be registered
+    //set external locations to be registered
     m_context.widgetConfig.externalLocations = externalLocationsUpdate;
 }
 
+void TaskDatabase::StepRemoveExternalFiles()
+{
+    if(!m_externalLocationsToRemove.empty())
+    {
+        LogDebug("Removing external files:");
+    }
+
+    FOREACH(file, m_externalLocationsToRemove)
+    {
+        if(WrtUtilFileExists(*file))
+        {
+            LogDebug("  -> " << *file);
+            remove(file->c_str());
+        }
+        else if(WrtUtilDirExists(*file))
+        {
+            LogDebug("  -> " << *file);
+            if(!WrtUtilRemove(*file)){
+                ThrowMsg(Exceptions::RemovingFolderFailure,
+                        "Failed to remove external directory");
+            }
+        }
+        else
+        {
+            LogWarning("  -> " << *file << "(no such a path)");
+        }
+    }
+}
+
+void TaskDatabase::StepCreateVconf()
+{
+    LogDebug("StepCreateVconf");
+    std::string popupUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyPopupUsage(
+            m_context.locations->getPkgname());
+    std::string geolocationUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
+            m_context.locations->getPkgname());
+    std::string webNotificationUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
+            m_context.locations->getPkgname());
+    std::string webDatabaseUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
+            m_context.locations->getPkgname());
+    std::string filesystemUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyFilesystemUsage(
+            m_context.locations->getPkgname());
+    std::string memorySavingModeKey =
+        WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
+            m_context.locations->getPkgname());
+
+    vconf_set_int(popupUsageKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
+    // prevent permission error
+    vconf_unset(popupUsageKey.c_str());
+    vconf_set_int(popupUsageKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
+    vconf_set_int(geolocationUsageKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
+    vconf_set_int(webNotificationUsageKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
+    vconf_set_int(webDatabaseUsageKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
+    vconf_set_int(filesystemUsageKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
+    vconf_set_int(memorySavingModeKey.c_str(),
+                  static_cast<int>(WrtDB::SETTINGS_TYPE_OFF));
+}
+
 void TaskDatabase::StepAbortDBInsert()
 {
     LogWarning("[DB Update Task] Aborting... (DB Clean)");
     Try
     {
         WidgetDAO::unregisterWidget(m_context.locations->getPkgname());
-
         LogDebug("Cleaning DB successful!");
     }
     Catch(DPL::DB::SqlConnection::Exception::Base)
     {
         LogError("Failed to handle StepAbortDBClean!");
     }
+
+    ace_unregister_widget(static_cast<ace_widget_handle_t>(m_handle));
+    // Remove also old one. If it was already updated nothing wrong will happen,
+    // but if not old widget will be removed.
+    if (INVALID_WIDGET_HANDLE != m_handleToRemove)
+        ace_unregister_widget(static_cast<ace_widget_handle_t>(m_handle));
 }
 
 } //namespace WidgetInstall
index ce01985..f2098bc 100644 (file)
@@ -24,6 +24,9 @@
 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DATABASE_H
 
 #include <dpl/task.h>
+#include <dpl/wrt-dao-ro/common_dao_types.h>
+
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 
 class InstallerContext;
 
@@ -34,9 +37,18 @@ class TaskDatabase:
 {
   private:
     InstallerContext& m_context;
+    WrtDB::ExternalLocationList m_externalLocationsToRemove;
+
+    //TODO: temporary needed until security-server start to use pkgName instead
+    //of widget handle
+    WrtDB::DbWidgetHandle m_handleToRemove;
+    WrtDB::DbWidgetHandle m_handle;
 
-    void StepDBInsert();
     void StepRegisterExternalFiles();
+    void StepWrtDBInsert();
+    void StepAceDBInsert();
+    void StepRemoveExternalFiles();
+    void StepCreateVconf();
 
     void StepAbortDBInsert();
 
diff --git a/src/jobs/widget_install/task_db_update.cpp b/src/jobs/widget_install/task_db_update.cpp
deleted file mode 100644 (file)
index 5b02a95..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/**
- * @file    task_db_update.cpp
- * @author  Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @version 1.0
- * @brief   Implementation file for installer task database updating
- */
-//#include <time.h>
-#include <widget_install/task_db_update.h>
-#include <widget_install/job_widget_install.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-#include <dpl/wrt-dao-ro/config_parser_data.h>
-#include <dpl/utils/wrt_utility.h>
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/log/log.h>
-#include <dpl/assert.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <string>
-#include <Ecore_File.h>
-#include <sstream>
-
-using namespace WrtDB;
-
-namespace Jobs {
-namespace WidgetInstall {
-TaskDbUpdate::TaskDbUpdate(InstallerContext& context) :
-    DPL::TaskDecl<TaskDbUpdate>(this),
-    m_context(context)
-{
-    AddStep(&TaskDbUpdate::StepDbUpdate);
-
-    AddAbortStep(&TaskDbUpdate::StepAbortDBUpdate);
-}
-
-void TaskDbUpdate::StepDbUpdate()
-{
-    Try
-    {
-        // If there is existing model, remove its database data
-        if (true == m_context.existingWidgetInfo.isExist) {
-            WidgetHandle old = m_context.existingWidgetInfo.existingHandle;
-            LogInfo("Unregistering widget...: " << old);
-            WidgetDAO::unregisterWidget(old);
-            LogInfo("Widget unregistered");
-        }
-
-        /* Set install Time */
-        time(&m_context.widgetConfig.installedTime);
-
-        LogInfo("Registering widget...");
-
-        WidgetDAO::registerWidget(
-                *(m_context.widgetHandle),
-                m_context.widgetConfig,
-                m_context.wacSecurity);
-
-        FOREACH (cap, m_context.staticPermittedDevCaps) {
-            LogInfo("staticPermittedDevCaps : " << cap->first
-                    << " smack status: " << cap->second);
-        }
-
-        Assert(!!m_context.widgetConfig.pkgname
-               && "pkgName should be initialized");
-
-        WrtDB::WidgetDAO widgetDao(*m_context.widgetHandle);
-        widgetDao.setPkgName(m_context.widgetConfig.pkgname);
-
-        LogInfo("Widget registered");
-    }
-    Catch(WidgetDAO::Exception::DatabaseError)
-    {
-        LogWarning("Database failure!");
-        ReThrowMsg(Exceptions::DatabaseFailure, "Database failure!");
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base)
-    {
-        LogDebug("Database failure!");
-        ReThrowMsg(Exceptions::DatabaseFailure, "Database failure!");
-    }
-
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_DB_UPDATE,
-        "Widget DB UPDATE Finished");
-}
-
-void TaskDbUpdate::StepAbortDBUpdate()
-{
-    LogWarning("[DB Update Task] Aborting... (DB Clean)");
-    Assert(!!m_context.widgetHandle);
-    Try
-    {
-        WidgetDAO::unregisterWidget(*m_context.widgetHandle);
-
-        LogDebug("Cleaning DB successful!");
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base)
-    {
-        //TODO What should happen here?
-        LogError("Failed to handle StepAbortDBClean!");
-        //        ReThrowMsg(Exceptions::DbStepFailed, "Failed to handle StepAbortDBClean!");
-    }
-}
-
-} //namespace WidgetInstall
-} //namespace Jobs
diff --git a/src/jobs/widget_install/task_db_update.h b/src/jobs/widget_install/task_db_update.h
deleted file mode 100644 (file)
index 3f76680..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/*
- * @file    task_db_update.h
- * @author  Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @version 1.0
- * @brief   Header file for installer task database updating
- */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DB_UPDATE_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DB_UPDATE_H
-
-#include <dpl/task.h>
-
-class InstallerContext;
-
-namespace Jobs {
-namespace WidgetInstall {
-class TaskDbUpdate :
-    public DPL::TaskDecl<TaskDbUpdate>
-{
-  private:
-    InstallerContext& m_context;
-
-    void StepDbUpdate();
-
-    void StepAbortDBUpdate();
-
-  public:
-    TaskDbUpdate(InstallerContext& context);
-};
-} //namespace WidgetInstall
-} //namespace Jobs
-
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_DB_UPDATE_H
index 9b0bdb4..2ea97ee 100644 (file)
@@ -27,6 +27,8 @@
 #include <string>
 #include <sys/stat.h>
 #include <fts.h>
+#include <string.h>
+#include <errno.h>
 
 #include <dpl/log/log.h>
 #include <dpl/errno_string.h>
@@ -161,17 +163,24 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
             memset(readBuf, 0, fileSize);
             memset(outEncBuf, 0, blockSize);
 
-            fread(readBuf, sizeof(unsigned char), fileSize, resFp);
-            fclose(resFp);
+            ret = fread(readBuf, sizeof(unsigned char), fileSize, resFp);
+            if (ret!=fileSize){
+                LogError("Failed to read ecryption buffer with error: " << strerror(errno) );
+                fclose(resFp);
+               return;
+            }
 
             m_resEnc->EncryptChunk(readBuf, outEncBuf, fileSize);
 
             FILE* encFp = fopen(encFile.c_str(), "w");
             if (NULL == encFp) {
                 LogError("Failed to open ecryption file");
+                fclose(resFp);
                 return;
             }
             fwrite(outEncBuf, sizeof(unsigned char), blockSize, encFp);
+
+            fclose(resFp);
             fclose(encFp);
 
             LogDebug("Success to encrypt file");
index ae02d73..a41239e 100644 (file)
@@ -20,6 +20,7 @@
  * @brief   Implementation file for installer task database updating
  */
 #include <sys/stat.h>
+#include <dirent.h>
 #include <widget_install/task_file_manipulation.h>
 #include <widget_install/job_widget_install.h>
 #include <widget_install/widget_install_errors.h>
 #include <dpl/foreach.h>
 #include <dpl/log/log.h>
 #include <dpl/assert.h>
+#include <dpl/utils/folder_size.h>
 #include <string>
+#include <fstream>
+#include <widget_install_to_external.h>
+
+#define WEBAPP_DEFAULT_UID  5000
+#define WEBAPP_DEFAULT_GID  5000
+
+namespace {
+const mode_t PRIVATE_STORAGE_MODE = 0700;
+const mode_t SHARE_MODE = 0705;
+}
 
 using namespace WrtDB;
 
+namespace {
+const char* GLIST_RES_DIR = "res";
+const char* GLIST_BIN_DIR = "bin";
+
+bool _FolderCopy(std::string source, std::string dest)
+{
+    DIR* dir = opendir(source.c_str());
+    if (NULL == dir) {
+        return false;
+    }
+
+    struct dirent* dEntry = NULL;
+    do {
+        struct stat statInfo;
+        if (dEntry = readdir(dir)) {
+            std::string fileName = dEntry->d_name;
+            std::string fullName = source + "/" + fileName;
+
+            if (stat(fullName.c_str(), &statInfo) != 0) {
+                return false;
+            }
+
+            if (S_ISDIR(statInfo.st_mode)) {
+                if(("." == fileName) || (".." == fileName)) {
+                    continue;
+                }
+                std::string destFolder = dest + "/" + fileName;
+                WrtUtilMakeDir(destFolder);
+
+                if (!_FolderCopy(fullName, destFolder)) {
+                    return false;
+                }
+            }
+
+            std::string destFile = dest + "/" + fileName;
+            std::ifstream infile(fullName);
+            std::ofstream outfile(destFile);
+            outfile << infile.rdbuf();
+            outfile.close();
+            infile.close();
+        }
+    } while(dEntry);
+    closedir(dir);
+    return true;
+}
+}
+
 namespace Jobs {
 namespace WidgetInstall {
 TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
     DPL::TaskDecl<TaskFileManipulation>(this),
     m_context(context)
 {
-    AddStep(&TaskFileManipulation::StepCreateDirs);
-    AddStep(&TaskFileManipulation::StepRenamePath);
+    if (INSTALL_LOCATION_TYPE_EXTERNAL !=
+            m_context.locationType) {
+        AddStep(&TaskFileManipulation::StepCreateDirs);
+        AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
+        AddStep(&TaskFileManipulation::StepCreateShareDir);
+        if (m_context.widgetConfig.packagingType !=
+                WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+        {
+            AddStep(&TaskFileManipulation::StepRenamePath);
+            AddAbortStep(&TaskFileManipulation::StepAbortRenamePath);
+        }
+    } else {
+        AddStep(&TaskFileManipulation::StepPrepareExternalDir);
+        AddStep(&TaskFileManipulation::StepInstallToExternal);
+        AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
+        AddStep(&TaskFileManipulation::StepCreateShareDir);
 
-    AddAbortStep(&TaskFileManipulation::StepAbortRenamePath);
+        AddAbortStep(&TaskFileManipulation::StepAbortCreateExternalDir);
+    }
 }
 
 void TaskFileManipulation::StepCreateDirs()
@@ -74,6 +148,91 @@ void TaskFileManipulation::StepCreateDirs()
         "Widget Directory Created");
 }
 
+void TaskFileManipulation::StepCreatePrivateStorageDir()
+{
+    std::string storagePath = m_context.locations->getPrivateStorageDir();
+
+    if (euidaccess(storagePath.c_str(), F_OK) != 0) {
+        if(!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)){
+            LogError("Failed to create directory for private storage");
+            ThrowMsg(Exceptions::InternalError,
+                    "Failed to create directory for private storage");
+        }
+        // '5000' is default uid, gid for applications.
+        // So installed applications should be launched as process of uid '5000'.
+        // the process can access private directory 'data' of itself.
+        if(chown(storagePath.c_str(),
+                 WEBAPP_DEFAULT_UID,
+                 WEBAPP_DEFAULT_GID) != 0)
+        {
+            ThrowMsg(Exceptions::InternalError,
+                 "Chown to invaild user");
+        }
+    } else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
+        LogInfo("Private storage already exists.");
+        // Even if private directory already is created, private dircetory
+        // should change owner.
+        if(chown(storagePath.c_str(),
+                 WEBAPP_DEFAULT_UID,
+                 WEBAPP_DEFAULT_GID) != 0)
+        {
+            ThrowMsg(Exceptions::InternalError,
+                 "Chown to invaild user");
+        }
+        if(chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
+            ThrowMsg(Exceptions::InternalError,
+                 "chmod to 0700");
+        }
+
+    } else {
+        ThrowMsg(Exceptions::InternalError,
+                 "No access to private storage.");
+    }
+}
+
+void TaskFileManipulation::StepCreateShareDir()
+{
+    std::string sharePath = m_context.locations->getShareDir();
+
+    if (euidaccess(sharePath.c_str(), F_OK) != 0) {
+        if(!WrtUtilMakeDir(sharePath, SHARE_MODE)){
+            LogError("Failed to create directory for share");
+            ThrowMsg(Exceptions::InternalError,
+                    "Failed to create directory for share");
+        }
+        // '5000' is default uid, gid for applications.
+        // So installed applications should be launched as process of uid '5000'.
+        // the process can access private directory 'data' of itself.
+        if(chown(sharePath.c_str(),
+                 WEBAPP_DEFAULT_UID,
+                 WEBAPP_DEFAULT_GID) != 0)
+        {
+            ThrowMsg(Exceptions::InternalError,
+                 "Chown to invaild user");
+        }
+    } else if (euidaccess(sharePath.c_str(), W_OK | R_OK | X_OK) == 0) {
+        LogInfo("Share directory already exists.");
+        // Even if share directory already is created, share dircetory
+        // should change owner.
+        if(chown(sharePath.c_str(),
+                 WEBAPP_DEFAULT_UID,
+                 WEBAPP_DEFAULT_GID) != 0)
+        {
+            ThrowMsg(Exceptions::InternalError,
+                 "Chown to invaild user");
+        }
+        if(chmod(sharePath.c_str(), SHARE_MODE) != 0) {
+            ThrowMsg(Exceptions::InternalError,
+                 "chmod to 0700");
+        }
+
+    } else {
+        ThrowMsg(Exceptions::InternalError,
+                 "No access to private storage.");
+    }
+
+}
+
 void TaskFileManipulation::StepRenamePath()
 {
     std::string instDir;
@@ -98,7 +257,6 @@ void TaskFileManipulation::StepRenamePath()
         ThrowMsg(Exceptions::UnknownError,
                 "Error occurs during renaming widget folder");
     }
-
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_RENAME_PATH,
         "Widget Rename path Finished");
@@ -108,21 +266,90 @@ void TaskFileManipulation::StepAbortRenamePath()
 {
     LogDebug("[Rename Widget Path] Aborting.... (Rename path)");
     std::string widgetPath;
-    if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) {
+    if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
         widgetPath = m_context.locations->getPackageInstallationDir();
-    } else {
-        widgetPath = m_context.locations->getSourceDir();
+        if (!WrtUtilRemove(widgetPath)) {
+            ThrowMsg(Exceptions::RemovingFolderFailure,
+                    "Error occurs during removing existing folder");
+        }
     }
-    struct stat fileInfo;
-    if (stat(widgetPath.c_str(), &fileInfo) != 0) {
-        LogError("Failed to get widget file path : " << widgetPath);
-        return;
+    LogDebug("Rename widget path sucessful!");
+}
+
+void TaskFileManipulation::StepPrepareExternalDir()
+{
+    LogDebug("Step prepare to install in exernal directory");
+    Try {
+        std::string pkgname =
+            DPL::ToUTF8String(*m_context.widgetConfig.pkgname);
+
+        WidgetInstallToExtSingleton::Instance().initialize(pkgname);
+
+        size_t totalSize =
+            Utils::getFolderSize(m_context.locations->getTemporaryPackageDir());
+
+        int folderSize = (int)(totalSize / (1024 * 1024)) + 1;
+
+        GList *list = NULL;
+        app2ext_dir_details* dirDetail = NULL;
+
+        std::string dirNames[2] = {GLIST_RES_DIR, GLIST_BIN_DIR};
+
+        for (int i = 0; i < 2; i++) {
+            dirDetail = (app2ext_dir_details*) calloc(1,
+                    sizeof(app2ext_dir_details));
+            if (NULL == dirDetail) {
+                ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "error in app2ext");
+            }
+            dirDetail->name = strdup(dirNames[i].c_str());
+            dirDetail->type = APP2EXT_DIR_RO;
+            list = g_list_append(list, dirDetail);
+        }
+
+        if (false == m_context.existingWidgetInfo.isExist) {
+            WidgetInstallToExtSingleton::Instance().preInstallation(list,
+                    folderSize);
+        } else {
+            WidgetInstallToExtSingleton::Instance().preUpgrade(list,
+                    folderSize);
+        }
+        free(dirDetail);
+        g_list_free(list);
+    }
+    Catch (WidgetInstallToExt::Exception::ErrorInstallToExt)
+    {
+        ReThrowMsg(Exceptions::ErrorExternalInstallingFailure, "Error during \
+                create external folder ");
     }
+}
 
-    if (!(rename(widgetPath.c_str(), m_context.locations->getTemporaryPackageDir().c_str()) == 0)) {
-        LogError("Failed to rename");
+void TaskFileManipulation::StepInstallToExternal()
+{
+    LogDebug("StepInstallExternal");
+    if (!WrtUtilMakeDir(m_context.locations->getSourceDir())) {
+        ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "To make src \
+                directory failed");
     }
-    LogDebug("Rename widget path sucessful!");
+
+    LogDebug("Resource move to external storage " <<
+            m_context.locations->getSourceDir());
+    if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(),
+                m_context.locations->getSourceDir()))
+    {
+        ThrowMsg(Exceptions::UnknownError,
+                "Error occurs during renaming widget folder");
+    }
+}
+
+void TaskFileManipulation::StepAbortCreateExternalDir()
+{
+    LogError("Abort StepAbortCreateExternalDir");
+    if (false == m_context.existingWidgetInfo.isExist) {
+        WidgetInstallToExtSingleton::Instance().postInstallation(false);
+    } else {
+        WidgetInstallToExtSingleton::Instance().postUpgrade(false);
+    }
+    WidgetInstallToExtSingleton::Instance().deinitialize();
 }
 } //namespace WidgetInstall
 } //namespace Jobs
index 162dbbf..e3f615e 100644 (file)
@@ -23,6 +23,7 @@
 #define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_FILE_MANIPULATION_UPDATE_H
 
 #include <dpl/task.h>
+#include <app2ext_interface.h>
 
 class InstallerContext;
 
@@ -31,14 +32,23 @@ namespace WidgetInstall {
 class TaskFileManipulation :
     public DPL::TaskDecl<TaskFileManipulation>
 {
-  private:
     InstallerContext& m_context;
+    app2ext_handle *m_extHandle;
 
+    // install internal location
     void StepCreateDirs();
     void StepRenamePath();
+    void StepCreatePrivateStorageDir();
+    void StepCreateShareDir();
 
     void StepAbortRenamePath();
 
+    // install external location
+    void StepPrepareExternalDir();
+    void StepInstallToExternal();
+    void StepFinishExternalInstallation();
+    void StepAbortCreateExternalDir();
+
   public:
     TaskFileManipulation(InstallerContext& context);
 };
old mode 100644 (file)
new mode 100755 (executable)
index 3acb023..908109a
@@ -56,6 +56,9 @@ using namespace WrtDB;
 namespace {
 typedef std::map<DPL::String, DPL::String> LanguageTagMap;
 
+const char* const ST_TRUE = "true";
+const char* const ST_NODISPLAY = "nodisplay";
+
 LanguageTagMap getLanguageTagMap()
 {
     LanguageTagMap map;
@@ -107,6 +110,8 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddStep(&TaskManifestFile::stepGenerateManifest);
         AddStep(&TaskManifestFile::stepParseManifest);
         AddStep(&TaskManifestFile::stepFinalize);
+
+        AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
     } else {
     // for widget update.
         AddStep(&TaskManifestFile::stepBackupIconFiles);
@@ -545,6 +550,8 @@ void TaskManifestFile::writeManifest(const DPL::String & path)
     setWidgetManifest(manifest);
     setWidgetOtherInfo(uiApp);
     setAppServiceInfo(uiApp);
+    setAppCategory(uiApp);
+    setLiveBoxInfo(manifest);
 
     manifest.addUiApplication(uiApp);
     manifest.generate(path);
@@ -727,7 +734,17 @@ void TaskManifestFile::setWidgetManifest(Manifest & manifest)
 
 void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
 {
-    uiApp.setNodisplay(false);
+    FOREACH(it, m_context.widgetConfig.configInfo.settingsList)
+    {
+         if(!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
+             if(!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
+                uiApp.setNodisplay(true);
+             }
+             else {
+                uiApp.setNodisplay(false);
+            }
+         }
+     }
     //TODO
     //There is no "X-TIZEN-PackageType=wgt"
     //There is no X-TIZEN-PackageID in manifest "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str()
@@ -746,19 +763,138 @@ void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp)
 
     // x-tizen-svc=http://tizen.org/appcontrol/operation/pick|NULL|image;
     FOREACH(it, appServiceList) {
-        ApplicationService appService;
+        AppControl appControl;
         if (!it->m_operation.empty()) {
-            appService.addOperation(it->m_operation); //TODO: encapsulation?
+            appControl.addOperation(it->m_operation); //TODO: encapsulation?
         }
         if (!it->m_scheme.empty()) {
-            appService.addUri(it->m_scheme);
+            appControl.addUri(it->m_scheme);
         }
         if (!it->m_mime.empty()) {
-            appService.addMime(it->m_mime);
+            appControl.addMime(it->m_mime);
+        }
+        uiApp.addAppControl(appControl);
+    }
+}
+
+void TaskManifestFile::setAppCategory(UiApplication &uiApp)
+{
+    WrtDB::ConfigParserData::CategoryList categoryList =
+        m_context.widgetConfig.configInfo.categoryList;
+
+    if (categoryList.empty()) {
+        LogInfo("Widget doesn't contain application category");
+        return;
+    }
+    FOREACH(it, categoryList) {
+        if (!(*it).empty()) {
+            uiApp.addAppCategory(*it);
         }
-        uiApp.addApplicationService(appService);
     }
 }
 
+void TaskManifestFile::stepAbortParseManifest()
+{
+    LogError("[Parse Manifest] Abroting....");
+
+    int code = pkgmgr_parser_parse_manifest_for_uninstallation(
+            DPL::ToUTF8String(manifest_file).c_str(), NULL);
+
+    if (0 != code)
+    {
+        LogWarning("Manifest parser error: " << code);
+        ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
+    }
+    int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
+    if (0 != ret)
+    {
+        LogWarning("No manifest file found: " << manifest_file);
+    }
+}
+
+void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
+{
+    FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
+        LogInfo("setLiveBoxInfo");
+        LiveBoxInfo liveBox;
+        DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
+        DPL::String pkgname = *m_context.widgetConfig.pkgname;
+        size_t found;
+
+        if(ConfigInfo->m_liveboxId != L"") {
+            found = ConfigInfo->m_liveboxId.find_first_of(L".");
+            if(found != std::string::npos) {
+                if(0 == ConfigInfo->m_liveboxId.compare(0, found, pkgname))
+                    liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
+                else {
+                    DPL::String liveboxId =
+                        pkgname+DPL::String(L".")+ConfigInfo->m_liveboxId;
+                    liveBox.setLiveboxId(liveboxId);
+                }
+            } else {
+                DPL::String liveboxId =
+                    pkgname+DPL::String(L".")+ConfigInfo->m_liveboxId;
+                liveBox.setLiveboxId(liveboxId);
+            }
+        }
+
+        if(ConfigInfo->m_primary != L"")
+            liveBox.setPrimary(ConfigInfo->m_primary);
+
+        if(ConfigInfo->m_autoLaunch == L"true")
+            liveBox.setAutoLaunch(pkgname);
+
+        if(ConfigInfo->m_updatePeriod != L"")
+            liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
+
+        if(ConfigInfo->m_label != L"")
+            liveBox.setLabel(ConfigInfo->m_label);
+
+        DPL::String defaultLocale
+            = DPL::FromUTF8String(m_context.locations->getPackageInstallationDir())
+            + DPL::String(L"/res/wgt/");
+
+        if(ConfigInfo->m_icon!=L"") {
+            liveBox.setIcon(defaultLocale+ConfigInfo->m_icon);
+        }
+
+        if (ConfigInfo->m_boxInfo.m_boxSrc.empty() || ConfigInfo->m_boxInfo.m_boxSize.empty()) {
+            LogInfo("Widget doesn't contain box");
+            return;
+        } else {
+            BoxInfoType box;
+            if (!ConfigInfo->m_boxInfo.m_boxSrc.empty()) {
+                if((0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 4, L"http"))
+                        || (0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 5, L"https")))
+                    box.boxSrc = ConfigInfo->m_boxInfo.m_boxSrc;
+                else
+                    box.boxSrc = defaultLocale + ConfigInfo->m_boxInfo.m_boxSrc;
+            }
+
+            std::list<std::pair<DPL::String,DPL::String>> BoxSizeList
+                = ConfigInfo->m_boxInfo.m_boxSize;
+            FOREACH(im, BoxSizeList) {
+                std::pair<DPL::String, DPL::String> boxSize = *im;
+                if(!boxSize.second.empty())
+                    boxSize.second = defaultLocale + boxSize.second;
+                box.boxSize.push_back(boxSize);
+            }
+
+            if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
+                    && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
+                    && !ConfigInfo->m_boxInfo.m_pdHeight.empty()) {
+                box.pdSrc = defaultLocale + ConfigInfo->m_boxInfo.m_pdSrc;
+                box.pdWidth = ConfigInfo->m_boxInfo.m_pdWidth;
+                box.pdHeight = ConfigInfo->m_boxInfo.m_pdHeight;
+            }
+
+            liveBox.setBox(box);
+        }
+
+        manifest.addLivebox(liveBox);
+    }
+
+}
+
 } //namespace WidgetInstall
 } //namespace Jobs
old mode 100644 (file)
new mode 100755 (executable)
index 86edffe..191bc49
@@ -68,6 +68,8 @@ class TaskManifestFile :
     void stepParseManifest();
     void stepParseUpgradedManifest();
 
+    void stepAbortParseManifest();
+
     //For widget update
     void stepBackupIconFiles();
     void stepUpdateFinalize();
@@ -93,6 +95,8 @@ class TaskManifestFile :
     void setWidgetManifest(Manifest & manifest);
     void setWidgetOtherInfo(UiApplication & uiApp);
     void setAppServiceInfo(UiApplication & uiApp);
+    void setAppCategory(UiApplication & uiApp);
+    void setLiveBoxInfo(Manifest& manifest);
 
     void generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved);
     void generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag, const DPL::String& language, bool & defaultIconSaved);
diff --git a/src/jobs/widget_install/task_new_db_insert.cpp b/src/jobs/widget_install/task_new_db_insert.cpp
deleted file mode 100644 (file)
index 38e9d92..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/**
- * @file    task_new_db_insert.cpp
- * @author  Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @author  Soyoung kim(sy037.kim@samsung.com)
- * @version 1.0
- * @brief   Implementation file for installer task database updating for widget update
- */
-#include <time.h>
-#include <sys/stat.h>
-#include <widget_install/task_new_db_insert.h>
-#include <widget_install/job_widget_install.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-//#include <dpl/wrt-dao-ro/config_parser_data.h>
-#include <dpl/wrt-dao-rw/widget_dao.h>
-#include <dpl/foreach.h>
-#include <dpl/log/log.h>
-#include <dpl/assert.h>
-//#include <dpl/wrt-dao-ro/global_config.h>
-#include <string>
-#include <sstream>
-
-using namespace WrtDB;
-
-namespace Jobs {
-namespace WidgetInstall {
-TaskNewDbInsert::TaskNewDbInsert(InstallerContext& context) :
-    DPL::TaskDecl<TaskNewDbInsert>(this),
-    m_context(context)
-{
-    AddStep(&TaskNewDbInsert::StepDBInsert);
-
-    AddAbortStep(&TaskNewDbInsert::StepAbortDBInsert);
-}
-
-void TaskNewDbInsert::StepDBInsert()
-{
-    Try
-    {
-        /* Set install Time */
-        time(&m_context.widgetConfig.installedTime);
-
-        LogInfo("Registering widget...");
-
-        WidgetDAO::registerWidget(
-                *(m_context.widgetHandle),
-                m_context.widgetConfig,
-                m_context.wacSecurity);
-
-        FOREACH (cap, m_context.staticPermittedDevCaps) {
-            LogInfo("staticPermittedDevCaps : " << cap->first
-                    << " smack status: " << cap->second);
-        }
-
-        Assert(!!m_context.widgetConfig.pkgname
-               && "pkgName should be initialized");
-
-        WrtDB::WidgetDAO widgetDao(*m_context.widgetHandle);
-        widgetDao.setPkgName(m_context.widgetConfig.pkgname);
-
-        LogInfo("Widget registered");
-    }
-    Catch(WidgetDAO::Exception::DatabaseError)
-    {
-        LogWarning("Database failure!");
-        ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!");
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base)
-    {
-        LogDebug("Database failure!");
-        ReThrowMsg(Exceptions::InsertNewWidgetFailed, "Database failure!");
-    }
-
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_NEW_DB_INSERT,
-        "New Widget DB UPDATE Finished");
-}
-
-void TaskNewDbInsert::StepAbortDBInsert()
-{
-    LogWarning("[DB Update Task] Aborting... (DB Clean)");
-    Assert(!!m_context.widgetHandle);
-    Try
-    {
-        WidgetDAO::unregisterWidget(*m_context.widgetHandle);
-
-        LogDebug("Cleaning DB successful!");
-    }
-    Catch(DPL::DB::SqlConnection::Exception::Base)
-    {
-        LogError("Failed to handle StepAbortDBClean!");
-    }
-}
-
-} //namespace WidgetInstall
-} //namespace Jobs
diff --git a/src/jobs/widget_install/task_new_db_insert.h b/src/jobs/widget_install/task_new_db_insert.h
deleted file mode 100644 (file)
index 13290d4..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/*
- * @file    task_new_db_insert.h
- * @author  Lukasz Wrzosek(l.wrzosek@samsung.com)
- * @author  Soyoung kim(sy037.kim@samsung.com)
- * @version 1.0
- * @brief   Header file for installer task database updating for widget update
- */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_NEW_DB_INSERT_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_NEW_DB_INSERT_H
-
-#include <dpl/task.h>
-
-class InstallerContext;
-
-namespace Jobs {
-namespace WidgetInstall {
-class TaskNewDbInsert:
-    public DPL::TaskDecl<TaskNewDbInsert>
-{
-  private:
-    InstallerContext& m_context;
-
-    void StepDBInsert();
-
-    void StepAbortDBInsert();
-
-  public:
-    TaskNewDbInsert(InstallerContext& context);
-};
-} //namespace WidgetInstall
-} //namespace Jobs
-
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_NEW_DB_INSERT_H
diff --git a/src/jobs/widget_install/task_private_storage.cpp b/src/jobs/widget_install/task_private_storage.cpp
deleted file mode 100644 (file)
index 8d9934f..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/**
- * @file    installer_task_private_storage.cpp
- * @author  Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- * @version 1.0
- * @brief   Implementation file for installer task private storage.
- */
-#include "task_private_storage.h"
-
-#include <pwd.h>
-#include <grp.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string>
-
-#include <dpl/log/log.h>
-#include <dpl/errno_string.h>
-
-#include <dpl/wrt-dao-ro/widget_config.h>
-#include <dpl/utils/wrt_utility.h>
-#include <widget_install/job_widget_install.h>
-#include <widget_install/widget_install_context.h>
-#include <widget_install/widget_install_errors.h>
-
-#define WEBAPP_DEFAULT_UID  5000
-#define WEBAPP_DEFAULT_GID  5000
-
-namespace {
-const mode_t PRIVATE_STORAGE_MODE = 0700;
-}
-
-namespace Jobs {
-namespace WidgetInstall {
-TaskPrivateStorage::TaskPrivateStorage(InstallerContext& context) :
-    DPL::TaskDecl<TaskPrivateStorage>(this),
-    m_context(context)
-{
-    AddStep(&TaskPrivateStorage::StepCreateDirectory);
-}
-
-void TaskPrivateStorage::StepCreateDirectory()
-{
-    using namespace WrtDB;
-
-    LogInfo("Step: Creating private storage directory.");
-
-    m_context.installStep =
-        InstallerContext::INSTALL_CREATE_PRIVATE_STORAGE;
-
-    std::ostringstream widgetPath;
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if(!pkgname.IsNull()) {
-        widgetPath << m_context.locations->getPackageInstallationDir() << "/";
-    } else {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
-
-    if (euidaccess(widgetPath.str().c_str(), W_OK | X_OK) != 0) {
-        ThrowMsg(Exceptions::InternalError, DPL::GetErrnoString());
-    }
-
-    std::ostringstream storagePath;
-    storagePath << widgetPath.str().c_str()
-                << GlobalConfig::GetWidgetPrivateStoragePath();
-
-    if (euidaccess(storagePath.str().c_str(), F_OK) != 0) {
-        if(!WrtUtilMakeDir(storagePath.str(), PRIVATE_STORAGE_MODE)){
-            LogError("Failed to create directory for private storage");
-            ThrowMsg(Exceptions::InternalError,
-                    "Failed to create directory for private storage");
-        }
-        // '5000' is default uid, gid for applications.
-        // So installed applications should be launched as process of uid '5000'.
-        // the process can access private directory 'data' of itself.
-        if(chown(storagePath.str().c_str(),
-                 WEBAPP_DEFAULT_UID,
-                 WEBAPP_DEFAULT_GID) != 0)
-        {
-            ThrowMsg(Exceptions::InternalError,
-                 "Chown to invaild user");
-        }
-    } else if (euidaccess(storagePath.str().c_str(), W_OK | R_OK | X_OK) == 0) {
-        LogInfo("Private storage already exists.");
-        // Even if private directory already is created, private dircetory
-        // should change owner.
-        if(chown(storagePath.str().c_str(),
-                 WEBAPP_DEFAULT_UID,
-                 WEBAPP_DEFAULT_GID) != 0)
-        {
-            ThrowMsg(Exceptions::InternalError,
-                 "Chown to invaild user");
-        }
-        if(chmod(storagePath.str().c_str(), PRIVATE_STORAGE_MODE) != 0) {
-            ThrowMsg(Exceptions::InternalError,
-                 "chmod to 0700");
-        }
-
-    } else {
-        ThrowMsg(Exceptions::InternalError,
-                 "No access to private storage.");
-    }
-
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_CREATE_PRIVATE_STORAGE,
-        "Private storage created."
-        );
-}
-} //namespace WidgetInstall
-} //namespace Jobs
index 1b922db..bd844ae 100644 (file)
@@ -72,10 +72,6 @@ void TaskRecovery::StepCreateCheckFile()
         m_context.installInfo = infoPath.str();
 
         LogDebug("Create file : " << m_context.installInfo);
-        m_context.job->UpdateProgress(
-                InstallerContext::INSTALL_LINK_DEPENDS_DIRECTORY,
-                "depends directory linked."
-                );
     } else {
         ThrowMsg(Exceptions::InternalError, "Fail to create file for recovery.");
     }
index b19bc19..fb084f6 100644 (file)
@@ -116,6 +116,10 @@ void TaskUnzip::StepUnzipPrepare()
     {
         ReThrowMsg(Exceptions::OpenZipFailed, m_installerContext.locations->getWidgetSource());
     }
+    Catch(DPL::ZipInput::Exception::SeekFileFailed)
+    {
+        ThrowMsg(Exceptions::ExtractFileFailed,"m_installerContext.locations->getWidgetSource()");
+    }
 }
 
 void TaskUnzip::StepUnzipProgress()
index 8423144..bf5301a 100644 (file)
@@ -80,13 +80,14 @@ TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
     AddStep(&TaskWidgetConfig::ProcessLocalizedStartFiles);
     AddStep(&TaskWidgetConfig::ProcessBackgroundPageFile);
     AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
+    AddStep(&TaskWidgetConfig::ProcessWidgetInstalledPath);
     AddStep(&TaskWidgetConfig::StepVerifyFeatures);
+    AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
 
     if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) {
         AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures);
         AddStep(&TaskWidgetConfig::StepShowWidgetInfo);
         AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation);
-        AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
         AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion);
         AddStep(&TaskWidgetConfig::StepDeletePopupWin);
     }
@@ -261,9 +262,9 @@ void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path,
                 if (m_installContext.widgetConfig.webAppType ==
                         APP_TYPE_TIZENWEBAPP)
                 {
-                    const char *startPath =
-                        DPL::ToUTF8String(startFileData.path).c_str();
-                    if (strstr(startPath, "http") == startPath) {
+                    std::string startPath =  DPL::ToUTF8String(startFileData.path);
+
+                    if (strstr(startPath.c_str(), "http") == startPath.c_str()) {
                         WidgetRegisterInfo::StartFileProperties
                             startFileProperties;
                         if (!!type) {
@@ -363,6 +364,13 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
     }
 }
 
+void TaskWidgetConfig::ProcessWidgetInstalledPath()
+{
+    LogDebug("ProcessWidgetInstalledPath");
+    m_installContext.widgetConfig.widgetInstalledPath =
+        DPL::FromUTF8String(m_installContext.locations->getPackageInstallationDir());
+}
+
 void TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures()
 {
     LogDebug("StepCancelWidgetInstallationAfterVerifyFeatures");
@@ -426,8 +434,18 @@ void TaskWidgetConfig::StepCheckMinVersionInfo()
     if (!isMinVersionCompatible(
                 m_installContext.widgetConfig.webAppType.appType,
                 m_installContext.widgetConfig.minVersion)) {
-        std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
-        createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
+        if(!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet)
+        {
+            LogDebug("Platform version to low - launching");
+            std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
+            createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
+        }
+        else
+        {
+            LogError("Platform version lower than required -> cancelling installation");
+            ThrowMsg(Exceptions::NotAllowed,
+                    "Platform version does not meet requirements");
+        }
     }
 
     m_installContext.job->UpdateProgress(
@@ -550,7 +568,9 @@ bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
     LogInfo("FetureName = [" << featureName << "]");
 
     AppType featureType = APP_TYPE_UNKNOWN;
-    const char* feature = DPL::ToUTF8String(featureName).c_str();
+    std::string featureStr = DPL::ToUTF8String(featureName);
+    const char* feature = featureStr.c_str();
+
     // check prefix of  feature name
     if (strstr(feature, PluginsPrefix::TIZENPluginsPrefix) == feature) {
         // Tizen WebApp feature
@@ -629,13 +649,15 @@ bool TaskWidgetConfig::isMinVersionCompatible(WrtDB::AppType appType,
 
     if (!parseVersionString(version,
                 majorSupported, minorSupported, microSupported)) {
-        LogWarning("Invalid format of WAC version string.");
+        LogWarning("Invalid format of platform version string.");
         return true;
     }
 
     if (majorWidget > majorSupported ||
-            minorWidget > minorSupported ||
-            microWidget > microSupported) {
+            (majorWidget == majorSupported && minorWidget > minorSupported) ||
+            (majorWidget == majorSupported && minorWidget == minorSupported
+                    && microWidget > microSupported))
+    {
         LogInfo("Platform doesn't support this widget.");
         return false;
     }
index 740af5f..2b0b7dc 100755 (executable)
@@ -78,6 +78,7 @@ class TaskWidgetConfig :
     void ProcessBackgroundPageFile();
     void ProcessLocalizedIcons();
     void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
+    void ProcessWidgetInstalledPath();
     void StepVerifyFeatures();
     void StepShowWidgetInfo();
     void StepCheckMinVersionInfo();
index 4f81120..6dafd02 100644 (file)
@@ -27,13 +27,6 @@ namespace Jobs {
 namespace WidgetInstall {
 
 void WacSecurity::getCertificateChainList(
-        WrtDB::CertificateChainList& list) const
-{
-    FOREACH(certIter, mCertificateChainList)
-        list.push_back(certIter->toBase64String());
-}
-
-void WacSecurity::getCertificateChainList(
         WrtDB::CertificateChainList& list,
         WrtDB::CertificateSource source) const
 {
index e899ad8..a2095da 100644 (file)
@@ -53,9 +53,6 @@ class WacSecurity : public WrtDB::IWacSecurity
     virtual bool isWacSigned() const { return mWacSigned; }
 
     virtual void getCertificateChainList(
-            WrtDB::CertificateChainList& list) const;
-
-    virtual void getCertificateChainList(
             WrtDB::CertificateChainList& list,
             WrtDB::CertificateSource source) const;
 
index 4fa010b..284cc1b 100755 (executable)
@@ -65,8 +65,6 @@ struct InstallerContext
         INSTALL_BACKUP_EXEC,                           /* For Update */
         INSTALL_NEW_DB_INSERT,                         /* For Update */
 
-        INSTALL_CREATE_PRIVATE_STORAGE,
-        INSTALL_LINK_DEPENDS_DIRECTORY,
         INSTALL_ACE_PREPARE,
         INSTALL_ACE_CHECK,
         INSTALL_SMACK_ENABLE,
@@ -104,6 +102,7 @@ struct InstallerContext
     RequestedDevCapsMap staticPermittedDevCaps;
     std::string installInfo;            ///<For recovery>
     bool m_quiet;
+    InstallLocationType locationType;
 };
 
 #endif // INSTALLER_CONTEXT_H
index 78480c2..109caff 100644 (file)
@@ -47,8 +47,10 @@ enum Type
     ErrorDeferred,                   ///< Widget installation was deferred and will be continued when possible
     ErrorDatabaseFailure,            ///< Failure in database
     ErrorRemovingFolderFailure,      ///< Failure in removing existing widget folder
+    ErrorCreateVconfFailure,         ///< Failure in creating vconf
     ErrorInstallOspServcie,          ///< Failure in installing osp service
     ErrorUpdateWidget,               ///< Failure in widget update.
+    ErrorInstallToExt,               ///< Failure in install to sdcard
     ErrorUnknown                     ///< Temporary error. Try to not use this.
 };
 
@@ -80,9 +82,12 @@ DECLARE_JOB_EXCEPTION(Base, AlreadyInstalled, ErrorAlreadyInstalled)
 DECLARE_JOB_EXCEPTION(Base, UnknownError, ErrorUnknown)
 DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorDatabaseFailure)
 DECLARE_JOB_EXCEPTION(Base, RemovingFolderFailure, ErrorRemovingFolderFailure)
+DECLARE_JOB_EXCEPTION(Base, CreateVconfFailure, ErrorCreateVconfFailure)
 
 DECLARE_JOB_EXCEPTION(Base, CopyIconFailed, ErrorUnknown)
 
+DECLARE_JOB_EXCEPTION(Base, ErrorExternalInstallingFailure, ErrorInstallToExt)
+
 // Installation osp service
 DECLARE_JOB_EXCEPTION(Base, RequestInstallOspsvc, ErrorInstallOspServcie)
 DECLARE_JOB_EXCEPTION(Base, InstallOspsvcFailed, ErrorInstallOspServcie)
index 2c7e3c8..2a655c8 100755 (executable)
@@ -31,6 +31,8 @@
 #include <job.h>
 #include <widget_install/widget_install_errors.h>
 #include <wrt_common_types.h>
+#include <pkgmgr_signal_interface.h>
+#include <memory>
 #include <string>
 
 //Widget Installer typedefs
@@ -71,7 +73,8 @@ enum Type
         ExistingVersionEqual |
         ExistingVersionNewer,
 
-    PolicyForceInstall = PolicyAlwaysInstall
+    PolicyForceInstall = PolicyAlwaysInstall,
+    PolicyDirectoryForceInstall
 };
 
 inline Type operator | (const Type &a,
@@ -100,10 +103,13 @@ struct WidgetInstallationStruct : public WidgetInstallCallbackBase
 {
     WidgetUpdateMode::Type updateMode;
     bool m_quiet;
+    bool m_preload;
+    std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface;
 
     // It must be empty-constructible as a parameter of generic event
     WidgetInstallationStruct() : updateMode(WidgetUpdateMode::Zero),
-                                m_quiet(true)
+                                m_quiet(true),
+                                m_preload(false)
     {
     }
 
@@ -111,10 +117,15 @@ struct WidgetInstallationStruct : public WidgetInstallCallbackBase
             InstallerProgressCallback progress,
             void *param,
             WidgetUpdateMode::Type mode,
-            bool quiet) :
+            bool quiet,
+            bool preload,
+            std::shared_ptr<PackageManager::IPkgmgrSignal> _pkgmgrInterface
+            ) :
         WidgetInstallCallbackBase(finished, progress, param),
         updateMode(mode),
-        m_quiet(quiet)
+        m_quiet(quiet),
+        m_preload(preload),
+        pkgmgrInterface(_pkgmgrInterface)
     {
     }
 };
diff --git a/src/jobs/widget_install/widget_unzip.cpp b/src/jobs/widget_install/widget_unzip.cpp
deleted file mode 100644 (file)
index b8d0b98..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/*
- * @file    widget_unzip.cpp
- * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief   Implementation file for installer task unzip
- */
-#include <widget_install/widget_unzip.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-#include <widget_install/job_widget_install.h>
-#include <dpl/log/log.h>
-#include <dpl/copy.h>
-#include <dpl/file_output.h>
-#include <dpl/abstract_waitable_input_adapter.h>
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <task_commons.h>
-#include <sys/stat.h>
-#include <drm_trusted_client.h>
-
-using namespace WrtDB;
-
-namespace {
-struct PathAndFilePair
-{
-    std::string path;
-    std::string file;
-
-    PathAndFilePair(const std::string &p,
-            const std::string &f) :
-        path(p),
-        file(f)
-    {
-    }
-};
-
-PathAndFilePair SplitFileAndPath(const std::string &filePath)
-{
-    std::string::size_type position = filePath.rfind('/');
-
-    // Is this only a file without a path ?
-    if (position == std::string::npos) {
-        return PathAndFilePair(std::string(), filePath);
-    }
-
-    // This is full file-path pair
-    return PathAndFilePair(filePath.substr(0,
-                                           position),
-                           filePath.substr(position + 1));
-}
-}
-
-namespace Jobs {
-namespace WidgetInstall {
-WidgetUnzip::WidgetUnzip(std::string source, std::string path) :
-    m_source(source),
-    m_destPath(path)
-{
-    LogDebug("WidgetUnzip");
-}
-
-void WidgetUnzip::ExtractFile(DPL::ZipInput::File *input,
-        const std::string &destFileName)
-{
-    Try
-    {
-        DPL::AbstractWaitableInputAdapter inputAdapter(input);
-        DPL::FileOutput output(destFileName);
-
-        DPL::Copy(&inputAdapter, &output);
-    }
-    Catch(DPL::FileOutput::Exception::OpenFailed)
-    {
-        ReThrowMsg(Exceptions::ExtractFileFailed, destFileName);
-    }
-    Catch(DPL::CopyFailed)
-    {
-        ReThrowMsg(Exceptions::ExtractFileFailed, destFileName);
-    }
-}
-
-void WidgetUnzip::UnzipWidget()
-{
-    UnzipPrepare();
-    UnzipProgress();
-}
-
-void WidgetUnzip::UnzipPrepare()
-{
-    LogInfo("Prepare to unzip...");
-
-    Try
-    {
-        m_zip.reset(new DPL::ZipInput(m_source));
-        LogInfo("Widget package comment: " << m_zip->GetGlobalComment());
-
-        // Widget package must not be empty
-        if (m_zip->empty()) {
-            ThrowMsg(Exceptions::ZipEmpty, m_source);
-        }
-
-        // Set iterator to first file
-        m_zipIterator = m_zip->begin();
-    }
-    Catch(DPL::ZipInput::Exception::OpenFailed)
-    {
-        ReThrowMsg(Exceptions::OpenZipFailed, m_source);
-    }
-}
-
-void WidgetUnzip::UnzipProgress()
-{
-
-    // Show file info
-    LogInfo("Unzipping: '" << m_zipIterator->name <<
-            "', Comment: '" << m_zipIterator->comment <<
-            "', Compressed size: " << m_zipIterator->compressedSize <<
-            ", Uncompressed size: " << m_zipIterator->uncompressedSize);
-
-
-    // Normalize file paths
-    // FIXME: Implement checking for invalid characters
-
-    // Extract file or path
-    std::string fileName = m_zipIterator->name;
-
-    if (fileName[fileName.size() - 1] == '/') {
-        // This is path
-        std::string newPath = m_destPath + "/" +
-            fileName.substr(0, fileName.size() - 1);
-        LogPedantic("Path to extract: " << newPath);
-
-        // Create path in case of it is empty
-        createTempPath(newPath);
-    } else {
-        // This is regular file
-        std::string fileExtractPath = m_destPath + "/" + fileName;
-
-        LogPedantic("File to extract: " << fileExtractPath);
-
-        // Split into pat & file pair
-        PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath);
-
-        LogPedantic("Path and file: " <<
-                    pathAndFile.path <<
-                    " : " << pathAndFile.file);
-
-        // First, ensure that path exists
-        createTempPath(pathAndFile.path);
-
-        Try
-        {
-            // Open file
-            std::unique_ptr<DPL::ZipInput::File> file(
-                m_zip->OpenFile(fileName));
-
-            // Extract single file
-            ExtractFile(file.get(), fileExtractPath);
-        }
-        Catch(DPL::ZipInput::Exception::OpenFileFailed)
-        {
-            ThrowMsg(Exceptions::ExtractFileFailed, fileName);
-        }
-    }
-
-    // Check whether there are more files to extract
-    if (++m_zipIterator == m_zip->end()) {
-        LogInfo("Unzip progress finished successfuly");
-        m_zip.reset();
-    } else {
-        UnzipProgress();
-    }
-}
-
-void WidgetUnzip::UnzipDRMWidget()
-{
-    LogDebug("Decrypt drm widget");
-    drm_trusted_sapps_decrypt_package_info_s package_info;
-
-    strncpy(package_info.sadcf_filepath, m_source.c_str(),
-            sizeof(package_info.sadcf_filepath));
-    strncpy(package_info.decrypt_filepath, m_destPath.c_str(),
-            sizeof(package_info.decrypt_filepath));
-
-    drm_trusted_request_type_e requestType =
-        DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
-
-    int ret = drm_trusted_handle_request(requestType,
-                                         (void *)&package_info, NULL);
-    if (DRM_TRUSTED_RETURN_SUCCESS != ret) {
-        LogDebug("Failed unzip drm widget");
-        ThrowMsg(Exceptions::ExtractFileFailed, m_destPath);
-    }
-}
-} //namespace WidgetInstall
-} //namespace Jobs
diff --git a/src/jobs/widget_install/widget_unzip.h b/src/jobs/widget_install/widget_unzip.h
deleted file mode 100644 (file)
index 7c7b4ca..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    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.
- */
-/*
- * @file    widget_unzip.cpp
- * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
- * @version 1.0
- * @brief   Implementation file for installer task unzip
- */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_WIDGET_UNZIP_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_WIDGET_UNZIP_H
-
-#include <string>
-#include <memory>
-
-#include <dpl/zip_input.h>
-
-class InstallerContext;
-
-namespace Jobs {
-namespace WidgetInstall {
-class WidgetUnzip 
-{
-  private:
-    // Installation context
-    std::string m_source;
-    std::string m_destPath;
-
-    // Unzip state
-    std::unique_ptr<DPL::ZipInput> m_zip;
-    DPL::ZipInput::const_iterator m_zipIterator;
-
-    void ExtractFile(DPL::ZipInput::File *input,
-            const std::string &destFileName);
-
-    void UnzipPrepare();
-    void UnzipProgress();
-
-  public:
-    WidgetUnzip(std::string m_source, std::string m_destPath);
-    void UnzipWidget();
-    void UnzipDRMWidget();
-};
-} //namespace WidgetInstall
-} //namespace Jobs
-
-#endif // INSTALLER_CORE_JOS_WIDGET_INSTALL_WIDGET_UNZIP_H
index 392106f..e6153ff 100644 (file)
@@ -23,6 +23,7 @@
 #include <widget_uninstall/task_uninstall_ospsvc.h>
 #include <widget_uninstall/task_delete_certificates.h>
 #include <pkg-manager/pkgmgr_signal.h>
+#include <app2ext_interface.h>
 
 using namespace WrtDB;
 
@@ -66,6 +67,7 @@ JobWidgetUninstall::JobWidgetUninstall(const std::string & widgetPkgName,
     m_context.uninstallStep = UninstallerContext::UNINSTALL_START;
     m_context.job = this;
     m_context.pkgname = widgetPkgName;
+    m_context.isExternalWidget = getExternalWidgetFlag();
 
     Try
     {
@@ -85,8 +87,8 @@ JobWidgetUninstall::JobWidgetUninstall(const std::string & widgetPkgName,
         AddTask(new TaskDeleteCertificates(m_context));
 
         // send start signal of pkgmgr
-        if (PkgmgrSignalSingleton::Instance().setPkgname(m_context.pkgname)) {
-            PkgmgrSignalSingleton::Instance().sendSignal(
+        if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.pkgname)) {
+            getInstallerStruct().pkgmgrInterface->sendSignal(
                     PKGMGR_START_KEY,
                     PKGMGR_START_UNINSTALL);
         }
@@ -121,7 +123,7 @@ void JobWidgetUninstall::SendProgress()
             // send progress signal of pkgmgr
             std::ostringstream percent;
             percent << static_cast<int>(GetProgressPercent());
-            PkgmgrSignalSingleton::Instance().sendSignal(
+            getInstallerStruct().pkgmgrInterface->sendSignal(
                         PKGMGR_PROGRESS_KEY,
                         percent.str());
 
@@ -137,7 +139,7 @@ void JobWidgetUninstall::SendFinishedSuccess()
 {
     using namespace PackageManager;
     // send signal of pkgmgr
-    PkgmgrSignalSingleton::Instance().sendSignal(
+    getInstallerStruct().pkgmgrInterface->sendSignal(
                 PKGMGR_END_KEY,
                 PKGMGR_END_SUCCESS);
 
@@ -153,7 +155,7 @@ void JobWidgetUninstall::SendFinishedFailure()
     LogError("Message: " << m_exceptionMessage);
 
     // send signal of pkgmgr
-    PkgmgrSignalSingleton::Instance().sendSignal(
+    getInstallerStruct().pkgmgrInterface->sendSignal(
                 PKGMGR_END_KEY,
                 PKGMGR_END_FAILURE);
 
@@ -168,5 +170,17 @@ void JobWidgetUninstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
     m_exceptionCaught = static_cast<Exceptions::Type>(e.getParam());
     m_exceptionMessage = e.GetMessage();
 }
+
+bool JobWidgetUninstall::getExternalWidgetFlag() const
+{
+
+    LogDebug("Get external widget");
+    if (APP2EXT_SD_CARD == app2ext_get_app_location(m_context.pkgname.c_str())) {
+        LogDebug("This widget is in external stroage");
+        return true;
+    }
+    return false;
+}
+
 } //namespace WidgetUninstall
 } //namespace Jobs
index 98cd62c..80c188c 100644 (file)
@@ -55,6 +55,7 @@ class JobWidgetUninstall :
     std::string getRemovedTizenId() const;
     bool getRemoveStartedFlag() const;
     bool getRemoveFinishedFlag() const;
+    bool getExternalWidgetFlag() const;
 
     void SendProgress();
     void SendFinishedSuccess();
index b18feb0..d3f2c93 100644 (file)
 #include <widget_uninstall/task_db_update.h>
 #include <widget_uninstall/job_widget_uninstall.h>
 #include <widget_uninstall/widget_uninstall_errors.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <ace_api_install.h>
 
 #include <dpl/assert.h>
+#include <ace-common/ace_api_common.h>
 
 using namespace WrtDB;
 
@@ -45,6 +48,9 @@ void TaskDbUpdate::StepDbUpdate()
 {
     Try
     {
+        //TODO: widget handle should not be used any more
+        ace_unregister_widget(static_cast<ace_widget_handle_t>(
+            WidgetDAOReadOnly::getHandle(m_context.locations->getPkgname())));
         WidgetDAO::unregisterWidget(m_context.locations->getPkgname());
 
         LogDebug("Unregistered widget successfully!");
index 2dfe92e..d7c3157 100644 (file)
 #include <widget_uninstall/uninstaller_context.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
 #include <dpl/wrt-dao-ro/widget_config.h>
+#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/assert.h>
 #include <dpl/utils/wrt_utility.h>
 #include <ail.h>
 #include <pkgmgr/pkgmgr_parser.h>
+#include <errno.h>
+#include <string.h>
+#include <widget_install_to_external.h>
+#include <vconf.h>
 
 namespace Jobs {
 namespace WidgetUninstall {
 
 using namespace WrtDB;
 
+namespace {
+const char * const VCONF_KEY_PREFIX = "file/private/";
+}
+
 TaskRemoveFiles::TaskRemoveFiles(UninstallerContext& context) :
     DPL::TaskDecl<TaskRemoveFiles>(this),
     m_context(context)
 {
-    AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
+    if (!m_context.isExternalWidget) {
+        AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
+    } else {
+        AddStep(&TaskRemoveFiles::StepRemoveExternalWidget);
+    }
     //AddStep(&TaskRemoveFiles::StepRemoveDesktop);
     AddStep(&TaskRemoveFiles::StepRemoveManifest);
     AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
+    AddStep(&TaskRemoveFiles::StepRemoveVconf);
     AddStep(&TaskRemoveFiles::StepRemoveFinished);
 }
 
@@ -60,6 +74,10 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory()
     if(!WrtUtilRemove(widgetDir)){
         LogWarning("Removing widget installation directory failed");
     }
+    std::string dataDir = m_context.locations->getUserDataRootDir();
+    if(!WrtUtilRemove(dataDir)){
+        LogWarning(dataDir + " is already removed");
+    }
     m_context.job->UpdateProgress(
         UninstallerContext::UNINSTALL_REMOVE_WIDGETDIR,
         "Widget INstallation Directory Removal Finished");
@@ -138,7 +156,10 @@ void TaskRemoveFiles::StepRemoveExternalLocations()
         if(WrtUtilFileExists(*path))
         {
             LogDebug("  -> " << *path);
-            remove(path->c_str());
+            int ret = remove(path->c_str());
+            if (ret != 0) {
+                LogError("Failed to remove the file: " << path->c_str() << " with error: " << strerror(errno));
+            }
         }
         else if(WrtUtilDirExists(*path))
         {
@@ -155,5 +176,30 @@ void TaskRemoveFiles::StepRemoveExternalLocations()
     dao.unregisterAllExternalLocations();
 }
 
+void TaskRemoveFiles::StepRemoveVconf()
+{
+    std::string key =
+        WrtDB::VconfConfig::GetVconfKeyRootPath(
+            m_context.locations->getPkgname());
+    if(vconf_unset_recursive(key.c_str())) {
+        LogError("Fail to unset vconf file");
+    } else {
+        LogDebug("vconf file is removed");
+    }
+}
+
+void TaskRemoveFiles::StepRemoveExternalWidget()
+{
+    Try {
+        WidgetInstallToExtSingleton::Instance().initialize(m_context.pkgname);
+        WidgetInstallToExtSingleton::Instance().uninstallation();
+        WidgetInstallToExtSingleton::Instance().deinitialize();
+    }
+    Catch (WidgetInstallToExt::Exception::ErrorInstallToExt)
+    {
+        Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::RemoveFilesFailed);
+    }
+}
+
 } //namespace WidgetUninstall
 } //namespace Jobs
index 6959242..0336443 100644 (file)
@@ -51,6 +51,8 @@ class TaskRemoveFiles :
     void StepRemoveDesktop();
     void StepRemoveManifest();
     void StepRemoveExternalLocations();
+    void StepRemoveVconf();
+    void StepRemoveExternalWidget();
 
   public:
     explicit TaskRemoveFiles(UninstallerContext& context);
index 1aeb086..caedcb7 100644 (file)
@@ -60,6 +60,7 @@ struct UninstallerContext
     UninstallStep uninstallStep;       ///< current step of installation
     Jobs::WidgetUninstall::JobWidgetUninstall *job;
     std::string pkgname;
+    bool isExternalWidget;
 };
 
 #endif // WRT_SRC_INSTALLER_CORE_UNINSTALLER_TASKS_UNINSTALLER_CONTEXT_H_
index 4388164..ce2d4cc 100644 (file)
@@ -29,6 +29,8 @@
 #include <job_base.h>
 #include <wrt_common_types.h>
 #include <widget_uninstall/widget_uninstall_errors.h>
+#include <pkgmgr_signal_interface.h>
+#include <memory>
 
 //Widget Uninstaller typedefs
 typedef void (*UninstallerFinishedCallback)(
@@ -44,6 +46,26 @@ typedef void (*UninstallerProgressCallback)(
 //UninstallationStruct
 typedef Jobs::JobCallbacksBase<UninstallerFinishedCallback,
                                UninstallerProgressCallback>
-WidgetUninstallationStruct;
+WidgetUninstallCallbackBase;
 
+
+struct WidgetUninstallationStruct : public WidgetUninstallCallbackBase
+{
+    std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface;
+
+    // It must be empty-constructible as a parameter of generic event
+    WidgetUninstallationStruct()
+    {
+    }
+
+    WidgetUninstallationStruct(UninstallerFinishedCallback finished,
+            UninstallerProgressCallback progress,
+            void *param,
+            std::shared_ptr<PackageManager::IPkgmgrSignal> _pkgmgrInterface
+            ) :
+        WidgetUninstallCallbackBase(finished, progress, param),
+        pkgmgrInterface(_pkgmgrInterface)
+    {
+    }
+};
 #endif // WRT_SRC_INSTALLER_CORE_UNINSTALLER_TASKS_WIDGET_INSTALLER_STRUCT_H_
index 938e7ee..55c68fe 100644 (file)
@@ -52,7 +52,7 @@ DECLARE_GENERIC_EVENT_2(InstallPluginEvent, std::string, PluginInstallerStruct)
 /**
  * @brief Event for inicietig widget uninstallation.
  *
- * WidgetHandler is used to point witch widget shuld be uninstalled
+ * tizen id is used to point witch widget shuld be uninstalled
  */
 DECLARE_GENERIC_EVENT_2(UninstallWidgetEvent,
                         std::string,
diff --git a/src/misc/widget_install_to_external.cpp b/src/misc/widget_install_to_external.cpp
new file mode 100644 (file)
index 0000000..3751d60
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    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.
+ */
+/*
+ * @file        widget_install_to_external.cpp
+ * @author      Soyoung Kim (sy037.kim@smasung.com)
+ */
+#include "widget_install_to_external.h"
+
+#include <dpl/singleton_safe_impl.h>
+#include <dpl/assert.h>
+#include <dpl/log/log.h>
+
+IMPLEMENT_SAFE_SINGLETON(WidgetInstallToExt)
+
+WidgetInstallToExt::WidgetInstallToExt() :
+    m_handle(NULL),
+    m_appId("")
+{
+}
+
+WidgetInstallToExt::~WidgetInstallToExt()
+{
+}
+
+void WidgetInstallToExt::initialize(std::string appId)
+{
+    LogDebug("WidgetInstallToExt::initialize()");
+    m_appId = appId;
+
+    m_handle = app2ext_init(APP2EXT_SD_CARD);
+    if (NULL == m_handle) {
+        ThrowMsg(Exception::ErrorInstallToExt, "initialize failed");
+    }
+}
+
+void WidgetInstallToExt::deinitialize()
+{
+    LogDebug("WidgetInstallToExt::deinitialize()");
+    if (NULL != m_handle) {
+        if ( 0 < app2ext_deinit(m_handle)) {
+            ThrowMsg(Exception::ErrorInstallToExt, "app2ext deinitialize \
+                    failed");
+        }
+    }
+}
+
+void WidgetInstallToExt::preInstallation(GList *dirList, int dSize)
+{
+    LogDebug("WidgetInstallToExt::preInstallation()");
+    Assert(m_handle);
+
+    int ret = m_handle->interface.pre_install(m_appId.c_str(), dirList, dSize);
+
+    if (APP2EXT_SUCCESS == ret ) {
+        LogDebug("App2Ext pre install success");
+    } else {
+        postInstallation(false);
+        ThrowMsg(Exception::ErrorInstallToExt, "pre-install failed");
+    }
+}
+
+void WidgetInstallToExt::postInstallation(bool status)
+{
+    LogDebug("WidgetInstallToExt::postInstallation()");
+    Assert(m_handle);
+
+    if (status) {
+        m_handle->interface.post_install(m_appId.c_str(),
+                APP2EXT_STATUS_SUCCESS);
+    } else {
+        m_handle->interface.post_install(m_appId.c_str(),
+                APP2EXT_STATUS_FAILED);
+    }
+}
+
+void WidgetInstallToExt::preUpgrade(GList *dirList, int dSize)
+{
+    LogDebug("WidgetInstallToExt::preUpgrade()");
+    Assert(m_handle);
+
+    int ret = m_handle->interface.pre_upgrade(m_appId.c_str(), dirList, dSize);
+    if (APP2EXT_SUCCESS == ret ) {
+        LogDebug("App2Ext pre-upgrade success");
+    } else {
+        postUpgrade(false);
+        ThrowMsg(Exception::ErrorInstallToExt, "pre-upgrade failed");
+    }
+}
+
+void WidgetInstallToExt::postUpgrade(bool status)
+{
+    LogDebug("WidgetInstallToExt::postUpgrade()");
+    Assert(m_handle);
+
+    if (status) {
+        m_handle->interface.post_upgrade(m_appId.c_str(),
+                APP2EXT_STATUS_SUCCESS);
+    } else {
+        m_handle->interface.post_upgrade(m_appId.c_str(),
+                APP2EXT_STATUS_FAILED);
+    }
+}
+
+void WidgetInstallToExt::uninstallation()
+{
+    LogDebug("WidgetInstallToExt::uninstallation()");
+
+    Assert(m_handle);
+
+    int ret = m_handle->interface.pre_uninstall(m_appId.c_str());
+    if (APP2EXT_SUCCESS == ret ) {
+        if (APP2EXT_SUCCESS ==
+                m_handle->interface.post_uninstall(m_appId.c_str())) {
+            LogDebug("App2Ext pre-uninstall success");
+        } else {
+            ThrowMsg(Exception::ErrorInstallToExt, "post-uninstall failed");
+        }
+    } else {
+        ThrowMsg(Exception::ErrorInstallToExt, "pre-uninstall failed");
+    }
+}
diff --git a/src/misc/widget_install_to_external.h b/src/misc/widget_install_to_external.h
new file mode 100644 (file)
index 0000000..9f71906
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    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.
+ */
+/*
+ * @file        widget_install_to_external.h
+ * @author      Soyoung Kim (sy037.kim@smasung.com)
+ */
+#ifndef WRT_INSTALLER_SRC_MISC_WIDGET_INSTALL_TO_EXTERNAL_H
+#define WRT_INSTALLER_SRC_MISC_WIDGET_INSTALL_TO_EXTERNAL_H
+
+#include <string>
+#include <dpl/singleton.h>
+#include <dpl/string.h>
+#include <app2ext_interface.h>
+
+
+class WidgetInstallToExt
+{
+public:
+    class Exception
+    {
+      public:
+        DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
+        DECLARE_EXCEPTION_TYPE(Base, ErrorInstallToExt)
+    };
+
+    void initialize(std::string appId);
+    void deinitialize();
+    void preInstallation(GList* dirList, int dSize);
+    void postInstallation(bool status);
+    void preUpgrade(GList* dirList, int dSize);
+    void postUpgrade(bool status);
+    void uninstallation();
+
+private:
+    app2ext_handle *m_handle;
+    std::string m_appId;
+
+    WidgetInstallToExt();
+    ~WidgetInstallToExt();
+
+    friend class DPL::Singleton<WidgetInstallToExt>;
+};
+
+typedef DPL::Singleton<WidgetInstallToExt> WidgetInstallToExtSingleton;
+
+#endif // WRT_INSTALLER_SRC_MISC_WIDGET_INSTALL_TO_EXTERNAL_H
index b899bec..35a8026 100644 (file)
@@ -42,7 +42,9 @@ WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath)
 WidgetLocation::DirectoryDeletor::~DirectoryDeletor()
 {
     LogDebug("Removing widget installation temporary directory: " << m_dirpath.c_str());
-    WrtUtilRemove(m_dirpath);
+    if(!WrtUtilRemove(m_dirpath)){
+        LogError("Fail at removing directory: " << m_dirpath.c_str());
+    }
 }
 
 std::string WidgetLocation::DirectoryDeletor::getTempPath() const
@@ -65,47 +67,58 @@ WidgetLocation::~WidgetLocation()
 
 WidgetLocation::WidgetLocation(const std::string & widgetname,
                                std::string sourcePath,
-                               WrtDB::PackagingType t):
+                               WrtDB::PackagingType t,
+                               InstallLocationType locationType):
                                     m_pkgname(widgetname),
                                     m_widgetSource(sourcePath),
                                     m_type(t),
                                     m_temp(new WidgetLocation::DirectoryDeletor())
 {
+    if (INSTALL_LOCATION_TYPE_PRELOAD == locationType) {
+        m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
+    } else {
+        m_installedPath += WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+    }
 }
 
 WidgetLocation::WidgetLocation(const std::string & widgetname,
                                std::string sourcePath,
                                std::string dirPath,
-                               WrtDB::PackagingType t):
+                               WrtDB::PackagingType t,
+                               InstallLocationType locationType):
                                     m_pkgname(widgetname),
                                     m_widgetSource(sourcePath),
                                     m_type(t),
                                     m_temp(new
                                             WidgetLocation::DirectoryDeletor(dirPath))
 {
+    if (INSTALL_LOCATION_TYPE_PRELOAD == locationType) {
+        m_installedPath += WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
+    } else {
+        m_installedPath += WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+    }
 }
 
 // TODO cache all these paths
 std::string WidgetLocation::getInstallationDir() const
 {
-    return std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath());
+    return m_installedPath;
 }
 
 std::string WidgetLocation::getPackageInstallationDir() const
 {
-    return std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath()) + "/"
-            + m_pkgname;
+    return m_installedPath + "/" + m_pkgname;
 }
 
 std::string WidgetLocation::getSourceDir() const
 {
-    return std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath()) + "/"
+    return m_installedPath + "/"
             + m_pkgname + WrtDB::GlobalConfig::GetWidgetSrcPath();
 }
 
 std::string WidgetLocation::getBinaryDir() const
 {
-    return std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath()) + "/"
+    return m_installedPath + "/"
             + m_pkgname + WrtDB::GlobalConfig::GetUserWidgetExecPath();
 }
 
@@ -134,6 +147,24 @@ std::string WidgetLocation::getBackupExecFile() const
     return getBackupBinaryDir() + "/" + m_pkgname;
 }
 
+std::string WidgetLocation::getUserDataRootDir() const
+{
+    return std::string(WrtDB::GlobalConfig::GetWidgetUserDataPath()) +
+        "/" + m_pkgname;
+}
+
+std::string WidgetLocation::getPrivateStorageDir() const
+{
+    return getUserDataRootDir() + "/" +
+        WrtDB::GlobalConfig::GetWidgetPrivateStoragePath();
+}
+
+std::string WidgetLocation::getShareDir() const
+{
+    return std::string(WrtDB::GlobalConfig::GetUserInstalledWidgetPath()) + "/"
+            + m_pkgname + "/" + WrtDB::GlobalConfig::GetWidgetSharePath();
+}
+
 std::string WidgetLocation::getTemporaryPackageDir() const
 {
     return m_temp->getTempPath();
@@ -141,6 +172,9 @@ std::string WidgetLocation::getTemporaryPackageDir() const
 
 std::string WidgetLocation::getTemporaryRootDir() const
 {
+    if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP) {
+        return getWidgetSource();
+    }
     if(m_type == WrtDB::PKG_TYPE_HYBRID_WEB_APP)
     {
         return getTemporaryPackageDir() + WrtDB::GlobalConfig::GetWidgetSrcPath();
@@ -153,7 +187,7 @@ std::string WidgetLocation::getTemporaryRootDir() const
 
 std::string WidgetLocation::getConfigurationDir() const
 {
-    if(m_type ==  WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+    if(m_type == WrtDB::PKG_TYPE_HOSTED_WEB_APP)
     {
         std::string path = ".";
         int index = m_widgetSource.find_last_of("\\/");
@@ -163,7 +197,10 @@ std::string WidgetLocation::getConfigurationDir() const
         }
         return path;
     }
-    else
+    else if (m_type == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+    {
+        return getWidgetSource() + WrtDB::GlobalConfig::GetWidgetSrcPath();
+    } else
     {
         return getTemporaryRootDir();
     }
index ab9fa29..e04c3dd 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <dpl/wrt-dao-ro/common_dao_types.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <wrt_common_types.h>
 
 /**
  * @brief The WidgetLocation class
@@ -36,6 +37,7 @@
  *
  * /opt/apps/[package_name]
  *           \_____________ /data
+ *           \_____________ /share
  *           \_____________ /bin
  *           \_____________ /bin/[id_of_installed_package]
  *           \_____________ /res/wgt/
@@ -91,15 +93,20 @@ public:
      * In destruction removes temporary directory
      */
     WidgetLocation(const std::string & widgetname, std::string sourcePath,
-                   WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP);
+                   WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
+                   InstallLocationType ltype =
+                        INSTALL_LOCATION_TYPE_NOMAL);
 
     WidgetLocation(const std::string & widgetname, std::string sourcePath,
                    std::string dirPath,
-                   WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP);
+                   WrtDB::PackagingType t = WrtDB::PKG_TYPE_NOMAL_WEB_APP,
+                   InstallLocationType ltype =
+                        INSTALL_LOCATION_TYPE_NOMAL);
+
     ~WidgetLocation();
 
     // Installed paths
-    std::string getInstallationDir() const;              // /opt/apps
+    std::string getInstallationDir() const;              // /opt/apps or /usr/apps
     std::string getPackageInstallationDir() const;       // /opt/apps/[package]
     std::string getSourceDir() const;                    // /opt/apps/[package]/res/wgt
     std::string getBinaryDir() const;                    // /opt/apps/[package]/bin
@@ -108,6 +115,9 @@ public:
     std::string getBackupSourceDir() const;              // /opt/apps/[package]/backup/res/wgt
     std::string getBackupBinaryDir() const;              // /opt/apps/[package]/backup/bin
     std::string getBackupExecFile() const;              // /opt/apps/[package]/backup/bin/[package]
+    std::string getUserDataRootDir() const;             // /opt/usr/apps/[package]
+    std::string getPrivateStorageDir() const;                 // /opt/usr/apps/[package]/data
+    std::string getShareDir() const;                    // /opt/usr/apps/[package]/share
 
     // Temporary paths
     /**
@@ -185,6 +195,7 @@ private:
     WrtDB::PackagingType m_type;
     std::shared_ptr<DirectoryDeletor> m_temp;      //directory
     WrtDB::ExternalLocationList m_externals;
+    std::string m_installedPath;
 };
 
 #endif // WRT_INSTALLER_SRC_MISC_WIDGET_LOCATION_H
index 13b32b5..4b48b83 100644 (file)
  * @brief
  */
 
-#include <dpl/singleton_safe_impl.h>
 #include <dpl/log/log.h>
 #include <pkgmgr_installer.h>
 #include <pkg-manager/pkgmgr_signal.h>
 
-IMPLEMENT_SAFE_SINGLETON(PackageManager::PkgmgrSignal)
 
 namespace PackageManager {
 
@@ -95,7 +93,7 @@ bool PkgmgrSignal::deinitialize()
     return true;
 }
 
-bool PkgmgrSignal::setPkgname(std::string name)
+bool PkgmgrSignal::setPkgname(const std::string& name)
 {
     if (!m_initialized)
     {
@@ -115,7 +113,7 @@ bool PkgmgrSignal::setPkgname(std::string name)
     return true;
 }
 
-bool PkgmgrSignal::sendSignal(std::string key, std::string value) const
+bool PkgmgrSignal::sendSignal(const std::string& key, const std::string& value) const
 {
     if (!m_initialized)
     {
index 6c4e043..a939c50 100644 (file)
  */
 /*
  * @author      Yunchan Cho (yunchan.cho@samsung.com)
- * @version     0.1
+ * @author      Jan Olszak (j.olszak@samsung.com)
+ * @version     0.2
  * @brief
  */
 
 #ifndef WRT_PKGMGR_SIGNAL_H_
 #define WRT_PKGMGR_SINGAL_H_
 
-#include <dpl/singleton.h>
+#include <pkg-manager/pkgmgr_signal_interface.h>
 #include <pkgmgr_installer.h>
 
 namespace PackageManager{
@@ -38,17 +39,20 @@ namespace PackageManager{
 
 typedef pkgmgr_installer* PkgmgrHandle;
 
-class PkgmgrSignal
+class PkgmgrSignal: public IPkgmgrSignal
 {
     public:
         bool initialize(int argc, char* argv[]);
         bool deinitialize();
-        bool setPkgname(std::string name);
-        bool sendSignal(std::string key, std::string value) const;
+        bool setPkgname(const std::string& name);
+        bool sendSignal(const std::string& key, const std::string& value) const;
         std::string getPkgname() const;
         int getRequestedType() const;
         bool isNoPopupRequired() const;
 
+        PkgmgrSignal();
+        virtual ~PkgmgrSignal();
+
     private:
         bool m_initialized;
         PkgmgrHandle m_handle;
@@ -56,15 +60,7 @@ class PkgmgrSignal
         std::string m_pkgname;
         bool m_noPopup;
         int m_reqType;
-
-        PkgmgrSignal();
-        ~PkgmgrSignal();
-
-        friend class DPL::Singleton<PkgmgrSignal>;
 };
-
-typedef DPL::Singleton<PkgmgrSignal> PkgmgrSignalSingleton;
-
 } // PackageManager
 
 #endif // WRT_PKGMGR_SIGNAL_H_
diff --git a/src/pkg-manager/pkgmgr_signal_dummy.h b/src/pkg-manager/pkgmgr_signal_dummy.h
new file mode 100644 (file)
index 0000000..f8862ee
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    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.
+ */
+/*
+ * @author      Jan Olszak (j.olszak@samsung.com)
+ * @version     0.1
+ * @brief       Dummy version of PkgmgrSignal.
+ */
+
+#ifndef WRT_PKGMGR_SIGNAL_DUMMY_H_
+#define WRT_PKGMGR_SIGNAL_DUMMY_H_
+
+#include <pkg-manager/pkgmgr_signal_interface.h>
+
+namespace PackageManager {
+
+class PkgmgrSignalDummy: public IPkgmgrSignal
+{
+public:
+    PkgmgrSignalDummy()
+    {
+    }
+
+    virtual ~PkgmgrSignalDummy()
+    {
+    }
+    bool setPkgname(const std::string& name)
+    {
+        return false;
+    }
+
+    bool sendSignal(const std::string& key, const std::string& value) const
+    {
+        return false;
+    }
+
+    std::string getPkgname() const
+    {
+        return "";
+    }
+};
+
+} // PkgmgrSignalDummy
+
+#endif // WRT_PKGMGR_SIGNAL_DUMMY_H_
similarity index 50%
rename from src/jobs/widget_install/task_private_storage.h
rename to src/pkg-manager/pkgmgr_signal_interface.h
index e919f6b..187efb5 100644 (file)
  *    See the License for the specific language governing permissions and
  *    limitations under the License.
  */
-/**
- * @file    task_private_storage.h
- * @author  Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
- * @version 1.0
- * @brief   Header file for installer task private storage.
+/*
+ * @author      Jan Olszak (j.olszak@samsung.com)
+ * @version     0.1
+ * @brief       Interface for PkgmgrSignal.
  */
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PRIVATESTORAGE_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_PRIVATESTORAGE_H
 
-#include <dpl/task.h>
+#ifndef WRT_PKGMGR_SIGNAL_INTERFACE_H_
+#define WRT_PKGMGR_SIGNAL_INTERFACE_H_
 
-class InstallerContext;
+#include <string>
+namespace PackageManager {
 
-namespace Jobs {
-namespace WidgetInstall {
-class TaskPrivateStorage : public DPL::TaskDecl<TaskPrivateStorage>
+class IPkgmgrSignal
 {
-  public:
-    explicit TaskPrivateStorage(InstallerContext& context);
-
-  private:
-    void StepCreateDirectory();
-
-  private:
-    InstallerContext& m_context;
+public:
+    virtual bool setPkgname(const std::string& name) = 0;
+    virtual bool sendSignal(const std::string& key, const std::string& value) const = 0;
+    virtual std::string getPkgname() const = 0;
+    virtual ~IPkgmgrSignal(){};
 };
-} //namespace WidgetInstall
-} //namespace Jobs
 
-#endif
+} // IPkgmgrSignal
+
+#endif // WRT_PKGMGR_SIGNAL_INTERFACE_H_
index 354cb5a..425d655 100644 (file)
@@ -49,7 +49,8 @@
 #include <parser_runner.h>
 #include <widget_parser.h>
 #include <root_parser.h>
-#include <pkg-manager/pkgmgr_signal.h>
+
+
 
 #define NOFILE_CNT_FOR_INSTALLER 9999
 
@@ -89,7 +90,8 @@ WrtInstaller::WrtInstaller(int argc, char **argv) :
     m_installByPkgmgr(false),
     m_quiet(true),
     m_popup(NULL),
-    m_startupPluginInstallation(false)
+    m_startupPluginInstallation(false),
+    m_preloadWidget(false)
 {
     Touch();
     LogDebug("App Created");
@@ -113,6 +115,12 @@ void WrtInstaller::OnCreate()
 
     std::string arg = m_argv[0];
 
+    pkgmgrSignalInterface = std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
+                                std::shared_ptr<PackageManager::PkgmgrSignalDummy>(
+                                        new PackageManager::PkgmgrSignalDummy()
+                                )
+                            );
+
     if (arg.empty()) {
         return showHelpAndQuit();
     }
@@ -147,8 +155,17 @@ void WrtInstaller::OnCreate()
                 return showHelpAndQuit();
             }
 
+            struct stat info;
+            if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
+                LogInfo("Installing package directly from directory");
+                m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+            }
+            else
+            {
+                LogInfo("Installing from regular location");
+                m_installPolicy = WRT_WIM_POLICY_WAC;
+            }
             m_packagePath = m_argv[2];
-            m_installPolicy = WRT_WIM_POLICY_WAC;
             AddStep(&WrtInstaller::installStep);
         } else if (arg == "-if" || arg == "--install-force") {
             if (m_argc != 3) {
@@ -158,6 +175,15 @@ void WrtInstaller::OnCreate()
             m_packagePath = m_argv[2];
             m_installPolicy = WRT_WIM_POLICY_FORCE_INSTALL;
             AddStep(&WrtInstaller::installStep);
+        } else if (arg == "-il" || arg == "--install-preload") {
+            if (m_argc != 3) {
+                return showHelpAndQuit();
+            }
+
+            m_packagePath = m_argv[2];
+            m_preloadWidget = true;
+            m_installPolicy = WRT_WIM_POLICY_WAC;
+            AddStep(&WrtInstaller::installStep);
         } else if (arg == "-un" || arg == "--uninstall-name") {
             if (m_argc != 3) {
                 return showHelpAndQuit();
@@ -184,16 +210,31 @@ void WrtInstaller::OnCreate()
         using namespace PackageManager;
         m_installByPkgmgr = true;
 
-        PkgmgrSignalSingleton::Instance().initialize(m_argc, m_argv);
-        m_quiet = PkgmgrSignalSingleton::Instance().isNoPopupRequired();
+        auto pkgmgrSignal =  std::shared_ptr<PackageManager::PkgmgrSignal>(
+                                new PackageManager::PkgmgrSignal()
+                             );
+
+        pkgmgrSignal->initialize(m_argc, m_argv);
+        m_quiet = pkgmgrSignal->isNoPopupRequired();
         LogDebug("backend m_quiet"<<m_quiet);
 
-        int reqType = PkgmgrSignalSingleton::Instance().getRequestedType();
+        int reqType = pkgmgrSignal->getRequestedType();
 
+        pkgmgrSignalInterface =
+                std::static_pointer_cast<PackageManager::IPkgmgrSignal>(pkgmgrSignal);
         switch (reqType) {
             case PKGMGR_REQ_INSTALL:
                 m_packagePath = m_argv[4];
-                m_installPolicy = WRT_WIM_POLICY_WAC;
+                struct stat info;
+                if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
+                    LogInfo("Installing package directly from directory");
+                    m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+                }
+                else
+                {
+                    LogInfo("Installing from regular location");
+                    m_installPolicy = WRT_WIM_POLICY_WAC;
+                }
                 AddStep(&WrtInstaller::installStep);
                 break;
             case PKGMGR_REQ_UNINSTALL:
@@ -324,7 +365,9 @@ void WrtInstaller::installStep()
                        (!m_quiet || m_installByPkgmgr)
                        ? &staticWrtInstallProgressCallback : NULL,
                        m_installPolicy,
-                       m_quiet);
+                       m_quiet,
+                       m_preloadWidget,
+                       pkgmgrSignalInterface);
 }
 
 void WrtInstaller::installPluginsStep()
@@ -405,7 +448,8 @@ void WrtInstaller::uninstallPkgNameStep()
     LogDebug("Package name : " << m_name);
     wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback,
             (!m_quiet || m_installByPkgmgr)
-            ? &staticWrtUninstallProgressCallback : NULL);
+            ? &staticWrtUninstallProgressCallback : NULL,
+            pkgmgrSignalInterface);
 }
 
 void WrtInstaller::uninstallGuidStep()
@@ -416,7 +460,8 @@ void WrtInstaller::uninstallGuidStep()
     if (status == WRT_SUCCESS) {
         LogDebug("Guid : " << m_name);
         wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
-                !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
+                !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
+                pkgmgrSignalInterface);
     } else {
         printf("failed: can not uninstall widget\n");
         LogError("Fail to uninstalling widget... ");
@@ -463,7 +508,8 @@ void WrtInstaller::unistallWgtFileStep()
         if (status == WRT_SUCCESS) {
             LogDebug("Pkgname from packagePath : " << pkgname);
             wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
-                    !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
+                    !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
+                    pkgmgrSignalInterface);
         } else {
             LogError("Fail to uninstalling widget... ");
             m_returnStatus = -1;
@@ -906,44 +952,48 @@ bool WrtInstaller::popupsEnabled() const
 
 int main(int argc, char *argv[])
 {
-    // Output on stdout will be flushed after every newline character,
-    // even if it is redirected to a pipe. This is useful for running
-    // from a script and parsing output.
-    // (Standard behavior of stdlib is to use full buffering when
-    // redirected to a pipe, which means even after an end of line
-    // the output may not be flushed).
-    setlinebuf(stdout);
-
-    // Check and re-set the file open limitation
-    struct rlimit rlim;
-    if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
-        LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
-        LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
-
-        if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
-            rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
-            rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
-            if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
-                LogError("setrlimit is fail!!");
+    UNHANDLED_EXCEPTION_HANDLER_BEGIN
+    {
+        // Output on stdout will be flushed after every newline character,
+        // even if it is redirected to a pipe. This is useful for running
+        // from a script and parsing output.
+        // (Standard behavior of stdlib is to use full buffering when
+        // redirected to a pipe, which means even after an end of line
+        // the output may not be flushed).
+        setlinebuf(stdout);
+
+        // Check and re-set the file open limitation
+        struct rlimit rlim;
+        if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
+            LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
+            LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
+
+            if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
+                rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
+                rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
+                if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
+                    LogError("setrlimit is fail!!");
+                }
             }
+        } else {
+            LogError("getrlimit is fail!!");
         }
-    } else {
-        LogError("getrlimit is fail!!");
-    }
 
-    // set evas backend type for emulator
-    // popup isn't showed in the emulator,
-    // if backend isn't set to SW backend
-    if (GlobalSettings::IsEmulator()) {
-        if (setenv("ELM_ENGINE", "x11", 1)) {
-            LogDebug("Enable backend");
+        // set evas backend type for emulator
+        // popup isn't showed in the emulator,
+        // if backend isn't set to SW backend
+        if (GlobalSettings::IsEmulator()) {
+            if (setenv("ELM_ENGINE", "x11", 1)) {
+                LogDebug("Enable backend");
+            }
         }
-    }
 
-    WrtInstaller app(argc, argv);
-    int ret = app.Exec();
-    LogDebug("App returned: " << ret);
-    ret = app.getReturnStatus();
-    LogDebug("WrtInstaller returned: " << ret);
-    return ret;
+        WrtInstaller app(argc, argv);
+        int ret = app.Exec();
+        LogDebug("App returned: " << ret);
+        ret = app.getReturnStatus();
+        LogDebug("WrtInstaller returned: " << ret);
+        return ret;
+    }
+    UNHANDLED_EXCEPTION_HANDLER_END
 }
index d6e2315..723236f 100644 (file)
 #include <string>
 #include <utilX.h>
 #include <wrt_installer_api.h>
-#include <pkgmgr_installer.h>
+
+#include <pkg-manager/pkgmgr_signal_interface.h>
+#include <pkg-manager/pkgmgr_signal_dummy.h>
+#include <pkg-manager/pkgmgr_signal.h>
+#include <memory>
 
 namespace WRTInstallerNS { //anonymous
 DECLARE_GENERIC_EVENT_0(QuitEvent)
@@ -134,6 +138,7 @@ class WrtInstaller :
     bool popupsEnabled() const;
 
     // Private data
+    std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface;
     wrt_widget_install_mode_e m_installPolicy;
     std::string m_bundleValue;
     std::string m_packagePath;
@@ -149,6 +154,7 @@ class WrtInstaller :
     bool m_startupPluginInstallation;
     std::string m_webAppConfig;
     std::string m_webAppIcon;
+    bool m_preloadWidget;
 
     typedef std::list<std::string> PluginPathList;
     DPL::Optional<PluginPathList> m_pluginsPaths;
index 21fcc72..d643991 100755 (executable)
@@ -62,8 +62,10 @@ extern "C"
     inline WidgetUpdateMode::Type translateWidgetUpdateMode(
             wrt_widget_update_mode_t updateMode)
     {
-        WidgetUpdateMode::Type result = WidgetUpdateMode::Zero;
+        if (updateMode == WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL)
+            return WidgetUpdateMode::PolicyDirectoryForceInstall;
 
+        WidgetUpdateMode::Type result = WidgetUpdateMode::Zero;
         if (updateMode & WRT_WIM_NOT_INSTALLED) {
             result = result | WidgetUpdateMode::NotInstalled;
         }
@@ -136,17 +138,17 @@ extern "C"
                 "> does not exist.");
         }
 
-        if_ok &= (checkPath(GlobalConfig::GetFactoryInstalledWidgetPath()));
+        if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath()));
         if (!if_ok) {
             LogError(
-                "Path <" << GlobalConfig::GetFactoryInstalledWidgetPath() <<
+                "Path <" << GlobalConfig::GetUserInstalledWidgetPath() <<
                 "> does not exist.");
         }
 
-        if_ok &= (checkPath(GlobalConfig::GetUserInstalledWidgetPath()));
+        if_ok &= (checkPath(GlobalConfig::GetUserPreloadedWidgetPath()));
         if (!if_ok) {
             LogError(
-                "Path <" << GlobalConfig::GetUserInstalledWidgetPath() <<
+                "Path <" << GlobalConfig::GetUserPreloadedWidgetPath() <<
                 "> does not exist.");
         }
         return if_ok;
@@ -321,7 +323,10 @@ extern "C"
                                        WrtInstallerStatusCallback status_cb,
                                        WrtProgressCallback progress_cb,
                                        wrt_widget_update_mode_t update_mode,
-                                       bool quiet)
+                                       bool quiet,
+                                       bool preload,
+                                       std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface
+                                       )
     {
         UNHANDLED_EXCEPTION_HANDLER_BEGIN
         {
@@ -336,7 +341,9 @@ extern "C"
                         new InstallerCallbacksTranslate::StatusCallbackStruct(
                             userdata, status_cb, progress_cb),
                         translateWidgetUpdateMode(update_mode),
-                        quiet)));
+                        quiet,
+                        preload,
+                        pkgmgrInterface)));
         }
         UNHANDLED_EXCEPTION_HANDLER_END
     }
@@ -344,7 +351,8 @@ extern "C"
     EXPORT_API void wrt_uninstall_widget(const char * const pkg_name,
                                          void* userdata,
                                          WrtInstallerStatusCallback status_cb,
-                                         WrtProgressCallback progress_cb)
+                                         WrtProgressCallback progress_cb,
+                                         std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface)
     {
         UNHANDLED_EXCEPTION_HANDLER_BEGIN
         {
@@ -352,14 +360,18 @@ extern "C"
             LogInfo("[WRT-API] UNINSTALL WIDGET: " << widgetPkgName);
             // Post uninstallation event
             CONTROLLER_POST_EVENT(
-                Logic::InstallerController,
-                InstallerControllerEvents::UninstallWidgetEvent(
-                    widgetPkgName,
-                    WidgetUninstallationStruct(
-                        InstallerCallbacksTranslate::uninstallFinishedCallback,
-                        InstallerCallbacksTranslate::installProgressCallback,
-                        new InstallerCallbacksTranslate::StatusCallbackStruct(
-                            userdata, status_cb, progress_cb))));
+                    Logic::InstallerController,
+                    InstallerControllerEvents::UninstallWidgetEvent(
+                            widgetPkgName,
+                            WidgetUninstallationStruct(
+                                    InstallerCallbacksTranslate::uninstallFinishedCallback,
+                                    InstallerCallbacksTranslate::installProgressCallback,
+                                    new InstallerCallbacksTranslate::StatusCallbackStruct(
+                                            userdata, status_cb, progress_cb),
+                                    pkgmgrSignalInterface
+                            )
+                    )
+            );
         }
         UNHANDLED_EXCEPTION_HANDLER_END
     }
index cd83c5b..6f2bea6 100755 (executable)
@@ -33,6 +33,8 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <wrt_type.h>
+#include <pkgmgr_signal_interface.h>
+#include <memory>
 
 #ifdef __cplusplus
 extern "C" {
@@ -151,7 +153,10 @@ typedef enum wrt_widget_install_mode_e
 
     /* Force install policy
      */
-    WRT_WIM_POLICY_FORCE_INSTALL = WRT_WIM_POLICY_ALWAYS_INSTALL
+    WRT_WIM_POLICY_FORCE_INSTALL = WRT_WIM_POLICY_ALWAYS_INSTALL,
+    /* Installation from directory - forced update
+     */
+    WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL
 } wrt_widget_update_mode_t;
 
 int wrt_installer_init(void *userdata,
@@ -196,7 +201,9 @@ void wrt_installer_shutdown(void);
  *                      void *user_parameter,
  *                      WrtInstallerStatusCallback status_callback,
  *                      WrtProgressCallback progress_callback,
- *                      wrt_widget_update_mode_t update_mode);
+ *                      wrt_widget_update_mode_t update_mode,
+ *                      bool quiet,
+ *                      bool preload);
  *
  * @brief Installs widget from given path
  *
@@ -213,6 +220,8 @@ void wrt_installer_shutdown(void);
  *                                  If you don't want to get progress data, this
  *                                  should be NULL
  * @param [in]  install_mode        Installation mode
+ * @param [in]  quiet               quiet mode
+ * @param [in]  preload             preload widget install
  * @return                          Nothing (status returned in callback).
  *
  * Sample code:
@@ -221,7 +230,9 @@ void wrt_installer_shutdown(void);
  *                      NULL,
  *                      install_cb,
  *                      progress_cb,
- *                      WRT_WIM_POLICY_WAC);
+ *                      WRT_WIM_POLICY_WAC,
+ *                      false,
+ *                      false);
  * @endcode
  *
  * @see wrt_installer_uninstall_widget
@@ -231,7 +242,10 @@ void wrt_install_widget(const char *path,
         WrtInstallerStatusCallback status_callback,
         WrtProgressCallback progress_callback,
         wrt_widget_update_mode_t update_mode,
-        bool quiet);
+        bool quiet,
+        bool preload,
+        std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrInterface
+        );
 
 /**
  * @fn void wrt_installer_uninstall_widget (const char * const pkg_name,
@@ -264,7 +278,8 @@ void wrt_install_widget(const char *path,
 void wrt_uninstall_widget (const char * const pkg_name,
         void* userdata,
         WrtInstallerStatusCallback status_cb,
-        WrtProgressCallback progress_cb);
+        WrtProgressCallback progress_cb,
+        std::shared_ptr<PackageManager::IPkgmgrSignal> pkgmgrSignalInterface);
 
 /**
  *  @fn void wrt_install_plugin(const char *pluginDirectory,