--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+#SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+
+PROJECT(pkgmgr-info C)
+
+SET(VERSION 0.0.17)
+SET(VERSION_MAJOR 0)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(INCLUDEDIR "\${prefix}/include")
+
+set(CMAKE_SKIP_BUILD_RPATH true)
+
+### Local include directories
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/parser)
+
+### Required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+
+pkg_check_modules(libpkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1)
+
+FOREACH(flag ${libpkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+## About debug
+SET(debug_type "-DPM_CONSOLE_USE") # for debug - use console window
+
+## Additional flag
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+################## ## build comm libraries
+add_subdirectory(parser)
+
+## build pkgmgr-info library
+add_library(pkgmgr-info SHARED src/pkgmgrinfo_client.c src/pkgmgrinfo_db.c src/pkgmgrinfo_certinfo.c
+ src/pkgmgrinfo_appinfo.c src/pkgmgrinfo_pkginfo.c
+ src/pkgmgrinfo_private.c src/pkgmgr-info-internal.c)
+
+
+SET_TARGET_PROPERTIES(pkgmgr-info PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(pkgmgr-info PROPERTIES VERSION ${VERSION})
+TARGET_LINK_LIBRARIES(pkgmgr-info pkgmgr_parser ${libpkgs_LDFLAGS})
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pkgmgr-info.pc.in ${CMAKE_BINARY_DIR}/pkgmgr-info.pc @ONLY)
+configure_file(parser_path.conf.in parser_path.conf @ONLY)
+configure_file(pkgmgr-info.manifest.in pkgmgr-info.manifest @ONLY)
+configure_file(pkgmgr-parser.manifest.in pkgmgr-parser.manifest @ONLY)
+
+INSTALL(TARGETS pkgmgr-info DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-info.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgr-info.h DESTINATION include)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/parser_path.conf DESTINATION ${PREFIX}/etc/package-manager/)
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
--- /dev/null
+#!/bin/sh
+export TET_INSTALL_HOST_PATH=/dts_fw/TETware
+export TET_INSTALL_TARGET_PATH=/dts_fw/TETware
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # local tetware path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest xmlns="http://tizen.org/ns/packages" package="com.samsung.testapp" version="0.1.45" size="15" install-location="internal-only">\r
+ <label>Test App Global Label</label>\r
+ <author email="shobhit.s@samsung.com" href="www.samsung.com">Shobhit Srivastava</author>\r
+ <description>Test App Global Description</description>\r
+ <ui-application appid="com.samsung.uitestapp" exec="/opt/apps/com.samsung.testapp/bin/uitestapp" nodisplay="false" multiple="false" type="capp" taskmanage="true" hw-acceleration="use-system-setting">\r
+ <icon>com.samsung.uitestapp.png</icon>\r
+ <icon xml:lang="en-us">com.samsung.uitestapp.png in English US</icon>\r
+ <label>Test Ui App Localized Label</label>\r
+ <label xml:lang="en-us">Test Ui App Local Label in English US</label>\r
+ <category name="http://tizen.org/category/launcher"/>\r
+ <category name="http://tizen.org/category/calculator"/>\r
+ <category name="http://tizen.org/category/calendar"/>\r
+ <category name="http://tizen.org/category/homescreen"/>\r
+ <category name="http://tizen.org/category/alarm"/>\r
+ <category name="http://tizen.org/category/search"/>\r
+ <application-service>\r
+ <operation name="abcd"/>\r
+ <operation name="efgh"/>\r
+ <operation name="uvwx"/>\r
+ </application-service>\r
+ <app-control>\r
+ <operation name="SEARCH"/>\r
+ <operation name="EDIT"/>\r
+ <uri name="http"/>\r
+ <uri name="ftp"/>\r
+ <mime name="mp3"/>\r
+ </app-control>\r
+ <app-control>\r
+ <operation name="VIEW"/>\r
+ <operation name="DELETE"/>\r
+ <uri name="mtp"/>\r
+ <uri name="https"/>\r
+ <mime name="jpg"/>\r
+ <mime name="png"/>\r
+ </app-control>\r
+ </ui-application>\r
+ <service-application appid="com.samsung.svctestapp" exec="/opt/apps/com.samsung.testapp/bin/svctestapp" type="webapp" on-boot="true" auto-restart="false">\r
+ <icon>com.samsung.svctestapp.jpg</icon>\r
+ <icon xml:lang="ko-kr">com.samsung.svctestapp.jpg in Korean</icon>\r
+ <label>Test Svc App Localized Label</label>\r
+ <label xml:lang="en-us">Test Svc App Local Label in English US</label>\r
+ <category name="http://tizen.org/category/browser"/>\r
+ <category name="http://tizen.org/category/default"/>\r
+ <app-control>\r
+ <operation name="VIEW"/>\r
+ <operation name="DELETE"/>\r
+ <uri name="mtp"/>\r
+ <uri name="https"/>\r
+ <mime name="jpg"/>\r
+ <mime name="png"/>\r
+ </app-control>\r
+ </service-application>\r
+</manifest>\r
--- /dev/null
+#!/bin/sh
+export TET_INSTALL_PATH=/mnt/nfs/TETware
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+
+export TET_ROOT=$TET_TARGET_PATH
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+# TET reserved codes
+0 "PASS"
+1 "FAIL"
+2 "UNRESOLVED"
+3 "NOTINUSE"
+4 "UNSUPPORTED"
+5 "UNTESTED"
+6 "UNINITIATED"
+7 "NORESULT"
+
+# Test suite additional codes
+33 "INSPECT"
--- /dev/null
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/unit/tslist
--- /dev/null
+TET_OUTPUT_CAPTURE=False
+TET_BUILD_TOOL=make
--- /dev/null
+TET_OUTPUT_CAPTURE=False
+TET_CLEAN_TOOL=make clean
--- /dev/null
+TET_OUTPUT_CAPTURE=False
--- /dev/null
+CC ?= gcc
+
+TARGETS = utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func \
+ utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func \
+ utc_ApplicationFW_pkgmgrinfo_save_certinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_cert_value_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func \
+ utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func \
+ utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func \
+ utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func \
+ utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func \
+ utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func \
+ utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func \
+ utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func
+
+PKGS = glib-2.0 dlog pkgmgr-info pkgmgr-parser
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+LDFLAGS += -L/usr/lib -lpthread
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+all: $(TARGETS)
+
+$(TARGETS): %: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TARGETS)
--- /dev/null
+#!/bin/sh
+
+TMPSTR=$0
+SCRIPT=${TMPSTR##*/}
+
+if [ $# -lt 2 ]; then
+ echo "Usage) $SCRIPT module_name api_name"
+ exit 1
+fi
+
+MODULE=$1
+API=$2
+TEMPLATE=utc_MODULE_API_func.c.in
+TESTCASE=utc_${MODULE}_${API}_func
+
+sed -e '
+ s^@API@^'"$API"'^g
+ s^@MODULE@^'"$MODULE"'^g
+ ' $TEMPLATE > $TESTCASE.c
+
+if [ ! -e "$TESTCASE.c" ]; then
+ echo "Failed"
+ exit 1
+fi
+echo "Testcase file is $TESTCASE.c"
+echo "Done"
+echo "please put \"$TESTCASE\" as Target in Makefile"
+echo "please put \"/unit/$TESTCASE\" in tslist"
--- /dev/null
+/unit/utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func
+/unit/utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func
+/unit/utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_cert_value_func
+/unit/utc_ApplicationFW_pkgmgrinfo_save_certinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func
+/unit/utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func
+/unit/utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func
+/unit/utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func
+/unit/utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr_parser.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func_01(void);
+static void utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgr_parser_check_manifest_validation()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func_01(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_check_manifest_validation("/usr/share/packages/com.samsung.calculator.xml");
+ if (r < 0) {
+ tet_infoline
+ ("pkgmgr_parser_check_manifest_validation() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgr_parser_check_manifest_validation()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_check_manifest_validation_func_02(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_check_manifest_validation(NULL);
+ if (r == 0) {
+ tet_infoline
+ ("pkgmgr_parser_check_manifest_validation() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr_parser.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func_01(void);
+static void utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgr_parser_get_manifest_file()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func_01(void)
+{
+ char *manifest = NULL;
+ manifest = pkgmgr_parser_get_manifest_file("com.samsung.calculator");
+ if (manifest == NULL) {
+ tet_infoline
+ ("pkgmgr_parser_get_manifest_file() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgr_parser_get_manifest_file()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_get_manifest_file_func_02(void)
+{
+ char *manifest = NULL;
+ manifest = pkgmgr_parser_get_manifest_file(NULL);
+ if (manifest != NULL) {
+ tet_infoline
+ ("pkgmgr_parser_get_manifest_file() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
\ No newline at end of file
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr_parser.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func_01(void);
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgr_parser_parse_manifest_for_installation()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func_01(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_parse_manifest_for_installation("/mnt/nfs/pkgmgr-info/TC/com.samsung.testapp.xml", NULL);
+ if (r < 0) {
+ tet_infoline
+ ("pkgmgr_parser_parse_manifest_for_installation() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgr_parser_parse_manifest_for_installation()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_installation_func_02(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_parse_manifest_for_installation(NULL, NULL);
+ if (r == 0) {
+ tet_infoline
+ ("pkgmgr_parser_parse_manifest_for_installation() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr_parser.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func_01(void);
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgr_parser_parse_manifest_for_uninstallation()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func_01(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_parse_manifest_for_uninstallation("/mnt/nfs/pkgmgr-info/TC/com.samsung.testapp.xml", NULL);
+ if (r < 0) {
+ tet_infoline
+ ("pkgmgr_parser_parse_manifest_for_uninstallation() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgr_parser_parse_manifest_for_uninstallation()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_uninstallation_func_02(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_parse_manifest_for_uninstallation(NULL, NULL);
+ if (r == 0) {
+ tet_infoline
+ ("pkgmgr_parser_parse_manifest_for_uninstallation() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr_parser.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func_01(void);
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgr_parser_parse_manifest_for_upgrade()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func_01(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_parse_manifest_for_upgrade("/mnt/nfs/pkgmgr-info/TC/com.samsung.testapp.xml", NULL);
+ if (r < 0) {
+ tet_infoline
+ ("pkgmgr_parser_parse_manifest_for_upgrade() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgr_parser_parse_manifest_for_upgrade()
+ */
+static void utc_ApplicationFW_pkgmgr_parser_parse_manifest_for_upgrade_func_02(void)
+{
+ int r = -1;
+ r = pkgmgr_parser_parse_manifest_for_upgrade(NULL, NULL);
+ if (r == 0) {
+ tet_infoline
+ ("pkgmgr_parser_parse_manifest_for_upgrade() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_destroy_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_destroy_appinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_destroy_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_destroy_appinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_destroy_appinfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_destroy_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_add_bool()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, 1);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_bool() failed in positive test case");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_add_bool()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_filter_add_bool(NULL, PMINFO_APPINFO_PROP_APP_NODISPLAY, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_add_bool()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_bool_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_bool(handle, NULL, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_add_int()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_01(void)
+{
+ /*Currently No Integer property for App*/
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_add_int()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_filter_add_int(NULL, PMINFO_APPINFO_PROP_APP_MULTIPLE, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_add_int()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_int_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_int(handle, NULL, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_add_string()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_URI, "http");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_string() failed in positive test case");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_add_string()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_filter_add_string(NULL, PMINFO_APPINFO_PROP_APP_URI, "http");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_string() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_add_string()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_add_string_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_string(handle, NULL, "http");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_add_string() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_count()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_01(void)
+{
+ int r = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_URI, "http");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_count() failed in positive test case");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_count()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_02(void)
+{
+ int r = 0;
+ int count = 0;
+ r = pkgmgrinfo_appinfo_filter_count(NULL, &count);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_count() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_count()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_count_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_URI, "http");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_count(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_count() failed in negative test case");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_create()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_create() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_create()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_create_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_filter_create(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_create() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_destroy()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_destroy(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_destroy() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_destroy()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_destroy_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_filter_destroy(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_destroy() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_03(void);
+static int __filtered_app_list_cb(const pkgmgrinfo_appinfo_h handle, void *user_data);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __filtered_app_list_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_URI, "http");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, __filtered_app_list_cb, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_foreach_appinfo() failed in positive test case");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_filter_foreach_appinfo(NULL, __filtered_app_list_cb, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_foreach_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_filter_foreach_appinfo_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ r = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_URI, "http");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_filter_foreach_appinfo() failed in negative test case");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_03(void);
+static int __appcontrol_list_cb(pkgmgrinfo_appcontrol_h handle, void *user_data);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __appcontrol_list_cb(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_foreach_appcontrol()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb, NULL);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_infoline
+ ("pkgmgrinfo_appinfo_foreach_appcontrol() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_foreach_appcontrol()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(NULL, __appcontrol_list_cb, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_foreach_appcontrol() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_foreach_appcontrol()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_appcontrol_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_foreach_appcontrol() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_03(void);
+static int __category_list_cb(const char *name, void *user_data);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __category_list_cb(const char *name, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_foreach_category()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_category(handle, __category_list_cb, NULL);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_infoline
+ ("pkgmgrinfo_appinfo_foreach_category() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_foreach_category()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_foreach_category(NULL, __category_list_cb, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_foreach_category() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_foreach_category()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_foreach_category_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_category(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_foreach_category() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_appid()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *appid = NULL;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_appid() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_appid()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_appid(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_appid() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_appid()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appid_func_03(void)
+{
+ int r = 0;
+ char *appid = NULL;
+ r = pkgmgrinfo_appinfo_get_appid(NULL, &appid);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_appid() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_appinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_appinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_appinfo_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo(NULL, &handle);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_appinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_apptype()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *apptype = NULL;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_apptype(handle, &apptype);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_apptype() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_apptype()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_apptype(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_apptype() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_apptype()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_apptype_func_03(void)
+{
+ int r = 0;
+ char *apptype = NULL;
+ r = pkgmgrinfo_appinfo_get_apptype(NULL, &apptype);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_apptype() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_component()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_app_component component;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_component(handle, &component);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_component() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_component()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_component(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_component() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_component()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_component_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_app_component component;
+ r = pkgmgrinfo_appinfo_get_component(NULL, &component);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_component() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_exec()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *exec = NULL;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_exec(handle, &exec);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_exec() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_exec()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_exec(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_exec() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_exec()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_exec_func_03(void)
+{
+ int r = 0;
+ char *exec = NULL;
+ r = pkgmgrinfo_appinfo_get_exec(NULL, &exec);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_exec() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_hwacceleration()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool hwacceleration = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_hwacceleration() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_hwacceleration()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_hwacceleration(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_hwacceleration() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_hwacceleration()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_hwacceleration_func_03(void)
+{
+ int r = 0;
+ bool hwacceleration = 0;
+ r = pkgmgrinfo_appinfo_get_hwacceleration(NULL, &hwacceleration);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_hwacceleration() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_icon()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *icon = NULL;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_icon(handle, &icon);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_icon() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_icon()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_icon(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_icon() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_icon()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_icon_func_03(void)
+{
+ int r = 0;
+ char *icon = NULL;
+ r = pkgmgrinfo_appinfo_get_icon(NULL, &icon);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_icon() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int app_func(const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_installed_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func_01(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_get_installed_list(app_func, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_installed_list() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_installed_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_installed_list_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_get_installed_list(NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_installed_list() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_label()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *label = NULL;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_label(handle, &label);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_label() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_label()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_label(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_label() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_label()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_label_func_03(void)
+{
+ int r = 0;
+ char *label = NULL;
+ r = pkgmgrinfo_appinfo_get_label(NULL, &label);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_label() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_03(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_04(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_05(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_02, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_03, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_04, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_05, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int app_func(const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_list() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_list(handle, PMINFO_SVC_APP, app_func, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_list() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_list() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_04(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_appinfo_get_list(NULL, PMINFO_SVC_APP, app_func, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_list() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_list_func_05(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_list(handle, -5, app_func, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_list() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __appcontrol_list_cb1(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int mc = 0;
+ int ret = 0;
+ char **mime;
+ ret = pkgmgrinfo_appinfo_get_mime(handle, &mc, &mime);
+ if (ret == PMINFO_R_OK) {
+ tet_result(TET_PASS);
+ return -1;
+ }
+ else {
+ tet_result(TET_FAIL);
+ return -1;
+ }
+}
+
+static int __appcontrol_list_cb2(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_mime(handle, NULL, NULL);
+ if (ret == PMINFO_R_OK) {
+ tet_result(TET_FAIL);
+ return -1;
+ }
+ else {
+ tet_result(TET_PASS);
+ return -1;
+ }
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_mime()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb1, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_mime()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_mime_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb2, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __appcontrol_list_cb1(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int oc = 0;
+ int ret = 0;
+ char **operation;
+ ret = pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
+ if (ret == PMINFO_R_OK) {
+ tet_result(TET_PASS);
+ return -1;
+ }
+ else {
+ tet_result(TET_FAIL);
+ return -1;
+ }
+}
+
+static int __appcontrol_list_cb2(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_operation(handle, NULL, NULL);
+ if (ret == PMINFO_R_OK) {
+ tet_result(TET_FAIL);
+ return -1;
+ }
+ else {
+ tet_result(TET_PASS);
+ return -1;
+ }
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_operation()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb1, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_operation()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_operation_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb2, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_pkgname()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *pkgname = NULL;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_pkgname() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_pkgname()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_get_pkgname(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_pkgname() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_pkgname()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_pkgname_func_03(void)
+{
+ int r = 0;
+ char *pkgname = NULL;
+ r = pkgmgrinfo_appinfo_get_pkgname(NULL, &pkgname);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_get_pkgname() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __appcontrol_list_cb1(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int uc = 0;
+ int ret = 0;
+ char **uri;
+ ret = pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
+ if (ret == PMINFO_R_OK) {
+ tet_result(TET_PASS);
+ return -1;
+ }
+ else {
+ tet_result(TET_FAIL);
+ return -1;
+ }
+}
+
+static int __appcontrol_list_cb2(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_uri(handle, NULL, NULL);
+ if (ret == PMINFO_R_OK) {
+ tet_result(TET_FAIL);
+ return -1;
+ }
+ else {
+ tet_result(TET_PASS);
+ return -1;
+ }
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_get_uri()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb1, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_get_uri()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_get_uri_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.uitestapp", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __appcontrol_list_cb2, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_is_autorestart()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool autorestart = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_autorestart() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_autorestart()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_autorestart(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_autorestart() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_autorestart()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_autorestart_func_03(void)
+{
+ int r = 0;
+ bool autorestart = 0;
+ r = pkgmgrinfo_appinfo_is_autorestart(NULL, &autorestart);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_autorestart() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_is_multiple()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool multiple = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_multiple(handle, &multiple);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_multiple() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_multiple()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_multiple(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_multiple() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_multiple()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_multiple_func_03(void)
+{
+ int r = 0;
+ bool multiple = 0;
+ r = pkgmgrinfo_appinfo_is_multiple(NULL, &multiple);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_multiple() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_is_nodisplay()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool nodisplay = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_nodisplay() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_nodisplay()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_nodisplay(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_nodisplay() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_nodisplay()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_nodisplay_func_03(void)
+{
+ int r = 0;
+ bool nodisplay = 0;
+ r = pkgmgrinfo_appinfo_is_nodisplay(NULL, &nodisplay);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_nodisplay() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_is_onboot()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool onboot = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_onboot(handle, &onboot);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_onboot() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_onboot()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_onboot(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_onboot() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_onboot()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_onboot_func_03(void)
+{
+ int r = 0;
+ bool onboot = 0;
+ r = pkgmgrinfo_appinfo_is_onboot(NULL, &onboot);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_onboot() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_appinfo_is_taskmanage()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool taskmanage = 0;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_taskmanage() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_taskmanage()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_appinfo_h handle;
+ r = pkgmgrinfo_appinfo_get_appinfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_appinfo_is_taskmanage(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_taskmanage() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_appinfo_is_taskmanage()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_appinfo_is_taskmanage_func_03(void)
+{
+ int r = 0;
+ bool taskmanage = 0;
+ r = pkgmgrinfo_appinfo_is_taskmanage(NULL, &taskmanage);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_appinfo_is_taskmanage() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_create_certinfo_set_handle()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ r = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_create_certinfo_set_handle() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_create_certinfo_set_handle()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_create_certinfo_set_handle_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_create_certinfo_set_handle(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_create_certinfo_set_handle() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_create_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_create_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_create_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_create_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_create_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_create_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo(NULL, &handle);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_create_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_delete_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func_01(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_delete_certinfo("com.samsung.hello");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_delete_certinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_delete_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_delete_certinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_delete_certinfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_delete_certinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_destroy_certinfo_set_handle()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ r = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_destroy_certinfo_set_handle() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_destroy_certinfo_set_handle()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_destroy_certinfo_set_handle_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_destroy_certinfo_set_handle(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_destroy_certinfo_set_handle() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_destroy_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_destroy_pkgdbinfo(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_destroy_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_destroy_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_destroy_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_destroy_pkgdbinfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_destroy_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_create_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_certinfo_h handle;
+ r = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_create_certinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_create_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_create_certinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_create_certinfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_create_certinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_destroy_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_certinfo_h handle;
+ r = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_destroy_certinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_destroy_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_certinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_destroy_certinfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_destroy_certinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_destroy_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_destroy_pkginfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_destroy_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_destroy_pkginfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_destroy_pkginfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_destroy_pkginfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_add_bool()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, 1);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_bool() failed in positive test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_add_bool()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_filter_add_bool(NULL, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_add_bool()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_bool_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_bool(handle, NULL, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_bool() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_add_int()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_int(handle, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_int() failed in positive test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_add_int()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_filter_add_int(NULL, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_add_int()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_int_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_int(handle, NULL, 10);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_int() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_add_string()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_string() failed in positive test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_add_string()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_filter_add_string(NULL, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_string() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_add_string()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_add_string_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_string(handle, NULL, "rpm");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_add_string() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_count()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_01(void)
+{
+ int r = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_count() failed in positive test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_count()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_02(void)
+{
+ int r = 0;
+ int count = 0;
+ r = pkgmgrinfo_pkginfo_filter_count(NULL, &count);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_count() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_count()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_count_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_count(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_count() failed in negative test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_create()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_create() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_create()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_create_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_filter_create(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_create() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_destroy()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_destroy(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_destroy() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_destroy()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_destroy_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_filter_destroy(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_destroy() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_03(void);
+static int __filtered_pkg_list_cb(const pkgmgrinfo_pkginfo_h handle, void *user_data);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __filtered_pkg_list_cb(const pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, __filtered_pkg_list_cb, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_foreach_pkginfo() failed in positive test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(NULL, __filtered_pkg_list_cb, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_foreach_pkginfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_filter_foreach_pkginfo_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ r = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, 1);
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (r != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_filter_foreach_pkginfo() failed in negative test case");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_author_email()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *author_email = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_author_email(handle, &author_email);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_email() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_author_email()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_author_email(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_email() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_author_email()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_email_func_03(void)
+{
+ int r = 0;
+ char *author_email = NULL;
+ r = pkgmgrinfo_pkginfo_get_author_email(NULL, &author_email);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_email() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_author_href()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *author_href = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_author_href(handle, &author_href);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_href() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_author_href()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_author_href(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_href() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_author_href()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_href_func_03(void)
+{
+ int r = 0;
+ char *author_href = NULL;
+ r = pkgmgrinfo_pkginfo_get_author_href(NULL, &author_href);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_href() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_author_name()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *author_name = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_author_name(handle, &author_name);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_name() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_author_name()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_author_name(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_name() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_author_name()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_author_name_func_03(void)
+{
+ int r = 0;
+ char *author_name = NULL;
+ r = pkgmgrinfo_pkginfo_get_author_name(NULL, &author_name);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_author_name() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_cert_value()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_01(void)
+{
+ int r = 0;
+ char *auth_root = NULL;
+ pkgmgrinfo_certinfo_h handle;
+ r = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_load_certinfo("com.samsung.hello", handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_root);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_cert_value() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_cert_value()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_02(void)
+{
+ int r = 0;
+ char *auth_root = NULL;
+ r = pkgmgrinfo_pkginfo_get_cert_value(NULL, PMINFO_AUTHOR_ROOT_CERT, &auth_root);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_cert_value() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_cert_value()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_cert_value_func_03(void)
+{
+ int r = 0;
+ char *auth_root = NULL;
+ pkgmgrinfo_certinfo_h handle;
+ r = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_load_certinfo("com.samsung.hello", handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_cert_value(handle, 50, &auth_root);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_cert_value() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_description()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *description = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_description(handle, &description);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_description() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_description()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_description(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_description() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_description()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_description_func_03(void)
+{
+ int r = 0;
+ char *description = NULL;
+ r = pkgmgrinfo_pkginfo_get_description(NULL, &description);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_description() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_icon()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *icon = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_icon(handle, &icon);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_icon() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_icon()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_icon(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgr_pkginfo_get_icon() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_icon()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_icon_func_03(void)
+{
+ int r = 0;
+ char *icon = NULL;
+ r = pkgmgrinfo_pkginfo_get_icon(NULL, &icon);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_icon() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_install_location()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_install_location install_location = 0;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_install_location(handle, &install_location);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_install_location() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_install_location()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_install_location(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_install_location() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_install_location()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_install_location_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_install_location install_location = 0;
+ r = pkgmgrinfo_pkginfo_get_install_location(NULL, &install_location);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_install_location() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_installed_storage()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_installed_storage installed_storage;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_installed_storage(handle, &installed_storage);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_installed_storage() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_installed_storage()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_installed_storage(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_installed_storage() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_installed_storage()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_storage_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_installed_storage installed_storage;
+ r = pkgmgrinfo_pkginfo_get_installed_storage(NULL, &installed_storage);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_installed_storage() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_installed_time()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ int installed_time = -1;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_installed_time(handle, &installed_time);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_installed_time() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_installed_time()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_installed_time(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_installed_time() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_installed_time()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_installed_time_func_03(void)
+{
+ int r = 0;
+ int installed_time = -1;
+ r = pkgmgrinfo_pkginfo_get_installed_time(NULL, &installed_time);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_installed_time() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_label()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *label = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_label(handle, &label);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_label() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_label()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_label(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_label() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_label()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_label_func_03(void)
+{
+ int r = 0;
+ char *label = NULL;
+ r = pkgmgrinfo_pkginfo_get_label(NULL, &label);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_label() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func_02(void);
+static int __pkg_list_cb(const pkgmgrinfo_pkginfo_h handle, void *user_data);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int __pkg_list_cb(const pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ return 0;
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func_01(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_get_list(__pkg_list_cb, NULL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_list() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_list()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_list_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_get_list(NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_list() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_package_size()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ int package_size = -1;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_package_size(handle, &package_size);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_package_size() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_package_size()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_package_size(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_package_size() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_package_size()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_package_size_func_03(void)
+{
+ int r = 0;
+ int package_size = -1;
+ r = pkgmgrinfo_pkginfo_get_package_size(NULL, &package_size);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_package_size() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_pkginfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_pkginfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_pkginfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkginfo_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo(NULL, &handle);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_pkginfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_pkgname()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *pkgname = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_pkgname(handle, &pkgname);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_pkgname() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_pkgname()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_pkgname(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_pkgname() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_pkgname()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_pkgname_func_03(void)
+{
+ int r = 0;
+ char *pkgname = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkgname(NULL, &pkgname);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_pkgname() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_type()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *type = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_type() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_type()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_type(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_type() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_type()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_type_func_03(void)
+{
+ int r = 0;
+ char *type = NULL;
+ r = pkgmgrinfo_pkginfo_get_type(NULL, &type);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_type() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_get_version()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ char *version = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_version(handle, &version);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_version() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_version()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_get_version(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_version() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_get_version()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_get_version_func_03(void)
+{
+ int r = 0;
+ char *version = NULL;
+ r = pkgmgrinfo_pkginfo_get_version(NULL, &version);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_get_version() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_is_accessible()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ bool accessible = 0;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_accessible(handle, &accessible);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_accessible() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_accessible()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_accessible(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_accessible() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_accessible()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_accessible_func_03(void)
+{
+ int r = 0;
+ bool accessible = 0;
+ r = pkgmgrinfo_pkginfo_is_accessible(NULL, &accessible);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_accessible() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_is_preload()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ bool preload = 0;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_preload(handle, &preload);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_preload() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_preload()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_preload(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_preload() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_preload()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_preload_func_03(void)
+{
+ int r = 0;
+ bool preload = 0;
+ r = pkgmgrinfo_pkginfo_is_preload(NULL, &preload);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_preload() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_is_readonly()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ bool readonly = 0;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_readonly(handle, &readonly);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_readonly() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_readonly()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_readonly(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_readonly() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_readonly()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_readonly_func_03(void)
+{
+ int r = 0;
+ bool readonly = 0;
+ r = pkgmgrinfo_pkginfo_is_readonly(NULL, &readonly);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_readonly() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_is_removable()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ bool removable = 0;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_removable(handle, &removable);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_removable() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_removable()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ r = pkgmgrinfo_pkginfo_get_pkginfo("com.samsung.calculator", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_is_removable(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_removable() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_is_removable()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_is_removable_func_03(void)
+{
+ int r = 0;
+ bool removable = 0;
+ r = pkgmgrinfo_pkginfo_is_removable(NULL, &removable);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_is_removable() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_pkginfo_load_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_certinfo_h handle;
+ r = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_pkginfo_load_certinfo("com.samsung.hello", handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_load_certinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return;
+ }
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_pkginfo_load_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_pkginfo_load_certinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_pkginfo_load_certinfo("com.samsung.hello", NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_pkginfo_load_certinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_save_certinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_save_certinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_save_certinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_save_certinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_save_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_save_certinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ r = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_save_certinfo("com.samsung.hello", handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_save_certinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_save_certinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_save_certinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_save_certinfo("com.samsung.hello", NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_save_certinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_save_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_save_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_save_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_save_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_save_pkgdbinfo(NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_save_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func_02(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_author_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_author_to_pkgdbinfo(handle, "John", "john@samsung.com",
+ "www.samsung.com", "en-us");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_author_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_author_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_author_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_author_to_pkgdbinfo(NULL, "John", "john@samsung.com",
+ "www.samsung.com", "en-us");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_author_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_cert_value()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ r = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root cert");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_cert_value() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_cert_value()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_02(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_cert_value(NULL, PMINFO_SET_AUTHOR_ROOT_CERT, "author root cert");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_cert_value() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_cert_value()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_cert_value_func_03(void)
+{
+ int r = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ r = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_cert_value(handle, 50, "author root cert");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_cert_value() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ tet_result(TET_PASS);
+}
+
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_description_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_description_to_pkgdbinfo(handle, "sample test app", "en-us");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_description_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_description_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_description_to_pkgdbinfo(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_description_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_description_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_description_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_description_to_pkgdbinfo(NULL, "sample test app", "en-us");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_description_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_icon_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, "com.samsung.test.png", "en-us");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_icon_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_icon_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_icon_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_icon_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_icon_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_icon_to_pkgdbinfo(NULL, "com.samsung.test.png", "en-us");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_icon_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_install_location_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, INSTALL_EXTERNAL);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_install_location_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_install_location_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, -10);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_install_location_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_install_location_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_install_location_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_install_location_to_pkgdbinfo(NULL, INSTALL_INTERNAL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_install_location_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_label_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_label_to_pkgdbinfo(handle, "test", "en-us");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_label_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_label_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_label_to_pkgdbinfo(handle, NULL, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_label_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_label_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_label_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_label_to_pkgdbinfo(NULL, "test", "en-us");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_label_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_preload_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, 0);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_preload_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_preload_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, -10);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_preload_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_preload_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_preload_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_preload_to_pkgdbinfo(NULL, 0);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_preload_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_removable_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, 1);
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_removable_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_removable_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, -10);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_removable_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_removable_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_removable_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_removable_to_pkgdbinfo(NULL, 1);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_removable_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_size_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, INSTALL_EXTERNAL);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_size_to_pkgdbinfo(handle, "10");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_size_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_size_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_size_to_pkgdbinfo(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_size_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_size_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_size_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_size_to_pkgdbinfo(NULL, "10");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_size_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_type_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_type_to_pkgdbinfo(handle, "rpm");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_type_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_type_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_type_to_pkgdbinfo(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_type_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_type_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_type_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_type_to_pkgdbinfo(NULL, "rpm");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_type_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#include <tet_api.h>
+#include <pkgmgr-info.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup) (void) = startup;
+void (*tet_cleanup) (void) = cleanup;
+
+static void utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_01(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_02(void);
+static void utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_03(void);
+
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ {utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_01, POSITIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_02, NEGATIVE_TC_IDX},
+ {utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_03, NEGATIVE_TC_IDX},
+ {NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of pkgmgrinfo_set_version_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_01(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
+ if (r != PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_version_to_pkgdbinfo() failed in positive test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_version_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_02(void)
+{
+ int r = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ r = pkgmgrinfo_create_pkgdbinfo("com.samsung.test", &handle);
+ if (r != PMINFO_R_OK) {
+ tet_result(TET_UNINITIATED);
+ return;
+ }
+ r = pkgmgrinfo_set_version_to_pkgdbinfo(handle, NULL);
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_version_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return;
+ }
+ tet_result(TET_PASS);
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+}
+
+/**
+ * @brief Negative test case of pkgmgrinfo_set_version_to_pkgdbinfo()
+ */
+static void utc_ApplicationFW_pkgmgrinfo_set_version_to_pkgdbinfo_func_03(void)
+{
+ int r = 0;
+ r = pkgmgrinfo_set_version_to_pkgdbinfo(NULL, "0.0.1");
+ if (r == PMINFO_R_OK) {
+ tet_infoline
+ ("pkgmgrinfo_set_version_to_pkgdbinfo() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+#include <tet_api.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_@MODULE@_@API@_func_01(void);
+static void utc_@MODULE@_@API@_func_02(void);
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+ { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX },
+ { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX },
+};
+
+static void startup(void)
+{
+ int r;
+/*
+ char *err;
+ r = initailze...;
+ if (r) {
+ err = "Error message.......";
+ tet_infoline(err);
+ tet_delete(POSITIVE_TC_IDX, err);
+ tet_delete(NEGATIVE_TC_IDX, err);
+ }
+*/
+
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of @API@()
+ */
+static void utc_@MODULE@_@API@_func_01(void)
+{
+ int r = 0;
+
+/*
+ r = @API@(...);
+*/
+ if (r) {
+ tet_infoline("@API@() failed in positive test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init @API@()
+ */
+static void utc_@MODULE@_@API@_func_02(void)
+{
+ int r = 0;
+
+/*
+ r = @API@(...);
+*/
+ if (!r) {
+ tet_infoline("@API@() failed in negative test case");
+ tet_result(TET_FAIL);
+ return;
+ }
+ tet_result(TET_PASS);
+}
--- /dev/null
+pkgmgr-info (0.2.1) unstable; urgency=low
+
+ * Initial release
+ * Git: slp/pkgs/a/pkgmgr-info
+ * Tag: pkgmgr-info_0.2.1
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com> Thu, 24 May 2012 12:04:51 +0530
+
--- /dev/null
+Source: pkgmgr-info
+Section: devel
+Priority: extra
+Maintainer: Garima Shrivastava <garima.s@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+Build-Depends: debhelper (>= 5),libssl-dev, libslp-setting-dev, libslp-db-util-dev
+Standards-Version: 3.7.2
+
+Package: pkgmgr-info
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: <App2sd is a utility for enabling installation of applications to sd card and also to move to and from sd card.>
+
+Package: pkgmgr-info-dev
+Architecture: any
+Depends: app2sd (= ${Source-Version})
+Description: App2sd dev package
+
+Package: pkgmgr-info-doc
+Architecture: all
+Description: <App2sd is a utility for enabling installation of applications to sd card and also to move to and from sd card.>
+
+Package: pkgmgr-info-dbg
+Section: debug
+Architecture: any
+Depends: pkgmgr-info (= ${Source-Version})
+Description: pkgmgr-info dbg package
+
--- /dev/null
+/*
+ * Copyright (c) 2012 - 2013 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.
+ *
+ */
--- /dev/null
+usr/bin
+usr/sbin
--- /dev/null
+@PREFIX@/include/pkgmgr-info.h
+@PREFIX@/lib/pkgconfig/*.pc
--- /dev/null
+@PREFIX@/lib/*.so*
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_GNU_OS)
+
+CFLAGS ?= -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+# architecture is not arm
+ifneq (, $(findstring arm, $(DEB_HOST_ARCH)))
+ # do something here
+else
+ # do something here for arm
+endif
+
+CFLAGS += -fvisibility=hidden -fPIC
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+
+CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
+
+config.status:
+
+configure: configure-stamp
+
+configure-stamp:
+ dh_testdir
+ mkdir -p $(CMAKE_TMP_DIR);
+ export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CMAKE_TMP_DIR) && cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+ touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+ # Add here commands to compile the package.
+ cd $(CMAKE_TMP_DIR) && $(MAKE) all
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ cat $$f > $${f%.in}; \
+ sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+ sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+ done
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f *-stamp
+
+ rm -rf $(CMAKE_TMP_DIR)
+
+ for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+ rm -f $${f%.in}; \
+ done
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/ncurses.
+ cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+# dh_installdocs
+ dh_installexamples
+ dh_install --list-missing --sourcedir=debian/tmp
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip --dbg-package=app2sd-dbg
+ dh_compress
+ dh_fixperms
+# dh_perl
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+/**
+
+ *
+ * @ingroup SLP_PG
+ * @defgroup PackageManagerInfoGuide
+
+
+@par Package Manager Information Library Programming Guide
+
+<h1 class="pg"> Introduction</h1>
+<h2 class="pg"> Purpose of this document</h2>
+The purpose of this document is to describe how applications can use Package Manager Information APIs.\n
+This document gives only programming guidelines to application developers.
+
+<h2 class="pg"> Scope</h2>
+The scope of this document is limited to Samsung platform Package Manager Info API usage.
+
+<h1 class="pg"> Architecture</h1>
+<h2 class="pg"> Architecture overview</h2>
+Package Manager Information Library is responsible for getting/setting manifest file information from/to manifest DB.\n
+
+The library provides APIs to parse the package's manifest file\n
+It also provides APIs to insert/update/delete this parsed data from manifest DB.
+
+
+<h2 class="pg"> Features</h2>
+Package Manager Info Library has the following features:\n
+
+ - Get /Set Package Information in DB
+ - It provides API to get package manifest data from DB.
+ - It provides API to get package certificate data from DB.
+ - It provides API to set package manifest data in DB.
+ - It provides API to set package certificate data in DB.
+
+@image html SLP_pkgmgr_info.png "High-Level Architure depicting get/set operation"
+
+ - Filter Package/Application Information
+ - It provides API to filter package information query result.
+ - It provides API to filter application information query result.
+
+ - Manifest Parser
+ - It provides API to parse package manifest file.
+ - It provides API to insert/update/delete manifest data in DB.
+
+@image html SLP_pkgmgr_parser.png "High-Level Architure depicting manifest parsing"
+
+<h1 class="pg"> Package Manager API descriptions</h1>
+<b> SEE API manual </b>
+
+<h1 class="pg"> Package Manager Features with sample code</h1>
+<h2 class="pg"> Get /Set Package Information in DB</h2>
+
+Client application
+- Get package version from manifest DB
+
+@code
+#include <pkgmgr-info.h>
+
+static int get_pkg_version(const char *pkgid)
+{
+ int ret = 0;
+ char *version = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_version(handle, &version);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg version: %s\n", version);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+@endcode
+
+- Get package author root certificate from manifest DB
+
+@code
+static int get_cert_info(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_certinfo_h handle;
+ char *auth_cert = NULL;
+ ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ printf("Author root certificate: %s\n", auth_root);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return 0;
+}
+@endcode
+
+- Set package version in manifest DB
+
+@code
+#include <pkgmgr-info.h>
+
+static int set_pkg_version_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+@endcode
+
+- Set package author root certificate in manifest DB
+
+@code
+static int set_cert_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return 0;
+}
+@endcode
+
+
+<h2 class="pg"> Filter Package/Application Information </h2>
+
+- Filter number of installed rpm packages out of total number of packages installed.
+
+@code
+#include <pkgmgr-info.h>
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid = NULL;
+ pkgmgrinfo_pkginfo_get_pkgname(handle, &pkgid);
+ printf("pkg id : %s\n", pkgid);
+ return 0;
+}
+
+static int get_rpm_pkg_list()
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, pkg_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+@endcode
+
+- Filter number of installed applications which are of type "capp".
+
+@code
+#include <pkgmgr-info.h>
+
+static int get_capp_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of capp: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+@endcode
+
+<h2 class="pg"> Manifest Parser </h2>
+
+- Parse the package manifest file and insert the parsed data in manifest DB.
+
+@code
+#include <pkgmgr-info.h>
+
+static int parse_manifest_file_for_installation(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+@endcode
+
+
+- Parse the package manifest file and update the manifest DB with the parsed data.
+
+@code
+#include <pkgmgr-info.h>
+
+static int parse_manifest_file_for_upgrade(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_upgrade(manifest, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+@endcode
+
+- Parse the package manifest file and delete the parsed data from manifest DB.
+
+@code
+#include <pkgmgr-info.h>
+
+static int parse_manifest_file_for_uninstallation(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_uninstallation(manifest, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+@endcode
+
+
+*/
+
+/**
+@}
+*/
+
+
--- /dev/null
+/*
+ * pkgmgr-info-debug
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: junsuk. oh <junsuk77.oh@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __PKGMGR_INFO_DEBUG_H__
+#define __PKGMGR_INFO_DEBUG_H__
+
+#include <dlog.h>
+
+#define _LOGE(fmt, arg...) LOGE(fmt, ##arg)
+#define _LOGD(fmt, arg...) LOGD(fmt, ##arg)
+#define _LOGS(fmt, arg...) SECURE_LOGD(fmt, ##arg)
+
+#define PKGMGR_INFO_ENABLE_DLOG
+
+#ifdef PKGMGR_INFO_ENABLE_DLOG
+#define PKGMGR_INFO_DEBUG(fmt, ...)\
+ do\
+ {\
+ LOGD(fmt, ##__VA_ARGS__);\
+ } while (0)
+
+#define PKGMGR_INFO_DEBUG_ERR(fmt, ...)\
+ do\
+ {\
+ LOGE(fmt, ##__VA_ARGS__);\
+ }while (0)
+
+#define PKGMGR_INFO_BEGIN() \
+ do\
+ {\
+ LOGD("BEGIN >>>>");\
+ } while( 0 )
+
+#define PKGMGR_INFO_END() \
+ do\
+ {\
+ LOGD("END <<<<");\
+ } \
+ while( 0 )
+
+#else
+#define PKGMGR_INFO_DEBUG(fmt, ...) \
+ do\
+ {\
+ printf("\n [%s: %s(): %d] " fmt"\n", rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
+ } while (0)
+
+#define PKGMGR_INFO_BEGIN() \
+ do\
+ {\
+ printf("\n [%s: %d] : BEGIN >>>> %s() \n", rindex(__FILE__, '/')+1, __LINE__ , __FUNCTION__);\
+ } while( 0 )
+
+#define PKGMGR_INFO_END() \
+ do\
+ {\
+ printf("\n [%s: %d]: END <<<< %s()\n", rindex(__FILE__, '/')+1, __LINE__ , __FUNCTION__); \
+ } \
+ while( 0 )
+#endif
+
+
+#define ret_if(expr) do { \
+ if (expr) { \
+ PKGMGR_INFO_DEBUG_ERR("(%s) ", #expr); \
+ return; \
+ } \
+} while (0)
+
+#define retm_if(expr, fmt, arg...) do { \
+ if (expr) { \
+ PKGMGR_INFO_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
+ return; \
+ } \
+ } while (0)
+
+#define retv_if(expr, val) do { \
+ if (expr) { \
+ PKGMGR_INFO_DEBUG_ERR("(%s) ", #expr); \
+ return (val); \
+ } \
+ } while (0)
+
+#define retvm_if(expr, val, fmt, arg...) do { \
+ if (expr) { \
+ PKGMGR_INFO_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
+ return (val); \
+ } \
+} while (0)
+
+#define tryvm_if(expr, val, fmt, arg...) do { \
+ if (expr) { \
+ PKGMGR_INFO_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
+ val; \
+ goto catch; \
+ } \
+} while (0)
+
+#endif /* __PKGMGR_INFO_DEBUG_H__ */
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef __PKGMGR_INFO_INTERNAL_H__
+#define __PKGMGR_INFO_INTERNAL_H__
+
+#ifndef DEPRECATED
+#define DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#define MMC_PATH "/opt/storage/sdcard"
+#define PKG_SD_PATH MMC_PATH"/app2sd/"
+
+#define PKG_RW_PATH "/opt/usr/apps/"
+#define PKG_RO_PATH "/usr/apps/"
+#define BLOCK_SIZE 4096 /*in bytes*/
+
+#define PKG_TYPE_STRING_LEN_MAX 128
+#define PKG_VERSION_STRING_LEN_MAX 128
+#define PKG_VALUE_STRING_LEN_MAX 512
+#define PKG_LOCALE_STRING_LEN_MAX 8
+
+#define MAX_QUERY_LEN 4096
+#define MAX_CERT_TYPE 9
+
+#define MANIFEST_DB "/opt/dbspace/.pkgmgr_parser.db"
+#define CERT_DB "/opt/dbspace/.pkgmgr_cert.db"
+#define DATACONTROL_DB "/opt/usr/dbspace/.app-package.db"
+
+/*String properties for filtering based on package info*/
+typedef enum _pkgmgrinfo_pkginfo_filter_prop_str {
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR = 101,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_ID = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_STR = E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF
+} pkgmgrinfo_pkginfo_filter_prop_str;
+
+/*Boolean properties for filtering based on package info*/
+typedef enum _pkgmgrinfo_pkginfo_filter_prop_bool {
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL = 201,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING
+} pkgmgrinfo_pkginfo_filter_prop_bool;
+
+/*Integer properties for filtering based on package info*/
+typedef enum _pkgmgrinfo_pkginfo_filter_prop_int {
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT = 301,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_INT = E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE
+} pkgmgrinfo_pkginfo_filter_prop_int;
+
+/*String properties for filtering based on app info*/
+typedef enum _pkgmgrinfo_appinfo_filter_prop_str {
+ E_PMINFO_APPINFO_PROP_APP_MIN_STR = 401,
+ E_PMINFO_APPINFO_PROP_APP_ID = E_PMINFO_APPINFO_PROP_APP_MIN_STR,
+ E_PMINFO_APPINFO_PROP_APP_COMPONENT,
+ E_PMINFO_APPINFO_PROP_APP_EXEC,
+ E_PMINFO_APPINFO_PROP_APP_ICON,
+ E_PMINFO_APPINFO_PROP_APP_TYPE,
+ E_PMINFO_APPINFO_PROP_APP_OPERATION,
+ E_PMINFO_APPINFO_PROP_APP_URI,
+ E_PMINFO_APPINFO_PROP_APP_MIME,
+ E_PMINFO_APPINFO_PROP_APP_HWACCELERATION,
+ E_PMINFO_APPINFO_PROP_APP_CATEGORY,
+ E_PMINFO_APPINFO_PROP_APP_SCREENREADER,
+ E_PMINFO_APPINFO_PROP_APP_MAX_STR = E_PMINFO_APPINFO_PROP_APP_CATEGORY
+} pkgmgrinfo_appinfo_filter_prop_str;
+
+/*Boolean properties for filtering based on app info*/
+typedef enum _pkgmgrinfo_appinfo_filter_prop_bool {
+ E_PMINFO_APPINFO_PROP_APP_MIN_BOOL = 501,
+ E_PMINFO_APPINFO_PROP_APP_NODISPLAY = E_PMINFO_APPINFO_PROP_APP_MIN_BOOL,
+ E_PMINFO_APPINFO_PROP_APP_MULTIPLE,
+ E_PMINFO_APPINFO_PROP_APP_ONBOOT,
+ E_PMINFO_APPINFO_PROP_APP_AUTORESTART,
+ E_PMINFO_APPINFO_PROP_APP_TASKMANAGE,
+ E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION,
+ E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION
+} pkgmgrinfo_appinfo_filter_prop_bool;
+
+/*Integer properties for filtering based on app info*/
+typedef enum _pkgmgrinfo_appinfo_filter_prop_int {
+ /*Currently No Fields*/
+ E_PMINFO_APPINFO_PROP_APP_MIN_INT = 601,
+ E_PMINFO_APPINFO_PROP_APP_MAX_INT = E_PMINFO_APPINFO_PROP_APP_MIN_INT
+} pkgmgrinfo_appinfo_filter_prop_int;
+
+/*Integer properties for filtering based on app info*/
+typedef enum _pkgmgrinfo_pkginfo_filter_prop_range {
+ /*Currently No Fields*/
+ E_PMINFO_PKGINFO_PROP_RANGE_MIN_INT = 701,
+ E_PMINFO_PKGINFO_PROP_RANGE_BASIC,
+ E_PMINFO_PKGINFO_PROP_RANGE_MAX_INT = E_PMINFO_PKGINFO_PROP_RANGE_BASIC
+} pkgmgrinfo_pkginfo_filter_prop_range;
+
+
+pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property);
+pkgmgrinfo_pkginfo_filter_prop_int _pminfo_pkginfo_convert_to_prop_int(const char *property);
+pkgmgrinfo_pkginfo_filter_prop_bool _pminfo_pkginfo_convert_to_prop_bool(const char *property);
+
+pkgmgrinfo_appinfo_filter_prop_str _pminfo_appinfo_convert_to_prop_str(const char *property);
+pkgmgrinfo_appinfo_filter_prop_int _pminfo_appinfo_convert_to_prop_int(const char *property);
+pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property);
+
+pkgmgrinfo_pkginfo_filter_prop_range _pminfo_pkginfo_convert_to_prop_range(const char *property);
+
+int _pkgmgrinfo_validate_cb(void *data, int ncols, char **coltxt, char **colname);
+
+#endif /* __PKGMGR_INFO_INTERNAL_H__ */
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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 pkgmgr-info.h
+ * @author Sewook Park <sewook7.park@samsung.com>
+ * @author Shobhit Srivastava <shobhit.s@samsung.com>
+ * @version 0.1
+ * @brief This file declares API of pkgmgr-info library
+ *
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup PackageManagerInfo
+ * @section Header Header file to include:
+ * @code
+ * #include <pkgmgr-info.h>
+ * @endcode
+ *
+ * @}
+ */
+
+#ifndef __PKG_INFO_H__
+#define __PKG_INFO_H__
+
+#include <errno.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * @mainpage
+ *
+ * This is package information library
+ *
+ * Package Information Library is used to get package related information.\n
+ * It uses the package manifest information database to get any package related information\n
+ * It also provides API to set information in the package info database\n
+ *
+ */
+
+/**
+ * @file pkgmgr-info.h
+ * @brief Package Information Library Header File
+ *
+ * Generated by Sewook Park <sewook7.park@samsung.com>
+ */
+
+
+/**
+ * @brief A handle to insert certificate information
+ */
+typedef void* pkgmgrinfo_instcertinfo_h;
+
+/**
+ * @brief Certificate Types to be used for setting information
+ */
+typedef enum {
+ PMINFO_SET_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
+ PMINFO_SET_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
+ PMINFO_SET_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
+ PMINFO_SET_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
+ PMINFO_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
+ PMINFO_SET_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
+ PMINFO_SET_DISTRIBUTOR2_ROOT_CERT = 6, /**< End Entity Root Certificate*/
+ PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< End Entity Intermediate Certificate*/
+ PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT = 8, /**< End Entity Signer Certificate*/
+}pkgmgrinfo_instcert_type;
+
+typedef enum {
+ PMINFO_CERT_COMPARE_MATCH,
+ PMINFO_CERT_COMPARE_MISMATCH,
+ PMINFO_CERT_COMPARE_LHS_NO_CERT,
+ PMINFO_CERT_COMPARE_RHS_NO_CERT,
+ PMINFO_CERT_COMPARE_BOTH_NO_CERT,
+ PMINFO_CERT_COMPARE_ERROR,
+} pkgmgrinfo_cert_compare_result_type_e;
+
+/**
+ * @brief API return values
+ */
+enum {
+ PMINFO_R_EINVAL = -2, /**< Invalid argument */
+ PMINFO_R_ERROR = -1, /**< General error */
+ PMINFO_R_OK = 0 /**< General success */
+};
+
+/**
+ * @brief Value to be used when filtering based on install location
+ */
+#define PMINFO_PKGINFO_INSTALL_LOCATION_AUTO "LOCATION_AUTO"
+
+/**
+ * @brief Value to be used when filtering based on install location
+ */
+#define PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL "LOCATION_INTERNAL"
+
+/**
+ * @brief Value to be used when filtering based on install location
+ */
+#define PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL "LOCATION_EXTERNAL"
+
+/**
+ * @brief Value to be used when filtering based on app-component
+ */
+#define PMINFO_APPINFO_UI_APP "UI_APP"
+
+/**
+ * @brief Value to be used when filtering based on app-component
+ */
+#define PMINFO_APPINFO_SVC_APP "SVC_APP"
+
+typedef enum {
+ PMINFO_HWACCELERATION_NOT_USE_GL = 0, /**< Don't use hardware acceleration*/
+ PMINFO_HWACCELERATION_USE_GL = 1, /**< Use hardware acceleration*/
+ PMINFO_HWACCELERATION_USE_SYSTEM_SETTING = 2 /**< Follow system setting for hardware acceleration */
+}pkgmgrinfo_app_hwacceleration;
+
+typedef enum {
+ PMINFO_SCREENREADER_OFF = 0, /**< Don't use screen reader*/
+ PMINFO_SCREENREADER_ON = 1, /**< Use screen reader*/
+ PMINFO_SCREENREADER_USE_SYSTEM_SETTING = 2 /**< Follow system setting for screen reader */
+}pkgmgrinfo_app_screenreader;
+
+typedef enum {
+ PMINFO_RECENTIMAGE_USE_ICON = 0, /**<Use icon for recent image*/
+ PMINFO_RECENTIMAGE_USE_CAPTURE = 1, /**< Use capture for recent image*/
+ PMINFO_RECENTIMAGE_USE_NOTHING = 2 /**< Don't use recent image */
+}pkgmgrinfo_app_recentimage;
+
+/**
+ * @brief A handle to get package information
+ */
+typedef void* pkgmgrinfo_pkginfo_h;
+
+/**
+ * @brief A handle to get application information
+ */
+typedef void* pkgmgrinfo_appinfo_h;
+
+/**
+ * @brief A handle to get certificate information
+ */
+typedef void* pkgmgrinfo_certinfo_h;
+
+/**
+ * @brief A handle to insert package information
+ */
+typedef void* pkgmgrinfo_pkgdbinfo_h;
+
+/**
+ * @brief A handle to filter package information
+ */
+typedef void* pkgmgrinfo_pkginfo_filter_h;
+
+/**
+ * @brief A handle to filter application information
+ */
+typedef void* pkgmgrinfo_appinfo_filter_h;
+
+/**
+ * @brief A handle to filter application metadata information
+ */
+typedef void* pkgmgrinfo_appinfo_metadata_filter_h;
+
+/**
+ * @brief A handle to get appcontrol information
+ */
+typedef void* pkgmgrinfo_appcontrol_h;
+
+/**
+ * @fn int (*pkgmgrinfo_pkg_list_cb ) (const pkgmgrinfo_pkginfo_h handle, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ *
+ * @param[in] handle the pkginfo handle
+ * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_pkginfo_get_list()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ */
+typedef int (*pkgmgrinfo_pkg_list_cb ) (const pkgmgrinfo_pkginfo_h handle,
+ void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_app_list_cb ) (const pkgmgrinfo_appinfo_h handle, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
+ *
+ * @param[in] handle the appinfo handle
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_get_list()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @see pkgmgrinfo_appinfo_metadata_filter_foreach()
+ */
+typedef int (*pkgmgrinfo_app_list_cb ) (const pkgmgrinfo_appinfo_h handle,
+ void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_app_category_list_cb ) (const char *category_name, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @param[in] category_name the name of the category
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_foreach_category()
+ */
+typedef int (*pkgmgrinfo_app_category_list_cb ) (const char *category_name,
+ void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @param[in] permission_name the name of the permission
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_foreach_category()
+ */
+typedef int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type,
+ void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_pkg_privilege_list_cb ) (const char *privilege_name, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
+ *
+ * @param[in] privilege_name the name of the privilege
+ * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_foreach_privilege()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_pkginfo_foreach_privilege()
+ */
+typedef int (*pkgmgrinfo_pkg_privilege_list_cb ) (const char *privilege_name,
+ void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_app_metadata_list_cb ) (const char *metadata_key, const char *metadata_value, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_metadata()
+ *
+ * @param[in] metadata_name the name of the metadata
+ * @param[in] metadata_value the value of the metadata
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_metadata()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_foreach_metadata()
+ */
+typedef int (*pkgmgrinfo_app_metadata_list_cb ) (const char *metadata_key,
+ const char *metadata_value, void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_app_control_list_cb ) (pkgmgrinfo_appcontrol_h handle, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
+ *
+ * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_foreach_appcontrol()
+ */
+typedef int (*pkgmgrinfo_app_control_list_cb ) (pkgmgrinfo_appcontrol_h handle,
+ void *user_data);
+
+/**
+ * @brief Install Location Types
+ */
+typedef enum {
+ PMINFO_INSTALL_LOCATION_AUTO = 0, /**< Auto*/
+ PMINFO_INSTALL_LOCATION_INTERNAL_ONLY, /**< Internal Installation*/
+ PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL, /**< External Installation*/
+}pkgmgrinfo_install_location;
+
+/**
+ * @brief Application Component Types
+ */
+typedef enum {
+ PMINFO_ALL_APP = 0, /**< All Application*/
+ PMINFO_UI_APP, /**< UI Application*/
+ PMINFO_SVC_APP, /**< Service Application*/
+}pkgmgrinfo_app_component;
+
+/**
+ * @brief Application Storage Types
+ */
+typedef enum {
+ PMINFO_INTERNAL_STORAGE = 0, /**< Internal Storage*/
+ PMINFO_EXTERNAL_STORAGE = 1, /**< External Storage*/
+}pkgmgrinfo_installed_storage;
+
+/**
+ * @brief Certificate Types to be used for getting information
+ */
+typedef enum {
+ PMINFO_AUTHOR_ROOT_CERT = 0, /**< Author Root Certificate*/
+ PMINFO_AUTHOR_INTERMEDIATE_CERT = 1, /**< Author Intermediate Certificate*/
+ PMINFO_AUTHOR_SIGNER_CERT = 2, /**< Author Signer Certificate*/
+ PMINFO_DISTRIBUTOR_ROOT_CERT = 3, /**< Distributor Root Certificate*/
+ PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4, /**< Distributor Intermediate Certificate*/
+ PMINFO_DISTRIBUTOR_SIGNER_CERT = 5, /**< Distributor Signer Certificate*/
+ PMINFO_DISTRIBUTOR2_ROOT_CERT = 6, /**< End Entity Root Certificate*/
+ PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, /**< End Entity Intermediate Certificate*/
+ PMINFO_DISTRIBUTOR2_SIGNER_CERT = 8, /**< End Entity Signer Certificate*/
+}pkgmgrinfo_cert_type;
+
+/**
+ * @brief Install Location Types to be used when setting data in DB
+ */
+typedef enum {
+ INSTALL_INTERNAL = 0, /**< Internal Installation*/
+ INSTALL_EXTERNAL, /**< External Installation*/
+} INSTALL_LOCATION;
+
+ /**
+ * @brief permission Types
+ */
+ typedef enum {
+ PMINFO_PERMISSION_NORMAL = 0, /**< permission normal*/
+ PMINFO_PERMISSION_SIGNATURE, /**< permission type is signature*/
+ PMINFO_PERMISSION_PRIVILEGE, /**< permission type is privilege*/
+ }pkgmgrinfo_permission_type;
+
+
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_ID "PMINFO_PKGINFO_PROP_PACKAGE_ID"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_TYPE "PMINFO_PKGINFO_PROP_PACKAGE_TYPE"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_VERSION "PMINFO_PKGINFO_PROP_PACKAGE_VERSION"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION "PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE "PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL"
+ /** String property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF"
+
+ /** Boolean property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
+ /** Boolean property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
+ /** Boolean property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_READONLY "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
+ /** Boolean property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_UPDATE "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE"
+ /** Boolean property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING "PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING"
+ /** Boolean property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING"
+
+ /** Integer property for filtering based on package info*/
+#define PMINFO_PKGINFO_PROP_PACKAGE_SIZE "PMINFO_PKGINFO_PROP_PACKAGE_SIZE"
+
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_ID "PMINFO_APPINFO_PROP_APP_ID"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_COMPONENT "PMINFO_APPINFO_PROP_APP_COMPONENT"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_EXEC "PMINFO_APPINFO_PROP_APP_EXEC"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_ICON "PMINFO_APPINFO_PROP_APP_ICON"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_TYPE "PMINFO_APPINFO_PROP_APP_TYPE"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_OPERATION "PMINFO_APPINFO_PROP_APP_OPERATION"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_URI "PMINFO_APPINFO_PROP_APP_URI"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_MIME "PMINFO_APPINFO_PROP_APP_MIME"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_CATEGORY "PMINFO_APPINFO_PROP_APP_CATEGORY"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_HWACCELERATION "PMINFO_APPINFO_PROP_APP_HWACCELERATION"
+ /** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_SCREENREADER "PMINFO_APPINFO_PROP_APP_SCREENREADER"
+
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_NODISPLAY "PMINFO_APPINFO_PROP_APP_NODISPLAY"
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_MULTIPLE "PMINFO_APPINFO_PROP_APP_MULTIPLE"
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_ONBOOT "PMINFO_APPINFO_PROP_APP_ONBOOT"
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_AUTORESTART "PMINFO_APPINFO_PROP_APP_AUTORESTART"
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_TASKMANAGE "PMINFO_APPINFO_PROP_APP_TASKMANAGE"
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
+
+ /** will be updated*/
+ /** string property for filtering based on pkg info*/
+#define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC"
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+ * @brief This API gets list of installed packages
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] pkg_list_cb iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid1 = NULL;
+ char *pkgid2 = NULL;
+ pkgid1 = (char *)user_data;
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
+ if (strcmp(pkgid1, pkgid2) == 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int list_pkgs()
+{
+ int ret = 0;
+ char *name = "helloworld";
+ ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, (void *)name);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_mounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+ * @brief This API gets list of package which are installed in sd card when sd card is mounted
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] pkg_list_cb iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid2 = NULL;
+
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
+ printf("appid: %s\n", pkgid2);
+
+ return 0;
+}
+
+static int mounted_list_pkgs()
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_pkginfo_get_mounted_list(pkg_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_mounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_unmounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+ * @brief This API gets list of package which are installed in sd card when sd card is unmounted
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] pkg_list_cb iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid2 = NULL;
+
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
+ printf("appid: %s\n", pkgid2);
+
+ return 0;
+}
+
+static int unmounted_list_pkgs()
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_pkginfo_get_unmounted_list(pkg_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_unmounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+ * @brief This API gets list of disabled package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] pkg_list_cb iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid2 = NULL;
+
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
+ printf("appid: %s\n", pkgid2);
+
+ return 0;
+}
+
+static int disabled_list_pkgs()
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_pkginfo_get_disabled_list(pkg_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_unmounted_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+ * @brief This API creates the package information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @param[out] handle pointer to the package info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_type(const char *pkgid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_unmounted_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgtype: %s\n", type);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_unmounted_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
+
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+ * @brief This API creates the package information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @param[out] handle pointer to the package info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_type(const char *pkgid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_disabled_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgtype: %s\n", type);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+ * @brief This API creates the package information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @param[out] handle pointer to the package info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_type(const char *pkgid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgtype: %s\n", type);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
+ * @brief This API gets the package name from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] pkg_name pointer to hold package name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_type()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_name(const char *pkgid)
+{
+ int ret = 0;
+ char *pkgname = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_pkgname(handle, &pkgname);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgname: %s\n", pkgname);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid)
+ * @brief This API gets the package id from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] pkgid pointer to hold package id
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_type()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkgid(const char *pkgid)
+{
+ int ret = 0;
+ char *pkg_id = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkg_id);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg id: %s\n", pkg_id);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type)
+ * @brief This API gets the package type from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] type pointer to hold package type
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_type(const char *pkgid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgtype: %s\n", type);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version)
+ * @brief This API gets the package version from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] version pointer to hold package version
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_version(const char *pkgid)
+{
+ int ret = 0;
+ char *version = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_version(handle, &version);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg version: %s\n", version);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
+ * @brief This API gets the package install location from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] location pointer to hold package install location
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_install_location(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_install_location location;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_install_location(handle, &location);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg install location: %d\n", location);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size)
+ * @brief This API gets the package size from the package ID. size will be 0 if package install location is internal-only.
+ size will be 0 if package install location is prefer-external but size is not specified in manifest file.Application should check
+ the return value of pkgmgrinfo_pkginfo_get_install_location() and use it to distinguish the above cases.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] size pointer to hold package size
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_size(const char *pkgid)
+{
+ int ret = 0;
+ int size = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_package_size(handle, &size);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgsize: %d\n", size);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size)
+ * @brief This API gets the installed package total size on the target.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] size pointer to hold package total size
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_pkg_total_size(const char *pkgid)
+{
+ int ret = 0;
+ int size = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_total_size(handle, &size);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg total size: %d\n", size);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+ int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size)
+ * @brief This API gets the installed package data size on the target.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] size pointer to hold package data size
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_pkg_data_size(const char *pkgid)
+{
+ int ret = 0;
+ int size = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_data_size(handle, &size);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg data size: %d\n", size);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+ int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_size_info(pkgmgrinfo_pkginfo_h handle, int *total_size, int *data_size)
+ * @brief This API gets the size information for given package on the target.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] total_size pointer to hold package total size
+ * @param[out] data_size pointer to hold package data size
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_pkg_data_size(const char *pkgid)
+{
+ int ret = 0;
+ int total_size = 0;
+ int data_size = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_size_info(handle, &total_size, &data_size);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg size: total=%d, data=%d\n", total_size, data_size);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_size_info(pkgmgrinfo_pkginfo_h handle, int *total_size, int *data_size);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
+ * @brief This API gets the package icon from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] icon pointer to hold package icon
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_icon(const char *pkgid)
+{
+ int ret = 0;
+ char *icon = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_icon(handle, &icon);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg icon: %s\n", icon);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
+ * @brief This API gets the package label from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] label pointer to hold package label
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_label(const char *pkgid)
+{
+ int ret = 0;
+ char *label = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_label(handle, &label);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg label: %s\n", label);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
+ * @brief This API gets the package description from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] description pointer to hold package description
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_description(const char *pkgid)
+{
+ int ret = 0;
+ char *description = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_description(handle, &description);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg description: %s\n", description);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
+ * @brief This API gets the package's author name from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] author_name pointer to hold package author name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_author_name(const char *pkgid)
+{
+ int ret = 0;
+ char *author_name = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_author_name(handle, &author_name);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg author name: %s\n", author_name);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
+ * @brief This API gets the package's author email from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] author_email pointer to hold package author email
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_author_email(const char *pkgid)
+{
+ int ret = 0;
+ char *author_email = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_author_email(handle, &author_email);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg author email: %s\n", author_email);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
+ * @brief This API gets the package's author href from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] author_href pointer to hold package author href
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_author_href(const char *pkgid)
+{
+ int ret = 0;
+ char *author_href = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_author_href(handle, &author_href);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg author href: %s\n", author_href);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
+ * @brief This API gets the package installed storagae value from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] storage pointer to hold package installed storage
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_installed_storage(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_installed_storage storage;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, &storage);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg installed storage: %d\n", storage);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
+ * @brief This API gets the installed time of package from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] installed_time pointer to hold installed time of package
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_installed_time(const char *pkgid)
+{
+ int ret = 0;
+ int installed_time = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &installed_time);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("installed_time: %d\n", installed_time);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
+ * @brief This API gets the store client id of package from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] storeclientid pointer to hold store client id of package
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_storeclientid(const char *pkgid)
+{
+ int ret = 0;
+ char *storeclientid = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_storeclientid(handle, &storeclientid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf(store client id: %s\n", storeclientid);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
+ * @brief This API gets the main app id of package from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] mainappid pointer to hold main app id of package
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_mainappid(const char *pkgid)
+{
+ int ret = 0;
+ char *mainappid = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &mainappid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf(main app id: %s\n", mainappid);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
+ * @brief This API gets the url of package from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] url pointer to hold url of package
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_url(const char *pkgid)
+{
+ int ret = 0;
+ char *url = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_url(handle, &url);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("url : %s\n", url);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url);
+
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
+ * @brief This API gets the root path of package
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] path pointer to hold root path of package
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_root_path(const char *pkgid)
+{
+ int ret = 0;
+ char *path = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("path : %s\n", path);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path);
+
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
+ * @brief This API gets the csc path of package
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] path pointer to hold csc path of package
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_csc_path(const char *pkgid)
+{
+ int ret = 0;
+ char *path = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &path);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("path : %s\n", path);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
+ * @brief This API compare the cert information from given package id
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] lhs_package_id pointer to first package ID
+ * @param[in] rhs_package_id pointer to second package ID
+ * @param[out] compare_result pointer to the compare result.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
+{
+ int ret = 0;
+ pkgmgrinfo_cert_compare_result_type_e result;
+
+ ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lhs_package_id, rhs_package_id, &result);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ printf("result: %d\n", result);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
+ * @brief This API compare the cert information from given app id
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] lhs_app_id pointer to first app ID
+ * @param[in] rhs_app_id pointer to second app ID
+ * @param[out] compare_result pointer to the compare result.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
+{
+ int ret = 0;
+ pkgmgrinfo_cert_compare_result_type_e result;
+
+ ret = pkgmgrinfo_pkginfo_compare_app_cert_info(lhs_app_id, rhs_app_id, &result);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ printf("result: %d\n", result);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
+ * @brief This API gets the package 'removable' value from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] removable pointer to hold package removable value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_readonly()
+ * @code
+static int get_pkg_removable(const char *pkgid)
+{
+ int ret = 0;
+ bool removable;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_removable(handle, &removable);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg removable: %d\n", removable);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
+ * @brief This API check that the package can move internal storage to external storage or external storage to internal storage from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] movable pointer to hold package movable state
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @code
+static int get_pkg_movable(const char *pkgid)
+{
+ int ret = 0;
+ bool movable;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_movable(handle, &movable);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg movable: %d\n", movable);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
+ * @brief This API gets the package 'preload' value from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] preload pointer to hold package preload value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_readonly()
+ * @code
+static int get_pkg_preload(const char *pkgid)
+{
+ int ret = 0;
+ bool preload;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_preload(handle, &preload);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg preload: %d\n", preload);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
+ * @brief This API gets the value for given handle is system or not
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] system pointer to hold system is or not
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_readonly()
+ * @code
+static int get_pkg_system(const char *pkgid)
+{
+ int ret = 0;
+ bool system = false;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg system: %d\n", system);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
+ * @brief This API gets the package 'readonly' value from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] readonly pointer to hold package readonly value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_readonly(const char *pkgid)
+{
+ int ret = 0;
+ bool readonly;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_readonly(handle, &readonly);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg readonly: %d\n", readonly);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly);
+
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
+ * @brief This API gets the package 'upate' value from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] update pointer to hold package update value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @code
+static int get_pkg_update(const char *pkgid)
+{
+ int ret = 0;
+ bool update;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_update(handle, &update);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg update: %d\n", update);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
+ * @brief This API gets the package 'accessible' value from the package ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] accessible pointer to hold package accessible value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_readonly()
+ * @code
+static int get_pkg_accessible(const char *pkgid)
+{
+ int ret = 0;
+ bool accessible;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_accessible(handle, &accessible);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg accessible: %d\n", accessible);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
+ * @brief This API destroys the package information handle freeing up all the resources
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info handle
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post None
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_type(const char *pkgid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgtype: %s\n", type);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
+ * @brief This API creates the package information filter handle from db. All filter properties will be ANDed.
+ The query will search the entire package information collected from the manifest file of all the installed packages
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[out] handle pointer to the package info filter handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_filter_destroy()
+ * @see pkgmgrinfo_pkginfo_filter_count()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ * @code
+static int get_rpm_pkg_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of rpm pkgs: %d\n", count);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
+ * @brief This API destroys the package information filter handle freeing up all the resources
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info filter handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_filter_create()
+ * @post None
+ * @see pkgmgrinfo_pkginfo_filter_count()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ * @code
+static int get_rpm_pkg_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of rpm pkgs: %d\n", count);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const bool value)
+ * @brief This API adds a boolean filter property to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info filter handle.
+ * @param[in] property boolean property name.
+ * @param[in] value value corresponding to the property.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_filter_create()
+ * @post pkgmgrinfo_pkginfo_filter_destroy()
+ * @see pkgmgrinfo_pkginfo_filter_count()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ * @code
+static int get_preload_pkg_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, 1);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of preload pkgs: %d\n", count);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
+ const char *property, const bool value);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const int value)
+ * @brief This API adds an integer filter property to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info filter handle.
+ * @param[in] property integer property name.
+ * @param[in] value value corresponding to the property.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_filter_create()
+ * @post pkgmgrinfo_pkginfo_filter_destroy()
+ * @see pkgmgrinfo_pkginfo_filter_count()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ * @code
+static int get_pkg_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_int(handle, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of preload pkgs: %d\n", count);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
+ const char *property, const int value);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const char *value)
+ * @brief This API adds a string filter property to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info filter handle.
+ * @param[in] property string property name.
+ * @param[in] value value corresponding to the property.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_filter_create()
+ * @post pkgmgrinfo_pkginfo_filter_destroy()
+ * @see pkgmgrinfo_pkginfo_filter_count()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ * @code
+static int get_rpm_pkg_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of rpm pkgs: %d\n", count);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
+ const char *property, const char *value);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
+ * @brief This API executes the user supplied callback function for each package that satisfy the filter conditions
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info filter handle.
+ * @param[in] pkg_cb callback function.
+ * @param[in] user_data user data to be passed to the callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_filter_create()
+ * @post pkgmgrinfo_pkginfo_filter_destroy()
+ * @see pkgmgrinfo_pkginfo_filter_count()
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid = NULL;
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+ printf("pkg id : %s\n", pkgid);
+ return 0;
+}
+
+static int get_rpm_pkg_list()
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, pkg_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
+ pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
+ * @brief This API counts the package that satisfy the filter conditions
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package info filter handle.
+ * @param[in] count pointer to store the count value.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_filter_create()
+ * @post pkgmgrinfo_pkginfo_filter_destroy()
+ * @see pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
+ * @code
+static int get_rpm_pkg_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of rpm pkgs: %d\n", count);
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
+ * @brief This API gets the list of privilege for a particular package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the package info handle.
+ * @param[in] privilege_func callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int privilege_func(const char *name, void *user_data)
+{
+ if (strcmp(name, (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+}
+
+static int list_privilege(const char *package, char *privilege)
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_foreach_privilege(handle, privilege_func, (void *)privilege);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data)
+ * @brief This API gets list of installed applications for a particular package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle package info handle
+ * @param[in] component application component
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int list_apps(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data);
+/**
+ * @fn int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief This API gets list of installed applications from all packages with minimum informaion.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *pkgid1 = NULL;
+ char *pkgid2 = NULL;
+ pkgid1 = (char *)user_data;
+ pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
+ if (strcmp(pkgid1, pkgid2) == 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int list_apps()
+{
+ int ret = 0;
+ char *name = "helloworld";
+ ret = pkgmgrinfo_appinfo_get_install_list(app_list_cb, (void *)name);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief This API gets list of installed applications from all packages.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *pkgid1 = NULL;
+ char *pkgid2 = NULL;
+ pkgid1 = (char *)user_data;
+ pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
+ if (strcmp(pkgid1, pkgid2) == 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int list_apps()
+{
+ int ret = 0;
+ char *name = "helloworld";
+ ret = pkgmgrinfo_appinfo_get_installed_list(app_list_cb, (void *)name);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_mounted_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief This API gets list of applications which are installed in sd card when sd card is mounted
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid: %s\n", appid);
+
+ return 0;
+}
+
+static int mounted_list_apps()
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_appinfo_get_mounted_list(app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_mounted_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_unmounted_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief This API gets list of applications which are installed in sd card when sd card is unmounted
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid: %s\n", appid);
+
+ return 0;
+}
+
+static int unmounted_list_apps()
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_appinfo_get_unmounted_list(app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_unmounted_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+ * @brief This API creates the application information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to appid
+ * @param[out] handle pointer to the application info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_type(const char *appid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("apptype: %s\n", type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data)
+ * @brief This API gets list of disabled applications for a particular package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle package info handle
+ * @param[in] component application component
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int list_apps(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_disabled_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_disabled_list(handle, PMINFO_UI_APP, app_func, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+
+int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+ * @brief This API creates the disabled application information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to appid
+ * @param[out] handle pointer to the application info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @code
+static int get_app_type(const char *appid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("apptype: %s\n", type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
+ * @brief This API gets the application ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] appid pointer to hold appid
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_id(const char *appid)
+{
+ int ret = 0;
+ char *app_id = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app id: %s\n", app_id);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_unmounted_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+ * @brief This API creates the application information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to appid
+ * @param[out] handle pointer to the application info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_type(const char *appid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_unmounted_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("apptype: %s\n", type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_unmounted_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
+ * @brief This API gets the package name of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] pkg_name pointer to hold package name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_pkgname(const char *appid)
+{
+ int ret = 0;
+ char *pkgname = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("pkg name: %s\n", pkgname);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
+ * @brief This API gets the package id of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] pkgid pointer to hold package id
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_pkgid(const char *appid)
+{
+ int ret = 0;
+ char *pkgid = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("pkg id: %s\n", pkgid);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
+ * @brief This API gets the executable name of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] exec pointer to hold app exec name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_exec(const char *appid)
+{
+ int ret = 0;
+ char *exec = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("exec name: %s\n", exec);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+ * @brief This API gets the icon name of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] icon pointer to hold app icon name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_icon(const char *appid)
+{
+ int ret = 0;
+ char *icon = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_icon(handle, &icon);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("icon name: %s\n", icon);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
+ * @brief This API gets the label of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] label pointer to hold app label
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_label(const char *appid)
+{
+ int ret = 0;
+ char *label = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_label(handle, &label);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("label : %s\n", label);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
+ * @brief This API gets the component of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] component pointer to hold app component
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_component(const char *appid)
+{
+ int ret = 0;
+ pkgmgrinfo_app_component component;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_component(handle, &component);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("component : %s\n", component);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
+ * @brief This API gets the apptype of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] app_type pointer to hold apptype
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_type(const char *appid)
+{
+ int ret = 0;
+ char *apptype = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("apptype : %s\n", apptype);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
+ int *operation_count, char ***operation)
+ * @brief This API gets the list of operation of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the appcontrol handle.
+ * @param[out] operation_count pointer to hold number of operations
+ * @param[out] operation pointer to hold list of operations
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_uri()
+ * @see pkgmgrinfo_appinfo_get_mime()
+ * @code
+int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int oc = 0;
+ int i = 0;
+ char **operation;
+ pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
+ for (i = 0; i < oc; i++) {
+ if (strcmp(operation[i], (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+ }
+}
+
+static int check_operation(const char *appid, char *operation)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
+ int *operation_count, char ***operation);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
+ int *uri_count, char ***uri)
+ * @brief This API gets the list of uri of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the appcontrol handle.
+ * @param[out] uri_count pointer to hold number of uris
+ * @param[out] uri pointer to hold list of uris
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_operation()
+ * @see pkgmgrinfo_appinfo_get_mime()
+ * @code
+int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int uc = 0;
+ int i = 0;
+ char **uri;
+ pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
+ for (i = 0; i < uc; i++) {
+ if (strcmp(uri[i], (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+ }
+}
+
+static int check_uri(const char *appid, char *uri)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)uri);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
+ int *uri_count, char ***uri);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
+ int *mime_count, char ***mime)
+ * @brief This API gets the list of mime of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the appcontrol handle.
+ * @param[out] mime_count pointer to hold number of mimes
+ * @param[out] mime pointer to hold list of mimes
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_uri()
+ * @see pkgmgrinfo_appinfo_get_operation()
+ * @code
+int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int mc = 0;
+ int i = 0;
+ char **mime;
+ pkgmgrinfo_appinfo_get_operation(handle, &mc, &mime);
+ for (i = 0; i < mc; i++) {
+ if (strcmp(mime[i], (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+ }
+}
+
+static int check_mime(const char *appid, char *mime)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)mime);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
+ int *mime_count, char ***mime);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
+ int *subapp_count, char ***subapp)
+ * @brief This API gets the list of subapp of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the appcontrol handle.
+ * @param[out] subapp_count pointer to hold number of subapp
+ * @param[out] subapp pointer to hold list of subapp
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_uri()
+ * @see pkgmgrinfo_appinfo_get_operation()
+ * @code
+int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int sc = 0;
+ int i = 0;
+ char **subapp = NULL;
+ pkgmgrinfo_appinfo_get_subapp(handle, &sc, &subapp);
+ for (i = 0; i < sc; i++) {
+ if (strcmp(subapp[i], (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+ }
+}
+
+static int check_subapp(const char *appid, char *subapp)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)subapp);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
+ int *subapp_count, char ***subapp);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+ * @brief This API gets the notification icon of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] icon pointer to hold notification icon
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_notification_icon(const char *appid)
+{
+ int ret = 0;
+ char *notification_icon = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_notification_icon(handle, ¬ification_icon);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("notification icon : %s\n", notification_icon);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+ * @brief This API gets the setting icon of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] icon pointer to hold setting icon
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_setting_icon(const char *appid)
+{
+ int ret = 0;
+ char *setting_icon = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_setting_icon(handle, &setting_icon);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("setting icon : %s\n", setting_icon);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_small_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+ * @brief This API gets the small icon of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] icon pointer to hold small icon
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_small_icon(const char *appid)
+{
+ int ret = 0;
+ char *small_icon = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_small_icon(handle, &small_icon);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("small icon : %s\n", small_icon);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_small_icon(pkgmgrinfo_appinfo_h handle, char **icon);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
+ * @brief This API gets the type of recent image on app-tray
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] type pointer to hold image type
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_recent_image_type(const char *appid)
+{
+ int ret = 0;
+ pkgmgrinfo_app_recentimage type;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_recent_image_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("recent image type: %d\n", type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type);
+
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img)
+ * @brief This API gets the preview image of application
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] preview_img pointer to hold preview image path
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_app_previewimage(const char *appid)
+{
+ int ret = 0;
+ char *preview = NULL;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_preview_image(handle, &preview);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("preview image path : %s\n", preview);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img);
+
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
+ * @brief This API gets the package permission type of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] permission pointer to hold package permission
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_app_permission(const char *appid)
+{
+ int ret = 0;
+ pkgmgrinfo_permission_type permission = 0;
+ pkgmgrinfo_appinfo_h handle;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_permission_type(handle, &permission);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("permission type: %d\n", permission);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
+ * @brief This API gets the component_type
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] component_type pointer to hold component_type
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_component_type(const char *appid)
+{
+ int ret = 0;
+ char *component_type = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_component_type(handle, &component_type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("component_type: %s\n", component_type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
+ * @brief This API gets the application 'hwacceleration' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] hwacceleration pointer to hold package hwacceleration value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_hwacceleration(const char *appid)
+{
+ int ret = 0;
+ pkgmgrinfo_app_hwacceleration hwacceleration;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app hwacceleration: %d\n", hwacceleration);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_screenreader *screenreader)
+ * @brief This API gets the application 'screenreader' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] screenreader pointer to hold package accessibility value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_screenreader(const char *appid)
+{
+ int ret = 0;
+ pkgmgrinfo_app_screenreader screenreader = PMINFO_USE_SYSTEM_SETTING;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_screenreader(handle, &screenreader);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app screenreader: %d\n", screenreader);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_screenreader *screenreader);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img)
+ * @brief This API gets the application's landscape & portrait effect images
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] portrait_img contains portrait mode effect image
+ * @param[out] landscape_img contains landscape mode effect image
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_nodisplay()
+ * @code
+static int get_app_effectimages(const char *appid)
+{
+ int ret = 0;
+ char *portraitimg = NULL;
+ char *landscapeimg = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_effectimage(handle, &portraitimg, &landscapeimg);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app effect image portrait: %s, app effect image landscape : %s\n", portraitimg, landscapeimg);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
+ * @brief This API gets the submode_mainid of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] submode_mainid pointer to hold package name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_submode_mainid(const char *appid)
+{
+ int ret = 0;
+ char *submode_mainid = NULL;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_submode_mainid(handle, &submode_mainid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("submode_mainid: %s\n", submode_mainid);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
+ * @brief This API gets exactly matched label by given appid and locale
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to appid
+ * @param[in] locale pointer to locale
+ * @param[out] label pointer to hold app label
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_localed_label(const char *appid, const char *locale)
+{
+ int ret = 0;
+ char *label = NULL;
+
+ ret = pkgmgrinfo_appinfo_get_localed_label(appid, locale, &label);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ printf("localed label: %s\n", label);
+
+ free(label);
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
+ * @brief This API checks if the application has the given category
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle
+ * @param[in] category category
+ * @param[out] exist value Gets whether the application has the given category
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int is_category_exist(const char *appid, const char *category)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool exist = false;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ ret = pkgmgrinfo_appinfo_is_category_exist(handle, category, &exist);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value)
+ * @brief This API gets metadata value by given metadata key
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle
+ * @param[in] metadata_key metadata key
+ * @param[out] metadata_value pointer to hold metadata value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_metadata_value(const char *appid, const char *metadata_key)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ char *metadata_value = NULL;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ ret = pkgmgrinfo_appinfo_get_metadata_value(handle, metadata_key, &metadata_value);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
+ * @brief This API gets the list of permission for a particular application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the application info handle.
+ * @param[in] permission_func callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+int permission_func(const char *name, void *user_data)
+{
+ if (strcmp(name, (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+}
+
+static int list_permission(const char *appid, char *permission)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_permission(handle, permission_func, (void *)permission);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_category_list_cb category_func, void *user_data);
+ * @brief This API gets the list of category for a particular application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the application info handle.
+ * @param[in] category_func callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+int category_func(const char *name, void *user_data)
+{
+ if (strcmp(name, (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+}
+
+static int list_category(const char *appid, char *category)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)category);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_category_list_cb category_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
+ * @brief This API gets the list of metadata for a particular application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the application info handle.
+ * @param[in] metadata_func callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+int metadata_func(const char *key, const char *value, void *user_data)
+{
+ if (strcmp(key, (char *)user_data) == 0) {
+ printf("Value is %s\n", value);
+ return -1;
+ }
+ else
+ return 0;
+}
+
+static int list_metadata(const char *appid, char *key)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_metadata(handle, metadata_func, (void *)key);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
+
+
+/**
+ * @fn int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
+ * @brief This API gets the list of app-control for a particular application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the application info handle.
+ * @param[in] appcontrol_func callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ int oc = 0;
+ int i = 0;
+ char **operation;
+ pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
+ for (i = 0; i < oc; i++) {
+ if (strcmp(operation[i], (char *)user_data) == 0)
+ return -1;
+ else
+ return 0;
+ }
+}
+
+static int check_operation(const char *appid, char *operation)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
+ * @brief This API gets the application 'nodisplay' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] nodisplay pointer to hold package nodisplay value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_nodisplay(const char *appid)
+{
+ int ret = 0;
+ bool nodisplay;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app nodisplay: %d\n", nodisplay);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
+ * @brief This API gets the application 'multiple' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] multiple pointer to hold package multiple value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_nodisplay()
+ * @code
+static int get_app_multiple(const char *appid)
+{
+ int ret = 0;
+ bool multiple;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app multiple: %d\n", multiple);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
+ * @brief This API gets the application 'indicatordisplay' value. If true, indicator will be displayed during
+ * application launching effect. If fales, indicator will be hidden during application launching effect
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] indicator_disp contains indicator display status for application launching effect
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_nodisplay()
+ * @code
+static int get_app_indicator_display(const char *appid)
+{
+ int ret = 0;
+ bool indicator_disp;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_indicator_display_allowed(handle, &indicator_disp);
+ if (ret != PMINFO_R_OK){
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app indicator disp : %d\n", indicator_disp);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
+ * @brief This API gets the application 'taskmanage' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] taskmanage pointer to hold package taskmanage value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_taskmanage(const char *appid)
+{
+ int ret = 0;
+ bool taskmanage;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app taskmanage: %d\n", taskmanage);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
+ * @brief This API gets the application 'taskmanage' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] enabled pointer to hold package enabled value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_enabled(const char *appid)
+{
+ int ret = 0;
+ bool enabled;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &enabled);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app enabled: %d\n", enabled);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot)
+ * @brief This API gets the application 'onboot' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] onboot pointer to hold package onboot value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_onboot(const char *appid)
+{
+ int ret = 0;
+ bool onboot;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_onboot(handle, &onboot);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app onboot: %d\n", onboot);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart)
+ * @brief This API gets the application 'autorestart' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] autorestart pointer to hold package autorestart value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_autorestart(const char *appid)
+{
+ int ret = 0;
+ bool autorestart;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app autorestart: %d\n", autorestart);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h handle, bool *mainapp)
+ * @brief This API gets the value for given application is main app or not from handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] mainapp pointer to hold package mainapp is or not
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_mainapp(const char *appid)
+{
+ int ret = 0;
+ bool mainapp;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_mainapp(handle, &mainapp);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("mainapp: %d\n", mainapp);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h handle, bool *mainapp);
+
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
+ * @brief This API gets the value for given application is preload or not from handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] preload pointer to hold preload is or not
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_preload(const char *appid)
+{
+ int ret = 0;
+ bool preload = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_preload(handle, &preload);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("preload: %d\n", preload);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
+ * @brief This API gets the value for given application is submode or not from handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] submode pointer to hold submode is or not
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_submode(const char *appid)
+{
+ int ret = 0;
+ bool submode = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_submode(handle, &submode);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("submode: %d\n", submode);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
+
+/**
+ * @fn int int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool)
+ * @brief This API gets the value for given application is process_pool or not from handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] process_pool pointer to hold process_pool is or not
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_app_process_pool(const char *appid)
+{
+ int ret = 0;
+ bool process_pool = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_process_pool(handle, &process_pool);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("process_pool: %d\n", process_pool);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
+ * @brief This API destroys the application information handle freeing up all the resources
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
+ * @post None
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_type(const char *appid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_appinfo_h handle;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("apptype: %s\n", type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
+ * @brief This API creates the application information filter handle from db. All filter properties will be ANDed.
+ The query will search the entire application information collected from the manifest file of all the installed packages
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[out] handle pointer to the application info filter handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_capp_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of capp: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
+ * @brief This API destroys the application information filter handle freeing up all the resources
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_filter_create()
+ * @post None
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_capp_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of capp: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle, const char *property, const bool value)
+ * @brief This API adds a boolean filter property to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @param[in] property boolean property name.
+ * @param[in] value value corresponding to the property.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_filter_create()
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_taskmanageable_app_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_TASKMANAGE, 1);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of taskmanageable apps: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
+ const char *property, const bool value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle, const char *property, const int value)
+ * @brief This API adds an integer filter property to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @param[in] property integer property name.
+ * @param[in] value value corresponding to the property.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_filter_create()
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_taskmanageable_app_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_XXX, 10);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of apps: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
+ const char *property, const int value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, const char *property, const char *value)
+ * @brief This API adds a string filter property to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @param[in] property string property name.
+ * @param[in] value value corresponding to the property.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_filter_create()
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_capp_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of capp: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
+ const char *property, const char *value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
+ * @brief This API executes the user supplied callback function for each application that satisfy the filter conditions
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @param[in] app_cb callback function.
+ * @param[in] user_data user data to be passed to the callback function
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_filter_create()
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int get_capp_list()
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
+ pkgmgrinfo_app_list_cb app_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
+ * @brief This API counts the application that satisfy the filter conditions
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @param[in] count pointer to store count value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_filter_create()
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_capp_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of capp: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
+ * @brief This API creates the application's metadata information filter handle from db.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[out] handle pointer to the application metadata info filter handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_appinfo_metadata_filter_destroy()
+ * @see pkgmgrinfo_appinfo_metadata_filter_foreach()
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int get_app_list(const char *mkey, const char *mvalue)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_metadata_filter_h handle;
+ ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
+ * @brief This API destroys the application's metadata information filter handle.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application metadata info filter handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_metadata_filter_create()
+ * @post None
+ * @see pkgmgrinfo_appinfo_metadata_filter_foreach()
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int get_app_list(const char *mkey, const char *mvalue)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_metadata_filter_h handle;
+ ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle, const char *key, const char *value)
+ * @brief This API adds filter condition for the query API. The query will search the entire application metadata information collected from
+ * the manifest file of all the installed packages. You can specify value as NULL to search based on key only.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application metadata info filter handle.
+ * @param[in] key pointer to metadata key
+ * @param[in] value pointer to metadata value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_metadata_filter_create()
+ * @post pkgmgrinfo_appinfo_metadata_filter_foreach(), pkgmgrinfo_appinfo_metadata_filter_destroy()
+ * @see pkgmgrinfo_appinfo_metadata_filter_foreach()
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int get_app_list(const char *mkey, const char *mvalue)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_metadata_filter_h handle;
+ ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle,
+ const char *key, const char *value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
+ * @brief This API executes the filter query. The query will search the entire application metadata information collected from
+ * the manifest file of all the installed packages. For each application returned by the query, the callback will be called. If callback returns
+ * negative value, no more callbacks will be called and API will return.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application metadata info filter handle.
+ * @param[in] app_cb function pointer to callback
+ * @param[in] user_data pointer to user data
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_appinfo_metadata_filter_create()
+ * @post pkgmgrinfo_appinfo_metadata_filter_destroy()
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
+}
+
+static int get_app_list(const char *mkey, const char *mvalue)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_metadata_filter_h handle;
+ ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return -1;
+ }
+ pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
+ pkgmgrinfo_app_list_cb app_cb, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle)
+ * @brief This API creates the package cert information handle to get data from db.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[out] handle pointer to the package cert handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_pkginfo_destroy_certinfo()
+ * @see pkgmgrinfo_pkginfo_get_cert_value()
+ * @see pkgmgrinfo_pkginfo_load_certinfo()
+ * @code
+static int get_cert_info(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_certinfo_h handle;
+ char *auth_cert = NULL;
+ ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ printf("Author root certificate: %s\n", auth_root);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle)
+ * @brief This API loads the package cert information handle with data from db.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to the package ID.
+ * @param[in] handle pointer to the package cert handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_create_certinfo()
+ * @post pkgmgrinfo_pkginfo_destroy_certinfo()
+ * @see pkgmgrinfo_pkginfo_get_cert_value()
+ * @code
+static int get_cert_info(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_certinfo_h handle;
+ char *auth_cert = NULL;
+ ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ printf("Author root certificate: %s\n", auth_root);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value)
+ * @brief This API gets the package cert information from the handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package cert handle.
+ * @param[in] cert_type certificate type
+ * @param[out] cert_value pointer to hold certificate value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_create_certinfo()
+ * @post pkgmgrinfo_pkginfo_destroy_certinfo()
+ * @see pkgmgrinfo_pkginfo_load_certinfo()
+ * @code
+static int get_cert_info(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_certinfo_h handle;
+ char *auth_cert = NULL;
+ ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ printf("Author root certificate: %s\n", auth_root);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle)
+ * @brief This API destroys the package cert information handle freeing up all the resources
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package cert handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_pkginfo_create_certinfo()
+ * @post None
+ * @see pkgmgrinfo_pkginfo_load_certinfo()
+ * @code
+static int get_cert_info(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_certinfo_h handle;
+ char *auth_cert = NULL;
+ ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return -1;
+ }
+ printf("Author root certificate: %s\n", auth_root);
+ pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_delete_certinfo(const char *pkgid)
+ * @brief This API deletes the package cert information from DB
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to the package ID.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int delete_cert_info(const char *pkgid)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_delete_certinfo(pkgid);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+ int pkgmgrinfo_delete_certinfo(const char *pkgid);
+
+/**
+ * @fn int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle)
+ * @brief This API creates the package db information handle to set data in db.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to the package ID.
+ * @param[out] handle pointer to the package db info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type)
+ * @brief This API sets the package type in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] type pointer to the package type.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_version_to_pkgdbinfo()
+ * @code
+static int set_pkg_type_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_type_to_pkgdbinfo(handle, "wgt");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type);
+
+/**
+ * @fn int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version)
+ * @brief This API sets the package version in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] version pointer to the package version
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_version_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version);
+
+/**
+ * @fn int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
+ * @brief This API sets the package install location in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] location package install location
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_install_location_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, INSTALL_INTERNAL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location);
+
+/**
+ * @fn int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size)
+ * @brief This API sets the package size in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] size pointer to the package size
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_size_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_size_to_pkgdbinfo(handle, "15");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size);
+
+/**
+ * @fn int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label, const char *locale)
+ * @brief This API sets the package label in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] label pointer to the package label
+ * @param[in] locale pointer to the locale
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_label_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, "helloworld", "en-us");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label, const char *locale);
+
+/**
+ * @fn int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon, const char *locale)
+ * @brief This API sets the package icon in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] icon pointer to the package icon
+ * @param[in] locale pointer to the locale
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_icon_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, "helloworld.png", "en-us");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon, const char *locale);
+
+/**
+ * @fn int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *description, const char *locale)
+ * @brief This API sets the package description in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] description pointer to the package description
+ * @param[in] locale pointer to the locale
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_description_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, "helloworld application", "en-us");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *description, const char *locale);
+
+/**
+ * @fn int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
+ const char *author_email, const char *author_href, const char *locale)
+ * @brief This API sets the package author info in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] author_name pointer to the package author name
+ * @param[in] author_email pointer to the package author email
+ * @param[in] author_href pointer to the package author href
+ * @param[in] locale pointer to the locale
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_author_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, "John", "john@samsung.com", "www.samsung.com", "en-us");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
+ const char *author_email, const char *author_href, const char *locale);
+
+/**
+ * @fn int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable)
+ * @brief This API sets the package 'removable' value in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] removable package removable value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_removable_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, 1);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable);
+
+/**
+ * @fn int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload)
+ * @brief This API sets the package 'preload' value in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] preload package preload value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_preload_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, 1);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload);
+
+/**
+ * @fn int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
+ * @brief This API sets the package 'installed_storage' value in db handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkgdbinfo handle.
+ * @param[in] location installed_storage value
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @code
+static int set_pkg_installed_storage_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_INTERNAL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location);
+
+/**
+ * @fn int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
+ * @brief This API saves all the information from the handle to the DB.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package db info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post pkgmgrinfo_destroy_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
+ * @brief This API destroys the package db information handle freeing up all the resources
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package db info handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_pkgdbinfo()
+ * @post None
+ * @see pkgmgrinfo_save_pkgdbinfo()
+ * @see pkgmgrinfo_set_type_to_pkgdbinfo()
+ * @code
+static int set_pkg_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkgdbinfo_h handle;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
+
+
+/**
+ * @fn int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle)
+ * @brief This API creates the package cert information handle to set data in db.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[out] handle pointer to the package cert handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post pkgmgrinfo_destroy_certinfo_set_handle()
+ * @see pkgmgrinfo_set_cert_value()
+ * @see pkgmgrinfo_save_certinfo()
+ * @code
+static int set_cert_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value)
+ * @brief This API sets the package cert information in the handle.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package cert handle.
+ * @param[in] cert_type certificate type.
+ * @param[in] cert_value certificate value.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_certinfo_set_handle()
+ * @post pkgmgrinfo_destroy_certinfo_set_handle()
+ * @see pkgmgrinfo_save_certinfo()
+ * @code
+static int set_cert_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value);
+
+/**
+ * @fn int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle)
+ * @brief This API saves the package cert information in the DB.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to the package ID.
+ * @param[in] handle pointer to the package cert handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_certinfo_set_handle()
+ * @post pkgmgrinfo_destroy_certinfo_set_handle()
+ * @see pkgmgrinfo_save_certinfo()
+ * @code
+static int set_cert_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle)
+ * @brief This API destroys the package cert information handle freeing up all the resources.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the package cert handle.
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_create_certinfo_set_handle()
+ * @post None
+ * @see pkgmgrinfo_save_certinfo()
+ * @code
+static int set_cert_in_db(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_instcertinfo_h handle;
+ ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle);
+
+/**
+ * @fn int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
+ * @brief This API gets the datacontrol info
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] providerid pointer to the providerid of dataconltrol.
+ * @param[in] type pointer to the type of dataconltrol.
+ * @param[out] appid pointer to hold appid, need to free after using
+ * @param[out] access pointer to hold access, need to free after using
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @endcode
+ */
+int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
+
+/**
+ * @pkgmgrinfo client API
+**/
+
+/**
+ * @brief listening status type in pkgmgrinfo.
+ */
+#define PMINFO_CLIENT_STATUS_ALL 0x00
+#define PMINFO_CLIENT_STATUS_INSTALL 0x01
+#define PMINFO_CLIENT_STATUS_UNINSTALL 0x02
+#define PMINFO_CLIENT_STATUS_UPGRADE 0x04
+#define PMINFO_CLIENT_STATUS_MOVE 0x08
+#define PMINFO_CLIENT_STATUS_CLEAR_DATA 0x10
+#define PMINFO_CLIENT_STATUS_INSTALL_PROGRESS 0x20
+
+/**
+ * @brief type definition.
+ */
+typedef void pkgmgrinfo_client;
+typedef int (*pkgmgrinfo_handler)(int req_id, const char *pkg_type,
+ const char *pkgid, const char *key,
+ const char *val, const void *pmsg, void *data);
+
+typedef enum {
+ PMINFO_REQUEST = 0,
+ PMINFO_LISTENING,
+ PMINFO_BROADCAST,
+}pkgmgrinfo_client_type;
+
+/**
+ * @brief This APIs provides pkgmgrinfo client listener
+ */
+pkgmgrinfo_client *pkgmgrinfo_client_new(pkgmgrinfo_client_type ctype);
+int pkgmgrinfo_client_set_status_type(pkgmgrinfo_client *pc, int status_type);
+int pkgmgrinfo_client_listen_status(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data);
+int pkgmgrinfo_client_free(pkgmgrinfo_client *pc);
+int pkgmgrinfo_client_request_enable_external_pkg(char *pkgid);
+
+/**
+ * @pkgmgrinfo client API end
+**/
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* __PKG_INFO_H__ */
+/**
+ * @}
+ * @}
+ */
+
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef __PKGMGRINFO_PRIVATE_H__
+#define __PKGMGRINFO_PRIVATE_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <db-util.h>
+#include <sqlite3.h>
+#include <glib.h>
+#include <ctype.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include <dirent.h>
+#include <sys/stat.h>
+
+#include "pkgmgr_parser.h"
+#include "pkgmgr-info-internal.h"
+#include "pkgmgr-info-debug.h"
+#include "pkgmgr-info.h"
+
+typedef struct _pkgmgr_pkginfo_x {
+ manifest_x *manifest_info;
+ char *locale;
+
+ struct _pkgmgr_pkginfo_x *prev;
+ struct _pkgmgr_pkginfo_x *next;
+} pkgmgr_pkginfo_x;
+
+typedef struct _pkgmgr_appinfo_x {
+ const char *package;
+ char *locale;
+ pkgmgrinfo_app_component app_component;
+ union {
+ uiapplication_x *uiapp_info;
+ serviceapplication_x *svcapp_info;
+ };
+} pkgmgr_appinfo_x;
+
+/*For filter APIs*/
+typedef struct _pkgmgrinfo_filter_x {
+ GSList *list;
+} pkgmgrinfo_filter_x;
+
+typedef struct _pkgmgrinfo_node_x {
+ int prop;
+ char *key;
+ char *value;
+} pkgmgrinfo_node_x;
+
+typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
+
+int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data);
+char* __convert_system_locale_to_manifest_locale();
+gint __compare_func(gconstpointer data1, gconstpointer data2);
+void __get_filter_condition(gpointer data, char **condition);
+
+void __cleanup_pkginfo(pkgmgr_pkginfo_x *data);
+void __cleanup_appinfo(pkgmgr_appinfo_x *data);
+
+int __pkginfo_check_installed_storage(pkgmgr_pkginfo_x *pkginfo);
+int __appinfo_check_installed_storage(pkgmgr_appinfo_x *appinfo);
+
+#endif /* __PKGMGRINFO_PRIVATE_H__ */
--- /dev/null
+Name: pkgmgr-info
+Summary: Packager Manager infomation api for package
+Version: 0.0.172
+Release: 1
+Group: Application Framework/Package Management
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(db-util)
+BuildRequires:pkgconfig(libxml-2.0)
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(dbus-glib-1)
+
+%description
+Packager Manager infomation api for packaging
+
+%package devel
+Summary: Packager Manager infomation api (devel)
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+%description devel
+Packager Manager infomation api (devel)
+
+%package parser
+Summary: Library for manifest parser
+Group: Application Framework/Package Management
+Requires: %{name} = %{version}-%{release}
+
+%description parser
+Library for manifest parser
+
+%package parser-devel
+Summary: Dev package for libpkgmgr-parser
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description parser-devel
+Dev package for libpkgmgr-parser
+
+
+%prep
+%setup -q
+
+%build
+
+%if 0%{?tizen_build_binary_release_type_eng}
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS ?DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+%endif
+
+%cmake .
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+cp LICENSE %{buildroot}/usr/share/license/%{name}-parser
+
+%post
+
+mkdir -p /opt/usr/apps/tmp
+chown 5100:5100 /opt/usr/apps/tmp
+chmod 771 /opt/usr/apps/tmp
+chsmack -a '*' /opt/usr/apps/tmp
+chsmack -t /opt/usr/apps/tmp
+
+touch /opt/usr/apps/tmp/pkgmgr_tmp.txt
+
+chsmack -a 'pkgmgr::db' /opt/usr/apps/tmp/pkgmgr_tmp.txt
+
+mkdir /usr/etc/package-manager
+chsmack -a '_' /usr/etc/package-manager
+
+%postun
+
+
+%files
+%manifest pkgmgr-info.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libpkgmgr-info.so.*
+/usr/share/license/%{name}
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/pkgmgr-info.h
+%{_libdir}/pkgconfig/pkgmgr-info.pc
+%{_libdir}/libpkgmgr-info.so
+
+%files parser
+%manifest pkgmgr-parser.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libpkgmgr_parser.so.*
+%{_prefix}/etc/package-manager/preload/preload_list.txt
+%{_prefix}/etc/package-manager/preload/manifest.xsd
+%{_prefix}/etc/package-manager/preload/xml.xsd
+%{_prefix}/etc/package-manager/parser_path.conf
+%{_prefix}/etc/package-manager/parserlib/pkgmgr_parser_plugin_list.txt
+/usr/share/license/%{name}-parser
+
+%files parser-devel
+%defattr(-,root,root,-)
+%{_includedir}/pkgmgr/pkgmgr_parser.h
+%{_includedir}/pkgmgr/pkgmgr_parser_db.h
+%{_libdir}/pkgconfig/pkgmgr-parser.pc
+%{_libdir}/libpkgmgr_parser.so
--- /dev/null
+### Description
+# Communication modules for pkg-mgr client lib and server process
+# By Youmin Ha <youmin.ha@samsung.com>
+
+cmake_minimum_required(VERSION 2.6)
+#set(CMAKE_SKIP_BUILD_RPATH true)
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+
+
+### Versioning
+if(DEFINED ${VERSION})
+ message("VERSION: ${VERSION}")
+else()
+ message("VERSION is not defined. set it as 0.1.0")
+ set(VERSION 0.1.0)
+endif()
+if(DEFINED ${VERSION_MAJOR})
+ message("VERSION_MAJOR: ${VERSION_MAJOR}")
+else()
+ message( "VERSION_MAJOR is not defined. set it as 0")
+ set(VERSION_MAJOR 0)
+endif()
+message(STATUS "version/major : ${VERSION} / ${VERSION_MAJOR}")
+
+### Get required CFLAGS, LDFLAGS from pkg-config
+
+include(FindPkgConfig)
+pkg_check_modules(parser_pkgs REQUIRED dlog libxml-2.0 glib-2.0 sqlite3 db-util vconf)
+
+foreach(flag ${parser_pkgs_CFLAGS})
+ set(parser_pkgs_CFLAGS_str "${parser_pkgs_CFLAGS_str} ${flag}")
+endforeach()
+
+## Additional flag
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+### Set current binary dir to be included (for generated *.h files)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+
+### Build modules
+
+## pkgmgr_parser object (by sewook.park)
+# This library is for installer backend
+add_library(pkgmgr_parser SHARED pkgmgr_parser.c pkgmgr_parser_db.c pkgmgr_parser_signature.c pkgmgr_parser_plugin.c)
+#add_library(pkgmgr_parser SHARED pkgmgr_parser.c)
+set_target_properties(pkgmgr_parser PROPERTIES SOVERSION ${VERSION_MAJOR})
+set_target_properties(pkgmgr_parser PROPERTIES VERSION ${VERSION})
+set_target_properties(pkgmgr_parser PROPERTIES COMPILE_FLAGS "${parser_pkgs_CFLAGS_str}")
+target_link_libraries(pkgmgr_parser ${parser_pkgs_LDFLAGS})
+
+### Create pc file
+configure_file(pkgmgr-parser.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc @ONLY)
+configure_file(preload_list.txt.in preload_list.txt @ONLY)
+configure_file(manifest.xsd.in manifest.xsd @ONLY)
+configure_file(xml.xsd.in xml.xsd @ONLY)
+configure_file(pkgmgr_parser_plugin_list.txt.in pkgmgr_parser_plugin_list.txt @ONLY)
+
+## Install
+INSTALL(TARGETS
+ pkgmgr_parser
+ DESTINATION ${LIB_INSTALL_DIR}
+ COMPONENT RuntimeLibraries)
+INSTALL(FILES
+ pkgmgr_parser.h
+ DESTINATION include/pkgmgr)
+INSTALL(FILES
+ pkgmgr_parser_db.h
+ DESTINATION include/pkgmgr)
+
+INSTALL(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/preload_list.txt DESTINATION ${PREFIX}/etc/package-manager/preload/)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.xsd DESTINATION ${PREFIX}/etc/package-manager/preload/)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/xml.xsd DESTINATION ${PREFIX}/etc/package-manager/preload/)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr_parser_plugin_list.txt DESTINATION ${PREFIX}/etc/package-manager/parserlib/)
+
--- /dev/null
+
+#export CFLAGS=""
+#export LDFLAGS=""
+
+cd `dirname $0`
+
+PREFIX=/usr
+
+rm -rf cmake_tmp
+mkdir -p cmake_tmp
+cd cmake_tmp
+
+CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} &&
+make &&
+
+# test
+{
+ export LD_LIBRARY_PATH=`pwd`
+ cd test
+# ./test_comm_client &
+# ./test_comm_status_broadcast_server
+# ./test_comm_socket &&
+ ./test_pkgmgr_installer
+}
+if [ "$?" == "0" ]; then
+ echo "Test done."
+else
+ echo "Test failed!"
+fi
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tizen.org/ns/packages" xmlns:packages="http://tizen.org/ns/packages">
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
+
+ <xs:element name="manifest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ <xs:element ref="packages:author"/>
+ <xs:element ref="packages:description"/>
+ <xs:element ref="packages:compatibility"/>
+ <xs:element ref="packages:device-profile"/>
+ <xs:element ref="packages:service-application"/>
+ <xs:element ref="packages:ui-application"/>
+ <xs:element ref="packages:ime-application"/>
+ <xs:element ref="packages:shortcut-list"/>
+ <xs:element ref="packages:livebox"/>
+ <xs:element ref="packages:account"/>
+ <xs:element ref="packages:notifications"/>
+ <xs:element ref="packages:privileges"/>
+ <xs:element ref="packages:font"/>
+ <xs:element ref="packages:ime"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="storeclient-id" type="xs:string"/>
+ <xs:attribute name="install-location" type="packages:InstallLocationType"/>
+ <xs:attribute name="package" use="required" type="xs:string"/>
+ <xs:attribute name="type" type="packages:PackageType"/>
+ <xs:attribute name="version" use="required" type="xs:NMTOKEN"/>
+ <xs:attribute name="size" type="xs:NMTOKEN"/>
+ <xs:attribute name="root_path" type="xs:string"/>
+ <xs:attribute name="csc_path" type="xs:string"/>
+ <xs:attribute name="appsetting" type="xs:boolean"/>
+ <xs:attribute name="nodisplay-setting" type="xs:boolean"/>
+ <xs:attribute name="url" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="InstallLocationType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="auto"/>
+ <xs:enumeration value="internal-only"/>
+ <xs:enumeration value="prefer-external"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="PackageType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="rpm"/>
+ <xs:enumeration value="tpk"/>
+ <xs:enumeration value="wgt"/>
+ <xs:enumeration value="apk"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="TypeType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="capp"/>
+ <xs:enumeration value="c++app"/>
+ <xs:enumeration value="webapp"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="HwAccelerationType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="use-GL"/>
+ <xs:enumeration value="not-use-GL"/>
+ <xs:enumeration value="use-system-setting"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ScreenReaderType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="screenreader-off"/>
+ <xs:enumeration value="screenreader-on"/>
+ <xs:enumeration value="use-system-setting"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="RecentImage">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="icon"/>
+ <xs:enumeration value="capture"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="author">
+ <xs:complexType mixed="true">
+ <xs:attribute name="email"/>
+ <xs:attribute name="href"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="description">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="compatibility">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="device-profile">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="service-application">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ <xs:element ref="packages:application-service"/>
+ <xs:element ref="packages:app-control"/>
+ <xs:element ref="packages:category"/>
+ <xs:element ref="packages:metadata"/>
+ <xs:element ref="packages:permission"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="appid" use="required" type="xs:string"/>
+ <xs:attribute name="auto-restart" use="required" type="xs:boolean"/>
+ <xs:attribute name="exec" use="required"/>
+ <xs:attribute name="on-boot" use="required" type="xs:boolean"/>
+ <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ <xs:attribute name="permission-type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ui-application">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ <xs:element ref="packages:image"/>
+ <xs:element ref="packages:application-service"/>
+ <xs:element ref="packages:app-control"/>
+ <xs:element ref="packages:category"/>
+ <xs:element ref="packages:metadata"/>
+ <xs:element ref="packages:permission"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="appid" use="required" type="xs:string"/>
+ <xs:attribute name="exec" use="required"/>
+ <xs:attribute name="multiple" type="xs:boolean"/>
+ <xs:attribute name="nodisplay" type="xs:boolean"/>
+ <xs:attribute name="taskmanage" type="xs:boolean"/>
+ <xs:attribute name="enabled" type="xs:boolean"/>
+ <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ <xs:attribute name="categories" type="xs:NCName"/>
+ <xs:attribute name="extraid"/>
+ <xs:attribute name="hw-acceleration" type="packages:HwAccelerationType"/>
+ <xs:attribute name="screen-reader" type="packages:ScreenReaderType"/>
+ <xs:attribute name="recentimage" type="packages:RecentImage"/>
+ <xs:attribute name="mainapp" type="xs:boolean"/>
+ <xs:attribute name="indicatordisplay" type="xs:boolean"/>
+ <xs:attribute name="portrait-effectimage" type="xs:string"/>
+ <xs:attribute name="landscape-effectimage" type="xs:string"/>
+ <xs:attribute name="guestmode-visibility" type="xs:string"/>
+ <xs:attribute name="launchcondition" type="xs:boolean"/>
+ <xs:attribute name="permission-type" type="xs:string"/>
+ <xs:attribute name="component-type" type="xs:string"/>
+ <xs:attribute name="submode" type="xs:boolean"/>
+ <xs:attribute name="submode-mainid" type="xs:string"/>
+ <xs:attribute name="process-pool" type="xs:boolean"/>
+ <xs:attribute name="auto-restart" type="xs:boolean"/>
+ <xs:attribute name="on-boot" type="xs:boolean"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ime-application">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="appid" use="required" type="xs:string"/>
+ <xs:attribute name="exec" use="required" type="xs:NCName"/>
+ <xs:attribute name="multiple" type="xs:boolean"/>
+ <xs:attribute name="nodisplay" type="xs:boolean"/>
+ <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="shortcut-list">
+ </xs:element>
+ <xs:element name="livebox">
+ </xs:element>
+ <xs:element name="account">
+ </xs:element>
+ <xs:element name="notifications">
+ </xs:element>
+ <xs:element name="ime">
+ </xs:element>
+ <xs:element name="privileges">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="packages:privilege"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="privilege">
+ </xs:element>
+ <xs:element name="font">
+ </xs:element>
+ <xs:element name="label">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="icon">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="section" type="xs:string"/>
+ <xs:attribute name="resolution" type="packages:ResolutionType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="image">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="section" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:simpleType name="SectionType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="notification"/>
+ <xs:enumeration value="setting"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ResolutionType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="xhigh"/>
+ <xs:enumeration value="high"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="application-service">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:operation"/>
+ <xs:element ref="packages:uri"/>
+ <xs:element ref="packages:mime"/>
+ <xs:element ref="packages:subapp"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="app-control">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:operation"/>
+ <xs:element ref="packages:uri"/>
+ <xs:element ref="packages:mime"/>
+ <xs:element ref="packages:subapp"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="category">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:any minOccurs="0" processContents="lax"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="metadata">
+ <xs:complexType>
+ <xs:attribute name="key" use="required" type="xs:string"/>
+ <xs:attribute name="value" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="permission">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="operation">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="uri">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="mime">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="subapp">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
--- /dev/null
+#
+# Copyright (c) 2008 ~ 2010 Samsung Electronics Co., Ltd.
+# All rights reserved.
+#
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDEDIR@
+
+Name: package manager parser library
+Description: SLP package manager's installer lib for each backends
+Version: @VERSION@
+Requires: libxml-2.0
+Libs: -L${libdir} -lpkgmgr_parser
+Cflags: -I${includedir}/pkgmgr
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <time.h>
+#include <string.h>
+#include <libxml/parser.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xmlschemas.h>
+#include <vconf.h>
+#include <glib.h>
+#include <db-util.h>
+
+#include "pkgmgr_parser.h"
+#include "pkgmgr_parser_internal.h"
+#include "pkgmgr_parser_db.h"
+#include "pkgmgr-info.h"
+#include "pkgmgr_parser_signature.h"
+#include "pkgmgr-info-debug.h"
+#include "pkgmgr_parser_plugin.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_PARSER"
+
+#define MANIFEST_RW_DIRECTORY "/opt/share/packages"
+#define MANIFEST_RO_DIRECTORY "/usr/share/packages"
+#define ASCII(s) (const char *)s
+#define XMLCHAR(s) (const xmlChar *)s
+#define BUFMAX 1024*128
+
+const char *package;
+
+static int __ps_process_label(xmlTextReaderPtr reader, label_x *label);
+static int __ps_process_privilege(xmlTextReaderPtr reader, privilege_x *privilege);
+static int __ps_process_privileges(xmlTextReaderPtr reader, privileges_x *privileges);
+static int __ps_process_deviceprofile(xmlTextReaderPtr reader, deviceprofile_x *deviceprofile);
+static int __ps_process_allowed(xmlTextReaderPtr reader, allowed_x *allowed);
+static int __ps_process_operation(xmlTextReaderPtr reader, operation_x *operation);
+static int __ps_process_uri(xmlTextReaderPtr reader, uri_x *uri);
+static int __ps_process_mime(xmlTextReaderPtr reader, mime_x *mime);
+static int __ps_process_subapp(xmlTextReaderPtr reader, subapp_x *subapp);
+static int __ps_process_condition(xmlTextReaderPtr reader, condition_x *condition);
+static int __ps_process_notification(xmlTextReaderPtr reader, notification_x *notifiation);
+static int __ps_process_category(xmlTextReaderPtr reader, category_x *category);
+static int __ps_process_metadata(xmlTextReaderPtr reader, metadata_x *metadata);
+static int __ps_process_permission(xmlTextReaderPtr reader, permission_x *permission);
+static int __ps_process_compatibility(xmlTextReaderPtr reader, compatibility_x *compatibility);
+static int __ps_process_resolution(xmlTextReaderPtr reader, resolution_x *resolution);
+static int __ps_process_request(xmlTextReaderPtr reader, request_x *request);
+static int __ps_process_define(xmlTextReaderPtr reader, define_x *define);
+static int __ps_process_appsvc(xmlTextReaderPtr reader, appsvc_x *appsvc);
+static int __ps_process_launchconditions(xmlTextReaderPtr reader, launchconditions_x *launchconditions);
+static int __ps_process_datashare(xmlTextReaderPtr reader, datashare_x *datashare);
+static int __ps_process_icon(xmlTextReaderPtr reader, icon_x *icon);
+static int __ps_process_author(xmlTextReaderPtr reader, author_x *author);
+static int __ps_process_description(xmlTextReaderPtr reader, description_x *description);
+static int __ps_process_capability(xmlTextReaderPtr reader, capability_x *capability);
+static int __ps_process_license(xmlTextReaderPtr reader, license_x *license);
+static int __ps_process_appcontrol(xmlTextReaderPtr reader, appcontrol_x *appcontrol);
+static int __ps_process_datacontrol(xmlTextReaderPtr reader, datacontrol_x *datacontrol);
+static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *uiapplication);
+static int __ps_process_serviceapplication(xmlTextReaderPtr reader, serviceapplication_x *serviceapplication);
+static int __ps_process_font(xmlTextReaderPtr reader, font_x *font);
+static int __ps_process_theme(xmlTextReaderPtr reader, theme_x *theme);
+static int __ps_process_daemon(xmlTextReaderPtr reader, daemon_x *daemon);
+static int __ps_process_ime(xmlTextReaderPtr reader, ime_x *ime);
+static void __ps_free_label(label_x *label);
+static void __ps_free_privilege(privilege_x *privilege);
+static void __ps_free_privileges(privileges_x *privileges);
+static void __ps_free_deviceprofile(deviceprofile_x * deviceprofile);
+static void __ps_free_allowed(allowed_x *allowed);
+static void __ps_free_operation(operation_x *operation);
+static void __ps_free_uri(uri_x *uri);
+static void __ps_free_mime(mime_x *mime);
+static void __ps_free_subapp(subapp_x *subapp);
+static void __ps_free_condition(condition_x *condition);
+static void __ps_free_notification(notification_x *notifiation);
+static void __ps_free_category(category_x *category);
+static void __ps_free_metadata(metadata_x *metadata);
+static void __ps_free_permission(permission_x *permission);
+static void __ps_free_compatibility(compatibility_x *compatibility);
+static void __ps_free_resolution(resolution_x *resolution);
+static void __ps_free_request(request_x *request);
+static void __ps_free_define(define_x *define);
+static void __ps_free_appsvc(appsvc_x *appsvc);
+static void __ps_free_launchconditions(launchconditions_x *launchconditions);
+static void __ps_free_datashare(datashare_x *datashare);
+static void __ps_free_icon(icon_x *icon);
+static void __ps_free_author(author_x *author);
+static void __ps_free_description(description_x *description);
+static void __ps_free_capability(capability_x *capability);
+static void __ps_free_license(license_x *license);
+static void __ps_free_appcontrol(appcontrol_x *appcontrol);
+static void __ps_free_datacontrol(datacontrol_x *datacontrol);
+static void __ps_free_uiapplication(uiapplication_x *uiapplication);
+static void __ps_free_serviceapplication(serviceapplication_x *serviceapplication);
+static void __ps_free_font(font_x *font);
+static void __ps_free_theme(theme_x *theme);
+static void __ps_free_daemon(daemon_x *daemon);
+static void __ps_free_ime(ime_x *ime);
+static char *__pkgid_to_manifest(const char *pkgid);
+static int __next_child_element(xmlTextReaderPtr reader, int depth);
+static int __start_process(xmlTextReaderPtr reader, manifest_x * mfx);
+static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx);
+static void __str_trim(char *input);
+static int __validate_appid(const char *pkgid, const char *appid, char **newappid);
+
+static void __str_trim(char *input)
+{
+ char *trim_str = input;
+
+ if (input == NULL)
+ return;
+
+ while (*input != 0) {
+ if (!isspace(*input)) {
+ *trim_str = *input;
+ trim_str++;
+ }
+ input++;
+ }
+
+ *trim_str = 0;
+ return;
+}
+
+static int __validate_appid(const char *pkgid, const char *appid, char **newappid)
+{
+ if (!pkgid || !appid || !newappid) {
+ _LOGD("Arg supplied is NULL\n");
+ return -1;
+ }
+ int pkglen = strlen(pkgid);
+ int applen = strlen(appid);
+ char *ptr = NULL;
+ char *newapp = NULL;
+ int len = 0;
+ if (strncmp(appid, ".", 1) == 0) {
+ len = pkglen + applen + 1;
+ newapp = calloc(1,len);
+ if (newapp == NULL) {
+ _LOGD("Malloc failed\n");
+ return -1;
+ }
+ strncpy(newapp, pkgid, pkglen);
+ strncat(newapp, appid, applen);
+ _LOGD("new appid is %s\n", newapp);
+ *newappid = newapp;
+ return 0;
+ }
+ if (applen < pkglen) {
+ _LOGD("app id is not proper\n");
+ *newappid = NULL;
+#ifdef _VALIDATE_APPID_
+ return -1;
+#else
+ return 0;
+#endif
+ }
+ if (!strcmp(appid, pkgid)) {
+ _LOGD("appid is proper\n");
+ *newappid = NULL;
+ return 0;
+ }
+ else if (strncmp(appid, pkgid, pkglen) == 0) {
+ ptr = strstr(appid, pkgid);
+ ptr = ptr + pkglen;
+ if (strncmp(ptr, ".", 1) == 0) {
+ _LOGD("appid is proper\n");
+ *newappid = NULL;
+ return 0;
+ }
+ else {
+ _LOGD("appid is not proper\n");
+ *newappid = NULL;
+#ifdef _VALIDATE_APPID_
+ return -1;
+#else
+ return 0;
+#endif
+ }
+ } else {
+ _LOGD("appid is not proper\n");
+ *newappid = NULL;
+#ifdef _VALIDATE_APPID_
+ return -1;
+#else
+ return 0;
+#endif
+ }
+ return 0;
+}
+
+static char *__pkgid_to_manifest(const char *pkgid)
+{
+ char *manifest;
+ int size;
+
+ if (pkgid == NULL) {
+ _LOGE("pkgid is NULL");
+ return NULL;
+ }
+
+ size = strlen(MANIFEST_RW_DIRECTORY) + strlen(pkgid) + 10;
+ manifest = malloc(size);
+ if (manifest == NULL) {
+ _LOGE("No memory");
+ return NULL;
+ }
+ memset(manifest, '\0', size);
+ snprintf(manifest, size, MANIFEST_RW_DIRECTORY "/%s.xml", pkgid);
+
+ if (access(manifest, F_OK)) {
+ snprintf(manifest, size, MANIFEST_RO_DIRECTORY "/%s.xml", pkgid);
+ }
+
+ return manifest;
+}
+
+static int __next_child_element(xmlTextReaderPtr reader, int depth)
+{
+ int ret = xmlTextReaderRead(reader);
+ int cur = xmlTextReaderDepth(reader);
+ while (ret == 1) {
+
+ switch (xmlTextReaderNodeType(reader)) {
+ case XML_READER_TYPE_ELEMENT:
+ if (cur == depth + 1)
+ return 1;
+ break;
+ case XML_READER_TYPE_TEXT:
+ /*text is handled by each function separately*/
+ if (cur == depth + 1)
+ return 0;
+ break;
+ case XML_READER_TYPE_END_ELEMENT:
+ if (cur == depth)
+ return 0;
+ break;
+ default:
+ if (cur <= depth)
+ return 0;
+ break;
+ }
+ ret = xmlTextReaderRead(reader);
+ cur = xmlTextReaderDepth(reader);
+ }
+ return ret;
+}
+
+static bool __check_action_fota(char *const tagv[])
+{
+ int i = 0;
+ char delims[] = "=";
+ char *ret_result = NULL;
+ char *tag = NULL;
+ int ret = false;
+
+ if (tagv == NULL)
+ return ret;
+
+ for (tag = strdup(tagv[0]); tag != NULL; ) {
+ ret_result = strtok(tag, delims);
+
+ /*check tag : fota is true */
+ if (strcmp(ret_result, "fota") == 0) {
+ ret_result = strtok(NULL, delims);
+ if (strcmp(ret_result, "true") == 0) {
+ ret = true;
+ }
+ } else
+ _LOGD("tag process [%s]is not defined\n", ret_result);
+
+ free(tag);
+
+ /*check next value*/
+ if (tagv[++i] != NULL)
+ tag = strdup(tagv[i]);
+ else {
+ _LOGD("tag process success...%d\n" , ret);
+ return ret;
+ }
+ }
+
+ return ret;
+}
+
+static void __ps_free_category(category_x *category)
+{
+ if (category == NULL)
+ return;
+ if (category->name) {
+ free((void *)category->name);
+ category->name = NULL;
+ }
+ free((void*)category);
+ category = NULL;
+}
+
+static void __ps_free_privilege(privilege_x *privilege)
+{
+ if (privilege == NULL)
+ return;
+ if (privilege->text) {
+ free((void *)privilege->text);
+ privilege->text = NULL;
+ }
+ free((void*)privilege);
+ privilege = NULL;
+}
+
+static void __ps_free_privileges(privileges_x *privileges)
+{
+ if (privileges == NULL)
+ return;
+ /*Free Privilege*/
+ if (privileges->privilege) {
+ privilege_x *privilege = privileges->privilege;
+ privilege_x *tmp = NULL;
+ while(privilege != NULL) {
+ tmp = privilege->next;
+ __ps_free_privilege(privilege);
+ privilege = tmp;
+ }
+ }
+ free((void*)privileges);
+ privileges = NULL;
+}
+
+static void __ps_free_metadata(metadata_x *metadata)
+{
+ if (metadata == NULL)
+ return;
+ if (metadata->key) {
+ free((void *)metadata->key);
+ metadata->key = NULL;
+ }
+ if (metadata->value) {
+ free((void *)metadata->value);
+ metadata->value = NULL;
+ }
+ free((void*)metadata);
+ metadata = NULL;
+}
+
+static void __ps_free_permission(permission_x *permission)
+{
+ if (permission == NULL)
+ return;
+ if (permission->type) {
+ free((void *)permission->type);
+ permission->type = NULL;
+ }
+ if (permission->value) {
+ free((void *)permission->value);
+ permission->value = NULL;
+ }
+ free((void*)permission);
+ permission = NULL;
+}
+
+static void __ps_free_icon(icon_x *icon)
+{
+ if (icon == NULL)
+ return;
+ if (icon->text) {
+ free((void *)icon->text);
+ icon->text = NULL;
+ }
+ if (icon->lang) {
+ free((void *)icon->lang);
+ icon->lang = NULL;
+ }
+ if (icon->name) {
+ free((void *)icon->name);
+ icon->name= NULL;
+ }
+ if (icon->section) {
+ free((void *)icon->section);
+ icon->section = NULL;
+ }
+ if (icon->size) {
+ free((void *)icon->size);
+ icon->size = NULL;
+ }
+ if (icon->resolution) {
+ free((void *)icon->resolution);
+ icon->resolution = NULL;
+ }
+ free((void*)icon);
+ icon = NULL;
+}
+
+static void __ps_free_image(image_x *image)
+{
+ if (image == NULL)
+ return;
+ if (image->text) {
+ free((void *)image->text);
+ image->text = NULL;
+ }
+ if (image->lang) {
+ free((void *)image->lang);
+ image->lang = NULL;
+ }
+ if (image->name) {
+ free((void *)image->name);
+ image->name= NULL;
+ }
+ if (image->section) {
+ free((void *)image->section);
+ image->section = NULL;
+ }
+ free((void*)image);
+ image = NULL;
+}
+
+static void __ps_free_operation(operation_x *operation)
+{
+ if (operation == NULL)
+ return;
+ if (operation->text) {
+ free((void *)operation->text);
+ operation->text = NULL;
+ }
+ free((void*)operation);
+ operation = NULL;
+}
+
+static void __ps_free_uri(uri_x *uri)
+{
+ if (uri == NULL)
+ return;
+ if (uri->text) {
+ free((void *)uri->text);
+ uri->text = NULL;
+ }
+ free((void*)uri);
+ uri = NULL;
+}
+
+static void __ps_free_mime(mime_x *mime)
+{
+ if (mime == NULL)
+ return;
+ if (mime->text) {
+ free((void *)mime->text);
+ mime->text = NULL;
+ }
+ free((void*)mime);
+ mime = NULL;
+}
+
+static void __ps_free_subapp(subapp_x *subapp)
+{
+ if (subapp == NULL)
+ return;
+ if (subapp->text) {
+ free((void *)subapp->text);
+ subapp->text = NULL;
+ }
+ free((void*)subapp);
+ subapp = NULL;
+}
+
+static void __ps_free_condition(condition_x *condition)
+{
+ if (condition == NULL)
+ return;
+ if (condition->text) {
+ free((void *)condition->text);
+ condition->text = NULL;
+ }
+ if (condition->name) {
+ free((void *)condition->name);
+ condition->name = NULL;
+ }
+ free((void*)condition);
+ condition = NULL;
+}
+
+static void __ps_free_notification(notification_x *notification)
+{
+ if (notification == NULL)
+ return;
+ if (notification->text) {
+ free((void *)notification->text);
+ notification->text = NULL;
+ }
+ if (notification->name) {
+ free((void *)notification->name);
+ notification->name = NULL;
+ }
+ free((void*)notification);
+ notification = NULL;
+}
+
+static void __ps_free_compatibility(compatibility_x *compatibility)
+{
+ if (compatibility == NULL)
+ return;
+ if (compatibility->text) {
+ free((void *)compatibility->text);
+ compatibility->text = NULL;
+ }
+ if (compatibility->name) {
+ free((void *)compatibility->name);
+ compatibility->name = NULL;
+ }
+ free((void*)compatibility);
+ compatibility = NULL;
+}
+
+static void __ps_free_resolution(resolution_x *resolution)
+{
+ if (resolution == NULL)
+ return;
+ if (resolution->mimetype) {
+ free((void *)resolution->mimetype);
+ resolution->mimetype = NULL;
+ }
+ if (resolution->urischeme) {
+ free((void *)resolution->urischeme);
+ resolution->urischeme = NULL;
+ }
+ free((void*)resolution);
+ resolution = NULL;
+}
+
+static void __ps_free_capability(capability_x *capability)
+{
+ if (capability == NULL)
+ return;
+ if (capability->operationid) {
+ free((void *)capability->operationid);
+ capability->operationid = NULL;
+ }
+ /*Free Resolution*/
+ if (capability->resolution) {
+ resolution_x *resolution = capability->resolution;
+ resolution_x *tmp = NULL;
+ while(resolution != NULL) {
+ tmp = resolution->next;
+ __ps_free_resolution(resolution);
+ resolution = tmp;
+ }
+ }
+ free((void*)capability);
+ capability = NULL;
+}
+
+static void __ps_free_allowed(allowed_x *allowed)
+{
+ if (allowed == NULL)
+ return;
+ if (allowed->name) {
+ free((void *)allowed->name);
+ allowed->name = NULL;
+ }
+ if (allowed->text) {
+ free((void *)allowed->text);
+ allowed->text = NULL;
+ }
+ free((void*)allowed);
+ allowed = NULL;
+}
+
+static void __ps_free_request(request_x *request)
+{
+ if (request == NULL)
+ return;
+ if (request->text) {
+ free((void *)request->text);
+ request->text = NULL;
+ }
+ free((void*)request);
+ request = NULL;
+}
+
+static void __ps_free_datacontrol(datacontrol_x *datacontrol)
+{
+ if (datacontrol == NULL)
+ return;
+ if (datacontrol->providerid) {
+ free((void *)datacontrol->providerid);
+ datacontrol->providerid = NULL;
+ }
+ /*Free Capability*/
+ if (datacontrol->capability) {
+ capability_x *capability = datacontrol->capability;
+ capability_x *tmp = NULL;
+ while(capability != NULL) {
+ tmp = capability->next;
+ __ps_free_capability(capability);
+ capability = tmp;
+ }
+ }
+ free((void*)datacontrol);
+ datacontrol = NULL;
+}
+
+static void __ps_free_launchconditions(launchconditions_x *launchconditions)
+{
+ if (launchconditions == NULL)
+ return;
+ if (launchconditions->text) {
+ free((void *)launchconditions->text);
+ launchconditions->text = NULL;
+ }
+ /*Free Condition*/
+ if (launchconditions->condition) {
+ condition_x *condition = launchconditions->condition;
+ condition_x *tmp = NULL;
+ while(condition != NULL) {
+ tmp = condition->next;
+ __ps_free_condition(condition);
+ condition = tmp;
+ }
+ }
+ free((void*)launchconditions);
+ launchconditions = NULL;
+}
+
+static void __ps_free_appcontrol(appcontrol_x *appcontrol)
+{
+ if (appcontrol == NULL)
+ return;
+ if (appcontrol->text) {
+ free((void *)appcontrol->text);
+ appcontrol->text = NULL;
+ }
+ /*Free Operation*/
+ if (appcontrol->operation) {
+ operation_x *operation = appcontrol->operation;
+ operation_x *tmp = NULL;
+ while(operation != NULL) {
+ tmp = operation->next;
+ __ps_free_operation(operation);
+ operation = tmp;
+ }
+ }
+ /*Free Uri*/
+ if (appcontrol->uri) {
+ uri_x *uri = appcontrol->uri;
+ uri_x *tmp = NULL;
+ while(uri != NULL) {
+ tmp = uri->next;
+ __ps_free_uri(uri);
+ uri = tmp;
+ }
+ }
+ /*Free Mime*/
+ if (appcontrol->mime) {
+ mime_x *mime = appcontrol->mime;
+ mime_x *tmp = NULL;
+ while(mime != NULL) {
+ tmp = mime->next;
+ __ps_free_mime(mime);
+ mime = tmp;
+ }
+ }
+ /*Free subapp*/
+ if (appcontrol->subapp) {
+ subapp_x *subapp = appcontrol->subapp;
+ subapp_x *tmp = NULL;
+ while(subapp != NULL) {
+ tmp = subapp->next;
+ __ps_free_subapp(subapp);
+ subapp = tmp;
+ }
+ }
+ free((void*)appcontrol);
+ appcontrol = NULL;
+}
+
+static void __ps_free_appsvc(appsvc_x *appsvc)
+{
+ if (appsvc == NULL)
+ return;
+ if (appsvc->text) {
+ free((void *)appsvc->text);
+ appsvc->text = NULL;
+ }
+ /*Free Operation*/
+ if (appsvc->operation) {
+ operation_x *operation = appsvc->operation;
+ operation_x *tmp = NULL;
+ while(operation != NULL) {
+ tmp = operation->next;
+ __ps_free_operation(operation);
+ operation = tmp;
+ }
+ }
+ /*Free Uri*/
+ if (appsvc->uri) {
+ uri_x *uri = appsvc->uri;
+ uri_x *tmp = NULL;
+ while(uri != NULL) {
+ tmp = uri->next;
+ __ps_free_uri(uri);
+ uri = tmp;
+ }
+ }
+ /*Free Mime*/
+ if (appsvc->mime) {
+ mime_x *mime = appsvc->mime;
+ mime_x *tmp = NULL;
+ while(mime != NULL) {
+ tmp = mime->next;
+ __ps_free_mime(mime);
+ mime = tmp;
+ }
+ }
+ /*Free subapp*/
+ if (appsvc->subapp) {
+ subapp_x *subapp = appsvc->subapp;
+ subapp_x *tmp = NULL;
+ while(subapp != NULL) {
+ tmp = subapp->next;
+ __ps_free_subapp(subapp);
+ subapp = tmp;
+ }
+ }
+ free((void*)appsvc);
+ appsvc = NULL;
+}
+
+static void __ps_free_deviceprofile(deviceprofile_x *deviceprofile)
+{
+ return;
+}
+
+static void __ps_free_define(define_x *define)
+{
+ if (define == NULL)
+ return;
+ if (define->path) {
+ free((void *)define->path);
+ define->path = NULL;
+ }
+ /*Free Request*/
+ if (define->request) {
+ request_x *request = define->request;
+ request_x *tmp = NULL;
+ while(request != NULL) {
+ tmp = request->next;
+ __ps_free_request(request);
+ request = tmp;
+ }
+ }
+ /*Free Allowed*/
+ if (define->allowed) {
+ allowed_x *allowed = define->allowed;
+ allowed_x *tmp = NULL;
+ while(allowed != NULL) {
+ tmp = allowed->next;
+ __ps_free_allowed(allowed);
+ allowed = tmp;
+ }
+ }
+ free((void*)define);
+ define = NULL;
+}
+
+static void __ps_free_datashare(datashare_x *datashare)
+{
+ if (datashare == NULL)
+ return;
+ /*Free Define*/
+ if (datashare->define) {
+ define_x *define = datashare->define;
+ define_x *tmp = NULL;
+ while(define != NULL) {
+ tmp = define->next;
+ __ps_free_define(define);
+ define = tmp;
+ }
+ }
+ /*Free Request*/
+ if (datashare->request) {
+ request_x *request = datashare->request;
+ request_x *tmp = NULL;
+ while(request != NULL) {
+ tmp = request->next;
+ __ps_free_request(request);
+ request = tmp;
+ }
+ }
+ free((void*)datashare);
+ datashare = NULL;
+}
+
+static void __ps_free_label(label_x *label)
+{
+ if (label == NULL)
+ return;
+ if (label->name) {
+ free((void *)label->name);
+ label->name = NULL;
+ }
+ if (label->text) {
+ free((void *)label->text);
+ label->text = NULL;
+ }
+ if (label->lang) {
+ free((void *)label->lang);
+ label->lang= NULL;
+ }
+ free((void*)label);
+ label = NULL;
+}
+
+static void __ps_free_author(author_x *author)
+{
+ if (author == NULL)
+ return;
+ if (author->email) {
+ free((void *)author->email);
+ author->email = NULL;
+ }
+ if (author->text) {
+ free((void *)author->text);
+ author->text = NULL;
+ }
+ if (author->href) {
+ free((void *)author->href);
+ author->href = NULL;
+ }
+ if (author->lang) {
+ free((void *)author->lang);
+ author->lang = NULL;
+ }
+ free((void*)author);
+ author = NULL;
+}
+
+static void __ps_free_description(description_x *description)
+{
+ if (description == NULL)
+ return;
+ if (description->name) {
+ free((void *)description->name);
+ description->name = NULL;
+ }
+ if (description->text) {
+ free((void *)description->text);
+ description->text = NULL;
+ }
+ if (description->lang) {
+ free((void *)description->lang);
+ description->lang = NULL;
+ }
+ free((void*)description);
+ description = NULL;
+}
+
+static void __ps_free_license(license_x *license)
+{
+ if (license == NULL)
+ return;
+ if (license->text) {
+ free((void *)license->text);
+ license->text = NULL;
+ }
+ if (license->lang) {
+ free((void *)license->lang);
+ license->lang = NULL;
+ }
+ free((void*)license);
+ license = NULL;
+}
+
+static void __ps_free_uiapplication(uiapplication_x *uiapplication)
+{
+ if (uiapplication == NULL)
+ return;
+ if (uiapplication->exec) {
+ free((void *)uiapplication->exec);
+ uiapplication->exec = NULL;
+ }
+ if (uiapplication->appid) {
+ free((void *)uiapplication->appid);
+ uiapplication->appid = NULL;
+ }
+ if (uiapplication->nodisplay) {
+ free((void *)uiapplication->nodisplay);
+ uiapplication->nodisplay = NULL;
+ }
+ if (uiapplication->multiple) {
+ free((void *)uiapplication->multiple);
+ uiapplication->multiple = NULL;
+ }
+ if (uiapplication->type) {
+ free((void *)uiapplication->type);
+ uiapplication->type = NULL;
+ }
+ if (uiapplication->categories) {
+ free((void *)uiapplication->categories);
+ uiapplication->categories = NULL;
+ }
+ if (uiapplication->extraid) {
+ free((void *)uiapplication->extraid);
+ uiapplication->extraid = NULL;
+ }
+ if (uiapplication->taskmanage) {
+ free((void *)uiapplication->taskmanage);
+ uiapplication->taskmanage = NULL;
+ }
+ if (uiapplication->enabled) {
+ free((void *)uiapplication->enabled);
+ uiapplication->enabled = NULL;
+ }
+ if (uiapplication->hwacceleration) {
+ free((void *)uiapplication->hwacceleration);
+ uiapplication->hwacceleration = NULL;
+ }
+ if (uiapplication->screenreader) {
+ free((void *)uiapplication->screenreader);
+ uiapplication->screenreader = NULL;
+ }
+ if (uiapplication->mainapp) {
+ free((void *)uiapplication->mainapp);
+ uiapplication->mainapp = NULL;
+ }
+ if (uiapplication->recentimage) {
+ free((void *)uiapplication->recentimage);
+ uiapplication->recentimage = NULL;
+ }
+ if (uiapplication->package) {
+ free((void *)uiapplication->package);
+ uiapplication->package = NULL;
+ }
+ if (uiapplication->launchcondition) {
+ free((void *)uiapplication->launchcondition);
+ uiapplication->launchcondition = NULL;
+ }
+ /*Free Label*/
+ if (uiapplication->label) {
+ label_x *label = uiapplication->label;
+ label_x *tmp = NULL;
+ while(label != NULL) {
+ tmp = label->next;
+ __ps_free_label(label);
+ label = tmp;
+ }
+ }
+ /*Free Icon*/
+ if (uiapplication->icon) {
+ icon_x *icon = uiapplication->icon;
+ icon_x *tmp = NULL;
+ while(icon != NULL) {
+ tmp = icon->next;
+ __ps_free_icon(icon);
+ icon = tmp;
+ }
+ }
+ /*Free image*/
+ if (uiapplication->image) {
+ image_x *image = uiapplication->image;
+ image_x *tmp = NULL;
+ while(image != NULL) {
+ tmp = image->next;
+ __ps_free_image(image);
+ image = tmp;
+ }
+ }
+ /*Free AppControl*/
+ if (uiapplication->appcontrol) {
+ appcontrol_x *appcontrol = uiapplication->appcontrol;
+ appcontrol_x *tmp = NULL;
+ while(appcontrol != NULL) {
+ tmp = appcontrol->next;
+ __ps_free_appcontrol(appcontrol);
+ appcontrol = tmp;
+ }
+ }
+ /*Free LaunchConditions*/
+ if (uiapplication->launchconditions) {
+ launchconditions_x *launchconditions = uiapplication->launchconditions;
+ launchconditions_x *tmp = NULL;
+ while(launchconditions != NULL) {
+ tmp = launchconditions->next;
+ __ps_free_launchconditions(launchconditions);
+ launchconditions = tmp;
+ }
+ }
+ /*Free Notification*/
+ if (uiapplication->notification) {
+ notification_x *notification = uiapplication->notification;
+ notification_x *tmp = NULL;
+ while(notification != NULL) {
+ tmp = notification->next;
+ __ps_free_notification(notification);
+ notification = tmp;
+ }
+ }
+ /*Free DataShare*/
+ if (uiapplication->datashare) {
+ datashare_x *datashare = uiapplication->datashare;
+ datashare_x *tmp = NULL;
+ while(datashare != NULL) {
+ tmp = datashare->next;
+ __ps_free_datashare(datashare);
+ datashare = tmp;
+ }
+ }
+ /*Free AppSvc*/
+ if (uiapplication->appsvc) {
+ appsvc_x *appsvc = uiapplication->appsvc;
+ appsvc_x *tmp = NULL;
+ while(appsvc != NULL) {
+ tmp = appsvc->next;
+ __ps_free_appsvc(appsvc);
+ appsvc = tmp;
+ }
+ }
+ /*Free Category*/
+ if (uiapplication->category) {
+ category_x *category = uiapplication->category;
+ category_x *tmp = NULL;
+ while(category != NULL) {
+ tmp = category->next;
+ __ps_free_category(category);
+ category = tmp;
+ }
+ }
+ /*Free Metadata*/
+ if (uiapplication->metadata) {
+ metadata_x *metadata = uiapplication->metadata;
+ metadata_x *tmp = NULL;
+ while(metadata != NULL) {
+ tmp = metadata->next;
+ __ps_free_metadata(metadata);
+ metadata = tmp;
+ }
+ }
+ /*Free permission*/
+ if (uiapplication->permission) {
+ permission_x *permission = uiapplication->permission;
+ permission_x *tmp = NULL;
+ while(permission != NULL) {
+ tmp = permission->next;
+ __ps_free_permission(permission);
+ permission = tmp;
+ }
+ }
+ /* _PRODUCT_LAUNCHING_ENHANCED_ START */
+ if (uiapplication->indicatordisplay) {
+ free((void *)uiapplication->indicatordisplay);
+ uiapplication->indicatordisplay = NULL;
+ }
+ if (uiapplication->portraitimg) {
+ free((void *)uiapplication->portraitimg);
+ uiapplication->portraitimg = NULL;
+ }
+ if (uiapplication->landscapeimg) {
+ free((void *)uiapplication->landscapeimg);
+ uiapplication->landscapeimg = NULL;
+ }
+ /* _PRODUCT_LAUNCHING_ENHANCED_ END */
+ if (uiapplication->guestmode_visibility) {
+ free((void *)uiapplication->guestmode_visibility);
+ uiapplication->guestmode_visibility = NULL;
+ }
+ if (uiapplication->app_component) {
+ free((void *)uiapplication->app_component);
+ uiapplication->app_component = NULL;
+ }
+ if (uiapplication->permission_type) {
+ free((void *)uiapplication->permission_type);
+ uiapplication->permission_type = NULL;
+ }
+ if (uiapplication->component_type) {
+ free((void *)uiapplication->component_type);
+ uiapplication->component_type = NULL;
+ }
+ if (uiapplication->preload) {
+ free((void *)uiapplication->preload);
+ uiapplication->preload = NULL;
+ }
+ if (uiapplication->submode) {
+ free((void *)uiapplication->submode);
+ uiapplication->submode = NULL;
+ }
+ if (uiapplication->submode_mainid) {
+ free((void *)uiapplication->submode_mainid);
+ uiapplication->submode_mainid = NULL;
+ }
+ if (uiapplication->installed_storage) {
+ free((void *)uiapplication->installed_storage);
+ uiapplication->installed_storage = NULL;
+ }
+ if (uiapplication->process_pool) {
+ free((void *)uiapplication->process_pool);
+ uiapplication->process_pool = NULL;
+ }
+ if (uiapplication->autorestart) {
+ free((void *)uiapplication->autorestart);
+ uiapplication->autorestart = NULL;
+ }
+ if (uiapplication->onboot) {
+ free((void *)uiapplication->onboot);
+ uiapplication->onboot = NULL;
+ }
+
+ free((void*)uiapplication);
+ uiapplication = NULL;
+}
+
+static void __ps_free_serviceapplication(serviceapplication_x *serviceapplication)
+{
+ if (serviceapplication == NULL)
+ return;
+ if (serviceapplication->exec) {
+ free((void *)serviceapplication->exec);
+ serviceapplication->exec = NULL;
+ }
+ if (serviceapplication->appid) {
+ free((void *)serviceapplication->appid);
+ serviceapplication->appid = NULL;
+ }
+ if (serviceapplication->onboot) {
+ free((void *)serviceapplication->onboot);
+ serviceapplication->onboot = NULL;
+ }
+ if (serviceapplication->autorestart) {
+ free((void *)serviceapplication->autorestart);
+ serviceapplication->autorestart = NULL;
+ }
+ if (serviceapplication->type) {
+ free((void *)serviceapplication->type);
+ serviceapplication->type = NULL;
+ }
+ if (serviceapplication->enabled) {
+ free((void *)serviceapplication->enabled);
+ serviceapplication->enabled = NULL;
+ }
+ if (serviceapplication->package) {
+ free((void *)serviceapplication->package);
+ serviceapplication->package = NULL;
+ }
+ if (serviceapplication->permission_type) {
+ free((void *)serviceapplication->permission_type);
+ serviceapplication->permission_type = NULL;
+ }
+ /*Free Label*/
+ if (serviceapplication->label) {
+ label_x *label = serviceapplication->label;
+ label_x *tmp = NULL;
+ while(label != NULL) {
+ tmp = label->next;
+ __ps_free_label(label);
+ label = tmp;
+ }
+ }
+ /*Free Icon*/
+ if (serviceapplication->icon) {
+ icon_x *icon = serviceapplication->icon;
+ icon_x *tmp = NULL;
+ while(icon != NULL) {
+ tmp = icon->next;
+ __ps_free_icon(icon);
+ icon = tmp;
+ }
+ }
+ /*Free AppControl*/
+ if (serviceapplication->appcontrol) {
+ appcontrol_x *appcontrol = serviceapplication->appcontrol;
+ appcontrol_x *tmp = NULL;
+ while(appcontrol != NULL) {
+ tmp = appcontrol->next;
+ __ps_free_appcontrol(appcontrol);
+ appcontrol = tmp;
+ }
+ }
+ /*Free DataControl*/
+ if (serviceapplication->datacontrol) {
+ datacontrol_x *datacontrol = serviceapplication->datacontrol;
+ datacontrol_x *tmp = NULL;
+ while(datacontrol != NULL) {
+ tmp = datacontrol->next;
+ __ps_free_datacontrol(datacontrol);
+ datacontrol = tmp;
+ }
+ }
+ /*Free LaunchConditions*/
+ if (serviceapplication->launchconditions) {
+ launchconditions_x *launchconditions = serviceapplication->launchconditions;
+ launchconditions_x *tmp = NULL;
+ while(launchconditions != NULL) {
+ tmp = launchconditions->next;
+ __ps_free_launchconditions(launchconditions);
+ launchconditions = tmp;
+ }
+ }
+ /*Free Notification*/
+ if (serviceapplication->notification) {
+ notification_x *notification = serviceapplication->notification;
+ notification_x *tmp = NULL;
+ while(notification != NULL) {
+ tmp = notification->next;
+ __ps_free_notification(notification);
+ notification = tmp;
+ }
+ }
+ /*Free DataShare*/
+ if (serviceapplication->datashare) {
+ datashare_x *datashare = serviceapplication->datashare;
+ datashare_x *tmp = NULL;
+ while(datashare != NULL) {
+ tmp = datashare->next;
+ __ps_free_datashare(datashare);
+ datashare = tmp;
+ }
+ }
+ /*Free AppSvc*/
+ if (serviceapplication->appsvc) {
+ appsvc_x *appsvc = serviceapplication->appsvc;
+ appsvc_x *tmp = NULL;
+ while(appsvc != NULL) {
+ tmp = appsvc->next;
+ __ps_free_appsvc(appsvc);
+ appsvc = tmp;
+ }
+ }
+ /*Free Category*/
+ if (serviceapplication->category) {
+ category_x *category = serviceapplication->category;
+ category_x *tmp = NULL;
+ while(category != NULL) {
+ tmp = category->next;
+ __ps_free_category(category);
+ category = tmp;
+ }
+ }
+ /*Free Metadata*/
+ if (serviceapplication->metadata) {
+ metadata_x *metadata = serviceapplication->metadata;
+ metadata_x *tmp = NULL;
+ while(metadata != NULL) {
+ tmp = metadata->next;
+ __ps_free_metadata(metadata);
+ metadata = tmp;
+ }
+ }
+ /*Free permission*/
+ if (serviceapplication->permission) {
+ permission_x *permission = serviceapplication->permission;
+ permission_x *tmp = NULL;
+ while(permission != NULL) {
+ tmp = permission->next;
+ __ps_free_permission(permission);
+ permission = tmp;
+ }
+ }
+ free((void*)serviceapplication);
+ serviceapplication = NULL;
+}
+
+static void __ps_free_font(font_x *font)
+{
+ if (font == NULL)
+ return;
+ if (font->name) {
+ free((void *)font->name);
+ font->name = NULL;
+ }
+ if (font->text) {
+ free((void *)font->text);
+ font->text = NULL;
+ }
+ free((void*)font);
+ font = NULL;
+}
+
+static void __ps_free_theme(theme_x *theme)
+{
+ if (theme == NULL)
+ return;
+ if (theme->name) {
+ free((void *)theme->name);
+ theme->name = NULL;
+ }
+ if (theme->text) {
+ free((void *)theme->text);
+ theme->text = NULL;
+ }
+ free((void*)theme);
+ theme = NULL;
+}
+
+static void __ps_free_daemon(daemon_x *daemon)
+{
+ if (daemon == NULL)
+ return;
+ if (daemon->name) {
+ free((void *)daemon->name);
+ daemon->name = NULL;
+ }
+ if (daemon->text) {
+ free((void *)daemon->text);
+ daemon->text = NULL;
+ }
+ free((void*)daemon);
+ daemon = NULL;
+}
+
+static void __ps_free_ime(ime_x *ime)
+{
+ if (ime == NULL)
+ return;
+ if (ime->name) {
+ free((void *)ime->name);
+ ime->name = NULL;
+ }
+ if (ime->text) {
+ free((void *)ime->text);
+ ime->text = NULL;
+ }
+ free((void*)ime);
+ ime = NULL;
+}
+
+static int __ps_process_allowed(xmlTextReaderPtr reader, allowed_x *allowed)
+{
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ allowed->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_operation(xmlTextReaderPtr reader, operation_x *operation)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ operation->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+/* Text does not exist. Only attribute exists
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ operation->text = ASCII(xmlTextReaderValue(reader));
+*/
+ return 0;
+}
+
+static int __ps_process_uri(xmlTextReaderPtr reader, uri_x *uri)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ uri->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+/* Text does not exist. Only attribute exists
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ uri->text = ASCII(xmlTextReaderValue(reader));
+*/
+ return 0;
+}
+
+static int __ps_process_mime(xmlTextReaderPtr reader, mime_x *mime)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ mime->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+/* Text does not exist. Only attribute exists
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ mime->text = ASCII(xmlTextReaderValue(reader));
+*/
+ return 0;
+}
+
+static int __ps_process_subapp(xmlTextReaderPtr reader, subapp_x *subapp)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ subapp->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+/* Text does not exist. Only attribute exists
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ mime->text = ASCII(xmlTextReaderValue(reader));
+*/
+ return 0;
+}
+
+static int __ps_process_condition(xmlTextReaderPtr reader, condition_x *condition)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ condition->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ condition->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_notification(xmlTextReaderPtr reader, notification_x *notification)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ notification->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ notification->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_category(xmlTextReaderPtr reader, category_x *category)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ category->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ return 0;
+}
+
+static int __ps_process_privilege(xmlTextReaderPtr reader, privilege_x *privilege)
+{
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader)) {
+ privilege->text = ASCII(xmlTextReaderValue(reader));
+ }
+ return 0;
+}
+
+static int __ps_process_metadata(xmlTextReaderPtr reader, metadata_x *metadata)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("key")))
+ metadata->key = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("key")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("value")))
+ metadata->value = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("value")));
+ return 0;
+}
+
+static int __ps_process_permission(xmlTextReaderPtr reader, permission_x *permission)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("type")))
+ permission->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type")));
+
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ permission->value = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_compatibility(xmlTextReaderPtr reader, compatibility_x *compatibility)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ compatibility->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ compatibility->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_resolution(xmlTextReaderPtr reader, resolution_x *resolution)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("mime-type")))
+ resolution->mimetype = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("mime-type")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("uri-scheme")))
+ resolution->urischeme = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("uri-scheme")));
+ return 0;
+}
+
+static int __ps_process_request(xmlTextReaderPtr reader, request_x *request)
+{
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ request->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_define(xmlTextReaderPtr reader, define_x *define)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ allowed_x *tmp1 = NULL;
+ request_x *tmp2 = NULL;
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("path")))
+ define->path = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("path")));
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "allowed")) {
+ allowed_x *allowed= malloc(sizeof(allowed_x));
+ if (allowed == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(allowed, '\0', sizeof(allowed_x));
+ LISTADD(define->allowed, allowed);
+ ret = __ps_process_allowed(reader, allowed);
+ } else if (!strcmp(ASCII(node), "request")) {
+ request_x *request = malloc(sizeof(request_x));
+ if (request == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(request, '\0', sizeof(request_x));
+ LISTADD(define->request, request);
+ ret = __ps_process_request(reader, request);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing define failed\n");
+ return ret;
+ }
+ }
+ if (define->allowed) {
+ LISTHEAD(define->allowed, tmp1);
+ define->allowed = tmp1;
+ }
+ if (define->request) {
+ LISTHEAD(define->request, tmp2);
+ define->request = tmp2;
+ }
+ return ret;
+}
+
+static int __ps_process_appcontrol(xmlTextReaderPtr reader, appcontrol_x *appcontrol)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ operation_x *tmp1 = NULL;
+ uri_x *tmp2 = NULL;
+ mime_x *tmp3 = NULL;
+ subapp_x *tmp4 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "operation")) {
+ operation_x *operation = malloc(sizeof(operation_x));
+ if (operation == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(operation, '\0', sizeof(operation_x));
+ LISTADD(appcontrol->operation, operation);
+ ret = __ps_process_operation(reader, operation);
+ _LOGD("operation processing\n");
+ } else if (!strcmp(ASCII(node), "uri")) {
+ uri_x *uri= malloc(sizeof(uri_x));
+ if (uri == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(uri, '\0', sizeof(uri_x));
+ LISTADD(appcontrol->uri, uri);
+ ret = __ps_process_uri(reader, uri);
+ _LOGD("uri processing\n");
+ } else if (!strcmp(ASCII(node), "mime")) {
+ mime_x *mime = malloc(sizeof(mime_x));
+ if (mime == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(mime, '\0', sizeof(mime_x));
+ LISTADD(appcontrol->mime, mime);
+ ret = __ps_process_mime(reader, mime);
+ _LOGD("mime processing\n");
+ } else if (!strcmp(ASCII(node), "subapp")) {
+ subapp_x *subapp = malloc(sizeof(subapp_x));
+ if (subapp == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(subapp, '\0', sizeof(subapp_x));
+ LISTADD(appcontrol->subapp, subapp);
+ ret = __ps_process_subapp(reader, subapp);
+ _LOGD("subapp processing\n");
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing appcontrol failed\n");
+ return ret;
+ }
+ }
+ if (appcontrol->operation) {
+ LISTHEAD(appcontrol->operation, tmp1);
+ appcontrol->operation = tmp1;
+ }
+ if (appcontrol->uri) {
+ LISTHEAD(appcontrol->uri, tmp2);
+ appcontrol->uri = tmp2;
+ }
+ if (appcontrol->mime) {
+ LISTHEAD(appcontrol->mime, tmp3);
+ appcontrol->mime = tmp3;
+ }
+ if (appcontrol->subapp) {
+ LISTHEAD(appcontrol->subapp, tmp4);
+ appcontrol->subapp = tmp4;
+ }
+
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ appcontrol->text = ASCII(xmlTextReaderValue(reader));
+
+ return ret;
+}
+
+static int __ps_process_appsvc(xmlTextReaderPtr reader, appsvc_x *appsvc)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ operation_x *tmp1 = NULL;
+ uri_x *tmp2 = NULL;
+ mime_x *tmp3 = NULL;
+ subapp_x *tmp4 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "operation")) {
+ operation_x *operation = malloc(sizeof(operation_x));
+ if (operation == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(operation, '\0', sizeof(operation_x));
+ LISTADD(appsvc->operation, operation);
+ ret = __ps_process_operation(reader, operation);
+ _LOGD("operation processing\n");
+ } else if (!strcmp(ASCII(node), "uri")) {
+ uri_x *uri= malloc(sizeof(uri_x));
+ if (uri == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(uri, '\0', sizeof(uri_x));
+ LISTADD(appsvc->uri, uri);
+ ret = __ps_process_uri(reader, uri);
+ _LOGD("uri processing\n");
+ } else if (!strcmp(ASCII(node), "mime")) {
+ mime_x *mime = malloc(sizeof(mime_x));
+ if (mime == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(mime, '\0', sizeof(mime_x));
+ LISTADD(appsvc->mime, mime);
+ ret = __ps_process_mime(reader, mime);
+ _LOGD("mime processing\n");
+ } else if (!strcmp(ASCII(node), "subapp")) {
+ subapp_x *subapp = malloc(sizeof(subapp_x));
+ if (subapp == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(subapp, '\0', sizeof(subapp_x));
+ LISTADD(appsvc->subapp, subapp);
+ ret = __ps_process_subapp(reader, subapp);
+ _LOGD("subapp processing\n");
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing appsvc failed\n");
+ return ret;
+ }
+ }
+ if (appsvc->operation) {
+ LISTHEAD(appsvc->operation, tmp1);
+ appsvc->operation = tmp1;
+ }
+ if (appsvc->uri) {
+ LISTHEAD(appsvc->uri, tmp2);
+ appsvc->uri = tmp2;
+ }
+ if (appsvc->mime) {
+ LISTHEAD(appsvc->mime, tmp3);
+ appsvc->mime = tmp3;
+ }
+ if (appsvc->subapp) {
+ LISTHEAD(appsvc->subapp, tmp4);
+ appsvc->subapp = tmp4;
+ }
+
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ appsvc->text = ASCII(xmlTextReaderValue(reader));
+
+ return ret;
+}
+
+
+static int __ps_process_privileges(xmlTextReaderPtr reader, privileges_x *privileges)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ privilege_x *tmp1 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (strcmp(ASCII(node), "privilege") == 0) {
+ privilege_x *privilege = malloc(sizeof(privilege_x));
+ if (privilege == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(privilege, '\0', sizeof(privilege_x));
+ LISTADD(privileges->privilege, privilege);
+ ret = __ps_process_privilege(reader, privilege);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing privileges failed\n");
+ return ret;
+ }
+ }
+ if (privileges->privilege) {
+ LISTHEAD(privileges->privilege, tmp1);
+ privileges->privilege = tmp1;
+ }
+ return ret;
+}
+
+static int __ps_process_launchconditions(xmlTextReaderPtr reader, launchconditions_x *launchconditions)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ condition_x *tmp1 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (strcmp(ASCII(node), "condition") == 0) {
+ condition_x *condition = malloc(sizeof(condition_x));
+ if (condition == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(condition, '\0', sizeof(condition_x));
+ LISTADD(launchconditions->condition, condition);
+ ret = __ps_process_condition(reader, condition);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing launchconditions failed\n");
+ return ret;
+ }
+ }
+ if (launchconditions->condition) {
+ LISTHEAD(launchconditions->condition, tmp1);
+ launchconditions->condition = tmp1;
+ }
+
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ launchconditions->text = ASCII(xmlTextReaderValue(reader));
+
+ return ret;
+}
+
+static int __ps_process_datashare(xmlTextReaderPtr reader, datashare_x *datashare)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ define_x *tmp1 = NULL;
+ request_x *tmp2 = NULL;
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "define")) {
+ define_x *define= malloc(sizeof(define_x));
+ if (define == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(define, '\0', sizeof(define_x));
+ LISTADD(datashare->define, define);
+ ret = __ps_process_define(reader, define);
+ } else if (!strcmp(ASCII(node), "request")) {
+ request_x *request= malloc(sizeof(request_x));
+ if (request == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(request, '\0', sizeof(request_x));
+ LISTADD(datashare->request, request);
+ ret = __ps_process_request(reader, request);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing data-share failed\n");
+ return ret;
+ }
+ }
+ if (datashare->define) {
+ LISTHEAD(datashare->define, tmp1);
+ datashare->define = tmp1;
+ }
+ if (datashare->request) {
+ LISTHEAD(datashare->request, tmp2);
+ datashare->request = tmp2;
+ }
+ return ret;
+}
+
+static char*
+__get_icon_with_path(const char* icon)
+{
+ if (!icon)
+ return NULL;
+
+ if (index(icon, '/') == NULL) {
+ char* theme = NULL;
+ char* icon_with_path = NULL;
+ int len;
+
+ if (!package)
+ return NULL;
+
+/* "db/setting/theme" is not exist */
+#if 0
+ theme = vconf_get_str("db/setting/theme");
+ if (!theme) {
+ theme = strdup("default");
+ if(!theme) {
+ return NULL;
+ }
+ }
+#else
+ theme = strdup("default");
+#endif
+
+ len = (0x01 << 7) + strlen(icon) + strlen(package) + strlen(theme);
+ icon_with_path = malloc(len);
+ if(icon_with_path == NULL) {
+ _LOGD("(icon_with_path == NULL) return\n");
+ free(theme);
+ return NULL;
+ }
+
+ memset(icon_with_path, 0, len);
+ snprintf(icon_with_path, len, "/opt/usr/apps/%s/shared/res/icons/default/small/%s", package, icon);
+ do {
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/opt/share/icons/%s/small/%s", theme, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/usr/share/icons/%s/small/%s", theme, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ _LOGD("cannot find icon %s", icon_with_path);
+ snprintf(icon_with_path, len,"/opt/share/icons/default/small/%s", icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/usr/share/icons/default/small/%s", icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+
+ /* icon path is going to be moved intto the app directory */
+ snprintf(icon_with_path, len, "/usr/apps/%s/shared/res/icons/default/small/%s", package, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/opt/apps/%s/res/icons/%s/small/%s", package, theme, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/usr/apps/%s/res/icons/%s/small/%s", package, theme, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ _LOGD("cannot find icon %s", icon_with_path);
+ snprintf(icon_with_path, len, "/opt/apps/%s/res/icons/default/small/%s", package, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/usr/apps/%s/res/icons/default/small/%s", package, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/usr/ug/res/images/%s/%s", package, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
+ } while (0);
+
+ free(theme);
+
+ _LOGD("Icon path : %s ---> %s", icon, icon_with_path);
+
+ return icon_with_path;
+ } else {
+ char* confirmed_icon = NULL;
+
+ confirmed_icon = strdup(icon);
+ if (!confirmed_icon)
+ return NULL;
+ return confirmed_icon;
+ }
+}
+
+static void __ps_process_tag(manifest_x * mfx, char *const tagv[])
+{
+ int i = 0;
+ char delims[] = "=";
+ char *ret_result = NULL;
+ char *tag = NULL;
+
+ if (tagv == NULL)
+ return;
+
+ for (tag = strdup(tagv[0]); tag != NULL; ) {
+ ret_result = strtok(tag, delims);
+
+ /*check tag : preload */
+ if (strcmp(ret_result, "preload") == 0) {
+ ret_result = strtok(NULL, delims);
+ if (strcmp(ret_result, "true") == 0) {
+ free((void *)mfx->preload);
+ mfx->preload = strdup("true");
+ } else if (strcmp(ret_result, "false") == 0) {
+ free((void *)mfx->preload);
+ mfx->preload = strdup("false");
+ }
+ /*check tag : removable*/
+ } else if (strcmp(ret_result, "removable") == 0) {
+ ret_result = strtok(NULL, delims);
+ if (strcmp(ret_result, "true") == 0){
+ free((void *)mfx->removable);
+ mfx->removable = strdup("true");
+ } else if (strcmp(ret_result, "false") == 0) {
+ free((void *)mfx->removable);
+ mfx->removable = strdup("false");
+ }
+ /*check tag : not matched*/
+ } else
+ _LOGD("tag process [%s]is not defined\n", ret_result);
+
+ free(tag);
+
+ /*check next value*/
+ if (tagv[++i] != NULL)
+ tag = strdup(tagv[i]);
+ else {
+ /*update tag : system*/
+ if ((strcmp(mfx->preload,"true")==0) && (strcmp(mfx->removable,"false")==0)){
+ free((void *)mfx->system);
+ mfx->system = strdup("true");
+ }
+ _LOGD("tag process success...\n");
+ return;
+ }
+ }
+}
+
+static int __ps_process_icon(xmlTextReaderPtr reader, icon_x *icon)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ icon->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ if (xmlTextReaderConstXmlLang(reader)) {
+ icon->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (icon->lang == NULL)
+ icon->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ icon->lang = strdup(DEFAULT_LOCALE);
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("section")))
+ icon->section = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("section")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("size")))
+ icon->size = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("size")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("resolution")))
+ icon->resolution = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("resolution")));
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader)) {
+ const char *text = ASCII(xmlTextReaderValue(reader));
+ if(text) {
+ icon->text = (const char *)__get_icon_with_path(text);
+ free((void *)text);
+ }
+ }
+
+ return 0;
+}
+
+static int __ps_process_image(xmlTextReaderPtr reader, image_x *image)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ image->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ if (xmlTextReaderConstXmlLang(reader)) {
+ image->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (image->lang == NULL)
+ image->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ image->lang = strdup(DEFAULT_LOCALE);
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("section")))
+ image->section = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("section")));
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ image->text = ASCII(xmlTextReaderValue(reader));
+
+ return 0;
+}
+
+static int __ps_process_label(xmlTextReaderPtr reader, label_x *label)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ label->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ if (xmlTextReaderConstXmlLang(reader)) {
+ label->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (label->lang == NULL)
+ label->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ label->lang = strdup(DEFAULT_LOCALE);
+ }
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ label->text = ASCII(xmlTextReaderValue(reader));
+
+/* _LOGD("lable name %s\n", label->name);
+ _LOGD("lable lang %s\n", label->lang);
+ _LOGD("lable text %s\n", label->text);
+*/
+ return 0;
+
+}
+
+static int __ps_process_author(xmlTextReaderPtr reader, author_x *author)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("email")))
+ author->email = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("email")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("href")))
+ author->href = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("href")));
+ if (xmlTextReaderConstXmlLang(reader)) {
+ author->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (author->lang == NULL)
+ author->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ author->lang = strdup(DEFAULT_LOCALE);
+ }
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader)) {
+ const char *text = ASCII(xmlTextReaderValue(reader));
+ if (*text == '\n') {
+ author->text = NULL;
+ free((void *)text);
+ return 0;
+ }
+ author->text = ASCII(xmlTextReaderValue(reader));
+ }
+ return 0;
+}
+
+static int __ps_process_description(xmlTextReaderPtr reader, description_x *description)
+{
+ if (xmlTextReaderConstXmlLang(reader)) {
+ description->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (description->lang == NULL)
+ description->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ description->lang = strdup(DEFAULT_LOCALE);
+ }
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader)) {
+ const char *text = ASCII(xmlTextReaderValue(reader));
+ if (*text == '\n') {
+ description->text = NULL;
+ free((void *)text);
+ return 0;
+ }
+ description->text = ASCII(xmlTextReaderValue(reader));
+ }
+ return 0;
+}
+
+static int __ps_process_license(xmlTextReaderPtr reader, license_x *license)
+{
+ if (xmlTextReaderConstXmlLang(reader)) {
+ license->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (license->lang == NULL)
+ license->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ license->lang = strdup(DEFAULT_LOCALE);
+ }
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ license->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int __ps_process_capability(xmlTextReaderPtr reader, capability_x *capability)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ resolution_x *tmp1 = NULL;
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("operation-id")))
+ capability->operationid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("operation-id")));
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "resolution")) {
+ resolution_x *resolution = malloc(sizeof(resolution_x));
+ if (resolution == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(resolution, '\0', sizeof(resolution_x));
+ LISTADD(capability->resolution, resolution);
+ ret = __ps_process_resolution(reader, resolution);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing capability failed\n");
+ return ret;
+ }
+ }
+
+ if (capability->resolution) {
+ LISTHEAD(capability->resolution, tmp1);
+ capability->resolution = tmp1;
+ }
+
+ return ret;
+}
+
+static int __ps_process_datacontrol(xmlTextReaderPtr reader, datacontrol_x *datacontrol)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ capability_x *tmp1 = NULL;
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("provider-id")))
+ datacontrol->providerid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("provider-id")));
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "capability")) {
+ capability_x *capability = malloc(sizeof(capability_x));
+ if (capability == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(capability, '\0', sizeof(capability_x));
+ LISTADD(datacontrol->capability, capability);
+ ret = __ps_process_capability(reader, capability);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing datacontrol failed\n");
+ return ret;
+ }
+ }
+
+ if (datacontrol->capability) {
+ LISTHEAD(datacontrol->capability, tmp1);
+ datacontrol->capability = tmp1;
+ }
+
+ return ret;
+}
+
+static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *uiapplication)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ char *newappid = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ appsvc_x *tmp3 = NULL;
+ appcontrol_x *tmp4 = NULL;
+ launchconditions_x *tmp5 = NULL;
+ notification_x *tmp6 = NULL;
+ datashare_x *tmp7 = NULL;
+ category_x *tmp8 = NULL;
+ metadata_x *tmp9 = NULL;
+ image_x *tmp10 = NULL;
+ permission_x *tmp11 = NULL;
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("appid"))) {
+ uiapplication->appid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appid")));
+ if (uiapplication->appid == NULL) {
+ _LOGD("appid cant be NULL\n");
+ return -1;
+ }
+ } else {
+ _LOGD("appid is mandatory\n");
+ return -1;
+ }
+ /*check appid*/
+ ret = __validate_appid(package, uiapplication->appid, &newappid);
+ if (ret == -1) {
+ _LOGD("appid is not proper\n");
+ return -1;
+ } else {
+ if (newappid) {
+ if (uiapplication->appid)
+ free((void *)uiapplication->appid);
+ uiapplication->appid = newappid;
+ }
+ uiapplication->package= strdup(package);
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("exec")))
+ uiapplication->exec = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("exec")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("nodisplay"))) {
+ uiapplication->nodisplay = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("nodisplay")));
+ if (uiapplication->nodisplay == NULL)
+ uiapplication->nodisplay = strdup("false");
+ } else {
+ uiapplication->nodisplay = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("multiple"))) {
+ uiapplication->multiple = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("multiple")));
+ if (uiapplication->multiple == NULL)
+ uiapplication->multiple = strdup("false");
+ } else {
+ uiapplication->multiple = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("type")))
+ uiapplication->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("categories")))
+ uiapplication->categories = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("categories")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("extraid")))
+ uiapplication->extraid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("extraid")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("taskmanage"))) {
+ uiapplication->taskmanage = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("taskmanage")));
+ if (uiapplication->taskmanage == NULL)
+ uiapplication->taskmanage = strdup("true");
+ } else {
+ uiapplication->taskmanage = strdup("true");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("enabled"))) {
+ uiapplication->enabled = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("enabled")));
+ if (uiapplication->enabled == NULL)
+ uiapplication->enabled = strdup("true");
+ } else {
+ uiapplication->enabled = strdup("true");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("hw-acceleration"))) {
+ uiapplication->hwacceleration = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("hw-acceleration")));
+ if (uiapplication->hwacceleration == NULL)
+ uiapplication->hwacceleration = strdup("use-system-setting");
+ } else {
+ uiapplication->hwacceleration = strdup("use-system-setting");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("screen-reader"))) {
+ uiapplication->screenreader = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("screen-reader")));
+ if (uiapplication->screenreader == NULL)
+ uiapplication->screenreader = strdup("use-system-setting");
+ } else {
+ uiapplication->screenreader = strdup("use-system-setting");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("recentimage")))
+ uiapplication->recentimage = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("recentimage")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("mainapp"))) {
+ uiapplication->mainapp = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("mainapp")));
+ if (uiapplication->mainapp == NULL)
+ uiapplication->mainapp = strdup("false");
+ } else {
+ uiapplication->mainapp = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("launchcondition"))) {
+ uiapplication->launchcondition = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("launchcondition")));
+ if (uiapplication->launchcondition == NULL)
+ uiapplication->launchcondition = strdup("false");
+ } else {
+ uiapplication->launchcondition = strdup("false");
+ }
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("indicatordisplay"))) {
+ uiapplication->indicatordisplay = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("indicatordisplay")));
+ if (uiapplication->indicatordisplay == NULL)
+ uiapplication->indicatordisplay = strdup("true");
+ } else {
+ uiapplication->indicatordisplay = strdup("true");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("portrait-effectimage")))
+ uiapplication->portraitimg = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("portrait-effectimage")));
+ else
+ uiapplication->portraitimg = NULL;
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("landscape-effectimage")))
+ uiapplication->landscapeimg = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("landscape-effectimage")));
+ else
+ uiapplication->landscapeimg = NULL;
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("guestmode-visibility"))) {
+ uiapplication->guestmode_visibility = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("guestmode-visibility")));
+ if (uiapplication->guestmode_visibility == NULL)
+ uiapplication->guestmode_visibility = strdup("true");
+ } else {
+ uiapplication->guestmode_visibility = strdup("true");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type"))) {
+ uiapplication->permission_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type")));
+ if (uiapplication->permission_type == NULL)
+ uiapplication->permission_type = strdup("normal");
+ } else {
+ uiapplication->permission_type = strdup("normal");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("component-type"))) {
+ uiapplication->component_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("component-type")));
+ if (uiapplication->component_type == NULL) {
+ uiapplication->component_type = strdup("uiapp");
+ } else {
+ /*component_type has "svcapp" or "uiapp", if it is not, parsing manifest is fail*/
+ if (strcmp(uiapplication->component_type, "svcapp") != 0) {
+ if (strcmp(uiapplication->component_type, "uiapp") != 0) {
+ _LOGD("invalid component_type[%s]\n", uiapplication->component_type);
+ return -1;
+ }
+ }
+ }
+ } else {
+ uiapplication->component_type = strdup("uiapp");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("submode"))) {
+ uiapplication->submode = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("submode")));
+ if (uiapplication->submode == NULL)
+ uiapplication->submode = strdup("false");
+ } else {
+ uiapplication->submode = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("submode-mainid")))
+ uiapplication->submode_mainid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("submode-mainid")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("process-pool"))) {
+ uiapplication->process_pool= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("process-pool")));
+ if (uiapplication->process_pool == NULL)
+ uiapplication->process_pool = strdup("false");
+ } else {
+ uiapplication->process_pool = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("auto-restart"))) {
+ uiapplication->autorestart= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("auto-restart")));
+ if (uiapplication->autorestart == NULL)
+ uiapplication->autorestart = strdup("false");
+ } else {
+ uiapplication->autorestart = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("on-boot"))) {
+ uiapplication->onboot= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("on-boot")));
+ if (uiapplication->onboot == NULL)
+ uiapplication->onboot = strdup("false");
+ } else {
+ uiapplication->onboot = strdup("false");
+ }
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+ if (!strcmp(ASCII(node), "label")) {
+ label_x *label = malloc(sizeof(label_x));
+ if (label == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(label, '\0', sizeof(label_x));
+ LISTADD(uiapplication->label, label);
+ ret = __ps_process_label(reader, label);
+ } else if (!strcmp(ASCII(node), "icon")) {
+ icon_x *icon = malloc(sizeof(icon_x));
+ if (icon == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(icon, '\0', sizeof(icon_x));
+ LISTADD(uiapplication->icon, icon);
+ ret = __ps_process_icon(reader, icon);
+ } else if (!strcmp(ASCII(node), "image")) {
+ image_x *image = malloc(sizeof(image_x));
+ if (image == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(image, '\0', sizeof(image_x));
+ LISTADD(uiapplication->image, image);
+ ret = __ps_process_image(reader, image);
+ } else if (!strcmp(ASCII(node), "category")) {
+ category_x *category = malloc(sizeof(category_x));
+ if (category == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(category, '\0', sizeof(category_x));
+ LISTADD(uiapplication->category, category);
+ ret = __ps_process_category(reader, category);
+ } else if (!strcmp(ASCII(node), "metadata")) {
+ metadata_x *metadata = malloc(sizeof(metadata_x));
+ if (metadata == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(metadata, '\0', sizeof(metadata_x));
+ LISTADD(uiapplication->metadata, metadata);
+ ret = __ps_process_metadata(reader, metadata);
+ } else if (!strcmp(ASCII(node), "permission")) {
+ permission_x *permission = malloc(sizeof(permission_x));
+ if (permission == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(permission, '\0', sizeof(permission_x));
+ LISTADD(uiapplication->permission, permission);
+ ret = __ps_process_permission(reader, permission);
+ } else if (!strcmp(ASCII(node), "app-control")) {
+ appcontrol_x *appcontrol = malloc(sizeof(appcontrol_x));
+ if (appcontrol == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(appcontrol, '\0', sizeof(appcontrol_x));
+ LISTADD(uiapplication->appcontrol, appcontrol);
+ ret = __ps_process_appcontrol(reader, appcontrol);
+ } else if (!strcmp(ASCII(node), "application-service")) {
+ appsvc_x *appsvc = malloc(sizeof(appsvc_x));
+ if (appsvc == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(appsvc, '\0', sizeof(appsvc_x));
+ LISTADD(uiapplication->appsvc, appsvc);
+ ret = __ps_process_appsvc(reader, appsvc);
+ } else if (!strcmp(ASCII(node), "data-share")) {
+ datashare_x *datashare = malloc(sizeof(datashare_x));
+ if (datashare == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(datashare, '\0', sizeof(datashare_x));
+ LISTADD(uiapplication->datashare, datashare);
+ ret = __ps_process_datashare(reader, datashare);
+ } else if (!strcmp(ASCII(node), "launch-conditions")) {
+ launchconditions_x *launchconditions = malloc(sizeof(launchconditions_x));
+ if (launchconditions == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(launchconditions, '\0', sizeof(launchconditions_x));
+ LISTADD(uiapplication->launchconditions, launchconditions);
+ ret = __ps_process_launchconditions(reader, launchconditions);
+ } else if (!strcmp(ASCII(node), "notification")) {
+ notification_x *notification = malloc(sizeof(notification_x));
+ if (notification == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(notification, '\0', sizeof(notification_x));
+ LISTADD(uiapplication->notification, notification);
+ ret = __ps_process_notification(reader, notification);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing uiapplication failed\n");
+ return ret;
+ }
+ }
+
+ if (uiapplication->label) {
+ LISTHEAD(uiapplication->label, tmp1);
+ uiapplication->label = tmp1;
+ }
+ if (uiapplication->icon) {
+ LISTHEAD(uiapplication->icon, tmp2);
+ uiapplication->icon = tmp2;
+ }
+ if (uiapplication->appsvc) {
+ LISTHEAD(uiapplication->appsvc, tmp3);
+ uiapplication->appsvc = tmp3;
+ }
+ if (uiapplication->appcontrol) {
+ LISTHEAD(uiapplication->appcontrol, tmp4);
+ uiapplication->appcontrol = tmp4;
+ }
+ if (uiapplication->launchconditions) {
+ LISTHEAD(uiapplication->launchconditions, tmp5);
+ uiapplication->launchconditions = tmp5;
+ }
+ if (uiapplication->notification) {
+ LISTHEAD(uiapplication->notification, tmp6);
+ uiapplication->notification = tmp6;
+ }
+ if (uiapplication->datashare) {
+ LISTHEAD(uiapplication->datashare, tmp7);
+ uiapplication->datashare = tmp7;
+ }
+ if (uiapplication->category) {
+ LISTHEAD(uiapplication->category, tmp8);
+ uiapplication->category = tmp8;
+ }
+ if (uiapplication->metadata) {
+ LISTHEAD(uiapplication->metadata, tmp9);
+ uiapplication->metadata = tmp9;
+ }
+ if (uiapplication->image) {
+ LISTHEAD(uiapplication->image, tmp10);
+ uiapplication->image = tmp10;
+ }
+ if (uiapplication->permission) {
+ LISTHEAD(uiapplication->permission, tmp11);
+ uiapplication->permission = tmp11;
+ }
+
+ return ret;
+}
+
+static int __ps_process_serviceapplication(xmlTextReaderPtr reader, serviceapplication_x *serviceapplication)
+{
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ char *newappid = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ appsvc_x *tmp3 = NULL;
+ appcontrol_x *tmp4 = NULL;
+ datacontrol_x *tmp5 = NULL;
+ launchconditions_x *tmp6 = NULL;
+ notification_x *tmp7 = NULL;
+ datashare_x *tmp8 = NULL;
+ category_x *tmp9 = NULL;
+ metadata_x *tmp10 = NULL;
+ permission_x *tmp11 = NULL;
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("appid"))) {
+ serviceapplication->appid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appid")));
+ if (serviceapplication->appid == NULL) {
+ _LOGD("appid cant be NULL\n");
+ return -1;
+ }
+ } else {
+ _LOGD("appid is mandatory\n");
+ return -1;
+ }
+ /*check appid*/
+ ret = __validate_appid(package, serviceapplication->appid, &newappid);
+ if (ret == -1) {
+ _LOGD("appid is not proper\n");
+ return -1;
+ } else {
+ if (newappid) {
+ if (serviceapplication->appid)
+ free((void *)serviceapplication->appid);
+ serviceapplication->appid = newappid;
+ }
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("exec")))
+ serviceapplication->exec = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("exec")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("type")))
+ serviceapplication->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("on-boot"))) {
+ serviceapplication->onboot = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("on-boot")));
+ if (serviceapplication->onboot == NULL)
+ serviceapplication->onboot = strdup("false");
+ } else {
+ serviceapplication->onboot = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("auto-restart"))) {
+ serviceapplication->autorestart = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("auto-restart")));
+ if (serviceapplication->autorestart == NULL)
+ serviceapplication->autorestart = strdup("false");
+ } else {
+ serviceapplication->autorestart = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type"))) {
+ serviceapplication->permission_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type")));
+ if (serviceapplication->permission_type == NULL)
+ serviceapplication->permission_type = strdup("normal");
+ } else {
+ serviceapplication->permission_type = strdup("normal");
+ }
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "label")) {
+ label_x *label = malloc(sizeof(label_x));
+ if (label == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(label, '\0', sizeof(label_x));
+ LISTADD(serviceapplication->label, label);
+ ret = __ps_process_label(reader, label);
+ } else if (!strcmp(ASCII(node), "icon")) {
+ icon_x *icon = malloc(sizeof(icon_x));
+ if (icon == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(icon, '\0', sizeof(icon_x));
+ LISTADD(serviceapplication->icon, icon);
+ ret = __ps_process_icon(reader, icon);
+ } else if (!strcmp(ASCII(node), "category")) {
+ category_x *category = malloc(sizeof(category_x));
+ if (category == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(category, '\0', sizeof(category_x));
+ LISTADD(serviceapplication->category, category);
+ ret = __ps_process_category(reader, category);
+ } else if (!strcmp(ASCII(node), "metadata")) {
+ metadata_x *metadata = malloc(sizeof(metadata_x));
+ if (metadata == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(metadata, '\0', sizeof(metadata_x));
+ LISTADD(serviceapplication->metadata, metadata);
+ ret = __ps_process_metadata(reader, metadata);
+ } else if (!strcmp(ASCII(node), "permission")) {
+ permission_x *permission = malloc(sizeof(permission_x));
+ if (permission == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(permission, '\0', sizeof(permission_x));
+ LISTADD(serviceapplication->permission, permission);
+ ret = __ps_process_permission(reader, permission);
+ } else if (!strcmp(ASCII(node), "app-control")) {
+ appcontrol_x *appcontrol = malloc(sizeof(appcontrol_x));
+ if (appcontrol == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(appcontrol, '\0', sizeof(appcontrol_x));
+ LISTADD(serviceapplication->appcontrol, appcontrol);
+ ret = __ps_process_appcontrol(reader, appcontrol);
+ } else if (!strcmp(ASCII(node), "application-service")) {
+ appsvc_x *appsvc = malloc(sizeof(appsvc_x));
+ if (appsvc == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(appsvc, '\0', sizeof(appsvc_x));
+ LISTADD(serviceapplication->appsvc, appsvc);
+ ret = __ps_process_appsvc(reader, appsvc);
+ } else if (!strcmp(ASCII(node), "data-share")) {
+ datashare_x *datashare = malloc(sizeof(datashare_x));
+ if (datashare == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(datashare, '\0', sizeof(datashare_x));
+ LISTADD(serviceapplication->datashare, datashare);
+ ret = __ps_process_datashare(reader, datashare);
+ } else if (!strcmp(ASCII(node), "launch-conditions")) {
+ launchconditions_x *launchconditions = malloc(sizeof(launchconditions_x));
+ if (launchconditions == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(launchconditions, '\0', sizeof(launchconditions_x));
+ LISTADD(serviceapplication->launchconditions, launchconditions);
+ ret = __ps_process_launchconditions(reader, launchconditions);
+ } else if (!strcmp(ASCII(node), "notification")) {
+ notification_x *notification = malloc(sizeof(notification_x));
+ if (notification == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(notification, '\0', sizeof(notification_x));
+ LISTADD(serviceapplication->notification, notification);
+ ret = __ps_process_notification(reader, notification);
+ } else if (!strcmp(ASCII(node), "data-control")) {
+ datacontrol_x *datacontrol = malloc(sizeof(datacontrol_x));
+ if (datacontrol == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(datacontrol, '\0', sizeof(datacontrol_x));
+ LISTADD(serviceapplication->datacontrol, datacontrol);
+ ret = __ps_process_datacontrol(reader, datacontrol);
+ } else
+ return -1;
+ if (ret < 0) {
+ _LOGD("Processing serviceapplication failed\n");
+ return ret;
+ }
+ }
+
+ if (serviceapplication->label) {
+ LISTHEAD(serviceapplication->label, tmp1);
+ serviceapplication->label = tmp1;
+ }
+ if (serviceapplication->icon) {
+ LISTHEAD(serviceapplication->icon, tmp2);
+ serviceapplication->icon = tmp2;
+ }
+ if (serviceapplication->appsvc) {
+ LISTHEAD(serviceapplication->appsvc, tmp3);
+ serviceapplication->appsvc = tmp3;
+ }
+ if (serviceapplication->appcontrol) {
+ LISTHEAD(serviceapplication->appcontrol, tmp4);
+ serviceapplication->appcontrol = tmp4;
+ }
+ if (serviceapplication->datacontrol) {
+ LISTHEAD(serviceapplication->datacontrol, tmp5);
+ serviceapplication->datacontrol = tmp5;
+ }
+ if (serviceapplication->launchconditions) {
+ LISTHEAD(serviceapplication->launchconditions, tmp6);
+ serviceapplication->launchconditions = tmp6;
+ }
+ if (serviceapplication->notification) {
+ LISTHEAD(serviceapplication->notification, tmp7);
+ serviceapplication->notification = tmp7;
+ }
+ if (serviceapplication->datashare) {
+ LISTHEAD(serviceapplication->datashare, tmp8);
+ serviceapplication->datashare = tmp8;
+ }
+ if (serviceapplication->category) {
+ LISTHEAD(serviceapplication->category, tmp9);
+ serviceapplication->category = tmp9;
+ }
+ if (serviceapplication->metadata) {
+ LISTHEAD(serviceapplication->metadata, tmp10);
+ serviceapplication->metadata = tmp10;
+ }
+ if (serviceapplication->permission) {
+ LISTHEAD(serviceapplication->permission, tmp11);
+ serviceapplication->permission = tmp11;
+ }
+
+ return ret;
+}
+
+static int __ps_process_deviceprofile(xmlTextReaderPtr reader, deviceprofile_x *deviceprofile)
+{
+ /*TODO: once policy is set*/
+ return 0;
+}
+
+static int __ps_process_font(xmlTextReaderPtr reader, font_x *font)
+{
+ /*TODO: once policy is set*/
+ return 0;
+}
+
+static int __ps_process_theme(xmlTextReaderPtr reader, theme_x *theme)
+{
+ /*TODO: once policy is set*/
+ return 0;
+}
+
+static int __ps_process_daemon(xmlTextReaderPtr reader, daemon_x *daemon)
+{
+ /*TODO: once policy is set*/
+ return 0;
+}
+
+static int __ps_process_ime(xmlTextReaderPtr reader, ime_x *ime)
+{
+ /*TODO: once policy is set*/
+ return 0;
+}
+
+static int __start_process(xmlTextReaderPtr reader, manifest_x * mfx)
+{
+ _LOGD("__start_process\n");
+ const xmlChar *node;
+ int ret = -1;
+ int depth = -1;
+ label_x *tmp1 = NULL;
+ author_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ license_x *tmp4 = NULL;
+ uiapplication_x *tmp5 = NULL;
+ serviceapplication_x *tmp6 = NULL;
+ daemon_x *tmp7 = NULL;
+ theme_x *tmp8 = NULL;
+ font_x *tmp9 = NULL;
+ ime_x *tmp10 = NULL;
+ icon_x *tmp11 = NULL;
+ compatibility_x *tmp12 = NULL;
+ deviceprofile_x *tmp13 = NULL;
+ privileges_x *tmp14 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "label")) {
+ label_x *label = malloc(sizeof(label_x));
+ if (label == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(label, '\0', sizeof(label_x));
+ LISTADD(mfx->label, label);
+ ret = __ps_process_label(reader, label);
+ } else if (!strcmp(ASCII(node), "author")) {
+ author_x *author = malloc(sizeof(author_x));
+ if (author == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(author, '\0', sizeof(author_x));
+ LISTADD(mfx->author, author);
+ ret = __ps_process_author(reader, author);
+ } else if (!strcmp(ASCII(node), "description")) {
+ description_x *description = malloc(sizeof(description_x));
+ if (description == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(description, '\0', sizeof(description_x));
+ LISTADD(mfx->description, description);
+ ret = __ps_process_description(reader, description);
+ } else if (!strcmp(ASCII(node), "license")) {
+ license_x *license = malloc(sizeof(license_x));
+ if (license == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(license, '\0', sizeof(license_x));
+ LISTADD(mfx->license, license);
+ ret = __ps_process_license(reader, license);
+ } else if (!strcmp(ASCII(node), "privileges")) {
+ privileges_x *privileges = malloc(sizeof(privileges_x));
+ if (privileges == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(privileges, '\0', sizeof(privileges_x));
+ LISTADD(mfx->privileges, privileges);
+ ret = __ps_process_privileges(reader, privileges);
+ } else if (!strcmp(ASCII(node), "ui-application")) {
+ uiapplication_x *uiapplication = malloc(sizeof(uiapplication_x));
+ if (uiapplication == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(uiapplication, '\0', sizeof(uiapplication_x));
+ LISTADD(mfx->uiapplication, uiapplication);
+ ret = __ps_process_uiapplication(reader, uiapplication);
+ } else if (!strcmp(ASCII(node), "service-application")) {
+ serviceapplication_x *serviceapplication = malloc(sizeof(serviceapplication_x));
+ if (serviceapplication == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(serviceapplication, '\0', sizeof(serviceapplication_x));
+ LISTADD(mfx->serviceapplication, serviceapplication);
+ ret = __ps_process_serviceapplication(reader, serviceapplication);
+ } else if (!strcmp(ASCII(node), "daemon")) {
+ daemon_x *daemon = malloc(sizeof(daemon_x));
+ if (daemon == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(daemon, '\0', sizeof(daemon_x));
+ LISTADD(mfx->daemon, daemon);
+ ret = __ps_process_daemon(reader, daemon);
+ } else if (!strcmp(ASCII(node), "theme")) {
+ theme_x *theme = malloc(sizeof(theme_x));
+ if (theme == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(theme, '\0', sizeof(theme_x));
+ LISTADD(mfx->theme, theme);
+ ret = __ps_process_theme(reader, theme);
+ } else if (!strcmp(ASCII(node), "font")) {
+ font_x *font = malloc(sizeof(font_x));
+ if (font == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(font, '\0', sizeof(font_x));
+ LISTADD(mfx->font, font);
+ ret = __ps_process_font(reader, font);
+ } else if (!strcmp(ASCII(node), "ime")) {
+ ime_x *ime = malloc(sizeof(ime_x));
+ if (ime == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(ime, '\0', sizeof(ime_x));
+ LISTADD(mfx->ime, ime);
+ ret = __ps_process_ime(reader, ime);
+ } else if (!strcmp(ASCII(node), "icon")) {
+ icon_x *icon = malloc(sizeof(icon_x));
+ if (icon == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(icon, '\0', sizeof(icon_x));
+ LISTADD(mfx->icon, icon);
+ ret = __ps_process_icon(reader, icon);
+ } else if (!strcmp(ASCII(node), "device-profile")) {
+ deviceprofile_x *deviceprofile = malloc(sizeof(deviceprofile_x));
+ if (deviceprofile == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(deviceprofile, '\0', sizeof(deviceprofile_x));
+ LISTADD(mfx->deviceprofile, deviceprofile);
+ ret = __ps_process_deviceprofile(reader, deviceprofile);
+ } else if (!strcmp(ASCII(node), "compatibility")) {
+ compatibility_x *compatibility = malloc(sizeof(compatibility_x));
+ if (compatibility == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
+ }
+ memset(compatibility, '\0', sizeof(compatibility_x));
+ LISTADD(mfx->compatibility, compatibility);
+ ret = __ps_process_compatibility(reader, compatibility);
+ } else if (!strcmp(ASCII(node), "shortcut-list")) {
+ continue;
+ } else if (!strcmp(ASCII(node), "livebox")) {
+ continue;
+ } else if (!strcmp(ASCII(node), "account")) {
+ continue;
+ } else if (!strcmp(ASCII(node), "notifications")) {
+ continue;
+ } else if (!strcmp(ASCII(node), "ime")) {
+ continue;
+ } else
+ return -1;
+
+ if (ret < 0) {
+ _LOGD("Processing manifest failed\n");
+ return ret;
+ }
+ }
+ if (mfx->label) {
+ LISTHEAD(mfx->label, tmp1);
+ mfx->label = tmp1;
+ }
+ if (mfx->author) {
+ LISTHEAD(mfx->author, tmp2);
+ mfx->author = tmp2;
+ }
+ if (mfx->description) {
+ LISTHEAD(mfx->description, tmp3);
+ mfx->description= tmp3;
+ }
+ if (mfx->license) {
+ LISTHEAD(mfx->license, tmp4);
+ mfx->license= tmp4;
+ }
+ if (mfx->uiapplication) {
+ LISTHEAD(mfx->uiapplication, tmp5);
+ mfx->uiapplication = tmp5;
+ }
+ if (mfx->serviceapplication) {
+ LISTHEAD(mfx->serviceapplication, tmp6);
+ mfx->serviceapplication = tmp6;
+ }
+ if (mfx->daemon) {
+ LISTHEAD(mfx->daemon, tmp7);
+ mfx->daemon= tmp7;
+ }
+ if (mfx->theme) {
+ LISTHEAD(mfx->theme, tmp8);
+ mfx->theme= tmp8;
+ }
+ if (mfx->font) {
+ LISTHEAD(mfx->font, tmp9);
+ mfx->font= tmp9;
+ }
+ if (mfx->ime) {
+ LISTHEAD(mfx->ime, tmp10);
+ mfx->ime= tmp10;
+ }
+ if (mfx->icon) {
+ LISTHEAD(mfx->icon, tmp11);
+ mfx->icon= tmp11;
+ }
+ if (mfx->compatibility) {
+ LISTHEAD(mfx->compatibility, tmp12);
+ mfx->compatibility= tmp12;
+ }
+ if (mfx->deviceprofile) {
+ LISTHEAD(mfx->deviceprofile, tmp13);
+ mfx->deviceprofile= tmp13;
+ }
+ if (mfx->privileges) {
+ LISTHEAD(mfx->privileges, tmp14);
+ mfx->privileges = tmp14;
+ }
+ return ret;
+}
+
+static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx)
+{
+ const xmlChar *node;
+ int ret = -1;
+
+ if ((ret = __next_child_element(reader, -1))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGD("xmlTextReaderConstName value is NULL\n");
+ return -1;
+ }
+
+ if (!strcmp(ASCII(node), "manifest")) {
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("xmlns")))
+ mfx->ns = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("xmlns")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("package"))) {
+ mfx->package= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("package")));
+ if (mfx->package == NULL) {
+ _LOGD("package cant be NULL\n");
+ return -1;
+ }
+ } else {
+ _LOGD("package field is mandatory\n");
+ return -1;
+ }
+ package = mfx->package;
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("version")))
+ mfx->version= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("version")));
+ /*app2ext needs package size for external installation*/
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("size")))
+ mfx->package_size = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("size")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("install-location"))) {
+ mfx->installlocation = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("install-location")));
+ if (mfx->installlocation == NULL)
+ mfx->installlocation = strdup("internal-only");
+ } else {
+ mfx->installlocation = strdup("internal-only");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("type")))
+ mfx->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("root_path")))
+ mfx->root_path = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("root_path")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("csc_path")))
+ mfx->csc_path = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("csc_path")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("appsetting"))) {
+ mfx->appsetting = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appsetting")));
+ if (mfx->appsetting == NULL)
+ mfx->appsetting = strdup("false");
+ } else {
+ mfx->appsetting = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("storeclient-id")))
+ mfx->storeclient_id= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("storeclient-id")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("nodisplay-setting"))) {
+ mfx->nodisplay_setting = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("nodisplay-setting")));
+ if (mfx->nodisplay_setting == NULL)
+ mfx->nodisplay_setting = strdup("false");
+ } else {
+ mfx->nodisplay_setting = strdup("false");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("url")))
+ mfx->package_url= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("url")));
+
+ /*Assign default values. If required it will be overwritten in __add_preload_info()*/
+ mfx->preload = strdup("False");
+ mfx->removable = strdup("True");
+ mfx->readonly = strdup("False");
+ mfx->update = strdup("False");
+ mfx->system = strdup("False");
+ char buf[PKG_STRING_LEN_MAX] = {'\0'};
+ char *val = NULL;
+ time_t current_time;
+ time(¤t_time);
+ snprintf(buf, PKG_STRING_LEN_MAX - 1, "%d", (int)current_time);
+ val = strndup(buf, PKG_STRING_LEN_MAX - 1);
+ mfx->installed_time = val;
+
+ mfx->installed_storage= strdup("installed_internal");
+
+ ret = __start_process(reader, mfx);
+ } else {
+ _LOGD("No Manifest element found\n");
+ return -1;
+ }
+ }
+ return ret;
+}
+
+
+static char* __convert_to_system_locale(const char *mlocale)
+{
+ if (mlocale == NULL)
+ return NULL;
+ char *locale = NULL;
+ locale = (char *)calloc(1, 6);
+ if (!locale) {
+ _LOGE("Malloc Failed\n");
+ return NULL;
+ }
+
+ strncpy(locale, mlocale, 2);
+ strncat(locale, "_", 1);
+ locale[3] = toupper(mlocale[3]);
+ locale[4] = toupper(mlocale[4]);
+ return locale;
+}
+
+static int __ail_change_info(int op, const char *appid)
+{
+ void *lib_handle = NULL;
+ int (*ail_desktop_operation) (const char *);
+ char *aop = NULL;
+ int ret = 0;
+
+ if ((lib_handle = dlopen(LIBAIL_PATH, RTLD_LAZY)) == NULL) {
+ _LOGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAIL_PATH);
+ goto END;
+ }
+
+
+ switch (op) {
+ case 0:
+ aop = "ail_desktop_add";
+ break;
+ case 1:
+ aop = "ail_desktop_update";
+ break;
+ case 2:
+ aop = "ail_desktop_remove";
+ break;
+ case 3:
+ aop = "ail_desktop_clean";
+ break;
+ case 4:
+ aop = "ail_desktop_fota";
+ break;
+ default:
+ goto END;
+ break;
+ }
+
+ if ((ail_desktop_operation =
+ dlsym(lib_handle, aop)) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol \n");
+ goto END;
+ }
+
+ ret = ail_desktop_operation(appid);
+
+END:
+ if (lib_handle)
+ dlclose(lib_handle);
+
+ return ret;
+}
+
+
+/* desktop shoud be generated automatically based on manifest */
+/* Currently removable, taskmanage, etc fields are not considerd. it will be decided soon.*/
+static int __ps_make_nativeapp_desktop(manifest_x * mfx, const char *manifest, ACTION_TYPE action)
+{
+ FILE* file = NULL;
+ int fd = 0;
+ char filepath[PKG_STRING_LEN_MAX] = "";
+ char *buf = NULL;
+ char *buftemp = NULL;
+ char *locale = NULL;
+
+ buf = (char *)calloc(1, BUFMAX);
+ if (!buf) {
+ _LOGE("Malloc Failed\n");
+ return -1;
+ }
+
+ buftemp = (char *)calloc(1, BUFMAX);
+ if (!buftemp) {
+ _LOGE("Malloc Failed\n");
+ free(buf);
+ return -1;
+ }
+
+ if (action == ACTION_UPGRADE)
+ __ail_change_info(AIL_CLEAN, mfx->package);
+
+ for(; mfx->uiapplication; mfx->uiapplication=mfx->uiapplication->next) {
+
+ if (manifest != NULL) {
+ /* skip making a deskfile and update ail, if preload app is updated */
+ if(strstr(manifest, MANIFEST_RO_PREFIX)) {
+ __ail_change_info(AIL_INSTALL, mfx->uiapplication->appid);
+ _LOGE("preload app is update : skip and update ail : %s", manifest);
+ continue;
+ }
+ }
+
+ if(mfx->readonly && !strcasecmp(mfx->readonly, "True"))
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RO_PATH, mfx->uiapplication->appid);
+ else
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, mfx->uiapplication->appid);
+
+ /* skip if desktop exists
+ if (access(filepath, R_OK) == 0)
+ continue;
+ */
+
+ file = fopen(filepath, "w");
+ if(file == NULL)
+ {
+ _LOGS("Can't open %s", filepath);
+ free(buf);
+ free(buftemp);
+ return -1;
+ }
+
+ snprintf(buf, BUFMAX, "[Desktop Entry]\n");
+ fwrite(buf, 1, strlen(buf), file);
+
+ for( ; mfx->uiapplication->label ; mfx->uiapplication->label = mfx->uiapplication->label->next) {
+ if(!strcmp(mfx->uiapplication->label->lang, DEFAULT_LOCALE)) {
+ snprintf(buf, BUFMAX, "Name=%s\n", mfx->uiapplication->label->text);
+ } else {
+ locale = __convert_to_system_locale(mfx->uiapplication->label->lang);
+ snprintf(buf, BUFMAX, "Name[%s]=%s\n", locale,
+ mfx->uiapplication->label->text);
+ free(locale);
+ }
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->label && mfx->uiapplication->label->text) {
+ snprintf(buf, BUFMAX, "Name=%s\n", mfx->uiapplication->label->text);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+/*
+ else if(mfx->label && mfx->label->text) {
+ snprintf(buf, BUFMAX, "Name=%s\n", mfx->label->text);
+ fwrite(buf, 1, strlen(buf), file);
+ } else {
+ snprintf(buf, BUFMAX, "Name=%s\n", mfx->package);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+*/
+
+
+ snprintf(buf, BUFMAX, "Type=Application\n");
+ fwrite(buf, 1, strlen(buf), file);
+
+ if(mfx->uiapplication->exec) {
+ snprintf(buf, BUFMAX, "Exec=%s\n", mfx->uiapplication->exec);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->icon && mfx->uiapplication->icon->text) {
+ snprintf(buf, BUFMAX, "Icon=%s\n", mfx->uiapplication->icon->text);
+ fwrite(buf, 1, strlen(buf), file);
+ } else if(mfx->icon && mfx->icon->text) {
+ snprintf(buf, BUFMAX, "Icon=%s\n", mfx->icon->text);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ // MIME types
+ if(mfx->uiapplication && mfx->uiapplication->appsvc) {
+ appsvc_x *asvc = mfx->uiapplication->appsvc;
+ mime_x *mi = NULL;
+ const char *mime = NULL;
+ const char *mime_delim = "; ";
+ int mime_count = 0;
+
+ strncpy(buf, "MimeType=", BUFMAX-1);
+ while (asvc) {
+ mi = asvc->mime;
+ while (mi) {
+ mime_count++;
+ mime = mi->name;
+ _LOGD("MIME type: %s\n", mime);
+ strncat(buf, mime, BUFMAX-strlen(buf)-1);
+ if(mi->next) {
+ strncat(buf, mime_delim, BUFMAX-strlen(buf)-1);
+ }
+
+ mi = mi->next;
+ mime = NULL;
+ }
+ asvc = asvc->next;
+ }
+ _LOGD("MIME types: buf[%s]\n", buf);
+ _LOGD("MIME count: %d\n", mime_count);
+ if(mime_count)
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->version) {
+ snprintf(buf, BUFMAX, "Version=%s\n", mfx->version);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->nodisplay) {
+ snprintf(buf, BUFMAX, "NoDisplay=%s\n", mfx->uiapplication->nodisplay);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->categories) {
+ snprintf(buf, BUFMAX, "Categories=%s\n", mfx->uiapplication->categories);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->taskmanage && !strcasecmp(mfx->uiapplication->taskmanage, "False")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-TaskManage=False\n");
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->enabled && !strcasecmp(mfx->uiapplication->enabled, "False")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Enabled=False\n");
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->hwacceleration) {
+ snprintf(buf, BUFMAX, "Hw-Acceleration=%s\n", mfx->uiapplication->hwacceleration);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->multiple && !strcasecmp(mfx->uiapplication->multiple, "True")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Multiple=True\n");
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->extraid) {
+ snprintf(buf, BUFMAX, "X-TIZEN-PackageID=%s\n", mfx->uiapplication->extraid);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->removable && !strcasecmp(mfx->removable, "False")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Removable=False\n");
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->type) {
+ snprintf(buf, BUFMAX, "X-TIZEN-PackageType=%s\n", mfx->type);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->submode && !strcasecmp(mfx->uiapplication->submode, "True")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Submode=%s\n", mfx->uiapplication->submode);
+ fwrite(buf, 1, strlen(buf), file);
+ snprintf(buf, BUFMAX, "X-TIZEN-SubmodeMainid=%s\n", mfx->uiapplication->submode_mainid);
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
+ snprintf(buf, BUFMAX, "X-TIZEN-PkgID=%s\n", mfx->package);
+ fwrite(buf, 1, strlen(buf), file);
+
+
+ snprintf(buf, BUFMAX, "X-TIZEN-InstalledStorage=%s\n", mfx->installed_storage);
+ fwrite(buf, 1, strlen(buf), file);
+
+// snprintf(buf, BUFMAX, "X-TIZEN-PackageType=rpm\n");
+// fwrite(buf, 1, strlen(buf), file);
+
+
+ if(mfx->uiapplication->appsvc) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Svc=");
+ _LOGD("buf[%s]\n", buf);
+
+
+ uiapplication_x *up = mfx->uiapplication;
+ appsvc_x *asvc = NULL;
+ operation_x *op = NULL;
+ mime_x *mi = NULL;
+ uri_x *ui = NULL;
+ subapp_x *sub = NULL;
+ const char *operation = NULL;
+ const char *mime = NULL;
+ const char *uri = NULL;
+ const char *subapp = NULL;
+ int i = 0;
+
+
+ asvc = up->appsvc;
+ while(asvc != NULL) {
+ op = asvc->operation;
+ while(op != NULL) {
+ if (op)
+ operation = op->name;
+ mi = asvc->mime;
+
+ do
+ {
+ if (mi)
+ mime = mi->name;
+ sub = asvc->subapp;
+ do
+ {
+ if (sub)
+ subapp = sub->name;
+ ui = asvc->uri;
+ do
+ {
+ if (ui)
+ uri = ui->name;
+
+ if(i++ > 0) {
+ strncpy(buftemp, buf, BUFMAX);
+ snprintf(buf, BUFMAX, "%s;", buftemp);
+ }
+
+
+ strncpy(buftemp, buf, BUFMAX);
+ snprintf(buf, BUFMAX, "%s%s|%s|%s|%s", buftemp, operation?operation:"NULL", uri?uri:"NULL", mime?mime:"NULL", subapp?subapp:"NULL");
+ _LOGD("buf[%s]\n", buf);
+
+ if (ui)
+ ui = ui->next;
+ uri = NULL;
+ } while(ui != NULL);
+ if (sub)
+ sub = sub->next;
+ subapp = NULL;
+ }while(sub != NULL);
+ if (mi)
+ mi = mi->next;
+ mime = NULL;
+ }while(mi != NULL);
+ if (op)
+ op = op->next;
+ operation = NULL;
+ }
+ asvc = asvc->next;
+ }
+
+
+ fwrite(buf, 1, strlen(buf), file);
+
+// strncpy(buftemp, buf, BUFMAX);
+// snprintf(buf, BUFMAX, "%s\n", buftemp);
+// fwrite(buf, 1, strlen(buf), file);
+ }
+
+ if(mfx->uiapplication->appcontrol) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Svc=");
+ _LOGD("buf[%s]\n", buf);
+
+ uiapplication_x *up = mfx->uiapplication;
+ appcontrol_x *acontrol = NULL;
+ operation_x *op = NULL;
+ mime_x *mi = NULL;
+ uri_x *ui = NULL;
+ subapp_x *sub = NULL;
+ const char *operation = NULL;
+ const char *mime = NULL;
+ const char *uri = NULL;
+ const char *subapp = NULL;
+ int i = 0;
+
+ acontrol = up->appcontrol;
+ while(acontrol != NULL) {
+ op = acontrol->operation;
+ while(op != NULL) {
+ if (op)
+ operation = op->name;
+ mi = acontrol->mime;
+
+ do
+ {
+ if (mi)
+ mime = mi->name;
+ sub = acontrol->subapp;
+ do
+ {
+ if (sub)
+ subapp = sub->name;
+ ui = acontrol->uri;
+ do
+ {
+ if (ui)
+ uri = ui->name;
+
+ if(i++ > 0) {
+ strncpy(buftemp, buf, BUFMAX);
+ snprintf(buf, BUFMAX, "%s;", buftemp);
+ }
+
+ strncpy(buftemp, buf, BUFMAX);
+ snprintf(buf, BUFMAX, "%s%s|%s|%s|%s", buftemp, operation?operation:"NULL", uri?uri:"NULL", mime?mime:"NULL", subapp?subapp:"NULL");
+ _LOGD("buf[%s]\n", buf);
+
+ if (ui)
+ ui = ui->next;
+ uri = NULL;
+ } while(ui != NULL);
+ if (sub)
+ sub = sub->next;
+ subapp = NULL;
+ }while(sub != NULL);
+ if (mi)
+ mi = mi->next;
+ mime = NULL;
+ }while(mi != NULL);
+ if (op)
+ op = op->next;
+ operation = NULL;
+ }
+ acontrol = acontrol->next;
+ }
+
+
+ fwrite(buf, 1, strlen(buf), file);
+
+// strncpy(buftemp, buf, BUFMAX);
+// snprintf(buf, BUFMAX, "%s\n", buftemp);
+// fwrite(buf, 1, strlen(buf), file);
+ }
+
+ fflush(file);
+ fd = fileno(file);
+ fsync(fd);
+ fclose(file);
+ if (action == ACTION_FOTA)
+ __ail_change_info(AIL_FOTA, mfx->uiapplication->appid);
+ else
+ __ail_change_info(AIL_INSTALL, mfx->uiapplication->appid);
+ }
+
+ free(buf);
+ free(buftemp);
+
+ return 0;
+}
+
+static int __ps_remove_nativeapp_desktop(manifest_x *mfx)
+{
+ char filepath[PKG_STRING_LEN_MAX] = "";
+ int ret = 0;
+ uiapplication_x *uiapplication = mfx->uiapplication;
+
+ for(; uiapplication; uiapplication=uiapplication->next) {
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid);
+
+ __ail_change_info(AIL_REMOVE, uiapplication->appid);
+
+ ret = remove(filepath);
+ if (ret <0)
+ return -1;
+ }
+
+ return 0;
+}
+
+static int __add_preload_info(manifest_x * mfx, const char *manifest)
+{
+ FILE *fp = NULL;
+ char buffer[1024] = { 0 };
+ int state = 0;
+
+ if(strstr(manifest, MANIFEST_RO_PREFIX)) {
+ free((void *)mfx->readonly);
+ mfx->readonly = strdup("True");
+
+ free((void *)mfx->preload);
+ mfx->preload = strdup("True");
+
+ free((void *)mfx->removable);
+ mfx->removable = strdup("False");
+
+ free((void *)mfx->system);
+ mfx->system = strdup("True");
+
+ return 0;
+ }
+
+ fp = fopen(PRELOAD_PACKAGE_LIST, "r");
+ if (fp == NULL) {
+ _LOGE("no preload list\n");
+ return -1;
+ }
+
+ while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+ if (buffer[0] == '#') {
+ if(strcasestr(buffer, "RW_NORM"))
+ state = 2;
+ else if(strcasestr(buffer, "RW_RM"))
+ state = 3;
+ else
+ continue;
+ }
+
+ __str_trim(buffer);
+
+ if(!strcmp(mfx->package, buffer)) {
+ free((void *)mfx->preload);
+ mfx->preload = strdup("True");
+ if(state == 2){
+ free((void *)mfx->readonly);
+ mfx->readonly = strdup("False");
+ free((void *)mfx->removable);
+ mfx->removable = strdup("False");
+ } else if(state == 3){
+ free((void *)mfx->readonly);
+ mfx->readonly = strdup("False");
+ free((void *)mfx->removable);
+ mfx->removable = strdup("True");
+ }
+ }
+
+ memset(buffer, 0x00, sizeof(buffer));
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ return 0;
+}
+
+static int __check_preload_updated(manifest_x * mfx, const char *manifest)
+{
+ char filepath[PKG_STRING_LEN_MAX] = "";
+ int ret = 0;
+ uiapplication_x *uiapplication = mfx->uiapplication;
+
+ if(strstr(manifest, MANIFEST_RO_PREFIX)) {
+ /* if preload app is updated, then remove previous desktop file on RW*/
+ for(; uiapplication; uiapplication=uiapplication->next) {
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid);
+ ret = remove(filepath);
+ if (ret <0)
+ return -1;
+ }
+ } else {
+ /* if downloaded app is updated, then update tag set true*/
+ free((void *)mfx->update);
+ mfx->update = strdup("true");
+ }
+
+ return 0;
+}
+
+static int __get_appid_list(const char *pkgid, void *user_data)
+{
+ int col = 0;
+ int cols = 0;
+ int ret = 0;
+ char *appid = NULL;
+
+ sqlite3_stmt *stmt = NULL;
+ sqlite3 *pkgmgr_parser_db;
+
+ char *query = sqlite3_mprintf("select app_id from package_app_info where package=%Q", pkgid);
+
+ ret = sqlite3_open("/opt/dbspace/.pkgmgr_parser.db", &pkgmgr_parser_db);
+ if (ret != SQLITE_OK) {
+ _LOGE("open fail\n");
+ sqlite3_free(query);
+ return -1;
+ }
+ ret = sqlite3_prepare_v2(pkgmgr_parser_db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("prepare_v2 fail\n");
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_free(query);
+ return -1;
+ }
+
+ cols = sqlite3_column_count(stmt);
+ while(1)
+ {
+ ret = sqlite3_step(stmt);
+ if(ret == SQLITE_ROW) {
+ for(col = 0; col < cols; col++)
+ {
+ appid = (char*)sqlite3_column_text(stmt, col);
+ _LOGS("success find appid[%s]\n", appid);
+ (*(GList**)user_data) = g_list_append((*(GList**)user_data), g_strdup(appid));
+ }
+ ret = 0;
+ } else {
+ break;
+ }
+ }
+ sqlite3_finalize(stmt);
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_free(query);
+ return ret;
+}
+
+void __call_uninstall_plugin(const char *pkgid, GList *appid_list)
+{
+ char *appid = NULL;
+ GList *tmp_list;
+
+ if (pkgid == NULL) {
+ _LOGD("pkgid is null\n");
+ return;
+ }
+
+ tmp_list = appid_list;
+ _pkgmgr_parser_plugin_open_db();
+
+ _pkgmgr_parser_plugin_uninstall_plugin(PKGMGR_PARSER_PLUGIN_TAG, pkgid, pkgid);
+
+ while (tmp_list) {
+ appid = (char *)tmp_list->data;
+ if (appid) {
+ _pkgmgr_parser_plugin_uninstall_plugin(PKGMGR_PARSER_PLUGIN_METADATA, pkgid, appid);
+ _pkgmgr_parser_plugin_uninstall_plugin(PKGMGR_PARSER_PLUGIN_CATEGORY, pkgid, appid);
+ }
+ tmp_list = g_list_next(tmp_list);
+ }
+
+ _pkgmgr_parser_plugin_close_db();
+}
+
+static int __delete_pkgid_info_for_uninstallation(const char *pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ int ret = -1;
+ char *appid = NULL;
+ GList *appid_list = NULL;
+ char filepath[PKG_STRING_LEN_MAX] = "";
+
+ _LOGD("Start uninstall for pkgid : delete pkgid[%s]\n", pkgid);
+
+ /*get appid list*/
+ ret = __get_appid_list(pkgid, &appid_list);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get app_list");
+
+ _LOGD("call plugin uninstall\n");
+
+ /*call plugin uninstall*/
+ __call_uninstall_plugin(pkgid, appid_list);
+
+ /* delete pkgmgr db */
+ ret = pkgmgr_parser_delete_pkgid_info_from_db(pkgid);
+ if (ret == -1)
+ _LOGD("DB pkgid info Delete failed\n");
+ else
+ _LOGD("DB pkgid info Delete Success\n");
+
+ /* delete desktop file*/
+ while (appid_list) {
+ appid = (char *)appid_list->data;
+ if (appid) {
+ _LOGD("Delete appid[%s] info from db\n", appid);
+
+ ret = pkgmgr_parser_delete_appid_info_from_db(appid);
+ if (ret == -1)
+ _LOGD("DB appid info Delete failed\n");
+ else
+ _LOGD("DB appid info Delete Success\n");
+
+ ret = __ail_change_info(AIL_REMOVE, appid);
+ if (ret < 0)
+ _LOGD("AIL_REMOVE failed\n");
+
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, appid);
+ if (access(filepath, R_OK) == 0) {
+ ret = remove(filepath);
+ if (ret < 0)
+ _LOGD("remove failed\n");
+ }
+ }
+ appid_list = g_list_next(appid_list);
+ }
+
+ g_list_free(appid_list);
+
+ _LOGD("Finish : uninstall for pkgid\n");
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_check_mdm_policy_for_uninstallation(const char *manifest)
+{
+ int ret = PMINFO_R_OK;
+ manifest_x *mfx = NULL;
+
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ retvm_if(mfx == NULL, PMINFO_R_OK, "argument supplied is NULL");
+
+ ret = __ps_check_mdm_policy(mfx, ACTION_UNINSTALL);
+ if (ret < 0)
+ _LOGE("pkg[%s] violate mdm policy.", mfx->package);
+
+ pkgmgr_parser_free_manifest_xml(mfx);
+
+ return ret;
+}
+
+API int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
+{
+ int ret = 0;
+ if (mfx == NULL) {
+ _LOGD("Manifest pointer is NULL\n");
+ return -1;
+ }
+ ret = __ps_make_nativeapp_desktop(mfx, NULL, ACTION_INSTALL);
+ if (ret == -1)
+ _LOGD("Creating desktop file failed\n");
+ else
+ _LOGD("Creating desktop file Success\n");
+ return ret;
+}
+
+API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
+{
+ if (mfx == NULL)
+ return;
+ if (mfx->ns) {
+ free((void *)mfx->ns);
+ mfx->ns = NULL;
+ }
+ if (mfx->package) {
+ free((void *)mfx->package);
+ mfx->package = NULL;
+ }
+ if (mfx->version) {
+ free((void *)mfx->version);
+ mfx->version = NULL;
+ }
+ if (mfx->installlocation) {
+ free((void *)mfx->installlocation);
+ mfx->installlocation = NULL;
+ }
+ if (mfx->preload) {
+ free((void *)mfx->preload);
+ mfx->preload = NULL;
+ }
+ if (mfx->readonly) {
+ free((void *)mfx->readonly);
+ mfx->readonly = NULL;
+ }
+ if (mfx->removable) {
+ free((void *)mfx->removable);
+ mfx->removable = NULL;
+ }
+ if (mfx->update) {
+ free((void *)mfx->update);
+ mfx->update = NULL;
+ }
+ if (mfx->system) {
+ free((void *)mfx->system);
+ mfx->system = NULL;
+ }
+ if (mfx->type) {
+ free((void *)mfx->type);
+ mfx->type = NULL;
+ }
+ if (mfx->package_size) {
+ free((void *)mfx->package_size);
+ mfx->package_size = NULL;
+ }
+ if (mfx->package_total_size) {
+ free((void *)mfx->package_total_size);
+ mfx->package_total_size = NULL;
+ }
+ if (mfx->package_data_size) {
+ free((void *)mfx->package_data_size);
+ mfx->package_data_size = NULL;
+ }
+ if (mfx->installed_time) {
+ free((void *)mfx->installed_time);
+ mfx->installed_time = NULL;
+ }
+ if (mfx->installed_storage) {
+ free((void *)mfx->installed_storage);
+ mfx->installed_storage = NULL;
+ }
+ if (mfx->storeclient_id) {
+ free((void *)mfx->storeclient_id);
+ mfx->storeclient_id = NULL;
+ }
+ if (mfx->mainapp_id) {
+ free((void *)mfx->mainapp_id);
+ mfx->mainapp_id = NULL;
+ }
+ if (mfx->package_url) {
+ free((void *)mfx->package_url);
+ mfx->package_url = NULL;
+ }
+ if (mfx->root_path) {
+ free((void *)mfx->root_path);
+ mfx->root_path = NULL;
+ }
+ if (mfx->csc_path) {
+ free((void *)mfx->csc_path);
+ mfx->csc_path = NULL;
+ }
+ if (mfx->appsetting) {
+ free((void *)mfx->appsetting);
+ mfx->appsetting = NULL;
+ }
+ if (mfx->nodisplay_setting) {
+ free((void *)mfx->nodisplay_setting);
+ mfx->nodisplay_setting = NULL;
+ }
+
+ /*Free Icon*/
+ if (mfx->icon) {
+ icon_x *icon = mfx->icon;
+ icon_x *tmp = NULL;
+ while(icon != NULL) {
+ tmp = icon->next;
+ __ps_free_icon(icon);
+ icon = tmp;
+ }
+ }
+ /*Free Label*/
+ if (mfx->label) {
+ label_x *label = mfx->label;
+ label_x *tmp = NULL;
+ while(label != NULL) {
+ tmp = label->next;
+ __ps_free_label(label);
+ label = tmp;
+ }
+ }
+ /*Free Author*/
+ if (mfx->author) {
+ author_x *author = mfx->author;
+ author_x *tmp = NULL;
+ while(author != NULL) {
+ tmp = author->next;
+ __ps_free_author(author);
+ author = tmp;
+ }
+ }
+ /*Free Description*/
+ if (mfx->description) {
+ description_x *description = mfx->description;
+ description_x *tmp = NULL;
+ while(description != NULL) {
+ tmp = description->next;
+ __ps_free_description(description);
+ description = tmp;
+ }
+ }
+ /*Free License*/
+ if (mfx->license) {
+ license_x *license = mfx->license;
+ license_x *tmp = NULL;
+ while(license != NULL) {
+ tmp = license->next;
+ __ps_free_license(license);
+ license = tmp;
+ }
+ }
+ /*Free Privileges*/
+ if (mfx->privileges) {
+ privileges_x *privileges = mfx->privileges;
+ privileges_x *tmp = NULL;
+ while(privileges != NULL) {
+ tmp = privileges->next;
+ __ps_free_privileges(privileges);
+ privileges = tmp;
+ }
+ }
+ /*Free UiApplication*/
+ if (mfx->uiapplication) {
+ uiapplication_x *uiapplication = mfx->uiapplication;
+ uiapplication_x *tmp = NULL;
+ while(uiapplication != NULL) {
+ tmp = uiapplication->next;
+ __ps_free_uiapplication(uiapplication);
+ uiapplication = tmp;
+ }
+ }
+ /*Free ServiceApplication*/
+ if (mfx->serviceapplication) {
+ serviceapplication_x *serviceapplication = mfx->serviceapplication;
+ serviceapplication_x *tmp = NULL;
+ while(serviceapplication != NULL) {
+ tmp = serviceapplication->next;
+ __ps_free_serviceapplication(serviceapplication);
+ serviceapplication = tmp;
+ }
+ }
+ /*Free Daemon*/
+ if (mfx->daemon) {
+ daemon_x *daemon = mfx->daemon;
+ daemon_x *tmp = NULL;
+ while(daemon != NULL) {
+ tmp = daemon->next;
+ __ps_free_daemon(daemon);
+ daemon = tmp;
+ }
+ }
+ /*Free Theme*/
+ if (mfx->theme) {
+ theme_x *theme = mfx->theme;
+ theme_x *tmp = NULL;
+ while(theme != NULL) {
+ tmp = theme->next;
+ __ps_free_theme(theme);
+ theme = tmp;
+ }
+ }
+ /*Free Font*/
+ if (mfx->font) {
+ font_x *font = mfx->font;
+ font_x *tmp = NULL;
+ while(font != NULL) {
+ tmp = font->next;
+ __ps_free_font(font);
+ font = tmp;
+ }
+ }
+ /*Free Ime*/
+ if (mfx->ime) {
+ ime_x *ime = mfx->ime;
+ ime_x *tmp = NULL;
+ while(ime != NULL) {
+ tmp = ime->next;
+ __ps_free_ime(ime);
+ ime = tmp;
+ }
+ }
+ /*Free Compatibility*/
+ if (mfx->compatibility) {
+ compatibility_x *compatibility = mfx->compatibility;
+ compatibility_x *tmp = NULL;
+ while(compatibility != NULL) {
+ tmp = compatibility->next;
+ __ps_free_compatibility(compatibility);
+ compatibility = tmp;
+ }
+ }
+ /*Free DeviceProfile*/
+ if (mfx->deviceprofile) {
+ deviceprofile_x *deviceprofile = mfx->deviceprofile;
+ deviceprofile_x *tmp = NULL;
+ while(deviceprofile != NULL) {
+ tmp = deviceprofile->next;
+ __ps_free_deviceprofile(deviceprofile);
+ deviceprofile = tmp;
+ }
+ }
+ free((void*)mfx);
+ mfx = NULL;
+ return;
+}
+
+API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
+{
+ _LOGD("parsing start\n");
+ xmlTextReaderPtr reader;
+ manifest_x *mfx = NULL;
+
+ reader = xmlReaderForFile(manifest, NULL, 0);
+ if (reader) {
+ mfx = malloc(sizeof(manifest_x));
+ if (mfx) {
+ memset(mfx, '\0', sizeof(manifest_x));
+ if (__process_manifest(reader, mfx) < 0) {
+ _LOGD("Parsing Failed\n");
+ pkgmgr_parser_free_manifest_xml(mfx);
+ mfx = NULL;
+ } else
+ _LOGD("Parsing Success\n");
+ } else {
+ _LOGD("Memory allocation error\n");
+ }
+ xmlFreeTextReader(reader);
+ } else {
+ _LOGD("Unable to create xml reader\n");
+ }
+ return mfx;
+}
+
+/* These APIs are intended to call parser directly */
+
+API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
+{
+ retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+ _LOGD("parsing manifest for installation: %s\n", manifest);
+
+ manifest_x *mfx = NULL;
+ int ret = -1;
+
+ xmlInitParser();
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ _LOGD("Parsing Finished\n");
+
+ ret = __ps_check_mdm_policy(mfx, ACTION_INSTALL);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "pkg[%s] violate mdm policy.", mfx->package);
+
+ __add_preload_info(mfx, manifest);
+
+ _LOGD("Added preload infomation\n");
+
+ __ps_process_tag(mfx, tagv);
+
+ ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
+ if (ret < 0) {
+ ret = __delete_pkgid_info_for_uninstallation(mfx->package);
+ ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
+ }
+
+ _LOGD("DB Insert Success\n");
+
+ _pkgmgr_parser_plugin_process_plugin(mfx, manifest, ACTION_INSTALL);
+
+ if (__check_action_fota(tagv))
+ ret = __ps_make_nativeapp_desktop(mfx, NULL, ACTION_FOTA);
+ else
+ ret = __ps_make_nativeapp_desktop(mfx, NULL, ACTION_INSTALL);
+
+ if (ret == -1)
+ _LOGD("Creating desktop file failed\n");
+ else
+ _LOGD("Creating desktop file Success\n");
+
+ pkgmgr_parser_free_manifest_xml(mfx);
+ _LOGD("Free Done\n");
+ xmlCleanupParser();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
+{
+ retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+ _LOGD("parsing manifest for upgradation: %s\n", manifest);
+
+ manifest_x *mfx = NULL;
+ int ret = -1;
+ bool preload = false;
+ bool system = false;
+ char *csc_path = NULL;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+
+ xmlInitParser();
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ _LOGD("Parsing Finished\n");
+
+ __add_preload_info(mfx, manifest);
+ _LOGD("Added preload infomation\n");
+ __check_preload_updated(mfx, manifest);
+
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(mfx->package, &handle);
+ if (ret != PMINFO_R_OK)
+ _LOGD("pkgmgrinfo_pkginfo_get_pkginfo failed\n");
+
+ ret = pkgmgrinfo_pkginfo_is_preload(handle, &preload);
+ if (ret != PMINFO_R_OK)
+ _LOGD("pkgmgrinfo_pkginfo_is_preload failed\n");
+
+ if (preload) {
+ free((void *)mfx->preload);
+ mfx->preload = strdup("true");
+ }
+
+ ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
+ if (ret != PMINFO_R_OK)
+ _LOGD("pkgmgrinfo_pkginfo_is_system failed\n");
+
+ if (system) {
+ free((void *)mfx->system);
+ mfx->system = strdup("true");
+ }
+
+ ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &csc_path);
+ if (ret != PMINFO_R_OK)
+ _LOGD("pkgmgrinfo_pkginfo_get_csc_path failed\n");
+
+ if (csc_path != NULL) {
+ if (mfx->csc_path)
+ free((void *)mfx->csc_path);
+ mfx->csc_path = strdup(csc_path);
+ }
+
+ ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
+ _LOGD("DB Update Success\n");
+
+ _pkgmgr_parser_plugin_process_plugin(mfx, manifest, ACTION_UPGRADE);
+
+ ret = __ps_make_nativeapp_desktop(mfx, manifest, ACTION_UPGRADE);
+ if (ret == -1)
+ _LOGD("Creating desktop file failed\n");
+ else
+ _LOGD("Creating desktop file Success\n");
+
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ pkgmgr_parser_free_manifest_xml(mfx);
+ _LOGD("Free Done\n");
+ xmlCleanupParser();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
+{
+ retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+ int ret = -1;
+ manifest_x *mfx = NULL;
+
+ if (!strstr(manifest, ".xml")) {
+ _LOGD("manifest is pkgid[%s]\n", manifest);
+ ret = __delete_pkgid_info_for_uninstallation(manifest);
+ if (ret <0)
+ _LOGD("__delete_manifest_for_fota failed\n");
+
+ return PMINFO_R_OK;
+ }
+
+ _LOGD("parsing manifest for uninstallation: %s\n", manifest);
+
+ xmlInitParser();
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ _LOGD("Parsing Finished\n");
+
+ ret = __ps_check_mdm_policy(mfx, ACTION_UNINSTALL);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "pkg[%s] violate mdm policy.", mfx->package);
+
+ __add_preload_info(mfx, manifest);
+ _LOGD("Added preload infomation\n");
+
+ _pkgmgr_parser_plugin_process_plugin(mfx, manifest, ACTION_UNINSTALL);
+
+ ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
+ if (ret == -1)
+ _LOGD("DB Delete failed\n");
+ else
+ _LOGD("DB Delete Success\n");
+
+ ret = __ps_remove_nativeapp_desktop(mfx);
+ if (ret == -1)
+ _LOGD("Removing desktop file failed\n");
+ else
+ _LOGD("Removing desktop file Success\n");
+
+ pkgmgr_parser_free_manifest_xml(mfx);
+ _LOGD("Free Done\n");
+ xmlCleanupParser();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_parse_manifest_for_preload()
+{
+ return pkgmgr_parser_update_preload_info_in_db();
+}
+
+API char *pkgmgr_parser_get_manifest_file(const char *pkgid)
+{
+ return __pkgid_to_manifest(pkgid);
+}
+
+API int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
+{
+ return __ps_run_parser(docPtr, tag, ACTION_INSTALL, pkgid);
+}
+
+API int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
+{
+ return __ps_run_parser(docPtr, tag, ACTION_UPGRADE, pkgid);
+}
+
+API int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
+{
+ return __ps_run_parser(docPtr, tag, ACTION_UNINSTALL, pkgid);
+}
+
+API int pkgmgr_parser_check_manifest_validation(const char *manifest)
+{
+ if (manifest == NULL) {
+ _LOGE("manifest file is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ int ret = -1;
+ xmlSchemaParserCtxtPtr ctx;
+ xmlSchemaValidCtxtPtr vctx;
+ xmlSchemaPtr xschema;
+ ctx = xmlSchemaNewParserCtxt(SCHEMA_FILE);
+ if (ctx == NULL) {
+ _LOGE("xmlSchemaNewParserCtxt() Failed\n");
+ return PMINFO_R_ERROR;
+ }
+ xschema = xmlSchemaParse(ctx);
+ if (xschema == NULL) {
+ _LOGE("xmlSchemaParse() Failed\n");
+ return PMINFO_R_ERROR;
+ }
+ vctx = xmlSchemaNewValidCtxt(xschema);
+ if (vctx == NULL) {
+ _LOGE("xmlSchemaNewValidCtxt() Failed\n");
+ return PMINFO_R_ERROR;
+ }
+ xmlSchemaSetValidErrors(vctx, (xmlSchemaValidityErrorFunc) fprintf, (xmlSchemaValidityWarningFunc) fprintf, stderr);
+ ret = xmlSchemaValidateFile(vctx, manifest, 0);
+ if (ret == -1) {
+ _LOGE("xmlSchemaValidateFile() failed\n");
+ return PMINFO_R_ERROR;
+ } else if (ret == 0) {
+ _LOGE("Manifest is Valid\n");
+ return PMINFO_R_OK;
+ } else {
+ _LOGE("Manifest Validation Failed with error code %d\n", ret);
+ return PMINFO_R_ERROR;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_insert_disabled_pkg(const char *pkgid, char *const tagv[])
+{
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ char *manifest = NULL;
+ manifest_x *mfx = NULL;
+ int ret = -1;
+
+ _LOGD("parsing manifest for installation: %s\n", pkgid);
+
+ manifest = pkgmgr_parser_get_manifest_file(pkgid);
+ if (manifest == NULL) {
+ _LOGE("can not get the manifest.xml\n");
+ return -1;
+ }
+
+ xmlInitParser();
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ _LOGD("Parsing Finished\n");
+
+ __add_preload_info(mfx, manifest);
+
+ _LOGD("Added preload infomation\n");
+
+ ret = pkgmgr_parser_insert_disabled_pkg_info_in_db(mfx);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
+
+ _LOGD("DB Insert Success\n");
+
+ pkgmgr_parser_free_manifest_xml(mfx);
+ _LOGD("Free Done\n");
+ xmlCleanupParser();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_delete_disabled_pkg(const char *pkgid, char *const tagv[])
+{
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ int ret = -1;
+
+ _LOGD("Start uninstall for pkgid : delete pkgid[%s]\n", pkgid);
+
+ /* delete pkgmgr db */
+ ret = pkgmgr_parser_delete_disabled_pkgid_info_from_db(pkgid);
+ if (ret == -1)
+ _LOGD("DB pkgid info Delete failed\n");
+ else
+ _LOGD("DB pkgid info Delete Success\n");
+
+ _LOGD("Finish : uninstall for pkgid\n");
+
+ return PMINFO_R_OK;
+}
+
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __PKGMGR_PARSER_H__
+#define __PKGMGR_PARSER_H__
+
+/**
+ * @file pkgmgr_parser.h
+ * @author Sewook Park <sewook7.park@samsung.com>
+ * @author Shobhit Srivastava <shobhit.s@samsung.com>
+ * @version 0.1
+ * @brief This file declares API of pkgmgr_parser
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup PackageManagerParser
+ * @section Header Header file to include:
+ * @code
+ * #include <pkgmgr_parser.h>
+ * @endcode
+ *
+ * @}
+ */
+
+#include <libxml/xmlreader.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define DEFAULT_LOCALE "No Locale"
+
+#define PKG_STRING_LEN_MAX 1024
+
+#define PKGMGR_PARSER_EMPTY_STR ""
+
+/* defined path and file*/
+#define PRELOAD_PACKAGE_LIST "/usr/etc/package-manager/preload/preload_list.txt"
+
+#define DESKTOP_RW_PATH "/opt/share/applications/"
+#define DESKTOP_RO_PATH "/usr/share/applications/"
+#define MANIFEST_RO_PREFIX "/usr/share/packages/"
+#define MANIFEST_RW_PREFIX "/opt/share/packages/"
+
+#define SCHEMA_FILE "/usr/etc/package-manager/preload/manifest.xsd"
+
+/* so path */
+#define LIBAPPSVC_PATH "/usr/lib/libappsvc.so.0"
+#define LIBAIL_PATH "/usr/lib/libail.so.0"
+
+/* operation_type */
+typedef enum {
+ ACTION_INSTALL = 0,
+ ACTION_UPGRADE,
+ ACTION_UNINSTALL,
+ ACTION_FOTA,
+ ACTION_MAX
+} ACTION_TYPE;
+
+typedef enum {
+ AIL_INSTALL = 0,
+ AIL_UPDATE,
+ AIL_REMOVE,
+ AIL_CLEAN,
+ AIL_FOTA,
+ AIL_MAX
+} AIL_TYPE;
+
+
+/**
+ * @brief List definitions.
+ * All lists are doubly-linked, the last element is stored to list pointer,
+ * which means that lists must be looped using the prev pointer, or by
+ * calling LISTHEAD first to go to start in order to use the next pointer.
+ */
+
+ /**
+ * @brief Convinience Macro to add node in list
+ */
+
+#define LISTADD(list, node) \
+ do { \
+ (node)->prev = (list); \
+ if (list) (node)->next = (list)->next; \
+ else (node)->next = NULL; \
+ if (list) (list)->next = (node); \
+ (list) = (node); \
+ } while (0);
+
+ /**
+ * @brief Convinience Macro to add one node to another node
+ */
+#define NODEADD(node1, node2) \
+ do { \
+ (node2)->prev = (node1); \
+ (node2)->next = (node1)->next; \
+ if ((node1)->next) (node1)->next->prev = (node2); \
+ (node1)->next = (node2); \
+ } while (0);
+
+ /**
+ * @brief Convinience Macro to concatenate two lists
+ */
+#define LISTCAT(list, first, last) \
+ if ((first) && (last)) { \
+ (first)->prev = (list); \
+ (list) = (last); \
+ }
+
+ /**
+ * @brief Convinience Macro to delete node from list
+ */
+#define LISTDEL(list, node) \
+ do { \
+ if ((node)->prev) (node)->prev->next = (node)->next; \
+ if ((node)->next) (node)->next->prev = (node)->prev; \
+ if (!((node)->prev) && !((node)->next)) (list) = NULL; \
+ } while (0);
+
+ /**
+ * @brief Convinience Macro to get list head
+ */
+#define LISTHEAD(list, node) \
+ for ((node) = (list); (node)->prev; (node) = (node)->prev)
+
+ /**
+ * @brief Convinience Macro to get list tail
+ */
+#define LISTTAIL(list, node) \
+ for ((node) = (list); (node)->next; (node) = (node)->next)
+
+typedef struct metadata_x {
+ const char *key;
+ const char *value;
+ struct metadata_x *prev;
+ struct metadata_x *next;
+} metadata_x;
+
+typedef struct privilege_x {
+ const char *text;
+ struct privilege_x *prev;
+ struct privilege_x *next;
+} privilege_x;
+
+typedef struct privileges_x {
+ struct privilege_x *privilege;
+ struct privileges_x *prev;
+ struct privileges_x *next;
+} privileges_x;
+
+typedef struct permission_x {
+ const char *type;
+ const char *value;
+ struct permission_x *prev;
+ struct permission_x *next;
+} permission_x;
+
+typedef struct icon_x {
+ const char *name;
+ const char *text;
+ const char *lang;
+ const char *section;
+ const char *size;
+ const char *resolution;
+ struct icon_x *prev;
+ struct icon_x *next;
+} icon_x;
+
+typedef struct image_x {
+ const char *name;
+ const char *text;
+ const char *lang;
+ const char *section;
+ struct image_x *prev;
+ struct image_x *next;
+} image_x;
+
+typedef struct allowed_x {
+ const char *name;
+ const char *text;
+ struct allowed_x *prev;
+ struct allowed_x *next;
+} allowed_x;
+
+typedef struct request_x {
+ const char *text;
+ struct request_x *prev;
+ struct request_x *next;
+} request_x;
+
+typedef struct define_x {
+ const char *path;
+ struct allowed_x *allowed;
+ struct request_x *request;
+ struct define_x *prev;
+ struct define_x *next;
+} define_x;
+
+typedef struct datashare_x {
+ struct define_x *define;
+ struct request_x *request;
+ struct datashare_x *prev;
+ struct datashare_x *next;
+} datashare_x;
+
+typedef struct description_x {
+ const char *name;
+ const char *text;
+ const char *lang;
+ struct description_x *prev;
+ struct description_x *next;
+} description_x;
+
+typedef struct registry_x {
+ const char *name;
+ const char *text;
+ struct registry_x *prev;
+ struct registry_x *next;
+} registry_x;
+
+typedef struct database_x {
+ const char *name;
+ const char *text;
+ struct database_x *prev;
+ struct database_x *next;
+} database_x;
+
+typedef struct layout_x {
+ const char *name;
+ const char *text;
+ struct layout_x *prev;
+ struct layout_x *next;
+} layout_x;
+
+typedef struct label_x {
+ const char *name;
+ const char *text;
+ const char *lang;
+ struct label_x *prev;
+ struct label_x *next;
+} label_x;
+
+typedef struct author_x {
+ const char *email;
+ const char *href;
+ const char *text;
+ const char *lang;
+ struct author_x *prev;
+ struct author_x *next;
+} author_x;
+
+typedef struct license_x {
+ const char *text;
+ const char *lang;
+ struct license_x *prev;
+ struct license_x *next;
+} license_x;
+
+typedef struct operation_x {
+ const char *name;
+ const char *text;
+ struct operation_x *prev;
+ struct operation_x *next;
+} operation_x;
+
+typedef struct uri_x {
+ const char *name;
+ const char *text;
+ struct uri_x *prev;
+ struct uri_x *next;
+} uri_x;
+
+typedef struct mime_x {
+ const char *name;
+ const char *text;
+ struct mime_x *prev;
+ struct mime_x *next;
+} mime_x;
+
+typedef struct subapp_x {
+ const char *name;
+ const char *text;
+ struct subapp_x *prev;
+ struct subapp_x *next;
+} subapp_x;
+
+typedef struct condition_x {
+ const char *name;
+ const char *text;
+ struct condition_x *prev;
+ struct condition_x *next;
+} condition_x;
+
+typedef struct notification_x {
+ const char *name;
+ const char *text;
+ struct notification_x *prev;
+ struct notification_x *next;
+} notification_x;
+
+typedef struct appsvc_x {
+ const char *text;
+ struct operation_x *operation;
+ struct uri_x *uri;
+ struct mime_x *mime;
+ struct subapp_x *subapp;
+ struct appsvc_x *prev;
+ struct appsvc_x *next;
+} appsvc_x;
+
+typedef struct appcontrol_x {
+ const char *text;
+ struct operation_x *operation;
+ struct uri_x *uri;
+ struct mime_x *mime;
+ struct subapp_x *subapp;
+ struct appcontrol_x *prev;
+ struct appcontrol_x *next;
+} appcontrol_x;
+
+typedef struct category_x{
+ const char *name;
+ struct category_x *prev;
+ struct category_x *next;
+} category_x;
+
+typedef struct launchconditions_x {
+ const char *text;
+ struct condition_x *condition;
+ struct launchconditions_x *prev;
+ struct launchconditions_x *next;
+} launchconditions_x;
+
+typedef struct compatibility_x {
+ const char *name;
+ const char *text;
+ struct compatibility_x *prev;
+ struct compatibility_x *next;
+}compatibility_x;
+
+typedef struct deviceprofile_x {
+ const char *name;
+ const char *text;
+ struct deviceprofile_x *prev;
+ struct deviceprofile_x *next;
+}deviceprofile_x;
+
+typedef struct resolution_x {
+ const char *mimetype;
+ const char *urischeme;
+ struct resolution_x *prev;
+ struct resolution_x *next;
+} resolution_x;
+
+typedef struct capability_x {
+ const char *operationid;
+ const char *access;
+ struct resolution_x *resolution;
+ struct capability_x *prev;
+ struct capability_x *next;
+} capability_x;
+
+typedef struct datacontrol_x {
+ const char *providerid;
+ struct capability_x *capability;
+ struct datacontrol_x *prev;
+ struct datacontrol_x *next;
+} datacontrol_x;
+
+typedef struct uiapplication_x {
+ const char *appid;
+ const char *exec;
+ const char *nodisplay;
+ const char *multiple;
+ const char *taskmanage;
+ const char *enabled;
+ const char *type;
+ const char *categories;
+ const char *extraid;
+ const char *hwacceleration;
+ const char *screenreader;
+ const char *mainapp;
+ const char *package;
+ const char *recentimage;
+ const char *launchcondition;
+ const char *indicatordisplay;
+ const char *portraitimg;
+ const char *landscapeimg;
+ const char *guestmode_visibility;
+ const char *app_component;
+ const char *permission_type;
+ const char *component_type;
+ const char *preload;
+ const char *submode;
+ const char *submode_mainid;
+ const char *installed_storage;
+ const char *process_pool;
+ const char *autorestart;
+ const char *onboot;
+ struct label_x *label;
+ struct icon_x *icon;
+ struct image_x *image;
+ struct appsvc_x *appsvc;
+ struct appcontrol_x *appcontrol;
+ struct category_x *category;
+ struct metadata_x *metadata;
+ struct permission_x *permission;
+ struct launchconditions_x *launchconditions;
+ struct notification_x *notification;
+ struct datashare_x *datashare;
+ struct uiapplication_x *prev;
+ struct uiapplication_x *next;
+} uiapplication_x;
+
+typedef struct serviceapplication_x {
+ const char *appid;
+ const char *exec;
+ const char *onboot;
+ const char *autorestart;
+ const char *enabled;
+ const char *type;
+ const char *package;
+ const char *permission_type;
+ struct label_x *label;
+ struct icon_x *icon;
+ struct appsvc_x *appsvc;
+ struct appcontrol_x *appcontrol;
+ struct category_x *category;
+ struct metadata_x *metadata;
+ struct permission_x *permission;
+ struct datacontrol_x *datacontrol;
+ struct launchconditions_x *launchconditions;
+ struct notification_x *notification;
+ struct datashare_x *datashare;
+ struct serviceapplication_x *prev;
+ struct serviceapplication_x *next;
+} serviceapplication_x;
+
+typedef struct daemon_x {
+ const char *name;
+ const char *text;
+ struct daemon_x *prev;
+ struct daemon_x *next;
+} daemon_x;
+
+typedef struct theme_x {
+ const char *name;
+ const char *text;
+ struct theme_x *prev;
+ struct theme_x *next;
+} theme_x;
+
+typedef struct font_x {
+ const char *name;
+ const char *text;
+ struct font_x *prev;
+ struct font_x *next;
+} font_x;
+
+typedef struct ime_x {
+ const char *name;
+ const char *text;
+ struct ime_x *prev;
+ struct ime_x *next;
+} ime_x;
+
+typedef struct manifest_x {
+ const char *package; /**< package name*/
+ const char *version; /**< package version*/
+ const char *installlocation; /**< package install location*/
+ const char *ns; /**<name space*/
+ const char *removable; /**< package removable flag*/
+ const char *preload; /**< package preload flag*/
+ const char *readonly; /**< package readonly flag*/
+ const char *update; /**< package update flag*/
+ const char *appsetting; /**< package app setting flag*/
+ const char *system; /**< package system flag*/
+ const char *type; /**< package type*/
+ const char *package_size; /**< package size for external installation*/
+ const char *package_total_size; /**< package size for total*/
+ const char *package_data_size; /**< package size for data*/
+ const char *installed_time; /**< installed time after finishing of installation*/
+ const char *installed_storage; /**< package currently installed storage*/
+ const char *storeclient_id; /**< id of store client for installed package*/
+ const char *mainapp_id; /**< app id of main application*/
+ const char *package_url; /**< app id of main application*/
+ const char *root_path; /**< package root path*/
+ const char *csc_path; /**< package csc path*/
+ const char *nodisplay_setting; /**< package no display setting menu*/
+ struct icon_x *icon; /**< package icon*/
+ struct label_x *label; /**< package label*/
+ struct author_x *author; /**< package author*/
+ struct description_x *description; /**< package description*/
+ struct license_x *license; /**< package license*/
+ struct privileges_x *privileges; /**< package privileges*/
+ struct uiapplication_x *uiapplication; /**< package's ui application*/
+ struct serviceapplication_x *serviceapplication; /**< package's service application*/
+ struct daemon_x *daemon; /**< package daemon*/
+ struct theme_x *theme; /**< package theme*/
+ struct font_x *font; /**< package font*/
+ struct ime_x *ime; /**< package ime*/
+ struct compatibility_x *compatibility; /**< package compatibility*/
+ struct deviceprofile_x *deviceprofile; /**< package device profile*/
+} manifest_x;
+
+/**
+ * @fn char int pkgmgr_parser_check_mdm_policy_for_uninstallation(manifest_x * mfx)
+ * @brief This API gets the mdm policy form mdm server
+ */
+int pkgmgr_parser_check_mdm_policy_for_uninstallation(const char *manifest);
+
+/**
+ * @fn char *pkgmgr_parser_get_manifest_file(const char *pkgid)
+ * @brief This API gets the manifest file of the package.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @return manifest file path on success, NULL on failure
+ * @pre None
+ * @post Free the manifest file pointer that is returned by API
+ * @code
+static int get_manifest_file(const char *pkgid)
+{
+ char *manifest = NULL;
+ manifest = pkgmgr_parser_get_manifest_file(pkgid);
+ if (manifest == NULL)
+ return -1;
+ printf("Manifest File Path is %s\n", manifest);
+ free(manifest);
+ return 0;
+}
+ * @endcode
+ */
+char *pkgmgr_parser_get_manifest_file(const char *pkgid);
+
+/**
+ * @fn int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
+ * @brief This API parses the manifest file of the package after installation and stores the data in DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest pointer to package manifest file
+ * @param[in] tagv array of xml tags or NULL
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_manifest_file_for_installation(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[]);
+
+/**
+ * @fn int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
+ * @brief This API parses the manifest file of the package after upgrade and stores the data in DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest pointer to package manifest file
+ * @param[in] tagv array of xml tags or NULL
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_manifest_file_for_upgrade(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_upgrade(manifest, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[]);
+
+/**
+ * @fn int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
+ * @brief This API parses the manifest file of the package after uninstallation and deletes the data from DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest pointer to package manifest file
+ * @param[in] tagv array of xml tags or NULL
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_manifest_file_for_uninstallation(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_uninstallation(manifest, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[]);
+
+/**
+ * @fn int pkgmgr_parser_parse_manifest_for_preload()
+ * @brief This API update preload information to DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parser_parse_manifest_for_preload()
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_preload();
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_parse_manifest_for_preload();
+
+/**
+ * @fn int pkgmgr_parser_check_manifest_validation(const char *manifest)
+ * @brief This API validates the manifest file against the manifest schema.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest pointer to package manifest file
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int validate_manifest_file(const char *manifest)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_check_manifest_validation(manifest);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_check_manifest_validation(const char *manifest);
+
+/**
+ * @fn void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
+ * @brief This API will free the manifest pointer by recursively freeing all sub elements.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] mfx pointer to parsed manifest data
+ * @pre pkgmgr_parser_process_manifest_xml()
+ * @post None
+ * @code
+static int parse_manifest_file(const char *manifest)
+{
+ manifest_x *mfx = NULL
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ if (mfx == NULL)
+ return -1;
+ printf("Parsing Manifest Success\n");
+ pkgmgr_parser_free_manifest_xml(mfx);
+ return 0;
+}
+ * @endcode
+ */
+void pkgmgr_parser_free_manifest_xml(manifest_x *mfx);
+
+/**
+ * @fn manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
+ * @brief This API parses the manifest file and stores all the data in the manifest structure.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest pointer to package manifest file
+ * @return manifest pointer on success, NULL on failure
+ * @pre None
+ * @post pkgmgr_parser_free_manifest_xml()
+ * @code
+static int parse_manifest_file(const char *manifest)
+{
+ manifest_x *mfx = NULL
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ if (mfx == NULL)
+ return -1;
+ printf("Parsing Manifest Success\n");
+ pkgmgr_parser_free_manifest_xml(mfx);
+ return 0;
+}
+ * @endcode
+ */
+manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest);
+
+/**
+ * @fn manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid)
+ * @brief This API gets the manifest info from DB and stores all the data in the manifest structure.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid package id for package
+ * @return manifest pointer on success, NULL on failure
+ * @pre None
+ * @post pkgmgr_parser_free_manifest_xml()
+ * @code
+static int get_manifest_info(const char *pkgid)
+{
+ manifest_x *mfx = NULL
+ mfx = pkgmgr_parser_get_manifest_info(pkgid);
+ if (mfx == NULL)
+ return -1;
+ printf("Parsing Manifest Success\n");
+ pkgmgr_parser_free_manifest_xml(mfx);
+ return 0;
+}
+ * @endcode
+ */
+manifest_x *pkgmgr_parser_get_manifest_info(const char *pkigid);
+
+/* These APIs are intended to call parser directly */
+typedef int (*ps_iter_fn) (const char *tag, int type, void *userdata);
+
+int pkgmgr_parser_has_parser(const char *tag, int *type);
+int pkgmgr_parser_get_list(ps_iter_fn iter_fn, void *data);
+
+/**
+ * @fn int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
+ * @brief This API calls the parser directly by supplying the xml docptr. It is used during package installation
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] docPtr XML doxument pointer
+ * @param[in] tag the xml tag corresponding to the parser that will parse the docPtr
+ * @param[in] pkgid the package id
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_docptr_for_installation(xmlDocPtr docPtr)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_run_parser_for_installation(docPtr, "theme", "com.samsung.test");
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
+
+/**
+ * @fn int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
+ * @brief This API calls the parser directly by supplying the xml docptr. It is used during package upgrade
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] docPtr XML doxument pointer
+ * @param[in] tag the xml tag corresponding to the parser that will parse the docPtr
+ * @param[in] pkgid the package id
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_docptr_for_upgrade(xmlDocPtr docPtr)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_run_parser_for_upgrade(docPtr, "theme", "com.samsung.test");
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid);
+
+/**
+ * @fn int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
+ * @brief This API calls the parser directly by supplying the xml docptr. It is used during package uninstallation
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] docPtr XML doxument pointer
+ * @param[in] tag the xml tag corresponding to the parser that will parse the docPtr
+ * @param[in] pkgid the package id
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_docptr_for_uninstallation(xmlDocPtr docPtr)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_run_parser_for_uninstallation(docPtr, "theme", "com.samsung.test");
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
+
+
+
+/**
+ * @fn int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
+ * @brief This API generates the application desktop file
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] mfx manifest pointer
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgr_parser_process_manifest_xml()
+ * @post pkgmgr_parser_free_manifest_xml()
+ * @code
+static int create_desktop_file(char *manifest)
+{
+ int ret = 0;
+ manifest_x *mfx = NULL;
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ ret = pkgmgr_parser_create_desktop_file(mfx);
+ if (ret)
+ return -1;
+ pkgmgr_parser_free_manifest_xml(mfx);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_create_desktop_file(manifest_x *mfx);
+
+/**
+ * @fn int pkgmgr_parser_insert_disabled_pkg(const char *pkgid, char *const tagv[])
+ * @brief This API parses the manifest file of the disabled package and stores the data in DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to pkgid
+ * @param[in] tagv array of xml tags or NULL
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parser_disabled_pkg_for_installation(const char *pkgid)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_insert_disabled_pkg(pkgid, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_insert_disabled_pkg(const char *pkgid, char *const tagv[]);
+
+/**
+ * @fn int pkgmgr_parser_delete_disabled_pkg(const char *pkgid, char *const tagv[])
+ * @brief This API deletes the data of the disabled package from DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to pkgid
+ * @param[in] tagv array of xml tags or NULL
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ * @code
+static int parse_disabled_pkg_file_for_uninstallation(const char *pkgid)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_delete_disabled_pkg(pkgid, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_delete_disabled_pkg(const char *pkgid, char *const tagv[]);
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* __PKGMGR_PARSER_H__ */
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <db-util.h>
+#include <glib.h>
+#include <dlfcn.h>
+
+#include "pkgmgr-info.h"
+#include "pkgmgr_parser_internal.h"
+#include "pkgmgr_parser_db.h"
+
+#include "pkgmgr-info-debug.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_PARSER"
+
+#define PKGMGR_PARSER_DB_FILE "/opt/dbspace/.pkgmgr_parser.db"
+#define PKGMGR_CERT_DB_FILE "/opt/dbspace/.pkgmgr_cert.db"
+
+#define MAX_QUERY_LEN 4096
+
+sqlite3 *pkgmgr_parser_db;
+sqlite3 *pkgmgr_cert_db;
+
+
+#define QUERY_CREATE_TABLE_PACKAGE_INFO "create table if not exists package_info " \
+ "(package text primary key not null, " \
+ "package_type text DEFAULT 'rpm', " \
+ "package_version text, " \
+ "install_location text, " \
+ "package_size text, " \
+ "package_removable text DEFAULT 'true', " \
+ "package_preload text DEFAULT 'false', " \
+ "package_readonly text DEFAULT 'false', " \
+ "package_update text DEFAULT 'false', " \
+ "package_appsetting text DEFAULT 'false', " \
+ "package_nodisplay text DEFAULT 'false', " \
+ "package_system text DEFAULT 'false', " \
+ "author_name text, " \
+ "author_email text, " \
+ "author_href text," \
+ "installed_time text," \
+ "installed_storage text," \
+ "storeclient_id text," \
+ "mainapp_id text," \
+ "package_url text," \
+ "root_path text," \
+ "csc_path text," \
+ "package_reserve1 text," \
+ "package_reserve2 text," \
+ "package_reserve3 text," \
+ "package_reserve4 text," \
+ "package_reserve5 text)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_LOCALIZED_INFO "create table if not exists package_localized_info " \
+ "(package text not null, " \
+ "package_locale text DEFAULT 'No Locale', " \
+ "package_label text, " \
+ "package_icon text, " \
+ "package_description text, " \
+ "package_license text, " \
+ "package_author, " \
+ "PRIMARY KEY(package, package_locale), " \
+ "FOREIGN KEY(package) " \
+ "REFERENCES package_info(package) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_PRIVILEGE_INFO "create table if not exists package_privilege_info " \
+ "(package text not null, " \
+ "privilege text not null, " \
+ "PRIMARY KEY(package, privilege) " \
+ "FOREIGN KEY(package) " \
+ "REFERENCES package_info(package) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_INFO "create table if not exists package_app_info " \
+ "(app_id text primary key not null, " \
+ "app_component text, " \
+ "app_exec text, " \
+ "app_nodisplay text DEFAULT 'false', " \
+ "app_type text, " \
+ "app_onboot text DEFAULT 'false', " \
+ "app_multiple text DEFAULT 'false', " \
+ "app_autorestart text DEFAULT 'false', " \
+ "app_taskmanage text DEFAULT 'false', " \
+ "app_enabled text DEFAULT 'true', " \
+ "app_hwacceleration text DEFAULT 'use-system-setting', " \
+ "app_screenreader text DEFAULT 'use-system-setting', " \
+ "app_mainapp text, " \
+ "app_recentimage text, " \
+ "app_launchcondition text, " \
+ "app_indicatordisplay text DEFAULT 'true', " \
+ "app_portraitimg text, " \
+ "app_landscapeimg text, " \
+ "app_guestmodevisibility text DEFAULT 'true', " \
+ "app_permissiontype text DEFAULT 'normal', " \
+ "app_preload text DEFAULT 'false', " \
+ "app_submode text DEFAULT 'false', " \
+ "app_submode_mainid text, " \
+ "app_installed_storage text, " \
+ "app_process_pool text DEFAULT 'false', " \
+ "component_type text, " \
+ "package text not null, " \
+ "app_reserve1 text, " \
+ "app_reserve2 text, " \
+ "app_reserve3 text, " \
+ "app_reserve4 text, " \
+ "app_reserve5 text, " \
+ "FOREIGN KEY(package) " \
+ "REFERENCES package_info(package) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_LOCALIZED_INFO "create table if not exists package_app_localized_info " \
+ "(app_id text not null, " \
+ "app_locale text DEFAULT 'No Locale', " \
+ "app_label text, " \
+ "app_icon text, " \
+ "PRIMARY KEY(app_id,app_locale) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_ICON_SECTION_INFO "create table if not exists package_app_icon_section_info " \
+ "(app_id text not null, " \
+ "app_icon text, " \
+ "app_icon_section text, " \
+ "app_icon_resolution text, " \
+ "PRIMARY KEY(app_id,app_icon_section,app_icon_resolution) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_IMAGE_INFO "create table if not exists package_app_image_info " \
+ "(app_id text not null, " \
+ "app_locale text DEFAULT 'No Locale', " \
+ "app_image_section text, " \
+ "app_image text, " \
+ "PRIMARY KEY(app_id,app_image_section) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_CONTROL "create table if not exists package_app_app_control " \
+ "(app_id text not null, " \
+ "operation text not null, " \
+ "uri_scheme text, " \
+ "mime_type text, " \
+ "subapp_name text, " \
+ "PRIMARY KEY(app_id,operation,uri_scheme,mime_type,subapp_name) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_SVC "create table if not exists package_app_app_svc " \
+ "(app_id text not null, " \
+ "operation text not null, " \
+ "uri_scheme text, " \
+ "mime_type text, " \
+ "subapp_name text, " \
+ "PRIMARY KEY(app_id,operation,uri_scheme,mime_type,subapp_name) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_CATEGORY "create table if not exists package_app_app_category " \
+ "(app_id text not null, " \
+ "category text not null, " \
+ "PRIMARY KEY(app_id,category) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_METADATA "create table if not exists package_app_app_metadata " \
+ "(app_id text not null, " \
+ "md_key text not null, " \
+ "md_value text not null, " \
+ "PRIMARY KEY(app_id, md_key, md_value) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_PERMISSION "create table if not exists package_app_app_permission " \
+ "(app_id text not null, " \
+ "pm_type text not null, " \
+ "pm_value text not null, " \
+ "PRIMARY KEY(app_id, pm_type, pm_value) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_ALLOWED "create table if not exists package_app_share_allowed " \
+ "(app_id text not null, " \
+ "data_share_path text not null, " \
+ "data_share_allowed text not null, " \
+ "PRIMARY KEY(app_id,data_share_path,data_share_allowed) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_REQUEST "create table if not exists package_app_share_request " \
+ "(app_id text not null, " \
+ "data_share_request text not null, " \
+ "PRIMARY KEY(app_id,data_share_request) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_CERT_INDEX_INFO "create table if not exists package_cert_index_info " \
+ "(cert_info text not null, " \
+ "cert_id integer, " \
+ "cert_ref_count integer, " \
+ "PRIMARY KEY(cert_id)) "
+
+#define QUERY_CREATE_TABLE_PACKAGE_CERT_INFO "create table if not exists package_cert_info " \
+ "(package text not null, " \
+ "author_root_cert integer, " \
+ "author_im_cert integer, " \
+ "author_signer_cert integer, " \
+ "dist_root_cert integer, " \
+ "dist_im_cert integer, " \
+ "dist_signer_cert integer, " \
+ "dist2_root_cert integer, " \
+ "dist2_im_cert integer, " \
+ "dist2_signer_cert integer, " \
+ "PRIMARY KEY(package)) "
+
+#define QUERY_CREATE_TABLE_PACKAGE_PKG_RESERVE "create table if not exists package_pkg_reserve " \
+ "(pkgid text not null, " \
+ "reserve1 text, " \
+ "reserve2 text, " \
+ "reserve3 text, " \
+ "reserve4 text, " \
+ "reserve5 text, " \
+ "PRIMARY KEY(pkgid)) "
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_RESERVE "create table if not exists package_app_reserve " \
+ "(app_id text not null, " \
+ "reserve1 text, " \
+ "reserve2 text, " \
+ "reserve3 text, " \
+ "reserve4 text, " \
+ "reserve5 text, " \
+ "PRIMARY KEY(app_id)) "
+
+#define QUERY_CREATE_TABLE_PACKAGE_PLUGIN_INFO "create table if not exists package_plugin_info " \
+ "(pkgid text primary key not null, " \
+ "enabled_plugin INTEGER DEFAULT 0)"
+
+#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_INFO "create table if not exists disabled_package_info " \
+ "(package text primary key not null, " \
+ "package_type text DEFAULT 'rpm', " \
+ "package_version text, " \
+ "install_location text, " \
+ "package_size text, " \
+ "package_removable text DEFAULT 'true', " \
+ "package_preload text DEFAULT 'false', " \
+ "package_readonly text DEFAULT 'false', " \
+ "package_update text DEFAULT 'false', " \
+ "package_appsetting text DEFAULT 'false', " \
+ "package_nodisplay text DEFAULT 'false', " \
+ "package_system text DEFAULT 'false', " \
+ "author_name text, " \
+ "author_email text, " \
+ "author_href text," \
+ "installed_time text," \
+ "installed_storage text," \
+ "storeclient_id text," \
+ "mainapp_id text," \
+ "package_url text," \
+ "root_path text," \
+ "csc_path text)"
+
+#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_INFO "create table if not exists disabled_package_app_info " \
+ "(app_id text primary key not null, " \
+ "app_component text, " \
+ "app_exec text, " \
+ "app_nodisplay text DEFAULT 'false', " \
+ "app_type text, " \
+ "app_onboot text DEFAULT 'false', " \
+ "app_multiple text DEFAULT 'false', " \
+ "app_autorestart text DEFAULT 'false', " \
+ "app_taskmanage text DEFAULT 'false', " \
+ "app_enabled text DEFAULT 'true', " \
+ "app_hwacceleration text DEFAULT 'use-system-setting', " \
+ "app_screenreader text DEFAULT 'use-system-setting', " \
+ "app_mainapp text, " \
+ "app_recentimage text, " \
+ "app_launchcondition text, " \
+ "app_indicatordisplay text DEFAULT 'true', " \
+ "app_portraitimg text, " \
+ "app_landscapeimg text, " \
+ "app_guestmodevisibility text DEFAULT 'true', " \
+ "app_permissiontype text DEFAULT 'normal', " \
+ "app_preload text DEFAULT 'false', " \
+ "app_submode text DEFAULT 'false', " \
+ "app_submode_mainid text, " \
+ "app_installed_storage text, " \
+ "component_type text, " \
+ "package text not null, " \
+ "FOREIGN KEY(package) " \
+ "REFERENCES package_info(package) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_LOCALIZED_INFO "create table if not exists disabled_package_localized_info " \
+ "(package text not null, " \
+ "package_locale text DEFAULT 'No Locale', " \
+ "package_label text, " \
+ "package_icon text, " \
+ "package_description text, " \
+ "package_license text, " \
+ "package_author, " \
+ "PRIMARY KEY(package, package_locale), " \
+ "FOREIGN KEY(package) " \
+ "REFERENCES package_info(package) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_LOCALIZED_INFO "create table if not exists disabled_package_app_localized_info " \
+ "(app_id text not null, " \
+ "app_locale text DEFAULT 'No Locale', " \
+ "app_label text, " \
+ "app_icon text, " \
+ "package text not null, " \
+ "PRIMARY KEY(app_id,app_locale) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_CATEGORY "create table if not exists disabled_package_app_app_category " \
+ "(app_id text not null, " \
+ "category text not null, " \
+ "package text not null, " \
+ "PRIMARY KEY(app_id,category) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+
+#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_METADATA "create table if not exists disabled_package_app_app_metadata " \
+ "(app_id text not null, " \
+ "md_key text not null, " \
+ "md_value text not null, " \
+ "package text not null, " \
+ "PRIMARY KEY(app_id, md_key, md_value) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+static int __insert_uiapplication_info(manifest_x *mfx);
+static int __insert_serviceapplication_info(manifest_x *mfx);
+static int __insert_uiapplication_appsvc_info(manifest_x *mfx);
+static int __insert_serviceapplication_appsvc_info(manifest_x *mfx);
+static int __insert_uiapplication_appcategory_info(manifest_x *mfx);
+static int __insert_serviceapplication_appcategory_info(manifest_x *mfx);
+static int __insert_uiapplication_appcontrol_info(manifest_x *mfx);
+static int __insert_serviceapplication_appmetadata_info(manifest_x *mfx);
+static int __insert_uiapplication_appmetadata_info(manifest_x *mfx);
+static int __insert_serviceapplication_appcontrol_info(manifest_x *mfx);
+static int __insert_uiapplication_share_allowed_info(manifest_x *mfx);
+static int __insert_serviceapplication_share_allowed_info(manifest_x *mfx);
+static int __insert_uiapplication_share_request_info(manifest_x *mfx);
+static int __insert_serviceapplication_share_request_info(manifest_x *mfx);
+static void __insert_serviceapplication_locale_info(gpointer data, gpointer userdata);
+static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata);
+static void __insert_pkglocale_info(gpointer data, gpointer userdata);
+static int __insert_manifest_info_in_db(manifest_x *mfx);
+static int __delete_manifest_info_from_db(manifest_x *mfx);
+static int __delete_subpkg_info_from_db(char *appid);
+static int __delete_appinfo_from_db(char *db_table, const char *appid);
+static int __initialize_db(sqlite3 *db_handle, const char *db_query);
+static int __exec_query(char *query);
+static void __extract_data(gpointer data, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath,
+ char **label, char **license, char **icon, char **description, char **author);
+static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata);
+static GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath);
+static int __pkgmgr_parser_create_db(sqlite3 **db_handle, const char *db_path);
+
+static int __delete_subpkg_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ if (coltxt[0])
+ __delete_subpkg_info_from_db(coltxt[0]);
+
+ return 0;
+}
+
+static const char *__get_str(const char *str)
+{
+ if (str == NULL)
+ {
+ return PKGMGR_PARSER_EMPTY_STR;
+ }
+
+ return str;
+}
+
+static int __pkgmgr_parser_create_db(sqlite3 **db_handle, const char *db_path)
+{
+ int ret = -1;
+ sqlite3 *handle;
+ if (access(db_path, F_OK) == 0) {
+ ret =
+ db_util_open(db_path, &handle,
+ DB_UTIL_REGISTER_HOOK_METHOD);
+ if (ret != SQLITE_OK) {
+ _LOGD("connect db [%s] failed!\n",
+ db_path);
+ return -1;
+ }
+ *db_handle = handle;
+ return 0;
+ }
+ _LOGD("%s DB does not exists. Create one!!\n", db_path);
+
+ ret =
+ db_util_open(db_path, &handle,
+ DB_UTIL_REGISTER_HOOK_METHOD);
+
+ if (ret != SQLITE_OK) {
+ _LOGD("connect db [%s] failed!\n", db_path);
+ return -1;
+ }
+ *db_handle = handle;
+ return 0;
+}
+
+static int __evaluate_query(sqlite3 *db_handle, const char *query)
+{
+ sqlite3_stmt* p_statement;
+ int result;
+ result = sqlite3_prepare_v2(db_handle, query, strlen(query), &p_statement, NULL);
+ if (result != SQLITE_OK) {
+ _LOGE("Sqlite3 error [%d] : <%s> preparing <%s> querry\n", result, sqlite3_errmsg(db_handle), query);
+ return -1;
+ }
+
+ result = sqlite3_step(p_statement);
+ if (result != SQLITE_DONE) {
+ _LOGE("Sqlite3 error [%d] : <%s> executing <%s> statement\n", result, sqlite3_errmsg(db_handle), query);
+ return -1;
+ }
+
+ result = sqlite3_finalize(p_statement);
+ if (result != SQLITE_OK) {
+ _LOGE("Sqlite3 error [%d] : <%s> finalizing <%s> statement\n", result, sqlite3_errmsg(db_handle), query);
+ return -1;
+ }
+ return 0;
+}
+
+static int __initialize_db(sqlite3 *db_handle, const char *db_query)
+{
+ return (__evaluate_query(db_handle, db_query));
+}
+
+static int __exec_query(char *query)
+{
+ return (__evaluate_query(pkgmgr_parser_db, query));
+}
+
+static int __exec_query_no_msg(char *query)
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &error_message)) {
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
+static GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath)
+{
+
+ while(lbl != NULL)
+ {
+ if (lbl->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)lbl->lang, __comparefunc, NULL);
+ lbl = lbl->next;
+ }
+ while(lcn != NULL)
+ {
+ if (lcn->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)lcn->lang, __comparefunc, NULL);
+ lcn = lcn->next;
+ }
+ while(icn != NULL)
+ {
+ if (icn->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)icn->lang, __comparefunc, NULL);
+ icn = icn->next;
+ }
+ while(dcn != NULL)
+ {
+ if (dcn->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)dcn->lang, __comparefunc, NULL);
+ dcn = dcn->next;
+ }
+ while(ath != NULL)
+ {
+ if (ath->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)ath->lang, __comparefunc, NULL);
+ ath = ath->next;
+ }
+ return locale;
+
+}
+
+static GList *__create_icon_list(GList *locale, icon_x *icn)
+{
+ while(icn != NULL)
+ {
+ if (icn->section)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)icn->section, __comparefunc, NULL);
+ icn = icn->next;
+ }
+ return locale;
+}
+
+static GList *__create_image_list(GList *locale, image_x *image)
+{
+ while(image != NULL)
+ {
+ if (image->section)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)image->section, __comparefunc, NULL);
+ image = image->next;
+ }
+ return locale;
+}
+
+static void __printfunc(gpointer data, gpointer userdata)
+{
+ _LOGD("%s ", (char*)data);
+}
+
+static void __trimfunc(GList* trim_list)
+{
+ char *trim_data = NULL;
+ char *prev = NULL;
+
+ GList *list = NULL;
+ list = g_list_first(trim_list);
+
+ while (list) {
+ trim_data = (char *)list->data;
+ if (trim_data) {
+ if (prev) {
+ if (strcmp(trim_data, prev) == 0) {
+ trim_list = g_list_remove(trim_list, trim_data);
+ list = g_list_first(trim_list);
+ prev = NULL;
+ continue;
+ } else
+ prev = trim_data;
+ }
+ else
+ prev = trim_data;
+ }
+ list = g_list_next(list);
+ }
+}
+
+static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata)
+{
+ if (a == NULL || b == NULL)
+ return 0;
+ if (strcmp((char*)a, (char*)b) == 0)
+ return 0;
+ if (strcmp((char*)a, (char*)b) < 0)
+ return -1;
+ if (strcmp((char*)a, (char*)b) > 0)
+ return 1;
+ return 0;
+}
+
+static void __extract_data(gpointer data, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath,
+ char **label, char **license, char **icon, char **description, char **author)
+{
+ while(lbl != NULL)
+ {
+ if (lbl->lang) {
+ if (strcmp(lbl->lang, (char *)data) == 0) {
+ *label = (char*)lbl->text;
+ break;
+ }
+ }
+ lbl = lbl->next;
+ }
+ while(lcn != NULL)
+ {
+ if (lcn->lang) {
+ if (strcmp(lcn->lang, (char *)data) == 0) {
+ *license = (char*)lcn->text;
+ break;
+ }
+ }
+ lcn = lcn->next;
+ }
+ while(icn != NULL)
+ {
+ if (icn->section == NULL) {
+ if (icn->lang) {
+ if (strcmp(icn->lang, (char *)data) == 0) {
+ *icon = (char*)icn->text;
+ break;
+ }
+ }
+ }
+ icn = icn->next;
+ }
+ while(dcn != NULL)
+ {
+ if (dcn->lang) {
+ if (strcmp(dcn->lang, (char *)data) == 0) {
+ *description = (char*)dcn->text;
+ break;
+ }
+ }
+ dcn = dcn->next;
+ }
+ while(ath != NULL)
+ {
+ if (ath->lang) {
+ if (strcmp(ath->lang, (char *)data) == 0) {
+ *author = (char*)ath->text;
+ break;
+ }
+ }
+ ath = ath->next;
+ }
+
+}
+
+static void __extract_icon_data(gpointer data, icon_x *icn, char **icon, char **resolution)
+{
+ while(icn != NULL)
+ {
+ if (icn->section) {
+ if (strcmp(icn->section, (char *)data) == 0) {
+ *icon = (char*)icn->text;
+ *resolution = (char*)icn->resolution;
+ break;
+ }
+ }
+ icn = icn->next;
+ }
+}
+
+static void __extract_image_data(gpointer data, image_x*image, char **lang, char **img)
+{
+ while(image != NULL)
+ {
+ if (image->section) {
+ if (strcmp(image->section, (char *)data) == 0) {
+ *lang = (char*)image->lang;
+ *img = (char*)image->text;
+ break;
+ }
+ }
+ image = image->next;
+ }
+}
+
+static void __insert_pkglocale_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *label = NULL;
+ char *icon = NULL;
+ char *description = NULL;
+ char *license = NULL;
+ char *author = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ manifest_x *mfx = (manifest_x *)userdata;
+ label_x *lbl = mfx->label;
+ license_x *lcn = mfx->license;
+ icon_x *icn = mfx->icon;
+ description_x *dcn = mfx->description;
+ author_x *ath = mfx->author;
+
+ __extract_data(data, lbl, lcn, icn, dcn, ath, &label, &license, &icon, &description, &author);
+ if (!label && !description && !icon && !license && !author)
+ return;
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_localized_info(package, package_locale, " \
+ "package_label, package_icon, package_description, package_license, package_author) values " \
+ "('%q', '%q', '%q', '%q', '%s', '%s', '%s')",
+ mfx->package,
+ (char*)data,
+ label,
+ icon,
+ __get_str(description),
+ __get_str(license),
+ __get_str(author));
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package Localized Info DB Insert failed\n");
+}
+
+static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *label = NULL;
+ char *icon = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ uiapplication_x *up = (uiapplication_x*)userdata;
+ label_x *lbl = up->label;
+ icon_x *icn = up->icon;
+
+ __extract_data(data, lbl, NULL, icn, NULL, NULL, &label, NULL, &icon, NULL, NULL);
+ if (!label && !icon)
+ return;
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_localized_info(app_id, app_locale, " \
+ "app_label, app_icon) values " \
+ "('%q', '%q', '%q', '%q')", up->appid, (char*)data,
+ label, icon);
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package UiApp Localized Info DB Insert failed\n");
+
+ /*insert ui app locale info to pkg locale to get mainapp data */
+ if (strcasecmp(up->mainapp, "true")==0) {
+ char *update_query = NULL;
+ update_query = sqlite3_mprintf("insert into package_localized_info(package, package_locale, " \
+ "package_label, package_icon, package_description, package_license, package_author) values " \
+ "(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
+ up->package,
+ (char*)data,
+ label,
+ icon,
+ PKGMGR_PARSER_EMPTY_STR,
+ PKGMGR_PARSER_EMPTY_STR,
+ PKGMGR_PARSER_EMPTY_STR);
+
+ ret = __exec_query_no_msg(update_query);
+ sqlite3_free(update_query);
+
+ if (icon != NULL) {
+ update_query = sqlite3_mprintf("update package_localized_info set package_icon=%Q " \
+ "where package=%Q and package_locale=%Q", icon, up->package, (char*)data);
+ ret = __exec_query_no_msg(update_query);
+ sqlite3_free(update_query);
+ }
+ }
+}
+
+static void __insert_uiapplication_icon_section_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *icon = NULL;
+ char *resolution = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ uiapplication_x *up = (uiapplication_x*)userdata;
+ icon_x *icn = up->icon;
+
+ __extract_icon_data(data, icn, &icon, &resolution);
+ if (!icon && !resolution)
+ return;
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_icon_section_info(app_id, " \
+ "app_icon, app_icon_section, app_icon_resolution) values " \
+ "('%q', '%q', '%q', '%q')", up->appid,
+ icon, (char*)data, resolution);
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package UiApp Localized Info DB Insert failed\n");
+
+}
+
+static void __insert_uiapplication_image_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *lang = NULL;
+ char *img = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ uiapplication_x *up = (uiapplication_x*)userdata;
+ image_x *image = up->image;
+
+ __extract_image_data(data, image, &lang, &img);
+ if (!lang && !img)
+ return;
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_image_info(app_id, app_locale, " \
+ "app_image_section, app_image) values " \
+ "('%q', '%q', '%q', '%q')", up->appid, lang, (char*)data, img);
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package UiApp image Info DB Insert failed\n");
+
+}
+
+
+static void __insert_serviceapplication_locale_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *icon = NULL;
+ char *label = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ serviceapplication_x *sp = (serviceapplication_x*)userdata;
+ label_x *lbl = sp->label;
+ icon_x *icn = sp->icon;
+
+ __extract_data(data, lbl, NULL, icn, NULL, NULL, &label, NULL, &icon, NULL, NULL);
+ if (!icon && !label)
+ return;
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_localized_info(app_id, app_locale, " \
+ "app_label, app_icon) values " \
+ "('%q', '%q', '%q', '%q')", sp->appid, (char*)data,
+ label, icon);
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package ServiceApp Localized Info DB Insert failed\n");
+}
+
+static int __insert_ui_mainapp_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "update package_app_info set app_mainapp='%s' where app_id='%s'", up->mainapp, up->appid);
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Info DB Insert Failed\n");
+ return -1;
+ }
+ if (strcasecmp(up->mainapp, "True")==0)
+ mfx->mainapp_id = strdup(up->appid);
+
+ up = up->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+
+ if (mfx->mainapp_id == NULL){
+ if (mfx->uiapplication && mfx->uiapplication->appid) {
+ snprintf(query, MAX_QUERY_LEN, "update package_app_info set app_mainapp='true' where app_id='%s'", mfx->uiapplication->appid);
+ } else {
+ _LOGD("Not valid appid\n");
+ return -1;
+ }
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Info DB Insert Failed\n");
+ return -1;
+ }
+
+ free((void *)mfx->uiapplication->mainapp);
+ mfx->uiapplication->mainapp= strdup("true");
+ mfx->mainapp_id = strdup(mfx->uiapplication->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN,
+ "update package_info set mainapp_id='%s' where package='%s'", mfx->mainapp_id, mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Info DB update Failed\n");
+ return -1;
+ }
+
+ return 0;
+}
+/* _PRODUCT_LAUNCHING_ENHANCED_
+* up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_appstatus
+*/
+static int __insert_uiapplication_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
+ "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_screenreader, app_mainapp , app_recentimage, " \
+ "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, "\
+ "app_preload, app_submode, app_submode_mainid, app_installed_storage, app_process_pool, component_type, package) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s')",\
+ up->appid,
+ "uiapp",
+ up->exec,
+ up->nodisplay,
+ up->type,
+ up->onboot,
+ up->multiple,
+ up->autorestart,
+ up->taskmanage,
+ up->enabled,
+ up->hwacceleration,
+ up->screenreader,
+ up->mainapp,
+ __get_str(up->recentimage),
+ up->launchcondition,
+ up->indicatordisplay,
+ __get_str(up->portraitimg),
+ __get_str(up->landscapeimg),
+ up->guestmode_visibility,
+ up->permission_type,
+ mfx->preload,
+ up->submode,
+ __get_str(up->submode_mainid),
+ mfx->installed_storage,
+ up->process_pool,
+ up->component_type,
+ mfx->package);
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Info DB Insert Failed\n");
+ return -1;
+ }
+ up = up->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_appcategory_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ category_x *ct = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ ct = up->category;
+ while (ct != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_category(app_id, category) " \
+ "values('%s','%s')",\
+ up->appid, ct->name);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Category Info DB Insert Failed\n");
+ return -1;
+ }
+ ct = ct->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_appmetadata_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ metadata_x *md = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ md = up->metadata;
+ while (md != NULL)
+ {
+ if (md->key) {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_metadata(app_id, md_key, md_value) " \
+ "values('%s','%s', '%s')",\
+ up->appid, md->key, md->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Metadata Info DB Insert Failed\n");
+ return -1;
+ }
+ }
+ md = md->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_apppermission_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ permission_x *pm = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ pm = up->permission;
+ while (pm != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_permission(app_id, pm_type, pm_value) " \
+ "values('%s','%s', '%s')",\
+ up->appid, pm->type, pm->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp permission Info DB Insert Failed\n");
+ return -1;
+ }
+ pm = pm->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_appcontrol_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ appcontrol_x *acontrol = NULL;
+ operation_x *op = NULL;
+ mime_x *mi = NULL;
+ uri_x *ui = NULL;
+ subapp_x *sub = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ const char *operation = NULL;
+ const char *mime = NULL;
+ const char *uri = NULL;
+ const char *subapp = NULL;
+ while(up != NULL)
+ {
+ acontrol = up->appcontrol;
+ while(acontrol != NULL)
+ {
+ op = acontrol->operation;
+ while(op != NULL)
+ {
+ if (op)
+ operation = op->name;
+ mi = acontrol->mime;
+
+ do
+ {
+ if (mi)
+ mime = mi->name;
+ sub = acontrol->subapp;
+ do
+ {
+ if (sub)
+ subapp = sub->name;
+ ui = acontrol->uri;
+ do
+ {
+ if (ui)
+ uri = ui->name;
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_control(app_id, operation, uri_scheme, mime_type, subapp_name) " \
+ "values('%s', '%s', '%s', '%s', '%s')",\
+ up->appid, operation, uri, mime, subapp);
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp AppSvc DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (ui)
+ ui = ui->next;
+ uri = NULL;
+ } while(ui != NULL);
+ if (sub)
+ sub = sub->next;
+ subapp = NULL;
+ }while(sub != NULL);
+ if (mi)
+ mi = mi->next;
+ mime = NULL;
+ }while(mi != NULL);
+ if (op)
+ op = op->next;
+ operation = NULL;
+ }
+ acontrol = acontrol->next;
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_appsvc_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ appsvc_x *asvc = NULL;
+ operation_x *op = NULL;
+ mime_x *mi = NULL;
+ uri_x *ui = NULL;
+ subapp_x *sub = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ const char *operation = NULL;
+ const char *mime = NULL;
+ const char *uri = NULL;
+ const char *subapp = NULL;
+ while(up != NULL)
+ {
+ asvc = up->appsvc;
+ while(asvc != NULL)
+ {
+ op = asvc->operation;
+ while(op != NULL)
+ {
+ if (op)
+ operation = op->name;
+ mi = asvc->mime;
+
+ do
+ {
+ if (mi)
+ mime = mi->name;
+ sub = asvc->subapp;
+ do
+ {
+ if (sub)
+ subapp = sub->name;
+ ui = asvc->uri;
+ do
+ {
+ if (ui)
+ uri = ui->name;
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_svc(app_id, operation, uri_scheme, mime_type, subapp_name) " \
+ "values('%s', '%s', '%s', '%s', '%s')",\
+ up->appid,
+ operation,
+ __get_str(uri),
+ __get_str(mime),
+ __get_str(subapp));
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp AppSvc DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (ui)
+ ui = ui->next;
+ uri = NULL;
+ } while(ui != NULL);
+ if (sub)
+ sub = sub->next;
+ subapp = NULL;
+ }while(sub != NULL);
+ if (mi)
+ mi = mi->next;
+ mime = NULL;
+ }while(mi != NULL);
+ if (op)
+ op = op->next;
+ operation = NULL;
+ }
+ asvc = asvc->next;
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_share_request_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ datashare_x *ds = NULL;
+ request_x *rq = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ ds = up->datashare;
+ while(ds != NULL)
+ {
+ rq = ds->request;
+ while(rq != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_share_request(app_id, data_share_request) " \
+ "values('%s', '%s')",\
+ up->appid, rq->text);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Share Request DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ rq = rq->next;
+ }
+ ds = ds->next;
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_share_allowed_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ datashare_x *ds = NULL;
+ define_x *df = NULL;
+ allowed_x *al = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ ds = up->datashare;
+ while(ds != NULL)
+ {
+ df = ds->define;
+ while(df != NULL)
+ {
+ al = df->allowed;
+ while(al != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_share_allowed(app_id, data_share_path, data_share_allowed) " \
+ "values('%s', '%s', '%s')",\
+ up->appid, df->path, al->text);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Share Allowed DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ al = al->next;
+ }
+ df = df->next;
+ }
+ ds = ds->next;
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_info(app_id, app_component, app_exec, app_type, app_onboot, " \
+ "app_multiple, app_autorestart, app_enabled, app_permissiontype, package) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ sp->appid, "svcapp", sp->exec, sp->type, sp->onboot, "\0",
+ sp->autorestart, sp->enabled, sp->permission_type, mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package ServiceApp Info DB Insert Failed\n");
+ return -1;
+ }
+ sp = sp->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_appcategory_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ category_x *ct = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ ct = sp->category;
+ while (ct != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_category(app_id, category) " \
+ "values('%s','%s')",\
+ sp->appid, ct->name);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package ServiceApp Category Info DB Insert Failed\n");
+ return -1;
+ }
+ ct = ct->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_appmetadata_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ metadata_x *md = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ md = sp->metadata;
+ while (md != NULL)
+ {
+ if (md->key) {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_metadata(app_id, md_key, md_value) " \
+ "values('%s','%s', '%s')",\
+ sp->appid, md->key, md->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package ServiceApp Metadata Info DB Insert Failed\n");
+ return -1;
+ }
+ }
+ md = md->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_apppermission_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ permission_x *pm = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ pm = sp->permission;
+ while (pm != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_permission(app_id, pm_type, pm_value) " \
+ "values('%s','%s', '%s')",\
+ sp->appid, pm->type, pm->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package ServiceApp permission Info DB Insert Failed\n");
+ return -1;
+ }
+ pm = pm->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_appcontrol_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ appcontrol_x *acontrol = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ operation_x *op = NULL;
+ mime_x *mi = NULL;
+ uri_x *ui = NULL;
+ subapp_x *sub = NULL;
+ const char *operation = NULL;
+ const char *mime = NULL;
+ const char *uri = NULL;
+ const char *subapp = NULL;
+ while(sp != NULL)
+ {
+ acontrol = sp->appcontrol;
+ while(acontrol != NULL)
+ {
+ op = acontrol->operation;
+ while(op != NULL)
+ {
+ if (op)
+ operation = op->name;
+ mi = acontrol->mime;
+ do
+ {
+ if (mi)
+ mime = mi->name;
+ sub = acontrol->subapp;
+ do
+ {
+ if (sub)
+ subapp = sub->name;
+ ui = acontrol->uri;
+ do
+ {
+ if (ui)
+ uri = ui->name;
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_control(app_id, operation, uri_scheme, mime_type,subapp_name) " \
+ "values('%s', '%s', '%s', '%s', '%s')",\
+ sp->appid, operation, uri, mime, subapp);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp AppSvc DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (ui)
+ ui = ui->next;
+ uri = NULL;
+ } while(ui != NULL);
+ if (sub)
+ sub = sub->next;
+ subapp = NULL;
+ }while(sub != NULL);
+ if (mi)
+ mi = mi->next;
+ mime = NULL;
+ }while(mi != NULL);
+ if (op)
+ op = op->next;
+ operation = NULL;
+ }
+ acontrol = acontrol->next;
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_appsvc_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ appsvc_x *asvc = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ operation_x *op = NULL;
+ mime_x *mi = NULL;
+ uri_x *ui = NULL;
+ subapp_x *sub = NULL;
+ const char *operation = NULL;
+ const char *mime = NULL;
+ const char *uri = NULL;
+ const char *subapp = NULL;
+ while(sp != NULL)
+ {
+ asvc = sp->appsvc;
+ while(asvc != NULL)
+ {
+ op = asvc->operation;
+ while(op != NULL)
+ {
+ if (op)
+ operation = op->name;
+ mi = asvc->mime;
+ do
+ {
+ if (mi)
+ mime = mi->name;
+ sub = asvc->subapp;
+ do
+ {
+ if (sub)
+ subapp = sub->name;
+ ui = asvc->uri;
+ do
+ {
+ if (ui)
+ uri = ui->name;
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_svc(app_id, operation, uri_scheme, mime_type, subapp_name) " \
+ "values('%s', '%s', '%s', '%s', '%s')",\
+ sp->appid,
+ operation,
+ __get_str(uri),
+ __get_str(mime),
+ __get_str(subapp));
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp AppSvc DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (ui)
+ ui = ui->next;
+ uri = NULL;
+ } while(ui != NULL);
+ if (sub)
+ sub = sub->next;
+ subapp = NULL;
+ }while(sub != NULL);
+ if (mi)
+ mi = mi->next;
+ mime = NULL;
+ }while(mi != NULL);
+ if (op)
+ op = op->next;
+ operation = NULL;
+ }
+ asvc = asvc->next;
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+
+
+static int __insert_serviceapplication_share_request_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ datashare_x *ds = NULL;
+ request_x *rq = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ ds = sp->datashare;
+ while(ds != NULL)
+ {
+ rq = ds->request;
+ while(rq != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_share_request(app_id, data_share_request) " \
+ "values('%s', '%s')",\
+ sp->appid, rq->text);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package ServiceApp Share Request DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ rq = rq->next;
+ }
+ ds = ds->next;
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+
+
+static int __insert_serviceapplication_share_allowed_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ datashare_x *ds = NULL;
+ define_x *df = NULL;
+ allowed_x *al = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ ds = sp->datashare;
+ while(ds != NULL)
+ {
+ df = ds->define;
+ while(df != NULL)
+ {
+ al = df->allowed;
+ while(al != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_share_allowed(app_id, data_share_path, data_share_allowed) " \
+ "values('%s', '%s', '%s')",\
+ sp->appid, df->path, al->text);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package App Share Allowed DB Insert Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ al = al->next;
+ }
+ df = df->next;
+ }
+ ds = ds->next;
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+static int __insert_manifest_info_in_db(manifest_x *mfx)
+{
+ label_x *lbl = mfx->label;
+ license_x *lcn = mfx->license;
+ icon_x *icn = mfx->icon;
+ description_x *dcn = mfx->description;
+ author_x *ath = mfx->author;
+ uiapplication_x *up = mfx->uiapplication;
+ uiapplication_x *up_icn = mfx->uiapplication;
+ uiapplication_x *up_image = mfx->uiapplication;
+ serviceapplication_x *sp = mfx->serviceapplication;
+ privileges_x *pvs = NULL;
+ privilege_x *pv = NULL;
+ char query[MAX_QUERY_LEN] = { '\0' };
+ char root[MAX_QUERY_LEN] = { '\0' };
+ int ret = -1;
+ char *type = NULL;
+ char *path = NULL;
+ const char *auth_name = NULL;
+ const char *auth_email = NULL;
+ const char *auth_href = NULL;
+
+ GList *pkglocale = NULL;
+ GList *applocale = NULL;
+ GList *appicon = NULL;
+ GList *appimage = NULL;
+
+ if (ath) {
+ if (ath->text)
+ auth_name = ath->text;
+ if (ath->email)
+ auth_email = ath->email;
+ if (ath->href)
+ auth_href = ath->href;
+ }
+
+ /*Insert in the package_info DB*/
+ if (mfx->type)
+ type = strdup(mfx->type);
+ else
+ type = strdup("rpm");
+ /*Insert in the package_info DB*/
+ if (mfx->root_path) {
+ path = strdup(mfx->root_path);
+ } else {
+ if (strcmp(type,"rpm")==0) {
+ snprintf(root, MAX_QUERY_LEN - 1, "/opt/share/packages/%s.xml", mfx->package);
+ if (access(root, F_OK) == 0) {
+ memset(root, '\0', MAX_QUERY_LEN);
+ snprintf(root, MAX_QUERY_LEN - 1, "/opt/usr/apps/%s", mfx->package);
+ } else {
+ memset(root, '\0', MAX_QUERY_LEN);
+ snprintf(root, MAX_QUERY_LEN - 1, "/usr/apps/%s", mfx->package);
+ }
+ } else {
+ snprintf(root, MAX_QUERY_LEN - 1, "/opt/usr/apps/%s", mfx->package);
+ }
+
+ path = strdup(root);
+ }
+
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_info(package, package_type, package_version, install_location, package_size, " \
+ "package_removable, package_preload, package_readonly, package_update, package_appsetting, package_nodisplay, package_system," \
+ "author_name, author_email, author_href, installed_time, installed_storage, storeclient_id, mainapp_id, package_url, root_path, csc_path) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ mfx->package,
+ type,
+ mfx->version,
+ __get_str(mfx->installlocation),
+ __get_str(mfx->package_size),
+ mfx->removable,
+ mfx->preload,
+ mfx->readonly,
+ mfx->update,
+ mfx->appsetting,
+ mfx->nodisplay_setting,
+ mfx->system,
+ __get_str(auth_name),
+ __get_str(auth_email),
+ __get_str(auth_href),
+ mfx->installed_time,
+ mfx->installed_storage,
+ __get_str(mfx->storeclient_id),
+ mfx->mainapp_id,
+ __get_str(mfx->package_url),
+ path,
+ __get_str(mfx->csc_path));
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Info DB Insert Failed\n");
+ if (type) {
+ free(type);
+ type = NULL;
+ }
+ if (path) {
+ free(path);
+ path = NULL;
+ }
+ return -1;
+ }
+
+ if (type) {
+ free(type);
+ type = NULL;
+ }
+ if (path) {
+ free(path);
+ path = NULL;
+ }
+
+ /*Insert in the package_privilege_info DB*/
+ pvs = mfx->privileges;
+ while (pvs != NULL) {
+ pv = pvs->privilege;
+ while (pv != NULL) {
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_privilege_info(package, privilege) " \
+ "values('%s','%s')",\
+ mfx->package, pv->text);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Privilege Info DB Insert Failed\n");
+ return -1;
+ }
+ pv = pv->next;
+ }
+ pvs = pvs->next;
+ }
+
+ ret = __insert_ui_mainapp_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert the package locale*/
+ pkglocale = __create_locale_list(pkglocale, lbl, lcn, icn, dcn, ath);
+ /*remove duplicated data in pkglocale*/
+ __trimfunc(pkglocale);
+
+ /*Insert the app locale info */
+ while(up != NULL)
+ {
+ applocale = __create_locale_list(applocale, up->label, NULL, up->icon, NULL, NULL);
+ up = up->next;
+ }
+ while(sp != NULL)
+ {
+ applocale = __create_locale_list(applocale, sp->label, NULL, sp->icon, NULL, NULL);
+ sp = sp->next;
+ }
+ /*remove duplicated data in applocale*/
+ __trimfunc(applocale);
+
+ /*Insert the app icon info */
+ while(up_icn != NULL)
+ {
+ appicon = __create_icon_list(appicon, up_icn->icon);
+ up_icn = up_icn->next;
+ }
+ /*remove duplicated data in appicon*/
+ __trimfunc(appicon);
+
+ /*Insert the image info */
+ while(up_image != NULL)
+ {
+ appimage = __create_image_list(appimage, up_image->image);
+ up_image = up_image->next;
+ }
+ /*remove duplicated data in appimage*/
+ __trimfunc(appimage);
+
+ /*g_list_foreach(pkglocale, __printfunc, NULL);*/
+ /*_LOGD("\n");*/
+ /*g_list_foreach(applocale, __printfunc, NULL);*/
+
+ g_list_foreach(pkglocale, __insert_pkglocale_info, (gpointer)mfx);
+
+ /*native app locale info*/
+ up = mfx->uiapplication;
+ while(up != NULL)
+ {
+ g_list_foreach(applocale, __insert_uiapplication_locale_info, (gpointer)up);
+ up = up->next;
+ }
+ /*agent app locale info*/
+ sp = mfx->serviceapplication;
+ while(sp != NULL)
+ {
+ g_list_foreach(applocale, __insert_serviceapplication_locale_info, (gpointer)sp);
+ sp = sp->next;
+ }
+
+ /*app icon locale info*/
+ up_icn = mfx->uiapplication;
+ while(up_icn != NULL)
+ {
+ g_list_foreach(appicon, __insert_uiapplication_icon_section_info, (gpointer)up_icn);
+ up_icn = up_icn->next;
+ }
+
+ /*app image info*/
+ up_image = mfx->uiapplication;
+ while(up_image != NULL)
+ {
+ g_list_foreach(appimage, __insert_uiapplication_image_info, (gpointer)up_image);
+ up_image = up_image->next;
+ }
+
+ g_list_free(pkglocale);
+ pkglocale = NULL;
+ g_list_free(applocale);
+ applocale = NULL;
+ g_list_free(appicon);
+ appicon = NULL;
+ g_list_free(appimage);
+ appimage = NULL;
+
+
+ /*Insert in the package_app_info DB*/
+ ret = __insert_uiapplication_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_control DB*/
+ ret = __insert_uiapplication_appcontrol_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_appcontrol_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_category DB*/
+ ret = __insert_uiapplication_appcategory_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_appcategory_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_metadata DB*/
+ ret = __insert_uiapplication_appmetadata_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_appmetadata_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_permission DB*/
+ ret = __insert_uiapplication_apppermission_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_apppermission_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_svc DB*/
+ ret = __insert_uiapplication_appsvc_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_appsvc_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_share_allowed DB*/
+ ret = __insert_uiapplication_share_allowed_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_share_allowed_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_share_request DB*/
+ ret = __insert_uiapplication_share_request_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_share_request_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ return 0;
+
+}
+
+static int __insert_disabled_ui_mainapp_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "update disabled_package_app_info set app_mainapp='%s' where app_id='%s'", up->mainapp, up->appid);
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Info DB Insert Failed\n");
+ return -1;
+ }
+ if (strcasecmp(up->mainapp, "True")==0)
+ mfx->mainapp_id = strdup(up->appid);
+
+ up = up->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+
+ if (mfx->mainapp_id == NULL){
+ if (mfx->uiapplication && mfx->uiapplication->appid) {
+ snprintf(query, MAX_QUERY_LEN, "update disabled_package_app_info set app_mainapp='true' where app_id='%s'", mfx->uiapplication->appid);
+ } else {
+ _LOGD("Not valid appid\n");
+ return -1;
+ }
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Info DB Insert Failed\n");
+ return -1;
+ }
+
+ free((void *)mfx->uiapplication->mainapp);
+ mfx->uiapplication->mainapp= strdup("true");
+ mfx->mainapp_id = strdup(mfx->uiapplication->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN,
+ "update disabled_package_info set mainapp_id='%s' where package='%s'", mfx->mainapp_id, mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Info DB update Failed\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int __insert_disabled_uiapplication_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into disabled_package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
+ "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_screenreader, app_mainapp , app_recentimage, " \
+ "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, "\
+ "app_preload, app_submode, app_submode_mainid, app_installed_storage, component_type, package) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ up->appid,
+ "uiapp",
+ up->exec,
+ up->nodisplay,
+ up->type,
+ PKGMGR_PARSER_EMPTY_STR,
+ up->multiple,
+ PKGMGR_PARSER_EMPTY_STR,
+ up->taskmanage,
+ up->enabled,
+ up->hwacceleration,
+ up->screenreader,
+ up->mainapp,
+ __get_str(up->recentimage),
+ up->launchcondition,
+ up->indicatordisplay,
+ __get_str(up->portraitimg),
+ __get_str(up->landscapeimg),
+ up->guestmode_visibility,
+ up->permission_type,
+ mfx->preload,
+ up->submode,
+ __get_str(up->submode_mainid),
+ mfx->installed_storage,
+ up->component_type,
+ mfx->package);
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Info DB Insert Failed\n");
+ return -1;
+ }
+ up = up->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ return 0;
+}
+
+static void __insert_disabled_uiapplication_locale_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *label = NULL;
+ char *icon = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ uiapplication_x *up = (uiapplication_x*)userdata;
+ label_x *lbl = up->label;
+ icon_x *icn = up->icon;
+
+ __extract_data(data, lbl, NULL, icn, NULL, NULL, &label, NULL, &icon, NULL, NULL);
+ if (!label && !icon)
+ return;
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into disabled_package_app_localized_info(app_id, app_locale, " \
+ "app_label, app_icon, package) values " \
+ "('%q', '%q', '%q', '%q', '%q')", up->appid, (char*)data,
+ label, icon, up->package);
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package UiApp Localized Info DB Insert failed\n");
+
+ /*insert ui app locale info to pkg locale to get mainapp data */
+ if (strcasecmp(up->mainapp, "true")==0) {
+ char *update_query = NULL;
+ update_query = sqlite3_mprintf("insert into disabled_package_localized_info(package, package_locale, " \
+ "package_label, package_icon, package_description, package_license, package_author) values " \
+ "(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
+ up->package,
+ (char*)data,
+ label,
+ icon,
+ PKGMGR_PARSER_EMPTY_STR,
+ PKGMGR_PARSER_EMPTY_STR,
+ PKGMGR_PARSER_EMPTY_STR);
+
+ ret = __exec_query_no_msg(update_query);
+ sqlite3_free(update_query);
+
+ if (icon != NULL) {
+ update_query = sqlite3_mprintf("update package_localized_info set package_icon=%Q " \
+ "where package=%Q and package_locale=%Q", icon, up->package, (char*)data);
+ ret = __exec_query_no_msg(update_query);
+ sqlite3_free(update_query);
+ }
+ }
+}
+
+static int __insert_disabled_uiapplication_appcategory_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ category_x *ct = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ ct = up->category;
+ while (ct != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into disabled_package_app_app_category(app_id, category, package) " \
+ "values('%s','%s','%s')",\
+ up->appid, ct->name, up->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Category Info DB Insert Failed\n");
+ return -1;
+ }
+ ct = ct->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_disabled_uiapplication_appmetadata_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ metadata_x *md = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ md = up->metadata;
+ while (md != NULL)
+ {
+ if (md->key) {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into disabled_package_app_app_metadata(app_id, md_key, md_value, package) " \
+ "values('%s','%s', '%s', '%s')",\
+ up->appid, md->key, md->value, up->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Metadata Info DB Insert Failed\n");
+ return -1;
+ }
+ }
+ md = md->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static void __insert_disabled_pkglocale_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *label = NULL;
+ char *icon = NULL;
+ char *description = NULL;
+ char *license = NULL;
+ char *author = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ manifest_x *mfx = (manifest_x *)userdata;
+ label_x *lbl = mfx->label;
+ license_x *lcn = mfx->license;
+ icon_x *icn = mfx->icon;
+ description_x *dcn = mfx->description;
+ author_x *ath = mfx->author;
+
+ __extract_data(data, lbl, lcn, icn, dcn, ath, &label, &license, &icon, &description, &author);
+ if (!label && !description && !icon && !license && !author)
+ return;
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into disabled_package_localized_info(package, package_locale, " \
+ "package_label, package_icon, package_description, package_license, package_author) values " \
+ "('%q', '%q', '%q', '%q', '%s', '%s', '%s')",
+ mfx->package,
+ (char*)data,
+ label,
+ icon,
+ __get_str(description),
+ __get_str(license),
+ __get_str(author));
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package Localized Info DB Insert failed\n");
+}
+
+static int __insert_disabled_pkg_info_in_db(manifest_x *mfx)
+{
+ label_x *lbl = mfx->label;
+ license_x *lcn = mfx->license;
+ icon_x *icn = mfx->icon;
+ description_x *dcn = mfx->description;
+ author_x *ath = mfx->author;
+ uiapplication_x *up = mfx->uiapplication;
+
+ char query[MAX_QUERY_LEN] = { '\0' };
+ char root[MAX_QUERY_LEN] = { '\0' };
+ int ret = -1;
+ char *type = NULL;
+ char *path = NULL;
+ const char *auth_name = NULL;
+ const char *auth_email = NULL;
+ const char *auth_href = NULL;
+
+ GList *pkglocale = NULL;
+ GList *applocale = NULL;
+
+ if (ath) {
+ if (ath->text)
+ auth_name = ath->text;
+ if (ath->email)
+ auth_email = ath->email;
+ if (ath->href)
+ auth_href = ath->href;
+ }
+
+ /*Insert in the package_info DB*/
+ if (mfx->type)
+ type = strdup(mfx->type);
+ else
+ type = strdup("rpm");
+ /*Insert in the package_info DB*/
+ if (mfx->root_path)
+ path = strdup(mfx->root_path);
+ else{
+ if (strcmp(type,"rpm")==0)
+ snprintf(root, MAX_QUERY_LEN - 1, "/usr/apps/%s", mfx->package);
+ else
+ snprintf(root, MAX_QUERY_LEN - 1, "/opt/usr/apps/%s", mfx->package);
+
+ path = strdup(root);
+ }
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into disabled_package_info(package, package_type, package_version, install_location, package_size, " \
+ "package_removable, package_preload, package_readonly, package_update, package_appsetting, package_nodisplay, package_system," \
+ "author_name, author_email, author_href, installed_time, installed_storage, storeclient_id, mainapp_id, package_url, root_path, csc_path) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ mfx->package,
+ type,
+ mfx->version,
+ __get_str(mfx->installlocation),
+ __get_str(mfx->package_size),
+ mfx->removable,
+ mfx->preload,
+ mfx->readonly,
+ mfx->update,
+ mfx->appsetting,
+ mfx->nodisplay_setting,
+ mfx->system,
+ __get_str(auth_name),
+ __get_str(auth_email),
+ __get_str(auth_href),
+ mfx->installed_time,
+ mfx->installed_storage,
+ __get_str(mfx->storeclient_id),
+ mfx->mainapp_id,
+ __get_str(mfx->package_url),
+ path,
+ __get_str(mfx->csc_path));
+
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Info DB Insert Failed\n");
+ if (type) {
+ free(type);
+ type = NULL;
+ }
+ if (path) {
+ free(path);
+ path = NULL;
+ }
+ return -1;
+ }
+
+ if (type) {
+ free(type);
+ type = NULL;
+ }
+ if (path) {
+ free(path);
+ path = NULL;
+ }
+
+ ret = __insert_disabled_ui_mainapp_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert the package locale*/
+ pkglocale = __create_locale_list(pkglocale, lbl, lcn, icn, dcn, ath);
+ /*remove duplicated data in pkglocale*/
+ __trimfunc(pkglocale);
+
+ /*Insert the app locale info */
+ while(up != NULL)
+ {
+ applocale = __create_locale_list(applocale, up->label, NULL, up->icon, NULL, NULL);
+ up = up->next;
+ }
+
+ /*remove duplicated data in applocale*/
+ __trimfunc(applocale);
+
+ /*g_list_foreach(pkglocale, __printfunc, NULL);*/
+ /*_LOGD("\n");*/
+ /*g_list_foreach(applocale, __printfunc, NULL);*/
+
+ g_list_foreach(pkglocale, __insert_disabled_pkglocale_info, (gpointer)mfx);
+
+ /*native app locale info*/
+ up = mfx->uiapplication;
+ while(up != NULL)
+ {
+ g_list_foreach(applocale, __insert_disabled_uiapplication_locale_info, (gpointer)up);
+ up = up->next;
+ }
+
+ g_list_free(pkglocale);
+ pkglocale = NULL;
+ g_list_free(applocale);
+ applocale = NULL;
+
+ /*Insert in the package_app_info DB*/
+ ret = __insert_disabled_uiapplication_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_category DB*/
+ ret = __insert_disabled_uiapplication_appcategory_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_metadata DB*/
+ ret = __insert_disabled_uiapplication_appmetadata_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ return 0;
+}
+
+static int __delete_disabled_pkg_info_from_pkgid(const char *pkgid)
+{
+ char *query = NULL;
+ int ret = -1;
+
+ /*Delete from Package Info DB*/
+ query = sqlite3_mprintf("delete from disabled_package_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Info DB Delete Failed\n");
+
+ /*Delete from Package Localized Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from disabled_package_localized_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Localized Info DB Delete Failed\n");
+
+ /*Delete from app Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from disabled_package_app_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app Info DB Delete Failed\n");
+
+ /*Delete from app Localized Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from disabled_package_app_localized_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app Localized Info DB Delete Failed\n");
+
+ /*Delete from app category Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from disabled_package_app_app_category where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app category Info DB Delete Failed\n");
+
+ /*Delete from app metadata Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from disabled_package_app_app_metadata where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app metadata Info DB Delete Failed\n");
+
+catch:
+ sqlite3_free(query);
+ return 0;
+}
+
+static int __delete_appinfo_from_db(char *db_table, const char *appid)
+{
+ int ret = 0;
+ char *query = sqlite3_mprintf("delete from %Q where app_id=%Q", db_table, appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("DB Deletion from table (%s) Failed\n", db_table);
+ ret = -1;
+ }
+
+ sqlite3_free(query);
+ return ret;
+}
+
+static int __delete_subpkg_info_from_db(char *appid)
+{
+ int ret = -1;
+
+ ret = __delete_appinfo_from_db("package_app_info", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_localized_info", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_icon_section_info", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_image_info", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_svc", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_control", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_category", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_metadata", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_permission", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_share_allowed", appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_share_request", appid);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+static int __delete_subpkg_from_db(const char *pkgid)
+{
+ char *error_message = NULL;
+
+ char *query = sqlite3_mprintf("select app_id from package_app_info where package=%Q", pkgid);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_parser_db, query, __delete_subpkg_list_cb, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ sqlite3_free(query);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ sqlite3_free(query);
+
+ return 0;
+}
+
+static int __delete_manifest_info_from_db(manifest_x *mfx)
+{
+ char query[MAX_QUERY_LEN] = { '\0' };
+ int ret = -1;
+ uiapplication_x *up = mfx->uiapplication;
+ serviceapplication_x *sp = mfx->serviceapplication;
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
+ /*Delete from Package Info DB*/
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_info where package='%s'", mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Info DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+
+ /*Delete from Package Localized Info*/
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_localized_info where package='%s'", mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Localized Info DB Delete Failed\n");
+ return -1;
+ }
+
+ /*Delete from Package Privilege Info*/
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_privilege_info where package='%s'", mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Privilege Info DB Delete Failed\n");
+ return -1;
+ }
+
+ while (up != NULL) {
+ ret = __delete_appinfo_from_db("package_app_info", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_localized_info", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_icon_section_info", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_image_info", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_svc", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_control", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_category", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_metadata", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_permission", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_share_allowed", up->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_share_request", up->appid);
+ if (ret < 0)
+ return ret;
+ up = up->next;
+ }
+
+ while (sp != NULL) {
+ ret = __delete_appinfo_from_db("package_app_info", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_localized_info", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_icon_section_info", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_image_info", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_svc", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_control", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_category", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_metadata", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_app_permission", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_share_allowed", sp->appid);
+ if (ret < 0)
+ return ret;
+ ret = __delete_appinfo_from_db("package_app_share_request", sp->appid);
+ if (ret < 0)
+ return ret;
+ sp = sp->next;
+ }
+
+ /* if main package has sub pkg, delete sub pkg data*/
+ __delete_subpkg_from_db(mfx->package);
+
+ return 0;
+}
+
+static int __delete_appsvc_db(const char *appid)
+{
+ int ret = -1;
+ void *lib_handle = NULL;
+ int (*appsvc_operation) (const char *);
+
+ if ((lib_handle = dlopen(LIBAPPSVC_PATH, RTLD_LAZY)) == NULL) {
+ _LOGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAPPSVC_PATH);
+ return ret;
+ }
+ if ((appsvc_operation =
+ dlsym(lib_handle, "appsvc_unset_defapp")) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol \n");
+ goto END;
+ }
+
+ ret = appsvc_operation(appid);
+
+END:
+ if (lib_handle)
+ dlclose(lib_handle);
+
+ return ret;
+}
+
+static int __delete_appsvc_info_from_db(manifest_x *mfx)
+{
+ int ret = 0;
+ uiapplication_x *uiapplication = mfx->uiapplication;
+
+ for(; uiapplication; uiapplication=uiapplication->next) {
+ ret = __delete_appsvc_db(uiapplication->appid);
+ if (ret <0)
+ _LOGE("can not remove_appsvc_db\n");
+ }
+
+ return ret;
+}
+
+static int __delete_manifest_info_from_pkgid(const char *pkgid)
+{
+ char *query = NULL;
+ int ret = -1;
+
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(pkgid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Cert Info DB Delete Failed\n");
+
+ /*Delete from Package Info DB*/
+ query = sqlite3_mprintf("delete from package_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Info DB Delete Failed\n");
+
+ /*Delete from Package Localized Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from package_localized_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Localized Info DB Delete Failed\n");
+
+ /*Delete from Package Privilege Info*/
+ sqlite3_free(query);
+ query = sqlite3_mprintf("delete from package_privilege_info where package=%Q", pkgid);
+ ret = __exec_query(query);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Privilege Info DB Delete Failed\n");
+
+ /* if main package has sub pkg, delete sub pkg data*/
+ __delete_subpkg_from_db(pkgid);
+
+catch:
+ sqlite3_free(query);
+ return 0;
+}
+
+
+static int __delete_manifest_info_from_appid(const char *appid)
+{
+ int ret = -1;
+
+ ret = __delete_appinfo_from_db("package_app_info", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_localized_info", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_icon_section_info", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_image_info", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_app_svc", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_app_control", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_app_category", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_app_metadata", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_app_permission", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_share_allowed", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ ret = __delete_appinfo_from_db("package_app_share_request", appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
+ return 0;
+}
+
+
+static int __update_preload_condition_in_db()
+{
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ snprintf(query, MAX_QUERY_LEN, "update package_info set package_preload='true'");
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ _LOGD("Package preload_condition update failed\n");
+
+ return ret;
+}
+
+int pkgmgr_parser_initialize_db()
+{
+ int ret = -1;
+ /*Manifest DB*/
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_INFO);
+ if (ret == -1) {
+ _LOGD("package info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_LOCALIZED_INFO);
+ if (ret == -1) {
+ _LOGD("package localized info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_PRIVILEGE_INFO);
+ if (ret == -1) {
+ _LOGD("package app app privilege DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_INFO);
+ if (ret == -1) {
+ _LOGD("package app info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_LOCALIZED_INFO);
+ if (ret == -1) {
+ _LOGD("package app localized info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_ICON_SECTION_INFO);
+ if (ret == -1) {
+ _LOGD("package app icon localized info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_IMAGE_INFO);
+ if (ret == -1) {
+ _LOGD("package app image info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_APP_CONTROL);
+ if (ret == -1) {
+ _LOGD("package app app control DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_APP_CATEGORY);
+ if (ret == -1) {
+ _LOGD("package app app category DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_APP_METADATA);
+ if (ret == -1) {
+ _LOGD("package app app category DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_APP_PERMISSION);
+ if (ret == -1) {
+ _LOGD("package app app permission DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_APP_SVC);
+ if (ret == -1) {
+ _LOGD("package app app svc DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_ALLOWED);
+ if (ret == -1) {
+ _LOGD("package app share allowed DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_REQUEST);
+ if (ret == -1) {
+ _LOGD("package app share request DB initialization failed\n");
+ return ret;
+ }
+ /*Cert DB*/
+ ret = __initialize_db(pkgmgr_cert_db, QUERY_CREATE_TABLE_PACKAGE_CERT_INFO);
+ if (ret == -1) {
+ _LOGD("package cert info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_cert_db, QUERY_CREATE_TABLE_PACKAGE_CERT_INDEX_INFO);
+ if (ret == -1) {
+ _LOGD("package cert index info DB initialization failed\n");
+ return ret;
+ }
+ /*reserve DB*/
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_PKG_RESERVE);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_RESERVE);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_PLUGIN_INFO);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_INFO);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_INFO);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_LOCALIZED_INFO);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_LOCALIZED_INFO);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_CATEGORY);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_METADATA);
+ if (ret == -1) {
+ _LOGD("package pkg reserve info DB initialization failed\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+int pkgmgr_parser_check_and_create_db()
+{
+ int ret = -1;
+ /*Manifest DB*/
+ ret = __pkgmgr_parser_create_db(&pkgmgr_parser_db, PKGMGR_PARSER_DB_FILE);
+ if (ret) {
+ _LOGD("Manifest DB creation Failed\n");
+ return -1;
+ }
+ /*Cert DB*/
+ ret = __pkgmgr_parser_create_db(&pkgmgr_cert_db, PKGMGR_CERT_DB_FILE);
+ if (ret) {
+ _LOGD("Cert DB creation Failed\n");
+ return -1;
+ }
+ return 0;
+}
+
+void pkgmgr_parser_close_db()
+{
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_close(pkgmgr_cert_db);
+}
+
+API int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
+{
+ if (mfx == NULL) {
+ _LOGD("manifest pointer is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ ret = pkgmgr_parser_check_and_create_db();
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ ret = pkgmgr_parser_initialize_db();
+ if (ret == -1)
+ goto err;
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction[%d]\n", ret);
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+ ret = __insert_manifest_info_in_db(mfx);
+ if (ret == -1) {
+ _LOGD("Insert into DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGD("ROLLBACK is fail after insert_disabled_pkg_info_in_db\n");
+
+ ret = -1;
+ goto err;
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction. Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Commit and End\n");
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
+{
+ if (mfx == NULL) {
+ _LOGD("manifest pointer is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ ret = pkgmgr_parser_check_and_create_db();
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ ret = pkgmgr_parser_initialize_db();
+ if (ret == -1)
+ goto err;
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+ ret = __delete_manifest_info_from_db(mfx);
+ if (ret == -1) {
+ _LOGD("Delete from DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGD("Failed to commit transaction. Rollback now\n");
+ goto err;
+ }
+ ret = __insert_manifest_info_in_db(mfx);
+ if (ret == -1) {
+ _LOGD("Insert into DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGD("Failed to commit transaction. Rollback now\n");
+ goto err;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGD("Failed to commit transaction. Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Commit and End\n");
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
+{
+ if (mfx == NULL) {
+ _LOGD("manifest pointer is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ ret = pkgmgr_parser_check_and_create_db();
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+ ret = __delete_manifest_info_from_db(mfx);
+ if (ret == -1) {
+ _LOGD("Delete from DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ goto err;
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+
+ ret = __delete_appsvc_info_from_db(mfx);
+ if (ret == -1)
+ _LOGD("Removing appsvc_db failed\n");
+ else
+ _LOGD("Removing appsvc_db Success\n");
+
+ _LOGD("Transaction Commit and End\n");
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_update_preload_info_in_db()
+{
+ int ret = 0;
+ ret = pkgmgr_parser_check_and_create_db();
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+ ret = __update_preload_condition_in_db();
+ if (ret == -1) {
+ _LOGD("__update_preload_condition_in_db failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ goto err;
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Commit and End\n");
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_delete_pkgid_info_from_db(const char *pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ int ret = 0;
+
+ /*open db*/
+ ret = pkgmgr_parser_check_and_create_db();
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Failed to open DB\n");
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+
+ _LOGD("Start to Delete pkgid[%s] info from db\n", pkgid);
+
+ /*delete pkg info*/
+ ret = __delete_manifest_info_from_pkgid(pkgid);
+ if (ret == -1) {
+ _LOGD("Delete from DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to begin transaction\n");
+ goto err;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_delete_appid_info_from_db(const char *appid)
+{
+ retvm_if(appid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ int ret = 0;
+
+ /*open db*/
+ ret = pkgmgr_parser_check_and_create_db();
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Failed to open DB\n");
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+
+ _LOGD("Start to Delete appid[%s] info from db\n", appid);
+
+ /*delete appinfo db*/
+ ret = __delete_manifest_info_from_appid(appid);
+ if (ret < 0)
+ _LOGE("Fail to delete appid[%s] info from pkgmgr db\n", appid);
+
+ /*delete appsvc db*/
+ ret = __delete_appsvc_db(appid);
+ if (ret < 0)
+ _LOGE("Fail to delete appid[%s] info from appsvc db\n", appid);
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_insert_disabled_pkg_info_in_db(manifest_x *mfx)
+{
+ if (mfx == NULL) {
+ _LOGD("manifest pointer is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ ret = pkgmgr_parser_check_and_create_db();
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ ret = pkgmgr_parser_initialize_db();
+ if (ret == -1)
+ goto err;
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction[%d]\n", ret);
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+ ret = __insert_disabled_pkg_info_in_db(mfx);
+ if (ret == -1) {
+ _LOGE("Insert into DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("ROLLBACK is fail after insert_disabled_pkg_info_in_db\n");
+
+ ret = -1;
+ goto err;
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction. Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Commit and End\n");
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+API int pkgmgr_parser_delete_disabled_pkgid_info_from_db(const char *pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ int ret = 0;
+
+ /*open db*/
+ ret = pkgmgr_parser_check_and_create_db();
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Failed to open DB\n");
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+
+ _LOGD("Start to Delete pkgid[%s] info from db\n", pkgid);
+
+ /*delete pkg info*/
+ ret = __delete_disabled_pkg_info_from_pkgid(pkgid);
+ if (ret == -1) {
+ _LOGD("Delete from DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to begin transaction\n");
+ goto err;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = -1;
+ goto err;
+ }
+
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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 pkgmgr_parser_db.h
+ * @author Shobhit Srivastava <shobhit.s@samsung.com>
+ * @version 0.1
+ * @brief This file declares API to store/retrieve manifest data in DB
+ *
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup PackageManagerParserDB
+ * @section Header Header file to include:
+ * @code
+ * #include <pkgmgr_parser_db.h>
+ * @endcode
+ *
+ * @}
+ */
+
+#ifndef __PKGMGR_PARSER_DB_H__
+#define __PKGMGR_PARSER_DB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "pkgmgr_parser.h"
+
+/**
+ * @fn int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
+ * @brief This API inserts the parsed manifest info in db
+ *
+ * @par This API is for package-manager installer backends
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] mfx pointer to manifest info
+ * @return 0 if success, error code(<0) if fail
+ * @pre None
+ * @post None
+ * @see pkgmgr_parser_update_manifest_info_in_db()
+ * @see pkgmgr_parser_delete_manifest_info_from_db()
+ * @code
+static int insert_manifest_data(manifest_x *mfx)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
+ if (ret < 0)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx);
+
+/**
+ * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
+ * @brief This API updates the manifest info in db
+ *
+ * @par This API is for package-manager installer backends
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] mfx pointer to manifest info
+ * @return 0 if success, error code(<0) if fail
+ * @pre None
+ * @post None
+ * @see pkgmgr_parser_insert_manifest_info_in_db()
+ * @see pkgmgr_parser_delete_manifest_info_from_db()
+ * @code
+static int update_manifest_data(manifest_x *mfx)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
+ if (ret < 0)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx);
+
+/**
+ * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
+ * @brief This API deletes the parsed manifest info from db
+ *
+ * @par This API is for package-manager installer backends
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] mfx pointer to manifest info
+ * @return 0 if success, error code(<0) if fail
+ * @pre None
+ * @post None
+ * @see pkgmgr_parser_update_manifest_info_in_db()
+ * @see pkgmgr_parser_insert_manifest_info_in_db()
+ * @code
+static int delete_manifest_data(manifest_x *mfx)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
+ if (ret < 0)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
+
+int pkgmgr_parser_update_preload_info_in_db();
+int pkgmgr_parser_check_and_create_db();
+int pkgmgr_parser_initialize_db();
+int pkgmgr_parser_delete_pkgid_info_from_db(const char *pkgid);
+int pkgmgr_parser_delete_appid_info_from_db(const char *appid);
+
+int pkgmgr_parser_insert_disabled_pkg_info_in_db(manifest_x *mfx);
+int pkgmgr_parser_delete_disabled_pkgid_info_from_db(const char *pkgid);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+#endif /* __PKGMGR_PARSER_DB_H__ */
+/**
+ * @}
+ * @}
+ */
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+
+
+
+#ifndef __PKGMGR_PARSER_INTERNAL_H__
+#define __PKGMGR_PARSER_INTERNAL_H__
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+
+#endif /* __PKGMGR_PARSER_INTERNAL_H__ */
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#define _GNU_SOURCE
+
+#include <dlfcn.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <time.h>
+#include <string.h>
+#include <libxml/parser.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xmlschemas.h>
+#include <glib.h>
+#include <db-util.h>
+
+#include "pkgmgr_parser_plugin.h"
+#include "pkgmgr-info.h"
+#include "pkgmgr-info-debug.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_PLUGIN"
+
+#define ASCII(s) (const char *)s
+#define XMLCHAR(s) (const xmlChar *)s
+
+#define PLLUGIN_LIST "/usr/etc/package-manager/parserlib/pkgmgr_parser_plugin_list.txt"
+
+#define TOKEN_TYPE_STR "type="
+#define TOKEN_NAME_STR "name="
+#define TOKEN_FLAG_STR "flag="
+#define TOKEN_PATH_STR "path="
+
+#define SEPERATOR_START '"'
+#define SEPERATOR_END '"'
+
+#define PKG_PARSER_CONF_PATH "/usr/etc/package-manager/parser_path.conf"
+#define TAG_PARSER_NAME "parserlib:"
+
+typedef struct pkgmgr_parser_plugin_info_x {
+ manifest_x *mfx;
+ char *pkgid;
+ char *appid;
+ char *filename;
+ char *type;
+ char *name;
+ char *path;
+ char *flag;
+ void *lib_handle;
+ ACTION_TYPE action;
+ int enabled_plugin;
+} pkgmgr_parser_plugin_info_x;
+
+#define E_PKGMGR_PARSER_PLUGIN_MAX 0xFFFFFFFF
+
+#define QUERY_CREATE_TABLE_PACKAGE_PLUGIN_INFO "create table if not exists package_plugin_info " \
+ "(pkgid text primary key not null, " \
+ "enabled_plugin INTEGER DEFAULT 0)"
+
+/*db info*/
+#define PKGMGR_PARSER_DB_FILE "/opt/dbspace/.pkgmgr_parser.db"
+sqlite3 *pkgmgr_parser_db;
+
+typedef struct {
+ char *key;
+ char *value;
+} __metadata_t;
+
+typedef struct {
+ char *name;
+} __category_t;
+
+static void __str_trim(char *input)
+{
+ char *trim_str = input;
+
+ if (input == NULL)
+ return;
+
+ while (*input != 0) {
+ if (!isspace(*input)) {
+ *trim_str = *input;
+ trim_str++;
+ }
+ input++;
+ }
+
+ *trim_str = 0;
+ return;
+}
+
+static char *__get_parser_plugin_path(const char *type, char *plugin_name)
+{
+ FILE *fp = NULL;
+ char buffer[1024] = { 0 };
+ char temp_path[1024] = { 0 };
+ char *path = NULL;
+
+ if (type == NULL) {
+ _LOGE("invalid argument\n");
+ return NULL;
+ }
+
+ fp = fopen(PKG_PARSER_CONF_PATH, "r");
+ if (fp == NULL) {
+ _LOGE("no matching backendlib\n");
+ return NULL;
+ }
+
+ while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+ if (buffer[0] == '#')
+ continue;
+
+ __str_trim(buffer);
+
+ if ((path = strstr(buffer, plugin_name)) != NULL) {
+ path = path + strlen(plugin_name);
+ break;
+ }
+
+ memset(buffer, 0x00, 1024);
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ if (path == NULL) {
+ _LOGE("no matching backendlib\n");
+ return NULL;
+ }
+
+ snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type);
+
+ return strdup(temp_path);
+}
+
+static void __metadata_parser_clear_dir_list(GList* dir_list)
+{
+ GList *list = NULL;
+ __metadata_t* detail = NULL;
+
+ if (dir_list) {
+ list = g_list_first(dir_list);
+ while (list) {
+ detail = (__metadata_t *)list->data;
+ if (detail) {
+ if (detail->key)
+ free(detail->key);
+ if (detail->value)
+ free(detail->value);
+ free(detail);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(dir_list);
+ }
+}
+
+static void __category_parser_clear_dir_list(GList* dir_list)
+{
+ GList *list = NULL;
+ __category_t* detail = NULL;
+
+ if (dir_list) {
+ list = g_list_first(dir_list);
+ while (list) {
+ detail = (__category_t *)list->data;
+ if (detail) {
+ if (detail->name)
+ free(detail->name);
+
+ free(detail);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(dir_list);
+ }
+}
+
+static int __parser_send_tag(void *lib_handle, ACTION_TYPE action, PLUGIN_PROCESS_TYPE process, const char *pkgid)
+{
+ int ret = -1;
+ int (*plugin_install) (const char *);
+ char *ac = NULL;
+
+ if (process == PLUGIN_PRE_PROCESS) {
+ switch (action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_PRE_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_PARSER_PLUGIN_PRE_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL";
+ break;
+ default:
+ _LOGE("PRE_PROCESS : action type error[%d]\n", action);
+ return -1;
+ }
+ } else if (process == PLUGIN_POST_PROCESS) {
+ switch (action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_POST_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_PARSER_PLUGIN_POST_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_POST_UNINSTALL";
+ break;
+ default:
+ _LOGE("POST_PROCESS : action type error[%d]\n", action);
+ return -1;
+ }
+ } else {
+ _LOGE("process type error[%d]\n", process);
+ return -1;
+ }
+
+ if ((plugin_install = dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
+ return -1;
+ }
+
+ ret = plugin_install(pkgid);
+ return ret;
+}
+
+int __ps_run_parser(xmlDocPtr docPtr, const char *tag,
+ ACTION_TYPE action, const char *pkgid)
+{
+ char *lib_path = NULL;
+ void *lib_handle = NULL;
+ int (*plugin_install) (xmlDocPtr, const char *);
+ int ret = -1;
+ char *ac = NULL;
+
+ switch (action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_PARSER_PLUGIN_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_UNINSTALL";
+ break;
+ default:
+ goto END;
+ }
+
+ lib_path = __get_parser_plugin_path(tag, TAG_PARSER_NAME);
+
+ if (!lib_path) {
+ goto END;
+ }
+
+ if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) {
+ _LOGE("dlopen is failed lib_path[%s]\n", lib_path);
+ goto END;
+ }
+ if ((plugin_install =
+ dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol[%s] \n", ac);
+ goto END;
+ }
+
+ ret = plugin_install(docPtr, pkgid);
+ if (ret < 0)
+ _LOGD("[pkgid = %s, libpath = %s plugin fail\n", pkgid, lib_path);
+ else
+ _LOGD("[pkgid = %s, libpath = %s plugin success\n", pkgid, lib_path);
+
+END:
+ if (lib_path)
+ free(lib_path);
+ if (lib_handle)
+ dlclose(lib_handle);
+ return ret;
+}
+
+static int __ps_get_enabled_plugin(const char *pkgid)
+{
+ char query[PKG_STRING_LEN_MAX] = { 0 };
+ sqlite3_stmt *stmt = NULL;
+ const char *tail = NULL;
+ int rc = 0;
+ int enabled_plugin = 0;
+
+ sqlite3_snprintf(PKG_STRING_LEN_MAX, query, "select * from package_plugin_info where pkgid LIKE '%s'", pkgid);
+
+ if (SQLITE_OK != sqlite3_prepare(pkgmgr_parser_db, query, strlen(query), &stmt, &tail)) {
+ _LOGE("sqlite3_prepare error\n");
+ return E_PKGMGR_PARSER_PLUGIN_MAX;
+ }
+
+ rc = sqlite3_step(stmt);
+ if (rc != SQLITE_ROW || rc == SQLITE_DONE) {
+ _LOGE("No records found");
+ goto FINISH_OFF;
+ }
+
+ enabled_plugin = (int)sqlite3_column_int(stmt, 1);
+
+// _LOGD("enabled_plugin ===> %d", enabled_plugin);
+
+ if (SQLITE_OK != sqlite3_finalize(stmt)) {
+ _LOGE("error : sqlite3_finalize\n");
+ goto FINISH_OFF;
+ }
+
+ return enabled_plugin;
+
+FINISH_OFF:
+ rc = sqlite3_finalize(stmt);
+ if (rc != SQLITE_OK) {
+ _LOGE(" sqlite3_finalize failed - %d", rc);
+ }
+
+ return E_PKGMGR_PARSER_PLUGIN_MAX;
+}
+
+static char *__getvalue(const char* pBuf, const char* pKey)
+{
+ const char* p = NULL;
+ const char* pStart = NULL;
+ const char* pEnd = NULL;
+
+ p = strstr(pBuf, pKey);
+ if (p == NULL)
+ return NULL;
+
+ pStart = p + strlen(pKey) + 1;
+ pEnd = strchr(pStart, SEPERATOR_END);
+ if (pEnd == NULL)
+ return NULL;
+
+ size_t len = pEnd - pStart;
+ if (len <= 0)
+ return NULL;
+
+ char *pRes = (char*)malloc(len + 1);
+ strncpy(pRes, pStart, len);
+ pRes[len] = 0;
+
+ return pRes;
+}
+
+static int __get_plugin_info_x(const char*buf, pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ if (buf[0] == '#')
+ return -1;
+
+ if (strstr(buf, TOKEN_TYPE_STR) == NULL)
+ return -1;
+
+ plugin_info->type = __getvalue(buf, TOKEN_TYPE_STR);
+ if (plugin_info->type == NULL)
+ return -1;
+
+ plugin_info->name = __getvalue(buf, TOKEN_NAME_STR);
+ plugin_info->flag = __getvalue(buf, TOKEN_FLAG_STR);
+ plugin_info->path = __getvalue(buf, TOKEN_PATH_STR);
+
+ return 0;
+}
+
+void __clean_plugin_info(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ if(plugin_info == NULL)
+ return;
+
+ if (plugin_info->filename){
+ free((void *)plugin_info->filename);
+ plugin_info->filename = NULL;
+ }
+
+ if (plugin_info->pkgid){
+ free((void *)plugin_info->pkgid);
+ plugin_info->pkgid = NULL;
+ }
+
+ if (plugin_info->appid){
+ free((void *)plugin_info->appid);
+ plugin_info->appid = NULL;
+ }
+
+ free((void *)plugin_info);
+ plugin_info = NULL;
+ return;
+}
+
+static void __check_enabled_plugin(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ int enabled_plugin = 0x0000001;
+
+ enabled_plugin = (int)strtol( plugin_info->flag, NULL, 16 );
+
+ _LOGD( "[%s] flag = 0x%x done[action=%d]!! \n", plugin_info->pkgid, enabled_plugin, plugin_info->action);
+
+ plugin_info->enabled_plugin = plugin_info->enabled_plugin | enabled_plugin;
+}
+
+static void __run_metadata_parser(pkgmgr_parser_plugin_info_x *plugin_info, GList *md_list, const char *appid)
+{
+ int (*metadata_parser_plugin) (const char *, const char *, GList *);
+ int ret = -1;
+ char *ac = NULL;
+
+ switch (plugin_info->action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_MDPARSER_PLUGIN_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_MDPARSER_PLUGIN_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_MDPARSER_PLUGIN_UNINSTALL";
+ break;
+ default:
+ goto END;
+ }
+
+ if ((metadata_parser_plugin =
+ dlsym(plugin_info->lib_handle, ac)) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol[%s] \n",ac);
+ goto END;
+ }
+
+ ret = metadata_parser_plugin(plugin_info->pkgid, appid, md_list);
+ _LOGD("Plugin = %s, appid = %s, result=%d\n", plugin_info->name, appid, ret);
+
+ __check_enabled_plugin(plugin_info);
+
+END:
+ return;
+}
+
+static void __run_category_parser(pkgmgr_parser_plugin_info_x *plugin_info, GList *category_list, const char *appid)
+{
+ int (*category_parser_plugin) (const char *, const char *, GList *);
+ int ret = -1;
+ char *ac = NULL;
+
+ switch (plugin_info->action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_CATEGORY_PARSER_PLUGIN_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_CATEGORY_PARSER_PLUGIN_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_CATEGORY_PARSER_PLUGIN_UNINSTALL";
+ break;
+ default:
+ goto END;
+ }
+
+ if ((category_parser_plugin =
+ dlsym(plugin_info->lib_handle, ac)) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol[%s] \n",ac);
+ goto END;
+ }
+
+ ret = category_parser_plugin(plugin_info->pkgid, appid, category_list);
+ _LOGD("Plugin = %s, appid = %s, result=%d\n", plugin_info->name, appid, ret);
+
+ __check_enabled_plugin(plugin_info);
+
+END:
+ return;
+}
+
+
+static void __run_tag_parser(pkgmgr_parser_plugin_info_x *plugin_info, xmlDocPtr docPtr)
+{
+ int (*plugin_install) (xmlDocPtr, const char *);
+ int ret = -1;
+ char *ac = NULL;
+
+ switch (plugin_info->action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_PARSER_PLUGIN_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_PARSER_PLUGIN_UNINSTALL";
+ break;
+ default:
+ goto END;
+ }
+
+ if ((plugin_install =
+ dlsym(plugin_info->lib_handle, ac)) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol[%s] \n", ac);
+ goto END;
+ }
+
+ ret = plugin_install(docPtr, plugin_info->pkgid);
+ _LOGD("Plugin = %s, appid = %s, result=%d\n", plugin_info->name, plugin_info->pkgid, ret);
+
+ __check_enabled_plugin(plugin_info);
+END:
+ return;
+}
+
+static int __run_tag_parser_prestep(pkgmgr_parser_plugin_info_x *plugin_info, xmlTextReaderPtr reader)
+{
+ const xmlChar *name;
+
+ if (xmlTextReaderDepth(reader) != 1) {
+ _LOGE("Node depth is not 1");
+ goto END;
+ }
+
+ if (xmlTextReaderNodeType(reader) != 1) {
+ _LOGE("Node type is not 1");
+ goto END;
+ }
+
+ const xmlChar *value;
+ name = xmlTextReaderConstName(reader);
+ if (name == NULL) {
+ _LOGE("TEST TEST TES\n");
+ name = BAD_CAST "--";
+ }
+
+ value = xmlTextReaderConstValue(reader);
+ if (value != NULL) {
+ if (xmlStrlen(value) > 40) {
+ _LOGD(" %.40s...", value);
+ } else {
+ _LOGD(" %s", value);
+ }
+ }
+
+ name = xmlTextReaderConstName(reader);
+ if (name == NULL) {
+ _LOGE("TEST TEST TES\n");
+ name = BAD_CAST "--";
+ }
+
+ xmlDocPtr docPtr = xmlTextReaderCurrentDoc(reader);
+ xmlDocPtr copyDocPtr = xmlCopyDoc(docPtr, 1);
+ if (copyDocPtr == NULL)
+ return -1;
+ xmlNode *rootElement = xmlDocGetRootElement(copyDocPtr);
+ if (rootElement == NULL)
+ return -1;
+ xmlNode *cur_node = xmlFirstElementChild(rootElement);
+ if (cur_node == NULL)
+ return -1;
+ xmlNode *temp = xmlTextReaderExpand(reader);
+ if (temp == NULL)
+ return -1;
+ xmlNode *next_node = NULL;
+ while(cur_node != NULL) {
+ if ( (strcmp(ASCII(temp->name), ASCII(cur_node->name)) == 0) &&
+ (temp->line == cur_node->line) ) {
+ break;
+ }
+ else {
+ next_node = xmlNextElementSibling(cur_node);
+ xmlUnlinkNode(cur_node);
+ xmlFreeNode(cur_node);
+ cur_node = next_node;
+ }
+ }
+ if (cur_node == NULL)
+ return -1;
+ next_node = xmlNextElementSibling(cur_node);
+ if (next_node) {
+ cur_node->next = NULL;
+ next_node->prev = NULL;
+ xmlFreeNodeList(next_node);
+ xmlSetTreeDoc(cur_node, copyDocPtr);
+ } else {
+ xmlSetTreeDoc(cur_node, copyDocPtr);
+ }
+
+ __run_tag_parser(plugin_info, copyDocPtr);
+ END:
+
+ return 0;
+}
+
+static void
+__process_tag_xml(pkgmgr_parser_plugin_info_x *plugin_info, xmlTextReaderPtr reader)
+{
+ switch (xmlTextReaderNodeType(reader)) {
+ case XML_READER_TYPE_END_ELEMENT:
+ {
+ break;
+ }
+ case XML_READER_TYPE_ELEMENT:
+ {
+ // Elements without closing tag don't receive
+ const xmlChar *elementName =
+ xmlTextReaderLocalName(reader);
+ if (elementName == NULL) {
+ break;
+ }
+
+ if (strcmp(plugin_info->name, ASCII(elementName)) == 0) {
+ __run_tag_parser_prestep(plugin_info, reader);
+ break;
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+static void __process_tag_parser(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ xmlTextReaderPtr reader;
+ xmlDocPtr docPtr;
+ int ret = -1;
+
+ if (access(plugin_info->filename, R_OK) != 0) {
+ __run_tag_parser(plugin_info, NULL);
+ } else {
+ docPtr = xmlReadFile(plugin_info->filename, NULL, 0);
+ reader = xmlReaderWalker(docPtr);
+ if (reader != NULL) {
+ ret = xmlTextReaderRead(reader);
+ while (ret == 1) {
+ __process_tag_xml(plugin_info, reader);
+ ret = xmlTextReaderRead(reader);
+ }
+ xmlFreeTextReader(reader);
+
+ if (ret != 0) {
+ _LOGS("%s : failed to parse", plugin_info->filename);
+ }
+ } else {
+ _LOGS("%s : failed to read", plugin_info->filename);
+ }
+ }
+}
+
+static void __process_category_parser(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ int tag_exist = 0;
+ char buffer[1024] = { 0, };
+ category_x *category = NULL;
+ GList *category_list = NULL;
+ __category_t *category_detail = NULL;
+
+ if (plugin_info->mfx == NULL) {
+ __run_category_parser(plugin_info, NULL, plugin_info->appid);
+ return;
+ }
+
+ uiapplication_x *up = plugin_info->mfx->uiapplication;
+ while(up != NULL)
+ {
+ category = up->category;
+ while (category != NULL)
+ {
+ //get glist of category key and value combination
+ memset(buffer, 0x00, 1024);
+ snprintf(buffer, 1024, "%s/", plugin_info->name);
+ if ((category->name) && (strncmp(category->name, plugin_info->name, strlen(plugin_info->name)) == 0)) {
+ category_detail = (__category_t*) calloc(1, sizeof(__category_t));
+ if (category_detail == NULL) {
+ _LOGD("Memory allocation failed\n");
+ goto END;
+ }
+
+ category_detail->name = (char*) calloc(1, sizeof(char)*(strlen(category->name)+2));
+ if (category_detail->name == NULL) {
+ _LOGD("Memory allocation failed\n");
+ free(category_detail);
+ goto END;
+ }
+ snprintf(category_detail->name, (strlen(category->name)+1), "%s", category->name);
+
+ category_list = g_list_append(category_list, (gpointer)category_detail);
+ tag_exist = 1;
+ }
+ category = category->next;
+ }
+
+ //send glist to parser when tags for metadata plugin parser exist.
+ if (tag_exist) {
+ __run_category_parser(plugin_info, category_list, up->appid);
+ }
+
+ __category_parser_clear_dir_list(category_list);
+ category_list = NULL;
+ tag_exist = 0;
+ up = up->next;
+ }
+END:
+ if (category_list)
+ __category_parser_clear_dir_list(category_list);
+
+ return;
+}
+
+static void __process_metadata_parser(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ int tag_exist = 0;
+ char buffer[1024] = { 0, };
+ metadata_x *md = NULL;
+ GList *md_list = NULL;
+ __metadata_t *md_detail = NULL;
+
+ if (plugin_info->mfx == NULL) {
+ __run_metadata_parser(plugin_info, NULL, plugin_info->appid);
+ return;
+ }
+
+ uiapplication_x *up = plugin_info->mfx->uiapplication;
+ while(up != NULL)
+ {
+ md = up->metadata;
+ while (md != NULL)
+ {
+ //get glist of metadata key and value combination
+ memset(buffer, 0x00, 1024);
+ snprintf(buffer, 1024, "%s/", plugin_info->name);
+ if ((md->key && md->value) && (strncmp(md->key, plugin_info->name, strlen(plugin_info->name)) == 0)) {
+ md_detail = (__metadata_t*) calloc(1, sizeof(__metadata_t));
+ if (md_detail == NULL) {
+ _LOGD("Memory allocation failed\n");
+ goto END;
+ }
+
+ md_detail->key = (char*) calloc(1, sizeof(char)*(strlen(md->key)+2));
+ if (md_detail->key == NULL) {
+ _LOGD("Memory allocation failed\n");
+ free(md_detail);
+ goto END;
+ }
+ snprintf(md_detail->key, (strlen(md->key)+1), "%s", md->key);
+
+ md_detail->value = (char*) calloc(1, sizeof(char)*(strlen(md->value)+2));
+ if (md_detail->value == NULL) {
+ _LOGD("Memory allocation failed\n");
+ free(md_detail->key);
+ free(md_detail);
+ goto END;
+ }
+ snprintf(md_detail->value, (strlen(md->value)+1), "%s", md->value);
+
+ md_list = g_list_append(md_list, (gpointer)md_detail);
+ tag_exist = 1;
+ }
+ md = md->next;
+ }
+
+ //send glist to parser when tags for metadata plugin parser exist.
+ if (tag_exist) {
+ __run_metadata_parser(plugin_info, md_list, up->appid);
+ }
+
+ __metadata_parser_clear_dir_list(md_list);
+ md_list = NULL;
+ tag_exist = 0;
+ up = up->next;
+ }
+
+END:
+ if(md_list)
+ __metadata_parser_clear_dir_list(md_list);
+ return;
+}
+
+void __process_plugin_db(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ char *query = NULL;
+ char *error_message = NULL;
+
+ query = sqlite3_mprintf("delete from package_plugin_info where pkgid LIKE %Q", plugin_info->pkgid);
+ if (SQLITE_OK == sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &error_message)) {
+ _LOGS("pkgid [%s] plugin[0x%x] deleted", plugin_info->pkgid, plugin_info->enabled_plugin);
+ }
+
+ sqlite3_free(query);
+
+ if (plugin_info->action == ACTION_UNINSTALL)
+ return;
+
+ query = sqlite3_mprintf("insert into package_plugin_info(pkgid,enabled_plugin) values (%Q,'%d')", plugin_info->pkgid, plugin_info->enabled_plugin);
+ if (SQLITE_OK != sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s, error message = %s\n", query, error_message);
+ sqlite3_free(query);
+ return;
+ }
+
+ sqlite3_free(query);
+ _LOGS("pkgid [%s] plugin[0x%x] inserted", plugin_info->pkgid, plugin_info->enabled_plugin);
+
+ return;
+}
+
+static void __process_each_plugin(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ int ret = 0;
+
+ plugin_info->lib_handle = dlopen(plugin_info->path, RTLD_LAZY);
+ retm_if(plugin_info->lib_handle == NULL, "dlopen is failed lib_path");
+
+ ret = __parser_send_tag(plugin_info->lib_handle, plugin_info->action, PLUGIN_PRE_PROCESS, plugin_info->pkgid);
+ _LOGS("PLUGIN_PRE_PROCESS : [%s] result=[%d]\n", plugin_info->name, ret);
+
+ if (strcmp(plugin_info->type,PKGMGR_PARSER_PLUGIN_TAG) == 0) {
+ __process_tag_parser(plugin_info);
+ } else if (strcmp(plugin_info->type,PKGMGR_PARSER_PLUGIN_METADATA) == 0) {
+ __process_metadata_parser(plugin_info);
+ } else if (strcmp(plugin_info->type,PKGMGR_PARSER_PLUGIN_CATEGORY) == 0) {
+ __process_category_parser(plugin_info);
+ }
+
+ ret =__parser_send_tag(plugin_info->lib_handle, plugin_info->action, PLUGIN_POST_PROCESS, plugin_info->pkgid);
+ _LOGS("PLUGIN_POST_PROCESS : [%s] result=[%d]\n", plugin_info->name, ret);
+
+ dlclose(plugin_info->lib_handle);
+}
+
+void __process_all_plugins(pkgmgr_parser_plugin_info_x *plugin_info)
+{
+ int ret = 0;
+ FILE *fp = NULL;
+ char buf[PKG_STRING_LEN_MAX] = {0};
+
+ fp = fopen(PLLUGIN_LIST, "r");
+ retm_if(fp == NULL, "Fail get : %s", PLLUGIN_LIST);
+
+ while (fgets(buf, PKG_STRING_LEN_MAX, fp) != NULL) {
+ __str_trim(buf);
+
+ ret = __get_plugin_info_x(buf, plugin_info);
+ if (ret < 0)
+ continue;
+
+ __process_each_plugin(plugin_info);
+
+ memset(buf, 0x00, PKG_STRING_LEN_MAX);
+ free(plugin_info->type);
+ free(plugin_info->name);
+ free(plugin_info->flag);
+ free(plugin_info->path);
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ return;
+}
+
+
+int _pkgmgr_parser_plugin_open_db()
+{
+ char *error_message = NULL;
+ int ret;
+ FILE * fp = NULL;
+
+ fp = fopen(PKGMGR_PARSER_DB_FILE, "r");
+ if (fp != NULL) {
+ fclose(fp);
+ ret = db_util_open(PKGMGR_PARSER_DB_FILE, &pkgmgr_parser_db, DB_UTIL_REGISTER_HOOK_METHOD);
+ if (ret != SQLITE_OK) {
+ _LOGE("package info DB initialization failed\n");
+ return -1;
+ }
+ return 0;
+ }
+
+ ret = db_util_open(PKGMGR_PARSER_DB_FILE, &pkgmgr_parser_db, DB_UTIL_REGISTER_HOOK_METHOD);
+ if (ret != SQLITE_OK) {
+ _LOGE("package info DB initialization failed\n");
+ return -1;
+ }
+
+ if (SQLITE_OK != sqlite3_exec(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_PLUGIN_INFO, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s, error message = %s\n", QUERY_CREATE_TABLE_PACKAGE_PLUGIN_INFO, error_message);
+ return -1;
+ }
+
+ _LOGE("db_initialize_done\n");
+ return 0;
+}
+
+
+void _pkgmgr_parser_plugin_close_db()
+{
+ sqlite3_close(pkgmgr_parser_db);
+}
+
+void _pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename, ACTION_TYPE action)
+{
+ int ret = 0;
+
+ pkgmgr_parser_plugin_info_x *plugin_info = NULL;
+
+ retm_if(mfx == NULL, "manifest pointer is NULL\n");
+ retm_if(filename == NULL, "filename pointer is NULL\n");
+
+ /*initialize plugin_info_x*/
+ plugin_info = malloc(sizeof(pkgmgr_parser_plugin_info_x));
+ retm_if(plugin_info == NULL, "malloc fail");
+
+ memset(plugin_info, '\0', sizeof(pkgmgr_parser_plugin_info_x));
+
+ /*initialize pkgmgr_paser db*/
+ ret = _pkgmgr_parser_plugin_open_db();
+ if (ret < 0)
+ _LOGE("_pkgmgr_parser_plugin_open_db failed\n");
+
+ /*save plugin_info_x*/
+ plugin_info->mfx = mfx;
+ plugin_info->pkgid = strdup(mfx->package);
+ plugin_info->filename = strdup(filename);
+ plugin_info->action = action;
+
+ /*get plugin list from list-file, and process each plugin*/
+ __process_all_plugins(plugin_info);
+
+ /*update finished info to pkgmgr_parser db*/
+ __process_plugin_db(plugin_info);
+
+ /*close pkgmgr_paser db*/
+ _pkgmgr_parser_plugin_close_db();
+
+ /*clean plugin_info_x*/
+ __clean_plugin_info(plugin_info);
+}
+
+void _pkgmgr_parser_plugin_uninstall_plugin(const char *plugin_type, const char *pkgid, const char *appid)
+{
+ int ret = 0;
+ FILE *fp = NULL;
+ char buf[PKG_STRING_LEN_MAX] = {0};
+
+ int plugin_flag = 0;
+ int enabled_plugin = 0;
+ pkgmgr_parser_plugin_info_x *plugin_info = NULL;
+
+ retm_if(plugin_type == NULL, "plugin_type is null");
+ retm_if(pkgid == NULL, "pkgid is null");
+ retm_if(appid == NULL, "appid is null");
+
+ /*initialize plugin_info_x*/
+ plugin_info = malloc(sizeof(pkgmgr_parser_plugin_info_x));
+ retm_if(plugin_info == NULL, "malloc fail");
+
+ memset(plugin_info, '\0', sizeof(pkgmgr_parser_plugin_info_x));
+
+ /*save plugin_info_x*/
+ enabled_plugin = __ps_get_enabled_plugin(pkgid);
+ plugin_info->pkgid = strdup(pkgid);
+ plugin_info->appid = strdup(appid);
+ plugin_info->action = ACTION_UNINSTALL;
+
+ /*get plugin list from list-file*/
+ fp = fopen(PLLUGIN_LIST, "r");
+
+ if (fp == NULL) {
+ _LOGE("Fail get : %s", PLLUGIN_LIST);
+ __clean_plugin_info(plugin_info);
+ return;
+ }
+
+ while (fgets(buf, PKG_STRING_LEN_MAX, fp) != NULL) {
+ __str_trim(buf);
+
+ ret = __get_plugin_info_x(buf, plugin_info);
+ if (ret < 0)
+ continue;
+
+ /*process uninstallation for given plugin type*/
+ if (strcmp(plugin_info->type, plugin_type) == 0) {
+
+ plugin_flag = (int)strtol(plugin_info->flag, NULL, 16);
+
+ /*if there is a plugin that is saved in db, it need to uninstall*/
+ if (enabled_plugin & plugin_flag) {
+ __process_each_plugin(plugin_info);
+ }
+ }
+
+ memset(buf, 0x00, PKG_STRING_LEN_MAX);
+ free(plugin_info->type);
+ free(plugin_info->name);
+ free(plugin_info->flag);
+ free(plugin_info->path);
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ /*clean plugin_info_x*/
+ __clean_plugin_info(plugin_info);
+
+ return;
+}
+
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+#ifndef __PKGMGR_PARSER_PLUGIN_H_
+#define __PKGMGR_PARSER_PLUGIN_H_
+
+#include "pkgmgr_parser.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif /* __cplusplus */
+
+typedef void* pkgmgr_parser_plugin_h;
+
+/* plugin process_type */
+typedef enum {
+ PLUGIN_PRE_PROCESS = 0,
+ PLUGIN_POST_PROCESS
+} PLUGIN_PROCESS_TYPE;
+
+#define PKGMGR_PARSER_PLUGIN_TAG "tag"
+#define PKGMGR_PARSER_PLUGIN_METADATA "metadata"
+#define PKGMGR_PARSER_PLUGIN_CATEGORY "category"
+
+int __ps_run_parser(xmlDocPtr docPtr, const char *tag, ACTION_TYPE action, const char *pkgid);
+
+int _pkgmgr_parser_plugin_open_db();
+void _pkgmgr_parser_plugin_close_db();
+void _pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename, ACTION_TYPE action);
+void _pkgmgr_parser_plugin_uninstall_plugin(const char *plugin_type, const char *pkgid, const char *appid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __PKGMGR_PARSER_PLUGIN_H_ */
--- /dev/null
+# usage
+# flag : bit flag value for index, flag overlapping is forbidden
+# type : type of plugin parser, three types of plugin are supported "tag, metadata, category"
+# name : name of attribute on xml,
+# path : directory path for plugin library
+
+flag="0x00000001":type="tag":name="shortcut-list":path="/usr/etc/package-manager/parserlib/libshortcut-list.so"
+flag="0x00000002":type="tag":name="livebox":path="/usr/etc/package-manager/parserlib/liblivebox.so"
+flag="0x00000004":type="tag":name="account":path="/usr/etc/package-manager/parserlib/libaccount.so"
+flag="0x00000008":type="tag":name="notifications":path="/usr/etc/package-manager/parserlib/libnotifications.so"
+flag="0x00000010":type="tag":name="privileges":path="/usr/etc/package-manager/parserlib/libprivileges.so"
+flag="0x00000020":type="tag":name="ime":path="/usr/etc/package-manager/parserlib/libime.so"
+flag="0x00000040":type="metadata":name="http://developer.samsung.com/tizen/metadata/font":path="/usr/etc/package-manager/parserlib/metadata/libfont.so"
+flag="0x00000080":type="metadata":name="http://developer.samsung.com/tizen/metadata/sticker":path="/usr/etc/package-manager/parserlib/metadata/libsticker.so"
+flag="0x00000100":type="metadata":name="http://developer.samsung.com/tizen/metadata/ttsengine":path="/usr/etc/package-manager/parserlib/metadata/libttsengine.so"
+flag="0x00000200":type="metadata":name="http://developer.samsung.com/tizen/metadata/downloadable_filters":path="/usr/etc/package-manager/parserlib/metadata/libdownloadable_filters.so"
+flag="0x00000400":type="metadata":name="http://developer.samsung.com/tizen/metadata/dictionary":path="/usr/etc/package-manager/parserlib/metadata/libdictionary.so"
+flag="0x00000800":type="category":name="http://tizen.org/category/antivirus":path="/usr/etc/package-manager/parserlib/category/libantivirus.so"
+flag="0x00001000":type="metadata":name="http://developer.samsung.com/tizen/metadata/profile":path="/usr/etc/package-manager/parserlib/metadata/libtheme.so"
\ No newline at end of file
--- /dev/null
+/*
+ * rpm-installer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#include <glib.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <pkgmgr_parser.h>
+#include "pkgmgr_parser_signature.h"
+#include "pkgmgr-info-debug.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_PARSER"
+
+/**
+ * MDM API result
+ * @see
+ */
+typedef enum _mdm_result {
+ MDM_RESULT_SERVICE_NOT_ENABLED = -5,
+ MDM_RESULT_ACCESS_DENIED = -4,
+ MDM_RESULT_INVALID_PARAM = -3,
+ MDM_RESULT_NOT_SUPPORTED = -2,
+ MDM_RESULT_FAIL = -1,
+ MDM_RESULT_SUCCESS = 0,
+} mdm_result_t;
+
+/**
+ * MDM Policy status
+ * @see
+ */
+typedef enum _mdm_status {
+ MDM_STATUS_ERROR = -1,
+
+ MDM_ALLOWED = 0,
+ MDM_RESTRICTED = 1,
+
+ MDM_ENABLED = 0,
+ MDM_DISABLED = 1,
+
+ MDM_FALSE = 0,
+ MDM_TRUE = 1,
+} mdm_status_t;
+
+typedef struct _mem_header {
+ int id; /* Internal id */
+ void (* free_func)(void *block); /* Pointer to function used to free this block of memory */
+} mem_header_t;
+
+typedef struct _mdm_data {
+ mdm_result_t ret;
+ mem_header_t mem_header;
+ void *data;
+} mdm_data_t;
+
+#define LIBMDM_PATH "libmdm.so.1"
+#define BUFMAX 1024*128
+
+#define ASCII(s) (const char *)s
+#define XMLCHAR(s) (const xmlChar *)s
+
+static int _ri_next_child_element(xmlTextReaderPtr reader, int depth)
+{
+ int ret = xmlTextReaderRead(reader);
+ int cur = xmlTextReaderDepth(reader);
+ while (ret == 1) {
+
+ switch (xmlTextReaderNodeType(reader)) {
+ case XML_READER_TYPE_ELEMENT:
+ if (cur == depth + 1)
+ return 1;
+ break;
+ case XML_READER_TYPE_TEXT:
+ if (cur == depth + 1)
+ return 0;
+ break;
+ case XML_READER_TYPE_END_ELEMENT:
+ if (cur == depth)
+ return 0;
+ break;
+ default:
+ if (cur <= depth)
+ return 0;
+ break;
+ }
+ ret = xmlTextReaderRead(reader);
+ cur = xmlTextReaderDepth(reader);
+ }
+ return ret;
+}
+
+static void _ri_free_transform(transform_x *transform)
+{
+ if (transform == NULL)
+ return;
+ if (transform->algorithm) {
+ free((void *)transform->algorithm);
+ transform->algorithm = NULL;
+ }
+ free((void*)transform);
+ transform = NULL;
+}
+
+static void _ri_free_cannonicalizationmethod(cannonicalizationmethod_x *cannonicalizationmethod)
+{
+ if (cannonicalizationmethod == NULL)
+ return;
+ if (cannonicalizationmethod->algorithm) {
+ free((void *)cannonicalizationmethod->algorithm);
+ cannonicalizationmethod->algorithm = NULL;
+ }
+ free((void*)cannonicalizationmethod);
+ cannonicalizationmethod = NULL;
+}
+
+static void _ri_free_signaturemethod(signaturemethod_x *signaturemethod)
+{
+ if (signaturemethod == NULL)
+ return;
+ if (signaturemethod->algorithm) {
+ free((void *)signaturemethod->algorithm);
+ signaturemethod->algorithm = NULL;
+ }
+ free((void*)signaturemethod);
+ signaturemethod = NULL;
+}
+
+static void _ri_free_digestmethod(digestmethod_x *digestmethod)
+{
+ if (digestmethod == NULL)
+ return;
+ if (digestmethod->algorithm) {
+ free((void *)digestmethod->algorithm);
+ digestmethod->algorithm = NULL;
+ }
+ free((void*)digestmethod);
+ digestmethod = NULL;
+}
+
+static void _ri_free_digestvalue(digestvalue_x *digestvalue)
+{
+ if (digestvalue == NULL)
+ return;
+ if (digestvalue->text) {
+ free((void *)digestvalue->text);
+ digestvalue->text = NULL;
+ }
+ free((void*)digestvalue);
+ digestvalue = NULL;
+}
+
+static void _ri_free_signaturevalue(signaturevalue_x *signaturevalue)
+{
+ if (signaturevalue == NULL)
+ return;
+ if (signaturevalue->text) {
+ free((void *)signaturevalue->text);
+ signaturevalue->text = NULL;
+ }
+ free((void*)signaturevalue);
+ signaturevalue = NULL;
+}
+
+static void _ri_free_x509certificate(x509certificate_x *x509certificate)
+{
+ if (x509certificate == NULL)
+ return;
+ if (x509certificate->text) {
+ free((void *)x509certificate->text);
+ x509certificate->text = NULL;
+ }
+ free((void*)x509certificate);
+ x509certificate = NULL;
+}
+
+static void _ri_free_x509data(x509data_x *x509data)
+{
+ if (x509data == NULL)
+ return;
+ if (x509data->x509certificate) {
+ x509certificate_x *x509certificate = x509data->x509certificate;
+ x509certificate_x *tmp = NULL;
+ while(x509certificate != NULL) {
+ tmp = x509certificate->next;
+ _ri_free_x509certificate(x509certificate);
+ x509certificate = tmp;
+ }
+ }
+ free((void*)x509data);
+ x509data = NULL;
+}
+
+static void _ri_free_keyinfo(keyinfo_x *keyinfo)
+{
+ if (keyinfo == NULL)
+ return;
+ if (keyinfo->x509data) {
+ x509data_x *x509data = keyinfo->x509data;
+ x509data_x *tmp = NULL;
+ while(x509data != NULL) {
+ tmp = x509data->next;
+ _ri_free_x509data(x509data);
+ x509data = tmp;
+ }
+ }
+ free((void*)keyinfo);
+ keyinfo = NULL;
+}
+
+static void _ri_free_transforms(transforms_x *transforms)
+{
+ if (transforms == NULL)
+ return;
+ if (transforms->transform) {
+ transform_x *transform = transforms->transform;
+ transform_x *tmp = NULL;
+ while(transform != NULL) {
+ tmp = transform->next;
+ _ri_free_transform(transform);
+ transform = tmp;
+ }
+ }
+ free((void*)transforms);
+ transforms = NULL;
+}
+
+static void _ri_free_reference(reference_x *reference)
+{
+ if (reference == NULL)
+ return;
+ if (reference->digestmethod) {
+ digestmethod_x *digestmethod = reference->digestmethod;
+ digestmethod_x *tmp = NULL;
+ while(digestmethod != NULL) {
+ tmp = digestmethod->next;
+ _ri_free_digestmethod(digestmethod);
+ digestmethod = tmp;
+ }
+ }
+ if (reference->digestvalue) {
+ digestvalue_x *digestvalue = reference->digestvalue;
+ digestvalue_x *tmp = NULL;
+ while(digestvalue != NULL) {
+ tmp = digestvalue->next;
+ _ri_free_digestvalue(digestvalue);
+ digestvalue = tmp;
+ }
+ }
+ if (reference->transforms) {
+ transforms_x *transforms = reference->transforms;
+ transforms_x *tmp = NULL;
+ while(transforms != NULL) {
+ tmp = transforms->next;
+ _ri_free_transforms(transforms);
+ transforms = tmp;
+ }
+ }
+ free((void*)reference);
+ reference = NULL;
+}
+
+static void _ri_free_signedinfo(signedinfo_x *signedinfo)
+{
+ if (signedinfo == NULL)
+ return;
+ if (signedinfo->cannonicalizationmethod) {
+ cannonicalizationmethod_x *cannonicalizationmethod = signedinfo->cannonicalizationmethod;
+ cannonicalizationmethod_x *tmp = NULL;
+ while(cannonicalizationmethod != NULL) {
+ tmp = cannonicalizationmethod->next;
+ _ri_free_cannonicalizationmethod(cannonicalizationmethod);
+ cannonicalizationmethod = tmp;
+ }
+ }
+ if (signedinfo->signaturemethod) {
+ signaturemethod_x *signaturemethod = signedinfo->signaturemethod;
+ signaturemethod_x *tmp = NULL;
+ while(signaturemethod != NULL) {
+ tmp = signaturemethod->next;
+ _ri_free_signaturemethod(signaturemethod);
+ signaturemethod = tmp;
+ }
+ }
+ if (signedinfo->reference) {
+ reference_x *reference = signedinfo->reference;
+ reference_x *tmp = NULL;
+ while(reference != NULL) {
+ tmp = reference->next;
+ _ri_free_reference(reference);
+ reference = tmp;
+ }
+ }
+ free((void*)signedinfo);
+ signedinfo = NULL;
+}
+
+void _ri_free_signature_xml(signature_x *sigx)
+{
+ if (sigx == NULL)
+ return;
+ if (sigx->id) {
+ free((void *)sigx->id);
+ sigx->id = NULL;
+ }
+ if (sigx->xmlns) {
+ free((void *)sigx->xmlns);
+ sigx->xmlns = NULL;
+ }
+ if (sigx->signedinfo) {
+ signedinfo_x *signedinfo = sigx->signedinfo;
+ signedinfo_x *tmp = NULL;
+ while(signedinfo != NULL) {
+ tmp = signedinfo->next;
+ _ri_free_signedinfo(signedinfo);
+ signedinfo = tmp;
+ }
+ }
+ if (sigx->signaturevalue) {
+ signaturevalue_x *signaturevalue = sigx->signaturevalue;
+ signaturevalue_x *tmp = NULL;
+ while(signaturevalue != NULL) {
+ tmp = signaturevalue->next;
+ _ri_free_signaturevalue(signaturevalue);
+ signaturevalue = tmp;
+ }
+ }
+ if (sigx->keyinfo) {
+ keyinfo_x *keyinfo = sigx->keyinfo;
+ keyinfo_x *tmp = NULL;
+ while(keyinfo != NULL) {
+ tmp = keyinfo->next;
+ _ri_free_keyinfo(keyinfo);
+ keyinfo = tmp;
+ }
+ }
+ /*Object will be freed when it will be parsed in future*/
+ free((void*)sigx);
+ sigx = NULL;
+}
+
+static int _ri_process_digestmethod(xmlTextReaderPtr reader, digestmethod_x *digestmethod)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")))
+ digestmethod->algorithm = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")));
+ return 0;
+}
+
+static int _ri_process_digestvalue(xmlTextReaderPtr reader, digestvalue_x *digestvalue)
+{
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ digestvalue->text = ASCII(xmlTextReaderValue(reader));
+ return 0;
+}
+
+static int _ri_process_transform(xmlTextReaderPtr reader, transform_x *transform)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")))
+ transform->algorithm = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")));
+ return 0;
+}
+
+static int _ri_process_transforms(xmlTextReaderPtr reader, transforms_x *transforms)
+{
+ const xmlChar *node = NULL;
+ int ret = 0;
+ int depth = 0;
+ transform_x *tmp1 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = _ri_next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "node is NULL\n");
+ return -1;
+ }
+ if (strcmp(ASCII(node), "Transform") == 0) {
+ transform_x *transform = calloc(1, sizeof(transform_x));
+ if (transform == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(transforms->transform, transform);
+ ret = _ri_process_transform(reader, transform);
+ } else {
+ // _d_msg(DEBUG_INFO, "Invalid tag %s", ASCII(node));
+ return -1;
+ }
+ if (ret < 0)
+ return ret;
+ }
+ if (transforms->transform) {
+ LISTHEAD(transforms->transform, tmp1);
+ transforms->transform = tmp1;
+ }
+ return ret;
+}
+
+static int _ri_process_cannonicalizationmethod(xmlTextReaderPtr reader, cannonicalizationmethod_x *cannonicalizationmethod)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")))
+ cannonicalizationmethod->algorithm = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")));
+ return 0;
+}
+
+static int _ri_process_signaturemethod(xmlTextReaderPtr reader, signaturemethod_x *signaturemethod)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")))
+ signaturemethod->algorithm = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("Algorithm")));
+ return 0;
+}
+
+static int _ri_process_reference(xmlTextReaderPtr reader, reference_x *reference)
+{
+ const xmlChar *node = NULL;
+ int ret = 0;
+ int depth = 0;
+ digestmethod_x *tmp1 = NULL;
+ digestvalue_x *tmp2 = NULL;
+ transforms_x *tmp3 = NULL;
+
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("URI")))
+ reference->uri = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("URI")));
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = _ri_next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "node is NULL\n");
+ return -1;
+ }
+ if (strcmp(ASCII(node), "DigestMethod") == 0) {
+ digestmethod_x *digestmethod = calloc(1, sizeof(digestmethod_x));
+ if (digestmethod == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(reference->digestmethod, digestmethod);
+ ret = _ri_process_digestmethod(reader, digestmethod);
+ } else if (strcmp(ASCII(node), "DigestValue") == 0) {
+ digestvalue_x *digestvalue = calloc(1, sizeof(digestvalue_x));
+ if (digestvalue == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(reference->digestvalue, digestvalue);
+ ret = _ri_process_digestvalue(reader, digestvalue);
+ } else if (strcmp(ASCII(node), "Transforms") == 0) {
+ transforms_x *transforms = calloc(1, sizeof(transforms_x));
+ if (transforms == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(reference->transforms, transforms);
+ ret = _ri_process_transforms(reader, transforms);
+ } else {
+ // _d_msg(DEBUG_INFO, "Invalid tag %s", ASCII(node));
+ return -1;
+ }
+ if (ret < 0)
+ return ret;
+ }
+ if (reference->digestmethod) {
+ LISTHEAD(reference->digestmethod, tmp1);
+ reference->digestmethod = tmp1;
+ }
+ if (reference->digestvalue) {
+ LISTHEAD(reference->digestvalue, tmp2);
+ reference->digestvalue = tmp2;
+ }
+ if (reference->transforms) {
+ LISTHEAD(reference->transforms, tmp3);
+ reference->transforms = tmp3;
+ }
+ return ret;
+}
+
+static int _ri_process_x509certificate(xmlTextReaderPtr reader, x509certificate_x *x509certificate)
+{
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader)) {
+ x509certificate->text = ASCII(xmlTextReaderValue(reader));
+ // _d_msg(DEBUG_INFO, "certlen=%d, x509certificate : %s", strlen(x509certificate->text), x509certificate->text);
+ }
+ return 0;
+}
+
+static int _ri_process_x509data(xmlTextReaderPtr reader, x509data_x *x509data)
+{
+ const xmlChar *node = NULL;
+ int ret = 0;
+ int depth = 0;
+ x509certificate_x *tmp1 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = _ri_next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "node is NULL\n");
+ return -1;
+ }
+ if (strcmp(ASCII(node), "X509Certificate") == 0) {
+ x509certificate_x *x509certificate = calloc(1, sizeof(x509certificate_x));
+ if (x509certificate == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(x509data->x509certificate, x509certificate);
+ ret = _ri_process_x509certificate(reader, x509certificate);
+ } else {
+ // _d_msg(DEBUG_INFO, "Invalid tag %s", ASCII(node));
+ return -1;
+ }
+ if (ret < 0)
+ return ret;
+ }
+ if (x509data->x509certificate) {
+ LISTHEAD(x509data->x509certificate, tmp1);
+ x509data->x509certificate = tmp1;
+ }
+ return ret;
+}
+
+#if 0
+static int _ri_process_object(xmlTextReaderPtr reader, object_x *object)
+{
+ /*To be parsed later*/
+ return 0;
+}
+#endif
+
+static int _ri_process_keyinfo(xmlTextReaderPtr reader, keyinfo_x *keyinfo)
+{
+ const xmlChar *node = NULL;
+ int ret = 0;
+ int depth = 0;
+ x509data_x *tmp1 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = _ri_next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "node is NULL\n");
+ return -1;
+ }
+ if (strcmp(ASCII(node), "X509Data") == 0) {
+ x509data_x *x509data = calloc(1, sizeof(x509data_x));
+ if (x509data == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(keyinfo->x509data, x509data);
+ ret = _ri_process_x509data(reader, x509data);
+ } else {
+ // _d_msg(DEBUG_INFO, "Invalid tag %s", ASCII(node));
+ return -1;
+ }
+ if (ret < 0)
+ return ret;
+ }
+ if (keyinfo->x509data) {
+ LISTHEAD(keyinfo->x509data, tmp1);
+ keyinfo->x509data = tmp1;
+ }
+ return ret;
+}
+
+static int _ri_process_signaturevalue(xmlTextReaderPtr reader, signaturevalue_x *signaturevalue)
+{
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader)) {
+ signaturevalue->text = ASCII(xmlTextReaderValue(reader));
+ // _d_msg(DEBUG_INFO, "siglen=%d SignatureValue %s", strlen(signaturevalue->text), signaturevalue->text);
+ }
+ return 0;
+}
+
+static int _ri_process_signedinfo(xmlTextReaderPtr reader, signedinfo_x *signedinfo)
+{
+ const xmlChar *node = NULL;
+ int ret = 0;
+ int depth = 0;
+ cannonicalizationmethod_x *tmp1 = NULL;
+ signaturemethod_x *tmp2 = NULL;
+ reference_x *tmp3 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = _ri_next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "node is NULL\n");
+ return -1;
+ }
+ if (strcmp(ASCII(node), "CanonicalizationMethod") == 0) {
+ cannonicalizationmethod_x *cannonicalizationmethod = calloc(1, sizeof(cannonicalizationmethod_x));
+ if (cannonicalizationmethod == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(signedinfo->cannonicalizationmethod, cannonicalizationmethod);
+ ret = _ri_process_cannonicalizationmethod(reader, cannonicalizationmethod);
+ } else if (strcmp(ASCII(node), "SignatureMethod") == 0) {
+ signaturemethod_x *signaturemethod = calloc(1, sizeof(signaturemethod_x));
+ if (signaturemethod == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(signedinfo->signaturemethod, signaturemethod);
+ ret = _ri_process_signaturemethod(reader, signaturemethod);
+ } else if (strcmp(ASCII(node), "Reference") == 0) {
+ reference_x *reference = calloc(1, sizeof(reference_x));
+ if (reference == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(signedinfo->reference, reference);
+ ret = _ri_process_reference(reader, reference);
+ } else {
+ // _d_msg(DEBUG_INFO, "Invalid tag %s", ASCII(node));
+ return -1;
+ }
+ if (ret < 0)
+ return ret;
+ }
+ if (signedinfo->cannonicalizationmethod) {
+ LISTHEAD(signedinfo->cannonicalizationmethod, tmp1);
+ signedinfo->cannonicalizationmethod = tmp1;
+ }
+ if (signedinfo->signaturemethod) {
+ LISTHEAD(signedinfo->signaturemethod, tmp2);
+ signedinfo->signaturemethod = tmp2;
+ }
+ if (signedinfo->reference) {
+ LISTHEAD(signedinfo->reference, tmp3);
+ signedinfo->reference = tmp3;
+ }
+ return ret;
+}
+
+static int _ri_process_sign(xmlTextReaderPtr reader, signature_x *sigx)
+{
+ const xmlChar *node = NULL;
+ int ret = 0;
+ int depth = 0;
+ signedinfo_x *tmp1 = NULL;
+ signaturevalue_x *tmp2 = NULL;
+ keyinfo_x *tmp3 = NULL;
+ object_x *tmp4 = NULL;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = _ri_next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "node is NULL\n");
+ return -1;
+ }
+ if (strcmp(ASCII(node), "SignedInfo") == 0) {
+ signedinfo_x *signedinfo = calloc(1, sizeof(signedinfo_x));
+ if (signedinfo == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(sigx->signedinfo, signedinfo);
+ ret = _ri_process_signedinfo(reader, signedinfo);
+ } else if (strcmp(ASCII(node), "SignatureValue") == 0) {
+ signaturevalue_x *signaturevalue = calloc(1, sizeof(signaturevalue_x));
+ if (signaturevalue == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(sigx->signaturevalue, signaturevalue);
+ ret = _ri_process_signaturevalue(reader, signaturevalue);
+ } else if (strcmp(ASCII(node), "KeyInfo") == 0) {
+ keyinfo_x *keyinfo = calloc(1, sizeof(keyinfo_x));
+ if (keyinfo == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(sigx->keyinfo, keyinfo);
+ ret = _ri_process_keyinfo(reader, keyinfo);
+ } else if (strcmp(ASCII(node), "Object") == 0) {
+ /*
+ object_x *object = calloc(1, sizeof(object_x));
+ if (object == NULL) {
+ // _d_msg(DEBUG_ERR, "Calloc Failed\n");
+ return -1;
+ }
+ LISTADD(sigx->object, object);
+ ret = _ri_process_object(reader, object);
+ */
+ continue;
+ } else {
+ // _d_msg(DEBUG_INFO, "Invalid tag %s", ASCII(node));
+ return -1;
+ }
+ if (ret < 0)
+ return ret;
+ }
+ if (sigx->signedinfo) {
+ LISTHEAD(sigx->signedinfo, tmp1);
+ sigx->signedinfo = tmp1;
+ }
+ if (sigx->signaturevalue) {
+ LISTHEAD(sigx->signaturevalue, tmp2);
+ sigx->signaturevalue = tmp2;
+ }
+ if (sigx->keyinfo) {
+ LISTHEAD(sigx->keyinfo, tmp3);
+ sigx->keyinfo = tmp3;
+ }
+ if (sigx->object) {
+ LISTHEAD(sigx->object, tmp4);
+ sigx->object = tmp4;
+ }
+ return ret;
+}
+
+static int _ri_process_signature(xmlTextReaderPtr reader, signature_x *sigx)
+{
+ const xmlChar *node = NULL;
+ int ret = -1;
+
+ if ((ret = _ri_next_child_element(reader, -1))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ // _d_msg(DEBUG_ERR, "Node is null");
+ return -1;
+ }
+ if (!strcmp(ASCII(node), "Signature")) {
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("Id")))
+ sigx->id = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("Id")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("xmlns")))
+ sigx->xmlns = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("xmlns")));
+ ret = _ri_process_sign(reader, sigx);
+ } else {
+ // _d_msg(DEBUG_ERR, "No Signature element found\n");
+ return -1;
+ }
+ }
+ return ret;
+}
+
+signature_x *_ri_process_signature_xml(const char *signature_file)
+{
+ xmlTextReaderPtr reader;
+ signature_x *sigx = NULL;
+
+ reader = xmlReaderForFile(signature_file, NULL, 0);
+
+ if (reader) {
+ sigx = calloc(1, sizeof(signature_x));
+ if (sigx) {
+ if (_ri_process_signature(reader, sigx) < 0) {
+ /* error in parsing. Let's display some hint where we failed */
+ // _d_msg(DEBUG_ERR, "Syntax error in processing signature in the above line\n");
+ _ri_free_signature_xml(sigx);
+ xmlFreeTextReader(reader);
+ return NULL;
+ }
+ } else {
+ // _d_msg(DEBUG_ERR, "Calloc failed\n");
+ }
+ xmlFreeTextReader(reader);
+ } else {
+ // _d_msg(DEBUG_ERR, "Unable to create xml reader\n");
+ }
+ return sigx;
+}
+
+int __ps_verify_sig_and_cert(const char *sigfile, char *signature)
+{
+ char certval[BUFMAX] = { '\0'};
+ int i = 0;
+ int j= 0;
+ int ret = PM_MDM_R_OK;
+ signature_x *signx = NULL;
+ struct keyinfo_x *keyinfo = NULL;
+ struct x509data_x *x509data = NULL;
+
+ signx = _ri_process_signature_xml(sigfile);
+ retvm_if(signx == NULL, PM_MDM_R_OK, "Parsing %s failed", sigfile);
+
+ keyinfo = signx->keyinfo;
+ tryvm_if(keyinfo == NULL, ret = PM_MDM_R_OK, "Certificates missing in %s", sigfile);
+ tryvm_if(keyinfo->x509data == NULL, ret = PM_MDM_R_OK, "x509data missing in %s", sigfile);
+ tryvm_if(keyinfo->x509data->x509certificate == NULL, ret = PM_MDM_R_OK, "x509certificate missing in %s", sigfile);
+
+ x509data = keyinfo->x509data;
+ x509certificate_x *cert = x509data->x509certificate;
+ if (cert->text != NULL) {
+ for (i = 0; i <= (int)strlen(cert->text); i++) {
+ if (cert->text[i] != '\n') {
+ certval[j++] = cert->text[i];
+ }
+ }
+ certval[j] = '\0';
+ _LOGE("strlen[%d] cert_svc_load_buf_to_context() load %s", strlen(certval), certval);
+
+ /*First cert is Signer certificate and check it with signature*/
+ tryvm_if(strcmp(certval, signature)==0, ret = PM_MDM_R_ERROR, "signature is blacklist !!\n");
+ }
+
+catch:
+ _ri_free_signature_xml(signx);
+ signx = NULL;
+ return ret;
+}
+
+static int __ps_check_signature_blacklist(manifest_x * mfx, char *signature)
+{
+ int ret = 0;
+ char buff[PKG_STRING_LEN_MAX] = {'\0'};
+
+ retvm_if(mfx == NULL, PM_MDM_R_OK, "Manifest pointer is NULL");
+ retvm_if(signature == NULL, PM_MDM_R_OK, "signature pointer is NULL");
+
+ snprintf(buff, PKG_STRING_LEN_MAX, "%s/author-signature.xml", mfx->root_path);
+
+ if (access(buff, F_OK) == 0) {
+ ret = __ps_verify_sig_and_cert(buff, signature);
+ retvm_if(ret == PM_MDM_R_ERROR, PM_MDM_R_ERROR, "Failed to verify [%s]", buff);
+ } else {
+ _LOGE("No author-signature.xml file found[%s]\n", buff);
+ return PM_MDM_R_OK;
+ }
+
+ return PM_MDM_R_OK;
+}
+
+
+static int __ps_check_privilege_blacklist(manifest_x * mfx, char *privlege)
+{
+ retvm_if(mfx == NULL, PM_MDM_R_OK, "Manifest pointer is NULL");
+ retvm_if(privlege == NULL, PM_MDM_R_OK, "privlege pointer is NULL");
+
+ privileges_x *pvs = NULL;
+ privilege_x *pv = NULL;
+
+ pvs = mfx->privileges;
+ while (pvs != NULL) {
+ pv = pvs->privilege;
+ while (pv != NULL) {
+ if (strcmp(pv->text, privlege)==0) {
+ _LOGE("privilege[%s] is blacklist\n", pv->text);
+ return PM_MDM_R_ERROR;
+ }
+ pv = pv->next;
+ }
+ pvs = pvs->next;
+ }
+
+ return PM_MDM_R_OK;
+}
+
+static int __ps_get_signature_blacklist(void *handle, manifest_x * mfx)
+{
+ retvm_if(mfx == NULL, PM_MDM_R_OK, "Manifest pointer is NULL");
+
+ int ret = PM_MDM_R_OK;
+ char *errmsg = NULL;
+
+ mdm_data_t *(*__mdm_get_app_signature_blacklist)(void) = NULL;
+ void (*__mdm_free_data)(mdm_data_t *data) = NULL;
+
+ __mdm_get_app_signature_blacklist = dlsym(handle, "mdm_get_app_signature_blacklist");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_get_app_signature_blacklist == NULL), ret = PM_MDM_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ __mdm_free_data = dlsym(handle, "mdm_free_data");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_free_data == NULL), ret = PM_MDM_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+
+ mdm_data_t *lp_data = __mdm_get_app_signature_blacklist();
+ if (lp_data){
+ GList *blacklist = (GList *)lp_data->data;
+ while(blacklist) {
+ char *signature = (char *)blacklist->data;
+ /*check signature and block installation*/
+ if (__ps_check_signature_blacklist(mfx, signature) == PM_MDM_R_ERROR) {
+ __mdm_free_data(lp_data);
+ return PM_MDM_R_ERROR;
+ }
+ blacklist = g_list_next(blacklist);
+ }
+ __mdm_free_data(lp_data);
+ }
+
+catch:
+ return ret;
+}
+
+static int __ps_get_privilege_blacklist(void *handle, manifest_x * mfx)
+{
+ retvm_if(mfx == NULL, PM_MDM_R_OK, "Manifest pointer is NULL");
+
+ int ret = PM_MDM_R_OK;
+ char *errmsg = NULL;
+
+ mdm_data_t *(*__mdm_get_app_privilege_blacklist)(void) = NULL;
+ void (*__mdm_free_data)(mdm_data_t *data) = NULL;
+
+ /*get MDM symbol*/
+ __mdm_get_app_privilege_blacklist = dlsym(handle, "mdm_get_app_privilege_blacklist");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_get_app_privilege_blacklist == NULL), ret = PM_MDM_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ __mdm_free_data = dlsym(handle, "mdm_free_data");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_free_data == NULL), ret = PM_MDM_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ /*check list*/
+ mdm_data_t *lp_data = __mdm_get_app_privilege_blacklist();
+ if (lp_data){
+ GList *blacklist = (GList *)lp_data->data;
+ while(blacklist) {
+ char *privlege = (char *)blacklist->data;
+ /*check privilege and block installation*/
+ if (__ps_check_privilege_blacklist(mfx, privlege) == PM_MDM_R_ERROR) {
+ __mdm_free_data(lp_data);
+ return PM_MDM_R_ERROR;
+ }
+ blacklist = g_list_next(blacklist);
+ }
+ __mdm_free_data(lp_data);
+ }
+
+catch:
+ return ret;
+}
+
+int __ps_check_mdm_policy(manifest_x * mfx, MDM_ACTION_TYPE action)
+{
+ int ret = PM_MDM_R_OK;
+ retvm_if(mfx == NULL, PM_MDM_R_OK, "Manifest pointer is NULL");
+
+ char *errmsg = NULL;
+ void *handle = NULL;
+
+ mdm_result_t (*__mdm_get_service)(void) = NULL;
+ int (*__mdm_release_service)(void) = NULL;
+ mdm_status_t (*__mdm_get_application_installation_disabled)(const char *app_name) = NULL;
+ mdm_status_t (*__mdm_get_application_uninstallation_disabled)(const char *app_name) = NULL;
+
+ /*get MDM symbol*/
+ handle = dlopen(LIBMDM_PATH, RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, PM_MDM_R_OK, "dlopen() failed. [%s]", dlerror());
+
+ __mdm_get_service = dlsym(handle, "mdm_get_service");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_get_service == NULL), ret = PM_MDM_R_OK, "dlsym() failed. [%s]", errmsg);
+
+ __mdm_release_service = dlsym(handle, "mdm_release_service");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_release_service == NULL), ret = PM_MDM_R_OK, "dlsym() failed. [%s]", errmsg);
+
+ __mdm_get_application_installation_disabled = dlsym(handle, "mdm_get_application_installation_disabled");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_get_application_installation_disabled == NULL), ret = PM_MDM_R_OK, "dlsym() failed. [%s]", errmsg);
+
+ __mdm_get_application_uninstallation_disabled = dlsym(handle, "mdm_get_application_uninstallation_disabled");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__mdm_get_application_uninstallation_disabled == NULL), ret = PM_MDM_R_OK, "dlsym() failed. [%s]", errmsg);
+
+
+ /*connect MDM server*/
+ ret = __mdm_get_service();
+ tryvm_if(ret != MDM_RESULT_SUCCESS, ret = PM_MDM_R_OK, "can not connect mdm server");
+
+ /*MDM server check disabled case*/
+ switch (action) {
+ case MDM_ACTION_INSTALL:
+ ret = __mdm_get_application_installation_disabled(mfx->package);
+ break;
+ case MDM_ACTION_UNINSTALL:
+ ret = __mdm_get_application_uninstallation_disabled(mfx->package);
+ break;
+ default:
+ _LOGE("action type is not defined\n");
+ dlclose(handle);
+ return PM_MDM_R_OK;
+ }
+ tryvm_if(ret == MDM_DISABLED, ret = PM_MDM_R_ERROR, "pkgmgr parser[%d] is disabled by mdm", action);
+
+#ifdef MDM_PHASE_2
+ /*MDM server check privilege_blacklist*/
+ ret = __ps_get_privilege_blacklist(handle, mfx);
+ tryvm_if(ret == PM_MDM_R_ERROR, ret = PM_MDM_R_ERROR, "pkg[%s] has privilege blacklist", mfx->package);
+
+ /*MDM server check signature_blacklist*/
+ ret = __ps_get_signature_blacklist(handle, mfx);
+ tryvm_if(ret == PM_MDM_R_ERROR, ret = PM_MDM_R_ERROR, "pkg[%s] has signature blacklist", mfx->package);
+#endif
+
+ /*release MDM server*/
+ __mdm_release_service();
+
+catch:
+
+ dlclose(handle);
+
+ return ret;
+}
+
--- /dev/null
+/*
+ * rpm-installer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __PKGMGR_PARSER_SIGNATURE_H_
+#define __PKGMGR_PARSER_SIGNATURE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct transform_x {
+ const char *algorithm;
+ struct transform_x *prev;
+ struct transform_x *next;
+} transform_x;
+
+typedef struct digestmethod_x {
+ const char *algorithm;
+ struct digestmethod_x *prev;
+ struct digestmethod_x *next;
+} digestmethod_x;
+
+typedef struct digestvalue_x {
+ const char *text;
+ struct digestvalue_x *prev;
+ struct digestvalue_x *next;
+} digestvalue_x;
+
+typedef struct transforms_x {
+ struct transform_x *transform;
+ struct transforms_x *prev;
+ struct transforms_x *next;
+} transforms_x;
+
+typedef struct x509certificate_x {
+ const char *text;
+ struct x509certificate_x *prev;
+ struct x509certificate_x *next;
+} x509certificate_x;
+
+typedef struct reference_x {
+ const char *uri;
+ struct transforms_x *transforms;
+ struct digestmethod_x *digestmethod;
+ struct digestvalue_x *digestvalue;
+ struct reference_x *prev;
+ struct reference_x *next;
+} reference_x;
+
+typedef struct cannonicalizationmethod_x {
+ const char *algorithm;
+ struct cannonicalizationmethod_x *prev;
+ struct cannonicalizationmethod_x *next;
+} cannonicalizationmethod_x;
+
+typedef struct signaturemethod_x {
+ const char *algorithm;
+ struct signaturemethod_x *prev;
+ struct signaturemethod_x *next;
+} signaturemethod_x;
+
+typedef struct x509data_x {
+ x509certificate_x *x509certificate;
+ struct x509data_x *prev;
+ struct x509data_x *next;
+} x509data_x;
+
+typedef struct signedinfo_x {
+ struct cannonicalizationmethod_x *cannonicalizationmethod;
+ struct signaturemethod_x *signaturemethod;
+ struct reference_x *reference;
+ struct signedinfo_x *prev;
+ struct signedinfo_x *next;
+} signedinfo_x;
+
+typedef struct signaturevalue_x {
+ const char *text;
+ struct signaturevalue_x *prev;
+ struct signaturevalue_x *next;
+} signaturevalue_x;
+
+typedef struct keyinfo_x {
+ struct x509data_x *x509data;
+ struct keyinfo_x *prev;
+ struct keyinfo_x *next;
+} keyinfo_x;
+
+/*This will be parsed later when requirement arises*/
+typedef struct object_x {
+ const char *id;
+ struct object_x *prev;
+ struct object_x *next;
+} object_x;
+
+typedef struct signature_x { /*signature xml*/
+ const char *id; /* distributor or author sign*/
+ const char *xmlns; /* namespace*/
+ struct signedinfo_x *signedinfo; /*signature data*/
+ struct signaturevalue_x *signaturevalue; /* signature value*/
+ struct keyinfo_x *keyinfo; /*cert info*/
+ struct object_x *object; /*other parameters in object tag*/
+} signature_x;
+
+
+/* operation_type */
+typedef enum {
+ MDM_ACTION_INSTALL = 0,
+ MDM_ACTION_UPGRADE,
+ MDM_ACTION_UNINSTALL,
+ MDM_ACTION_FOTA,
+ MDM_ACTION_MAX
+} MDM_ACTION_TYPE;
+
+enum {
+ PM_MDM_R_EINVAL = -2, /**< Invalid argument */
+ PM_MDM_R_ERROR = -1, /**< General error */
+ PM_MDM_R_OK = 0 /**< General success */
+};
+
+int __ps_check_mdm_policy(manifest_x * mfx, MDM_ACTION_TYPE action);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __PKGMGR_PARSER_SIGNATURE_H_ */
--- /dev/null
+#RW_NORM
+com.samsung.ag-hello
+com.samsung.app-tray
+com.samsung.bluetooth-share-ui
+com.samsung.bluetooth
+com.samsung.browser
+com.samsung.bt-appsvc
+com.samsung.bt-syspopup
+com.samsung.calculator
+com.samsung.calendar-viewer
+com.samsung.calendar
+com.samsung.call-eq-analyzer
+com.samsung.call
+com.samsung.camera-app
+com.samsung.ciss
+com.samsung.clock
+com.samsung.cluster-home
+com.samsung.contacts-viewer
+com.samsung.contacts
+com.samsung.dailybriefing-accuweather
+com.samsung.dailybriefing-agent
+com.samsung.dailybriefing-ynews
+com.samsung.dailybriefing-yfinance
+com.samsung.data-provider-slave
+com.samsung.download-provider
+com.samsung.draglock
+com.samsung.eas-appsvc
+com.samsung.email
+com.samsung.ereader
+com.samsung.facebook-service
+com.samsung.facebook
+com.samsung.fileshare-service
+com.samsung.fm-radio
+com.samsung.gallery
+com.samsung.idle-lock
+com.samsung.image-editor
+com.samsung.image-viewer
+com.samsung.keystrings
+com.samsung.kies-via-wifi
+com.samsung.livebox-3d-lock
+com.samsung.lowbat-syspopup
+com.samsung.lowmem-syspopup
+com.samsung.mdm-app
+com.samsung.mdm-syspopup
+com.samsung.memo
+com.samsung.menu-screen
+com.samsung.message
+com.samsung.mobileprint
+com.samsung.msg-ui-class0
+com.samsung.music-player
+com.samsung.myfile
+com.samsung.nfc-app
+com.samsung.phone-lock
+com.samsung.phone
+com.samsung.picasa
+com.samsung.poweroff-syspopup
+com.samsung.pwlock
+com.samsung.ring
+com.samsung.setting
+com.samsung.smartsearch
+com.samsung.sound-player
+com.samsung.system-panel
+com.samsung.taskmgr
+com.samsung.tethering
+com.samsung.tickernoti-syspopup
+com.samsung.usb-printer-detector
+com.samsung.usbotg-syspopup
+com.samsung.voicerecorder
+com.samsung.volume
+com.samsung.vtmain
+com.samsung.wifi-direct-popup
+com.samsung.wifi-direct-ugapp
+com.samsung.youtube
+activesync-ui
+com.samsung.rcs-im
+com.samsung.ims-syspopup
+aospd00043
+cp7ipabg4k
+57r43275q7
+q7097a278m
+800ij447xl
+70lsyzhkse
+nas9xepmna
+
+#RW_RM
+com.samsung.video-player
+com.samsung.spotify
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:packages="http://tizen.org/ns/packages">
+ <xs:import namespace="http://tizen.org/ns/packages" schemaLocation="manifest.xsd"/>
+ <xs:attribute name="lang" type="xs:NCName"/>
+</xs:schema>
--- /dev/null
+# usage
+# parserlib:directory_path
+
+parserlib:/usr/etc/package-manager/parserlib/
+metadataparser:/usr/etc/package-manager/parserlib/metadata/
+categoryparser:/usr/etc/package-manager/parserlib/category/
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr-info"/>
+ </define>
+ <request>
+ <domain name="pkgmgr-info"/>
+ </request>
+ <assign>
+ <filesystem path="@LIB_INSTALL_DIR@/libpkgmgr-info.*" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+# Package Information for pkg-config
+
+prefix=/usr
+exec_prefix=${prefix}
+libdir=@LIB_INSTALL_DIR@
+includedir=${prefix}/include
+
+Name: pkgmgr-info
+Description: Simple string key/val dictionary library
+Version: @VERSION@
+Libs: -L${libdir} -lpkgmgr-info
+Cflags: -I${includedir}
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr-parser"/>
+ </define>
+ <request>
+ <domain name="pkgmgr-parser"/>
+ </request>
+ <assign>
+ <filesystem path="@LIB_INSTALL_DIR@/libpkgmgr_parser.so.0" label="_"/>
+ <filesystem path="@LIB_INSTALL_DIR@/libpkgmgr_parser.so.0.1.0" label="_"/>
+ <filesystem path="@LIB_INSTALL_DIR@/libpkgmgr_parser_lib_sample.so" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "pkgmgr-info.h"
+#include "pkgmgr-info-internal.h"
+
+struct _pkginfo_str_map_t {
+ pkgmgrinfo_pkginfo_filter_prop_str prop;
+ const char *property;
+};
+
+static struct _pkginfo_str_map_t pkginfo_str_prop_map[] = {
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_ID, PMINFO_PKGINFO_PROP_PACKAGE_ID},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE, PMINFO_PKGINFO_PROP_PACKAGE_TYPE},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION, PMINFO_PKGINFO_PROP_PACKAGE_VERSION},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION,PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE,PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME, PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL, PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF, PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF}
+};
+
+struct _pkginfo_int_map_t {
+ pkgmgrinfo_pkginfo_filter_prop_int prop;
+ const char *property;
+};
+
+static struct _pkginfo_int_map_t pkginfo_int_prop_map[] = {
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE, PMINFO_PKGINFO_PROP_PACKAGE_SIZE}
+};
+
+struct _pkginfo_bool_map_t {
+ pkgmgrinfo_pkginfo_filter_prop_bool prop;
+ const char *property;
+};
+
+static struct _pkginfo_bool_map_t pkginfo_bool_prop_map[] = {
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY, PMINFO_PKGINFO_PROP_PACKAGE_READONLY},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE, PMINFO_PKGINFO_PROP_PACKAGE_UPDATE},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING, PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING, PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING}
+};
+
+struct _appinfo_str_map_t {
+ pkgmgrinfo_appinfo_filter_prop_str prop;
+ const char *property;
+};
+
+static struct _appinfo_str_map_t appinfo_str_prop_map[] = {
+ {E_PMINFO_APPINFO_PROP_APP_ID, PMINFO_APPINFO_PROP_APP_ID},
+ {E_PMINFO_APPINFO_PROP_APP_COMPONENT, PMINFO_APPINFO_PROP_APP_COMPONENT},
+ {E_PMINFO_APPINFO_PROP_APP_EXEC, PMINFO_APPINFO_PROP_APP_EXEC},
+ {E_PMINFO_APPINFO_PROP_APP_ICON, PMINFO_APPINFO_PROP_APP_ICON},
+ {E_PMINFO_APPINFO_PROP_APP_TYPE, PMINFO_APPINFO_PROP_APP_TYPE},
+ {E_PMINFO_APPINFO_PROP_APP_OPERATION, PMINFO_APPINFO_PROP_APP_OPERATION},
+ {E_PMINFO_APPINFO_PROP_APP_URI, PMINFO_APPINFO_PROP_APP_URI},
+ {E_PMINFO_APPINFO_PROP_APP_MIME, PMINFO_APPINFO_PROP_APP_MIME},
+ {E_PMINFO_APPINFO_PROP_APP_CATEGORY, PMINFO_APPINFO_PROP_APP_CATEGORY},
+ {E_PMINFO_APPINFO_PROP_APP_HWACCELERATION, PMINFO_APPINFO_PROP_APP_HWACCELERATION},
+ {E_PMINFO_APPINFO_PROP_APP_SCREENREADER, PMINFO_APPINFO_PROP_APP_SCREENREADER}
+};
+
+struct _appinfo_int_map_t {
+ pkgmgrinfo_appinfo_filter_prop_int prop;
+ const char *property;
+};
+
+static struct _appinfo_int_map_t appinfo_int_prop_map[] = {
+ /*Currently No Fields*/
+};
+
+struct _appinfo_bool_map_t {
+ pkgmgrinfo_appinfo_filter_prop_bool prop;
+ const char *property;
+};
+
+static struct _appinfo_bool_map_t appinfo_bool_prop_map[] = {
+ {E_PMINFO_APPINFO_PROP_APP_NODISPLAY, PMINFO_APPINFO_PROP_APP_NODISPLAY},
+ {E_PMINFO_APPINFO_PROP_APP_MULTIPLE, PMINFO_APPINFO_PROP_APP_MULTIPLE},
+ {E_PMINFO_APPINFO_PROP_APP_ONBOOT, PMINFO_APPINFO_PROP_APP_ONBOOT},
+ {E_PMINFO_APPINFO_PROP_APP_AUTORESTART, PMINFO_APPINFO_PROP_APP_AUTORESTART},
+ {E_PMINFO_APPINFO_PROP_APP_TASKMANAGE, PMINFO_APPINFO_PROP_APP_TASKMANAGE},
+ {E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION, PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION}
+};
+
+inline int _pkgmgrinfo_validate_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ int *p = (int*)data;
+ *p = atoi(coltxt[0]);
+ return 0;
+}
+
+inline pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property)
+{
+ int i = 0;
+ int max = 0;
+ pkgmgrinfo_pkginfo_filter_prop_str prop = -1;
+
+ if (property == NULL)
+ return -1;
+ max = E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_STR - E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR + 1;
+ for (i = 0 ; i < max; i++) {
+ if (strcmp(property, pkginfo_str_prop_map[i].property) == 0) {
+ prop = pkginfo_str_prop_map[i].prop;
+ break;
+ }
+ }
+ return prop;
+}
+
+inline pkgmgrinfo_pkginfo_filter_prop_int _pminfo_pkginfo_convert_to_prop_int(const char *property)
+{
+ int i = 0;
+ int max = 0;
+ pkgmgrinfo_pkginfo_filter_prop_int prop = -1;
+
+ if (property == NULL)
+ return -1;
+ max = E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_INT - E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT + 1;
+ for (i = 0 ; i < max; i++) {
+ if (strcmp(property, pkginfo_int_prop_map[i].property) == 0) {
+ prop = pkginfo_int_prop_map[i].prop;
+ break;
+ }
+ }
+ return prop;
+}
+
+inline pkgmgrinfo_pkginfo_filter_prop_bool _pminfo_pkginfo_convert_to_prop_bool(const char *property)
+{
+ int i = 0;
+ int max = 0;
+ pkgmgrinfo_pkginfo_filter_prop_bool prop = -1;
+
+ if (property == NULL)
+ return -1;
+ max = E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL - E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL + 1;
+ for (i = 0 ; i < max; i++) {
+ if (strcmp(property, pkginfo_bool_prop_map[i].property) == 0) {
+ prop = pkginfo_bool_prop_map[i].prop;
+ break;
+ }
+ }
+ return prop;
+}
+
+inline pkgmgrinfo_appinfo_filter_prop_str _pminfo_appinfo_convert_to_prop_str(const char *property)
+{
+ int i = 0;
+ int max = 0;
+ pkgmgrinfo_appinfo_filter_prop_str prop = -1;
+
+ if (property == NULL)
+ return -1;
+ max = E_PMINFO_APPINFO_PROP_APP_MAX_STR - E_PMINFO_APPINFO_PROP_APP_MIN_STR + 1;
+ for (i = 0 ; i < max; i++) {
+ if (strcmp(property, appinfo_str_prop_map[i].property) == 0) {
+ prop = appinfo_str_prop_map[i].prop;
+ break;
+ }
+ }
+ return prop;
+}
+
+inline pkgmgrinfo_appinfo_filter_prop_int _pminfo_appinfo_convert_to_prop_int(const char *property)
+{
+ int i = 0;
+ int max = 0;
+ pkgmgrinfo_appinfo_filter_prop_int prop = -1;
+
+ if (property == NULL)
+ return -1;
+ max = E_PMINFO_APPINFO_PROP_APP_MAX_INT - E_PMINFO_APPINFO_PROP_APP_MIN_INT + 1;
+ for (i = 0 ; i < max; i++) {
+ if (strcmp(property, appinfo_int_prop_map[i].property) == 0) {
+ prop = appinfo_int_prop_map[i].prop;
+ break;
+ }
+ }
+ return prop;
+}
+
+inline pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property)
+{
+ int i = 0;
+ int max = 0;
+ pkgmgrinfo_appinfo_filter_prop_bool prop = -1;
+
+ if (property == NULL)
+ return -1;
+ max = E_PMINFO_APPINFO_PROP_APP_MAX_BOOL - E_PMINFO_APPINFO_PROP_APP_MIN_BOOL + 1;
+ for (i = 0 ; i < max; i++) {
+ if (strcmp(property, appinfo_bool_prop_map[i].property) == 0) {
+ prop = appinfo_bool_prop_map[i].prop;
+ break;
+ }
+ }
+ return prop;
+}
--- /dev/null
+/*
+ * pkgmgrinfo-appinfo
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Junsuk Oh <junsuk77.oh@samsung.com>,
+ *
+ * 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.
+ *
+ */
+
+#include "pkgmgrinfo_private.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_INFO"
+
+#define LANGUAGE_LENGTH 2
+
+#define FILTER_QUERY_LIST_APP "select DISTINCT package_app_info.app_id, package_app_info.app_component " \
+ "from package_app_info LEFT OUTER JOIN package_app_localized_info " \
+ "ON package_app_info.app_id=package_app_localized_info.app_id " \
+ "and package_app_localized_info.app_locale='%s' " \
+ "LEFT OUTER JOIN package_app_app_svc " \
+ "ON package_app_info.app_id=package_app_app_svc.app_id " \
+ "LEFT OUTER JOIN package_app_app_category " \
+ "ON package_app_info.app_id=package_app_app_category.app_id where "
+
+#define METADATA_FILTER_QUERY_SELECT_CLAUSE "select DISTINCT package_app_info.app_id, package_app_info.app_component " \
+ "from package_app_info LEFT OUTER JOIN package_app_app_metadata " \
+ "ON package_app_info.app_id=package_app_app_metadata.app_id where "
+
+#define METADATA_FILTER_QUERY_UNION_CLAUSE " UNION "METADATA_FILTER_QUERY_SELECT_CLAUSE
+
+typedef struct _pkgmgr_locale_x {
+ char *locale;
+} pkgmgr_locale_x;
+
+typedef struct _pkgmgrinfo_appcontrol_x {
+ int operation_count;
+ int uri_count;
+ int mime_count;
+ int subapp_count;
+ char **operation;
+ char **uri;
+ char **mime;
+ char **subapp;
+} pkgmgrinfo_appcontrol_x;
+
+
+/* get the first locale value*/
+static int __fallback_locale_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_locale_x *info = (pkgmgr_locale_x *)data;
+
+ if (ncols >= 1)
+ info->locale = strdup(coltxt[0]);
+ else
+ info->locale = NULL;
+
+ return 0;
+}
+
+static int __check_app_locale_from_app_localized_info_by_exact(sqlite3 *db, const char *appid, const char *locale)
+{
+ int result_query = -1;
+ int ret = 0;
+
+ char *query = sqlite3_mprintf("select exists(select app_locale from package_app_localized_info where app_id=%Q and app_locale=%Q)", appid, locale);
+ ret = __exec_db_query(db, query, _pkgmgrinfo_validate_cb, (void *)&result_query);
+ sqlite3_free(query);
+ retvm_if(ret == -1, PMINFO_R_ERROR, "Exec DB query failed");
+ return result_query;
+}
+
+static int __check_app_locale_from_app_localized_info_by_fallback(sqlite3 *db, const char *appid, const char *locale)
+{
+ int result_query = -1;
+ int ret = 0;
+ char wildcard[2] = {'%','\0'};
+ char lang[3] = {'\0'};
+ strncpy(lang, locale, LANGUAGE_LENGTH);
+
+ char *query = sqlite3_mprintf("select exists(select app_locale from package_app_localized_info where app_id=%Q and app_locale like %Q%Q)", appid, lang, wildcard);
+ ret = __exec_db_query(db, query, _pkgmgrinfo_validate_cb, (void *)&result_query);
+ sqlite3_free(query);
+ retvm_if(ret == -1, PMINFO_R_ERROR, "Exec DB query failed");
+ return result_query;
+}
+
+static char* __get_app_locale_from_app_localized_info_by_fallback(sqlite3 *db, const char *appid, const char *locale)
+{
+ int ret = 0;
+ char wildcard[2] = {'%','\0'};
+ char lang[3] = {'\0'};
+ char *locale_new = NULL;
+ pkgmgr_locale_x *info = NULL;
+
+ info = (pkgmgr_locale_x *)malloc(sizeof(pkgmgr_locale_x));
+ if (info == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return NULL;
+ }
+ memset(info, '\0', sizeof(*info));
+
+ strncpy(lang, locale, LANGUAGE_LENGTH);
+ char *query = sqlite3_mprintf("select app_locale from package_app_localized_info where app_id=%Q and app_locale like %Q%Q", appid, lang, wildcard);
+
+ ret = __exec_db_query(db, query, __fallback_locale_cb, (void *)info);
+ sqlite3_free(query);
+ if (ret < 0)
+ goto catch;
+
+ locale_new = info->locale;
+ free(info);
+ return locale_new;
+catch:
+ if (info) {
+ free(info);
+ info = NULL;
+ }
+ return NULL;
+}
+
+static char* __get_app_locale_by_fallback(sqlite3 *db, const char *appid)
+{
+ assert(appid);
+
+ char *locale = NULL;
+ char *locale_new = NULL;
+ int check_result = 0;
+
+ locale = __convert_system_locale_to_manifest_locale();
+
+ /*check exact matching */
+ check_result = __check_app_locale_from_app_localized_info_by_exact(db, appid, locale);
+
+ /* Exact found */
+ if (check_result == 1) {
+// _LOGD("%s find exact locale(%s)\n", appid, locale);
+ return locale;
+ }
+
+ /* fallback matching */
+ check_result = __check_app_locale_from_app_localized_info_by_fallback(db, appid, locale);
+ if(check_result == 1) {
+ locale_new = __get_app_locale_from_app_localized_info_by_fallback(db, appid, locale);
+ free(locale);
+ if (locale_new == NULL)
+ locale_new = strdup(DEFAULT_LOCALE);
+ return locale_new;
+ }
+
+ /* default locale */
+ free(locale);
+ return strdup(DEFAULT_LOCALE);
+}
+
+static void __get_metadata_filter_condition(gpointer data, char **condition)
+{
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data;
+ char key[MAX_QUERY_LEN] = {'\0'};
+ char value[MAX_QUERY_LEN] = {'\0'};
+ if (node->key) {
+ snprintf(key, MAX_QUERY_LEN, "(package_app_app_metadata.md_key='%s'", node->key);
+ }
+ if (node->value) {
+ snprintf(value, MAX_QUERY_LEN, " AND package_app_app_metadata.md_value='%s')", node->value);
+ strcat(key, value);
+ } else {
+ strcat(key, ")");
+ }
+ *condition = strdup(key);
+ return;
+}
+
+static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ int j = 0;
+ uiapplication_x *uiapp = NULL;
+ serviceapplication_x *svcapp = NULL;
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_component") == 0) {
+ if (coltxt[i]) {
+ if (strcmp(coltxt[i], "uiapp") == 0) {
+ uiapp = calloc(1, sizeof(uiapplication_x));
+ if (uiapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+ LISTADD(info->manifest_info->uiapplication, uiapp);
+ for(j = 0; j < ncols; j++)
+ {
+ if (strcmp(colname[j], "app_id") == 0) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->appid = strdup(coltxt[j]);
+ } else if (strcmp(colname[j], "app_exec") == 0) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->exec = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->exec = NULL;
+ } else if (strcmp(colname[j], "app_nodisplay") == 0) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->nodisplay = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->nodisplay = NULL;
+ } else if (strcmp(colname[j], "app_type") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->type = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->type = NULL;
+ } else if (strcmp(colname[j], "app_multiple") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->multiple = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->multiple = NULL;
+ } else if (strcmp(colname[j], "app_taskmanage") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->taskmanage = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->taskmanage = NULL;
+ } else if (strcmp(colname[j], "app_hwacceleration") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->hwacceleration = NULL;
+ } else if (strcmp(colname[j], "app_screenreader") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->screenreader = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->screenreader = NULL;
+ } else if (strcmp(colname[j], "app_enabled") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->enabled= strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->enabled = NULL;
+ } else if (strcmp(colname[j], "app_indicatordisplay") == 0){
+ if (coltxt[j])
+ info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->indicatordisplay = NULL;
+ } else if (strcmp(colname[j], "app_portraitimg") == 0){
+ if (coltxt[j])
+ info->manifest_info->uiapplication->portraitimg = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->portraitimg = NULL;
+ } else if (strcmp(colname[j], "app_landscapeimg") == 0){
+ if (coltxt[j])
+ info->manifest_info->uiapplication->landscapeimg = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->landscapeimg = NULL;
+ } else if (strcmp(colname[j], "app_guestmodevisibility") == 0){
+ if (coltxt[j])
+ info->manifest_info->uiapplication->guestmode_visibility = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->guestmode_visibility = NULL;
+ } else if (strcmp(colname[j], "app_recentimage") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->recentimage = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->recentimage = NULL;
+ } else if (strcmp(colname[j], "app_mainapp") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->mainapp = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->mainapp = NULL;
+ } else if (strcmp(colname[j], "package") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->package = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->package = NULL;
+ } else if (strcmp(colname[j], "app_component") == 0) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->app_component = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->app_component = NULL;
+ } else if (strcmp(colname[j], "app_permissiontype") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->permission_type = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->permission_type = NULL;
+ } else if (strcmp(colname[j], "component_type") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->component_type = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->component_type = NULL;
+ } else if (strcmp(colname[j], "app_preload") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->preload = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->preload = NULL;
+ } else if (strcmp(colname[j], "app_submode") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->submode = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->submode = NULL;
+ } else if (strcmp(colname[j], "app_submode_mainid") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->submode_mainid = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->submode_mainid = NULL;
+ } else if (strcmp(colname[j], "app_installed_storage") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->installed_storage = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->installed_storage = NULL;
+ } else if (strcmp(colname[j], "app_process_pool") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->process_pool = strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->process_pool = NULL;
+ } else if (strcmp(colname[j], "app_onboot") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->onboot= strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->onboot = NULL;
+ } else if (strcmp(colname[j], "app_autorestart") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->autorestart= strdup(coltxt[j]);
+ else
+ info->manifest_info->uiapplication->autorestart = NULL;
+
+ } else
+ continue;
+ }
+ } else {
+ svcapp = calloc(1, sizeof(serviceapplication_x));
+ if (svcapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+ LISTADD(info->manifest_info->serviceapplication, svcapp);
+ for(j = 0; j < ncols; j++)
+ {
+ if (strcmp(colname[j], "app_id") == 0) {
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->appid = strdup(coltxt[j]);
+ } else if (strcmp(colname[j], "app_exec") == 0) {
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->exec = strdup(coltxt[j]);
+ else
+ info->manifest_info->serviceapplication->exec = NULL;
+ } else if (strcmp(colname[j], "app_type") == 0 ){
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->type = strdup(coltxt[j]);
+ else
+ info->manifest_info->serviceapplication->type = NULL;
+ } else if (strcmp(colname[j], "app_onboot") == 0 ){
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->onboot = strdup(coltxt[j]);
+ else
+ info->manifest_info->serviceapplication->onboot = NULL;
+ } else if (strcmp(colname[j], "app_autorestart") == 0 ){
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->autorestart = strdup(coltxt[j]);
+ else
+ info->manifest_info->serviceapplication->autorestart = NULL;
+ } else if (strcmp(colname[j], "package") == 0 ){
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->package = strdup(coltxt[j]);
+ else
+ info->manifest_info->serviceapplication->package = NULL;
+ } else if (strcmp(colname[j], "app_permissiontype") == 0 ) {
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->permission_type = strdup(coltxt[j]);
+ else
+ info->manifest_info->serviceapplication->permission_type = NULL;
+ } else
+ continue;
+ }
+ }
+ }
+ } else
+ continue;
+ }
+
+ return 0;
+}
+
+static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
+ int i = 0;
+ icon_x *icon = NULL;
+ label_x *label = NULL;
+ category_x *category = NULL;
+ metadata_x *metadata = NULL;
+ permission_x *permission = NULL;
+ image_x *image = NULL;
+
+ switch (info->app_component) {
+ case PMINFO_UI_APP:
+ icon = calloc(1, sizeof(icon_x));
+ LISTADD(info->uiapp_info->icon, icon);
+ label = calloc(1, sizeof(label_x));
+ LISTADD(info->uiapp_info->label, label);
+ category = calloc(1, sizeof(category_x));
+ LISTADD(info->uiapp_info->category, category);
+ metadata = calloc(1, sizeof(metadata_x));
+ LISTADD(info->uiapp_info->metadata, metadata);
+ permission = calloc(1, sizeof(permission_x));
+ LISTADD(info->uiapp_info->permission, permission);
+ image = calloc(1, sizeof(image_x));
+ LISTADD(info->uiapp_info->image, image);
+
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ /*appid being foreign key, is column in every table
+ Hence appid gets strduped every time leading to memory leak.
+ If appid is already set, just continue.*/
+ if (info->uiapp_info->appid)
+ continue;
+ if (coltxt[i])
+ info->uiapp_info->appid = strdup(coltxt[i]);
+ else
+ info->uiapp_info->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->exec = strdup(coltxt[i]);
+ else
+ info->uiapp_info->exec = NULL;
+ } else if (strcmp(colname[i], "app_nodisplay") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->nodisplay = strdup(coltxt[i]);
+ else
+ info->uiapp_info->nodisplay = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->type = strdup(coltxt[i]);
+ else
+ info->uiapp_info->type = NULL;
+ } else if (strcmp(colname[i], "app_icon_section") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->icon->section= strdup(coltxt[i]);
+ else
+ info->uiapp_info->icon->section = NULL;
+ } else if (strcmp(colname[i], "app_icon") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->icon->text = strdup(coltxt[i]);
+ else
+ info->uiapp_info->icon->text = NULL;
+ } else if (strcmp(colname[i], "app_label") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->label->text = strdup(coltxt[i]);
+ else
+ info->uiapp_info->label->text = NULL;
+ } else if (strcmp(colname[i], "app_multiple") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->multiple = strdup(coltxt[i]);
+ else
+ info->uiapp_info->multiple = NULL;
+ } else if (strcmp(colname[i], "app_taskmanage") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->taskmanage = strdup(coltxt[i]);
+ else
+ info->uiapp_info->taskmanage = NULL;
+ } else if (strcmp(colname[i], "app_hwacceleration") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->hwacceleration = strdup(coltxt[i]);
+ else
+ info->uiapp_info->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_screenreader") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->screenreader = strdup(coltxt[i]);
+ else
+ info->uiapp_info->screenreader = NULL;
+ } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->enabled= strdup(coltxt[i]);
+ else
+ info->uiapp_info->enabled = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0){
+ if (coltxt[i])
+ info->uiapp_info->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->uiapp_info->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0){
+ if (coltxt[i])
+ info->uiapp_info->portraitimg = strdup(coltxt[i]);
+ else
+ info->uiapp_info->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0){
+ if (coltxt[i])
+ info->uiapp_info->landscapeimg = strdup(coltxt[i]);
+ else
+ info->uiapp_info->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0){
+ if (coltxt[i])
+ info->uiapp_info->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->uiapp_info->guestmode_visibility = NULL;
+ } else if (strcmp(colname[i], "category") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->category->name = strdup(coltxt[i]);
+ else
+ info->uiapp_info->category->name = NULL;
+ } else if (strcmp(colname[i], "md_key") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->metadata->key = strdup(coltxt[i]);
+ else
+ info->uiapp_info->metadata->key = NULL;
+ } else if (strcmp(colname[i], "md_value") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->metadata->value = strdup(coltxt[i]);
+ else
+ info->uiapp_info->metadata->value = NULL;
+ } else if (strcmp(colname[i], "pm_type") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission->type= strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission->type = NULL;
+ } else if (strcmp(colname[i], "pm_value") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission->value = strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission->value = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->recentimage = strdup(coltxt[i]);
+ else
+ info->uiapp_info->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->mainapp = strdup(coltxt[i]);
+ else
+ info->uiapp_info->mainapp = NULL;
+ } else if (strcmp(colname[i], "app_locale") == 0 ) {
+ if (coltxt[i]) {
+ info->uiapp_info->icon->lang = strdup(coltxt[i]);
+ info->uiapp_info->label->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->uiapp_info->icon->lang = NULL;
+ info->uiapp_info->label->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "app_image") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->image->text= strdup(coltxt[i]);
+ else
+ info->uiapp_info->image->text = NULL;
+ } else if (strcmp(colname[i], "app_image_section") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->image->section= strdup(coltxt[i]);
+ else
+ info->uiapp_info->image->section = NULL;
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission_type = strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission_type = NULL;
+ } else if (strcmp(colname[i], "component_type") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->component_type = strdup(coltxt[i]);
+ else
+ info->uiapp_info->component_type = NULL;
+ } else if (strcmp(colname[i], "app_preload") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->preload = strdup(coltxt[i]);
+ else
+ info->uiapp_info->preload = NULL;
+ } else if (strcmp(colname[i], "app_submode") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->submode = strdup(coltxt[i]);
+ else
+ info->uiapp_info->submode = NULL;
+ } else if (strcmp(colname[i], "app_submode_mainid") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->submode_mainid = strdup(coltxt[i]);
+ else
+ info->uiapp_info->submode_mainid = NULL;
+ } else if (strcmp(colname[i], "app_installed_storage") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->installed_storage = strdup(coltxt[i]);
+ else
+ info->uiapp_info->installed_storage = NULL;
+ } else if (strcmp(colname[i], "app_process_pool") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->process_pool = strdup(coltxt[i]);
+ else
+ info->uiapp_info->process_pool = NULL;
+ } else if (strcmp(colname[i], "app_onboot") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->onboot= strdup(coltxt[i]);
+ else
+ info->uiapp_info->onboot = NULL;
+ } else if (strcmp(colname[i], "app_autorestart") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->autorestart = strdup(coltxt[i]);
+ else
+ info->uiapp_info->autorestart = NULL;
+
+ } else
+ continue;
+ }
+ break;
+ case PMINFO_SVC_APP:
+ icon = calloc(1, sizeof(icon_x));
+ LISTADD(info->svcapp_info->icon, icon);
+ label = calloc(1, sizeof(label_x));
+ LISTADD(info->svcapp_info->label, label);
+ category = calloc(1, sizeof(category_x));
+ LISTADD(info->svcapp_info->category, category);
+ metadata = calloc(1, sizeof(metadata_x));
+ LISTADD(info->svcapp_info->metadata, metadata);
+ permission = calloc(1, sizeof(permission_x));
+ LISTADD(info->svcapp_info->permission, permission);
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ /*appid being foreign key, is column in every table
+ Hence appid gets strduped every time leading to memory leak.
+ If appid is already set, just continue.*/
+ if (info->svcapp_info->appid)
+ continue;
+ if (coltxt[i])
+ info->svcapp_info->appid = strdup(coltxt[i]);
+ else
+ info->svcapp_info->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->svcapp_info->exec = strdup(coltxt[i]);
+ else
+ info->svcapp_info->exec = NULL;
+ } else if (strcmp(colname[i], "app_icon") == 0) {
+ if (coltxt[i])
+ info->svcapp_info->icon->text = strdup(coltxt[i]);
+ else
+ info->svcapp_info->icon->text = NULL;
+ } else if (strcmp(colname[i], "app_label") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->label->text = strdup(coltxt[i]);
+ else
+ info->svcapp_info->label->text = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->type = strdup(coltxt[i]);
+ else
+ info->svcapp_info->type = NULL;
+ } else if (strcmp(colname[i], "app_onboot") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->onboot = strdup(coltxt[i]);
+ else
+ info->svcapp_info->onboot = NULL;
+ } else if (strcmp(colname[i], "app_autorestart") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->autorestart = strdup(coltxt[i]);
+ else
+ info->svcapp_info->autorestart = NULL;
+ } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->enabled= strdup(coltxt[i]);
+ else
+ info->svcapp_info->enabled = NULL;
+ } else if (strcmp(colname[i], "category") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->category->name = strdup(coltxt[i]);
+ else
+ info->svcapp_info->category->name = NULL;
+ } else if (strcmp(colname[i], "md_key") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->metadata->key = strdup(coltxt[i]);
+ else
+ info->svcapp_info->metadata->key = NULL;
+ } else if (strcmp(colname[i], "md_value") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->metadata->value = strdup(coltxt[i]);
+ else
+ info->svcapp_info->metadata->value = NULL;
+ } else if (strcmp(colname[i], "pm_type") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->permission->type= strdup(coltxt[i]);
+ else
+ info->svcapp_info->permission->type = NULL;
+ } else if (strcmp(colname[i], "pm_value") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->permission->value = strdup(coltxt[i]);
+ else
+ info->svcapp_info->permission->value = NULL;
+ } else if (strcmp(colname[i], "app_locale") == 0 ) {
+ if (coltxt[i]) {
+ info->svcapp_info->icon->lang = strdup(coltxt[i]);
+ info->svcapp_info->label->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->svcapp_info->icon->lang = NULL;
+ info->svcapp_info->label->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->permission_type = strdup(coltxt[i]);
+ else
+ info->svcapp_info->permission_type = NULL;
+ } else
+ continue;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+static pkgmgrinfo_app_component __appcomponent_convert(const char *comp)
+{
+ if ( strcasecmp(comp, "uiapp") == 0)
+ return PMINFO_UI_APP;
+ else if ( strcasecmp(comp, "svcapp") == 0)
+ return PMINFO_SVC_APP;
+ else
+ return -1;
+}
+
+static int __appcomponent_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
+ int i = 0;
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_component") == 0) {
+ info->app_component = __appcomponent_convert(coltxt[i]);
+ } else if (strcmp(colname[i], "package") == 0) {
+ info->package = strdup(coltxt[i]);
+ }
+ }
+
+ return 0;
+}
+
+static int __app_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ int j = 0;
+ uiapplication_x *uiapp = NULL;
+ serviceapplication_x *svcapp = NULL;
+ for(i = 0; i < ncols; i++)
+ {
+ if ((strcmp(colname[i], "app_component") == 0) ||
+ (strcmp(colname[i], "package_app_info.app_component") == 0)) {
+ if (coltxt[i]) {
+ if (strcmp(coltxt[i], "uiapp") == 0) {
+ uiapp = calloc(1, sizeof(uiapplication_x));
+ if (uiapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+ LISTADD(info->manifest_info->uiapplication, uiapp);
+ for(j = 0; j < ncols; j++)
+ {
+ if ((strcmp(colname[j], "app_id") == 0) ||
+ (strcmp(colname[j], "package_app_info.app_id") == 0)) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->appid = strdup(coltxt[j]);
+ } else if (strcmp(colname[j], "package") == 0) {
+ if (coltxt[j])
+ info->manifest_info->uiapplication->package = strdup(coltxt[j]);
+ } else
+ continue;
+ }
+ } else {
+ svcapp = calloc(1, sizeof(serviceapplication_x));
+ if (svcapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+ LISTADD(info->manifest_info->serviceapplication, svcapp);
+ for(j = 0; j < ncols; j++)
+ {
+ if ((strcmp(colname[j], "app_id") == 0) ||
+ (strcmp(colname[j], "package_app_info.app_id") == 0)) {
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->appid = strdup(coltxt[j]);
+ } else if (strcmp(colname[j], "package") == 0) {
+ if (coltxt[j])
+ info->manifest_info->serviceapplication->package = strdup(coltxt[j]);
+ } else
+ continue;
+ }
+ }
+ }
+ } else
+ continue;
+ }
+
+ return 0;
+}
+
+
+static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ uiapplication_x *uiapp = NULL;
+ icon_x *icon = NULL;
+ label_x *label = NULL;
+
+ uiapp = calloc(1, sizeof(uiapplication_x));
+ LISTADD(info->manifest_info->uiapplication, uiapp);
+ icon = calloc(1, sizeof(icon_x));
+ LISTADD(info->manifest_info->uiapplication->icon, icon);
+ label = calloc(1, sizeof(label_x));
+ LISTADD(info->manifest_info->uiapplication->label, label);
+
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->appid = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->exec = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->exec = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->type = NULL;
+ } else if (strcmp(colname[i], "app_nodisplay") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->nodisplay = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->nodisplay = NULL;
+ } else if (strcmp(colname[i], "app_multiple") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->multiple = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->multiple = NULL;
+ } else if (strcmp(colname[i], "app_taskmanage") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->taskmanage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->taskmanage = NULL;
+ } else if (strcmp(colname[i], "app_hwacceleration") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_screenreader") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->screenreader = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->screenreader = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->portraitimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->landscapeimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->guestmode_visibility = NULL;
+ } else if (strcmp(colname[i], "package") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->package = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->package = NULL;
+ } else if (strcmp(colname[i], "app_icon") == 0) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->icon->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->icon->text = NULL;
+ } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->enabled= strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->enabled = NULL;
+ } else if (strcmp(colname[i], "app_label") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->label->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->label->text = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->recentimage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->mainapp = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->mainapp = NULL;
+ } else if (strcmp(colname[i], "app_locale") == 0 ) {
+ if (coltxt[i]) {
+ info->manifest_info->uiapplication->icon->lang = strdup(coltxt[i]);
+ info->manifest_info->uiapplication->label->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->manifest_info->uiapplication->icon->lang = NULL;
+ info->manifest_info->uiapplication->label->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->permission_type = NULL;
+ } else if (strcmp(colname[i], "component_type") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->component_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->component_type = NULL;
+ } else if (strcmp(colname[i], "app_preload") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->preload = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->preload = NULL;
+ } else if (strcmp(colname[i], "app_submode") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->submode = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->submode = NULL;
+ } else if (strcmp(colname[i], "app_submode_mainid") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->submode_mainid = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->submode_mainid = NULL;
+ } else if (strcmp(colname[i], "app_installed_storage") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->installed_storage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->installed_storage = NULL;
+ } else if (strcmp(colname[i], "app_process_pool") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->process_pool = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->process_pool = NULL;
+ } else if (strcmp(colname[i], "app_onboot") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->onboot = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->onboot = NULL;
+ } else if (strcmp(colname[i], "app_autorestart") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->autorestart = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->autorestart = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+static int __svcapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ serviceapplication_x *svcapp = NULL;
+ icon_x *icon = NULL;
+ label_x *label = NULL;
+
+ svcapp = calloc(1, sizeof(serviceapplication_x));
+ LISTADD(info->manifest_info->serviceapplication, svcapp);
+ icon = calloc(1, sizeof(icon_x));
+ LISTADD(info->manifest_info->serviceapplication->icon, icon);
+ label = calloc(1, sizeof(label_x));
+ LISTADD(info->manifest_info->serviceapplication->label, label);
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->appid = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->exec = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->exec = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->type = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->type = NULL;
+ } else if (strcmp(colname[i], "app_onboot") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->onboot = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->onboot = NULL;
+ } else if (strcmp(colname[i], "app_autorestart") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->autorestart = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->autorestart = NULL;
+ } else if (strcmp(colname[i], "package") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->package = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->package = NULL;
+ } else if (strcmp(colname[i], "app_icon") == 0) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->icon->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->icon->text = NULL;
+ } else if (strcmp(colname[i], "app_label") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->label->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->label->text = NULL;
+ } else if (strcmp(colname[i], "app_locale") == 0 ) {
+ if (coltxt[i]) {
+ info->manifest_info->serviceapplication->icon->lang = strdup(coltxt[i]);
+ info->manifest_info->serviceapplication->label->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->manifest_info->serviceapplication->icon->lang = NULL;
+ info->manifest_info->serviceapplication->label->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->permission_type = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+static int __allapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ int j = 0;
+ uiapplication_x *uiapp = NULL;
+ serviceapplication_x *svcapp = NULL;
+ for(j = 0; j < ncols; j++)
+ {
+ if (strcmp(colname[j], "app_component") == 0) {
+ if (coltxt[j]) {
+ if (strcmp(coltxt[j], "uiapp") == 0) {
+ uiapp = calloc(1, sizeof(uiapplication_x));
+ if (uiapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+ LISTADD(info->manifest_info->uiapplication, uiapp);
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->appid = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->exec = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->exec = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->type = NULL;
+ } else if (strcmp(colname[i], "app_nodisplay") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->nodisplay = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->nodisplay = NULL;
+ } else if (strcmp(colname[i], "app_multiple") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->multiple = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->multiple = NULL;
+ } else if (strcmp(colname[i], "app_taskmanage") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->taskmanage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->taskmanage = NULL;
+ } else if (strcmp(colname[i], "app_hwacceleration") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_screenreader") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->screenreader = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->screenreader = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->portraitimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->landscapeimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->guestmode_visibility = NULL;
+ } else if (strcmp(colname[i], "package") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->package = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->package = NULL;
+ } else if (strcmp(colname[i], "app_icon") == 0) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->icon->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->icon->text = NULL;
+ } else if (strcmp(colname[i], "app_label") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->label->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->label->text = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->recentimage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->mainapp= strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->mainapp = NULL;
+ } else if (strcmp(colname[i], "app_locale") == 0 ) {
+ if (coltxt[i]) {
+ info->manifest_info->uiapplication->icon->lang = strdup(coltxt[i]);
+ info->manifest_info->uiapplication->label->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->manifest_info->uiapplication->icon->lang = NULL;
+ info->manifest_info->uiapplication->label->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->permission_type = NULL;
+ } else
+ continue;
+ }
+ } else {
+ svcapp = calloc(1, sizeof(serviceapplication_x));
+ if (svcapp == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return -1;
+ }
+ LISTADD(info->manifest_info->serviceapplication, svcapp);
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_id") == 0) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->appid = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->appid = NULL;
+ } else if (strcmp(colname[i], "app_exec") == 0) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->exec = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->exec = NULL;
+ } else if (strcmp(colname[i], "app_type") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->type = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->type = NULL;
+ } else if (strcmp(colname[i], "app_onboot") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->onboot = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->onboot = NULL;
+ } else if (strcmp(colname[i], "app_autorestart") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->autorestart = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->autorestart = NULL;
+ } else if (strcmp(colname[i], "package") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->package = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->package = NULL;
+ } else if (strcmp(colname[i], "app_icon") == 0) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->icon->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->icon->text = NULL;
+ } else if (strcmp(colname[i], "app_label") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->label->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->label->text = NULL;
+ } else if (strcmp(colname[i], "app_locale") == 0 ) {
+ if (coltxt[i]) {
+ info->manifest_info->serviceapplication->icon->lang = strdup(coltxt[i]);
+ info->manifest_info->serviceapplication->label->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->manifest_info->serviceapplication->icon->lang = NULL;
+ info->manifest_info->serviceapplication->label->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->serviceapplication->permission_type = strdup(coltxt[i]);
+ else
+ info->manifest_info->serviceapplication->permission_type = NULL;
+ } else
+ continue;
+ }
+ }
+ }
+ } else
+ continue;
+ }
+
+ return 0;
+}
+
+API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback pointer is NULL");
+ retvm_if((component != PMINFO_UI_APP) && (component != PMINFO_SVC_APP) && (component != PMINFO_ALL_APP), PMINFO_R_EINVAL, "Invalid App Component Type");
+
+ char *locale = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ pkgmgr_pkginfo_x *allinfo = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ icon_x *ptr1 = NULL;
+ label_x *ptr2 = NULL;
+ category_x *ptr3 = NULL;
+ metadata_x *ptr4 = NULL;
+ permission_x *ptr5 = NULL;
+ image_x *ptr6 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*check installed storage*/
+ ret = __pkginfo_check_installed_storage(info);
+ retvm_if(ret < 0, PMINFO_R_EINVAL, "[%s] is installed external, but is not in mmc", info->manifest_info->package);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
+
+ /*calloc allinfo*/
+ allinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*calloc manifest_info*/
+ allinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(allinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*set component type*/
+ if (component == PMINFO_UI_APP)
+ appinfo->app_component = PMINFO_UI_APP;
+ if (component == PMINFO_SVC_APP)
+ appinfo->app_component = PMINFO_SVC_APP;
+ if (component == PMINFO_ALL_APP)
+ appinfo->app_component = PMINFO_ALL_APP;
+
+ /*open db */
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ appinfo->package = strdup(info->manifest_info->package);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_info where " \
+ "package='%s' and app_component='%s'",
+ info->manifest_info->package,
+ (appinfo->app_component==PMINFO_UI_APP ? "uiapp" : "svcapp"));
+
+ switch(component) {
+ case PMINFO_UI_APP:
+ /*Populate ui app info */
+ ret = __exec_db_query(appinfo_db, query, __uiapp_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
+ uiapplication_x *tmp = NULL;
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, tmp);
+ info->manifest_info->uiapplication = tmp;
+ }
+ /*Populate localized info for default locales and call callback*/
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(tmp != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = tmp;
+ if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
+ if (locale) {
+ free(locale);
+ }
+ locale = __get_app_locale_by_fallback(appinfo_db, appinfo->uiapp_info->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_category where app_id=='%s'%", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_metadata where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, ptr2);
+ appinfo->uiapp_info->label = ptr2;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, ptr1);
+ appinfo->uiapp_info->icon = ptr1;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, ptr3);
+ appinfo->uiapp_info->category = ptr3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, ptr4);
+ appinfo->uiapp_info->metadata = ptr4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, ptr5);
+ appinfo->uiapp_info->permission = ptr5;
+ }
+ if (appinfo->uiapp_info->image) {
+ LISTHEAD(appinfo->uiapp_info->image, ptr6);
+ appinfo->uiapp_info->image = ptr6;
+ }
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ tmp = tmp->next;
+ }
+ break;
+ case PMINFO_SVC_APP:
+ /*Populate svc app info */
+ ret = __exec_db_query(appinfo_db, query, __svcapp_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
+ serviceapplication_x *tmp1 = NULL;
+ if (info->manifest_info->serviceapplication) {
+ LISTHEAD(info->manifest_info->serviceapplication, tmp1);
+ info->manifest_info->serviceapplication = tmp1;
+ }
+ /*Populate localized info for default locales and call callback*/
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(tmp1 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->svcapp_info = tmp1;
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ if (appinfo->svcapp_info->label) {
+ LISTHEAD(appinfo->svcapp_info->label, ptr2);
+ appinfo->svcapp_info->label = ptr2;
+ }
+ if (appinfo->svcapp_info->icon) {
+ LISTHEAD(appinfo->svcapp_info->icon, ptr1);
+ appinfo->svcapp_info->icon = ptr1;
+ }
+ if (appinfo->svcapp_info->category) {
+ LISTHEAD(appinfo->svcapp_info->category, ptr3);
+ appinfo->svcapp_info->category = ptr3;
+ }
+ if (appinfo->svcapp_info->metadata) {
+ LISTHEAD(appinfo->svcapp_info->metadata, ptr4);
+ appinfo->svcapp_info->metadata = ptr4;
+ }
+ if (appinfo->svcapp_info->permission) {
+ LISTHEAD(appinfo->svcapp_info->permission, ptr5);
+ appinfo->svcapp_info->permission = ptr5;
+ }
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ tmp1 = tmp1->next;
+ }
+ break;
+ case PMINFO_ALL_APP:
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where package='%s'", info->manifest_info->package);
+
+ /*Populate all app info */
+ ret = __exec_db_query(appinfo_db, query, __allapp_list_cb, (void *)allinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
+ /*UI Apps*/
+ appinfo->app_component = PMINFO_UI_APP;
+ uiapplication_x *tmp2 = NULL;
+ if (allinfo->manifest_info->uiapplication) {
+ LISTHEAD(allinfo->manifest_info->uiapplication, tmp2);
+ allinfo->manifest_info->uiapplication = tmp2;
+ }
+ /*Populate localized info for default locales and call callback*/
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(tmp2 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = tmp2;
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, ptr2);
+ appinfo->uiapp_info->label = ptr2;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, ptr1);
+ appinfo->uiapp_info->icon = ptr1;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, ptr3);
+ appinfo->uiapp_info->category = ptr3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, ptr4);
+ appinfo->uiapp_info->metadata = ptr4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, ptr5);
+ appinfo->uiapp_info->permission = ptr5;
+ }
+ if (appinfo->uiapp_info->image) {
+ LISTHEAD(appinfo->uiapp_info->image, ptr6);
+ appinfo->uiapp_info->image = ptr6;
+ }
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ tmp2 = tmp2->next;
+ }
+
+ /*SVC Apps*/
+ appinfo->app_component = PMINFO_SVC_APP;
+ serviceapplication_x *tmp3 = NULL;
+ if (allinfo->manifest_info->serviceapplication) {
+ LISTHEAD(allinfo->manifest_info->serviceapplication, tmp3);
+ allinfo->manifest_info->serviceapplication = tmp3;
+ }
+ /*Populate localized info for default locales and call callback*/
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(tmp3 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->svcapp_info = tmp3;
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ if (appinfo->svcapp_info->label) {
+ LISTHEAD(appinfo->svcapp_info->label, ptr2);
+ appinfo->svcapp_info->label = ptr2;
+ }
+ if (appinfo->svcapp_info->icon) {
+ LISTHEAD(appinfo->svcapp_info->icon, ptr1);
+ appinfo->svcapp_info->icon = ptr1;
+ }
+ if (appinfo->svcapp_info->category) {
+ LISTHEAD(appinfo->svcapp_info->category, ptr3);
+ appinfo->svcapp_info->category = ptr3;
+ }
+ if (appinfo->svcapp_info->metadata) {
+ LISTHEAD(appinfo->svcapp_info->metadata, ptr4);
+ appinfo->svcapp_info->metadata = ptr4;
+ }
+ if (appinfo->svcapp_info->permission) {
+ LISTHEAD(appinfo->svcapp_info->permission, ptr5);
+ appinfo->svcapp_info->permission = ptr5;
+ }
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ tmp3 = tmp3->next;
+ }
+ appinfo->app_component = PMINFO_ALL_APP;
+ break;
+
+ }
+
+ ret = PMINFO_R_OK;
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ if (appinfo) {
+ if (appinfo->package) {
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(allinfo);
+
+ sqlite3_close(appinfo_db);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ pkgmgr_appinfo_x *appinfo = NULL;
+ uiapplication_x *ptr1 = NULL;
+ serviceapplication_x *ptr2 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*calloc pkginfo*/
+ pkgmgr_pkginfo_x *info = NULL;
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc manifest_info*/
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
+ ret = __exec_db_query(appinfo_db, query, __mini_appinfo_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+ if (info->manifest_info->serviceapplication) {
+ LISTHEAD(info->manifest_info->serviceapplication, ptr2);
+ info->manifest_info->serviceapplication = ptr2;
+ }
+
+ /*UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ appinfo->app_component = PMINFO_UI_APP;
+ appinfo->package = strdup(ptr1->package);
+ appinfo->uiapp_info = ptr1;
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+ /*Service Apps*/
+ for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
+ {
+ appinfo->app_component = PMINFO_SVC_APP;
+ appinfo->package = strdup(ptr2->package);
+ appinfo->svcapp_info = ptr2;
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_close(appinfo_db);
+
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ uiapplication_x *ptr1 = NULL;
+ serviceapplication_x *ptr2 = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ category_x *tmp3 = NULL;
+ metadata_x *tmp4 = NULL;
+ permission_x *tmp5 = NULL;
+ image_x *tmp6 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*calloc pkginfo*/
+ pkgmgr_pkginfo_x *info = NULL;
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc manifest_info*/
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
+ ret = __exec_db_query(appinfo_db, query, __app_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+ if (info->manifest_info->serviceapplication) {
+ LISTHEAD(info->manifest_info->serviceapplication, ptr2);
+ info->manifest_info->serviceapplication = ptr2;
+ }
+
+ /*UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->app_component = PMINFO_UI_APP;
+ appinfo->package = strdup(ptr1->package);
+ appinfo->uiapp_info = ptr1;
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_info where " \
+ "app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
+ if (locale) {
+ free(locale);
+ }
+ locale = __get_app_locale_by_fallback(appinfo_db, ptr1->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr1->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr1->appid, DEFAULT_LOCALE);
+
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, tmp1);
+ appinfo->uiapp_info->label = tmp1;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, tmp2);
+ appinfo->uiapp_info->icon= tmp2;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, tmp3);
+ appinfo->uiapp_info->category = tmp3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
+ appinfo->uiapp_info->metadata = tmp4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, tmp5);
+ appinfo->uiapp_info->permission = tmp5;
+ }
+ if (appinfo->uiapp_info->image) {
+ LISTHEAD(appinfo->uiapp_info->image, tmp6);
+ appinfo->uiapp_info->image = tmp6;
+ }
+
+ ret = __appinfo_check_installed_storage(appinfo);
+ if(ret < 0)
+ continue;
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+ /*Service Apps*/
+ for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->app_component = PMINFO_SVC_APP;
+ appinfo->package = strdup(ptr2->package);
+ appinfo->svcapp_info = ptr2;
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_info where " \
+ "app_id='%s'", ptr2->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr2->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr2->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (appinfo->svcapp_info->label) {
+ LISTHEAD(appinfo->svcapp_info->label, tmp1);
+ appinfo->svcapp_info->label = tmp1;
+ }
+ if (appinfo->svcapp_info->icon) {
+ LISTHEAD(appinfo->svcapp_info->icon, tmp2);
+ appinfo->svcapp_info->icon= tmp2;
+ }
+ if (appinfo->svcapp_info->category) {
+ LISTHEAD(appinfo->svcapp_info->category, tmp3);
+ appinfo->svcapp_info->category = tmp3;
+ }
+ if (appinfo->svcapp_info->metadata) {
+ LISTHEAD(appinfo->svcapp_info->metadata, tmp4);
+ appinfo->svcapp_info->metadata = tmp4;
+ }
+ if (appinfo->svcapp_info->permission) {
+ LISTHEAD(appinfo->svcapp_info->permission, tmp5);
+ appinfo->svcapp_info->permission = tmp5;
+ }
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+ ret = PMINFO_R_OK;
+
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_close(appinfo_db);
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_mounted_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ uiapplication_x *ptr1 = NULL;
+ label_x *tmp1 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*calloc pkginfo*/
+ pkgmgr_pkginfo_x *info = NULL;
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc manifest_info*/
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_installed_storage='installed_external'");
+ ret = __exec_db_query(appinfo_db, query, __app_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+
+ /*UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->app_component = PMINFO_UI_APP;
+ appinfo->package = strdup(ptr1->package);
+ appinfo->uiapp_info = ptr1;
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_info where " \
+ "app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
+ if (locale) {
+ free(locale);
+ }
+ locale = __get_app_locale_by_fallback(appinfo_db, ptr1->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr1->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr1->appid, DEFAULT_LOCALE);
+
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, tmp1);
+ appinfo->uiapp_info->label = tmp1;
+ }
+
+ ret = __appinfo_check_installed_storage(appinfo);
+ if(ret < 0)
+ continue;
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_close(appinfo_db);
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_unmounted_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ uiapplication_x *ptr1 = NULL;
+ label_x *tmp1 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*calloc pkginfo*/
+ pkgmgr_pkginfo_x *info = NULL;
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc manifest_info*/
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_installed_storage='installed_external'");
+ ret = __exec_db_query(appinfo_db, query, __app_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+
+ /*UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->app_component = PMINFO_UI_APP;
+ appinfo->package = strdup(ptr1->package);
+ appinfo->uiapp_info = ptr1;
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_info where " \
+ "app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
+ if (locale) {
+ free(locale);
+ }
+ locale = __get_app_locale_by_fallback(appinfo_db, ptr1->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr1->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from package_app_localized_info where " \
+ "app_id='%s' and app_locale='%s'",
+ ptr1->appid, DEFAULT_LOCALE);
+
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, tmp1);
+ appinfo->uiapp_info->label = tmp1;
+ }
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_close(appinfo_db);
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_unmounted_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ pkgmgr_appinfo_x *appinfo = NULL;
+ char *locale = NULL;
+ int ret = -1;
+ int exist = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ category_x *tmp3 = NULL;
+ metadata_x *tmp4 = NULL;
+ permission_x *tmp5 = NULL;
+ image_x *tmp6 = NULL;
+ char *query = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check appid exist on db*/
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q)", appid);
+ ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
+ tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", appid);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*check app_component from DB*/
+ query = sqlite3_mprintf("select app_component, package from package_app_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appcomponent_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*calloc app_component*/
+ if (appinfo->app_component == PMINFO_UI_APP) {
+ appinfo->uiapp_info = (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
+ tryvm_if(appinfo->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for uiapp info");
+ } else {
+ appinfo->svcapp_info = (serviceapplication_x *)calloc(1, sizeof(serviceapplication_x));
+ tryvm_if(appinfo->svcapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for svcapp info");
+ }
+ appinfo->locale = strdup(locale);
+
+ /*populate app_info from DB*/
+ query = sqlite3_mprintf("select * from package_app_info where app_id=%Q ", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ /*Populate app permission*/
+ query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ switch (appinfo->app_component) {
+ case PMINFO_UI_APP:
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, tmp1);
+ appinfo->uiapp_info->label = tmp1;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, tmp2);
+ appinfo->uiapp_info->icon = tmp2;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, tmp3);
+ appinfo->uiapp_info->category = tmp3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
+ appinfo->uiapp_info->metadata = tmp4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, tmp5);
+ appinfo->uiapp_info->permission = tmp5;
+ }
+ if (appinfo->uiapp_info->image) {
+ LISTHEAD(appinfo->uiapp_info->image, tmp6);
+ appinfo->uiapp_info->image = tmp6;
+ }
+ break;
+ case PMINFO_SVC_APP:
+ if (appinfo->svcapp_info->label) {
+ LISTHEAD(appinfo->svcapp_info->label, tmp1);
+ appinfo->svcapp_info->label = tmp1;
+ }
+ if (appinfo->svcapp_info->icon) {
+ LISTHEAD(appinfo->svcapp_info->icon, tmp2);
+ appinfo->svcapp_info->icon = tmp2;
+ }
+ if (appinfo->svcapp_info->category) {
+ LISTHEAD(appinfo->svcapp_info->category, tmp3);
+ appinfo->svcapp_info->category = tmp3;
+ }
+ if (appinfo->svcapp_info->metadata) {
+ LISTHEAD(appinfo->svcapp_info->metadata, tmp4);
+ appinfo->svcapp_info->metadata = tmp4;
+ }
+ if (appinfo->svcapp_info->permission) {
+ LISTHEAD(appinfo->svcapp_info->permission, tmp5);
+ appinfo->svcapp_info->permission = tmp5;
+ }
+ break;
+ default:
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)appinfo;
+ else {
+ *handle = NULL;
+ __cleanup_appinfo(appinfo);
+ }
+
+ sqlite3_close(appinfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback pointer is NULL");
+ retvm_if((component != PMINFO_UI_APP) && (component != PMINFO_SVC_APP) && (component != PMINFO_ALL_APP), PMINFO_R_EINVAL, "Invalid App Component Type");
+
+ char *locale = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ pkgmgr_pkginfo_x *allinfo = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ icon_x *ptr1 = NULL;
+ label_x *ptr2 = NULL;
+ category_x *ptr3 = NULL;
+ metadata_x *ptr4 = NULL;
+ permission_x *ptr5 = NULL;
+ image_x *ptr6 = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*check installed storage*/
+ ret = __pkginfo_check_installed_storage(info);
+ retvm_if(ret < 0, PMINFO_R_EINVAL, "[%s] is installed external, but is not in mmc", info->manifest_info->package);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
+
+ /*calloc allinfo*/
+ allinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*calloc manifest_info*/
+ allinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(allinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*set component type*/
+ if (component == PMINFO_UI_APP)
+ appinfo->app_component = PMINFO_UI_APP;
+ if (component == PMINFO_SVC_APP)
+ appinfo->app_component = PMINFO_SVC_APP;
+ if (component == PMINFO_ALL_APP)
+ appinfo->app_component = PMINFO_ALL_APP;
+
+ /*open db */
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ appinfo->package = strdup(info->manifest_info->package);
+ snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
+ "from disabled_package_app_info where " \
+ "package='%s' and app_component='%s'",
+ info->manifest_info->package,
+ (appinfo->app_component==PMINFO_UI_APP ? "uiapp" : "svcapp"));
+
+ switch(component) {
+ case PMINFO_UI_APP:
+ /*Populate ui app info */
+ ret = __exec_db_query(appinfo_db, query, __uiapp_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
+ uiapplication_x *tmp = NULL;
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, tmp);
+ info->manifest_info->uiapplication = tmp;
+ }
+ /*Populate localized info for default locales and call callback*/
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(tmp != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = tmp;
+ if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
+ if (locale) {
+ free(locale);
+ }
+ locale = __get_app_locale_by_fallback(appinfo_db, appinfo->uiapp_info->appid);
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_app_category where app_id=='%s'%", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_app_metadata where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, ptr2);
+ appinfo->uiapp_info->label = ptr2;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, ptr1);
+ appinfo->uiapp_info->icon = ptr1;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, ptr3);
+ appinfo->uiapp_info->category = ptr3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, ptr4);
+ appinfo->uiapp_info->metadata = ptr4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, ptr5);
+ appinfo->uiapp_info->permission = ptr5;
+ }
+ if (appinfo->uiapp_info->image) {
+ LISTHEAD(appinfo->uiapp_info->image, ptr6);
+ appinfo->uiapp_info->image = ptr6;
+ }
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ tmp = tmp->next;
+ }
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ if (appinfo) {
+ if (appinfo->package) {
+ free((void *)appinfo->package);
+ appinfo->package = NULL;
+ }
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(allinfo);
+
+ sqlite3_close(appinfo_db);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ pkgmgr_appinfo_x *appinfo = NULL;
+ char *locale = NULL;
+ int ret = -1;
+ int exist = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ category_x *tmp3 = NULL;
+ metadata_x *tmp4 = NULL;
+
+ char *query = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check appid exist on db*/
+ query = sqlite3_mprintf("select exists(select * from disabled_package_app_info where app_id=%Q)", appid);
+ ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
+ tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", appid);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*check app_component from DB*/
+ query = sqlite3_mprintf("select app_component, package from disabled_package_app_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appcomponent_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*calloc app_component*/
+ appinfo->uiapp_info = (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
+ tryvm_if(appinfo->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for uiapp info");
+
+ appinfo->locale = strdup(locale);
+
+ /*populate app_info from DB*/
+ query = sqlite3_mprintf("select * from disabled_package_app_info where app_id=%Q ", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ query = sqlite3_mprintf("select * from disabled_package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query = sqlite3_mprintf("select * from disabled_package_app_localized_info where app_id=%Q and app_locale=%Q", appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ query = sqlite3_mprintf("select * from disabled_package_app_app_category where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ query = sqlite3_mprintf("select * from disabled_package_app_app_metadata where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ switch (appinfo->app_component) {
+ case PMINFO_UI_APP:
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, tmp1);
+ appinfo->uiapp_info->label = tmp1;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, tmp2);
+ appinfo->uiapp_info->icon = tmp2;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, tmp3);
+ appinfo->uiapp_info->category = tmp3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
+ appinfo->uiapp_info->metadata = tmp4;
+ }
+ break;
+ default:
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)appinfo;
+ else {
+ *handle = NULL;
+ __cleanup_appinfo(appinfo);
+ }
+
+ sqlite3_close(appinfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ pkgmgr_appinfo_x *appinfo = NULL;
+ char *locale = NULL;
+ int ret = -1;
+ int exist = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ category_x *tmp3 = NULL;
+ metadata_x *tmp4 = NULL;
+ permission_x *tmp5 = NULL;
+ image_x *tmp6 = NULL;
+ char *query = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check appid exist on db*/
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q)", appid);
+ ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
+ if (exist == 0) {
+ _LOGS("Appid[%s] not found in DB", appid);
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*check app_component from DB*/
+ query = sqlite3_mprintf("select app_component, package from package_app_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appcomponent_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*calloc app_component*/
+ if (appinfo->app_component == PMINFO_UI_APP) {
+ appinfo->uiapp_info = (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
+ tryvm_if(appinfo->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for uiapp info");
+ } else {
+ appinfo->svcapp_info = (serviceapplication_x *)calloc(1, sizeof(serviceapplication_x));
+ tryvm_if(appinfo->svcapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for svcapp info");
+ }
+ appinfo->locale = strdup(locale);
+
+ /*populate app_info from DB*/
+ query = sqlite3_mprintf("select * from package_app_info where app_id=%Q ", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ /*Populate app permission*/
+ query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ ret = __appinfo_check_installed_storage(appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "[%s] is installed external, but is not in mmc", appinfo->package);
+
+ switch (appinfo->app_component) {
+ case PMINFO_UI_APP:
+ if (appinfo->uiapp_info->label) {
+ LISTHEAD(appinfo->uiapp_info->label, tmp1);
+ appinfo->uiapp_info->label = tmp1;
+ }
+ if (appinfo->uiapp_info->icon) {
+ LISTHEAD(appinfo->uiapp_info->icon, tmp2);
+ appinfo->uiapp_info->icon = tmp2;
+ }
+ if (appinfo->uiapp_info->category) {
+ LISTHEAD(appinfo->uiapp_info->category, tmp3);
+ appinfo->uiapp_info->category = tmp3;
+ }
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
+ appinfo->uiapp_info->metadata = tmp4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, tmp5);
+ appinfo->uiapp_info->permission = tmp5;
+ }
+ if (appinfo->uiapp_info->image) {
+ LISTHEAD(appinfo->uiapp_info->image, tmp6);
+ appinfo->uiapp_info->image = tmp6;
+ }
+ break;
+ case PMINFO_SVC_APP:
+ if (appinfo->svcapp_info->label) {
+ LISTHEAD(appinfo->svcapp_info->label, tmp1);
+ appinfo->svcapp_info->label = tmp1;
+ }
+ if (appinfo->svcapp_info->icon) {
+ LISTHEAD(appinfo->svcapp_info->icon, tmp2);
+ appinfo->svcapp_info->icon = tmp2;
+ }
+ if (appinfo->svcapp_info->category) {
+ LISTHEAD(appinfo->svcapp_info->category, tmp3);
+ appinfo->svcapp_info->category = tmp3;
+ }
+ if (appinfo->svcapp_info->metadata) {
+ LISTHEAD(appinfo->svcapp_info->metadata, tmp4);
+ appinfo->svcapp_info->metadata = tmp4;
+ }
+ if (appinfo->svcapp_info->permission) {
+ LISTHEAD(appinfo->svcapp_info->permission, tmp5);
+ appinfo->svcapp_info->permission = tmp5;
+ }
+ break;
+ default:
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)appinfo;
+ else {
+ *handle = NULL;
+ __cleanup_appinfo(appinfo);
+ }
+
+ sqlite3_close(appinfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ return ret;
+}
+
+
+API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ *appid = (char *)info->uiapp_info->appid;
+ else if (info->app_component == PMINFO_SVC_APP)
+ *appid = (char *)info->svcapp_info->appid;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(pkg_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *pkg_name = (char *)info->package;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *pkgid = (char *)info->package;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(exec == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ *exec = (char *)info->uiapp_info->exec;
+ if (info->app_component == PMINFO_SVC_APP)
+ *exec = (char *)info->svcapp_info->exec;
+
+ return PMINFO_R_OK;
+}
+
+
+API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *locale = NULL;
+ icon_x *ptr = NULL;
+ icon_x *start = NULL;
+ *icon = NULL;
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ locale = info->locale;
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
+ if (info->app_component == PMINFO_UI_APP)
+ start = info->uiapp_info->icon;
+ if (info->app_component == PMINFO_SVC_APP)
+ start = info->svcapp_info->icon;
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ if (ptr->text) {
+ *icon = (char *)ptr->text;
+ if (strcasecmp(*icon, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+
+API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *locale = NULL;
+ label_x *ptr = NULL;
+ label_x *start = NULL;
+ *label = NULL;
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ locale = info->locale;
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
+ if (info->app_component == PMINFO_UI_APP)
+ start = info->uiapp_info->label;
+ if (info->app_component == PMINFO_SVC_APP)
+ start = info->svcapp_info->label;
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ if (ptr->text) {
+ *label = (char *)ptr->text;
+ if (strcasecmp(*label, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strncasecmp(ptr->lang, locale, 2) == 0) {
+ *label = (char *)ptr->text;
+ if (ptr->text) {
+ if (strcasecmp(*label, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *label = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+
+API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(component == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ *component = PMINFO_UI_APP;
+ else if (info->app_component == PMINFO_SVC_APP)
+ *component = PMINFO_SVC_APP;
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(app_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ *app_type = (char *)info->uiapp_info->type;
+ if (info->app_component == PMINFO_SVC_APP)
+ *app_type = (char *)info->svcapp_info->type;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
+ int *operation_count, char ***operation)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(operation == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ retvm_if(operation_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
+ *operation_count = data->operation_count;
+ *operation = data->operation;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
+ int *uri_count, char ***uri)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(uri == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ retvm_if(uri_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
+ *uri_count = data->uri_count;
+ *uri = data->uri;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
+ int *mime_count, char ***mime)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(mime == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ retvm_if(mime_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
+ *mime_count = data->mime_count;
+ *mime = data->mime;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
+ int *subapp_count, char ***subapp)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(subapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ retvm_if(subapp_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
+ *subapp_count = data->subapp_count;
+ *subapp = data->subapp;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ icon_x *ptr = NULL;
+ icon_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ start = info->uiapp_info->icon;
+
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+ if (strcmp(val, "setting") == 0){
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_small_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ icon_x *ptr = NULL;
+ icon_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ start = info->uiapp_info->icon;
+
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+ if (strcmp(val, "small") == 0){
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ icon_x *ptr = NULL;
+ icon_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ start = info->uiapp_info->icon;
+
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+
+ if (strcmp(val, "notification") == 0){
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->recentimage;
+ if (val) {
+ if (strcasecmp(val, "capture") == 0)
+ *type = PMINFO_RECENTIMAGE_USE_CAPTURE;
+ else if (strcasecmp(val, "icon") == 0)
+ *type = PMINFO_RECENTIMAGE_USE_ICON;
+ else
+ *type = PMINFO_RECENTIMAGE_USE_NOTHING;
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(preview_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ image_x *ptr = NULL;
+ image_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ start = info->uiapp_info->image;
+
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+
+ if (strcmp(val, "preview") == 0)
+ *preview_img = (char *)ptr->text;
+
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(permission == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ val = info->uiapp_info->permission_type;
+ else if (info->app_component == PMINFO_SVC_APP)
+ val = info->svcapp_info->permission_type;
+ else
+ return PMINFO_R_ERROR;
+
+ if (strcmp(val, "signature") == 0)
+ *permission = PMINFO_PERMISSION_SIGNATURE;
+ else if (strcmp(val, "privilege") == 0)
+ *permission = PMINFO_PERMISSION_PRIVILEGE;
+ else
+ *permission = PMINFO_PERMISSION_NORMAL;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(component_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *component_type = (char *)info->uiapp_info->component_type;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(hwacceleration == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->hwacceleration;
+ if (val) {
+ if (strcasecmp(val, "not-use-GL") == 0)
+ *hwacceleration = PMINFO_HWACCELERATION_NOT_USE_GL;
+ else if (strcasecmp(val, "use-GL") == 0)
+ *hwacceleration = PMINFO_HWACCELERATION_USE_GL;
+ else
+ *hwacceleration = PMINFO_HWACCELERATION_USE_SYSTEM_SETTING;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_screenreader *screenreader)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(screenreader == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->screenreader;
+ if (val) {
+ if (strcasecmp(val, "screenreader-off") == 0)
+ *screenreader = PMINFO_SCREENREADER_OFF;
+ else if (strcasecmp(val, "screenreader-on") == 0)
+ *screenreader = PMINFO_SCREENREADER_ON;
+ else
+ *screenreader = PMINFO_SCREENREADER_USE_SYSTEM_SETTING;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(portrait_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ retvm_if(landscape_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP){
+ *portrait_img = (char *)info->uiapp_info->portraitimg;
+ *landscape_img = (char *)info->uiapp_info->landscapeimg;
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(submode_mainid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *submode_mainid = (char *)info->uiapp_info->submode_mainid;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
+{
+ int col = 0;
+ int cols = 0;
+ int ret = -1;
+ char *val = NULL;
+ char *localed_label = NULL;
+
+ retvm_if(appid == NULL || locale == NULL || label == NULL, PMINFO_R_EINVAL, "Argument is NULL");
+
+ sqlite3_stmt *stmt = NULL;
+ sqlite3 *pkgmgr_parser_db = NULL;
+
+ char *query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
+
+ ret = sqlite3_open(MANIFEST_DB, &pkgmgr_parser_db);
+ if (ret != SQLITE_OK) {
+ _LOGE("open fail\n");
+ sqlite3_free(query);
+ return -1;
+ }
+
+ ret = sqlite3_prepare_v2(pkgmgr_parser_db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("prepare_v2 fail\n");
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_free(query);
+ return -1;
+ }
+
+ cols = sqlite3_column_count(stmt);
+ while(1)
+ {
+ ret = sqlite3_step(stmt);
+ if(ret == SQLITE_ROW) {
+ for(col = 0; col < cols; col++)
+ {
+ val = (char*)sqlite3_column_text(stmt, col);
+ if (val == NULL)
+ break;
+
+ _LOGE("success find localed_label[%s]\n", val);
+
+ localed_label = strdup(val);
+ if (localed_label == NULL)
+ break;
+
+ *label = localed_label;
+
+
+ }
+ ret = 0;
+ } else {
+ break;
+ }
+ }
+
+ /*find default label when exact matching failed*/
+ if (localed_label == NULL) {
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, DEFAULT_LOCALE);
+ ret = sqlite3_prepare_v2(pkgmgr_parser_db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("prepare_v2 fail\n");
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_free(query);
+ return -1;
+ }
+
+ cols = sqlite3_column_count(stmt);
+ while(1)
+ {
+ ret = sqlite3_step(stmt);
+ if(ret == SQLITE_ROW) {
+ for(col = 0; col < cols; col++)
+ {
+ val = (char*)sqlite3_column_text(stmt, col);
+ if (val == NULL)
+ break;
+
+ _LOGE("success find default localed_label[%s]\n", val);
+
+ localed_label = strdup(val);
+ if (localed_label == NULL)
+ break;
+
+ *label = localed_label;
+
+
+ }
+ ret = 0;
+ } else {
+ break;
+ }
+ }
+
+ }
+
+ sqlite3_finalize(stmt);
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_free(query);
+ return ret;
+
+}
+
+API int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(category == NULL, PMINFO_R_EINVAL, "category is NULL");
+ retvm_if(exist == NULL, PMINFO_R_EINVAL, "exist is NULL");
+
+ int ret = -1;
+ category_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *exist = 0;
+
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->category;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->category;
+ else
+ return PMINFO_R_EINVAL;
+
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->name) {
+ if (strcasecmp(ptr->name, category) == 0)
+ {
+ *exist = 1;
+ break;
+ }
+ }
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(metadata_key == NULL, PMINFO_R_EINVAL, "metadata_key is NULL");
+ retvm_if(metadata_value == NULL, PMINFO_R_EINVAL, "metadata_value is NULL");
+
+ int ret = -1;
+ metadata_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->metadata;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->metadata;
+ else
+ return PMINFO_R_EINVAL;
+
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->key) {
+ if (strcasecmp(ptr->key, metadata_key) == 0)
+ {
+ *metadata_value = ptr->value;
+ return PMINFO_R_OK;
+ }
+ }
+ }
+
+ return PMINFO_R_EINVAL;
+}
+
+API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_permission_list_cb permission_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(permission_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+ int ret = -1;
+ permission_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->permission;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->permission;
+ else
+ return PMINFO_R_EINVAL;
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->value) {
+ ret = permission_func(ptr->value, user_data);
+ if (ret < 0)
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_category_list_cb category_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(category_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+ int ret = -1;
+ category_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->category;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->category;
+ else
+ return PMINFO_R_EINVAL;
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->name) {
+ ret = category_func(ptr->name, user_data);
+ if (ret < 0)
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(metadata_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+ int ret = -1;
+ metadata_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->metadata;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->metadata;
+ else
+ return PMINFO_R_EINVAL;
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->key) {
+ ret = metadata_func(ptr->key, ptr->value, user_data);
+ if (ret < 0)
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(appcontrol_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+ int i = 0;
+ int ret = -1;
+ int oc = 0;
+ int mc = 0;
+ int uc = 0;
+ int sc = 0;
+ char *pkgid = NULL;
+ char *manifest = NULL;
+ char **operation = NULL;
+ char **uri = NULL;
+ char **mime = NULL;
+ char **subapp = NULL;
+ appcontrol_x *appcontrol = NULL;
+ manifest_x *mfx = NULL;
+ operation_x *op = NULL;
+ uri_x *ui = NULL;
+ mime_x *mi = NULL;
+ subapp_x *sa = NULL;
+ pkgmgrinfo_app_component component;
+ pkgmgrinfo_appcontrol_x *ptr = NULL;
+ ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
+ if (ret < 0) {
+ _LOGE("Failed to get package name\n");
+ return PMINFO_R_ERROR;
+ }
+ ret = pkgmgrinfo_appinfo_get_component(handle, &component);
+ if (ret < 0) {
+ _LOGE("Failed to get app component name\n");
+ return PMINFO_R_ERROR;
+ }
+ manifest = pkgmgr_parser_get_manifest_file(pkgid);
+ if (manifest == NULL) {
+ _LOGE("Failed to fetch package manifest file\n");
+ return PMINFO_R_ERROR;
+ }
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ if (mfx == NULL) {
+ _LOGE("Failed to parse package manifest file\n");
+ free(manifest);
+ manifest = NULL;
+ return PMINFO_R_ERROR;
+ }
+ free(manifest);
+ ptr = calloc(1, sizeof(pkgmgrinfo_appcontrol_x));
+ if (ptr == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ pkgmgr_parser_free_manifest_xml(mfx);
+ return PMINFO_R_ERROR;
+ }
+ /*Get Operation, Uri, Mime*/
+ switch (component) {
+ case PMINFO_UI_APP:
+ if (mfx->uiapplication) {
+ if (mfx->uiapplication->appsvc) {
+ appcontrol = mfx->uiapplication->appsvc;
+ }
+ }
+ break;
+ case PMINFO_SVC_APP:
+ if (mfx->serviceapplication) {
+ if (mfx->serviceapplication->appsvc) {
+ appcontrol = mfx->serviceapplication->appsvc;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ for (; appcontrol; appcontrol = appcontrol->next) {
+ op = appcontrol->operation;
+ for (; op; op = op->next)
+ oc = oc + 1;
+ op = appcontrol->operation;
+
+ ui = appcontrol->uri;
+ for (; ui; ui = ui->next)
+ uc = uc + 1;
+ ui = appcontrol->uri;
+
+ mi = appcontrol->mime;
+ for (; mi; mi = mi->next)
+ mc = mc + 1;
+ mi = appcontrol->mime;
+
+ sa = appcontrol->subapp;
+ for (; sa; sa = sa->next)
+ sc = sc + 1;
+ sa = appcontrol->subapp;
+
+ operation = (char **)calloc(oc, sizeof(char *));
+ for (i = 0; i < oc; i++) {
+ operation[i] = strndup(op->name, PKG_STRING_LEN_MAX - 1);
+ op = op->next;
+ }
+
+ uri = (char **)calloc(uc, sizeof(char *));
+ for (i = 0; i < uc; i++) {
+ uri[i] = strndup(ui->name, PKG_STRING_LEN_MAX - 1);
+ ui = ui->next;
+ }
+
+ mime = (char **)calloc(mc, sizeof(char *));
+ for (i = 0; i < mc; i++) {
+ mime[i] = strndup(mi->name, PKG_STRING_LEN_MAX - 1);
+ mi = mi->next;
+ }
+
+ subapp = (char **)calloc(sc, sizeof(char *));
+ for (i = 0; i < sc; i++) {
+ subapp[i] = strndup(sa->name, PKG_STRING_LEN_MAX - 1);
+ sa = sa->next;
+ }
+
+ /*populate appcontrol handle*/
+ ptr->operation_count = oc;
+ ptr->uri_count = uc;
+ ptr->mime_count = mc;
+ ptr->subapp_count = sc;
+ ptr->operation = operation;
+ ptr->uri = uri;
+ ptr->mime = mime;
+ ptr->subapp = subapp;
+
+ ret = appcontrol_func((void *)ptr, user_data);
+ for (i = 0; i < oc; i++) {
+ if (operation[i]) {
+ free(operation[i]);
+ operation[i] = NULL;
+ }
+ }
+ if (operation) {
+ free(operation);
+ operation = NULL;
+ }
+ for (i = 0; i < uc; i++) {
+ if (uri[i]) {
+ free(uri[i]);
+ uri[i] = NULL;
+ }
+ }
+ if (uri) {
+ free(uri);
+ uri = NULL;
+ }
+ for (i = 0; i < mc; i++) {
+ if (mime[i]) {
+ free(mime[i]);
+ mime[i] = NULL;
+ }
+ }
+ if (mime) {
+ free(mime);
+ mime = NULL;
+ }
+ for (i = 0; i < sc; i++) {
+ if (subapp[i]) {
+ free(subapp[i]);
+ subapp[i] = NULL;
+ }
+ }
+ if (subapp) {
+ free(subapp);
+ subapp = NULL;
+ }
+ if (ret < 0)
+ break;
+ uc = 0;
+ mc = 0;
+ oc = 0;
+ sc = 0;
+ }
+ pkgmgr_parser_free_manifest_xml(mfx);
+ if (ptr) {
+ free(ptr);
+ ptr = NULL;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(nodisplay == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->nodisplay;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *nodisplay = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *nodisplay = 0;
+ else
+ *nodisplay = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(multiple == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->multiple;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *multiple = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *multiple = 0;
+ else
+ *multiple = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(indicator_disp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->indicatordisplay;
+ if (val) {
+ if (strcasecmp(val, "true") == 0){
+ *indicator_disp = 1;
+ }else if (strcasecmp(val, "false") == 0){
+ *indicator_disp = 0;
+ }else{
+ *indicator_disp = 0;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(taskmanage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->taskmanage;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *taskmanage = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *taskmanage = 0;
+ else
+ *taskmanage = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(enabled == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ val = (char *)info->uiapp_info->enabled;
+ else if (info->app_component == PMINFO_SVC_APP)
+ val = (char *)info->uiapp_info->enabled;
+ else {
+ _LOGE("invalid component type\n");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *enabled = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *enabled = 0;
+ else
+ *enabled = 1;
+ }
+ return PMINFO_R_OK;
+
+}
+
+API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(onboot == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ val = (char *)info->uiapp_info->onboot;
+ else if (info->app_component == PMINFO_SVC_APP)
+ val = (char *)info->svcapp_info->onboot;
+ else {
+ _LOGE("invalid component type\n");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *onboot = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *onboot = 0;
+ else
+ *onboot = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(autorestart == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ val = (char *)info->uiapp_info->autorestart;
+ else if (info->app_component == PMINFO_SVC_APP)
+ val = (char *)info->svcapp_info->autorestart;
+ else {
+ _LOGE("invalid component type\n");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *autorestart = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *autorestart = 0;
+ else
+ *autorestart = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h handle, bool *mainapp)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(mainapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->mainapp;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *mainapp = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *mainapp = 0;
+ else
+ *mainapp = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(preload == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->preload;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *preload = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *preload = 0;
+ else
+ *preload = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(submode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->submode;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *submode = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *submode = 0;
+ else
+ *submode = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(process_pool == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->process_pool;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *process_pool = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *process_pool = 0;
+ else
+ *process_pool = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ __cleanup_appinfo(info);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
+{
+ return (pkgmgrinfo_pkginfo_filter_create(handle));
+}
+
+API int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
+{
+ return (pkgmgrinfo_pkginfo_filter_destroy(handle));
+}
+
+API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
+ const char *property, const int value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char buf[PKG_VALUE_STRING_LEN_MAX] = {'\0'};
+ char *val = NULL;
+ GSList *link = NULL;
+ int prop = -1;
+ prop = _pminfo_appinfo_convert_to_prop_int(property);
+ if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_INT ||
+ prop > E_PMINFO_APPINFO_PROP_APP_MAX_INT) {
+ _LOGE("Invalid Integer Property\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+ snprintf(buf, PKG_VALUE_STRING_LEN_MAX - 1, "%d", value);
+ val = strndup(buf, PKG_VALUE_STRING_LEN_MAX - 1);
+ if (val == NULL) {
+ _LOGE("Out of Memory\n");
+ free(node);
+ node = NULL;
+ return PMINFO_R_ERROR;
+ }
+ node->prop = prop;
+ node->value = val;
+ /*If API is called multiple times for same property, we should override the previous values.
+ Last value set will be used for filtering.*/
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ return PMINFO_R_OK;
+
+}
+
+API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
+ const char *property, const bool value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *val = NULL;
+ GSList *link = NULL;
+ int prop = -1;
+ prop = _pminfo_appinfo_convert_to_prop_bool(property);
+ if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_BOOL ||
+ prop > E_PMINFO_APPINFO_PROP_APP_MAX_BOOL) {
+ _LOGE("Invalid Boolean Property\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+ if (value)
+ val = strndup("('true','True')", 15);
+ else
+ val = strndup("('false','False')", 17);
+ if (val == NULL) {
+ _LOGE("Out of Memory\n");
+ free(node);
+ node = NULL;
+ return PMINFO_R_ERROR;
+ }
+ node->prop = prop;
+ node->value = val;
+ /*If API is called multiple times for same property, we should override the previous values.
+ Last value set will be used for filtering.*/
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ return PMINFO_R_OK;
+
+}
+
+API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
+ const char *property, const char *value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(value == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *val = NULL;
+ pkgmgrinfo_node_x *ptr = NULL;
+ char prev[PKG_STRING_LEN_MAX] = {'\0'};
+ char temp[PKG_STRING_LEN_MAX] = {'\0'};
+ GSList *link = NULL;
+ int prop = -1;
+ prop = _pminfo_appinfo_convert_to_prop_str(property);
+ if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_STR ||
+ prop > E_PMINFO_APPINFO_PROP_APP_MAX_STR) {
+ _LOGE("Invalid String Property\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+ node->prop = prop;
+ switch (prop) {
+ case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
+ if (strcmp(value, PMINFO_APPINFO_UI_APP) == 0)
+ val = strndup("uiapp", PKG_STRING_LEN_MAX - 1);
+ else
+ val = strndup("svcapp", PKG_STRING_LEN_MAX - 1);
+ node->value = val;
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
+ case E_PMINFO_APPINFO_PROP_APP_OPERATION:
+ case E_PMINFO_APPINFO_PROP_APP_URI:
+ case E_PMINFO_APPINFO_PROP_APP_MIME:
+ val = (char *)calloc(1, PKG_STRING_LEN_MAX);
+ if (val == NULL) {
+ _LOGE("Out of Memory\n");
+ free(node);
+ node = NULL;
+ return PMINFO_R_ERROR;
+ }
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link) {
+ ptr = (pkgmgrinfo_node_x *)link->data;
+ strncpy(prev, ptr->value, PKG_STRING_LEN_MAX - 1);
+ _LOGS("Previous value is %s\n", prev);
+ filter->list = g_slist_delete_link(filter->list, link);
+ snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s , '%s'", prev, value);
+ strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
+ _LOGS("New value is %s\n", val);
+ node->value = val;
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ memset(temp, '\0', PKG_STRING_LEN_MAX);
+ } else {
+ snprintf(temp, PKG_STRING_LEN_MAX - 1, "'%s'", value);
+ strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
+ _LOGS("First value is %s\n", val);
+ node->value = val;
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ memset(temp, '\0', PKG_STRING_LEN_MAX);
+ }
+ break;
+ default:
+ node->value = strndup(value, PKG_STRING_LEN_MAX - 1);
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ break;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(count == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *locale = NULL;
+ char *condition = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char where[MAX_QUERY_LEN] = {'\0'};
+ GSList *list;
+ int ret = 0;
+ uiapplication_x *ptr1 = NULL;
+ serviceapplication_x *ptr2 = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ sqlite3 *pkginfo_db = NULL;
+ int filter_count = 0;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*Start constructing query*/
+ snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_APP, locale);
+ /*Get where clause*/
+ for (list = filter->list; list; list = g_slist_next(list)) {
+ __get_filter_condition(list->data, &condition);
+ if (condition) {
+ strncat(where, condition, sizeof(where) - strlen(where) -1);
+ where[sizeof(where) - 1] = '\0';
+ free(condition);
+ condition = NULL;
+ }
+ if (g_slist_next(list)) {
+ strncat(where, " and ", sizeof(where) - strlen(where) - 1);
+ where[sizeof(where) - 1] = '\0';
+ }
+ }
+ _LOGS("where = %s\n", where);
+ if (strlen(where) > 0) {
+ strncat(query, where, sizeof(query) - strlen(query) - 1);
+ query[sizeof(query) - 1] = '\0';
+ }
+ _LOGS("query = %s\n", query);
+ /*To get filtered list*/
+ pkgmgr_pkginfo_x *info = NULL;
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ /*To get detail app info for each member of filtered list*/
+ pkgmgr_pkginfo_x *filtinfo = NULL;
+ filtinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(filtinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ filtinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(filtinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ pkgmgr_appinfo_x *appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ ret = __exec_db_query(pkginfo_db, query, __app_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+ if (info->manifest_info->serviceapplication) {
+ LISTHEAD(info->manifest_info->serviceapplication, ptr2);
+ info->manifest_info->serviceapplication = ptr2;
+ }
+ /*Filtered UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
+ ptr1->appid, "uiapp");
+ ret = __exec_db_query(pkginfo_db, query, __uiapp_list_cb, (void *)filtinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+ }
+ for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
+ {
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
+ ptr2->appid, "svcapp");
+ ret = __exec_db_query(pkginfo_db, query, __svcapp_list_cb, (void *)filtinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+ }
+ if (filtinfo->manifest_info->uiapplication) {
+ LISTHEAD(filtinfo->manifest_info->uiapplication, ptr1);
+ filtinfo->manifest_info->uiapplication = ptr1;
+ }
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(ptr1 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = ptr1;
+ appinfo->app_component = PMINFO_UI_APP;
+
+ ret = __appinfo_check_installed_storage(appinfo);
+ if(ret < 0) {
+ ptr1 = ptr1->next;
+ continue;
+ }
+
+ filter_count++;
+
+ ptr1 = ptr1->next;
+ }
+ /*Filtered Service Apps*/
+ if (filtinfo->manifest_info->serviceapplication) {
+ LISTHEAD(filtinfo->manifest_info->serviceapplication, ptr2);
+ filtinfo->manifest_info->serviceapplication = ptr2;
+ }
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(ptr2 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->svcapp_info = ptr2;
+ appinfo->app_component = PMINFO_SVC_APP;
+ filter_count++;
+ ptr2 = ptr2->next;
+ }
+ *count = filter_count;
+
+ ret = PMINFO_R_OK;
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_close(pkginfo_db);
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ __cleanup_pkginfo(filtinfo);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
+ pkgmgrinfo_app_list_cb app_cb, void * user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(app_cb == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *locale = NULL;
+ char *condition = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char where[MAX_QUERY_LEN] = {'\0'};
+ GSList *list;
+ int ret = 0;
+ uiapplication_x *ptr1 = NULL;
+ serviceapplication_x *ptr2 = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*Start constructing query*/
+ snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_APP, locale);
+ /*Get where clause*/
+ for (list = filter->list; list; list = g_slist_next(list)) {
+ __get_filter_condition(list->data, &condition);
+ if (condition) {
+ strncat(where, condition, sizeof(where) - strlen(where) -1);
+ where[sizeof(where) - 1] = '\0';
+ free(condition);
+ condition = NULL;
+ }
+ if (g_slist_next(list)) {
+ strncat(where, " and ", sizeof(where) - strlen(where) - 1);
+ where[sizeof(where) - 1] = '\0';
+ }
+ }
+ _LOGS("where = %s\n", where);
+ if (strlen(where) > 0) {
+ strncat(query, where, sizeof(query) - strlen(query) - 1);
+ query[sizeof(query) - 1] = '\0';
+ }
+ _LOGS("query = %s\n", query);
+ /*To get filtered list*/
+ pkgmgr_pkginfo_x *info = NULL;
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ /*To get detail app info for each member of filtered list*/
+ pkgmgr_pkginfo_x *filtinfo = NULL;
+ filtinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(filtinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ filtinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(filtinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ pkgmgr_appinfo_x *appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ ret = __exec_db_query(pkginfo_db, query, __app_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+ if (info->manifest_info->serviceapplication) {
+ LISTHEAD(info->manifest_info->serviceapplication, ptr2);
+ info->manifest_info->serviceapplication = ptr2;
+ }
+ /*Filtered UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
+ ptr1->appid, "uiapp");
+ ret = __exec_db_query(pkginfo_db, query, __uiapp_list_cb, (void *)filtinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+ }
+ for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
+ {
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
+ ptr2->appid, "svcapp");
+ ret = __exec_db_query(pkginfo_db, query, __svcapp_list_cb, (void *)filtinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+ }
+ if (filtinfo->manifest_info->uiapplication) {
+ LISTHEAD(filtinfo->manifest_info->uiapplication, ptr1);
+ filtinfo->manifest_info->uiapplication = ptr1;
+ }
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(ptr1 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = ptr1;
+ appinfo->app_component = PMINFO_UI_APP;
+
+ ret = __appinfo_check_installed_storage(appinfo);
+ if(ret < 0) {
+ ptr1 = ptr1->next;
+ continue;
+ }
+
+ ret = app_cb((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ ptr1 = ptr1->next;
+ }
+ /*Filtered Service Apps*/
+ if (filtinfo->manifest_info->serviceapplication) {
+ LISTHEAD(filtinfo->manifest_info->serviceapplication, ptr2);
+ filtinfo->manifest_info->serviceapplication = ptr2;
+ }
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(ptr2 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->svcapp_info = ptr2;
+ appinfo->app_component = PMINFO_SVC_APP;
+ ret = app_cb((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ ptr2 = ptr2->next;
+ }
+ ret = PMINFO_R_OK;
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_close(pkginfo_db);
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ __cleanup_pkginfo(filtinfo);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
+{
+ return (pkgmgrinfo_pkginfo_filter_create(handle));
+}
+
+API int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
+{
+ return (pkgmgrinfo_pkginfo_filter_destroy(handle));
+}
+
+API int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle,
+ const char *key, const char *value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "filter handle is NULL\n");
+ retvm_if(key == NULL, PMINFO_R_EINVAL, "metadata key supplied is NULL\n");
+ /*value can be NULL. In that case all apps with specified key should be displayed*/
+ int ret = 0;
+ char *k = NULL;
+ char *v = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ retvm_if(node == NULL, PMINFO_R_ERROR, "Out of Memory!!!\n");
+ k = strdup(key);
+ tryvm_if(k == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+ node->key = k;
+ if (value) {
+ v = strdup(value);
+ tryvm_if(v == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+ }
+ node->value = v;
+ /*If API is called multiple times, we should OR all conditions.*/
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ /*All memory will be freed in destroy API*/
+ return PMINFO_R_OK;
+catch:
+ if (node) {
+ if (node->key) {
+ free(node->key);
+ node->key = NULL;
+ }
+ if (node->value) {
+ free(node->value);
+ node->value = NULL;
+ }
+ free(node);
+ node = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
+ pkgmgrinfo_app_list_cb app_cb, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "filter handle is NULL\n");
+ retvm_if(app_cb == NULL, PMINFO_R_EINVAL, "Callback function supplied is NULL\n");
+ char *locale = NULL;
+ char *condition = NULL;
+ char *error_message = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char where[MAX_QUERY_LEN] = {'\0'};
+ GSList *list;
+ int ret = 0;
+ pkgmgr_pkginfo_x *info = NULL;
+ pkgmgr_pkginfo_x *filtinfo = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ uiapplication_x *ptr1 = NULL;
+ serviceapplication_x *ptr2 = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*Get current locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL\n");
+
+ /*Start constructing query*/
+ memset(where, '\0', MAX_QUERY_LEN);
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN - 1, METADATA_FILTER_QUERY_SELECT_CLAUSE);
+ /*Get where clause*/
+ for (list = filter->list; list; list = g_slist_next(list)) {
+ __get_metadata_filter_condition(list->data, &condition);
+ if (condition) {
+ strncat(where, condition, sizeof(where) - strlen(where) -1);
+ free(condition);
+ condition = NULL;
+ }
+ if (g_slist_next(list)) {
+ strncat(where, METADATA_FILTER_QUERY_UNION_CLAUSE, sizeof(where) - strlen(where) - 1);
+ }
+ }
+ _LOGE("where = %s (%d)\n", where, strlen(where));
+ if (strlen(where) > 0) {
+ strncat(query, where, sizeof(query) - strlen(query) - 1);
+ }
+ _LOGE("query = %s (%d)\n", query, strlen(query));
+ /*To get filtered list*/
+ info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ /*To get detail app info for each member of filtered list*/
+ filtinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(filtinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ filtinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(filtinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ ret = sqlite3_exec(pkginfo_db, query, __app_list_cb, (void *)info, &error_message);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
+ memset(query, '\0', MAX_QUERY_LEN);
+
+ if (info->manifest_info->uiapplication) {
+ LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ info->manifest_info->uiapplication = ptr1;
+ }
+ if (info->manifest_info->serviceapplication) {
+ LISTHEAD(info->manifest_info->serviceapplication, ptr2);
+ info->manifest_info->serviceapplication = ptr2;
+ }
+
+ /*UI Apps*/
+ for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ {
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
+ ptr1->appid, "uiapp");
+ ret = sqlite3_exec(pkginfo_db, query, __uiapp_list_cb, (void *)filtinfo, &error_message);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ /*Service Apps*/
+ for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
+ {
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' and app_component='%s'",
+ ptr2->appid, "svcapp");
+ ret = sqlite3_exec(pkginfo_db, query, __svcapp_list_cb, (void *)filtinfo, &error_message);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s error message = %s\n", query, error_message);
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ /*Filtered UI Apps*/
+ if (filtinfo->manifest_info->uiapplication) {
+ LISTHEAD(filtinfo->manifest_info->uiapplication, ptr1);
+ filtinfo->manifest_info->uiapplication = ptr1;
+ }
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(ptr1 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = ptr1;
+ appinfo->app_component = PMINFO_UI_APP;
+ ret = app_cb((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ ptr1 = ptr1->next;
+ }
+ /*Filtered Service Apps*/
+ if (filtinfo->manifest_info->serviceapplication) {
+ LISTHEAD(filtinfo->manifest_info->serviceapplication, ptr2);
+ filtinfo->manifest_info->serviceapplication = ptr2;
+ }
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(ptr2 != NULL)
+ {
+ appinfo->locale = strdup(locale);
+ appinfo->svcapp_info = ptr2;
+ appinfo->app_component = PMINFO_SVC_APP;
+ ret = app_cb((void *)appinfo, user_data);
+ if (ret < 0)
+ break;
+ ptr2 = ptr2->next;
+ }
+ ret = PMINFO_R_OK;
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_free(error_message);
+ sqlite3_close(pkginfo_db);
+ if (appinfo) {
+ free(appinfo);
+ appinfo = NULL;
+ }
+ __cleanup_pkginfo(info);
+ __cleanup_pkginfo(filtinfo);
+ return ret;
+}
--- /dev/null
+/*
+ * pkgmgrinfo-certinfo
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Junsuk Oh <junsuk77.oh@samsung.com>,
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sqlite3.h>
+#include <db-util.h>
+
+#include "pkgmgr-info-internal.h"
+#include "pkgmgr-info-debug.h"
+#include "pkgmgr-info.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_CERT"
+
+
+typedef struct _pkgmgr_instcertinfo_x {
+ char *pkgid;
+ char *cert_info[MAX_CERT_TYPE]; /*certificate data*/
+ int is_new[MAX_CERT_TYPE]; /*whether already exist in table or not*/
+ int ref_count[MAX_CERT_TYPE]; /*reference count of certificate data*/
+ int cert_id[MAX_CERT_TYPE]; /*certificate ID in index table*/
+} pkgmgr_instcertinfo_x;
+
+typedef struct _pkgmgr_certindexinfo_x {
+ int cert_id;
+ int cert_ref_count;
+} pkgmgr_certindexinfo_x;
+
+typedef struct _pkgmgr_certinfo_x {
+ char *pkgid;
+ char *cert_value;
+ char *cert_info[MAX_CERT_TYPE]; /*certificate info*/
+ int cert_id[MAX_CERT_TYPE]; /*certificate ID in index table*/
+} pkgmgr_certinfo_x;
+
+__thread sqlite3 *cert_db = NULL;
+
+static int __maxid_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ int *p = (int*)data;
+ if (coltxt[0])
+ *p = atoi(coltxt[0]);
+ return 0;
+}
+
+static int __certinfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_certinfo_x *info = (pkgmgr_certinfo_x *)data;
+ int i = 0;
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "package") == 0) {
+ if (coltxt[i])
+ info->pkgid = strdup(coltxt[i]);
+ else
+ info->pkgid = NULL;
+ } else if (strcmp(colname[i], "author_signer_cert") == 0) {
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_AUTHOR_SIGNER_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_AUTHOR_SIGNER_CERT] = 0;
+ } else if (strcmp(colname[i], "author_im_cert") == 0) {
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_AUTHOR_INTERMEDIATE_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_AUTHOR_INTERMEDIATE_CERT] = 0;
+ } else if (strcmp(colname[i], "author_root_cert") == 0) {
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_AUTHOR_ROOT_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_AUTHOR_ROOT_CERT] = 0;
+ } else if (strcmp(colname[i], "dist_signer_cert") == 0 ){
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_DISTRIBUTOR_SIGNER_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_DISTRIBUTOR_SIGNER_CERT] = 0;
+ } else if (strcmp(colname[i], "dist_im_cert") == 0 ){
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT] = 0;
+ } else if (strcmp(colname[i], "dist_root_cert") == 0 ){
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_DISTRIBUTOR_ROOT_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_DISTRIBUTOR_ROOT_CERT] = 0;
+ } else if (strcmp(colname[i], "dist2_signer_cert") == 0 ){
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_DISTRIBUTOR2_SIGNER_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_DISTRIBUTOR2_SIGNER_CERT] = 0;
+ } else if (strcmp(colname[i], "dist2_im_cert") == 0 ){
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT] = 0;
+ } else if (strcmp(colname[i], "dist2_root_cert") == 0 ){
+ if (coltxt[i])
+ (info->cert_id)[PMINFO_DISTRIBUTOR2_ROOT_CERT] = atoi(coltxt[i]);
+ else
+ (info->cert_id)[PMINFO_DISTRIBUTOR2_ROOT_CERT] = 0;
+ } else if (strcmp(colname[i], "cert_info") == 0 ){
+ if (coltxt[i])
+ info->cert_value = strdup(coltxt[i]);
+ else
+ info->cert_value = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+static int __certindexinfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_certindexinfo_x *info = (pkgmgr_certindexinfo_x *)data;
+ int i = 0;
+ for(i = 0; i < ncols; i++) {
+ if (strcmp(colname[i], "cert_id") == 0) {
+ if (coltxt[i])
+ info->cert_id = atoi(coltxt[i]);
+ else
+ info->cert_id = 0;
+ } else if (strcmp(colname[i], "cert_ref_count") == 0) {
+ if (coltxt[i])
+ info->cert_ref_count = atoi(coltxt[i]);
+ else
+ info->cert_ref_count = 0;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+static int __exec_certinfo_query(char *query, void *data)
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, query, __certinfo_cb, data, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
+static int __exec_certindexinfo_query(char *query, void *data)
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, query, __certindexinfo_cb, data, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
+static int __delete_certinfo(const char *pkgid)
+{
+ int ret = -1;
+ int i = 0;
+ int j = 0;
+ int c = 0;
+ int unique_id[MAX_CERT_TYPE] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+ char *error_message = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ pkgmgr_certinfo_x *certinfo = NULL;
+ pkgmgr_certindexinfo_x *indexinfo = NULL;
+ certinfo = calloc(1, sizeof(pkgmgr_certinfo_x));
+ retvm_if(certinfo == NULL, PMINFO_R_ERROR, "Malloc Failed\n");
+ indexinfo = calloc(1, sizeof(pkgmgr_certindexinfo_x));
+ if (indexinfo == NULL) {
+ _LOGE("Out of Memory!!!");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ /*populate certinfo from DB*/
+ char *sel_query = sqlite3_mprintf("select * from package_cert_info where package=%Q ", pkgid);
+ ret = __exec_certinfo_query(sel_query, (void *)certinfo);
+ sqlite3_free(sel_query);
+ if (ret == -1) {
+ _LOGE("Package Cert Info DB Information retrieval failed\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ /*Update cert index table*/
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((certinfo->cert_id)[i]) {
+ for (j = 0; j < MAX_CERT_TYPE; j++) {
+ if ((certinfo->cert_id)[i] == unique_id[j]) {
+ /*Ref count has already been updated. Just continue*/
+ break;
+ }
+ }
+ if (j == MAX_CERT_TYPE)
+ unique_id[c++] = (certinfo->cert_id)[i];
+ else
+ continue;
+ snprintf(query, MAX_QUERY_LEN, "select * from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
+ ret = __exec_certindexinfo_query(query, (void *)indexinfo);
+ if (ret == -1) {
+ _LOGE("Cert Info DB Information retrieval failed\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ if (indexinfo->cert_ref_count > 1) {
+ /*decrease ref count*/
+ snprintf(query, MAX_QUERY_LEN, "update package_cert_index_info set cert_ref_count=%d where cert_id=%d ",
+ indexinfo->cert_ref_count - 1, (certinfo->cert_id)[i]);
+ } else {
+ /*delete this certificate as ref count is 1 and it will become 0*/
+ snprintf(query, MAX_QUERY_LEN, "delete from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
+ }
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ }
+ }
+ /*Now delete the entry from db*/
+ char *del_query = sqlite3_mprintf("delete from package_cert_info where package=%Q", pkgid);
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, del_query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", del_query,
+ error_message);
+ sqlite3_free(error_message);
+ sqlite3_free(del_query);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ sqlite3_free(del_query);
+ ret = PMINFO_R_OK;
+err:
+ if (indexinfo) {
+ free(indexinfo);
+ indexinfo = NULL;
+ }
+ if (certinfo->pkgid) {
+ free(certinfo->pkgid);
+ certinfo->pkgid = NULL;
+ }
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((certinfo->cert_info)[i]) {
+ free((certinfo->cert_info)[i]);
+ (certinfo->cert_info)[i] = NULL;
+ }
+ }
+ free(certinfo);
+ certinfo = NULL;
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_certinfo_x *certinfo = NULL;
+ certinfo = calloc(1, sizeof(pkgmgr_certinfo_x));
+ retvm_if(certinfo == NULL, PMINFO_R_ERROR, "Malloc Failed\n");
+ *handle = (void *)certinfo;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "package ID is NULL\n");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Certinfo handle is NULL\n");
+ pkgmgr_certinfo_x *certinfo = NULL;
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ int i = 0;
+
+ /*Open db.*/
+ ret = db_util_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READONLY, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("connect db [%s] failed!\n", CERT_DB);
+ return PMINFO_R_ERROR;
+ }
+
+ certinfo = (pkgmgr_certinfo_x *)handle;
+ /*populate certinfo from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_cert_info where package='%s' ", pkgid);
+ ret = __exec_certinfo_query(query, (void *)certinfo);
+ if (ret == -1) {
+ _LOGE("Package Cert Info DB Information retrieval failed\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+
+ if (certinfo->pkgid == NULL) {
+ _LOGE("Package not found in DB\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select cert_info from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
+ ret = __exec_certinfo_query(query, (void *)certinfo);
+ if (ret == -1) {
+ _LOGE("Cert Info DB Information retrieval failed\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ if (certinfo->cert_value) {
+ (certinfo->cert_info)[i] = strdup(certinfo->cert_value);
+ free(certinfo->cert_value);
+ certinfo->cert_value = NULL;
+ }
+ }
+err:
+ sqlite3_close(cert_db);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(cert_value == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(cert_type < PMINFO_AUTHOR_ROOT_CERT, PMINFO_R_EINVAL, "Invalid certificate type\n");
+ retvm_if(cert_type > PMINFO_DISTRIBUTOR2_SIGNER_CERT, PMINFO_R_EINVAL, "Invalid certificate type\n");
+ pkgmgr_certinfo_x *certinfo = NULL;
+ certinfo = (pkgmgr_certinfo_x *)handle;
+ if ((certinfo->cert_info)[cert_type])
+ *cert_value = (certinfo->cert_info)[cert_type];
+ else
+ *cert_value = NULL;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ int i = 0;
+ pkgmgr_certinfo_x *certinfo = NULL;
+ certinfo = (pkgmgr_certinfo_x *)handle;
+ if (certinfo->pkgid) {
+ free(certinfo->pkgid);
+ certinfo->pkgid = NULL;
+ }
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((certinfo->cert_info)[i]) {
+ free((certinfo->cert_info)[i]);
+ (certinfo->cert_info)[i] = NULL;
+ }
+ }
+ free(certinfo);
+ certinfo = NULL;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_instcertinfo_x *certinfo = NULL;
+ certinfo = calloc(1, sizeof(pkgmgr_instcertinfo_x));
+ retvm_if(certinfo == NULL, PMINFO_R_ERROR, "Malloc Failed\n");
+ *handle = (void *)certinfo;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(cert_value == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(cert_type < PMINFO_SET_AUTHOR_ROOT_CERT, PMINFO_R_EINVAL, "Invalid certificate type\n");
+ retvm_if(cert_type > PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT, PMINFO_R_EINVAL, "Invalid certificate type\n");
+ pkgmgr_instcertinfo_x *certinfo = NULL;
+ certinfo = (pkgmgr_instcertinfo_x *)handle;
+ (certinfo->cert_info)[cert_type] = strdup(cert_value);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "package ID is NULL\n");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Certinfo handle is NULL\n");
+ char *error_message = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *vquery = NULL;
+ int len = 0;
+ int i = 0;
+ int j = 0;
+ int c = 0;
+ int unique_id[MAX_CERT_TYPE] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+ int newid = 0;
+ int is_new = 0;
+ int exist = -1;
+ int ret = -1;
+ int maxid = 0;
+ int flag = 0;
+ pkgmgr_instcertinfo_x *info = (pkgmgr_instcertinfo_x *)handle;
+ pkgmgr_certindexinfo_x *indexinfo = NULL;
+ indexinfo = calloc(1, sizeof(pkgmgr_certindexinfo_x));
+ if (indexinfo == NULL) {
+ _LOGE("Out of Memory!!!");
+ return PMINFO_R_ERROR;
+ }
+ info->pkgid = strdup(pkgid);
+
+ /*Open db.*/
+ ret = db_util_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READWRITE, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("connect db [%s] failed!\n", CERT_DB);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ /*Begin Transaction*/
+ ret = sqlite3_exec(cert_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ _LOGE("Transaction Begin\n");
+ /*Check if request is to insert/update*/
+ char *cert_query = sqlite3_mprintf("select exists(select * from package_cert_info where package=%Q)", pkgid);
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, cert_query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", cert_query,
+ error_message);
+ sqlite3_free(cert_query);
+ sqlite3_free(error_message);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ sqlite3_free(cert_query);
+
+ if (exist) {
+ /*Update request.
+ We cant just issue update query directly. We need to manage index table also.
+ Hence it is better to delete and insert again in case of update*/
+ ret = __delete_certinfo(pkgid);
+ if (ret < 0)
+ _LOGE("Certificate Deletion Failed\n");
+ }
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((info->cert_info)[i]) {
+ for (j = 0; j < i; j++) {
+ if ( (info->cert_info)[j]) {
+ if (strcmp((info->cert_info)[i], (info->cert_info)[j]) == 0) {
+ (info->cert_id)[i] = (info->cert_id)[j];
+ (info->is_new)[i] = 0;
+ (info->ref_count)[i] = (info->ref_count)[j];
+ break;
+ }
+ }
+ }
+ if (j < i)
+ continue;
+ snprintf(query, MAX_QUERY_LEN, "select * from package_cert_index_info " \
+ "where cert_info='%s'",(info->cert_info)[i]);
+ ret = __exec_certindexinfo_query(query, (void *)indexinfo);
+ if (ret == -1) {
+ _LOGE("Cert Info DB Information retrieval failed\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ if (indexinfo->cert_id == 0) {
+ /*New certificate. Get newid*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select MAX(cert_id) from package_cert_index_info ");
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, query, __maxid_cb, (void *)&newid, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ newid = newid + 1;
+ if (flag == 0) {
+ maxid = newid;
+ flag = 1;
+ }
+ indexinfo->cert_id = maxid;
+ indexinfo->cert_ref_count = 1;
+ is_new = 1;
+ maxid = maxid + 1;
+ }
+ (info->cert_id)[i] = indexinfo->cert_id;
+ (info->is_new)[i] = is_new;
+ (info->ref_count)[i] = indexinfo->cert_ref_count;
+ _LOGE("Id:Count = %d %d\n", indexinfo->cert_id, indexinfo->cert_ref_count);
+ indexinfo->cert_id = 0;
+ indexinfo->cert_ref_count = 0;
+ is_new = 0;
+ }
+ }
+ len = MAX_QUERY_LEN;
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((info->cert_info)[i])
+ len+= strlen((info->cert_info)[i]);
+ }
+ vquery = (char *)calloc(1, len);
+ /*insert*/
+ snprintf(vquery, len,
+ "insert into package_cert_info(package, author_root_cert, author_im_cert, author_signer_cert, dist_root_cert, " \
+ "dist_im_cert, dist_signer_cert, dist2_root_cert, dist2_im_cert, dist2_signer_cert) " \
+ "values('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d)",\
+ info->pkgid,(info->cert_id)[PMINFO_SET_AUTHOR_ROOT_CERT],(info->cert_id)[PMINFO_SET_AUTHOR_INTERMEDIATE_CERT],
+ (info->cert_id)[PMINFO_SET_AUTHOR_SIGNER_CERT], (info->cert_id)[PMINFO_SET_DISTRIBUTOR_ROOT_CERT],
+ (info->cert_id)[PMINFO_SET_DISTRIBUTOR_INTERMEDIATE_CERT], (info->cert_id)[PMINFO_SET_DISTRIBUTOR_SIGNER_CERT],
+ (info->cert_id)[PMINFO_SET_DISTRIBUTOR2_ROOT_CERT],(info->cert_id)[PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT],
+ (info->cert_id)[PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT]);
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, vquery, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", vquery,
+ error_message);
+ sqlite3_free(error_message);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ /*Update index table info*/
+ /*If cert_id exists and is repeated for current package, ref count should only be increased once*/
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((info->cert_info)[i]) {
+ memset(vquery, '\0', len);
+ if ((info->is_new)[i]) {
+ snprintf(vquery, len, "insert into package_cert_index_info(cert_info, cert_id, cert_ref_count) " \
+ "values('%s', '%d', '%d') ", (info->cert_info)[i], (info->cert_id)[i], 1);
+ unique_id[c++] = (info->cert_id)[i];
+ } else {
+ /*Update*/
+ for (j = 0; j < MAX_CERT_TYPE; j++) {
+ if ((info->cert_id)[i] == unique_id[j]) {
+ /*Ref count has already been increased. Just continue*/
+ break;
+ }
+ }
+ if (j == MAX_CERT_TYPE)
+ unique_id[c++] = (info->cert_id)[i];
+ else
+ continue;
+ snprintf(vquery, len, "update package_cert_index_info set cert_ref_count=%d " \
+ "where cert_id=%d", (info->ref_count)[i] + 1, (info->cert_id)[i]);
+ }
+ if (SQLITE_OK !=
+ sqlite3_exec(cert_db, vquery, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", vquery,
+ error_message);
+ sqlite3_free(error_message);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ }
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(cert_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(cert_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ _LOGE("Transaction Commit and End\n");
+ ret = PMINFO_R_OK;
+err:
+ sqlite3_close(cert_db);
+ if (vquery) {
+ free(vquery);
+ vquery = NULL;
+ }
+ if (indexinfo) {
+ free(indexinfo);
+ indexinfo = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ int i = 0;
+ pkgmgr_instcertinfo_x *certinfo = NULL;
+ certinfo = (pkgmgr_instcertinfo_x *)handle;
+ if (certinfo->pkgid) {
+ free(certinfo->pkgid);
+ certinfo->pkgid = NULL;
+ }
+ for (i = 0; i < MAX_CERT_TYPE; i++) {
+ if ((certinfo->cert_info)[i]) {
+ free((certinfo->cert_info)[i]);
+ (certinfo->cert_info)[i] = NULL;
+ }
+ }
+ free(certinfo);
+ certinfo = NULL;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_delete_certinfo(const char *pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ int ret = -1;
+ /*Open db.*/
+ ret = db_util_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READWRITE, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("connect db [%s] failed!\n", CERT_DB);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ /*Begin Transaction*/
+ ret = sqlite3_exec(cert_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ _LOGE("Transaction Begin\n");
+ ret = __delete_certinfo(pkgid);
+ if (ret < 0) {
+ _LOGE("Certificate Deletion Failed\n");
+ } else {
+ _LOGE("Certificate Deletion Success\n");
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(cert_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(cert_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ _LOGE("Transaction Commit and End\n");
+ ret = PMINFO_R_OK;
+err:
+ sqlite3_close(cert_db);
+ return ret;
+}
+
--- /dev/null
+/*
+ * pkgmgrinfo-client
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Junsuk Oh <junsuk77.oh@samsung.com>,
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <dlfcn.h>
+#include <dirent.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "pkgmgr-info-internal.h"
+#include "pkgmgr-info-debug.h"
+#include "pkgmgr-info.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_CLIENT"
+
+#define SERVICE_NAME "org.tizen.system.deviced"
+#define PATH_NAME "/Org/Tizen/System/DeviceD/Mmc"
+#define INTERFACE_NAME "org.tizen.system.deviced.Mmc"
+#define METHOD_NAME "RequestMountApp2ext"
+
+static int __get_pkg_location(const char *pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_OK, "pkginfo handle is NULL");
+
+ FILE *fp = NULL;
+ char pkg_mmc_path[FILENAME_MAX] = { 0, };
+ snprintf(pkg_mmc_path, FILENAME_MAX, "%s%s", PKG_SD_PATH, pkgid);
+
+ /*check whether application is in external memory or not */
+ fp = fopen(pkg_mmc_path, "r");
+ if (fp != NULL) {
+ fclose(fp);
+ fp = NULL;
+ return PMINFO_EXTERNAL_STORAGE;
+ }
+
+ return PMINFO_INTERNAL_STORAGE;
+}
+
+/* pkgmgrinfo client start*/
+API pkgmgrinfo_client *pkgmgrinfo_client_new(pkgmgrinfo_client_type ctype)
+{
+ int ret = 0;
+ char *errmsg = NULL;
+ void *pc = NULL;
+ void *handle = NULL;
+ pkgmgrinfo_client *(*__pkgmgr_client_new)(pkgmgrinfo_client_type ctype) = NULL;
+
+ handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, NULL, "dlopen() failed. [%s]", dlerror());
+
+ __pkgmgr_client_new = dlsym(handle, "pkgmgr_client_new");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_new == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ pc = __pkgmgr_client_new(ctype);
+ tryvm_if(pc == NULL, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
+
+catch:
+// dlclose(handle);
+ return (pkgmgrinfo_client *) pc;
+}
+
+API int pkgmgrinfo_client_set_status_type(pkgmgrinfo_client *pc, int status_type)
+{
+ int ret = 0;
+ char *errmsg = NULL;
+ void *handle = NULL;
+ int (*__pkgmgr_client_set_status_type)(pkgmgrinfo_client *pc, int status_type) = NULL;
+
+ handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror());
+
+ __pkgmgr_client_set_status_type = dlsym(handle, "pkgmgr_client_set_status_type");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_set_status_type == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ ret = __pkgmgr_client_set_status_type(pc, status_type);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
+
+catch:
+// dlclose(handle);
+ return ret;
+}
+
+API int pkgmgrinfo_client_listen_status(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data)
+{
+ int ret = 0;
+ char *errmsg = NULL;
+ void *handle = NULL;
+ int (*__pkgmgr_client_listen_status)(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data) = NULL;
+
+ handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror());
+
+ __pkgmgr_client_listen_status = dlsym(handle, "pkgmgr_client_listen_status");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_listen_status == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ ret = __pkgmgr_client_listen_status(pc, event_cb, data);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
+
+catch:
+// dlclose(handle);
+ return ret;
+}
+
+API int pkgmgrinfo_client_free(pkgmgrinfo_client *pc)
+{
+ int ret = 0;
+ char *errmsg = NULL;
+ void *handle = NULL;
+ int (*__pkgmgr_client_free)(pkgmgrinfo_client *pc) = NULL;
+
+ handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror());
+
+ __pkgmgr_client_free = dlsym(handle, "pkgmgr_client_free");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_free == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ ret = __pkgmgr_client_free(pc);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
+
+catch:
+// dlclose(handle);
+ return ret;
+}
+
+API int pkgmgrinfo_client_request_enable_external_pkg(char *pkgid)
+{
+ int ret = 0;
+ DBusConnection *bus;
+ DBusMessage *message;
+ DBusMessage *reply;
+
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
+
+ if(__get_pkg_location(pkgid) != PMINFO_EXTERNAL_STORAGE)
+ return PMINFO_R_OK;
+
+ bus = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ retvm_if(bus == NULL, PMINFO_R_EINVAL, "dbus_bus_get() failed.");
+
+ message = dbus_message_new_method_call (SERVICE_NAME, PATH_NAME, INTERFACE_NAME, METHOD_NAME);
+ retvm_if(message == NULL, PMINFO_R_EINVAL, "dbus_message_new_method_call() failed.");
+
+ dbus_message_append_args(message, DBUS_TYPE_STRING, &pkgid, DBUS_TYPE_INVALID);
+
+ reply = dbus_connection_send_with_reply_and_block(bus, message, -1, NULL);
+ retvm_if(!reply, ret = PMINFO_R_EINVAL, "connection_send dbus fail");
+
+ dbus_connection_flush(bus);
+ dbus_message_unref(message);
+ dbus_message_unref(reply);
+
+ return PMINFO_R_OK;
+}
+
+/* pkgmgrinfo client end*/
+
--- /dev/null
+/*
+ * pkgmgrinfo-db
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Junsuk Oh <junsuk77.oh@samsung.com>,
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sqlite3.h>
+#include <db-util.h>
+#include <dlfcn.h>
+#include <dirent.h>
+
+#include "pkgmgr-info-internal.h"
+#include "pkgmgr-info-debug.h"
+#include "pkgmgr-info.h"
+
+#include "pkgmgr_parser.h"
+#include "pkgmgr_parser_db.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_DB"
+
+typedef struct _pkgmgr_datacontrol_x {
+ char *appid;
+ char *access;
+} pkgmgr_datacontrol_x;
+
+static int __datacontrol_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_datacontrol_x *info = (pkgmgr_datacontrol_x *)data;
+ int i = 0;
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "PACKAGE_NAME") == 0) {
+ if (coltxt[i])
+ info->appid = strdup(coltxt[i]);
+ else
+ info->appid = NULL;
+ } else if (strcmp(colname[i], "ACCESS") == 0 ){
+ if (coltxt[i])
+ info->access = strdup(coltxt[i]);
+ else
+ info->access = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+static int __update_ail_appinfo(manifest_x * mfx)
+{
+ int ret = -1;
+ uiapplication_x *uiapplication = mfx->uiapplication;
+ void *lib_handle = NULL;
+ int (*ail_desktop_operation) (const char *appid, const char *property, const char *value, bool broadcast);
+ char *aop = NULL;
+
+ if ((lib_handle = dlopen(LIBAIL_PATH, RTLD_LAZY)) == NULL) {
+ _LOGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAIL_PATH);
+ goto END;
+ }
+
+ aop = "ail_desktop_appinfo_modify_str";
+
+ if ((ail_desktop_operation =
+ dlsym(lib_handle, aop)) == NULL || dlerror() != NULL) {
+ _LOGE("can not find symbol \n");
+ goto END;
+ }
+
+ for(; uiapplication; uiapplication=uiapplication->next) {
+ ret = ail_desktop_operation(uiapplication->appid, "AIL_PROP_X_SLP_INSTALLEDSTORAGE_STR", mfx->installed_storage, false);
+ if (ret != 0)
+ _LOGE("Failed to store info in DB\n");
+ }
+
+END:
+ if (lib_handle)
+ dlclose(lib_handle);
+
+ return ret;
+}
+
+API int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle)
+{
+ retvm_if(!pkgid, PMINFO_R_EINVAL, "pkgid is NULL");
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ char *manifest = NULL;
+ manifest_x *mfx = NULL;
+
+ manifest = pkgmgr_parser_get_manifest_file(pkgid);
+ retvm_if(manifest == NULL, PMINFO_R_EINVAL, "pkg[%s] dont have manifest file", pkgid);
+
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ if (manifest) {
+ free(manifest);
+ manifest = NULL;
+ }
+ retvm_if(mfx == NULL, PMINFO_R_EINVAL, "pkg[%s] parsing fail", pkgid);
+
+ *handle = (void *)mfx;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type)
+{
+ retvm_if(!type, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ int len = strlen(type);
+ retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
+
+ manifest_x *mfx = (manifest_x *)handle;
+ free((void *)mfx->type);
+
+ mfx->type = strndup(type, PKG_TYPE_STRING_LEN_MAX);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version)
+{
+ retvm_if(!version, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ int len = strlen(version);
+ retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
+
+ manifest_x *mfx = (manifest_x *)handle;
+ free((void *)mfx->version);
+
+ mfx->version = strndup(version, PKG_VERSION_STRING_LEN_MAX);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if((location < 0) || (location > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ manifest_x *mfx = (manifest_x *)handle;
+ free((void *)mfx->installlocation);
+
+ if (location == INSTALL_INTERNAL)
+ mfx->installlocation= strdup("internal-only");
+ else if (location == INSTALL_EXTERNAL)
+ mfx->installlocation= strdup("prefer-external");
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ manifest_x *mfx = (manifest_x *)handle;
+
+ mfx->package_size = strdup(size);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label_txt, const char *locale)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if(!label_txt, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ int len = strlen(label_txt);
+ retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
+
+ manifest_x *mfx = (manifest_x *)handle;
+
+ label_x *label = calloc(1, sizeof(label_x));
+ retvm_if(label == NULL, PMINFO_R_EINVAL, "Malloc Failed");
+
+ LISTADD(mfx->label, label);
+ if (locale)
+ mfx->label->lang = strdup(locale);
+ else
+ mfx->label->lang = strdup(DEFAULT_LOCALE);
+ mfx->label->text = strdup(label_txt);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon_txt, const char *locale)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if(!icon_txt, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ int len = strlen(icon_txt);
+ retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
+
+ manifest_x *mfx = (manifest_x *)handle;
+
+ icon_x *icon = calloc(1, sizeof(icon_x));
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Malloc Failed");
+
+ LISTADD(mfx->icon, icon);
+ if (locale)
+ mfx->icon->lang = strdup(locale);
+ else
+ mfx->icon->lang = strdup(DEFAULT_LOCALE);
+ mfx->icon->text = strdup(icon_txt);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *desc_txt, const char *locale)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if(!desc_txt, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ int len = strlen(desc_txt);
+ retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
+
+ manifest_x *mfx = (manifest_x *)handle;
+
+ description_x *description = calloc(1, sizeof(description_x));
+ retvm_if(description == NULL, PMINFO_R_EINVAL, "Malloc Failed");
+
+ LISTADD(mfx->description, description);
+ if (locale)
+ mfx->description->lang = strdup(locale);
+ else
+ mfx->description->lang = strdup(DEFAULT_LOCALE);
+ mfx->description->text = strdup(desc_txt);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
+ const char *author_email, const char *author_href, const char *locale)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ manifest_x *mfx = (manifest_x *)handle;
+ author_x *author = calloc(1, sizeof(author_x));
+ retvm_if(author == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ LISTADD(mfx->author, author);
+ if (author_name)
+ mfx->author->text = strdup(author_name);
+ if (author_email)
+ mfx->author->email = strdup(author_email);
+ if (author_href)
+ mfx->author->href = strdup(author_href);
+ if (locale)
+ mfx->author->lang = strdup(locale);
+ else
+ mfx->author->lang = strdup(DEFAULT_LOCALE);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if((removable < 0) || (removable > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ manifest_x *mfx = (manifest_x *)handle;
+ free((void *)mfx->removable);
+
+ if (removable == 0)
+ mfx->removable= strdup("false");
+ else if (removable == 1)
+ mfx->removable= strdup("true");
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if((preload < 0) || (preload > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ manifest_x *mfx = (manifest_x *)handle;
+
+ free((void *)mfx->preload);
+
+ if (preload == 0)
+ mfx->preload= strdup("false");
+ else if (preload == 1)
+ mfx->preload= strdup("true");
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+ retvm_if((location < 0) || (location > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ manifest_x *mfx = (manifest_x *)handle;
+
+ free((void *)mfx->installed_storage);
+
+ if (location == INSTALL_INTERNAL)
+ mfx->installed_storage= strdup("installed_internal");
+ else if (location == INSTALL_EXTERNAL)
+ mfx->installed_storage= strdup("installed_external");
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ int ret = 0;
+ manifest_x *mfx = NULL;
+ mfx = (manifest_x *)handle;
+
+ ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
+ retvm_if(ret != 0, PMINFO_R_ERROR, "Failed to store info in DB\n");
+
+ ret = __update_ail_appinfo(mfx);
+ retvm_if(ret != 0, PMINFO_R_ERROR, "Failed to store info in DB\n");
+
+ _LOGE("Successfully stored info in DB\n");
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
+{
+ retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
+
+ manifest_x *mfx = NULL;
+ mfx = (manifest_x *)handle;
+ pkgmgr_parser_free_manifest_xml(mfx);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_set_state_enabled(const char *pkgid, bool enabled)
+{
+ /* Should be implemented later */
+ return 0;
+}
+
+API int pkgmgrinfo_appinfo_set_state_enabled(const char *appid, bool enabled)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL\n");
+ int ret = -1;
+ sqlite3 *pkginfo_db = NULL;
+
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkginfo_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ sqlite3_close(pkginfo_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Begin\n");
+
+ char *query = sqlite3_mprintf("update package_app_info set app_enabled=%Q where app_id=%Q", enabled?"true":"false", appid);
+
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(pkginfo_db, query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ sqlite3_free(query);
+ return PMINFO_R_ERROR;
+ }
+ sqlite3_free(error_message);
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkginfo_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction. Rollback now\n");
+ ret = sqlite3_exec(pkginfo_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Don't execute query = %s\n", query);
+ sqlite3_close(pkginfo_db);
+ sqlite3_free(query);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Commit and End\n");
+ sqlite3_close(pkginfo_db);
+ sqlite3_free(query);
+
+ return PMINFO_R_OK;
+}
+
+
+API int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
+{
+ retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ retvm_if(access == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ int ret = PMINFO_R_OK;
+ char *error_message = NULL;
+ pkgmgr_datacontrol_x *data = NULL;
+
+ sqlite3 *datacontrol_info_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(DATACONTROL_DB, &datacontrol_info_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ data = (pkgmgr_datacontrol_x *)calloc(1, sizeof(pkgmgr_datacontrol_x));
+ if (data == NULL) {
+ _LOGE("Failed to allocate memory for pkgmgr_datacontrol_x\n");
+ sqlite3_close(datacontrol_info_db);
+ return PMINFO_R_ERROR;
+ }
+ char *query = sqlite3_mprintf("select appinfo.package_name, datacontrol.access from appinfo, datacontrol where datacontrol.id=appinfo.unique_id and datacontrol.provider_id = %Q and datacontrol.type=%Q COLLATE NOCASE",
+ providerid, type);
+
+ if (SQLITE_OK !=
+ sqlite3_exec(datacontrol_info_db, query, __datacontrol_cb, (void *)data, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ sqlite3_free(query);
+ sqlite3_close(datacontrol_info_db);
+ return PMINFO_R_ERROR;
+ }
+
+ *appid = (char *)data->appid;
+ *access = (char *)data->access;
+ free(data);
+ sqlite3_free(query);
+ sqlite3_close(datacontrol_info_db);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_set_default_label(const char *appid, const char *label)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL\n");
+ int ret = -1;
+ char *error_message = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkginfo_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ sqlite3_close(pkginfo_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Begin\n");
+
+ char *query = sqlite3_mprintf("update package_app_localized_info set app_label=%Q where app_id=%Q", label, appid);
+
+ ret = sqlite3_exec(pkginfo_db, query, NULL, NULL, &error_message);
+ if (ret != SQLITE_OK) {
+ _LOGE("Don't execute query = %s error message = %s\n", query, error_message);
+ sqlite3_free(error_message);
+ sqlite3_free(query);
+ return PMINFO_R_ERROR;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkginfo_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction. Rollback now\n");
+ ret = sqlite3_exec(pkginfo_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Don't execute query = %s\n", query);
+ sqlite3_free(query);
+ sqlite3_close(pkginfo_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Commit and End\n");
+ sqlite3_free(query);
+ sqlite3_close(pkginfo_db);
+
+ return PMINFO_R_OK;
+}
+
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#include "pkgmgrinfo_private.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_INFO"
+
+#define FILTER_QUERY_LIST_PACKAGE "select DISTINCT package_info.package " \
+ "from package_info LEFT OUTER JOIN package_localized_info " \
+ "ON package_info.package=package_localized_info.package " \
+ "and package_localized_info.package_locale='%s' where "
+
+typedef struct _pkgmgr_cert_x {
+ char *pkgid;
+ int cert_id;
+} pkgmgr_cert_x;
+
+
+typedef int (*pkgmgr_handler)(int req_id, const char *pkg_type,
+ const char *pkgid, const char *key,
+ const char *val, const void *pmsg, void *data);
+
+typedef void pkgmgr_client;
+typedef void pkgmgr_info;
+
+typedef enum {
+ PM_REQUEST_CSC = 0,
+ PM_REQUEST_MOVE = 1,
+ PM_REQUEST_GET_SIZE = 2,
+ PM_REQUEST_KILL_APP = 3,
+ PM_REQUEST_CHECK_APP = 4,
+ PM_REQUEST_MAX
+}pkgmgr_request_service_type;
+
+typedef enum {
+ PM_GET_TOTAL_SIZE= 0,
+ PM_GET_DATA_SIZE = 1,
+ PM_GET_ALL_PKGS = 2,
+ PM_GET_SIZE_INFO = 3,
+ PM_GET_TOTAL_AND_DATA = 4,
+ PM_GET_SIZE_FILE = 5,
+ PM_GET_MAX
+}pkgmgr_getsize_type;
+
+typedef enum {
+ PC_REQUEST = 0,
+ PC_LISTENING,
+ PC_BROADCAST,
+}client_type;
+
+#define PKG_SIZE_INFO_FILE "/tmp/pkgmgr_size_info.txt"
+#define MAX_PKG_BUF_LEN 1024
+#define MAX_PKG_INFO_LEN 10
+
+static void __destroy_each_node(gpointer data, gpointer user_data)
+{
+ ret_if(data == NULL);
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data;
+ if (node->value) {
+ free(node->value);
+ node->value = NULL;
+ }
+ if (node->key) {
+ free(node->key);
+ node->key = NULL;
+ }
+ free(node);
+ node = NULL;
+}
+
+static int __pkg_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *udata = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ pkgmgr_pkginfo_x *info = NULL;
+ info = calloc(1, sizeof(pkgmgr_pkginfo_x));
+ info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+
+ LISTADD(udata, info);
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "package") == 0) {
+ if (coltxt[i])
+ info->manifest_info->package = strdup(coltxt[i]);
+ else
+ info->manifest_info->package = NULL;
+ } else
+ continue;
+ }
+
+ return 0;
+}
+
+static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
+ int i = 0;
+ author_x *author = NULL;
+ icon_x *icon = NULL;
+ label_x *label = NULL;
+ description_x *description = NULL;
+ privilege_x *privilege = NULL;
+
+ author = calloc(1, sizeof(author_x));
+ LISTADD(info->manifest_info->author, author);
+ icon = calloc(1, sizeof(icon_x));
+ LISTADD(info->manifest_info->icon, icon);
+ label = calloc(1, sizeof(label_x));
+ LISTADD(info->manifest_info->label, label);
+ description = calloc(1, sizeof(description_x));
+ LISTADD(info->manifest_info->description, description);
+ privilege = calloc(1, sizeof(privilege_x));
+ LISTADD(info->manifest_info->privileges->privilege, privilege);
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "package_version") == 0) {
+ if (coltxt[i])
+ info->manifest_info->version = strdup(coltxt[i]);
+ else
+ info->manifest_info->version = NULL;
+ } else if (strcmp(colname[i], "package_type") == 0) {
+ if (coltxt[i])
+ info->manifest_info->type = strdup(coltxt[i]);
+ else
+ info->manifest_info->type = NULL;
+ } else if (strcmp(colname[i], "install_location") == 0) {
+ if (coltxt[i])
+ info->manifest_info->installlocation = strdup(coltxt[i]);
+ else
+ info->manifest_info->installlocation = NULL;
+ } else if (strcmp(colname[i], "package_size") == 0) {
+ if (coltxt[i])
+ info->manifest_info->package_size = strdup(coltxt[i]);
+ else
+ info->manifest_info->package_size = NULL;
+ } else if (strcmp(colname[i], "author_email") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->author->email = strdup(coltxt[i]);
+ else
+ info->manifest_info->author->email = NULL;
+ } else if (strcmp(colname[i], "author_href") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->author->href = strdup(coltxt[i]);
+ else
+ info->manifest_info->author->href = NULL;
+ } else if (strcmp(colname[i], "package_label") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->label->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->label->text = NULL;
+ } else if (strcmp(colname[i], "package_icon") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->icon->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->icon->text = NULL;
+ } else if (strcmp(colname[i], "package_description") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->description->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->description->text = NULL;
+ } else if (strcmp(colname[i], "package_author") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->author->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->author->text = NULL;
+ } else if (strcmp(colname[i], "package_removable") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->removable = strdup(coltxt[i]);
+ else
+ info->manifest_info->removable = NULL;
+ } else if (strcmp(colname[i], "package_preload") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->preload = strdup(coltxt[i]);
+ else
+ info->manifest_info->preload = NULL;
+ } else if (strcmp(colname[i], "package_readonly") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->readonly = strdup(coltxt[i]);
+ else
+ info->manifest_info->readonly = NULL;
+ } else if (strcmp(colname[i], "package_update") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->update= strdup(coltxt[i]);
+ else
+ info->manifest_info->update = NULL;
+ } else if (strcmp(colname[i], "package_system") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->system= strdup(coltxt[i]);
+ else
+ info->manifest_info->system = NULL;
+ } else if (strcmp(colname[i], "package_appsetting") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->appsetting = strdup(coltxt[i]);
+ else
+ info->manifest_info->appsetting = NULL;
+ } else if (strcmp(colname[i], "installed_time") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->installed_time = strdup(coltxt[i]);
+ else
+ info->manifest_info->installed_time = NULL;
+ } else if (strcmp(colname[i], "installed_storage") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->installed_storage = strdup(coltxt[i]);
+ else
+ info->manifest_info->installed_storage = NULL;
+ } else if (strcmp(colname[i], "mainapp_id") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->mainapp_id = strdup(coltxt[i]);
+ else
+ info->manifest_info->mainapp_id = NULL;
+ } else if (strcmp(colname[i], "storeclient_id") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->storeclient_id = strdup(coltxt[i]);
+ else
+ info->manifest_info->storeclient_id = NULL;
+ } else if (strcmp(colname[i], "root_path") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->root_path = strdup(coltxt[i]);
+ else
+ info->manifest_info->root_path = NULL;
+ } else if (strcmp(colname[i], "csc_path") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->csc_path = strdup(coltxt[i]);
+ else
+ info->manifest_info->csc_path = NULL;
+ } else if (strcmp(colname[i], "privilege") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->privileges->privilege->text = strdup(coltxt[i]);
+ else
+ info->manifest_info->privileges->privilege->text = NULL;
+ } else if (strcmp(colname[i], "package_locale") == 0 ){
+ if (coltxt[i]) {
+ info->manifest_info->author->lang = strdup(coltxt[i]);
+ info->manifest_info->icon->lang = strdup(coltxt[i]);
+ info->manifest_info->label->lang = strdup(coltxt[i]);
+ info->manifest_info->description->lang = strdup(coltxt[i]);
+ }
+ else {
+ info->manifest_info->author->lang = NULL;
+ info->manifest_info->icon->lang = NULL;
+ info->manifest_info->label->lang = NULL;
+ info->manifest_info->description->lang = NULL;
+ }
+ } else if (strcmp(colname[i], "package_url") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->package_url = strdup(coltxt[i]);
+ else
+ info->manifest_info->package_url = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+static int __cert_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_cert_x *info = (pkgmgr_cert_x *)data;
+ int i = 0;
+
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "author_signer_cert") == 0) {
+ if (coltxt[i])
+ info->cert_id = atoi(coltxt[i]);
+ else
+ info->cert_id = 0;
+ } else if (strcmp(colname[i], "package") == 0) {
+ if (coltxt[i])
+ info->pkgid= strdup(coltxt[i]);
+ else
+ info->pkgid = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
+int __reqeust_get_size(const char *pkgid, int type)
+{
+ int ret = 0;
+ int size = 0;
+ char *errmsg = NULL;
+ void *pc = NULL;
+ void *handle = NULL;
+// FILE *fp = NULL;
+ pkgmgr_client *(*__pkgmgr_client_new)(client_type ctype) = NULL;
+// int (*__pkgmgr_client_get_size)(pkgmgr_client * pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data) = NULL;
+ int (*__pkgmgr_client_request_service)(pkgmgr_request_service_type service_type, int service_mode,
+ pkgmgr_client * pc, const char *pkg_type, const char *pkgid,
+ const char *custom_info, pkgmgr_handler event_cb, void *data) = NULL;
+
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL");
+
+ handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror());
+
+ __pkgmgr_client_new = dlsym(handle, "pkgmgr_client_new");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_new == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ __pkgmgr_client_request_service = dlsym(handle, "pkgmgr_client_request_service");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_request_service == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ pc = __pkgmgr_client_new(PC_REQUEST);
+ tryvm_if(pc == NULL, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
+
+ size = __pkgmgr_client_request_service(PM_REQUEST_GET_SIZE, type, pc, NULL, pkgid, NULL, NULL, NULL);
+ tryvm_if(size < 0, ret = PMINFO_R_ERROR, "get size failed.");
+
+ ret = size;
+
+catch:
+ dlclose(handle);
+ return ret;
+}
+
+void __get_package_size(const char *size_info, const char *pkgid, int *total_size, int *data_size)
+{
+ char *p = NULL;
+ p = strstr(size_info, pkgid);
+ if (p == NULL)
+ return;
+
+ p += strlen(pkgid);
+ if (*p == '=') {
+ *total_size = atoi(p+1);
+
+ while (*p)
+ {
+ if (*p == '/') {
+ *data_size = atoi(p+1);
+ break;
+ } else {
+ p++;
+ }
+ }
+ } else {
+ return;
+ }
+
+ return;
+}
+
+int __get_package_size_info(char **size_info)
+{
+// int ret = 0;
+ int size = 0;
+ char *pInfo = NULL;
+ FILE *fp = NULL;
+ pInfo = (char *)malloc(MAX_PKG_BUF_LEN * MAX_PKG_INFO_LEN);
+ memset(pInfo, 0, MAX_PKG_BUF_LEN * MAX_PKG_INFO_LEN);
+
+ fp = fopen(PKG_SIZE_INFO_FILE, "r");
+ if (fp != NULL) {
+ size = fread(pInfo, 1, MAX_PKG_BUF_LEN * MAX_PKG_INFO_LEN, fp);
+ if (size < 0)
+ _LOGE("size error \n");
+ fclose(fp);
+ }
+
+ *size_info = pInfo;
+ return PMINFO_R_OK;
+}
+
+int __set_package_size_info(manifest_x *manifest, const char* size_info)
+{
+ int total_size = 0;
+ int data_size = 0;
+// int ret = 0;
+ char total_buf[PKG_TYPE_STRING_LEN_MAX] = {'\0'};
+ char data_buf[PKG_TYPE_STRING_LEN_MAX] = {'\0'};
+
+ __get_package_size(size_info, manifest->package, &total_size, &data_size);
+
+ manifest->package_size = strdup("true");
+
+ snprintf(total_buf, PKG_TYPE_STRING_LEN_MAX - 1, "%d", total_size);
+ manifest->package_total_size = strndup(total_buf, PKG_TYPE_STRING_LEN_MAX - 1);
+
+ snprintf(data_buf, PKG_TYPE_STRING_LEN_MAX - 1, "%d", data_size);
+ manifest->package_data_size = strndup(data_buf, PKG_TYPE_STRING_LEN_MAX - 1);
+
+ return 0;
+}
+
+API int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+{
+ retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkgmgr_pkginfo_x *tmphead = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ pkgmgr_pkginfo_x *node = NULL;
+ pkgmgr_pkginfo_x *temp_node = NULL;
+
+ snprintf(query, MAX_QUERY_LEN, "select * from package_info");
+ ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+ pkginfo->locale = strdup(locale);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
+
+ /*populate manifest_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ /*populate privilege_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_privilege_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package privilege Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+ }
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ if(ret < 0)
+ continue;
+
+ ret = pkg_list_cb( (void *)pkginfo, user_data);
+ if(ret < 0)
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_close(pkginfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ LISTHEAD(tmphead, node);
+ temp_node = node->next;
+ node = temp_node;
+ while (node) {
+ temp_node = node->next;
+ __cleanup_pkginfo(node);
+ node = temp_node;
+ }
+ __cleanup_pkginfo(tmphead);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_mounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+{
+ retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkgmgr_pkginfo_x *tmphead = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ pkgmgr_pkginfo_x *node = NULL;
+ pkgmgr_pkginfo_x *temp_node = NULL;
+
+ snprintf(query, MAX_QUERY_LEN, "select package from package_info where installed_storage='installed_external'");
+ ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+ pkginfo->locale = strdup(locale);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
+
+ /*populate manifest_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+ }
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ if(ret < 0)
+ continue;
+
+ ret = pkg_list_cb( (void *)pkginfo, user_data);
+ if(ret < 0)
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_close(pkginfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ LISTHEAD(tmphead, node);
+ temp_node = node->next;
+ node = temp_node;
+ while (node) {
+ temp_node = node->next;
+ __cleanup_pkginfo(node);
+ node = temp_node;
+ }
+ __cleanup_pkginfo(tmphead);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_unmounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+{
+ retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkgmgr_pkginfo_x *tmphead = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ pkgmgr_pkginfo_x *node = NULL;
+ pkgmgr_pkginfo_x *temp_node = NULL;
+
+ snprintf(query, MAX_QUERY_LEN, "select package from package_info where installed_storage='installed_external'");
+ ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+ pkginfo->locale = strdup(locale);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
+
+ /*populate manifest_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+ }
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+
+ ret = pkg_list_cb( (void *)pkginfo, user_data);
+ if(ret < 0)
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_close(pkginfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ LISTHEAD(tmphead, node);
+ temp_node = node->next;
+ node = temp_node;
+ while (node) {
+ temp_node = node->next;
+ __cleanup_pkginfo(node);
+ node = temp_node;
+ }
+ __cleanup_pkginfo(tmphead);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+{
+ retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
+ int ret = PMINFO_R_OK;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *locale = NULL;
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkgmgr_pkginfo_x *tmphead = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ pkgmgr_pkginfo_x *node = NULL;
+ pkgmgr_pkginfo_x *temp_node = NULL;
+
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_info");
+ ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+ pkginfo->locale = strdup(locale);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
+
+ /*populate manifest_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_localized_info where" \
+ " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ }
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next; node ; node = node->next) {
+ pkginfo = node;
+
+ ret = pkg_list_cb( (void *)pkginfo, user_data);
+ if(ret < 0)
+ break;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_close(pkginfo_db);
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ LISTHEAD(tmphead, node);
+ temp_node = node->next;
+ node = temp_node;
+ while (node) {
+ temp_node = node->next;
+ __cleanup_pkginfo(node);
+ node = temp_node;
+ }
+ __cleanup_pkginfo(tmphead);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_unmounted_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ char *locale = NULL;
+ int exist = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*validate pkgid*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check pkgid exist on db*/
+ query= sqlite3_mprintf("select exists(select * from package_info where package=%Q)", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec[%s] fail", pkgid);
+ tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "pkgid[%s] not found in DB", pkgid);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(pkginfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for pkginfo");
+
+ pkginfo->locale = strdup(locale);
+
+ pkginfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
+
+ pkginfo->manifest_info->package = strdup(pkgid);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info");
+
+ /*populate manifest_info from DB*/
+ query= sqlite3_mprintf("select * from package_info where package=%Q", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*populate privilege_info from DB*/
+ query= sqlite3_mprintf("select * from package_privilege_info where package=%Q ", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Privilege Info DB Information retrieval failed");
+
+ query= sqlite3_mprintf("select * from package_localized_info where package=%Q and package_locale=%Q", pkgid, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query= sqlite3_mprintf("select * from package_localized_info where package=%Q and package_locale=%Q", pkgid, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)pkginfo;
+ else {
+ *handle = NULL;
+ __cleanup_pkginfo(pkginfo);
+ }
+ sqlite3_close(pkginfo_db);
+
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ char *locale = NULL;
+ int exist = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*validate pkgid*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(pkginfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for pkginfo");
+
+ pkginfo->locale = strdup(locale);
+
+ pkginfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
+
+ pkginfo->manifest_info->package = strdup(pkgid);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info");
+
+ /*populate manifest_info from DB*/
+ query= sqlite3_mprintf("select * from disabled_package_info where package=%Q", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ query= sqlite3_mprintf("select * from disabled_package_localized_info where package=%Q and package_locale=%Q", pkgid, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query= sqlite3_mprintf("select * from disabled_package_localized_info where package=%Q and package_locale=%Q", pkgid, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)pkginfo;
+ else {
+ *handle = NULL;
+ __cleanup_pkginfo(pkginfo);
+ }
+ sqlite3_close(pkginfo_db);
+
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ char *locale = NULL;
+ int exist = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*validate pkgid*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check pkgid exist on db*/
+ query= sqlite3_mprintf("select exists(select * from package_info where package=%Q)", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec[%s] fail", pkgid);
+ if (exist == 0) {
+ _LOGS("pkgid[%s] not found in DB", pkgid);
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(pkginfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for pkginfo");
+
+ pkginfo->locale = strdup(locale);
+
+ pkginfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
+
+ pkginfo->manifest_info->package = strdup(pkgid);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info");
+
+ /*populate manifest_info from DB*/
+ query= sqlite3_mprintf("select * from package_info where package=%Q", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*populate privilege_info from DB*/
+ query= sqlite3_mprintf("select * from package_privilege_info where package=%Q ", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Privilege Info DB Information retrieval failed");
+
+ query= sqlite3_mprintf("select * from package_localized_info where package=%Q and package_locale=%Q", pkgid, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query= sqlite3_mprintf("select * from package_localized_info where package=%Q and package_locale=%Q", pkgid, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "[%s] is installed external, but is not in mmc", pkgid);
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)pkginfo;
+ else {
+ *handle = NULL;
+ __cleanup_pkginfo(pkginfo);
+ }
+ sqlite3_close(pkginfo_db);
+
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ return ret;
+}
+
+
+API int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(pkg_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->package)
+ *pkg_name = (char *)info->manifest_info->package;
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->package)
+ *pkgid = (char *)info->manifest_info->package;
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->type)
+ *type = (char *)info->manifest_info->type;
+ else
+ *type = "rpm";
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(version == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *version = (char *)info->manifest_info->version;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(location == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->installlocation;
+ if (val) {
+ if (strcmp(val, "internal-only") == 0)
+ *location = PMINFO_INSTALL_LOCATION_INTERNAL_ONLY;
+ else if (strcmp(val, "prefer-external") == 0)
+ *location = PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL;
+ else
+ *location = PMINFO_INSTALL_LOCATION_AUTO;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->package_size;
+ if (val) {
+ *size = atoi(val);
+ } else {
+ *size = 0;
+ _LOGE("package size is not specified\n");
+ return PMINFO_R_ERROR;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ int ret = -1;
+ char *pkgid = NULL;
+ char *val = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->package_size;
+ if (strcmp(val, "true") == 0) {
+ *size = atoi(info->manifest_info->package_total_size);
+ return 0;
+ } else {
+ ret = pkgmgrinfo_pkginfo_get_pkgid(handle,&pkgid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "get pkgid fail");
+
+ *size = __reqeust_get_size(pkgid, PM_GET_TOTAL_SIZE);
+ return 0;
+ }
+}
+
+API int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ int ret = -1;
+ char *pkgid = NULL;
+ char *val = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->package_size;
+ if (strcmp(val, "true") == 0) {
+ *size = atoi(info->manifest_info->package_data_size);
+ return 0;
+ } else {
+ ret = pkgmgrinfo_pkginfo_get_pkgid(handle,&pkgid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "get pkgid fail");
+
+ *size = __reqeust_get_size(pkgid, PM_GET_DATA_SIZE);
+ return 0;
+ }
+}
+
+API int pkgmgrinfo_pkginfo_get_size_info(pkgmgrinfo_pkginfo_h handle, int *total_size, int *data_size)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(total_size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ retvm_if(data_size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ int ret = -1;
+ int total_tmp = 0;
+ int data_tmp = 0;
+ char *val = NULL;
+ char *pkgid = NULL;
+ char* package_size_info = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+ val = (char *)info->manifest_info->package_size;
+ if (strcmp(val, "true") == 0) {
+ *total_size = atoi(info->manifest_info->package_total_size);
+ *data_size = atoi(info->manifest_info->package_data_size);
+ return 0;
+ } else {
+ ret = pkgmgrinfo_pkginfo_get_pkgid(handle,&pkgid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "get pkgid fail");
+
+ ret = __reqeust_get_size(pkgid, PM_GET_TOTAL_AND_DATA);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "fail reqeust size info");
+
+ ret = __get_package_size_info(&package_size_info);
+ retvm_if(ret != 0 || package_size_info == NULL, PMINFO_R_ERROR, "__get_package_size_info() failed");
+
+ __get_package_size(package_size_info, pkgid, &total_tmp, &data_tmp);
+ *total_size = total_tmp;
+ *data_size = data_tmp;
+
+ free(package_size_info);
+ return 0;
+ }
+ return -1;
+}
+
+API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ int ret = PMINFO_R_OK;
+ char *locale = NULL;
+ icon_x *ptr = NULL;
+ *icon = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+ locale = info->locale;
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
+ for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ if (ptr->text) {
+ *icon = (char *)ptr->text;
+ if (strcasecmp(*icon, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ int ret = PMINFO_R_OK;
+ char *locale = NULL;
+ label_x *ptr = NULL;
+ *label = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ locale = info->locale;
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
+ for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ if (ptr->text) {
+ *label = (char *)ptr->text;
+ if (strcasecmp(*label, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *label = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(description == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *locale = NULL;
+ description_x *ptr = NULL;
+ *description = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ locale = info->locale;
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
+ for(ptr = info->manifest_info->description; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ *description = (char *)ptr->text;
+ if (strcasecmp(*description, PKGMGR_PARSER_EMPTY_STR) == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *description = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(author_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *locale = NULL;
+ author_x *ptr = NULL;
+ *author_name = NULL;
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ locale = info->locale;
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
+ for(ptr = info->manifest_info->author; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ *author_name = (char *)ptr->text;
+ if (strcasecmp(*author_name, PKGMGR_PARSER_EMPTY_STR) == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *author_name = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(author_email == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *author_email = (char *)info->manifest_info->author->email;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(author_href == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *author_href = (char *)info->manifest_info->author->href;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(storage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+ if (strcmp(info->manifest_info->installed_storage,"installed_internal") == 0)
+ *storage = PMINFO_INTERNAL_STORAGE;
+ else if (strcmp(info->manifest_info->installed_storage,"installed_external") == 0)
+ *storage = PMINFO_EXTERNAL_STORAGE;
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(installed_time == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->installed_time)
+ *installed_time = atoi(info->manifest_info->installed_time);
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(storeclientid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *storeclientid = (char *)info->manifest_info->storeclient_id;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(mainappid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *mainappid = (char *)info->manifest_info->mainapp_id;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(url == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *url = (char *)info->manifest_info->package_url;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(path == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->root_path)
+ *path = (char *)info->manifest_info->root_path;
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(path == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->csc_path)
+ *path = (char *)info->manifest_info->csc_path;
+ else
+ *path = (char *)info->manifest_info->csc_path;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
+{
+ retvm_if(lhs_package_id == NULL, PMINFO_R_EINVAL, "lhs package ID is NULL");
+ retvm_if(rhs_package_id == NULL, PMINFO_R_EINVAL, "rhs package ID is NULL");
+ retvm_if(compare_result == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ char *error_message = NULL;
+ pkgmgr_cert_x *info= NULL;
+ int lcert = 0;
+ int rcert = 0;
+ int exist = -1;
+ sqlite3 *pkgmgr_cert_db = NULL;
+
+ *compare_result = PMINFO_CERT_COMPARE_ERROR;
+ info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x));
+ retvm_if(info == NULL, PMINFO_R_ERROR, "Out of Memory!!!");
+
+ ret = db_util_open_with_options(CERT_DB, &pkgmgr_cert_db, SQLITE_OPEN_READONLY, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("connect db [%s] failed!\n", CERT_DB);
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+
+ query = sqlite3_mprintf("select exists(select * from package_cert_info where package=%Q)", lhs_package_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_cert_db, query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto err;
+ }
+
+ if (exist == 0) {
+ lcert = 0;
+ } else {
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select author_signer_cert from package_cert_info where package=%Q", lhs_package_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_cert_db, query, __cert_cb, (void *)info, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto err;
+ }
+ lcert = info->cert_id;
+ }
+
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select exists(select * from package_cert_info where package=%Q)", rhs_package_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_cert_db, query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto err;
+ }
+
+ if (exist == 0) {
+ rcert = 0;
+ } else {
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select author_signer_cert from package_cert_info where package=%Q", rhs_package_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_cert_db, query, __cert_cb, (void *)info, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto err;
+ }
+ rcert = info->cert_id;
+ sqlite3_free(query);
+ }
+
+ if ((lcert == 0) || (rcert == 0))
+ {
+ if ((lcert == 0) && (rcert == 0))
+ *compare_result = PMINFO_CERT_COMPARE_BOTH_NO_CERT;
+ else if (lcert == 0)
+ *compare_result = PMINFO_CERT_COMPARE_LHS_NO_CERT;
+ else if (rcert == 0)
+ *compare_result = PMINFO_CERT_COMPARE_RHS_NO_CERT;
+ } else {
+ if (lcert == rcert)
+ *compare_result = PMINFO_CERT_COMPARE_MATCH;
+ else
+ *compare_result = PMINFO_CERT_COMPARE_MISMATCH;
+ }
+
+err:
+ sqlite3_free(error_message);
+ sqlite3_close(pkgmgr_cert_db);
+ if (info) {
+ if (info->pkgid) {
+ free(info->pkgid);
+ info->pkgid = NULL;
+ }
+ free(info);
+ info = NULL;
+ }
+ return ret;
+}
+
+
+API int pkgmgrinfo_pkginfo_compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
+{
+ retvm_if(lhs_app_id == NULL, PMINFO_R_EINVAL, "lhs app ID is NULL");
+ retvm_if(rhs_app_id == NULL, PMINFO_R_EINVAL, "rhs app ID is NULL");
+ retvm_if(compare_result == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ char *error_message = NULL;
+ pkgmgr_cert_x *info= NULL;
+ int exist = -1;
+ char *lpkgid = NULL;
+ char *rpkgid = NULL;
+ sqlite3 *pkginfo_db = NULL;
+
+ info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x));
+ retvm_if(info == NULL, PMINFO_R_ERROR, "Out of Memory!!!");
+
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q)", lhs_app_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto catch;
+ }
+
+ if (exist == 0) {
+ lpkgid = NULL;
+ } else {
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select package from package_app_info where app_id=%Q", lhs_app_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkginfo_db, query, __cert_cb, (void *)info, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto catch;
+ }
+ lpkgid = strdup(info->pkgid);
+ if (lpkgid == NULL) {
+ _LOGE("Out of Memory\n");
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto catch;
+ }
+ free(info->pkgid);
+ info->pkgid = NULL;
+ }
+
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q)", rhs_app_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto catch;
+ }
+
+ if (exist == 0) {
+ rpkgid = NULL;
+ } else {
+ sqlite3_free(query);
+ query = sqlite3_mprintf("select package from package_app_info where app_id=%Q", rhs_app_id);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkginfo_db, query, __cert_cb, (void *)info, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto catch;
+ }
+ rpkgid = strdup(info->pkgid);
+ if (rpkgid == NULL) {
+ _LOGE("Out of Memory\n");
+ ret = PMINFO_R_ERROR;
+ sqlite3_free(query);
+ goto catch;
+ }
+ sqlite3_free(query);
+ free(info->pkgid);
+ info->pkgid = NULL;
+ }
+ ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lpkgid, rpkgid, compare_result);
+
+ catch:
+ sqlite3_free(error_message);
+ sqlite3_close(pkginfo_db);
+ if (info) {
+ if (info->pkgid) {
+ free(info->pkgid);
+ info->pkgid = NULL;
+ }
+ free(info);
+ info = NULL;
+ }
+ if (lpkgid) {
+ free(lpkgid);
+ lpkgid = NULL;
+ }
+ if (rpkgid) {
+ free(rpkgid);
+ rpkgid = NULL;
+ }
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(accessible == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+#if 0 //smack issue occured, check later
+ char *pkgid = NULL;
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+ if (pkgid == NULL){
+ _LOGD("invalid func parameters\n");
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("pkgmgr_get_pkg_external_validation() called\n");
+
+ FILE *fp = NULL;
+ char app_mmc_path[FILENAME_MAX] = { 0, };
+ char app_dir_path[FILENAME_MAX] = { 0, };
+ char app_mmc_internal_path[FILENAME_MAX] = { 0, };
+ snprintf(app_dir_path, FILENAME_MAX,"%s%s", PKG_RW_PATH, pkgid);
+ snprintf(app_mmc_path, FILENAME_MAX,"%s%s", PKG_SD_PATH, pkgid);
+ snprintf(app_mmc_internal_path, FILENAME_MAX,"%s%s/.mmc", PKG_RW_PATH, pkgid);
+
+ /*check whether application is in external memory or not */
+ fp = fopen(app_mmc_path, "r");
+ if (fp == NULL){
+ _LOGD(" app path in external memory not accesible\n");
+ } else {
+ fclose(fp);
+ fp = NULL;
+ *accessible = 1;
+ _LOGD("pkgmgr_get_pkg_external_validation() : SD_CARD \n");
+ return PMINFO_R_OK;
+ }
+
+ /*check whether application is in internal or not */
+ fp = fopen(app_dir_path, "r");
+ if (fp == NULL) {
+ _LOGD(" app path in internal memory not accesible\n");
+ *accessible = 0;
+ return PMINFO_R_ERROR;
+ } else {
+ fclose(fp);
+ /*check whether the application is installed in SD card
+ but SD card is not present*/
+ fp = fopen(app_mmc_internal_path, "r");
+ if (fp == NULL){
+ *accessible = 1;
+ _LOGD("pkgmgr_get_pkg_external_validation() : INTERNAL_MEM \n");
+ return PMINFO_R_OK;
+ }
+ else{
+ *accessible = 0;
+ _LOGD("pkgmgr_get_pkg_external_validation() : ERROR_MMC_STATUS \n");
+ }
+ fclose(fp);
+ }
+
+ _LOGD("pkgmgr_get_pkg_external_validation() end\n");
+#endif
+
+ *accessible = 1;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(removable == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->removable;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *removable = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *removable = 0;
+ else
+ *removable = 1;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(movable == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+ val = (char *)info->manifest_info->installlocation;
+ if (val) {
+ if (strcmp(val, "internal-only") == 0)
+ *movable = 0;
+ else if (strcmp(val, "prefer-external") == 0)
+ *movable = 1;
+ else
+ *movable = 1;
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(preload == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->preload;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *preload = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *preload = 0;
+ else
+ *preload = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(system == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->system;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *system = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *system = 0;
+ else
+ *system = 0;
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(readonly == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->readonly;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *readonly = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *readonly = 0;
+ else
+ *readonly = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(update == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ val = (char *)info->manifest_info->update;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *update = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *update = 0;
+ else
+ *update = 1;
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ __cleanup_pkginfo(info);
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle output parameter is NULL\n");
+ *handle = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)calloc(1, sizeof(pkgmgrinfo_filter_x));
+ if (filter == NULL) {
+ _LOGE("Out of Memory!!!");
+ return PMINFO_R_ERROR;
+ }
+ *handle = filter;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ if (filter->list){
+ g_slist_foreach(filter->list, __destroy_each_node, NULL);
+ g_slist_free(filter->list);
+ }
+ free(filter);
+ filter = NULL;
+
+ if (access(PKG_SIZE_INFO_FILE, F_OK) == 0) {
+ char info_file[PKG_VALUE_STRING_LEN_MAX] = { 0, };
+ snprintf(info_file, PKG_VALUE_STRING_LEN_MAX, "%s", PKG_SIZE_INFO_FILE);
+ (void)remove(info_file);
+ }
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
+ const char *property, const int value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char buf[PKG_VALUE_STRING_LEN_MAX] = {'\0'};
+ char *val = NULL;
+ GSList *link = NULL;
+ int prop = -1;
+ prop = _pminfo_pkginfo_convert_to_prop_int(property);
+ if (prop < E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT ||
+ prop > E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_INT) {
+ _LOGE("Invalid Integer Property\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+ snprintf(buf, PKG_VALUE_STRING_LEN_MAX - 1, "%d", value);
+ val = strndup(buf, PKG_VALUE_STRING_LEN_MAX - 1);
+ if (val == NULL) {
+ _LOGE("Out of Memory\n");
+ free(node);
+ node = NULL;
+ return PMINFO_R_ERROR;
+ }
+ node->prop = prop;
+ node->value = val;
+ /*If API is called multiple times for same property, we should override the previous values.
+ Last value set will be used for filtering.*/
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ return PMINFO_R_OK;
+
+}
+
+API int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
+ const char *property, const bool value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *val = NULL;
+ GSList *link = NULL;
+ int prop = -1;
+ prop = _pminfo_pkginfo_convert_to_prop_bool(property);
+ if (prop < E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL ||
+ prop > E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL) {
+ _LOGE("Invalid Boolean Property\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+ if (value)
+ val = strndup("('true','True')", 15);
+ else
+ val = strndup("('false','False')", 17);
+ if (val == NULL) {
+ _LOGE("Out of Memory\n");
+ free(node);
+ node = NULL;
+ return PMINFO_R_ERROR;
+ }
+ node->prop = prop;
+ node->value = val;
+ /*If API is called multiple times for same property, we should override the previous values.
+ Last value set will be used for filtering.*/
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ return PMINFO_R_OK;
+
+}
+
+API int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
+ const char *property, const char *value)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(value == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *val = NULL;
+ GSList *link = NULL;
+ int prop = -1;
+ prop = _pminfo_pkginfo_convert_to_prop_str(property);
+ if (prop < E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR ||
+ prop > E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_STR) {
+ _LOGE("Invalid String Property\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+ if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_AUTO) == 0)
+ val = strndup("auto", PKG_STRING_LEN_MAX - 1);
+ else if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL) == 0)
+ val = strndup("internal-only", PKG_STRING_LEN_MAX - 1);
+ else if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL) == 0)
+ val = strndup("prefer-external", PKG_STRING_LEN_MAX - 1);
+ else if (strcmp(value, "installed_internal") == 0)
+ val = strndup("installed_internal", PKG_STRING_LEN_MAX - 1);
+ else if (strcmp(value, "installed_external") == 0)
+ val = strndup("installed_external", PKG_STRING_LEN_MAX - 1);
+ else
+ val = strndup(value, PKG_STRING_LEN_MAX - 1);
+ if (val == NULL) {
+ _LOGE("Out of Memory\n");
+ free(node);
+ node = NULL;
+ return PMINFO_R_ERROR;
+ }
+ node->prop = prop;
+ node->value = val;
+ /*If API is called multiple times for same property, we should override the previous values.
+ Last value set will be used for filtering.*/
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link)
+ filter->list = g_slist_delete_link(filter->list, link);
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+ return PMINFO_R_OK;
+
+}
+
+API int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(count == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *locale = NULL;
+ char *condition = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char where[MAX_QUERY_LEN] = {'\0'};
+ GSList *list;
+ int ret = 0;
+ pkgmgr_pkginfo_x *node = NULL;
+ pkgmgr_pkginfo_x *tmphead = NULL;
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ sqlite3 *pkginfo_db = NULL;
+ int filter_count = 0;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*Start constructing query*/
+ snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_PACKAGE, locale);
+
+ /*Get where clause*/
+ for (list = filter->list; list; list = g_slist_next(list)) {
+ __get_filter_condition(list->data, &condition);
+ if (condition) {
+ strncat(where, condition, sizeof(where) - strlen(where) -1);
+ where[sizeof(where) - 1] = '\0';
+ free(condition);
+ condition = NULL;
+ }
+ if (g_slist_next(list)) {
+ strncat(where, " and ", sizeof(where) - strlen(where) - 1);
+ where[sizeof(where) - 1] = '\0';
+ }
+ }
+ _LOGE("where = %s\n", where);
+ if (strlen(where) > 0) {
+ strncat(query, where, sizeof(query) - strlen(query) - 1);
+ query[sizeof(query) - 1] = '\0';
+ }
+ _LOGE("query = %s\n", query);
+
+ tmphead = calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(tmphead == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ LISTHEAD(tmphead, node);
+ for(node = node->next ; node ; node = node->next) {
+ pkginfo = node;
+ pkginfo->locale = strdup(locale);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
+
+ /*populate manifest_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+ }
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next ; node ; node = node->next) {
+ pkginfo = node;
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ if(ret < 0)
+ continue;
+ filter_count++;
+ }
+
+ *count = filter_count;
+ ret = PMINFO_R_OK;
+
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ sqlite3_close(pkginfo_db);
+ __cleanup_pkginfo(tmphead);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
+ pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(pkg_cb == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ char *locale = NULL;
+ char *condition = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char where[MAX_QUERY_LEN] = {'\0'};
+ GSList *list;
+ int ret = 0;
+ label_x *tmp1 = NULL;
+ icon_x *tmp2 = NULL;
+ description_x *tmp3 = NULL;
+ author_x *tmp4 = NULL;
+ privilege_x *tmp5 = NULL;
+ pkgmgr_pkginfo_x *node = NULL;
+ pkgmgr_pkginfo_x *tmphead = NULL;
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ sqlite3 *pkginfo_db = NULL;
+ char* package_size_info = NULL;
+ bool is_setting = false;
+
+ /*open db*/
+ ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*Start constructing query*/
+ snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_PACKAGE, locale);
+
+ /*Get where clause*/
+ for (list = filter->list; list; list = g_slist_next(list)) {
+ __get_filter_condition(list->data, &condition);
+ if (condition) {
+ strncat(where, condition, sizeof(where) - strlen(where) -1);
+ where[sizeof(where) - 1] = '\0';
+
+ if (strstr(condition, "package_info.package_nodisplay"))
+ is_setting = true;
+
+ free(condition);
+ condition = NULL;
+ }
+ if (g_slist_next(list)) {
+ strncat(where, " and ", sizeof(where) - strlen(where) - 1);
+ where[sizeof(where) - 1] = '\0';
+ }
+ }
+ _LOGE("where = %s\n", where);
+ if (strlen(where) > 0) {
+ strncat(query, where, sizeof(query) - strlen(query) - 1);
+ query[sizeof(query) - 1] = '\0';
+ }
+ _LOGE("query = %s\n", query);
+
+ tmphead = calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(tmphead == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+
+ ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (is_setting) {
+ ret = __reqeust_get_size("size_info", PM_GET_SIZE_FILE);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "fail reqeust size info");
+
+ ret = __get_package_size_info(&package_size_info);
+ tryvm_if(ret != 0 || package_size_info == NULL, ret = PMINFO_R_ERROR, "__get_package_size_info() failed");
+ _LOGD("is_setting is true, get package size info success!! ");
+ }
+
+ LISTHEAD(tmphead, node);
+ for(node = node->next ; node ; node = node->next) {
+ pkginfo = node;
+ pkginfo->locale = strdup(locale);
+ pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
+ tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
+
+ /*populate manifest_info from DB*/
+ snprintf(query, MAX_QUERY_LEN, "select * from package_info where package='%s' ", pkginfo->manifest_info->package);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_localized_info where package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ if (pkginfo->manifest_info->label) {
+ LISTHEAD(pkginfo->manifest_info->label, tmp1);
+ pkginfo->manifest_info->label = tmp1;
+ }
+ if (pkginfo->manifest_info->icon) {
+ LISTHEAD(pkginfo->manifest_info->icon, tmp2);
+ pkginfo->manifest_info->icon = tmp2;
+ }
+ if (pkginfo->manifest_info->description) {
+ LISTHEAD(pkginfo->manifest_info->description, tmp3);
+ pkginfo->manifest_info->description = tmp3;
+ }
+ if (pkginfo->manifest_info->author) {
+ LISTHEAD(pkginfo->manifest_info->author, tmp4);
+ pkginfo->manifest_info->author = tmp4;
+ }
+ if (pkginfo->manifest_info->privileges->privilege) {
+ LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
+ pkginfo->manifest_info->privileges->privilege = tmp5;
+ }
+ if (is_setting) {
+ __set_package_size_info(pkginfo->manifest_info, package_size_info);
+ }
+ }
+
+ LISTHEAD(tmphead, node);
+
+ for(node = node->next ; node ; node = node->next) {
+ pkginfo = node;
+
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ if(ret < 0)
+ continue;
+
+ ret = pkg_cb( (void *)pkginfo, user_data);
+ if(ret < 0)
+ break;
+ }
+ ret = PMINFO_R_OK;
+
+catch:
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
+ if (package_size_info) {
+ free(package_size_info);
+ }
+
+ sqlite3_close(pkginfo_db);
+ __cleanup_pkginfo(tmphead);
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(privilege_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+ int ret = -1;
+ privilege_x *ptr = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ ptr = info->manifest_info->privileges->privilege;
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->text){
+ ret = privilege_func(ptr->text, user_data);
+ if (ret < 0)
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
--- /dev/null
+/*
+ * pkgmgrinfo-appinfo
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Junsuk Oh <junsuk77.oh@samsung.com>,
+ *
+ * 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.
+ *
+ */
+
+#include <vconf.h>
+
+#include "pkgmgrinfo_private.h"
+
+int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data)
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(db, query, callback, data, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
+void __cleanup_pkginfo(pkgmgr_pkginfo_x *data)
+{
+ if(data == NULL)
+ return;
+ if (data->locale){
+ free((void *)data->locale);
+ data->locale = NULL;
+ }
+
+ pkgmgr_parser_free_manifest_xml(data->manifest_info);
+ free((void *)data);
+ data = NULL;
+ return;
+}
+
+void __cleanup_appinfo(pkgmgr_appinfo_x *data)
+{
+ if(data == NULL)
+ return;
+ if (data->package){
+ free((void *)data->package);
+ data->package = NULL;
+ }
+ if (data->locale){
+ free((void *)data->locale);
+ data->locale = NULL;
+ }
+
+ manifest_x *mfx = calloc(1, sizeof(manifest_x));
+ if (data->app_component == PMINFO_UI_APP)
+ mfx->uiapplication = data->uiapp_info;
+ else if (data->app_component == PMINFO_SVC_APP)
+ mfx->serviceapplication = data->svcapp_info;
+ pkgmgr_parser_free_manifest_xml(mfx);
+ free((void *)data);
+ data = NULL;
+ return;
+}
+
+char* __convert_system_locale_to_manifest_locale()
+{
+ char *syslocale = NULL;
+
+ syslocale = vconf_get_str(VCONFKEY_LANGSET);
+
+ if (syslocale == NULL) {
+ _LOGE("syslocale is null\n");
+ return strdup(DEFAULT_LOCALE);
+ }
+
+ char *locale = malloc(6);
+ if (!locale) {
+ _LOGE("Malloc Failed\n");
+ free(syslocale);
+ return strdup(DEFAULT_LOCALE);
+ }
+
+ sprintf(locale, "%c%c-%c%c", syslocale[0], syslocale[1], tolower(syslocale[3]), tolower(syslocale[4]));
+
+ free(syslocale);
+ return locale;
+}
+
+gint __compare_func(gconstpointer data1, gconstpointer data2)
+{
+ pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x*)data1;
+ pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x*)data2;
+ if (node1->prop == node2->prop)
+ return 0;
+ else if (node1->prop > node2->prop)
+ return 1;
+ else
+ return -1;
+}
+
+
+void __get_filter_condition(gpointer data, char **condition)
+{
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data;
+ char buf[MAX_QUERY_LEN + 1] = {'\0'};
+ char temp[PKG_STRING_LEN_MAX] = {'\0'};
+ switch (node->prop) {
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_ID:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_type='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_version='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.install_location='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.installed_storage='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.author_name='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.author_href='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.author_email='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_size='%s'", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_removable IN %s", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_preload IN %s", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_readonly IN %s", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_update IN %s", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_appsetting IN %s", node->value);
+ break;
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING:
+ snprintf(buf, MAX_QUERY_LEN, "package_info.package_nodisplay IN %s", node->value);
+ break;
+
+ case E_PMINFO_APPINFO_PROP_APP_ID:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_id='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_component='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_EXEC:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_exec='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_ICON:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_localized_info.app_icon='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_TYPE:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_type='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_OPERATION:
+ snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
+ snprintf(buf, MAX_QUERY_LEN, "package_app_app_svc.operation IN %s", temp);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_URI:
+ snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
+ snprintf(buf, MAX_QUERY_LEN, "package_app_app_svc.uri_scheme IN %s", temp);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_MIME:
+ snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
+ snprintf(buf, MAX_QUERY_LEN, "package_app_app_svc.mime_type IN %s", temp);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
+ snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
+ snprintf(buf, MAX_QUERY_LEN, "package_app_app_category.category IN %s", temp);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_NODISPLAY:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_nodisplay IN %s", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_MULTIPLE:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_multiple IN %s", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_ONBOOT:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_onboot IN %s", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_AUTORESTART:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_autorestart IN %s", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_TASKMANAGE:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_taskmanage IN %s", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_HWACCELERATION:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_hwacceleration='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_SCREENREADER:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_screenreader='%s'", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION:
+ snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition IN %s", node->value);
+ break;
+ default:
+ _LOGE("Invalid Property Type\n");
+ *condition = NULL;
+ return;
+ }
+ *condition = strdup(buf);
+ return;
+}
+
+int __pkginfo_check_installed_storage(pkgmgr_pkginfo_x *pkginfo)
+{
+ char buf[MAX_QUERY_LEN] = {'\0'};
+ retvm_if(pkginfo->manifest_info->package == NULL, PMINFO_R_OK, "pkgid is NULL\n");
+ retvm_if(pkginfo->manifest_info->installed_storage == NULL, PMINFO_R_ERROR, "installed_storage is NULL\n");
+
+ if (strcmp(pkginfo->manifest_info->installed_storage,"installed_external") == 0) {
+ snprintf(buf, MAX_QUERY_LEN - 1, "%s%s", PKG_SD_PATH, pkginfo->manifest_info->package);
+ if (access(buf, R_OK) != 0) {
+ _LOGE("can not access [%s]", buf);
+ return PMINFO_R_ERROR;
+ }
+ }
+
+ return PMINFO_R_OK;
+}
+
+int __appinfo_check_installed_storage(pkgmgr_appinfo_x *appinfo)
+{
+ char buf[MAX_QUERY_LEN] = {'\0'};
+ char pkgid[MAX_QUERY_LEN] = {'\0'};
+
+ if (appinfo->package != NULL)
+ snprintf(pkgid, MAX_QUERY_LEN - 1, "%s", appinfo->package);
+ else
+ snprintf(pkgid, MAX_QUERY_LEN - 1, "%s", appinfo->uiapp_info->package);
+
+ retvm_if(appinfo->uiapp_info->installed_storage == NULL, PMINFO_R_ERROR, "installed_storage is NULL\n");
+
+ if (strcmp(appinfo->uiapp_info->installed_storage,"installed_external") == 0) {
+ snprintf(buf, MAX_QUERY_LEN - 1, "%s%s", PKG_SD_PATH, pkgid);
+ if (access(buf, R_OK) != 0) {
+ _LOGE("can not access [%s]", buf);
+ return PMINFO_R_ERROR;
+ }
+ }
+
+ return PMINFO_R_OK;
+}
+