Initialize Tizen 2.3 2.3a_release submit/tizen_2.3/20140531.053354
authorSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:28:38 +0000 (12:28 +0900)
committerSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:28:38 +0000 (12:28 +0900)
61 files changed:
.gitignore [new file with mode: 0755]
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
TC/build.sh [new file with mode: 0755]
TC/execute.sh [new file with mode: 0755]
TC/tet_code [new file with mode: 0644]
TC/tet_scen [new file with mode: 0644]
TC/tetbuild.cfg [new file with mode: 0644]
TC/tetclean.cfg [new file with mode: 0644]
TC/tetexec.cfg [new file with mode: 0644]
TC/unit/Makefile [new file with mode: 0644]
TC/unit/tc_gen.sh [new file with mode: 0755]
TC/unit/tslist [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_efl_main_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_exit_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_get_rotation_state_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_init_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_measure_start_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_measure_time_from_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_measure_time_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_set_event_callback_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_set_i18n_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_set_rotation_cb_func.c [new file with mode: 0644]
TC/unit/utc_ApplicationFW_appcore_unset_rotation_cb_func.c [new file with mode: 0644]
TC/unit/utc_MODULE_API_func.c.in [new file with mode: 0644]
app-core.manifest [new file with mode: 0644]
appcore-common.pc.in [new file with mode: 0644]
appcore-efl.pc.in [new file with mode: 0644]
debian/app-template.install.in [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/docs [new file with mode: 0644]
debian/libappcore-common-0.install.in [new file with mode: 0644]
debian/libappcore-common-dev.install.in [new file with mode: 0644]
debian/libappcore-efl-0.install.in [new file with mode: 0644]
debian/libappcore-efl-dev.install.in [new file with mode: 0644]
debian/rules [new file with mode: 0755]
include/SLP_Appcore_PG.h [new file with mode: 0755]
include/appcore-common.h [new file with mode: 0755]
include/appcore-efl.h [new file with mode: 0755]
include/appcore-internal.h [new file with mode: 0755]
include/image/SLP_Appcore_PG_events.png [new file with mode: 0644]
include/image/SLP_Appcore_PG_lifecycle.png [new file with mode: 0644]
include/image/SLP_Appcore_PG_overview.png [new file with mode: 0644]
include/image/SLP_Appcore_PG_rotation.png [new file with mode: 0755]
include/virtual_canvas.h [new file with mode: 0644]
packaging/app-core.spec [new file with mode: 0644]
packaging/core-efl.target [new file with mode: 0644]
src/appcore-X.c [new file with mode: 0755]
src/appcore-efl.c [new file with mode: 0755]
src/appcore-i18n.c [new file with mode: 0755]
src/appcore-measure.c [new file with mode: 0755]
src/appcore-noti.c [new file with mode: 0755]
src/appcore-pmcontrol.c [new file with mode: 0755]
src/appcore-rotation.c [new file with mode: 0755]
src/appcore-util.c [new file with mode: 0755]
src/appcore.c [new file with mode: 0755]
src/virtual_canvas.c [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100755 (executable)
index 0000000..6ab0cd7
--- /dev/null
@@ -0,0 +1,27 @@
+build_log
+*.log
+*.pyc
+usr
+opt
+*.o
+*.os
+*.exe
+packages
+binaries
+*.ipk
+*~
+build-stamp
+cmake_build_tmp/
+configure-stamp
+debian/files
+debian/*.install
+debian/*.substvars
+debian/*.debhelper
+debian/app-template/
+debian/libappcore-common-0/
+debian/libappcore-common-dev/
+debian/libappcore-dbg/
+debian/libappcore-efl-0/
+debian/libappcore-efl-dev/
+debian/libappcore-gtk-0/
+debian/libappcore-gtk-dev/
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..064881e
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Jayoun Lee <airjany@samsung.com>
+Sewook Park <sewook7.park@samsung.com>
+Jaeho Lee <jaeho81.lee@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bad7798
--- /dev/null
@@ -0,0 +1,90 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(appcore C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.1")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+IF(DEVICE_PROFILE STREQUAL "wearable")
+       ADD_DEFINITIONS("-DWEARABLE_PROFILE")
+ELSEIF(DEVICE_PROFILE STREQUAL "mobile")
+       ADD_DEFINITIONS("-DMOBILE_PROFILE")
+ENDIF()
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+#################################################################
+# Build appcore-common Library
+# ------------------------------
+SET(APPCORE_COMMON "appcore-common")
+SET(SRCS_common src/appcore.c src/appcore-i18n.c src/appcore-measure.c
+#              src/appcore-noti.c src/appcore-pmcontrol.c 
+               src/appcore-rotation.c
+#              src/appcore-util.c
+               src/appcore-X.c)
+SET(HEADERS_common appcore-common.h)
+
+INCLUDE(FindPkgConfig)
+#pkg_check_modules(pkg_common REQUIRED pmapi vconf sensor aul rua dlog x11)
+pkg_check_modules(pkg_common REQUIRED vconf sensor aul dlog x11 ecore-x)
+FOREACH(flag ${pkg_common_CFLAGS})
+       SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${APPCORE_COMMON} SHARED ${SRCS_common})
+SET_TARGET_PROPERTIES(${APPCORE_COMMON} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${APPCORE_COMMON} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${APPCORE_COMMON} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
+TARGET_LINK_LIBRARIES(${APPCORE_COMMON} ${pkg_common_LDFLAGS} "-ldl")
+
+CONFIGURE_FILE(${APPCORE_COMMON}.pc.in ${APPCORE_COMMON}.pc @ONLY)
+
+INSTALL(TARGETS ${APPCORE_COMMON} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_COMMON}.pc DESTINATION lib/pkgconfig)
+FOREACH(hfile ${HEADERS_common})
+       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${hfile} DESTINATION include/appcore)
+ENDFOREACH(hfile)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/SLP_Appcore_PG.h DESTINATION include)
+
+#################################################################
+# Build appcore-efl Library
+# ------------------------------
+SET(APPCORE_EFL "appcore-efl")
+SET(SRCS_efl src/appcore-efl.c src/virtual_canvas.c)
+
+SET(HEADERS_efl appcore-efl.h)
+
+INCLUDE(FindPkgConfig)
+IF(DEVICE_PROFILE STREQUAL "wearable")
+pkg_check_modules(pkg_efl REQUIRED elementary dlog ecore ecore-x gobject-2.0 glib-2.0 x11 xcomposite ecore-evas ecore-input aul system-resource)
+ELSE()
+pkg_check_modules(pkg_efl REQUIRED elementary dlog ecore ecore-x gobject-2.0 glib-2.0 x11 xcomposite ecore-evas ecore-input aul)
+ENDIF()
+FOREACH(flag ${pkg_efl_CFLAGS})
+       SET(EXTRA_CFLAGS_efl "${EXTRA_CFLAGS_efl} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${APPCORE_EFL} SHARED ${SRCS_efl})
+SET_TARGET_PROPERTIES(${APPCORE_EFL} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${APPCORE_EFL} PROPERTIES VERSION ${VERSION})
+SET_TARGET_PROPERTIES(${APPCORE_EFL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_efl})
+TARGET_LINK_LIBRARIES(${APPCORE_EFL} ${pkg_efl_LDFLAGS} ${APPCORE_COMMON})
+
+CONFIGURE_FILE(${APPCORE_EFL}.pc.in ${APPCORE_EFL}.pc @ONLY)
+
+INSTALL(TARGETS ${APPCORE_EFL} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_EFL}.pc DESTINATION lib/pkgconfig)
+FOREACH(hfile ${HEADERS_efl})
+       INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${hfile} DESTINATION include/appcore)
+ENDFOREACH(hfile)
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..9c13a9b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+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
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..98ebeff
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+export TET_INSTALL_PATH=/scratchbox/tetware  # 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
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..2d9df79
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#export TET_INSTALL_PATH=/mnt/nfs/tetware
+export TET_INSTALL_PATH=/scratchbox/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
diff --git a/TC/tet_code b/TC/tet_code
new file mode 100644 (file)
index 0000000..a2cf6c1
--- /dev/null
@@ -0,0 +1,12 @@
+# 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"
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100644 (file)
index 0000000..43cbc9b
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/unit/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100644 (file)
index 0000000..6192c78
--- /dev/null
@@ -0,0 +1,3 @@
+TET_OUTPUT_CAPTURE=False
+TET_BUILD_TOOL=make
+TET_PASS_TC_NAME=True
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100644 (file)
index 0000000..c66eda4
--- /dev/null
@@ -0,0 +1,2 @@
+TET_OUTPUT_CAPTURE=False
+TET_CLEAN_TOOL=make clean
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100644 (file)
index 0000000..0d9d39a
--- /dev/null
@@ -0,0 +1 @@
+TET_OUTPUT_CAPTURE=False
diff --git a/TC/unit/Makefile b/TC/unit/Makefile
new file mode 100644 (file)
index 0000000..f967994
--- /dev/null
@@ -0,0 +1,33 @@
+CC ?= gcc
+
+TARGETS =  \
+         utc_ApplicationFW_appcore_efl_main_func \
+         utc_ApplicationFW_appcore_init_func \
+         utc_ApplicationFW_appcore_exit_func \
+         utc_ApplicationFW_appcore_set_rotation_cb_func \
+         utc_ApplicationFW_appcore_unset_rotation_cb_func \
+         utc_ApplicationFW_appcore_get_rotation_state_func \
+         utc_ApplicationFW_appcore_set_i18n_func \
+         utc_ApplicationFW_appcore_measure_start_func \
+         utc_ApplicationFW_appcore_measure_time_func \
+         utc_ApplicationFW_appcore_measure_time_from_func \
+         utc_ApplicationFW_appcore_set_event_callback_func
+
+PKGS = appcore-efl
+
+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
+
+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)
diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh
new file mode 100755 (executable)
index 0000000..54f482d
--- /dev/null
@@ -0,0 +1,28 @@
+#!/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"
diff --git a/TC/unit/tslist b/TC/unit/tslist
new file mode 100644 (file)
index 0000000..91c8d1a
--- /dev/null
@@ -0,0 +1,11 @@
+/unit/utc_ApplicationFW_appcore_efl_main_func
+/unit/utc_ApplicationFW_appcore_init_func
+/unit/utc_ApplicationFW_appcore_exit_func
+/unit/utc_ApplicationFW_appcore_set_rotation_cb_func
+/unit/utc_ApplicationFW_appcore_unset_rotation_cb_func
+/unit/utc_ApplicationFW_appcore_get_rotation_state_func
+/unit/utc_ApplicationFW_appcore_set_i18n_func
+/unit/utc_ApplicationFW_appcore_measure_start_func
+/unit/utc_ApplicationFW_appcore_measure_time_func
+/unit/utc_ApplicationFW_appcore_measure_time_from_func
+/unit/utc_ApplicationFW_appcore_set_event_callback_func
diff --git a/TC/unit/utc_ApplicationFW_appcore_efl_main_func.c b/TC/unit/utc_ApplicationFW_appcore_efl_main_func.c
new file mode 100644 (file)
index 0000000..eacd09e
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <Elementary.h>
+#include <appcore-efl.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_efl_main_func_01(void);
+static void utc_ApplicationFW_appcore_efl_main_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_efl_main_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_appcore_efl_main_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int app_reset(bundle *b, void *data)
+{
+       elm_exit();
+       return 0;
+}
+
+/**
+ * @brief Positive test case of appcore_efl_main()
+ */
+static void utc_ApplicationFW_appcore_efl_main_func_01(void)
+{
+       int r = 0;
+       int argc = 1;
+       char *_argv[] = {
+               "Testcase",
+               NULL,
+       };
+       char **argv;
+       struct appcore_ops ops = {
+               .reset = app_reset,
+       };
+
+       argv = _argv;
+       r = appcore_efl_main("Testcase", &argc, &argv, &ops);
+       printf("Return %d\n", r);
+       if (r) {
+               tet_infoline("appcore_efl_main() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init appcore_efl_main()
+ */
+static void utc_ApplicationFW_appcore_efl_main_func_02(void)
+{
+       int r = 0;
+       int argc = 1;
+       char *_argv[] = {
+               "Testcase",
+               NULL,
+       };
+       char **argv;
+       struct appcore_ops ops = {
+               .reset = app_reset,
+       };
+
+       argv = _argv;
+       r = appcore_efl_main("Testcase", &argc, &argv, NULL);
+       if (!r) {
+               tet_infoline("appcore_efl_main() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_efl_main(NULL, &argc, &argv, &ops);
+       if (!r) {
+               tet_infoline("appcore_efl_main() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_efl_main("Testcase", NULL, &argv, &ops);
+       if (!r) {
+               tet_infoline("appcore_efl_main() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_efl_main("Testcase", &argc, NULL, &ops);
+       if (!r) {
+               tet_infoline("appcore_efl_main() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_appcore_exit_func.c b/TC/unit/utc_ApplicationFW_appcore_exit_func.c
new file mode 100644 (file)
index 0000000..b74e9a6
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_exit_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_exit_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_exit()
+ */
+static void utc_ApplicationFW_appcore_exit_func_01(void)
+{
+       appcore_exit();
+       tet_result(TET_PASS);
+}
+
diff --git a/TC/unit/utc_ApplicationFW_appcore_get_rotation_state_func.c b/TC/unit/utc_ApplicationFW_appcore_get_rotation_state_func.c
new file mode 100644 (file)
index 0000000..45c0226
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_get_rotation_state_func_01(void);
+static void utc_ApplicationFW_appcore_get_rotation_state_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_get_rotation_state_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_appcore_get_rotation_state_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_get_rotation_state()
+ */
+static void utc_ApplicationFW_appcore_get_rotation_state_func_01(void)
+{
+       int r = 0;
+       enum appcore_rm curr;
+
+       r = appcore_get_rotation_state(&curr);
+       if (r) {
+               tet_infoline("appcore_get_rotation_state() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init appcore_get_rotation_state()
+ */
+static void utc_ApplicationFW_appcore_get_rotation_state_func_02(void)
+{
+       int r = 0;
+
+       r = appcore_get_rotation_state(NULL);
+       if (!r) {
+               tet_infoline("appcore_get_rotation_state() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_appcore_init_func.c b/TC/unit/utc_ApplicationFW_appcore_init_func.c
new file mode 100644 (file)
index 0000000..3c0e283
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+struct ui_ops {
+       void *data;
+       void (*cb_app)(int, void *, bundle *);
+};
+
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_init_func_01(void);
+static void utc_ApplicationFW_appcore_init_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_init_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_appcore_init_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+       appcore_exit();
+}
+
+static void ui_cb(int evt, void *data, bundle *b)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_init()
+ */
+static void utc_ApplicationFW_appcore_init_func_01(void)
+{
+       int r = 0;
+       int argc = 1;
+       char *argv[] = {
+               "Testcase",
+               NULL,
+       };
+       const struct ui_ops ops = {
+               .cb_app = ui_cb,
+       };
+
+       r = appcore_init("Testcase", &ops, argc, argv);
+       if (r) {
+               tet_infoline("appcore_init() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init appcore_init()
+ */
+static void utc_ApplicationFW_appcore_init_func_02(void)
+{
+       int r = 0;
+       int argc = 1;
+       char *argv[] = {
+               "Testcase",
+               NULL,
+       };
+       const struct ui_ops ops = {
+               .cb_app = ui_cb,
+       };
+
+       r = appcore_init(NULL, &ops, argc, argv);
+       if (!r) {
+               tet_infoline("appcore_init() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_init("Testcase", NULL, argc, argv);
+       if (!r) {
+               tet_infoline("appcore_init() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_init("Testcase", &ops, -1, argv);
+       if (!r) {
+               tet_infoline("appcore_init() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_init("Testcase", &ops, argc, NULL);
+       if (!r) {
+               tet_infoline("appcore_init() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_appcore_measure_start_func.c b/TC/unit/utc_ApplicationFW_appcore_measure_start_func.c
new file mode 100644 (file)
index 0000000..30eb144
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_measure_start_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_measure_start_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_measure_start()
+ */
+static void utc_ApplicationFW_appcore_measure_start_func_01(void)
+{
+       appcore_measure_start();
+       tet_result(TET_PASS);
+}
+
diff --git a/TC/unit/utc_ApplicationFW_appcore_measure_time_from_func.c b/TC/unit/utc_ApplicationFW_appcore_measure_time_from_func.c
new file mode 100644 (file)
index 0000000..8af350b
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <stdio.h>
+
+#define APPCORE_TESTCASE "APPCORE_TESTCASE"
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_measure_time_from_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_measure_time_from_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+       struct timeval tv;
+       char buf[1024];
+
+       gettimeofday(&tv, NULL);
+
+       snprintf(buf, sizeof(buf), "%d %d", (int)tv.tv_sec, (int)tv.tv_usec);
+       setenv(APPCORE_TESTCASE, buf, 1);
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_measure_time_from()
+ */
+static void utc_ApplicationFW_appcore_measure_time_from_func_01(void)
+{
+       int r = 0;
+
+       r = appcore_measure_time_from(APPCORE_TESTCASE);
+       if (!r) {
+               tet_infoline("appcore_measure_time_from() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       unsetenv(APPCORE_TESTCASE);
+
+       r = appcore_measure_time_from(APPCORE_TESTCASE);
+       if (r) {
+               tet_infoline("appcore_measure_time_from() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
+
diff --git a/TC/unit/utc_ApplicationFW_appcore_measure_time_func.c b/TC/unit/utc_ApplicationFW_appcore_measure_time_func.c
new file mode 100644 (file)
index 0000000..245cd9f
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_measure_time_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_measure_time_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+       appcore_measure_start();
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_measure_time()
+ */
+static void utc_ApplicationFW_appcore_measure_time_func_01(void)
+{
+       int r = 0;
+
+       r = appcore_measure_time();
+       if (r == 0) {
+               tet_infoline("appcore_measure_time() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
diff --git a/TC/unit/utc_ApplicationFW_appcore_set_event_callback_func.c b/TC/unit/utc_ApplicationFW_appcore_set_event_callback_func.c
new file mode 100644 (file)
index 0000000..6cb792c
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_set_event_callback_func_01(void);
+static void utc_ApplicationFW_appcore_set_event_callback_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_set_event_callback_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_appcore_set_event_callback_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int cb(void *data)
+{
+
+       return 0;
+}
+
+
+/**
+ * @brief Positive test case of appcore_set_event_callback()
+ */
+static void utc_ApplicationFW_appcore_set_event_callback_func_01(void)
+{
+       int r = 0;
+
+       r = appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, cb, NULL);
+       if (r) {
+               tet_infoline("appcore_set_event_callback() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       r = appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, NULL, NULL);
+       if (r) {
+               tet_infoline("appcore_set_event_callback() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init appcore_set_event_callback()
+ */
+static void utc_ApplicationFW_appcore_set_event_callback_func_02(void)
+{
+       int r = 0;
+
+       r = appcore_set_event_callback(-1, cb, NULL);
+       if (!r) {
+               tet_infoline("appcore_set_event_callback() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_appcore_set_i18n_func.c b/TC/unit/utc_ApplicationFW_appcore_set_i18n_func.c
new file mode 100644 (file)
index 0000000..6ec6522
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_set_i18n_func_01(void);
+static void utc_ApplicationFW_appcore_set_i18n_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_set_i18n_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_appcore_set_i18n_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_set_i18n()
+ */
+static void utc_ApplicationFW_appcore_set_i18n_func_01(void)
+{
+       int r = 0;
+
+       r = appcore_set_i18n("Testcase", NULL);
+       if (r) {
+               tet_infoline("appcore_set_i18n() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init appcore_set_i18n()
+ */
+static void utc_ApplicationFW_appcore_set_i18n_func_02(void)
+{
+       int r = 0;
+
+       r = appcore_set_i18n(NULL, NULL);
+       if (!r) {
+               tet_infoline("appcore_set_i18n() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_appcore_set_rotation_cb_func.c b/TC/unit/utc_ApplicationFW_appcore_set_rotation_cb_func.c
new file mode 100644 (file)
index 0000000..79a3738
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_set_rotation_cb_func_01(void);
+static void utc_ApplicationFW_appcore_set_rotation_cb_func_02(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_set_rotation_cb_func_01, POSITIVE_TC_IDX },
+       { utc_ApplicationFW_appcore_set_rotation_cb_func_02, NEGATIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+static int rot_cb(enum appcore_rm rm, void *data)
+{
+
+       return 0;
+}
+
+/**
+ * @brief Positive test case of appcore_set_rotation_cb()
+ */
+static void utc_ApplicationFW_appcore_set_rotation_cb_func_01(void)
+{
+       int r = 0;
+
+       r = appcore_set_rotation_cb(rot_cb, NULL);
+       if (r) {
+               tet_infoline("appcore_set_rotation_cb() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
+/**
+ * @brief Negative test case of ug_init appcore_set_rotation_cb()
+ */
+static void utc_ApplicationFW_appcore_set_rotation_cb_func_02(void)
+{
+       int r = 0;
+
+       r = appcore_set_rotation_cb(NULL, NULL);
+       if (!r) {
+               tet_infoline("appcore_set_rotation_cb() failed in negative test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
diff --git a/TC/unit/utc_ApplicationFW_appcore_unset_rotation_cb_func.c b/TC/unit/utc_ApplicationFW_appcore_unset_rotation_cb_func.c
new file mode 100644 (file)
index 0000000..493315c
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <appcore-common.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_ApplicationFW_appcore_unset_rotation_cb_func_01(void);
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+struct tet_testlist tet_testlist[] = {
+       { utc_ApplicationFW_appcore_unset_rotation_cb_func_01, POSITIVE_TC_IDX },
+       { NULL, 0},
+};
+
+static void startup(void)
+{
+}
+
+static void cleanup(void)
+{
+}
+
+/**
+ * @brief Positive test case of appcore_unset_rotation_cb()
+ */
+static void utc_ApplicationFW_appcore_unset_rotation_cb_func_01(void)
+{
+       int r = 0;
+
+       r = appcore_unset_rotation_cb();
+       if (r) {
+               tet_infoline("appcore_unset_rotation_cb() failed in positive test case");
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+}
+
diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in
new file mode 100644 (file)
index 0000000..bf9f90c
--- /dev/null
@@ -0,0 +1,76 @@
+#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);
+}
diff --git a/app-core.manifest b/app-core.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/appcore-common.pc.in b/appcore-common.pc.in
new file mode 100644 (file)
index 0000000..233ccde
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: app-core-common
+Description: SAMSUNG Linux platform application library
+Version: @VERSION@
+Requires: sensor vconf aul dlog x11
+Libs: -L${libdir} -lappcore-common
+Cflags: -I${includedir} -I${includedir}/appcore
diff --git a/appcore-efl.pc.in b/appcore-efl.pc.in
new file mode 100644 (file)
index 0000000..9f6895c
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: app-core-efl
+Description: SAMSUNG Linux platform efl application library
+Version: @VERSION@
+Requires: elementary appcore-common dlog
+Libs: -L${libdir} -lappcore-efl
+Cflags: -I${includedir} -I${includedir}/appcore
diff --git a/debian/app-template.install.in b/debian/app-template.install.in
new file mode 100644 (file)
index 0000000..aaa2e86
--- /dev/null
@@ -0,0 +1,3 @@
+@PREFIX@/bin/app-gen.sh
+@PREFIX@/bin/app3D-gen.sh
+@PREFIX@/share/app-template/*
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..7357e83
--- /dev/null
@@ -0,0 +1,864 @@
+app-core (1.2-22) unstable; urgency=low
+
+  * Add error handle for ecore_x_window_prop_card32_get
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-22
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Sun, 13 May 2012 17:50:08 +0900
+
+app-core (1.2-21) unstable; urgency=low
+
+  * Updated rotation code
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-21
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 17 Apr 2012 16:47:13 +0900
+
+app-core (1.2-20) unstable; urgency=low
+
+  * Add appcore_set_system_resource_reclaiming API
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-20
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Thu, 29 Mar 2012 10:42:28 +0900
+
+app-core (1.2-19) unstable; urgency=low
+
+  * Fixed compile warnings
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-19
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 20 Mar 2012 13:51:26 +0900
+
+app-core (1.2-18) unstable; urgency=low
+
+  * API Changes in elementary
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-18
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 13 Mar 2012 17:45:24 +0900
+
+app-core (1.2-17) unstable; urgency=low
+
+  * Added window checking in __get_win_pid()
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-17
+
+ -- Sewook Park <sewook7.park@samsung.com>  Mon, 05 Mar 2012 17:21:51 +0900
+
+app-core (1.2-16) unstable; urgency=low
+
+  * Add aul_finalize()
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-16
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 28 Feb 2012 16:57:59 +0900
+
+app-core (1.2-15) unstable; urgency=low
+
+  * Remove rua
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-15
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Wed, 15 Feb 2012 19:06:18 +0900
+
+app-core (1.2-14) unstable; urgency=low
+
+  * About elm_all_flush issue
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-14
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Thu, 26 Jan 2012 17:33:57 +0900
+
+app-core (1.2-13) unstable; urgency=low
+
+  * Change window raise to send active request
+  * Git: slp/pkgs/a/app-core
+  * Tag: app-core_1.2-13
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Wed, 18 Jan 2012 19:31:33 +0900
+
+app-core (1.2-12) unstable; urgency=low
+
+  * Add appcore_set_pre_resume_cb API
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-12
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 10 Jan 2012 15:37:07 +0900
+
+app-core (1.2-11) unstable; urgency=low
+
+  * remove app-template
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-11
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 06 Dec 2011 11:15:26 +0900
+
+app-core (1.2-10) unstable; urgency=low
+
+  * Changed boilerplate
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-10
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Mon, 05 Dec 2011 16:40:38 +0900
+
+app-core (1.2-9) unstable; urgency=low
+
+  * Change XInternAtom function arg
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-9
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 15 Nov 2011 17:41:00 +0900
+
+app-core (1.2-8) unstable; urgency=low
+
+  * Modify XInternAtom function arg
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-8 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 08 Nov 2011 11:22:50 +0900
+
+app-core (1.2-7) unstable; urgency=low
+
+  * Changed Boilerplate as per the guideline
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-7 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Mon, 07 Nov 2011 16:55:09 +0900
+
+app-core (1.2-6) unstable; urgency=low
+
+  * Modify appcore-roration.c
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-6 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Mon, 24 Oct 2011 16:39:12 +0900
+
+app-core (1.2-5) unstable; urgency=low
+
+  * Fix rotation bug 
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-5 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 11 Oct 2011 19:24:34 +0900
+
+app-core (1.2-4) unstable; urgency=low
+
+  * Code cleanup
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-4 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 06 Sep 2011 11:31:50 +0900
+
+app-core (1.2-3) unstable; urgency=low
+
+  * Code cleanup
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-3
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Mon, 05 Sep 2011 20:18:22 +0900
+
+app-core (1.2-2) unstable; urgency=low
+
+  * Include stdbool.h
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-2 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Mon, 05 Sep 2011 15:58:21 +0900
+
+app-core (1.2-1) unstable; urgency=low
+
+  * Fix set i18n bug
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-1
+
+ --  Jaeho Lee <jaeho81.lee@samsung.com>  Wed, 31 Aug 2011 19:29:14 +0900
+
+app-core (1.2-0) unstable; urgency=low
+
+  * Remove gtk package and sglib dependency
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.2-0 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 30 Aug 2011 22:18:52 +0900
+
+app-core (1.1-64) unstable; urgency=low
+
+  * Fix TC build error
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-64 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Fri, 19 Aug 2011 15:18:54 +0900
+
+app-core (1.1-63) unstable; urgency=low
+
+  * Fix hide callback
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-63 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Wed, 17 Aug 2011 15:16:41 +0900
+
+app-core (1.1-62) unstable; urgency=low
+
+  * Modify Tc Makefile
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-62 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Tue, 16 Aug 2011 14:45:31 +0900
+
+app-core (1.1-61) unstable; urgency=low
+
+  * Apply code cleanup
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-61 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Wed, 03 Aug 2011 15:55:14 +0900
+
+app-core (1.1-60) unstable; urgency=low
+
+  * Fix resume rotation callback on rotation lock state
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-60
+
+ -- Sewook Park <sewook7.park@samsung.com>  Thu, 28 Jul 2011 12:36:54 +0900
+
+app-core (1.1-59) unstable; urgency=low
+
+  * Paunse & resume
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-59 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Fri, 22 Jul 2011 13:11:13 +0900
+
+app-core (1.1-58) unstable; urgency=low
+
+  * Code cleanup
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-58 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Wed, 13 Jul 2011 16:05:54 +0900
+
+app-core (1.1-57) unstable; urgency=low
+
+  * Add time format change event
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-57 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Fri, 17 Jun 2011 14:48:31 +0900
+
+app-core (1.1-56) unstable; urgency=low
+
+  * Modify setlocale call in _set_i18n
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-56 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Mon, 06 Jun 2011 15:23:05 +0900
+
+app-core (1.1-55) unstable; urgency=low
+
+  * Add region format change event
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-55 
+
+ -- Jaeho Lee <jaeho81.lee@samsung.com>  Fri, 03 Jun 2011 10:52:16 +0900
+
+app-core (1.1-54) unstable; urgency=low
+
+  * Modify appcore-gtk build error 
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-54
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Thu, 28 Apr 2011 20:54:25 +0900
+
+app-core (1.1-53) unstable; urgency=low
+
+  * Modify gtk-template
+  * Deleting ecore event handlers before elm_shutdown 
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-53
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Thu, 28 Apr 2011 14:17:37 +0900
+
+app-core (1.1-52) unstable; urgency=low
+
+  * Modify app-template - remove deb. from pkgname
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-52
+
+ -- Noha Park <noha.park@samsung.com>  Thu, 21 Apr 2011 10:38:16 +0900
+
+app-core (1.1-51) unstable; urgency=low
+
+  * Modify app-template - remove deb. from pkgname
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-51
+
+ -- Noha Park <noha.park@samsung.com>  Thu, 21 Apr 2011 09:15:02 +0900
+
+app-core (1.1-50) unstable; urgency=low
+
+  * Modify app-template for sb2
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-50
+
+ -- Noha Park <noha.park@samsung.com>  Tue, 05 Apr 2011 14:29:12 +0900
+
+app-core (1.1-49) unstable; urgency=low
+
+  * Modify app-template for sb2
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-49
+
+ -- Noha Park <noha.park@samsung.com>  Tue, 05 Apr 2011 12:09:20 +0900
+
+app-core (1.1-48) unstable; urgency=low
+
+  * Disable forcefully setting window focus
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-48
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Tue, 08 Mar 2011 08:37:58 +0900
+
+app-core (1.1-47) unstable; urgency=low
+
+  * disable stack_trim
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-47
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Fri, 04 Mar 2011 00:21:57 +0900
+
+app-core (1.1-46) unstable; urgency=low
+
+  * changelog update
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-46 
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Thu, 03 Mar 2011 22:39:15 +0900
+
+app-core (1.1-45) unstable; urgency=low
+
+  * Add appcore_flush_memory() - request from Memory TF
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-45 
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Thu, 03 Mar 2011 16:12:27 +0900
+
+app-core (1.1-44) unstable; urgency=low
+
+  * Fix tut-tut message
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-44
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Mon, 21 Feb 2011 16:09:24 +0900
+
+app-core (1.1-43) unstable; urgency=low
+
+  * Enable elm_flush_all
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-43 
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Mon, 14 Feb 2011 10:51:52 +0900
+
+app-core (1.1-42) unstable; urgency=low
+
+  * Rollback elm_flush_all temporarily for MWC
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-42
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Tue, 08 Feb 2011 09:58:20 +0900
+
+app-core (1.1-41) unstable; urgency=low
+
+  * Enable elm_flush_all
+  * Remove deprecated PM-related APIs
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-41
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Mon, 07 Feb 2011 14:13:48 +0900
+
+app-core (1.1-40) unstable; urgency=low
+
+  * Modify default action for low battery
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-40
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Wed, 26 Jan 2011 08:16:17 +0900
+
+app-core (1.1-39) unstable; urgency=low
+
+  * Modify app template
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-39
+
+ -- Noha Park <noha.park@samsung.com>  Mon, 24 Jan 2011 11:29:24 +0900
+
+app-core (1.1-38) unstable; urgency=low
+
+  * Modify app template
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-38
+
+ -- Noha Park <noha.park@samsung.com>  Mon, 24 Jan 2011 11:16:09 +0900
+
+app-core (1.1-37) unstable; urgency=low
+
+  * Modify app template
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-37
+
+ -- Noha Park <noha.park@samsung.com>  Mon, 24 Jan 2011 11:03:17 +0900
+
+app-core (1.1-36) unstable; urgency=low
+
+  * Modify app template
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-36
+
+ -- Noha Park <noha.park@samsung.com>  Wed, 19 Jan 2011 10:45:13 +0900
+
+app-core (1.1-35) unstable; urgency=low
+
+  * Modify app template
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-35
+
+ -- Noha Park <noha.park@samsung.com>  Mon, 17 Jan 2011 08:33:26 +0900
+
+app-core (1.1-34) unstable; urgency=low
+
+  * Modify measure time and tc
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-34
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Fri, 07 Jan 2011 20:23:51 +0900
+
+app-core (1.1-33) unstable; urgency=low
+
+  * Modify log typo: request from Jayoun Lee <airjany@samsung.com>
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core
+  * Tag: app-core_1.1-33
+
+ -- Yoonkyong Lee <yk6629.lee@samsung.com>  Thu, 06 Jan 2011 19:13:21 +0900
+
+app-core (1.1-32) unstable; urgency=low
+
+  * Modify history information
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core 
+  * Tag: app-core_1.1-32
+
+ -- Noha Park <noha.park@samsung.com>  Thu, 16 Dec 2010 11:01:03 +0900
+
+app-core (1.1-31) unstable; urgency=low
+
+  * Remove vconf set for security
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core 
+  * Tag: app-core_1.1-31
+
+ -- Noha Park <noha.park@samsung.com>  Mon, 13 Dec 2010 12:27:29 +0900
+
+app-core (1.1-30) unstable; urgency=low
+
+  * Remove vconf set for security
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core 
+  * Tag: app-core_1.1-30
+
+ -- Noha Park <noha.park@samsung.com>  Mon, 13 Dec 2010 11:37:06 +0900
+
+app-core (1.1-29) unstable; urgency=low
+
+  * add time log: from Jayoun Lee <airjany@samasung.com>
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core 
+  * Tag: app-core_1.1-29
+
+ -- Youmin Ha <youmin.ha@samsung.com>  Sat, 11 Dec 2010 16:56:33 +0900
+
+app-core (1.1-28) unstable; urgency=low
+
+  * Modify Low battery level
+  * Git: slp-source.sec.samsung.net:slp/pkgs/a/app-core 
+  * Tag: app-core_1.1-28
+
+ -- Noha Park <noha.park@samsung.com>  Thu, 09 Dec 2010 12:01:44 +0900
+
+app-core (1.1-27) unstable; urgency=low
+
+  * Modify template generation code
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-27
+
+ -- Noha Park <noha.park@samsung.com>  Fri, 03 Dec 2010 17:28:48 +0900
+
+app-core (1.1-26) unstable; urgency=low
+
+  * Remove sysman internal dev dependency
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-26
+
+ -- Noha Park <noha.park@samsung.com>  Wed, 01 Dec 2010 13:23:13 +0900
+
+app-core (1.1-25) unstable; urgency=low
+
+  * Remove sysman internal dev dependency
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-25
+
+ -- Noha Park <noha.park@samsung.com>  Wed, 01 Dec 2010 10:28:00 +0900
+
+app-core (1.1-24) unstable; urgency=low
+
+  * Modify Doxyzen
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-24
+
+ -- Noha Park <noha.park@samsung.com>  Tue, 16 Nov 2010 15:40:30 +0900
+
+app-core (1.1-23) unstable; urgency=low
+
+  * add stk_watch_property_notify_for_root API
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-23
+
+ -- Noha Park <noha.park@samsung.com>  Fri, 12 Nov 2010 10:13:37 +0900
+
+app-core (1.1-22) unstable; urgency=low
+
+  * update_rua
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-22
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Mon, 25 Oct 2010 11:10:11 +0900
+
+app-core (1.1-21) unstable; urgency=low
+
+  * add VERSION property and set major to SOVERSION
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-21
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Tue, 19 Oct 2010 18:39:47 +0900
+
+app-core (1.1-20) unstable; urgency=low
+
+  * change debug messages
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-20
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Thu, 14 Oct 2010 16:00:14 +0900
+
+app-core (1.1-19) unstable; urgency=low
+
+  * bug fix: get pid from client message
+  * add STK ISE init
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-19
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Wed, 13 Oct 2010 15:38:18 +0900
+
+app-core (1.1-18) unstable; urgency=low
+
+  * bug fix: GTK build script
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-18
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Thu, 07 Oct 2010 14:15:01 +0900
+
+app-core (1.1-17) unstable; urgency=low
+
+  * add sysman foreground/background API
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-17
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Wed, 06 Oct 2010 16:10:37 +0900
+
+app-core (1.1-16) unstable; urgency=low
+
+  * add GLES template
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-16
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Tue, 05 Oct 2010 17:18:58 +0900
+
+app-core (1.1-15) unstable; urgency=low
+
+  * update PG and doxygen
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-15
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Fri, 01 Oct 2010 14:24:52 +0900
+
+app-core (1.1-14) unstable; urgency=low
+
+  * add rotation lock
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-14
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Tue, 28 Sep 2010 19:19:52 +0900
+
+app-core (1.1-13) unstable; urgency=low
+
+  * add quickpanel state
+  * check aul API return value
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-13
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Mon, 20 Sep 2010 13:07:17 +0900
+
+app-core (1.1-12) unstable; urgency=low
+
+  * EFL upgrade
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-12
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Fri, 10 Sep 2010 20:56:34 +0900
+
+app-core (1.1-11) unstable; urgency=low
+
+  * print launch time which is from aul to first idle
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-11
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Tue, 07 Sep 2010 11:19:57 +0900
+
+app-core (1.1-10) unstable; urgency=low
+
+  * check a value when Battery low vconf changed
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-10
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Fri, 27 Aug 2010 16:52:59 +0900
+
+app-core (1.1-9) unstable; urgency=low
+
+  * add Programming Guide
+  * code cleanup
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-9
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Fri, 27 Aug 2010 15:34:13 +0900
+
+app-core (1.1-8) unstable; urgency=low
+
+  * use dlog
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-8
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Mon, 23 Aug 2010 14:05:29 +0900
+
+app-core (1.1-7) unstable; urgency=low
+
+  * increase version for upload
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-7
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Fri, 20 Aug 2010 20:28:06 +0900
+
+app-core (1.1-6) unstable; urgency=low
+
+  * add measure time example to the header file and template code
+  * change Raise window API: XRaiseWindow() -> XMapRaised() for raising hided
+    window
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-6
+
+ -- Suchang Woo <suchang.woo@samsung.com>  Fri, 20 Aug 2010 14:13:19 +0900
+
+app-core (1.1-5) unstable; urgency=low
+
+  * print error messages
+  * set START TIME to environment variable
+  * bug fix - if appcore_i18n_set failed, i18n_init did not work 
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-5
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Fri, 20 Aug 2010 11:01:11 +0900
+
+app-core (1.1-4) unstable; urgency=low
+
+  * gtk template has been updated
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-4
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Thu, 19 Aug 2010 09:18:43 +0900
+
+app-core (1.1-3) unstable; urgency=low
+
+  * bug fix - appcore_i18n_set did not work
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-3
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Mon, 16 Aug 2010 13:09:49 +0900
+
+app-core (1.1-2) unstable; urgency=low
+
+  * app history update routine added
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-2
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Tue, 10 Aug 2010 11:07:54 +0900
+
+app-core (1.1-1) unstable; urgency=low
+
+  * Bug fixed - PAUSE/RESUME state handling
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-1
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Fri, 06 Aug 2010 20:49:03 +0900
+
+app-core (1.1-0) unstable; urgency=low
+
+  * Re-design: change API, implementation, etc...
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.1-0
+
+ -- Wonguk Jeong <wonguk.jeong@samsung.com>  Sat, 31 Jul 2010 11:22:38 +0900
+
+app-core (1.0-19) unstable; urgency=low
+
+  * Modify header file
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.0-19
+
+ -- Sangjung Woo <sangjung.woo@samsung.com>  Fri, 16 Jul 2010 14:04:14 +0900
+
+app-core (1.0-18) unstable; urgency=low
+
+  * Modify header file for documentation
+  * Git: 165.213.180.234:/git/slp/pkgs/app-core
+  * Tag: app-core_1.0-18
+
+ -- Sangjung Woo <sangjung.woo@samsung.com>  Fri, 16 Jul 2010 10:04:14 +0900
+
+app-core (1.0-17) unstable; urgency=low
+
+  * Change maintainers
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-17
+
+ -- Youmin Ha <youmin.ha@samsung.com>  Thu, 08 Jul 2010 16:04:14 +0900
+
+app-core (1.0-16) unstable; urgency=low
+
+  * remove dlog-module-name.h and dlog.h
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-16
+
+ -- Hojun lee <rcn95@samsung.com>  Mon, 14 Jun 2010 21:32:33 -0700
+
+app-core (1.0-15) unstable; urgency=low
+
+  * bug fix that APPCORE_EVENT_TERMINATE happpens twice
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-15
+
+ -- Hojun lee <rcn95@samsung.com>  Fri, 11 Jun 2010 20:11:27 +0900
+
+app-core (1.0-14) unstable; urgency=low
+
+  * Remove utilx_raise_window and utilx dependancy
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-14
+
+ -- Sangjung Woo <sangjung.woo@samsung.com>  Fri, 11 Jun 2010 10:07:10 +0900
+
+app-core (1.0-13) unstable; urgency=low
+
+  * Remove utilx_raise_window and utilx dependancy
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-13
+
+ -- Hojun lee <rcn95@samsung.com>  Thu, 10 Jun 2010 20:07:10 +0900
+
+app-core (1.0-12) unstable; urgency=low
+
+  * bug fix for heynoti_get_pnoti_name and snoti_name API
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-12
+
+ -- Hojun lee <rcn95@samsung.com>  Wed, 09 Jun 2010 03:38:22 -0700
+
+app-core (1.0-11) unstable; urgency=low
+
+  * Remove  return_result aul
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-11
+
+ -- Hojun lee <rcn95@samsung.com>  Mon, 07 Jun 2010 05:15:25 -0700
+
+app-core (1.0-10) unstable; urgency=low
+
+  * Remove free(t->name) for fixing bugs
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-10
+
+ -- Hojun lee <rcn95@samsung.com>  Sat, 05 Jun 2010 15:17:44 +0000
+
+app-core (1.0-9) unstable; urgency=low
+
+  * add XB-Generate-Docs flag to control file
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-9
+
+ -- Hojun lee <rcn95@samsung.com>  Fri, 04 Jun 2010 21:31:49 -0700
+
+app-core (1.0-8) unstable; urgency=low
+
+  * modify pc file
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-8
+
+ -- Hojun lee <rcn95@samsung.com>  Fri, 04 Jun 2010 11:29:23 +0900
+
+app-core (1.0-7) unstable; urgency=low
+
+  * change for appcore-rotation.c (replace by New sensor APIs)
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-7
+
+ -- Yongsul Oh <yongsul96.oh@samsung.com>  Thu, 03 Jun 2010 14:50:56 +0900
+
+app-core (1.0-6) unstable; urgency=low
+
+  * update xxx_snoti_name() and xxxx_snoti_name()
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-6
+
+ -- Hojun Lee  <rcn95@samsung.com>  Mon, 31 May 2010 21:00:25 -0700
+
+app-core (1.0-5) unstable; urgency=low
+
+  * add new APPCORE_EVENT_RESULT_FOR_LAUNCH_SERVICE interface
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-5
+
+ -- Hojun Lee  <rcn95@samsung.com>  Mon, 31 May 2010 07:24:03 -0700
+
+app-core (1.0-4) unstable; urgency=low
+
+  * modify sensor rotation data type and enum value(rotmode_t->appcore_rotmode_t)
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-4
+
+ -- Hojun Lee  <rcn95@samsung.com>  Tue, 25 May 2010 03:37:06 -0700
+
+app-core (1.0-3) unstable; urgency=low
+
+  * modify control file
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-3
+
+ -- Hojun Lee  <rcn95@samsung.com>  Mon, 24 May 2010 19:13:45 +0900
+
+app-core (1.0-2) unstable; urgency=low
+
+  * modify doxygen and change lowmemory and lowbattery event
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-2
+
+ -- Hojun Lee  <rcn95@samsung.com>  Wed, 19 May 2010 18:30:23 -0700
+
+app-core (1.0-1) unstable; urgency=low
+
+  * Initial Release.
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/app-core-0
+  * Tag: app-core_1.0-1
+
+ -- Hojun Lee  <rcn95@samsung.com>  Tue, 18 May 2010 07:13:19 -0700
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..6f8c020
--- /dev/null
@@ -0,0 +1,44 @@
+Source: app-core
+Section: libs
+Priority: extra
+Maintainer: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>, Yoonkyong Lee <yk6629.lee@samsung.com>
+Uploaders: Wonguk Jeong <wonguk.jeong@samsung.com>, Knhoon Baik <knhoon.baik@samsung.com>, Sangjung Woo <sangjung.woo@samsung.com>, Youmin Ha <youmin.ha@samsung.com>, Noha Park <noha.park@samsung.com>
+Build-Depends: debhelper (>= 5), libslp-sensor-dev, libslp-setting-dev, libelm-dev, libaul-1-dev, dlog-dev, libslp-sysman-dev, libglib2.0-dev
+Standards-Version: 3.7.2
+
+Package: libappcore-common-dev
+Section: libs
+Architecture: any
+Depends: libappcore-common-0 (= ${Source-Version}), libslp-sensor-dev, libslp-setting-dev, libaul-1-dev
+XB-Generate-Docs: yes
+Description: Samsung Linux platform common application basic (dev)
+ Samsung Linux platform application basic.
+
+Package: libappcore-common-0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Samsung Linux platform common application basic
+ Samsung Linux platform application basic.
+
+Package: libappcore-efl-dev
+Section: libs
+Architecture: any
+Depends: libappcore-common-0 (= ${Source-Version}), libappcore-common-dev, libelm-dev, libappcore-efl-0
+XB-Generate-Docs: yes
+Description: Samsung Linux platform efl application basic (dev)
+ Samsung Linux platform application basic.
+
+Package: libappcore-efl-0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Samsung Linux platform efl application basic
+ Samsung Linux platform application basic.
+
+Package: libappcore-dbg
+Section: debug
+Architecture: any
+Depends: ${misc:Depends}, libappcore-common-0 (= ${Source-Version}), libappcore-efl-0 (= ${Source-Version})
+Description: Samsung Linux platform application basic (unstripped)
+ Samsung Linux platform application basic.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/debian/docs b/debian/docs
new file mode 100644 (file)
index 0000000..a0f0008
--- /dev/null
@@ -0,0 +1 @@
+CMakeLists.txt
diff --git a/debian/libappcore-common-0.install.in b/debian/libappcore-common-0.install.in
new file mode 100644 (file)
index 0000000..d39d2b6
--- /dev/null
@@ -0,0 +1 @@
+@PREFIX@/lib/libappcore-common.so*
diff --git a/debian/libappcore-common-dev.install.in b/debian/libappcore-common-dev.install.in
new file mode 100644 (file)
index 0000000..d3270ad
--- /dev/null
@@ -0,0 +1,3 @@
+@PREFIX@/include/appcore/appcore-common.h
+@PREFIX@/lib/pkgconfig/appcore-common.pc
+@PREFIX@/include/SLP_Appcore_PG.h
diff --git a/debian/libappcore-efl-0.install.in b/debian/libappcore-efl-0.install.in
new file mode 100644 (file)
index 0000000..41d479d
--- /dev/null
@@ -0,0 +1 @@
+@PREFIX@/lib/libappcore-efl.so*
diff --git a/debian/libappcore-efl-dev.install.in b/debian/libappcore-efl-dev.install.in
new file mode 100644 (file)
index 0000000..69bffd7
--- /dev/null
@@ -0,0 +1,2 @@
+@PREFIX@/include/appcore/appcore-efl.h
+@PREFIX@/lib/pkgconfig/appcore-efl.pc
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..82be125
--- /dev/null
@@ -0,0 +1,115 @@
+#!/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
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \
+       CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+
+       #docbook-to-man debian/wavplayer.sgml > wavplayer.1
+
+       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 build-stamp configure-stamp
+
+       rm -rf $(CMAKE_BUILD_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/wavplayer.
+       cd $(CMAKE_BUILD_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 --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=libappcore-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 configure
diff --git a/include/SLP_Appcore_PG.h b/include/SLP_Appcore_PG.h
new file mode 100755 (executable)
index 0000000..df4823a
--- /dev/null
@@ -0,0 +1,557 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 SLP_PG_APPCORE Application Model and Appcore
+ @{
+
+<h1 class="pg">Introduction</h1>
+
+<h2 class="pg">Purpose of this document</h2>
+ This document demonstrates the basic steps needed to develop application(EFL or GTK) using appcore module in the SLP(Samsung Linux Platform). The document provides a brief introduction to the appcore architecture and explains application life-cycle of appcore. Programmers should develop their applications(EFL or GTK) based on the appcore module. The sample applications can be studied and can be used to develop other applications.
+
+<h2 class="pg">Features</h2>
+- Support EFL and GTK(including STK) application's basic function
+- Support internalization
+- Support rotation function
+- Support power state function
+
+
+
+<h1 class="pg">Components of Appcore</h3>
+@image html SLP_Appcore_PG_overview.png
+
+- Appcore EFL(libappcore-efl.so)
+  - It provides appcore_efl_main() which includes elm_init(), elm_run(), and other initializations for EFL application
+  - Refer to appcore-efl.h
+- Appcore common(libappcore-common.so)
+  - It provides useful rotation function to control sensor’s rotation operation in application
+  - It provides useful function to process internalization based on GNU gettext
+  - It provides useful function to control power-state in application
+  - Refer to appcore-common.h
+- Libraries used by Appcore
+  - EFL and GTK(STK) is a graphic widget library
+  - Sensor for supporting rotation
+  - AUL for application's life-cycle
+  - RUA for task manager
+  - Vconf for system events (such as low battery, low memory).
+@}
+ @defgroup SLP_PG_APPCORE1 1.Application's life-cycle
+ @ingroup SLP_PG_APPCORE
+ @{
+
+<h1 class="pg">Application's life-cycle</h2>
+Appcore provides basic life-cycle like the following to manage application in SLP
+<table>
+  <tr>
+    <td> @image html SLP_Appcore_PG_lifecycle.png </td>
+    <td>
+      <table>
+        <tr>
+         <th>Operation</th>
+         <th>Description</th>
+       </tr>
+       <tr>
+         <td>CREATE</td>
+         <td>Called once before the main loop. Initialize the application such as window creation, data structure allocation, and etc.</td>
+       </tr>
+       <tr>
+         <td>RESET</td>
+         <td>Called at the first idler and every "relaunch" message. Reset the application states and data structures.</td>
+       </tr>
+       <tr>
+         <td>PAUSE</td>
+         <td>Called when the entire window in this application are invisible. Recommend to suspend the actions related to the visibility.</td>
+       </tr>
+       <tr>
+         <td>RESUME</td>
+         <td>Called when one of the windows in this application is visible. Resume the paused actions.</td>
+       </tr>
+       <tr>
+         <td>TERMINATE</td>
+         <td>Called once after the main loop. Release the resources.</td>
+       </tr>
+      </table> 
+    </td>
+  </tr>
+</table>
+Call the main function (appcore_efl_main() with struct appcore_ops filled with the proper function pointers. The functions are called by Appcore at the proper situation.
+@code
+struct appcore_ops {
+        void *data; // Callback data
+        int (*create)(void *); // Called before main loop 
+        int (*terminate)(void *); // Called after main loop 
+        int (*pause)(void *); // Called when every window goes back
+        int (*resume)(void *); // Called when any window comes on top
+        int (*reset)(bundle *, void *); // Called at the first idler and every relaunching
+};
+@endcode
+
+@}
+ @defgroup SLP_PG_APPCORE2 2.Appcore event handling
+ @ingroup SLP_PG_APPCORE
+ @{
+
+<h1 class="pg">Appcore event handling</h2>
+An Application should perform an action when a system change occurs, such as the battery level goes low. Appcore provides APIs to handle the system changes notified by other frameworks and managers. The following figure shows the relationship between events and callback functions.
+
+@image html SLP_Appcore_PG_events.png 
+
+Appcore provides appcore_set_event_callback() to handle events from the system. If you set the callback function, it will be called when the event received. Otherwise, Appcore does default behavior which is defined as following.
+<table>
+  <tr>
+    <th>Event</th>
+    <th>Description</th>
+    <th>Default behavior</th>
+  </tr>
+  <tr>
+    <td>APPCORE_EVENT_LOW_MEMORY</td>
+    <td>A system memory goes low</td>
+    <td>call malloc_trim() to enforce giving back the freed memory</td>
+  </tr>
+  <tr>
+    <td>APPCORE_EVENT_LOW_BATTERY</td>
+    <td>A system is out of battery</td>
+    <td>Quit the main loop</td>
+  </tr>
+  <tr>
+    <td>APPCORE_EVENT_LANG_CHANGE</td>
+    <td>A system's language setting is changed</td>
+    <td>Reset the environment variable "LANG". This has influence on the function related to internationalization</td>
+  </tr>
+</table>
+
+
+@}
+ @defgroup SLP_PG_APPCORE3 3.Internationalization
+ @ingroup SLP_PG_APPCORE
+ @{
+
+<h1 class="pg">Internationalization</h3>
+SLP platform uses GNU gettext for Internationalization.
+The process of using gettext is as follows:
+-# Marking any phrases to be translated using gettext(“phrase”) or gettext_noop(“phrase”)
+-# Generating a <I>po</I> file by extracting marked phrases using a <I>xgettext</I> command.
+-# Modifying the <I>po</I> file and entering a translated phrase for the corresponding phrase.
+-# Compiling a <I>po</I> file into a <I>mo</I>  file using a <I>msgfmt</I> command.
+-# Installing <I>mo</I> files into proper locale directories.
+-# gettext() returns a properly translated phrase while an application is running.
+
+For example, we have the following source code
+@code
+printf(“%s\n”, gettext(“Hello”));
+@endcode
+
+Then, as you can see, we can have the following po file using xgettext,
+@code
+#: hello.c:41
+msgid "Hello"
+msgstr ""
+@endcode
+
+And we can enter a translated phrase as the following,
+@code
+#: hello.c:41
+msgid "Hello"
+msgstr "안녕하세요" // Hello in Korean
+@endcode
+
+Finally we generate and install a mo file. In doing so, an application will print out "안녕하세요" instead of "Hello", if the applied language is Korean.
+
+appcore_set_i18n() has been introduced to achieve an internationalization which requires information on a mo file's name and its installed directory.
+@code
+int appcore_set_i18n(const char *domainname, const char *dirname)
+@endcode
+
+The first parameter, <I>domainname</I>, a mo file’s name and the second one, <I>dirname</I>, is the directory.<br>
+In general, a mo file will be installed in the following fashion, <I>dirname/locale/category/domainname.mo</I>. <I>locale</I> is a locale’s name, such as ‘ko’ and ‘ja’, and category is LC_MESSAGES. For instance, a mo file has been installed in /usr/share/locale/ko/LC_MESSAGES/example.mo, and then <I>dirname</I> becomes /usr/share/locale.<br>
+Typically, mo files will be installed in ${prefix}/share/locale.
+
+Generally the following macros are defined for easy to use gettext()
+@code
+#define _(str) gettext(str)
+#define gettext_noop(str) (str)
+#define N_(str) gettext_noop(str)
+@endcode
+
+N_() macro only extracts any marked phrases using xgettext command, it will not do anything in the action. This macro is used to handle an array of phrases. Since gettext() cannot be called in declaration of an array, we let N_() macro extract phrases and then call gettext(). Let’s look at the following example.
+
+@code
+static const char *messages[] = {
+       N_(“Hello”),
+       N_(“World”)
+};
+…
+printf(“Message: %s\n”, _(messages[0]);
+…
+@endcode
+
+In doing so, we now can handle phrases in an array as same as we do for the following.
+
+@code
+printf(“Message: %s\n”, _(“Hello”);
+@endcode
+
+For more details, refer to GNU gettext manual (http://www.gnu.org/software/gettext/manual/gettext.html)
+
+@}
+ @defgroup SLP_PG_APPCORE4 4.Rotation
+ @ingroup SLP_PG_APPCORE
+ @{
+
+<h1 class="pg">Rotation</h3>
+An Application can display its UI in either landscape or portrait mode. The application registers to receive rotation events from the system with the appcore_set_rotation_cb() API. The system automatically calls the registered user's callback whenever the sensor framework detects that the current rotation status has changed. This continues until appcore_unset_rotation_cb() is called.
+
+@code
+enum appcore_rm {
+        APPCORE_RM_UNKNOWN,
+        APPCORE_RM_PORTRAIT_NORMAL , // Portrait mode
+        APPCORE_RM_PORTRAIT_REVERSE , // Portrait upside down mode 
+        APPCORE_RM_LANDSCAPE_NORMAL , // Left handed landscape mode
+        APPCORE_RM_LANDSCAPE_REVERSE ,  // Right handed landscape mode 
+};
+
+int appcore_set_rotation_cb(int (*cb)(enum appcore_rm, void *), void *data);
+int appcore_unset_rotation_cb(void);
+int appcore_get_rotation_state(enum appcore_rm *curr);
+@endcode
+
+<I>enum appcore_rm</I> has portrait, portrait upside down, left handed landscape, and right handed landscape mode. The following is an each mode.
+@image html SLP_Appcore_PG_rotation.png
+
+When the registered callback is called, it receives the current mode state as the first argument. According to the received mode state, the application should rotate the window, resize window to changed screen size and composite the screen.
+
+@}
+ @defgroup SLP_PG_APPCORE5 5.Using code template
+ @ingroup SLP_PG_APPCORE
+ @{
+
+<h1 class="pg">Using code template</h1>
+We provide a code template for reference and convenience. You can generate a code template using the script "app-gen.sh" which is included in the <I>app-template</I> package.
+
+The usage as follow:
+@code
+# app-gen.sh
+Usage) app-gen.sh dest app_name [EFL|GTK] 
+       app_name does not support _ string because of debian usage."
+
+ex) 
+ EFL application: 
+  # app-gen.sh ~/efl_app MyApp
+
+ GTK application: 
+  # app-gen.sh /home/app/gtk_app TestApp GTK
+
+@endcode
+
+Let's make a simple application using template
+-# Install <I>app-template</I> package
+@code
+# apt-get install app-template
+@endcode
+-# Generate a code template
+@code
+# app-gen.sh ~/apps/simple simple EFL
+@endcode
+-# Build a package
+@code
+# cd ~/apps/simple
+# dpkg-buildpackage -sa -rfakeroot
+@endcode
+@}
+ @defgroup SLP_PG_APPCORE6 6.Example: EFL Apps
+ @ingroup SLP_PG_APPCORE
+ @{
+
+<h1 class="pg">Example: EFL application</h1>
+
+Header example
+@code
+12 #ifndef __APP_COMMON_H__
+13 #define __APP_COMMON_H__
+14 
+15 #include <Elementary.h>
+16 
+17 #if !defined(PACKAGE)
+18 #  define PACKAGE "example"  // for appcore_set_i18n()
+19 #endif
+20 
+21 #if !defined(LOCALEDIR)
+22 #  define LOCALEDIR "/opt/apps/com.slp.example/share/locale" // for appcore_set_i18n()
+23 #endif
+24 
+25 #if !defined(EDJDIR)
+26 #  define EDJDIR "/opt/apps/com.slp.example/share/edje"
+27 #endif
+28 
+29 #define EDJ_FILE EDJDIR "/" PACKAGE ".edj"
+30 #define GRP_MAIN "main"
+31 
+32 struct appdata
+33 {
+34         Evas_Object *win;
+35         Evas_Object *ly_main;
+36 
+37         // add more variables here
+38 };
+39 
+40 #endif // __APP_COMMON_H__ 
+@endcode
+
+Source example
+@code
+12 #include <stdio.h>
+13 #include <appcore-efl.h>
+14 #include <Ecore_X.h>
+15 
+16 #include "example.h"
+17 
+18 struct text_part {   // this for internationalization
+19         char *part;
+20         char *msgid;
+21 };
+22 
+23 static struct text_part main_txt[] = {
+24         { "txt_title", N_("Application template"), },
+25         { "txt_mesg", N_("Click to exit"), },  // N_() is do nothing. Only for extracting the string
+26 };
+27
+28
+29 static void win_del(void *data, Evas_Object *obj, void *event)
+30 {
+31         elm_exit();
+32 }
+33 
+34 static void main_quit_cb(void *data, Evas_Object *obj,
+35                 const char *emission, const char *source)
+36 {
+37         elm_exit();
+38 }
+39 
+40 static void update_ts(Evas_Object *eo, struct text_part *tp, int size)
+41 {
+42         int i;
+43 
+44         if (eo == NULL || tp == NULL || size < 0)
+45                 return;
+46 
+47         for (i = 0; i < size; i++) {
+48                 if (tp[i].part && tp[i].msgid)
+49                         edje_object_part_text_set(eo,
+50                                         tp[i].part, _(tp[i].msgid)); // _() return translated string
+51         }
+52 }
+53 
+54 static int lang_changed(void *data) // language changed callback
+55 {
+56         struct appdata *ad = data;
+57 
+58         if (ad->ly_main == NULL)
+59                 return 0;
+60 
+61         update_ts(elm_layout_edje_get(ad->ly_main), main_txt,
+62                         sizeof(main_txt)/sizeof(main_txt[0]));
+63 
+64         return 0;
+65 }
+66 
+67 static int rotate(enum appcore_rm m, void *data) // rotation callback
+68 {
+69         struct appdata *ad = data;
+70         int r;
+71 
+72         if (ad == NULL || ad->win == NULL)
+73                 return 0;
+74 
+75         switch(m) {
+76         case APPCORE_RM_PORTRAIT_NORMAL:
+77                 r = 0;
+78                 break;
+79         case APPCORE_RM_PORTRAIT_REVERSE:
+80                 r = 180;
+81                 break;
+82         case APPCORE_RM_LANDSCAPE_NORMAL:
+83                 r = 270;
+84                 break;
+85         case APPCORE_RM_LANDSCAPE_REVERSE:
+86                 r = 90;
+87                 break;
+88         default:
+89                 r = -1;
+90                 break;
+91         }
+92 
+93         if (r >= 0) // Using this API, you can implement the rotation mode easily
+94                 elm_win_rotation_with_resize_set(ad->win, r);
+95 
+96         return 0;
+97 }
+98 
+99 static Evas_Object* create_win(const char *name)
+100 {
+101         Evas_Object *eo;
+102         int w, h;
+103 
+104         eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+105         if (eo) {
+106                 elm_win_title_set(eo, name);
+107                 elm_win_borderless_set(eo, EINA_TRUE);
+108                 evas_object_smart_callback_add(eo, "delete,request",
+109                                 win_del, NULL);
+110                 ecore_x_window_size_get(ecore_x_window_root_first_get(), // get root window(screen) size
+111                                 &w, &h);
+112                 evas_object_resize(eo, w, h);
+113         }
+114 
+115         return eo;
+116 }
+117 
+118 static Evas_Object* load_edj(Evas_Object *parent, const char *file,
+119                 const char *group)
+120 {
+121         Evas_Object *eo;
+122         int r;
+123 
+124         eo = elm_layout_add(parent);
+125         if (eo) {
+126                 r = elm_layout_file_set(eo, file, group);
+127                 if (!r) {
+128                         evas_object_del(eo);
+129                         return NULL;
+130                 }
+131 
+132                 evas_object_size_hint_weight_set(eo,
+133                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+134         }
+135 
+136         return eo;
+137 }
+138 
+139 static int app_create(void *data)
+140 {
+141         struct appdata *ad = data;
+142         Evas_Object *win;
+143         Evas_Object *ly;
+144         int r;
+145 
+146         // create window 
+147         win = create_win(PACKAGE);
+148         if (win == NULL)
+149                 return -1;
+150         ad->win = win;
+151 
+152         // load edje 
+153         ly = load_edj(win, EDJ_FILE, GRP_MAIN);
+154         if (ly == NULL)
+155                 return -1;
+156         elm_win_resize_object_add(win, ly); // This can make the EDJE object fitted in window size
+157         edje_object_signal_callback_add(elm_layout_edje_get(ly),
+158                         "EXIT", "*", main_quit_cb, NULL);
+159         ad->ly_main = ly;
+160         evas_object_show(ly);
+161 
+166         lang_changed(ad); // call the language changed callback to update strings
+167 
+168         evas_object_show(win);
+169 
+170         // add system event callback 
+171         appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE,
+172                         lang_changed, ad);
+173 
+174         appcore_set_rotation_cb(rotate, ad); // set rotation callback
+175 
+176         // appcore measure time example 
+177         printf("from AUL to %s(): %d msec\n", __func__,
+178                         appcore_measure_time_from("APP_START_TIME"));
+179 
+180         appcore_measure_start();
+181         return 0;
+182 }
+183 
+184 static int app_terminate(void *data) // terminate callback
+185 {
+186         struct appdata *ad = data;
+187 
+188         if (ad->ly_main)
+189                 evas_object_del(ad->ly_main);
+190 
+191         if (ad->win)
+192                 evas_object_del(ad->win);
+193 
+194         return 0;
+195 }
+196 
+197 static int app_pause(void *data) // pause callback
+198 {
+199         struct appdata *ad = data;
+200 
+201         return 0;
+202 }
+203 
+204 static int app_resume(void *data) // resume callback
+205 {
+206         struct appdata *ad = data;
+207 
+208         return 0;
+209 }
+210 
+211 static int app_reset(bundle *b, void *data) // reset callback
+212 {
+213         struct appdata *ad = data;
+214 
+215         // appcore measure time example 
+216         printf("from AUL to %s(): %d msec\n", __func__,
+217                         appcore_measure_time_from("APP_START_TIME"));
+218         printf("from create to %s(): %d msec\n", __func__,
+219                         appcore_measure_time());
+220 
+221         if (ad->win)
+222                 elm_win_activate(ad->win); // You should make one of the window on top
+223 
+224         return 0;
+225 }
+226 
+227 int main(int argc, char *argv[])
+228 {
+229         struct appdata ad;
+230         struct appcore_ops ops = {  // fill the appcore_ops with callback functions
+231                 .create = app_create,
+232                 .terminate = app_terminate,
+233                 .pause = app_pause,
+234                 .resume = app_resume,
+235                 .reset = app_reset,
+236         };
+237 
+238         // appcore measure time example 
+239         printf("from AUL to %s(): %d msec\n", __func__,
+240                         appcore_measure_time_from("APP_START_TIME"));
+241 
+242         memset(&ad, 0x0, sizeof(struct appdata));
+243         ops.data = &ad;
+244 
+245         return appcore_efl_main(PACKAGE, &argc, &argv, &ops); // start mainloop
+246 }
+@endcode
+
+ @}
+**/
diff --git a/include/appcore-common.h b/include/appcore-common.h
new file mode 100755 (executable)
index 0000000..8559511
--- /dev/null
@@ -0,0 +1,721 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 __APPCORE_COMMON_H__
+#define __APPCORE_COMMON_H__
+
+/**
+ * @file    appcore-common.h
+ * @version 1.1
+ * @brief   This file contains APIs of the Appcore library
+ */
+
+/**
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup Appcore Appcore
+ * @version  1.1
+ * @brief    A base library for application
+ *
+ */
+
+/**
+ * @addtogroup Appcore
+ * @{
+ */
+
+#include <libintl.h>
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _
+#define _(str) gettext(str)  /**< gettext alias */
+#endif
+#define gettext_noop(str) (str)        /**< keyword for xgettext
+                                 to extract translatable strings */
+#define N_(str) gettext_noop(str)  /**< gettext_noop alias */
+
+/**
+ * System global events related to the application
+ * @see appcore_set_event_callback()
+ */
+enum appcore_event {
+       APPCORE_EVENT_UNKNOWN,
+                      /**< Unknown event */
+       APPCORE_EVENT_LOW_MEMORY,
+                         /**< Low memory */
+       APPCORE_EVENT_LOW_BATTERY,
+                          /**< Low battery */
+       APPCORE_EVENT_LANG_CHANGE,
+                          /**< Language setting is changed */
+       APPCORE_EVENT_REGION_CHANGE,
+                            /**< Region setting is changed */
+};
+
+/**
+ * Rotaion modes
+ * @see appcore_set_rotation_cb(), appcore_get_rotation_state()
+ */
+enum appcore_rm {
+       APPCORE_RM_UNKNOWN,
+                   /**< Unknown mode */
+       APPCORE_RM_PORTRAIT_NORMAL,
+                            /**< Portrait mode */
+       APPCORE_RM_PORTRAIT_REVERSE,
+                             /**< Portrait upside down mode */
+       APPCORE_RM_LANDSCAPE_NORMAL,
+                             /**< Left handed landscape mode */
+       APPCORE_RM_LANDSCAPE_REVERSE,
+                               /**< Right handed landscape mode */
+};
+
+/**
+ * Time format
+ * @see appcore_get_timeformat()
+ */
+enum appcore_time_format {
+       APPCORE_TIME_FORMAT_UNKNOWN,
+       APPCORE_TIME_FORMAT_12,
+       APPCORE_TIME_FORMAT_24,
+};
+
+/**
+ * Appcore operations which are called during the application life-cycle
+ * @see appcore_efl_main()
+ */
+struct appcore_ops {
+       void *data;
+           /**< Callback data */
+       int (*create) (void *);
+                      /**< Called before main loop \n
+                       If this returns non-zero, Appcore does not run the main loop. */
+       int (*terminate) (void *);
+                         /**< Called after main loop */
+       int (*pause) (void *);
+                     /**< Called when every window goes back */
+       int (*resume) (void *);
+                      /**< Called when any window comes on top */
+       int (*reset) (bundle *, void *);
+                               /**< Called at the first idler
+                                 and every relaunching */
+       void *reserved[6];
+                  /**< Reserved */
+       };
+
+/**
+ * @par Description:
+ * Set the callback function which is called when the event occurs.
+ *
+ * @par Purpose:
+ * This function sets a callback function for events from the system.
+ * Callback function is invoked every time the event occurs.
+ *
+ * @par Typical use case:
+ * To do something when predefined events (enum appcore_event) occur, use this API
+ * 
+ * @par Method of function operation:
+ * Using Heynoti subscription, Vconf changed callback, and AUL, Appcore invokes the registered callback function.
+ * 
+ * @par Important notes:
+ * Only one callback function can be set. If <I>cb</I> is NULL, unset the callback function about the event.\n
+ * Default behavior is performed when the specified event callback doesn't have registered.
+ *
+ * @param[in] event System event
+ * @param[in] cb callback function
+ * @param[in] data callback function data
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set) 
+ *
+ * @par Errors:
+ * EINVAL - Invalid event type
+ *
+ * @pre None.
+ * @post Callback is set/unset.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+static int _lang_changed(void *);
+static int _low_battery(void *);
+static int _low_memory(void *);
+static int _region_changed(void *);
+
+int add_callbacks(struct appdata *data)
+{
+       int r;
+
+       r = appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, _lang_changed,
+                                                                        data);
+       if (r == -1) {
+               // add exception handling
+       }
+
+       r = appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, _low_battery,
+                                                                        data);
+       if (r == -1) {
+               // add exception handling
+       }
+
+       r = appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, _low_memory,
+                                                                data);
+       if (r == -1) {
+               // add exception handling
+       }
+
+       r = appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE,
+                                        _region_changed, data);
+       if (r == -1) {
+               // add exception handling
+       }
+
+       return 0;
+}
+ * @endcode
+ *
+ */
+int appcore_set_event_callback(enum appcore_event event,
+               int (*cb)(void *), void *data);
+
+/**
+ * @par Description:
+ * Set a rotation callback
+ *
+ * @par Purpose:
+ * This function sets a callback function for rotation events. Callback function is invoked every time the rotation mode is changed.
+ *
+ * @par Typical use case:
+ * To do something when the rotation mode is changed, use this API
+ * 
+ * @par Method of function operation:
+ * Appcore receives rotation change from Sensor framework. When Appcore receive the change, it invokes the registered callback function.
+ * 
+ * @par Important notes:
+ * Locks the rotation mode, the registered callback is not invoked.
+ *
+ * @param[in] cb callback function
+ * @param[in] data callback function data
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set) 
+ * 
+ * @par Errors:
+ * EINVAL - <I>cb</I> is NULL
+ * EALREADY - rotation callback function already registered
+ *
+ * @pre Callback is not set.
+ * @post None.
+ * @see appcore_unset_rotation_cb(), appcore_get_rotation_state()
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+static int _rot_cb(enum appcore_rm, void *);
+
+...
+{
+       int r;
+
+       r = appcore_set_rotation_cb(_rot_cb, data);
+       if (r == -1) {
+               // add exception handling
+       }
+
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *),
+                           void *data);
+
+/**
+ * @par Description:
+ * Unset a rotation callback
+ *
+ * @par Purpose:
+ * This function unsets a callback function for rotation events.
+ *
+ * @return 0 on success, -1 on error
+ * 
+ * @pre Callback is set by appcore_set_rotation_cb().
+ * @post None.
+ * @see appcore_set_rotation_cb(), appcore_get_rotation_state()
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       int r;
+
+       ...
+
+       r = appcore_unset_rotation_cb();
+       if (r == -1) {
+               // add exception handling
+       }
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_unset_rotation_cb(void);
+
+/**
+ * @par Description:
+ * Get the current rotation mode.
+ *
+ * @par Purpose:
+ * To get the current rotation mode, use this API.
+ *
+ * @par Method of function operation:
+ * This function gets the current rotation mode from Sensor framework.
+ * 
+ * @param[out] curr current rotation mode\n
+ * If Sensor framework is not working, curr is set to APPCORE_RM_UNKNOWN.
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set) 
+ * 
+ * @par Errors:
+ * EINVAL - <I>curr</I> is NULL
+ *
+ * @pre None.
+ * @post None.
+ * @see appcore_set_rotation_cb(), appcore_unset_rotation_cb()
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       int r;
+       enum appcore_rm curr;
+
+       ...
+       
+       r = appcore_get_rotation_state(&curr);
+       if (r == -1) {
+               // add exception handling
+       }
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_get_rotation_state(enum appcore_rm *curr);
+
+/**
+ * @par Description:
+ * Get the current time format.
+ *
+ * @par Purpose:
+ * To get the current time format, use this API.
+ *
+ * @par Method of function operation:
+ * This function gets the current time format from vconf.
+ * 
+ * @param[out] timeformat current time format\n
+ * If vconf is not working, timeformat is set to APPCORE_TIME_FORMAT_UNKNOWN.
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set) 
+ * 
+ * @par Errors:
+ * EINVAL - <I>timeformat</I> is NULL
+ *
+ * @pre None.
+ * @post None.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       int r;
+       enum appcore_time_format timeformat;
+
+       ...
+       
+       r = appcore_get_timeformat(&timeformat);
+       if (r == -1) {
+               // add exception handling
+       }
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_get_timeformat(enum appcore_time_format *timeformat);
+
+/**
+ * @par Description:
+ * Set the information for the internationalization.
+ *
+ * @par Purpose:
+ * This function prepares to internationalize. To use gettext, use this API.
+ *
+ * @par Typical use case:
+ * This function provides convenience for using gettext.
+ * 
+ * @par Method of function operation:
+ * Calls setlocale(), bindtextdomain() and textdomain() internally.
+ * 
+ * @par Corner cases/exceptions:
+ * If <I>dirname</I> is NULL, the previously set base directory is used. Typically, it is /usr/share/locale.
+ *
+ * @param[in] domainname a message domain name(text domain name) \n Must be a non-empty string.
+ * @param[in] dirname the base directory for message catalogs belonging to the specified domain \n 
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set) 
+ * 
+ * @par Errors:
+ * EINVAL - <I>domain</I> is NULL
+ *
+ * @pre None.
+ * @post The environment variable LANG is set or changed.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       int r;
+
+       ...
+
+       r = appcore_set_i18n("i18n_example", NULL);
+       if (r == -1) {
+               // add exception handling       
+       }
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_set_i18n(const char *domainname, const char *dirname);
+
+/**
+ * @par Description:
+ * Set the measuring start time 
+ *
+ * @par Purpose:
+ * To measure the time, the start time should be set. This function set the start point.
+ *
+ * @par Typical use case:
+ * It is used to measure the time for doing something. \n
+ * This function set the start point. And, appcore_measure_time() returns 
+ * the elapsed time from the start point.
+ *
+ * @see appcore_measure_time()
+ * 
+ * @par Method of function operation:
+ * Store the current time to the internal variable.
+ *
+ * @pre None.
+ * @post Current time is saved to the internal space.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       ...
+       appcore_measure_start();
+
+       // do something
+
+       printf("it takes %d msec to do something\n", appcore_measure_time());
+       ...
+}
+ * @endcode
+ *
+ */
+void appcore_measure_start(void);
+
+/**
+ * @par Description:
+ * Measure the time from appcore_measure_start()
+ *
+ * @par Purpose:
+ * To measure the elapsed time from the start point.
+ *
+ * @par Typical use case:
+ * It is used to measure the time for doing something. \n
+ * This function returns the elapsed time from the start point set by appcore_measure_start().
+ *
+ * @see appcore_measure_start()
+ * 
+ * @par Method of function operation:
+ * This function subtracts the current time from the start point.
+ *
+ * @par Corner cases/exceptions:
+ * If the start point is not set, returns 0.
+ *
+ * @return Milliseconds from appcore_measure_start()
+ *
+ * @pre None.
+ * @post None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       ...
+       appcore_measure_start();
+
+       // do something
+
+       printf("it takes %d msec to do something\n", appcore_measure_time());
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_measure_time(void);
+
+/**
+ * @par Description:
+ * Measure the time from a time specified in environment variable.
+ *
+ * @par Purpose:
+ * To measure the elapsed time from a time specified in environment variable.
+ *
+ * @par Typical use case:
+ * It is used to measure the time from a time set by external.
+ * This function returns the elapsed time from a time specified in environment variable.
+ *
+ * @see appcore_measure_start()
+ * 
+ * @par Method of function operation:
+ * This function subtracts the current time from a time specified in environment variable.
+ *
+ * @par Corner cases/exceptions:
+ * If <I>envnm</I> is NULL, "APP_START_TIME" set by launcher is used.
+ * If the environment variable is not set or invalid format, returns 0.
+ *
+ * @param[in] envnm environment variable name which has 
+ *  the start time (format: "%u %u", seconds, micro seconds)
+ *
+ * @return Milliseconds from a time specified in environment variable
+ *
+ * @pre None.
+ * @post None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       ...
+
+       // do something 
+
+       printf("it takes %d msec from APP_START\n", 
+               appcore_measure_time_from("APP_START_TIME"));
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_measure_time_from(const char *envnm);
+
+/**
+ * Appcore UI operaions. Internal use only.
+ */
+struct ui_ops;
+
+/**
+ * @par Description:
+ * Appcore init. Internal use only
+ * 
+ * @par Important notes:
+ * Except special case, NEVER use this. Use the appcore EFL or GTK instead of this.
+ *
+ * @param[in] name Application name used for text domain name
+ * @param[in] ops UI operations
+ * @param[in] argc a count of the arguments
+ * @param[in] argv an array of pointers to the strings which are those arguments
+ *
+ * @return 0 on succes, -1 on error (<I>errno</I> set)
+ *
+ * @par Errors:
+ * EINVAL - <I>ops</I> or <I>ops</I>'s callback is NULL \n
+ * EALREADY - Appcore already in operation \n
+ *
+ * @pre None.
+ * @post None.
+ * @see appcore_exit()
+ * @remarks Internal use only.
+ *
+ */
+int appcore_init(const char *name, const struct ui_ops *ops,
+                int argc, char **argv);
+
+/**
+ * @par Description:
+ * Appcore exit. Internal use only.
+ * 
+ * @par Important notes:
+ * Except special case, NEVER use this.
+ *
+ * @pre None.
+ * @post None.
+ * @see appcore_init()
+ * @remarks Internal use only.
+ *
+ */
+void appcore_exit(void);
+
+
+/**
+ * @par Description:
+ * Utility function for memory flushing
+ *
+ * @par Purpose:
+ * To flush memory
+ *
+ * @par Method of function operation:
+ * Calls application-specific memory flushing tool (e.g., elm_flush_all() for EFL),
+ * sqlite3_release_memory() if sqlite3 is used, and malloc_trim(). Also, trims native stack.
+ *
+ * @par Important notes:
+ * Currently, this function is automatically called in the following 2 cases:\n 
+ * (1) when the application enters into the pause state and\n
+ * (2) when low memory event is invoked and the application is on pause.\n 
+ * Developers can use this function when they want extra memory flush utility.
+ *
+ * @return 0 on success, -1 on error
+ *
+ * @pre Appcore is already initialized.
+ * @post Memory for the application is flushed.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+{
+       int r;
+
+       ...
+       r = appcore_flush_memory();
+       if (r == -1) {
+               // add exception handling
+       }
+
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_flush_memory(void);
+
+/**
+ * @par Description:
+ * Set a open callback
+ * Only when application is running, if aul_open api is called, then this callback function is called. 
+ * If your open_cb function return -1, then appcore doesn't raise window. 
+ *
+ * @param[in] cb callback function
+ * @param[in] data callback function data
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
+ *
+ * @pre None
+ * @post None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-common.h>
+
+...
+
+static int _open_cb(enum appcore_rm, void *);
+
+...
+{
+       int r;
+
+       r = appcore_set_open_cb(_open_cb, data);
+       if (r == -1) {
+               // add exception handling
+       }
+
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_set_open_cb(int (*cb) (void *), void *data);
+
+char *appcore_get_caller_appid(void);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+/**
+ * @}
+ */
+#endif                         /* __APPCORE_COMMON_H__ */
diff --git a/include/appcore-efl.h b/include/appcore-efl.h
new file mode 100755 (executable)
index 0000000..794734a
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 __APPCORE_ELF_H__
+#define __APPCORE_ELF_H__
+
+/**
+ * @file    appcore-efl.h
+ * @version 1.1
+ * @brief   This file contains APIs of the Appcore EFL library
+ */
+
+/**
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup Appcore_EFL Appcore EFL
+ * @version  1.1
+ * @brief    A base library for EFL application based on Appcore
+ *
+ */
+
+/**
+ * @addtogroup Appcore_EFL
+ * @{
+ */
+
+#include <stdbool.h>
+#include <appcore-common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @par Description:
+ * This is a main function for EFL application on SLP platform. \n
+ * Refer to programming guide for the details.
+ *
+ * @par Purpose:
+ * To develop an application using EFL on this platform.
+ *
+ * @par Method of function operation:
+ * Initialize the EFL, internationalization, and notifications 
+ * for receiving system events such as rotation, low battery, etc.\n
+ * And, start an ecore mainloop.
+ *
+ * @param[in] name Application name
+ * @param[in] argc A count of the arguments
+ * @param[in] argv An array of pointers to the strings which are those arguments
+ * @param[in] ops Appcore operations
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
+ *
+ * @par Errors:
+ * EALREADY - mainloop already started \n
+ * EINVAL - one of parameters is NULL \n
+ * ECANCELED - create() callback returns error (none zero value) \n
+ *
+ * @par Corner cases/exceptions:
+ * If <I>ops</I> has no callback function, this function just starts a mainloop.
+ *
+ * @par Known issues/bugs:
+ * If <I>errno</I> set another value, check the <I>dlog</I> message.
+ * This doesn't care internal <I>errno</I> set.
+ *
+ * @pre None.
+ * @post None.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-efl.h>
+
+static int _create(void *);
+static int _reset(bundle *, void *);
+
+int main(int argc, char *argv[])
+{
+       int r;
+       const char *name;
+       struct appcore_ops ops = {
+               .create = _create,
+               .reset = _reset,
+               ...
+       };
+
+       ...
+
+       r = appcore_efl_main(name, &argc, &argv, &ops);
+       if (r) {
+               // add exception handling
+               perror("Appcore EFL main");
+       }
+}
+ * @endcode
+ *
+ */
+int appcore_efl_main(const char *name, int *argc, char ***argv,
+                    struct appcore_ops *ops);
+
+/**
+ * @par Description:
+ * This API sets system resource reclaiming.
+ *
+ * @par Purpose:
+ * When this is not enabled, the application doesn't reclaim system resource.
+ *
+ * @param[in] enable Application name
+ *
+ * @return 0 on success, -1 on error (<I>errno</I> set)
+ *
+ *
+ * @pre None.
+ * @post None.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appcore-efl.h>
+
+int _create(void *data)
+{
+       int r;
+
+       ...
+       r = appcore_set_system_resource_reclaiming(FALSE);
+       if (r) {
+               // add exception handling
+               perror("appcore_set_system_resource_reclaiming");
+       }
+       ...
+}
+ * @endcode
+ *
+ */
+int appcore_set_system_resource_reclaiming(bool enable);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+ * @}
+ */
+/**
+ * @}
+ */
+#endif                         /* __APPCORE_ELF_H__ */
diff --git a/include/appcore-internal.h b/include/appcore-internal.h
new file mode 100755 (executable)
index 0000000..d22ddee
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 __APPCORE_INTERNAL_H__
+#define __APPCORE_INTERNAL_H__
+
+#define LOG_TAG "APP_CORE"
+
+#include <stdio.h>
+#include <dlog.h>
+#include "appcore-common.h"
+
+
+#ifndef EXPORT_API
+#  define EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+#  define _ERR(fmt, arg...) LOGE(fmt, ##arg)
+#  define _INFO(...) LOGI(__VA_ARGS__)
+#  define _DBG(...) LOGD(__VA_ARGS__)
+
+#define _warn_if(expr, fmt, arg...) do { \
+               if (expr) { \
+                       _ERR(fmt, ##arg); \
+               } \
+       } while (0)
+
+#define _ret_if(expr) do { \
+               if (expr) { \
+                       return; \
+               } \
+       } while (0)
+
+#define _retv_if(expr, val) do { \
+               if (expr) { \
+                       return (val); \
+               } \
+       } while (0)
+
+#define _retm_if(expr, fmt, arg...) do { \
+               if (expr) { \
+                       _ERR(fmt, ##arg); \
+                       return; \
+               } \
+       } while (0)
+
+#define _retvm_if(expr, val, fmt, arg...) do { \
+               if (expr) { \
+                       _ERR(fmt, ##arg); \
+                       return (val); \
+               } \
+       } while (0)
+
+#define goto_if(expr, val) do { \
+                       if(expr) { \
+                               _ERR("(%s) -> goto", #expr); \
+                               goto val; \
+                       } \
+               } while (0)
+
+#define break_if(expr) { \
+                       if(expr) { \
+                               _ERR("(%s) -> break", #expr); \
+                               break; \
+                       } \
+               }
+
+#define continue_if(expr) { \
+                       if(expr) { \
+                               _ERR("(%s) -> continue", #expr); \
+                               continue; \
+                       } \
+               }
+
+/**
+ * Appcore internal state
+ */
+enum app_state {
+       AS_NONE,
+       AS_CREATED,
+       AS_RUNNING,
+       AS_PAUSED,
+       AS_DYING,
+};
+
+/**
+ * Appcore internal event
+ */
+enum app_event {
+       AE_UNKNOWN,
+       AE_CREATE,
+       AE_TERMINATE,
+       AE_PAUSE,
+       AE_RESUME,
+       AE_RESET,
+       AE_LOWMEM_POST,
+       AE_MEM_FLUSH,
+       AE_MAX
+};
+
+/**
+ * Appcore internal system event
+ */
+enum sys_event {
+       SE_UNKNOWN,
+       SE_LOWMEM,
+       SE_LOWBAT,
+       SE_LANGCHG,
+       SE_REGIONCHG,
+       SE_MAX
+};
+
+/**
+ * Appcore system event operation
+ */
+struct sys_op {
+       int (*func) (void *);
+       void *data;
+};
+
+/**
+ * Appcore internal structure
+ */
+struct appcore {
+       int state;
+
+       const struct ui_ops *ops;
+       struct sys_op sops[SE_MAX];
+};
+
+/**
+ * Appcore UI operation
+ */
+struct ui_ops {
+       void *data;
+       void (*cb_app) (enum app_event evnt, void *data, bundle *b);
+};
+
+/* appcore-i18n.c */
+extern void update_lang(void);
+extern int set_i18n(const char *domainname, const char *dirname);
+void update_region(void);
+
+
+/* appcore-X.c */
+extern int x_raise_win(pid_t pid);
+
+/* appcore-util.c */
+/* extern void stack_trim(void);*/
+
+int appcore_pause_rotation_cb(void);
+int appcore_resume_rotation_cb(void);
+
+struct ui_wm_rotate {
+   int (*set_rotation_cb) (int (*cb) (enum appcore_rm, void *), void *data);
+   int (*unset_rotation_cb) (void);
+   int (*get_rotation_state) (enum appcore_rm *curr);
+   int (*pause_rotation_cb) (void);
+   int (*resume_rotation_cb) (void);
+};
+int appcore_set_wm_rotation(struct ui_wm_rotate* wm_rotate);
+
+#define ENV_START "APP_START_TIME"
+
+#define MEMORY_FLUSH_ACTIVATE
+
+#define APPID_MAX 256
+
+#endif                         /* __APPCORE_INTERNAL_H__ */
diff --git a/include/image/SLP_Appcore_PG_events.png b/include/image/SLP_Appcore_PG_events.png
new file mode 100644 (file)
index 0000000..03a1547
Binary files /dev/null and b/include/image/SLP_Appcore_PG_events.png differ
diff --git a/include/image/SLP_Appcore_PG_lifecycle.png b/include/image/SLP_Appcore_PG_lifecycle.png
new file mode 100644 (file)
index 0000000..0b12db4
Binary files /dev/null and b/include/image/SLP_Appcore_PG_lifecycle.png differ
diff --git a/include/image/SLP_Appcore_PG_overview.png b/include/image/SLP_Appcore_PG_overview.png
new file mode 100644 (file)
index 0000000..ce3fbc9
Binary files /dev/null and b/include/image/SLP_Appcore_PG_overview.png differ
diff --git a/include/image/SLP_Appcore_PG_rotation.png b/include/image/SLP_Appcore_PG_rotation.png
new file mode 100755 (executable)
index 0000000..444d7ba
Binary files /dev/null and b/include/image/SLP_Appcore_PG_rotation.png differ
diff --git a/include/virtual_canvas.h b/include/virtual_canvas.h
new file mode 100644 (file)
index 0000000..2d523f8
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ *  starter
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@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 __STARTER_VIRTUAL_CANVAS_H__
+#define __STARTER_VIRTUAL_CANVAS_H__
+
+#include <Evas.h>
+#include <stdbool.h>
+
+extern Evas *virtual_canvas_create(int w, int h);
+extern bool virtual_canvas_flush_to_file(Evas *e, const char *filename, int w, int h);
+extern bool virtual_canvas_destroy(Evas *e);
+
+#endif //__STARTER_VIRTUAL_CANVAS_H__
+
+// End of a file
diff --git a/packaging/app-core.spec b/packaging/app-core.spec
new file mode 100644 (file)
index 0000000..e7f79a1
--- /dev/null
@@ -0,0 +1,156 @@
+
+Name:       app-core
+Summary:    Application basic
+Version:    1.3.11
+Release:    1
+VCS:        framework/appfw/app-core#app-core_1.2-47-52-ge28693cc5d9eabf1943bc165ba686d9336334e6c
+Group:      TO_BE/FILLED_IN
+License:    Apache License, Version 2.0
+Source0:    app-core-%{version}.tar.gz
+Source101:  packaging/core-efl.target
+BuildRequires:  pkgconfig(sensor)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(aul)
+BuildRequires:  pkgconfig(rua)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xcomposite)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-x)
+BuildRequires:  pkgconfig(edje)
+BuildRequires:  pkgconfig(eet)
+BuildRequires:  pkgconfig(eina)
+BuildRequires:  pkgconfig(gobject-2.0)
+BuildRequires:  pkgconfig(glib-2.0)
+%if %{_repository} == "wearable"
+BuildRequires:  pkgconfig(system-resource)
+%endif
+BuildRequires:  cmake
+
+
+%description
+SLP common application basic
+
+
+
+%package efl
+Summary:    App basic EFL
+Group:      Development/Libraries
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description efl
+Application basic EFL
+
+%package efl-devel
+Summary:    App basic EFL (devel)
+Group:      Development/Libraries
+Requires:   %{name}-efl = %{version}-%{release}
+Requires:   %{name}-common-devel = %{version}-%{release}
+
+%description efl-devel
+Application basic EFL (devel)
+
+%package common
+Summary:    App basics common
+Group:      Development/Libraries
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description common
+Application basics common
+
+%package common-devel
+Summary:    App basics common (devel)
+Group:      Development/Libraries
+Requires:   %{name}-common = %{version}-%{release}
+Requires:   pkgconfig(sensor)
+Requires:   pkgconfig(vconf)
+Requires:   pkgconfig(elementary)
+Requires:   pkgconfig(aul)
+
+%description common-devel
+Application basics common (devel)
+
+%package template
+Summary:    App basics template
+Group:      Development/Libraries
+
+%description template
+Application basics template
+
+
+%prep
+%setup -q 
+
+%build
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+%endif
+%if %{_repository} == "wearable"
+cmake -DDEVICE_PROFILE=wearable -DCMAKE_INSTALL_PREFIX=%{_prefix} -DENABLE_GTK=OFF .
+%else
+cmake -DDEVICE_PROFILE=mobile -DCMAKE_INSTALL_PREFIX=%{_prefix} -DENABLE_GTK=OFF .
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+install -d %{buildroot}%{_libdir}/systemd/user/core-efl.target.wants
+install -m0644 %{SOURCE101} %{buildroot}%{_libdir}/systemd/user/
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}-efl
+cp LICENSE %{buildroot}/usr/share/license/%{name}-common
+
+
+%post efl
+
+/sbin/ldconfig
+mkdir -p /opt/share/app_capture
+chmod 777 /opt/share/app_capture
+chsmack -a "system::homedir" /opt/share/app_capture
+chsmack -t /opt/share/app_capture
+
+%postun efl -p /sbin/ldconfig
+
+%post common -p /sbin/ldconfig
+
+%postun common -p /sbin/ldconfig
+
+
+
+
+
+%files efl
+%manifest app-core.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libappcore-efl.so.*
+/usr/share/license/%{name}-efl
+
+%files efl-devel
+%defattr(-,root,root,-)
+%{_includedir}/appcore/appcore-efl.h
+%{_libdir}/libappcore-efl.so
+%{_libdir}/pkgconfig/appcore-efl.pc
+
+%files common
+%manifest app-core.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libappcore-common.so.*
+%{_libdir}/systemd/user/core-efl.target
+%{_libdir}/systemd/user/core-efl.target.wants/
+/usr/share/license/%{name}-common
+
+%files common-devel
+%defattr(-,root,root,-)
+%{_libdir}/libappcore-common.so
+%{_libdir}/pkgconfig/appcore-common.pc
+%{_includedir}/appcore/appcore-common.h
+%{_includedir}/SLP_Appcore_PG.h
+
diff --git a/packaging/core-efl.target b/packaging/core-efl.target
new file mode 100644 (file)
index 0000000..67ec56e
--- /dev/null
@@ -0,0 +1,15 @@
+#
+# This virtual unit maps the default core components and their dependencies.
+#
+# The real desktop services should go into the final desktop target
+# folder, which should require this virtual target. While starting
+# up, systemd will assure that the core EFL and daemons start before
+# anything else. After the core target finishes, dependencies should
+# not matter too much anymore and less fine-grained dependencies can
+# be used.
+#
+
+[Unit]
+Description=Core EFL UI target
+After=xorg.target
+Requires=xorg.target
diff --git a/src/appcore-X.c b/src/appcore-X.c
new file mode 100755 (executable)
index 0000000..8595860
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <errno.h>
+#include <signal.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+#include "appcore-internal.h"
+
+static Atom a_pid;
+static Atom a_active_win;
+
+static pid_t __get_win_pid(Display *d, Window win)
+{
+       int r;
+       pid_t pid;
+
+       Atom a_type;
+       int format;
+       unsigned long nitems;
+       unsigned long bytes_after;
+       unsigned char *prop_ret;
+       XWindowAttributes attr;
+
+       _retv_if(d == NULL || !a_pid, -1);
+
+       if (!XGetWindowAttributes(d, win, &attr))
+               return -1;
+
+       if (attr.override_redirect || attr.class == InputOnly)
+               return -1;
+
+       prop_ret = NULL;
+       r = XGetWindowProperty(d, win, a_pid, 0, 1, False, XA_CARDINAL,
+                              &a_type, &format, &nitems, &bytes_after,
+                              &prop_ret);
+       if (r != Success || prop_ret == NULL)
+               return -1;
+
+       if (a_type == XA_CARDINAL && format == 32)
+               pid = *(unsigned long *)prop_ret;
+       else
+               pid = -1;
+
+       XFree(prop_ret);
+
+       return pid;
+}
+
+static int __find_win(Display *d, Window *win, pid_t pid)
+{
+       int r;
+       pid_t p;
+       unsigned int n;
+       Window root, parent, *child;
+
+       p = __get_win_pid(d, *win);
+       if (p == pid)
+               return 1;
+
+       r = XQueryTree(d, *win, &root, &parent, &child, &n);
+       if (r) {
+               int i;
+               int found = 0;
+
+               for (i = 0; i < n; i++) {
+                       found = __find_win(d, &child[i], pid);
+                       if (found) {
+                               *win = child[i];
+                               break;
+                       }
+               }
+               XFree(child);
+
+               if (found)
+                       return 1;
+       }
+
+       return 0;
+}
+
+static int __raise_win(Display *d, Window win)
+{
+       XEvent xev;
+       Window root;
+
+       if (!a_active_win)
+               a_active_win = XInternAtom(d, "_NET_ACTIVE_WINDOW", False);
+
+       root = XDefaultRootWindow(d);
+
+       xev.xclient.type = ClientMessage;
+       xev.xclient.display = d;
+       xev.xclient.window = win;
+       xev.xclient.message_type = a_active_win;
+       xev.xclient.format = 32;
+       xev.xclient.data.l[0] = 1;
+       xev.xclient.data.l[1] = CurrentTime;
+       xev.xclient.data.l[2] = 0;
+       xev.xclient.data.l[3] = 0;
+       xev.xclient.data.l[4] = 0;
+       XSendEvent(d, root, False,
+                  SubstructureRedirectMask | SubstructureNotifyMask, &xev);
+
+       return 0;
+}
+
+int x_raise_win(pid_t pid)
+{
+
+       int r;
+       int found;
+       Display *d;
+       Window win;
+
+       if (pid < 1) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       r = kill(pid, 0);
+       if (r == -1) {
+               errno = ESRCH;  /* No such process */
+               return -1;
+       }
+
+       d = XOpenDisplay(NULL);
+       _retv_if(d == NULL, -1);
+
+       win = XDefaultRootWindow(d);
+
+       if (!a_pid)
+               a_pid = XInternAtom(d, "_NET_WM_PID", True);
+
+       found = __find_win(d, &win, pid);
+       if (!found) {
+               XCloseDisplay(d);
+               errno = ENOENT;
+               return -1;
+       }
+
+       r = __raise_win(d, win);
+
+       XCloseDisplay(d);
+
+       return r;
+}
diff --git a/src/appcore-efl.c b/src/appcore-efl.c
new file mode 100755 (executable)
index 0000000..06d4903
--- /dev/null
@@ -0,0 +1,1407 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/XShm.h>
+#include <sys/shm.h>
+
+#include <Ecore_X.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Ecore_Input_Evas.h>
+#include <Elementary.h>
+#include <glib-object.h>
+#include <malloc.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <aul.h>
+#ifdef WEARABLE_PROFILE
+#include <proc_stat.h>
+#endif
+#include "appcore-internal.h"
+#include "appcore-efl.h"
+#include "virtual_canvas.h"
+
+#define SYSMAN_MAXSTR 100
+#define SYSMAN_MAXARG 16
+#define SYSNOTI_SOCKET_PATH "/tmp/sn"
+#define RETRY_READ_COUNT       10
+
+#define PREDEF_BACKGRD                         "backgrd"
+#define PREDEF_FOREGRD                         "foregrd"
+
+enum sysnoti_cmd {
+       ADD_SYSMAN_ACTION,
+       CALL_SYSMAN_ACTION
+};
+
+struct sysnoti {
+       int pid;
+       int cmd;
+       char *type;
+       char *path;
+       int argc;
+       char *argv[SYSMAN_MAXARG];
+};
+
+static pid_t _pid;
+
+static bool resource_reclaiming = TRUE;
+static int tmp_val = 0;
+
+
+struct ui_priv {
+       const char *name;
+       enum app_state state;
+
+       Ecore_Event_Handler *hshow;
+       Ecore_Event_Handler *hhide;
+       Ecore_Event_Handler *hvchange;
+       Ecore_Event_Handler *hcmsg; /* WM_ROTATE */
+
+       Ecore_Timer *mftimer;   /* Ecore Timer for memory flushing */
+
+       struct appcore_ops *ops;
+       void (*mfcb) (void);    /* Memory Flushing Callback */
+
+       /* WM_ROTATE */
+       int wm_rot_supported;
+       int rot_started;
+       int (*rot_cb) (enum appcore_rm, void *);
+       void *rot_cb_data;
+       enum appcore_rm rot_mode;
+};
+
+static struct ui_priv priv;
+
+static const char *_ae_name[AE_MAX] = {
+       [AE_UNKNOWN] = "UNKNOWN",
+       [AE_CREATE] = "CREATE",
+       [AE_TERMINATE] = "TERMINATE",
+       [AE_PAUSE] = "PAUSE",
+       [AE_RESUME] = "RESUME",
+       [AE_RESET] = "RESET",
+       [AE_LOWMEM_POST] = "LOWMEM_POST",
+       [AE_MEM_FLUSH] = "MEM_FLUSH",
+};
+
+static const char *_as_name[] = {
+       [AS_NONE] = "NONE",
+       [AS_CREATED] = "CREATED",
+       [AS_RUNNING] = "RUNNING",
+       [AS_PAUSED] = "PAUSED",
+       [AS_DYING] = "DYING",
+};
+
+static bool b_active = 0;
+struct win_node {
+       unsigned int win;
+       bool bfobscured;
+};
+
+static struct ui_wm_rotate wm_rotate;
+
+static inline int send_int(int fd, int val)
+{
+       return write(fd, &val, sizeof(int));
+}
+
+static inline int send_str(int fd, char *str)
+{
+       int len;
+       int ret;
+       if (str == NULL) {
+               len = 0;
+               ret = write(fd, &len, sizeof(int));
+       } else {
+               len = strlen(str);
+               if (len > SYSMAN_MAXSTR)
+                       len = SYSMAN_MAXSTR;
+               write(fd, &len, sizeof(int));
+               ret = write(fd, str, len);
+       }
+       return ret;
+}
+
+static int sysnoti_send(struct sysnoti *msg)
+{
+       int client_len;
+       int client_sockfd;
+       int result;
+       int r;
+       int retry_count = 0;
+       struct sockaddr_un clientaddr;
+       int i;
+
+       client_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (client_sockfd == -1) {
+               _ERR("%s: socket create failed\n", __FUNCTION__);
+               return -1;
+       }
+       bzero(&clientaddr, sizeof(clientaddr));
+       clientaddr.sun_family = AF_UNIX;
+       strncpy(clientaddr.sun_path, SYSNOTI_SOCKET_PATH, sizeof(clientaddr.sun_path) - 1);
+       client_len = sizeof(clientaddr);
+
+       if (connect(client_sockfd, (struct sockaddr *)&clientaddr, client_len) <
+           0) {
+               _ERR("%s: connect failed\n", __FUNCTION__);
+               close(client_sockfd);
+               return -1;
+       }
+
+       send_int(client_sockfd, msg->pid);
+       send_int(client_sockfd, msg->cmd);
+       send_str(client_sockfd, msg->type);
+       send_str(client_sockfd, msg->path);
+       send_int(client_sockfd, msg->argc);
+       for (i = 0; i < msg->argc; i++)
+               send_str(client_sockfd, msg->argv[i]);
+
+       while (retry_count < RETRY_READ_COUNT) {
+               r = read(client_sockfd, &result, sizeof(int));
+               if (r < 0) {
+                       if (errno == EINTR) {
+                               _ERR("Re-read for error(EINTR)");
+                               retry_count++;
+                               continue;
+                       }
+                       _ERR("Read fail for str length");
+                       result = -1;
+                       break;
+
+               }
+               break;
+       }
+       if (retry_count == RETRY_READ_COUNT) {
+               _ERR("Read retry failed");
+       }
+
+       close(client_sockfd);
+       return result;
+}
+
+static int _call_predef_action(const char *type, int num, ...)
+{
+       struct sysnoti *msg;
+       int ret;
+       va_list argptr;
+
+       int i;
+       char *args = NULL;
+
+       if (type == NULL || num > SYSMAN_MAXARG) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       msg = malloc(sizeof(struct sysnoti));
+
+       if (msg == NULL) {
+               /* Do something for not enought memory error */
+               return -1;
+       }
+
+       msg->pid = getpid();
+       msg->cmd = CALL_SYSMAN_ACTION;
+       msg->type = (char *)type;
+       msg->path = NULL;
+
+       msg->argc = num;
+       va_start(argptr, num);
+       for (i = 0; i < num; i++) {
+               args = va_arg(argptr, char *);
+               msg->argv[i] = args;
+       }
+       va_end(argptr);
+
+       ret = sysnoti_send(msg);
+       free(msg);
+
+       return ret;
+}
+
+static int _inform_foregrd(void)
+{
+       char buf[255];
+       snprintf(buf, sizeof(buf), "%d", getpid());
+       return _call_predef_action(PREDEF_FOREGRD, 1, buf);
+}
+
+static int _inform_backgrd(void)
+{
+       char buf[255];
+       snprintf(buf, sizeof(buf), "%d", getpid());
+       return _call_predef_action(PREDEF_BACKGRD, 1, buf);
+}
+
+
+
+char appid[APPID_MAX];
+bool taskmanage;
+
+static void _capture_and_make_file(Ecore_X_Window win, int pid, const char *package);
+
+static int WIN_COMP(gconstpointer data1, gconstpointer data2)
+{
+       struct win_node *a = (struct win_node *)data1;
+       struct win_node *b = (struct win_node *)data2;
+       return (int)((a->win)-(b->win));
+}
+
+GSList *g_winnode_list = NULL;
+
+#if defined(MEMORY_FLUSH_ACTIVATE)
+static Eina_Bool __appcore_memory_flush_cb(void *data)
+{
+       struct ui_priv *ui = (struct ui_priv *)data;
+
+       appcore_flush_memory();
+       ui->mftimer = NULL;
+
+       return ECORE_CALLBACK_CANCEL;
+}
+
+static int __appcore_low_memory_post_cb(struct ui_priv *ui)
+{
+       if (ui->state == AS_PAUSED) {
+       //      appcore_flush_memory();
+       } else {
+               malloc_trim(0);
+       }
+
+       return 0;
+}
+
+static void __appcore_timer_add(struct ui_priv *ui)
+{
+       ui->mftimer = ecore_timer_add(5, __appcore_memory_flush_cb, ui);
+}
+
+static void __appcore_timer_del(struct ui_priv *ui)
+{
+       if (ui->mftimer) {
+               ecore_timer_del(ui->mftimer);
+               ui->mftimer = NULL;
+       }
+}
+
+#else
+
+static int __appcore_low_memory_post_cb(ui_priv *ui)
+{
+       return -1;
+}
+
+#define __appcore_timer_add(ui) 0
+#define __appcore_timer_del(ui) 0
+
+#endif
+
+static void __appcore_efl_memory_flush_cb(void)
+{
+       //_DBG("[APP %d]   __appcore_efl_memory_flush_cb()", _pid);
+       elm_cache_all_flush();
+}
+
+static void __do_app(enum app_event event, void *data, bundle * b)
+{
+       int r = -1;
+       struct ui_priv *ui = data;
+
+       _ret_if(ui == NULL || event >= AE_MAX);
+       _DBG("[APP %d] Event: %s State: %s", _pid, _ae_name[event],
+            _as_name[ui->state]);
+
+       if (event == AE_MEM_FLUSH) {
+               ui->mfcb();
+               return;
+       }
+
+       if (event == AE_LOWMEM_POST) {
+               if (__appcore_low_memory_post_cb(ui) == 0)
+                       return;
+       }
+
+       if (!(ui->state == AS_PAUSED && event == AE_PAUSE))
+               __appcore_timer_del(ui);
+
+       if (event == AE_TERMINATE) {
+               _DBG("[APP %d] TERMINATE", _pid);
+               ui->state = AS_DYING;
+               elm_exit();
+               return;
+       }
+
+       _ret_if(ui->ops == NULL);
+
+       switch (event) {
+       case AE_RESET:
+               _DBG("[APP %d] RESET", _pid);
+               LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:start]",
+                   ui->name);
+               if (ui->ops->reset)
+                       r = ui->ops->reset(b, ui->ops->data);
+               ui->state = AS_RUNNING;
+               LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:reset:done]",
+                   ui->name);
+               break;
+       case AE_PAUSE:
+               if (ui->state == AS_RUNNING) {
+                       _DBG("[APP %d] PAUSE", _pid);
+                       if (ui->ops->pause)
+                               r = ui->ops->pause(ui->ops->data);
+                       ui->state = AS_PAUSED;
+                       if(r >= 0 && resource_reclaiming == TRUE)
+                               __appcore_timer_add(ui);
+               }
+               /* TODO : rotation stop */
+               //r = appcore_pause_rotation_cb();
+#ifdef WEARABLE_PROFILE
+               proc_group_change_status(PROC_CGROUP_SET_BACKGRD, getpid(), NULL);
+#else
+               _inform_backgrd();
+#endif
+
+               break;
+       case AE_RESUME:
+               LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:resume:start]",
+                   ui->name);
+               if (ui->state == AS_PAUSED) {
+                       _DBG("[APP %d] RESUME", _pid);
+                       if (ui->ops->resume)
+                               r = ui->ops->resume(ui->ops->data);
+                       ui->state = AS_RUNNING;
+               }
+               /*TODO : rotation start*/
+               //r = appcore_resume_rotation_cb();
+               LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:resume:done]",
+                   ui->name);
+               LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:Launching:done]",
+                   ui->name);
+#ifdef WEARABLE_PROFILE
+               proc_group_change_status(PROC_CGROUP_SET_FOREGRD, getpid(), NULL);
+#else
+               _inform_foregrd();
+#endif
+
+               break;
+       default:
+               /* do nothing */
+               break;
+       }
+}
+
+static struct ui_ops efl_ops = {
+       .data = &priv,
+       .cb_app = __do_app,
+};
+
+
+static bool __check_visible(void)
+{
+       GSList *iter = NULL;
+       struct win_node *entry = NULL;
+
+       for (iter = g_winnode_list; iter != NULL; iter = g_slist_next(iter)) {
+               entry = iter->data;     
+               //_DBG("win : %x obscured : %d\n", entry->win, entry->bfobscured);
+               if(entry->bfobscured == FALSE)
+                       return TRUE;            
+       }
+       return FALSE;
+}
+
+static bool __check_skip(Ecore_X_Window xwin)
+{
+       unsigned int i, num;
+       Ecore_X_Window_State *state;
+       int ret;
+
+       ret = ecore_x_netwm_window_state_get(xwin, &state, &num);
+       _DBG("ret(%d), win(%x), state(%x), num(%d)", ret, xwin, state, num);
+       if (state) {
+               for (i = 0; i < num; i++) {
+                       _DBG("state[%d] : %d", i, state[i]);
+                       switch (state[i]) {
+                               case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
+                                       free(state);
+                                       return TRUE;
+                                       break;
+                               case ECORE_X_WINDOW_STATE_SKIP_PAGER:
+                                       free(state);
+                                       return TRUE;
+                                       break;
+                               default:
+                                       /* Ignore */
+                                       break;
+                       }
+               }
+       }
+       free(state);
+       return FALSE;
+}
+
+static bool __exist_win(unsigned int win)
+{
+       struct win_node temp;
+       GSList *f;
+
+       temp.win = win;
+
+       f = g_slist_find_custom(g_winnode_list, &temp, WIN_COMP);
+       if (f == NULL) {
+               return FALSE;
+       } else {
+               return TRUE;
+       }
+
+}
+
+static bool __add_win(unsigned int win)
+{
+       struct win_node *t;
+       GSList *f;
+
+       t = calloc(1, sizeof(struct win_node));
+       if (t == NULL)
+               return FALSE;
+
+       t->win = win;
+       t->bfobscured = FALSE;
+
+       _DBG("[EVENT_TEST][EVENT] __add_win WIN:%x\n", win);
+
+       f = g_slist_find_custom(g_winnode_list, t, WIN_COMP);
+
+       if (f) {
+               errno = ENOENT;
+               _DBG("[EVENT_TEST][EVENT] ERROR There is already window : %x \n", win);
+               free(t);
+               return 0;
+       }
+
+       g_winnode_list = g_slist_append(g_winnode_list, t);
+
+       return TRUE;
+
+}
+
+static bool __delete_win(unsigned int win)
+{
+       struct win_node temp;
+       GSList *f;
+
+       temp.win = win;
+
+       f = g_slist_find_custom(g_winnode_list, &temp, WIN_COMP);
+       if (f == NULL) {
+               errno = ENOENT;
+               _DBG("[EVENT_TEST][EVENT] ERROR There is no window : %x \n",
+                    win);
+               return 0;
+       }
+
+       g_winnode_list = g_slist_remove_link(g_winnode_list, f);
+
+       free(f->data);
+
+       return TRUE;
+}
+
+static bool __update_win(unsigned int win, bool bfobscured)
+{
+       struct win_node temp;
+       GSList *f;
+
+       struct win_node *t;
+
+       _DBG("[EVENT_TEST][EVENT] __update_win WIN:%x fully_obscured %d\n", win,
+            bfobscured);
+
+       temp.win = win;
+
+       f = g_slist_find_custom(g_winnode_list, &temp, WIN_COMP);
+
+       if (f == NULL) {
+               errno = ENOENT;
+               _DBG("[EVENT_TEST][EVENT] ERROR There is no window : %x \n", win);
+               return FALSE;
+       }
+
+       g_winnode_list = g_slist_remove_link(g_winnode_list, f);
+
+       free(f->data);
+
+       t = calloc(1, sizeof(struct win_node));
+       if (t == NULL)
+               return FALSE;
+
+       t->win = win;
+       t->bfobscured = bfobscured;
+
+       g_winnode_list = g_slist_append(g_winnode_list, t);
+       
+       return TRUE;
+
+}
+
+/* WM_ROTATE */
+static Ecore_X_Atom _WM_WINDOW_ROTATION_SUPPORTED = 0;
+static Ecore_X_Atom _WM_WINDOW_ROTATION_CHANGE_REQUEST = 0;
+
+static int __check_wm_rotation_support(void)
+{
+       _DBG("Disable window manager rotation");
+       return -1;
+#if 0
+       Ecore_X_Window root, win, win2;
+       int ret;
+
+       if (!_WM_WINDOW_ROTATION_SUPPORTED) {
+               _WM_WINDOW_ROTATION_SUPPORTED =
+                                       ecore_x_atom_get("_E_WINDOW_ROTATION_SUPPORTED");
+       }
+
+       if (!_WM_WINDOW_ROTATION_CHANGE_REQUEST) {
+               _WM_WINDOW_ROTATION_CHANGE_REQUEST =
+                                       ecore_x_atom_get("_E_WINDOW_ROTATION_CHANGE_REQUEST");
+       }
+
+       root = ecore_x_window_root_first_get();
+       ret = ecore_x_window_prop_xid_get(root,
+                       _WM_WINDOW_ROTATION_SUPPORTED,
+                       ECORE_X_ATOM_WINDOW,
+                       &win, 1);
+       if ((ret == 1) && (win))
+       {
+               ret = ecore_x_window_prop_xid_get(win,
+                               _WM_WINDOW_ROTATION_SUPPORTED,
+                               ECORE_X_ATOM_WINDOW,
+                               &win2, 1);
+               if ((ret == 1) && (win2 == win))
+                       return 0;
+       }
+
+       return -1;
+#endif
+}
+
+static void __set_wm_rotation_support(unsigned int win, unsigned int set)
+{
+       GSList *iter = NULL;
+       struct win_node *entry = NULL;
+
+       if (0 == win) {
+               for (iter = g_winnode_list; iter != NULL; iter = g_slist_next(iter)) {
+                       entry = iter->data;
+                       if (entry->win) {
+                               ecore_x_window_prop_card32_set(entry->win,
+                                               _WM_WINDOW_ROTATION_SUPPORTED,
+                                               &set, 1);
+                       }
+               }
+       } else {
+               ecore_x_window_prop_card32_set(win,
+                               _WM_WINDOW_ROTATION_SUPPORTED,
+                               &set, 1);
+       }
+}
+
+Ecore_X_Atom atom_parent;
+
+static Eina_Bool __show_cb(void *data, int type, void *event)
+{
+       Ecore_X_Event_Window_Show *ev;
+       int ret;
+       Ecore_X_Window parent;
+
+       ev = event;
+
+       ret = ecore_x_window_prop_window_get(ev->win, atom_parent, &parent, 1);
+       if (ret != 1)
+       {
+               // This is child window. Skip!!!
+               return ECORE_CALLBACK_PASS_ON;
+       }
+
+       _DBG("[EVENT_TEST][EVENT] GET SHOW EVENT!!!. WIN:%x\n", ev->win);
+
+       if (!__exist_win((unsigned int)ev->win)) {
+               /* WM_ROTATE */
+               if ((priv.wm_rot_supported) && (1 == priv.rot_started)) {
+                       __set_wm_rotation_support(ev->win, 1);
+               }
+               __add_win((unsigned int)ev->win);
+       }
+       else
+               __update_win((unsigned int)ev->win, FALSE);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __hide_cb(void *data, int type, void *event)
+{
+       Ecore_X_Event_Window_Hide *ev;
+       int bvisibility = 0;
+
+       ev = event;
+
+       _DBG("[EVENT_TEST][EVENT] GET HIDE EVENT!!!. WIN:%x\n", ev->win);
+
+       if (__exist_win((unsigned int)ev->win)) {
+               __delete_win((unsigned int)ev->win);
+               
+               bvisibility = __check_visible();
+               if (!bvisibility && b_active == 1) {
+                       _DBG(" Go to Pasue state \n");
+                       b_active = 0;
+                       __do_app(AE_PAUSE, data, NULL);
+                       if(taskmanage) {
+                               _capture_and_make_file(ev->win, getpid(), appid);
+                       } else if ( aul_is_subapp() ) {
+                               _capture_and_make_file(ev->win, getpid(), appcore_get_caller_appid());
+                       }
+               }
+       }
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __visibility_cb(void *data, int type, void *event)
+{
+       Ecore_X_Event_Window_Visibility_Change *ev;
+       int bvisibility = 0;
+
+       ev = event;
+
+       __update_win((unsigned int)ev->win, ev->fully_obscured);
+       bvisibility = __check_visible();
+
+       if (bvisibility && b_active == 0) {
+               _DBG(" Go to Resume state\n");
+               b_active = 1;
+
+               __do_app(AE_RESUME, data, NULL);
+
+       } else if (!bvisibility && b_active == 1) {
+               _DBG(" Go to Pasue state \n");
+               b_active = 0;
+               __do_app(AE_PAUSE, data, NULL);
+               if(taskmanage) {
+                       _capture_and_make_file(ev->win, getpid(), appid);
+               } else if ( aul_is_subapp() ) {
+                       _capture_and_make_file(ev->win, getpid(), appcore_get_caller_appid());
+               }
+       } else
+               _DBG(" No change state \n");
+
+       return ECORE_CALLBACK_RENEW;
+
+}
+
+/* WM_ROTATE */
+static Eina_Bool __cmsg_cb(void *data, int type, void *event)
+{
+       struct ui_priv *ui = (struct ui_priv *)data;
+       Ecore_X_Event_Client_Message *e = event;
+
+       if (!ui) return ECORE_CALLBACK_PASS_ON;
+       if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
+       if (e->message_type == _WM_WINDOW_ROTATION_CHANGE_REQUEST) {
+               if ((0 == ui->wm_rot_supported) ||
+                       (0 == ui->rot_started) ||
+                       (NULL == ui->rot_cb)) {
+                       return ECORE_CALLBACK_PASS_ON;
+               }
+
+               enum appcore_rm rm;
+               switch (e->data.l[1])
+               {
+                       case   0: rm = APPCORE_RM_PORTRAIT_NORMAL;   break;
+                       case  90: rm = APPCORE_RM_LANDSCAPE_REVERSE; break;
+                       case 180: rm = APPCORE_RM_PORTRAIT_REVERSE;  break;
+                       case 270: rm = APPCORE_RM_LANDSCAPE_NORMAL;  break;
+                       default:  rm = APPCORE_RM_UNKNOWN;           break;
+               }
+
+               ui->rot_mode = rm;
+
+               if (APPCORE_RM_UNKNOWN != rm) {
+                       ui->rot_cb(rm, ui->rot_cb_data);
+               }
+       }
+
+       return ECORE_CALLBACK_PASS_ON;
+}
+
+static void __add_climsg_cb(struct ui_priv *ui)
+{
+       _ret_if(ui == NULL);
+
+       atom_parent = ecore_x_atom_get("_E_PARENT_BORDER_WINDOW");
+       if (!atom_parent)
+       {
+               // Do Error Handling
+       }
+
+       ui->hshow =
+           ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, __show_cb, ui);
+       ui->hhide =
+           ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, __hide_cb, ui);
+       ui->hvchange =
+           ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE,
+                                   __visibility_cb, ui);
+
+       /* Add client message callback for WM_ROTATE */
+       if(!__check_wm_rotation_support())
+       {
+               ui->hcmsg =
+                       ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __cmsg_cb, ui);
+               ui->wm_rot_supported = 1;
+               appcore_set_wm_rotation(&wm_rotate);
+       }
+}
+
+static int __before_loop(struct ui_priv *ui, int *argc, char ***argv)
+{
+       int r;
+       char *hwacc = NULL;
+       char *tm_tmp = NULL;
+
+       if (argc == NULL || argv == NULL) {
+               _ERR("argc/argv is NULL");
+               errno = EINVAL;
+               return -1;
+       }
+
+       g_type_init();
+       elm_init(*argc, *argv);
+
+       hwacc = getenv("HWACC");
+       if(hwacc == NULL) {
+               _DBG("elm_config_preferred_engine_set is not called");
+       } else if(strcmp(hwacc, "USE") == 0) {
+               elm_config_preferred_engine_set("opengl_x11");
+               _DBG("elm_config_preferred_engine_set : opengl_x11");
+       } else if(strcmp(hwacc, "NOT_USE") == 0) {
+               elm_config_preferred_engine_set("software_x11");
+               _DBG("elm_config_preferred_engine_set : software_x11");
+       } else {
+               _DBG("elm_config_preferred_engine_set is not called");
+       }
+
+       tm_tmp = getenv("TASKMANAGE");
+       if(tm_tmp == NULL) {
+               _DBG("taskmanage is null");
+               taskmanage = 1;
+       } else if(strcmp(tm_tmp, "false") == 0) {
+               _DBG("taskmanage is false");
+               taskmanage = 0;
+       } else {
+               _DBG("taskmanage is true %s", tm_tmp);
+               taskmanage = 1;
+       }
+
+       r = appcore_init(ui->name, &efl_ops, *argc, *argv);
+       _retv_if(r == -1, -1);
+
+       LOG(LOG_DEBUG, "LAUNCH", "[%s:Platform:appcore_init:done]", ui->name);
+       if (ui->ops && ui->ops->create) {
+               r = ui->ops->create(ui->ops->data);
+               if (r == -1) {
+                       _ERR("create() return error");
+                       appcore_exit();
+                       errno = ECANCELED;
+                       return -1;
+               }
+               LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:create:done]",
+                   ui->name);
+       }
+       ui->state = AS_CREATED;
+
+       __add_climsg_cb(ui);
+
+       return 0;
+}
+
+static void __after_loop(struct ui_priv *ui)
+{
+       appcore_unset_rotation_cb();
+       appcore_exit();
+
+       if (ui->ops && ui->ops->terminate)
+               ui->ops->terminate(ui->ops->data);
+
+       if (ui->hshow)
+               ecore_event_handler_del(ui->hshow);
+       if (ui->hhide)
+               ecore_event_handler_del(ui->hhide);
+       if (ui->hvchange)
+               ecore_event_handler_del(ui->hvchange);
+
+       __appcore_timer_del(ui);
+
+       elm_shutdown();
+}
+
+static int __set_data(struct ui_priv *ui, const char *name,
+                   struct appcore_ops *ops)
+{
+       if (ui->name) {
+               _ERR("Mainloop already started");
+               errno = EINPROGRESS;
+               return -1;
+       }
+
+       if (name == NULL || name[0] == '\0') {
+               _ERR("Invalid name");
+               errno = EINVAL;
+               return -1;
+       }
+
+       if (ops == NULL) {
+               _ERR("ops is NULL");
+               errno = EINVAL;
+               return -1;
+       }
+
+       ui->name = strdup(name);
+       _retv_if(ui->name == NULL, -1);
+
+       ui->ops = ops;
+
+       ui->mfcb = __appcore_efl_memory_flush_cb;
+
+       _pid = getpid();
+
+       /* WM_ROTATE */
+       ui->wm_rot_supported = 0;
+       ui->rot_started = 0;
+       ui->rot_cb = NULL;
+       ui->rot_cb_data = NULL;
+       ui->rot_mode = APPCORE_RM_UNKNOWN;
+
+       return 0;
+}
+
+static void __unset_data(struct ui_priv *ui)
+{
+       if (ui->name)
+               free((void *)ui->name);
+
+       memset(ui, 0, sizeof(struct ui_priv));
+}
+
+/* WM_ROTATE */
+static int __wm_set_rotation_cb(int (*cb) (enum appcore_rm, void *), void *data)
+{
+       if (cb == NULL) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       if ((priv.wm_rot_supported) && (0 == priv.rot_started)) {
+               __set_wm_rotation_support(0, 1);
+       }
+
+       priv.rot_cb = cb;
+       priv.rot_cb_data = data;
+       priv.rot_started = 1;
+
+       return 0;
+}
+
+static int __wm_unset_rotation_cb(void)
+{
+       if ((priv.wm_rot_supported) && (1 == priv.rot_started)) {
+               __set_wm_rotation_support(0, 0);
+       }
+
+       priv.rot_cb = NULL;
+       priv.rot_cb_data = NULL;
+       priv.rot_started = 0;
+
+       return 0;
+}
+
+static int __wm_get_rotation_state(enum appcore_rm *curr)
+{
+       if (curr == NULL) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       *curr = priv.rot_mode;
+
+       return 0;
+}
+
+static int __wm_pause_rotation_cb(void)
+{
+       if ((1 == priv.rot_started) && (priv.wm_rot_supported)) {
+               __set_wm_rotation_support(0, 0);
+       }
+
+       priv.rot_started = 0;
+
+       return 0;
+}
+
+static int __wm_resume_rotation_cb(void)
+{
+       if ((0 == priv.rot_started) && (priv.wm_rot_supported)) {
+               __set_wm_rotation_support(0, 1);
+       }
+
+       priv.rot_started = 1;
+
+       return 0;
+}
+
+static struct ui_wm_rotate wm_rotate = {
+       __wm_set_rotation_cb,
+       __wm_unset_rotation_cb,
+       __wm_get_rotation_state,
+       __wm_pause_rotation_cb,
+       __wm_resume_rotation_cb
+};
+
+static Window _get_parent_window(Window id)
+{
+       Window root;
+       Window parent;
+       Window *children;
+       unsigned int num;
+
+       if (!XQueryTree(ecore_x_display_get(), id, &root, &parent, &children, &num)) {
+               return 0;
+       }
+
+       if (children) {
+               XFree(children);
+       }
+
+       return parent;
+}
+
+static Window _find_capture_window(Window id, Visual **visual, int *depth, int *width, int *height)
+{
+       XWindowAttributes attr;
+       Window parent = id;
+       Window orig_id = id;
+
+       if (id == 0) {
+               return (Window)-1;
+       }
+
+       do {
+               id = parent;
+
+               if (!XGetWindowAttributes(ecore_x_display_get(), id, &attr)) {
+                       return (Window)-1;
+               }
+
+               parent = _get_parent_window(id);
+
+               if (attr.map_state == IsViewable
+                   && attr.override_redirect == True
+                   && attr.class == InputOutput && parent == attr.root) {
+                       *depth = attr.depth;
+                       *width = attr.width;
+                       *height = attr.height;
+                       *visual = attr.visual;
+                       return id;
+               }
+       } while (parent != attr.root && parent != 0);
+
+       XGetWindowAttributes(ecore_x_display_get(), orig_id, &attr);
+       *depth = attr.depth;
+       *width = attr.width;
+       *height = attr.height;
+       *visual = attr.visual;
+
+       return (Window) 0;
+
+}
+
+static char *_capture_window(Window id, Visual *visual, int width, int height, int depth, int *size)
+{
+       XShmSegmentInfo si;
+       XImage *xim;
+       int img_size;
+       char *captured_img = NULL;
+
+       /* (depth >> 3) + 1 == 4 byte */
+       si.shmid =
+           shmget(IPC_PRIVATE, width * height * ((depth >> 3) + 1),
+                  IPC_CREAT | 0666);
+
+       if (si.shmid < 0) {
+               _ERR("shmget");
+               return NULL;
+       }
+
+       si.readOnly = False;
+       si.shmaddr = shmat(si.shmid, NULL, 0);
+
+       if (si.shmaddr == (char *)-1) {
+               shmdt(si.shmaddr);
+               shmctl(si.shmid, IPC_RMID, 0);
+               return NULL;
+       }
+
+       xim = XShmCreateImage(ecore_x_display_get(), visual, depth, ZPixmap, NULL, &si,
+                           width, height);
+
+       if (xim == 0) {
+               shmdt(si.shmaddr);
+               shmctl(si.shmid, IPC_RMID, 0);
+
+               return NULL;
+       }
+
+       img_size = xim->bytes_per_line * xim->height;
+       xim->data = si.shmaddr;
+
+       XSync(ecore_x_display_get(), False);
+       XShmAttach(ecore_x_display_get(), &si);
+       XShmGetImage(ecore_x_display_get(), id, xim, 0, 0, 0xFFFFFFFF);
+       XSync(ecore_x_display_get(), False);
+
+       captured_img = calloc(1, img_size);
+       if (captured_img) {
+               memcpy(captured_img, xim->data, img_size);
+       } else {
+               _ERR("calloc");
+       }
+
+       XShmDetach(ecore_x_display_get(), &si);
+       XDestroyImage(xim);
+
+
+       shmdt(si.shmaddr);
+       shmctl(si.shmid, IPC_RMID, 0);
+
+       *size = img_size;
+
+       return captured_img;
+
+}
+
+#define _WND_REQUEST_ANGLE_IDX 0
+#define _WND_CURR_ANGLE_IDX    1
+int _get_angle(Ecore_X_Window win)
+{
+       int after = -1;
+       int before = -1;
+
+       do {
+               int ret, count;
+               int angle[2] = {-1, -1};
+               unsigned char* prop_data = NULL;
+
+               ret = ecore_x_window_prop_property_get(win,
+                               ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                               ECORE_X_ATOM_CARDINAL,
+                               32,
+                               &prop_data,
+                               &count);
+               if (ret <= 0) {
+                       if (prop_data) free(prop_data);
+                       break;
+               }
+
+               if (prop_data) {
+                       memcpy(&angle, prop_data, sizeof (int) *count);
+                       free(prop_data);
+               }
+
+               after= angle[_WND_REQUEST_ANGLE_IDX];
+               before = angle[_WND_CURR_ANGLE_IDX];
+       } while (0);
+
+       if (-1 == after) after = 0;
+
+       return after;
+}
+
+static void _rotate_img(Evas_Object *image_object, int angle, int cx, int cy)
+{
+       Evas_Map *em;
+
+       _ret_if(NULL == image_object);
+
+       em = evas_map_new(4);
+       _ret_if(NULL == em);
+
+       evas_map_util_points_populate_from_object(em, image_object);
+       evas_map_util_rotate(em, (double) angle, cx, cy);
+
+       evas_object_map_set(image_object, em);
+       evas_object_map_enable_set(image_object, EINA_TRUE);
+
+       evas_map_free(em);
+}
+
+#define EXTENSION_LEN 128
+#define CAPTURE_FILE_PATH "/opt/share/app_capture"
+bool _make_capture_file(const char *package, int width, int height, char *img, int angle)
+{
+       int len;
+       char *filename;
+       Evas *e;
+       Evas_Object *image_object;
+       int canvas_width, canvas_height;
+       int cx = 0, cy = 0;
+       int mx = 0;
+
+       _retv_if(NULL == package, false);
+
+       len = strlen(package) + EXTENSION_LEN;
+       filename = malloc(len);
+       _retv_if(NULL == filename, false);
+       snprintf(filename, len, CAPTURE_FILE_PATH"/%s.jpg", package);
+
+       if (90 == angle || 270 == angle) {
+               canvas_width = height;
+               canvas_height = width;
+       } else {
+               canvas_width = width;
+               canvas_height = height;
+       }
+
+       e = virtual_canvas_create(canvas_width, canvas_height);
+       goto_if(NULL == e, error);
+
+       image_object = evas_object_image_add(e);
+       goto_if(NULL == image_object, error);
+
+       evas_object_image_size_set(image_object, width, height);
+       evas_object_image_data_set(image_object, img);
+       evas_object_image_data_update_add(image_object, 0, 0, width, height);
+       evas_object_resize(image_object, width, height);
+       evas_object_image_filled_set(image_object, EINA_TRUE);
+       switch (angle) {
+               case 90:
+                       cx = canvas_width - width / 2;
+                       cy = canvas_height / 2;
+                       mx = canvas_width - width;
+                       break;
+               case 180:
+                       cx = width / 2;
+                       cy = height / 2;
+                       break;
+               case 270:
+                       cx = width / 2;
+                       cy = canvas_height / 2;
+                       break;
+               default:
+                       break;
+       }
+       evas_object_move(image_object, mx, 0);
+       _rotate_img(image_object, angle, cx, cy);
+       evas_object_show(image_object);
+
+       if (access(CAPTURE_FILE_PATH, F_OK) != 0) {
+               mkdir(CAPTURE_FILE_PATH, 0777);
+       }
+       goto_if(false == virtual_canvas_flush_to_file(e, filename, canvas_width, canvas_height), error);
+
+       evas_object_del(image_object);
+       virtual_canvas_destroy(e);
+       free(filename);
+
+       return true;
+
+error:
+       do {
+               free(filename);
+
+               if (!e) break;
+               virtual_canvas_destroy(e);
+
+               if (!image_object) break;
+               evas_object_del(image_object);
+       } while (0);
+
+       return false;
+}
+
+int __resize8888(const char* pDataIn, char* pDataOut, int inWidth, int inHeight, int outWidth, int outHeight)
+{
+       int scaleX = 0;
+       int scaleY = 0;
+       int i = 0;
+       int j = 0;
+       int iRow = 0;
+       int iIndex = 0;
+       char* pOutput = pDataOut;
+       char* pOut = pDataOut;
+       const char* pIn = NULL;
+       int *pColLUT = malloc(sizeof(int) * outWidth);
+
+       /* Calculate X Scale factor */
+       scaleX = inWidth * 256 / outWidth;
+       /* Calculate Y Scale factor, aspect ratio is not maintained */
+       scaleY = inHeight * 256 / outHeight;
+       for (j = 0; j < outWidth; j++)
+       {
+       /* Get input index based on column scale factor */
+       /* To get more optimization, this is calculated once and
+       * is placed in a LUT and used for indexing
+       */
+       pColLUT [j] = ((j * scaleX) >> 8) * 4;
+       }
+       pOut = pOutput;
+       for (i = 0; i < outHeight; i++)
+       {
+               /* Get input routWidth index based on routWidth scale factor */
+               iRow = (i * scaleY >> 8) * inWidth * 4;
+               /* Loop could be unrolled for more optimization */
+               for (j = 0; j < (outWidth); j++)
+               {
+                       /* Get input index based on column scale factor */
+                       iIndex = iRow + pColLUT [j];
+                       pIn = pDataIn + iIndex;
+                       *pOut++ = *pIn++;
+                       *pOut++ = *pIn++;
+                       *pOut++ = *pIn++;
+                       *pOut++ = *pIn++;
+               }
+       }
+
+       free(pColLUT);
+       return 0;
+}
+
+
+static void _capture_and_make_file(Ecore_X_Window win, int pid, const char *package)
+{
+       Visual *visual;
+       Window redirected_id;
+
+       int width, height, depth;
+       int width_out, height_out;
+       int size = 0;
+       int angle;
+
+       char *img;
+
+       redirected_id = _find_capture_window(win, &visual, &depth, &width, &height);
+       _ret_if(redirected_id == (Window) -1 ||
+                               redirected_id == (Window) 0);
+
+       SECURE_LOGD("Capture : win[%x] -> redirected win[%x] for %s[%d]", win, redirected_id, package, pid);
+
+       img = _capture_window(redirected_id, visual, width, height, depth, &size);
+       _ret_if(NULL == img);
+
+       width_out = width/2;
+       height_out = height/2;
+
+       if ( width_out < 1 || height_out < 1 ) {
+               free(img);
+               return;
+       }
+
+       __resize8888(img, img, width, height, width_out, height_out);
+
+       angle = _get_angle(win);
+       if (false == _make_capture_file(package, width_out, height_out, img, angle)) {
+               _ERR("cannot a capture file for the package of [%s]", package);
+       }
+
+       free(img);
+}
+
+
+EXPORT_API int appcore_efl_main(const char *name, int *argc, char ***argv,
+                               struct appcore_ops *ops)
+{
+       int r;
+       GSList *iter = NULL;
+       struct win_node *entry = NULL;
+       int pid;
+       int ret;
+
+       LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:main:done]", name);
+
+       pid = getpid();
+       aul_app_get_appid_bypid(pid, appid, APPID_MAX);
+
+       r = __set_data(&priv, name, ops);
+       _retv_if(r == -1, -1);
+
+       r = __before_loop(&priv, argc, argv);
+       if (r == -1) {
+               __unset_data(&priv);
+               return -1;
+       }
+
+       elm_run();
+
+       aul_status_update(STATUS_DYING);
+
+       for (iter = g_winnode_list; iter != NULL; iter = g_slist_next(iter)) {
+               entry = iter->data;
+               if(__check_skip(entry->win) == FALSE)
+                       break;
+       }
+       if(iter) {
+               entry = iter->data;
+               if(taskmanage) {
+                       _capture_and_make_file(entry->win, pid, appid);
+               }
+       }
+
+       __after_loop(&priv);
+
+       __unset_data(&priv);
+
+       return 0;
+}
+
+EXPORT_API int appcore_set_system_resource_reclaiming(bool enable)
+{
+       resource_reclaiming = enable;
+
+       return 0;
+}
+
+EXPORT_API int appcore_set_app_state(int state)
+{
+       priv.state = state;
+
+       return 0;
+}
diff --git a/src/appcore-i18n.c b/src/appcore-i18n.c
new file mode 100755 (executable)
index 0000000..6dc1a53
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <locale.h>
+#include <libintl.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <vconf.h>
+
+#include "appcore-internal.h"
+
+static int _set;
+
+void update_lang(void)
+{
+       char *lang;
+       char *r;
+
+       lang = vconf_get_str(VCONFKEY_LANGSET);
+       if (lang) {
+               setenv("LANG", lang, 1);
+               setenv("LC_MESSAGES", lang, 1);
+               r = setlocale(LC_ALL, "");
+               if (r == NULL) {
+                       r = setlocale(LC_ALL, vconf_get_str(VCONFKEY_LANGSET));
+                       if (r)
+                               _DBG("*****appcore setlocale=%s\n", r);
+               }
+               free(lang);
+       }
+}
+
+void update_region(void)
+{
+       char *region;
+       char *r;
+
+       region = vconf_get_str(VCONFKEY_REGIONFORMAT);
+       if (region) {
+               setenv("LC_CTYPE", region, 1);
+               setenv("LC_NUMERIC", region, 1);
+               setenv("LC_TIME", region, 1);
+               setenv("LC_COLLATE", region, 1);
+               setenv("LC_MONETARY", region, 1);
+               setenv("LC_PAPER", region, 1);
+               setenv("LC_NAME", region, 1);
+               setenv("LC_ADDRESS", region, 1);
+               setenv("LC_TELEPHONE", region, 1);
+               setenv("LC_MEASUREMENT", region, 1);
+               setenv("LC_IDENTIFICATION", region, 1);
+               r = setlocale(LC_ALL, "");
+               if (r != NULL) {
+                       _DBG("*****appcore setlocale=%s\n", r);
+               }
+               free(region);
+       }
+}
+
+static int __set_i18n(const char *domain, const char *dir)
+{
+       char *r;
+
+       if (domain == NULL) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       r = setlocale(LC_ALL, "");
+       /* if locale is not set properly, try again to set as language base */
+       if (r == NULL) {
+               r = setlocale(LC_ALL, vconf_get_str(VCONFKEY_LANGSET));
+               if (r)
+                       _DBG("*****appcore setlocale=%s\n", r);
+       }
+       if (r == NULL) {
+               _ERR("appcore: setlocale() error");
+       }
+       //_retvm_if(r == NULL, -1, "appcore: setlocale() error");
+
+       r = bindtextdomain(domain, dir);
+       if (r == NULL) {
+               _ERR("appcore: bindtextdomain() error");
+       }
+       //_retvm_if(r == NULL, -1, "appcore: bindtextdomain() error");
+
+       r = textdomain(domain);
+       if (r == NULL) {
+               _ERR("appcore: textdomain() error");
+       }
+       //_retvm_if(r == NULL, -1, "appcore: textdomain() error");
+
+       return 0;
+}
+
+
+EXPORT_API int appcore_set_i18n(const char *domainname, const char *dirname)
+{
+       int r;
+
+       update_lang();
+       update_region();
+
+       r = __set_i18n(domainname, dirname);
+       if (r == 0)
+               _set = 1;
+
+       return r;
+}
+
+int set_i18n(const char *domainname, const char *dirname)
+{
+       _retv_if(_set, 0);
+
+       update_lang();
+       update_region();
+
+       return __set_i18n(domainname, dirname);
+}
+
+EXPORT_API int appcore_get_timeformat(enum appcore_time_format *timeformat)
+{
+       int r;
+
+       if (timeformat == NULL) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       r = vconf_get_int(VCONFKEY_REGIONFORMAT_TIME1224, (int *)timeformat);
+
+       if (r < 0) {
+               *timeformat = APPCORE_TIME_FORMAT_UNKNOWN;
+               return -1;
+       } else
+               return 0;
+}
diff --git a/src/appcore-measure.c b/src/appcore-measure.c
new file mode 100755 (executable)
index 0000000..aa379fd
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <sys/time.h>
+
+#include "appcore-internal.h"
+
+static struct timeval tv_s;    /* measure start */
+
+static inline int __get_msec(struct timeval *s, struct timeval *e)
+{
+       return (e->tv_sec - s->tv_sec) * 1000 +
+           (e->tv_usec - s->tv_usec + 500) / 1000;
+}
+
+static int __get_time(struct timeval *s)
+{
+       struct timeval t;
+
+       _retv_if(s == NULL || (s->tv_sec == 0 && s->tv_usec == 0), 0);
+
+       gettimeofday(&t, NULL);
+
+       return __get_msec(s, &t);
+}
+
+static int __get_envtime(const char *name, struct timeval *t)
+{
+       int r;
+       char *s;
+
+       s = getenv(name ? : ENV_START);
+       /*_retvm_if(s == NULL, -1, "%s is not set", name);*/
+       _retv_if(s == NULL, -1);
+
+       r = sscanf(s, "%u/%u", (int *)&t->tv_sec, (int *)&t->tv_usec);
+       if (r != 2)
+               r = sscanf(s, "%u %u", (int *)&t->tv_sec, (int *)&t->tv_usec);
+
+       _retv_if(r != 2, -1);
+
+       return 0;
+}
+
+static int __get_time_from(const char *name)
+{
+       int r;
+       struct timeval s;
+       struct timeval t;
+
+       gettimeofday(&t, NULL);
+
+       r = __get_envtime(name, &s);
+       _retv_if(r == -1, 0);
+
+       return __get_msec(&s, &t);
+}
+
+EXPORT_API int appcore_measure_time_from(const char *envnm)
+{
+       return __get_time_from(envnm);
+}
+
+EXPORT_API int appcore_measure_time(void)
+{
+       return __get_time(&tv_s);
+}
+
+EXPORT_API void appcore_measure_start(void)
+{
+       gettimeofday(&tv_s, NULL);
+}
diff --git a/src/appcore-noti.c b/src/appcore-noti.c
new file mode 100755 (executable)
index 0000000..c3af2aa
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <heynoti.h>
+
+#include "appcore-internal.h"
+
+#define NOTI_COMP(a, b) (strcmp(a->name, b->name))
+
+struct noti_s {
+       const char *name;
+       void *data;
+       int (*cb_pre) (void *);
+       int (*cb) (void *);
+       int (*cb_post) (void *);
+
+       struct noti_s *next;
+};
+typedef struct noti_s notis;
+
+
+SGLIB_DEFINE_LIST_PROTOTYPES(notis, NOTI_COMP, next);
+SGLIB_DEFINE_LIST_FUNCTIONS(notis, NOTI_COMP, next);
+
+static struct noti_s *noti_h;
+
+static void __main_handle(void *data)
+{
+       struct noti_s *n = data;
+
+       _ret_if(n == NULL || n->name == NULL);
+
+       _DBG("[APP %d] noti: %s", getpid(), n->name);
+
+       if (n->cb_pre)
+               n->cb_pre(n->data);
+
+       if (n->cb)
+               n->cb(n->data);
+
+       if (n->cb_post)
+               n->cb_post(n->data);
+}
+
+static int __del_noti(int fd, struct noti_s *t)
+{
+       int r;
+
+       r = heynoti_unsubscribe(fd, t->name, __main_handle);
+       if (r == 0) {
+               sglib_notis_delete(&noti_h, t);
+               free((void *)t->name);
+               free(t);
+       }
+
+       return r;
+}
+
+static int __del_notis(int fd)
+{
+       struct sglib_notis_iterator it;
+       struct noti_s *t;
+
+       t = sglib_notis_it_init(&it, noti_h);
+       while (t) {
+               __del_noti(fd, t);
+               t = sglib_notis_it_next(&it);
+       }
+
+       return 0;
+}
+
+int add_noti(int fd, const char *name, int (*cb_pre) (void *),
+            int (*cb) (void *), int (*cb_post) (void *), void *data)
+{
+       int r;
+       struct noti_s *t;
+
+       if (fd < 0) {
+               errno = EBADF;
+               return -1;
+       }
+
+       if (name == NULL || name[0] == '\0') {
+               errno = EINVAL;
+               return -1;
+       }
+
+       t = calloc(1, sizeof(struct noti_s));
+       if (t == NULL)
+               return -1;
+
+       t->name = strdup(name);
+       if (t->name == NULL) {
+               free(t);
+               return -1;
+       }
+
+       t->cb_pre = cb_pre;
+       t->cb = cb;
+       t->cb_post = cb_post;
+       t->data = data;
+
+       r = heynoti_subscribe(fd, name, __main_handle, t);
+       if (r != 0) {
+               free((void *)t->name);
+               free(t);
+               return -1;
+       }
+
+       sglib_notis_add(&noti_h, t);
+
+       return r;
+}
+
+int del_noti(int fd, const char *name)
+{
+       struct noti_s t;
+       struct noti_s *f;
+
+       if (fd < 0) {
+               errno = EBADF;
+               return -1;
+       }
+
+       t.name = name;
+       f = sglib_notis_find_member(noti_h, &t);
+       if (f == NULL) {
+               errno = ENOENT;
+               return -1;
+       }
+
+       return __del_noti(fd, f);
+}
+
+int noti_start(int fd)
+{
+       return heynoti_attach_handler(fd);
+}
+
+int noti_init(void)
+{
+       return heynoti_init();
+}
+
+void noti_exit(int *fd)
+{
+       _ret_if(fd == NULL || *fd < 0);
+
+       __del_notis(*fd);
+
+       heynoti_close(*fd);
+
+       *fd = -1;
+}
diff --git a/src/appcore-pmcontrol.c b/src/appcore-pmcontrol.c
new file mode 100755 (executable)
index 0000000..b2c02bb
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <pmapi.h>
+
+#include "appcore-internal.h"
+
+EXPORT_API int appcore_lock_power_state(int s_bits)
+{
+       switch (s_bits) {
+       case LCD_NORMAL:
+               return pm_lock_state(s_bits, GOTO_STATE_NOW, 0);
+
+       case LCD_DIM:
+               if (pm_lock_state(s_bits, STAY_CUR_STATE, 0) < 0)
+                       return -1;
+               return pm_change_state(LCD_NORMAL);
+
+       case LCD_OFF:
+               return pm_lock_state(s_bits, STAY_CUR_STATE, 0);
+
+       default:
+               break;
+       }
+
+       return -1;
+}
+
+EXPORT_API int appcore_unlock_power_state(int s_bits)
+{
+       return pm_unlock_state(s_bits, STAY_CUR_STATE);
+}
diff --git a/src/appcore-rotation.c b/src/appcore-rotation.c
new file mode 100755 (executable)
index 0000000..5c493d4
--- /dev/null
@@ -0,0 +1,418 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sensor.h>
+#include <vconf.h>
+#include <Ecore_X.h>
+#include <Ecore.h>
+#include <X11/Xlib.h>
+
+#include "appcore-internal.h"
+
+#define _MAKE_ATOM(a, s)                              \
+   do {                                               \
+        a = ecore_x_atom_get(s);                      \
+        if (!a)                                       \
+          _ERR("##s creation failed.\n");             \
+   } while(0)
+
+#define STR_ATOM_ROTATION_LOCK                "_E_ROTATION_LOCK"
+
+static Ecore_X_Atom ATOM_ROTATION_LOCK = 0;
+static Ecore_X_Window root;
+
+struct rot_s {
+       int handle;
+       int (*callback) (enum appcore_rm, void *);
+       enum appcore_rm mode;
+       int lock;
+       void *cbdata;
+       int cb_set;
+       int sf_started;
+
+       struct ui_wm_rotate* wm_rotate;
+};
+static struct rot_s rot;
+
+struct rot_evt {
+       enum accelerometer_rotate_state re;
+       enum appcore_rm rm;
+};
+
+static struct rot_evt re_to_rm[] = {
+       {
+        ROTATION_EVENT_0,
+         APPCORE_RM_PORTRAIT_NORMAL,
+       },
+       {
+        ROTATION_EVENT_90,
+        APPCORE_RM_LANDSCAPE_NORMAL,
+       },
+       {
+        ROTATION_EVENT_180,
+        APPCORE_RM_PORTRAIT_REVERSE,
+       },
+       {
+        ROTATION_EVENT_270,
+        APPCORE_RM_LANDSCAPE_REVERSE,
+       },
+};
+
+static enum appcore_rm __get_mode(int event_data)
+{
+       int i;
+       enum appcore_rm m;
+
+       m = APPCORE_RM_UNKNOWN;
+
+       for (i = 0; i < sizeof(re_to_rm) / sizeof(re_to_rm[0]); i++) {
+               if (re_to_rm[i].re == event_data) {
+                       m = re_to_rm[i].rm;
+                       break;
+               }
+       }
+
+       return m;
+}
+
+static void __changed_cb(unsigned int event_type, sensor_event_data_t *event,
+                      void *data)
+{
+       int *cb_event_data;
+       enum appcore_rm m;
+       int ret;
+
+       if (rot.lock)
+               return;
+
+       if (event_type != ACCELEROMETER_EVENT_ROTATION_CHECK) {
+               errno = EINVAL;
+               return;
+       }
+
+       cb_event_data = (int *)(event->event_data);
+
+       m = __get_mode(*cb_event_data);
+
+       _DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m);
+
+       if (rot.callback) {
+               if (rot.cb_set && rot.mode != m) {
+                       _DBG("[APP %d] Rotation: %d -> %d", getpid(), rot.mode, m);
+                       rot.callback(m, data);
+                       rot.mode = m;
+               }
+       }
+}
+
+static void __lock_cb(keynode_t *node, void *data)
+{
+       int r;
+       enum appcore_rm m;
+       int ret;
+
+       rot.lock = !vconf_keynode_get_bool(node);
+
+       if (rot.lock) {
+               m = APPCORE_RM_PORTRAIT_NORMAL;
+               if (rot.mode != m) {
+                       rot.callback(m, data);
+                       rot.mode = m;
+               }
+               _DBG("[APP %d] Rotation locked", getpid());
+               return;
+       }
+
+       _DBG("[APP %d] Rotation unlocked", getpid());
+       if (rot.callback) {
+               if (rot.cb_set) {
+                       r = appcore_get_rotation_state(&m);
+                       _DBG("[APP %d] Rotmode prev %d -> curr %d", getpid(),
+                            rot.mode, m);
+                       if (!r && rot.mode != m) {
+                               rot.callback(m, data);
+                               rot.mode = m;
+                       }
+               }
+       }
+}
+
+static void __add_rotlock(void *data)
+{
+       int r;
+       int lock;
+
+       lock = 0;
+       r = vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &lock);
+       if (r) {
+               _DBG("[APP %d] Rotation vconf get bool failed", getpid());
+       }
+
+       rot.lock = !lock;
+
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, __lock_cb,
+                                data);
+}
+
+static void __del_rotlock(void)
+{
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, __lock_cb);
+       rot.lock = 0;
+}
+
+EXPORT_API int appcore_set_rotation_cb(int (*cb) (enum appcore_rm, void *),
+                                      void *data)
+{
+       if (rot.wm_rotate) {
+               return rot.wm_rotate->set_rotation_cb(cb, data);
+       }
+       else {
+               int r;
+               int handle;
+
+               if (cb == NULL) {
+                       errno = EINVAL;
+                       return -1;
+               }
+
+               if (rot.callback != NULL) {
+                       errno = EALREADY;
+                       return -1;
+               }
+
+               handle = sf_connect(ACCELEROMETER_SENSOR);
+               if (handle < 0) {
+                       _ERR("sf_connect failed: %d", handle);
+                       return -1;
+               }
+
+               r = sf_register_event(handle, ACCELEROMETER_EVENT_ROTATION_CHECK,
+                                     NULL, __changed_cb, data);
+               if (r < 0) {
+                       _ERR("sf_register_event failed: %d", r);
+                       sf_disconnect(handle);
+                       return -1;
+               }
+
+               rot.cb_set = 1;
+               rot.callback = cb;
+               rot.cbdata = data;
+
+               r = sf_start(handle, 0);
+               if (r < 0) {
+                       _ERR("sf_start failed: %d", r);
+                       r = sf_unregister_event(handle, ACCELEROMETER_EVENT_ROTATION_CHECK);
+                       if (r < 0) {
+                               _ERR("sf_unregister_event failed: %d", r);
+                       }
+                       rot.callback = NULL;
+                       rot.cbdata = NULL;
+                       rot.cb_set = 0;
+                       rot.sf_started = 0;
+                       sf_disconnect(handle);
+                       return -1;
+               }
+               rot.sf_started = 1;
+
+               rot.handle = handle;
+               __add_rotlock(data);
+
+               _MAKE_ATOM(ATOM_ROTATION_LOCK, STR_ATOM_ROTATION_LOCK );
+               root =  ecore_x_window_root_first_get();
+               XSelectInput(ecore_x_display_get(), root, PropertyChangeMask);
+       }
+       return 0;
+}
+
+EXPORT_API int appcore_unset_rotation_cb(void)
+{
+       if (rot.wm_rotate) {
+               return rot.wm_rotate->unset_rotation_cb();
+       }
+       else {
+               int r;
+
+               _retv_if(rot.callback == NULL, 0);
+
+               __del_rotlock();
+
+               if (rot.cb_set) {
+                       r = sf_unregister_event(rot.handle,
+                                               ACCELEROMETER_EVENT_ROTATION_CHECK);
+                       if (r < 0) {
+                               _ERR("sf_unregister_event failed: %d", r);
+                               return -1;
+                       }
+                       rot.cb_set = 0;
+               }
+               rot.callback = NULL;
+               rot.cbdata = NULL;
+
+               if (rot.sf_started == 1) {
+                       r = sf_stop(rot.handle);
+                       if (r < 0) {
+                               _ERR("sf_stop failed: %d", r);
+                               return -1;
+                       }
+                       rot.sf_started = 0;
+               }
+
+               r = sf_disconnect(rot.handle);
+               if (r < 0) {
+                       _ERR("sf_disconnect failed: %d", r);
+                       return -1;
+               }
+               rot.handle = -1;
+       }
+       return 0;
+}
+
+EXPORT_API int appcore_get_rotation_state(enum appcore_rm *curr)
+{
+       if (rot.wm_rotate) {
+               return rot.wm_rotate->get_rotation_state(curr);
+       }
+       else {
+               int r;
+               unsigned long event;
+
+               if (curr == NULL) {
+                       errno = EINVAL;
+                       return -1;
+               }
+
+               r = sf_check_rotation(&event);
+               if (r < 0) {
+                       _ERR("sf_check_rotation failed: %d", r);
+                       *curr = APPCORE_RM_UNKNOWN;
+                       return -1;
+               }
+
+               *curr = __get_mode(event);
+       }
+       return 0;
+}
+
+EXPORT_API int appcore_pause_rotation_cb(void)
+{
+       if (rot.wm_rotate) {
+               return rot.wm_rotate->pause_rotation_cb();
+       }
+       else {
+               int r;
+
+               _retv_if(rot.callback == NULL, 0);
+               _DBG("[APP %d] appcore_pause_rotation_cb is called", getpid());
+
+               __del_rotlock();
+
+               if (rot.cb_set) {
+                       r = sf_unregister_event(rot.handle,
+                                               ACCELEROMETER_EVENT_ROTATION_CHECK);
+                       if (r < 0) {
+                               _ERR("sf_unregister_event in appcore_internal_sf_stop failed: %d", r);
+                               return -1;
+                       }
+                       rot.cb_set = 0;
+               }
+
+               if (rot.sf_started == 1) {
+                       r = sf_stop(rot.handle);
+                       if (r < 0) {
+                               _ERR("sf_stop in appcore_internal_sf_stop failed: %d",
+                                    r);
+                               return -1;
+                       }
+                       rot.sf_started = 0;
+               }
+       }
+
+       return 0;
+}
+
+EXPORT_API int appcore_resume_rotation_cb(void)
+{
+       if (rot.wm_rotate) {
+               return rot.wm_rotate->resume_rotation_cb();
+       }
+       else {
+               int r;
+               enum appcore_rm m;
+
+               _retv_if(rot.callback == NULL, 0);
+               _DBG("[APP %d] appcore_resume_rotation_cb is called", getpid());
+
+               if (rot.cb_set == 0) {
+                       r = sf_register_event(rot.handle,
+                                             ACCELEROMETER_EVENT_ROTATION_CHECK, NULL,
+                                             __changed_cb, rot.cbdata);
+                       if (r < 0) {
+                               _ERR("sf_register_event in appcore_internal_sf_start failed: %d", r);
+                               return -1;
+                       }
+                       rot.cb_set = 1;
+               }
+
+               if (rot.sf_started == 0) {
+                       r = sf_start(rot.handle, 0);
+                       if (r < 0) {
+                               _ERR("sf_start in appcore_internal_sf_start failed: %d",
+                                    r);
+                               r = sf_unregister_event(rot.handle,
+                                                   ACCELEROMETER_EVENT_ROTATION_CHECK);
+                               if (r < 0) {
+                                       _ERR("sf_unregister_event failed: %d", r);
+                               }
+                               rot.cb_set = 0;
+                               return -1;
+                       }
+                       rot.sf_started = 1;
+               }
+
+               __add_rotlock(rot.cbdata);
+
+               r = appcore_get_rotation_state(&m);
+               _DBG("[APP %d] Rotmode prev %d -> curr %d", getpid(), rot.mode, m);
+               if (!r && rot.mode != m && rot.lock == 0) {
+                       rot.callback(m, rot.cbdata);
+                       rot.mode = m;
+               }
+       }
+       return 0;
+}
+
+EXPORT_API int appcore_set_wm_rotation(struct ui_wm_rotate* wm_rotate)
+{
+       if (!wm_rotate) return -1;
+
+       if (rot.callback) {
+               wm_rotate->set_rotation_cb(rot.callback, rot.cbdata);
+               appcore_unset_rotation_cb();
+       }
+       rot.wm_rotate = wm_rotate;
+       _DBG("[APP %d] Support wm rotate:%p", getpid(), wm_rotate);
+       return 0;
+}
diff --git a/src/appcore-util.c b/src/appcore-util.c
new file mode 100755 (executable)
index 0000000..8d175bc
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <unistd.h>
+#include <string.h>
+
+#include <sys/mman.h>
+
+#include "appcore-internal.h"
+
+#define GETSP() ({ unsigned int sp; asm volatile ("mov %0,sp " : "=r"(sp) ); sp;})
+#define BUF_SIZE                               256
+#define PAGE_SIZE                      (1 << 12)
+#define _ALIGN_UP(addr , size)    (((addr)+((size)-1))&(~((size)-1)))
+#define _ALIGN_DOWN(addr , size)  ((addr)&(~((size)-1)))
+#define PAGE_ALIGN(addr)        _ALIGN_DOWN(addr, PAGE_SIZE)
+
+void stack_trim(void)
+{
+       unsigned int sp;
+       char buf[BUF_SIZE];
+       FILE *file;
+       unsigned int stacktop;
+       int found = 0;
+
+       sp = GETSP();
+
+       sprintf(buf, "/proc/%d/maps", getpid());
+       file = fopen(buf, "r");
+       while (fgets(buf, BUF_SIZE, file) != NULL) {
+               if (strstr(buf, "[stack]")) {
+                       found = 1;
+                       break;
+               }
+       }
+       fclose(file);
+
+       if (found) {
+               sscanf(buf, "%x-", &stacktop);
+               if (madvise
+                   ((void *)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp) - stacktop,
+                    MADV_DONTNEED) < 0)
+                       perror("stack madvise fail");
+       }
+}
diff --git a/src/appcore.c b/src/appcore.c
new file mode 100755 (executable)
index 0000000..c9ae214
--- /dev/null
@@ -0,0 +1,563 @@
+/*
+ *  app-core
+ *
+ * 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>
+ *
+ * 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 <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <locale.h>
+#include <linux/limits.h>
+#include <glib.h>
+#include <sys/time.h>
+#include <dlfcn.h>
+#include <vconf.h>
+#include <aul.h>
+#include "appcore-internal.h"
+
+#define SQLITE_FLUSH_MAX               (1024*1024)
+
+#define PKGNAME_MAX 256
+#define PATH_APP_ROOT "/opt/usr/apps"
+#define PATH_RO_APP_ROOT "/usr/apps"
+#define PATH_RES "/res"
+#define PATH_LOCALE "/locale"
+
+static struct appcore core;
+static pid_t _pid;
+char caller_appid[APPID_MAX];
+
+static enum appcore_event to_ae[SE_MAX] = {
+       APPCORE_EVENT_UNKNOWN,  /* SE_UNKNOWN */
+       APPCORE_EVENT_LOW_MEMORY,       /* SE_LOWMEM */
+       APPCORE_EVENT_LOW_BATTERY,      /* SE_LOWBAT */
+       APPCORE_EVENT_LANG_CHANGE,      /* SE_LANGCGH */
+       APPCORE_EVENT_REGION_CHANGE,
+};
+
+
+enum cb_type {                 /* callback */
+       _CB_NONE,
+       _CB_SYSNOTI,
+       _CB_APPNOTI,
+       _CB_VCONF,
+};
+
+struct evt_ops {
+       enum cb_type type;
+       union {
+               enum appcore_event sys;
+               enum app_event app;
+               const char *vkey;
+       } key;
+
+       int (*cb_pre) (void *);
+       int (*cb) (void *);
+       int (*cb_post) (void *);
+
+       int (*vcb_pre) (void *, void *);
+       int (*vcb) (void *, void *);
+       int (*vcb_post) (void *, void *);
+};
+
+struct open_s {
+       int (*callback) (void *);
+       void *cbdata;
+};
+
+static struct open_s open;
+
+static int __app_terminate(void *data);
+static int __app_resume(void *data);
+static int __app_reset(void *data, bundle *k);
+
+static int __sys_lowmem_post(void *data, void *evt);
+static int __sys_lowmem(void *data, void *evt);
+static int __sys_lowbatt(void *data, void *evt);
+static int __sys_langchg_pre(void *data, void *evt);
+static int __sys_langchg(void *data, void *evt);
+static int __sys_regionchg_pre(void *data, void *evt);
+static int __sys_regionchg(void *data, void *evt);
+extern void aul_finalize();
+
+
+static struct evt_ops evtops[] = {
+       {
+        .type = _CB_VCONF,
+        .key.vkey = VCONFKEY_SYSMAN_LOW_MEMORY,
+        .vcb_post = __sys_lowmem_post,
+        .vcb = __sys_lowmem,
+        },
+       {
+        .type = _CB_VCONF,
+        .key.vkey = VCONFKEY_SYSMAN_BATTERY_STATUS_LOW,
+        .vcb = __sys_lowbatt,
+        },
+       {
+        .type = _CB_VCONF,
+        .key.vkey = VCONFKEY_LANGSET,
+        .vcb_pre = __sys_langchg_pre,
+        .vcb = __sys_langchg,
+        },
+       {
+        .type = _CB_VCONF,
+        .key.vkey = VCONFKEY_REGIONFORMAT,
+        .vcb_pre = __sys_regionchg_pre,
+        .vcb = __sys_regionchg,
+        },
+       {
+        .type = _CB_VCONF,
+        .key.vkey = VCONFKEY_REGIONFORMAT_TIME1224,
+        .vcb = __sys_regionchg,
+        },
+};
+
+static int __get_dir_name(char *dirname)
+{
+       char pkg_name[PKGNAME_MAX];
+       int r;
+       int pid;
+
+       pid = getpid();
+       if (pid < 0)
+               return -1;
+
+       if (aul_app_get_pkgname_bypid(pid, pkg_name, PKGNAME_MAX) != AUL_R_OK)
+               return -1;
+
+       r = snprintf(dirname, PATH_MAX, PATH_APP_ROOT "/%s" PATH_RES PATH_LOCALE,pkg_name);
+       if (r < 0)
+               return -1;
+       if (access(dirname, R_OK) == 0) return 0;
+       r = snprintf(dirname, PATH_MAX, PATH_RO_APP_ROOT "/%s" PATH_RES PATH_LOCALE,pkg_name);
+       if (r < 0)
+               return -1;
+
+       return 0;
+}
+
+static int __app_terminate(void *data)
+{
+       struct appcore *ac = data;
+
+       _retv_if(ac == NULL || ac->ops == NULL, -1);
+       _retv_if(ac->ops->cb_app == NULL, 0);
+
+       ac->ops->cb_app(AE_TERMINATE, ac->ops->data, NULL);
+
+       return 0;
+}
+
+static gboolean __prt_ltime(gpointer data)
+{
+       int msec;
+
+       msec = appcore_measure_time_from(NULL);
+       if (msec)
+               _DBG("[APP %d] first idle after reset: %d msec", _pid, msec);
+
+       return FALSE;
+}
+
+static int __app_reset(void *data, bundle * k)
+{
+       struct appcore *ac = data;
+       _retv_if(ac == NULL || ac->ops == NULL, -1);
+       _retv_if(ac->ops->cb_app == NULL, 0);
+
+       g_idle_add(__prt_ltime, ac);
+
+       ac->ops->cb_app(AE_RESET, ac->ops->data, k);
+
+       return 0;
+}
+
+static int __app_resume(void *data)
+{
+       x_raise_win(getpid());
+       return 0;
+}
+
+static int __sys_do_default(struct appcore *ac, enum sys_event event)
+{
+       int r;
+
+       switch (event) {
+       case SE_LOWBAT:
+               /*r = __def_lowbatt(ac);*/
+               r = 0;
+               break;
+       default:
+               r = 0;
+               break;
+       };
+
+       return r;
+}
+
+static int __sys_do(struct appcore *ac, enum sys_event event)
+{
+       struct sys_op *op;
+
+       _retv_if(ac == NULL || event >= SE_MAX, -1);
+
+       op = &ac->sops[event];
+
+       if (op->func == NULL)
+               return __sys_do_default(ac, event);
+
+       return op->func(op->data);
+}
+
+static int __sys_lowmem_post(void *data, void *evt)
+{
+       keynode_t *key = evt;
+       int val;
+
+       val = vconf_keynode_get_int(key);
+
+       if (val >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING)     {
+#if defined(MEMORY_FLUSH_ACTIVATE)
+               struct appcore *ac = data;
+               ac->ops->cb_app(AE_LOWMEM_POST, ac->ops->data, NULL);
+#else
+               malloc_trim(0);
+#endif
+       }
+       return 0;
+}
+
+static int __sys_lowmem(void *data, void *evt)
+{
+       keynode_t *key = evt;
+       int val;
+
+       val = vconf_keynode_get_int(key);
+
+       if (val >= VCONFKEY_SYSMAN_LOW_MEMORY_SOFT_WARNING)
+               return __sys_do(data, SE_LOWMEM);
+
+       return 0;
+}
+
+static int __sys_lowbatt(void *data, void *evt)
+{
+       keynode_t *key = evt;
+       int val;
+
+       val = vconf_keynode_get_int(key);
+
+       /* VCONFKEY_SYSMAN_BAT_CRITICAL_LOW or VCONFKEY_SYSMAN_POWER_OFF */
+       if (val <= VCONFKEY_SYSMAN_BAT_CRITICAL_LOW)
+               return __sys_do(data, SE_LOWBAT);
+
+       return 0;
+}
+
+static int __sys_langchg_pre(void *data, void *evt)
+{
+       update_lang();
+       return 0;
+}
+
+static int __sys_langchg(void *data, void *evt)
+{
+       return __sys_do(data, SE_LANGCHG);
+}
+
+static int __sys_regionchg_pre(void *data, void *evt)
+{
+       update_region();
+       return 0;
+}
+
+static int __sys_regionchg(void *data, void *evt)
+{
+       return __sys_do(data, SE_REGIONCHG);
+}
+
+static void __vconf_do(struct evt_ops *eo, keynode_t * key, void *data)
+{
+       _ret_if(eo == NULL);
+
+       if (eo->vcb_pre)
+               eo->vcb_pre(data, key);
+
+       if (eo->vcb)
+               eo->vcb(data, key);
+
+       if (eo->vcb_post)
+               eo->vcb_post(data, key);
+}
+
+static void __vconf_cb(keynode_t *key, void *data)
+{
+       int i;
+       const char *name;
+
+       name = vconf_keynode_get_name(key);
+       _ret_if(name == NULL);
+
+       _DBG("[APP %d] vconf changed: %s", _pid, name);
+
+       for (i = 0; i < sizeof(evtops) / sizeof(evtops[0]); i++) {
+               struct evt_ops *eo = &evtops[i];
+
+               switch (eo->type) {
+               case _CB_VCONF:
+                       if (!strcmp(name, eo->key.vkey))
+                               __vconf_do(eo, key, data);
+                       break;
+               default:
+                       /* do nothing */
+                       break;
+               }
+       }
+}
+
+static int __add_vconf(struct appcore *ac)
+{
+       int i;
+       int r;
+
+       for (i = 0; i < sizeof(evtops) / sizeof(evtops[0]); i++) {
+               struct evt_ops *eo = &evtops[i];
+
+               switch (eo->type) {
+               case _CB_VCONF:
+                       r = vconf_notify_key_changed(eo->key.vkey, __vconf_cb,
+                                                    ac);
+                       break;
+               default:
+                       /* do nothing */
+                       break;
+               }
+       }
+
+       return 0;
+}
+
+static int __del_vconf(void)
+{
+       int i;
+       int r;
+
+       for (i = 0; i < sizeof(evtops) / sizeof(evtops[0]); i++) {
+               struct evt_ops *eo = &evtops[i];
+
+               switch (eo->type) {
+               case _CB_VCONF:
+                       r = vconf_ignore_key_changed(eo->key.vkey, __vconf_cb);
+                       break;
+               default:
+                       /* do nothing */
+                       break;
+               }
+       }
+
+       return 0;
+}
+
+static int __aul_handler(aul_type type, bundle *b, void *data)
+{
+       int ret;
+       char *str = NULL;
+
+       switch (type) {
+       case AUL_START:
+               _DBG("[APP %d]     AUL event: AUL_START", _pid);
+               __app_reset(data, b);
+               str = bundle_get_val(b, AUL_K_CALLER_APPID);
+               SECURE_LOGD("caller_appid : %s", str);
+               if(str) {
+                       strncpy(caller_appid, str, APPID_MAX-1);
+                       caller_appid[APPID_MAX-1] = '\0';
+               }
+               break;
+       case AUL_RESUME:
+               _DBG("[APP %d]     AUL event: AUL_RESUME", _pid);
+               if(open.callback) {
+                       ret = open.callback(open.cbdata);
+                       if (ret == 0)
+                               __app_resume(data);
+               } else {
+                       __app_resume(data);
+               }
+               break;
+       case AUL_TERMINATE:
+               _DBG("[APP %d]     AUL event: AUL_TERMINATE", _pid);
+               __app_terminate(data);
+               break;
+       default:
+               _DBG("[APP %d]     AUL event: %d", _pid, type);
+               /* do nothing */
+               break;
+       }
+
+       return 0;
+}
+
+
+static void __clear(struct appcore *ac)
+{
+       memset(ac, 0, sizeof(struct appcore));
+}
+
+EXPORT_API char *appcore_get_caller_appid()
+{
+       return caller_appid;
+}
+
+EXPORT_API int appcore_set_open_cb(int (*cb) (void *),
+                                      void *data)
+{
+       open.callback = cb;
+       open.cbdata = data;
+
+       return 0;
+}
+
+EXPORT_API int appcore_set_event_callback(enum appcore_event event,
+                                         int (*cb) (void *), void *data)
+{
+       struct appcore *ac = &core;
+       struct sys_op *op;
+       enum sys_event se;
+
+       for (se = SE_UNKNOWN; se < SE_MAX; se++) {
+               if (event == to_ae[se])
+                       break;
+       }
+
+       if (se == SE_UNKNOWN || se >= SE_MAX) {
+               _ERR("Unregistered event");
+               errno = EINVAL;
+               return -1;
+       }
+
+       op = &ac->sops[se];
+
+       op->func = cb;
+       op->data = data;
+
+       return 0;
+}
+
+
+
+EXPORT_API int appcore_init(const char *name, const struct ui_ops *ops,
+                           int argc, char **argv)
+{
+       int r;
+       char dirname[PATH_MAX];
+
+       if (core.state != 0) {
+               _ERR("Already in use");
+               errno = EALREADY;
+               return -1;
+       }
+
+       if (ops == NULL || ops->cb_app == NULL) {
+               _ERR("ops or callback function is null");
+               errno = EINVAL;
+               return -1;
+       }
+
+       r = __get_dir_name(dirname);
+       r = set_i18n(name, dirname);
+       _retv_if(r == -1, -1);
+
+       r = __add_vconf(&core);
+       if (r == -1) {
+               _ERR("Add vconf callback failed");
+               goto err;
+       }
+
+       r = aul_launch_init(__aul_handler, &core);
+       if (r < 0) {
+               _ERR("Aul init failed: %d", r);
+               goto err;
+       }
+
+       r = aul_launch_argv_handler(argc, argv);
+       if (r < 0) {
+               _ERR("Aul argv handler failed: %d", r);
+               goto err;
+       }
+
+       core.ops = ops;
+       core.state = 1;         /* TODO: use enum value */
+
+       _pid = getpid();
+
+       return 0;
+ err:
+       __del_vconf();
+       __clear(&core);
+       return -1;
+}
+
+EXPORT_API void appcore_exit(void)
+{
+       if (core.state) {
+               __del_vconf();
+               __clear(&core);
+       }
+       aul_finalize();
+}
+
+EXPORT_API int appcore_flush_memory(void)
+{
+       int (*flush_fn) (int);
+       int size = 0;
+
+       struct appcore *ac = &core;
+
+       if (!core.state) {
+               _ERR("Appcore not initialized");
+               return -1;
+       }
+
+       //_DBG("[APP %d] Flushing memory ...", _pid);
+
+       if (ac->ops->cb_app) {
+               ac->ops->cb_app(AE_MEM_FLUSH, ac->ops->data, NULL);
+       }
+
+       flush_fn = dlsym(RTLD_DEFAULT, "sqlite3_release_memory");
+       if (flush_fn) {
+               size = flush_fn(SQLITE_FLUSH_MAX);
+       }
+
+       malloc_trim(0);
+       /*
+       *Disabled - the impact of stack_trim() is unclear
+       *stack_trim();
+       */
+
+       //_DBG("[APP %d] Flushing memory DONE", _pid);
+
+       return 0;
+}
diff --git a/src/virtual_canvas.c b/src/virtual_canvas.c
new file mode 100755 (executable)
index 0000000..3b8308f
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ *  starter
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@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 <Elementary.h>
+#include <Ecore_Evas.h>
+#include <Ecore_X.h>
+
+#include "appcore-internal.h"
+#include "virtual_canvas.h"
+
+
+#define QUALITY_N_COMPRESS "quality=100 compress=1"
+
+
+
+Evas *virtual_canvas_create(int w, int h)
+{
+       Ecore_Evas *internal_ee;
+       Evas *internal_e;
+
+       // Create virtual canvas
+       internal_ee = ecore_evas_buffer_new(w, h);
+       if (!internal_ee) {
+               _DBG("Failed to create a new canvas buffer\n");
+               return NULL;
+       }
+
+       ecore_evas_alpha_set(internal_ee, EINA_TRUE);
+       ecore_evas_manual_render_set(internal_ee, EINA_TRUE);
+
+       // Get the "Evas" object from a virtual canvas
+       internal_e = ecore_evas_get(internal_ee);
+       if (!internal_e) {
+               ecore_evas_free(internal_ee);
+               _DBG("Faield to get Evas object\n");
+               return NULL;
+       }
+
+       return internal_e;
+}
+
+
+
+static bool _flush_data_to_file(Evas *e, char *data, const char *filename, int w, int h)
+{
+       Evas_Object *output;
+
+       output = evas_object_image_add(e);
+       if (!output) {
+               _DBG("Failed to create an image object\n");
+               return false;
+       }
+
+       evas_object_image_data_set(output, NULL);
+       evas_object_image_colorspace_set(output, EVAS_COLORSPACE_ARGB8888);
+       evas_object_image_alpha_set(output, EINA_TRUE);
+       evas_object_image_size_set(output, w, h);
+       evas_object_image_smooth_scale_set(output, EINA_TRUE);
+       evas_object_image_data_set(output, data);
+       evas_object_image_data_update_add(output, 0, 0, w, h);
+
+       if (evas_object_image_save(output, filename, NULL, QUALITY_N_COMPRESS) == EINA_FALSE) {
+               evas_object_del(output);
+               _DBG("Faild to save a captured image (%s)\n", filename);
+               return false;
+       }
+
+       evas_object_del(output);
+
+       if (access(filename, F_OK) != 0) {
+               _DBG("File %s is not found\n", filename);
+               return false;
+       }
+
+       return true;
+}
+
+
+
+bool virtual_canvas_flush_to_file(Evas *e, const char *filename, int w, int h)
+{
+       void *data;
+       Ecore_Evas *internal_ee;
+
+       internal_ee = ecore_evas_ecore_evas_get(e);
+       if (!internal_ee) {
+               _DBG("Failed to get ecore evas\n");
+               return false;
+       }
+
+       ecore_evas_manual_render(internal_ee);
+
+       // Get a pointer of a buffer of the virtual canvas
+       data = (void *) ecore_evas_buffer_pixels_get(internal_ee);
+       if (!data) {
+               _DBG("Failed to get pixel data\n");
+               return false;
+       }
+
+       return _flush_data_to_file(e, data, filename, w, h);
+}
+
+
+
+bool virtual_canvas_destroy(Evas *e)
+{
+       Ecore_Evas *ee;
+
+       ee = ecore_evas_ecore_evas_get(e);
+       if (!ee) {
+               _DBG("Failed to ecore evas object\n");
+               return false;
+       }
+
+       ecore_evas_free(ee);
+       return true;
+}
+
+
+
+// End of a file