Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:50:20 +0000 (01:50 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:50:20 +0000 (01:50 +0900)
35 files changed:
CMakeLists.txt [new file with mode: 0755]
LICENSE.APLv2 [new file with mode: 0755]
NOTICE [new file with mode: 0755]
osp-app-controls.manifest [new file with mode: 0644]
packaging/osp-app-controls.spec [new file with mode: 0755]
res/arm/usr/etc/app-control-alias.ini [new file with mode: 0644]
res/arm/usr/etc/app-control-appid.ini [new file with mode: 0644]
res/arm/usr/etc/app-control-info.ini [new file with mode: 0644]
res/x86/usr/etc/app-control-alias.ini [new file with mode: 0644]
res/x86/usr/etc/app-control-appid.ini [new file with mode: 0644]
res/x86/usr/etc/app-control-info.ini [new file with mode: 0644]
src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp [new file with mode: 0755]
src/bluetooth-app-control/CMakeLists.txt [new file with mode: 0755]
src/browser-app-control/BrowserAppControlDLLEntry.cpp [new file with mode: 0644]
src/browser-app-control/CMakeLists.txt [new file with mode: 0755]
src/calendar-app-control/CMakeLists.txt [new file with mode: 0755]
src/calendar-app-control/CalendarAppControlDllEntry.cpp [new file with mode: 0755]
src/call-app-control/AppControlDLLEntry.cpp [new file with mode: 0644]
src/call-app-control/CMakeLists.txt [new file with mode: 0755]
src/camera-app-control/CMakeLists.txt [new file with mode: 0755]
src/camera-app-control/CameraAppControlDllEntry.cpp [new file with mode: 0755]
src/certmgr-app-control/CMakeLists.txt [new file with mode: 0755]
src/certmgr-app-control/CertMgrAppControlDllEntry.cpp [new file with mode: 0644]
src/certmgr-app-control/CertificateListForm.cpp [new file with mode: 0644]
src/certmgr-app-control/CertificateListForm.h [new file with mode: 0644]
src/contact-app-control/CMakeLists.txt [new file with mode: 0755]
src/contact-app-control/ContactAppControlDllEntry.cpp [new file with mode: 0755]
src/media-app-control/CMakeLists.txt [new file with mode: 0644]
src/media-app-control/MediaAppControlDLLEntry.cpp [new file with mode: 0755]
src/media-app-control/ParseUtil.cpp [new file with mode: 0644]
src/media-app-control/ParseUtil.h [new file with mode: 0644]
src/message-app-control/CMakeLists.txt [new file with mode: 0755]
src/message-app-control/MessageAppControlDllEntry.cpp [new file with mode: 0755]
src/setting-app-control/CMakeLists.txt [new file with mode: 0755]
src/setting-app-control/SettingAppControlDllEntry.cpp [new file with mode: 0755]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..ed85172
--- /dev/null
@@ -0,0 +1,62 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+PROJECT(osp-app-controls)
+
+SET(COMMON_INCLUDE_DIRS
+               /usr/include/appfw
+               /usr/include/network
+    /usr/include/osp
+       /usr/include/osp/app
+       /usr/include/osp/base
+       /usr/include/osp/io
+       /usr/include/osp/net
+       /usr/include/osp/security
+       /usr/include/osp/system
+       /usr/include/system
+       )
+     
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -L/usr/lib/osp" )     
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/cmake_build_tmp/output)
+
+MACRO(OSP_STRIP _target)
+    SET_TARGET_PROPERTIES(${_target}
+       PROPERTIES
+       VERSION ${FULLVER}
+       SOVERSION ${MAJORVER}
+       CLEAN_DIRECT_OUTPUT 1
+       )
+       ADD_CUSTOM_COMMAND(TARGET ${this_target}
+    POST_BUILD
+               COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} 
+               COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJORVER}
+               COMMAND ${CMAKE_STRIP} --strip-unneeded ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+    COMMENT "strip ${this_target}"
+               )   
+ENDMACRO(OSP_STRIP)
+
+ADD_SUBDIRECTORY(src/bluetooth-app-control osp-ac-bluetooth)
+ADD_SUBDIRECTORY(src/browser-app-control osp-ac-browser)
+ADD_SUBDIRECTORY(src/calendar-app-control osp-ac-calendar)
+ADD_SUBDIRECTORY(src/call-app-control osp-ac-call)
+ADD_SUBDIRECTORY(src/camera-app-control osp-ac-camera)
+ADD_SUBDIRECTORY(src/certmgr-app-control osp-ac-certmgr)
+ADD_SUBDIRECTORY(src/contact-app-control osp-ac-contact)
+ADD_SUBDIRECTORY(src/media-app-control osp-ac-media)
+ADD_SUBDIRECTORY(src/message-app-control osp-ac-message)
+ADD_SUBDIRECTORY(src/setting-app-control osp-ac-setting)
+
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/ DESTINATION lib/osp 
+                               FILES_MATCHING PATTERN "*.so*" 
+                               PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ                                          
+                                                                               GROUP_EXECUTE GROUP_READ
+                                                                               WORLD_EXECUTE WORLD_READ)
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/debug/ DESTINATION lib/osp/debug 
+                               FILES_MATCHING PATTERN "*.so*" 
+                               PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ                                          
+                                                                               GROUP_EXECUTE GROUP_READ
+                                                                               WORLD_EXECUTE WORLD_READ)
+IF("${ARCH}" MATCHES "arm")
+  INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/arm/usr/etc DESTINATION ../usr)
+ELSEIF("${ARCH}" MATCHES "x86")
+  INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res/x86/usr/etc DESTINATION ../usr)
+ENDIF("${ARCH}" MATCHES "arm")
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100755 (executable)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100755 (executable)
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/osp-app-controls.manifest b/osp-app-controls.manifest
new file mode 100644 (file)
index 0000000..ae3e6f7
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
\ No newline at end of file
diff --git a/packaging/osp-app-controls.spec b/packaging/osp-app-controls.spec
new file mode 100755 (executable)
index 0000000..4f8fbf2
--- /dev/null
@@ -0,0 +1,79 @@
+%define debug_package %{nil}
+%define __strip /bin/true
+
+Name:          osp-app-controls
+Summary:       osp application controls library
+Version:       1.2.0.0
+Release:       1
+Group:         System/Libraries
+License:       Apache License, Version 2.0
+Source0:       %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(appsvc)
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-network-bluetooth)
+BuildRequires:  pkgconfig(capi-system-device)
+BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires: boost-devel
+BuildRequires:  pkgconfig(osp-appfw)
+BuildRequires:  osp-appfw-internal-devel
+BuildRequires:  pkgconfig(osp-uifw)
+BuildRequires:  pkgconfig(osp-bluetooth)
+BuildRequires:  osp-bluetooth-internal-devel
+BuildRequires:  pkgconfig(osp-social)
+BuildRequires:  osp-social-internal-devel
+BuildRequires:  pkgconfig(contacts-service2)
+
+# runtime requires
+Requires: osp-appfw 
+Requires: osp-uifw
+Requires: osp-bluetooth
+Requires: osp-social
+
+Requires(post): coreutils
+
+%description
+osp application controls library
+
+%package debug
+Summary:    osp face library (Development)
+Group:      TO_BE/FILLED_IN
+Requires:   %{name} = %{version}-%{release}
+
+%description debug
+osp face library (DEV)
+
+%prep
+%setup -q
+
+%build 
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%ifarch %{ix86}
+CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DARCH=x86
+%else
+CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DARCH=arm
+%endif
+
+# Call make instruction with smp support
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2  %{buildroot}/usr/share/license/%{name}
+
+%make_install
+
+%post
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest osp-app-controls.manifest
+/usr/share/license/%{name}
+/usr/etc/*
+%{_libdir}/osp/*.so*
+
+%files debug
+%{_libdir}/osp/debug/*.so*
diff --git a/res/arm/usr/etc/app-control-alias.ini b/res/arm/usr/etc/app-control-alias.ini
new file mode 100644 (file)
index 0000000..8fb0664
--- /dev/null
@@ -0,0 +1,151 @@
+#osp.appcontrol.CONTACT
+PROVIDER_ALIAS=tizen.contacts
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.ADD=http://tizen.org/appcontrol/operation/add
+osp.appcontrol.operation.EDIT=http://tizen.org/appcontrol/operation/edit
+osp.appcontrol.operation.VIEW=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.CALENDAR
+PROVIDER_ALIAS=tizen.calendar
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.VIEW=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.TODO
+PROVIDER_ALIAS=tizen.todo
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.BT
+PROVIDER_ALIAS=tizen.bluetooth
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.DIAL
+PROVIDER_ALIAS=tizen.phone
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/dial
+#osp.appcontrol.CALL
+PROVIDER_ALIAS=tizen.phone
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/call
+#osp.appcontrol.BROWSER
+PROVIDER_ALIAS=tizen.internet
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.MEDIA
+PROVIDER_ALIAS=tizen.filemanager
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.MESSAGE
+PROVIDER_ALIAS=tizen.messages
+osp.appcontrol.operation.EDIT=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.EMAIL
+PROVIDER_ALIAS=tizen.email
+osp.appcontrol.operation.EDIT=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.IMAGE
+PROVIDER_ALIAS=tizen.imageviewer
+osp.appcontrol.operation.VIEW=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.VIDEO
+PROVIDER_ALIAS=tizen.videoplayer
+osp.appcontrol.operation.PLAY=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.AUDIO
+PROVIDER_ALIAS=tizen.musicplayer
+osp.appcontrol.operation.PLAY=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.CAMERA
+PROVIDER_ALIAS=tizen.camera
+osp.appcontrol.operation.CAPTURE=http://tizen.org/appcontrol/operation/createcontent
+#osp.appcontrol.SETTINGS
+PROVIDER_ALIAS=tizen.settings
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/configure
+#osp.appcontrol.provider.contact
+PROVIDER_ALIAS=tizen.contacts
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.add=http://tizen.org/appcontrol/operation/add
+osp.appcontrol.operation.edit=http://tizen.org/appcontrol/operation/edit
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.calendar
+PROVIDER_ALIAS=tizen.calendar
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.todo
+PROVIDER_ALIAS=tizen.todo
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.provider.bluetooth
+PROVIDER_ALIAS=tizen.bluetooth
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.provider.call
+PROVIDER_ALIAS=tizen.phone
+osp.appcontrol.operation.call=http://tizen.org/appcontrol/operation/call
+osp.appcontrol.operation.dial=http://tizen.org/appcontrol/operation/dial
+#osp.appcontrol.provider.browser
+PROVIDER_ALIAS=tizen.internet
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.media
+PROVIDER_ALIAS=tizen.filemanager
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.provider.message
+PROVIDER_ALIAS=tizen.messages
+osp.appcontrol.operation.compose=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.provider.email
+PROVIDER_ALIAS=tizen.email
+osp.appcontrol.operation.compose=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.provider.image
+PROVIDER_ALIAS=tizen.imageviewer
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.imageeditor
+PROVIDER_ALIAS=tizen.imageeditor
+osp.appcontrol.operation.crop=http://tizen.org/appcontrol/operation/crop
+#osp.appcontrol.provider.video
+PROVIDER_ALIAS=tizen.videoplayer
+osp.appcontrol.operation.play=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.audio
+PROVIDER_ALIAS=tizen.musicplayer
+osp.appcontrol.operation.play=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.camera
+PROVIDER_ALIAS=tizen.camera
+osp.appcontrol.operation.capture=http://tizen.org/appcontrol/operation/createcontent
+osp.appcontrol.operation.record=http://tizen.org/appcontrol/operation/createcontent
+#osp.appcontrol.provider.settings
+PROVIDER_ALIAS=tizen.settings
+osp.appcontrol.operation.configure=http://tizen.org/appcontrol/operation/configure
+#osp.appcontrol.provider.certificatemanager
+PROVIDER_ALIAS=tizen.certificatemanager
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#http://tizen.org/appcontrol/provider/contact
+PROVIDER_ALIAS=tizen.contacts
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+http://tizen.org/appcontrol/operation/add=http://tizen.org/appcontrol/operation/add
+http://tizen.org/appcontrol/operation/edit=http://tizen.org/appcontrol/operation/edit
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/calendar
+PROVIDER_ALIAS=tizen.calendar
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/bluetooth
+PROVIDER_ALIAS=tizen.bluetooth
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+#http://tizen.org/appcontrol/provider/call
+PROVIDER_ALIAS=tizen.phone
+http://tizen.org/appcontrol/operation/call=http://tizen.org/appcontrol/operation/call
+http://tizen.org/appcontrol/operation/dial=http://tizen.org/appcontrol/operation/dial
+#http://tizen.org/appcontrol/provider/browser
+PROVIDER_ALIAS=tizen.internet
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/media
+PROVIDER_ALIAS=tizen.filemanager
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+#http://tizen.org/appcontrol/provider/message
+PROVIDER_ALIAS=tizen.messages
+http://tizen.org/appcontrol/operation/compose=http://tizen.org/appcontrol/operation/compose
+#http://tizen.org/appcontrol/provider/email
+PROVIDER_ALIAS=tizen.email
+http://tizen.org/appcontrol/operation/compose=http://tizen.org/appcontrol/operation/compose
+#http://tizen.org/appcontrol/provider/image
+PROVIDER_ALIAS=tizen.imageviewer
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/video
+PROVIDER_ALIAS=tizen.videoplayer
+http://tizen.org/appcontrol/operation/play=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/audio
+PROVIDER_ALIAS=tizen.musicplayer
+http://tizen.org/appcontrol/operation/play=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/camera
+PROVIDER_ALIAS=tizen.camera
+http://tizen.org/appcontrol/operation/capture=http://tizen.org/appcontrol/operation/createcontent
+http://tizen.org/appcontrol/operation/record=http://tizen.org/appcontrol/operation/createcontent
+#http://tizen.org/appcontrol/provider/settings
+PROVIDER_ALIAS=tizen.settings
+http://tizen.org/appcontrol/operation/configure=http://tizen.org/appcontrol/operation/configure
+#http://tizen.org/appcontrol/provider/certificatemanager
+PROVIDER_ALIAS=tizen.certificatemanager
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
diff --git a/res/arm/usr/etc/app-control-appid.ini b/res/arm/usr/etc/app-control-appid.ini
new file mode 100644 (file)
index 0000000..c3f821a
--- /dev/null
@@ -0,0 +1,2 @@
+#Alias
+tizen.internet=kmcele1k0n.Internet
diff --git a/res/arm/usr/etc/app-control-info.ini b/res/arm/usr/etc/app-control-info.ini
new file mode 100644 (file)
index 0000000..2e667b4
--- /dev/null
@@ -0,0 +1,180 @@
+#tizen.contacts
+Title=APPCONTROL_PROVIDER_CONTACT
+Vendor=Samsung
+Overridable=No
+OPID_Count=5
+OPID_0=http://tizen.org/appcontrol/operation/pick
+OPID_1=http://tizen.org/appcontrol/operation/add
+OPID_2=http://tizen.org/appcontrol/operation/edit
+OPID_3=http://tizen.org/appcontrol/operation/default
+OPID_4=http://tizen.org/appcontrol/operation/view
+MIME_4=text/x-cCard
+Path=libosp-ac-contact.so
+LaunchType=2
+Name=Contacts
+Public=1
+Category=osp.appcontrol.category.contact
+#tizen.calendar
+Title=APPCONTROL_PROVIDER_CALENDAR
+Overridable=No
+Vendor=Samsung
+OPID_Count=2
+OPID_0=http://tizen.org/appcontrol/operation/pick
+OPID_1=http://tizen.org/appcontrol/operation/view
+MIME_1=text/x-vCalendar
+Path=libosp-ac-calendar.so
+LaunchType=2
+Name=Calendar
+Public=1
+Category=osp.appcontrol.category.calendar
+#tizen.todo
+Title=APPCONTROL_PROVIDER_TODO
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/pick
+Path=libosp-ac-calendar.so
+LaunchType=2
+Public=0
+Category=osp.appcontrol.category.calendar
+#tizen.bluetooth
+Title=APPCONTROL_PROVIDER_BLUETOOTH
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/pick
+Path=libosp-ac-bluetooth.so
+LaunchType=2
+Name=Bluetooth
+Public=1
+Category=osp.appcontrol.category.bluetooth
+#tizen.phone
+Title=APPCONTROL_PROVIDER_CALL
+Overridable=No
+Vendor=Samsung
+OPID_Count=2
+OPID_0=http://tizen.org/appcontrol/operation/call
+OPID_1=http://tizen.org/appcontrol/operation/dial
+SCHEME_0=tel
+SCHEME_1=tel
+Path=libosp-ac-call.so
+LaunchType=2
+Name=Logs
+Public=1
+Category=osp.appcontrol.category.videocall;osp.appcontrol.category.voicecall
+#tizen.filemanager
+Title=APPCONTROL_PROVIDER_MEDIA
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/pick
+MIME_0=audio/*;video/*;image/*
+Path=libosp-ac-media.so
+LaunchType=2
+Name=My files
+Public=1
+Category=osp.appcontrol.category.media
+#tizen.messages
+Title=APPCONTROL_PROVIDER_MESSAGE
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/compose
+SCHEME_0=mms;mmsto;sms;smsto
+Path=libosp-ac-message.so
+LaunchType=2
+Name=Messages
+Public=1
+Category=osp.appcontrol.category.mms;osp.appcontrol.category.sms
+#tizen.email
+Title=APPCONTROL_PROVIDER_EMAIL
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/compose
+Path=libosp-ac-message.so
+LaunchType=2
+Name=EMail
+Public=1
+Category=osp.appcontrol.category.email
+#tizen.imageviewer
+Title=APPCONTROL_PROVIDER_IMAGE
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/view
+MIME_0=image/*
+Path=libosp-ac-media.so
+LaunchType=2
+Name=Gallery
+Public=1
+Category=osp.appcontrol.category.image
+#tizen.imageeditor
+Title=APPCONTROL_PROVIDER_IMAGE_EDITOR
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/crop
+Path=libosp-ac-media.so
+LaunchType=2
+Public=0
+Category=osp.appcontrol.category.image
+#tizen.videoplayer
+Title=APPCONTROL_PROVIDER_VIDEO
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/view
+SCHEME_0=rtsp
+MIME_0=video/*
+Path=libosp-ac-media.so
+LaunchType=2
+Name=Videos
+Public=1
+Category=osp.appcontrol.category.video
+#tizen.musicplayer
+Title=APPCONTROL_AUDIO_AUDIO
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/view
+MIME_0=audio/*
+Path=libosp-ac-media.so
+LaunchType=2
+Name=Music
+Public=1
+Category=osp.appcontrol.category.audio
+#tizen.camera
+Title=APPCONTROL_PROVIDER_CAMERA
+Overridable=No
+Vendor=Samsung
+OPID_Count=2
+OPID_0=http://tizen.org/appcontrol/operation/createcontent
+OPID_1=http://tizen.org/appcontrol/operation/createcontent
+Path=libosp-ac-camera.so
+LaunchType=2
+Name=Camera
+Public=1
+Category=osp.appcontrol.category.image
+#tizen.settings
+Title=APPCONTROL_PROVIDER_SETTINGS
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/configure
+Path=libosp-ac-setting.so
+LaunchType=2
+Public=1
+Name=Settings
+Category=osp.appcontrol.category.settings
+#tizen.certificatemanager
+Title=APPCONTROL_PROVIDER_CERTIFICATE_MANAGER
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/pick
+Path=libosp-ac-certmgr.so
+LaunchType=2
+Public=1
+Name=CertificateManager
+Category=osp.appcontrol.category.certificate
diff --git a/res/x86/usr/etc/app-control-alias.ini b/res/x86/usr/etc/app-control-alias.ini
new file mode 100644 (file)
index 0000000..8fb0664
--- /dev/null
@@ -0,0 +1,151 @@
+#osp.appcontrol.CONTACT
+PROVIDER_ALIAS=tizen.contacts
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.ADD=http://tizen.org/appcontrol/operation/add
+osp.appcontrol.operation.EDIT=http://tizen.org/appcontrol/operation/edit
+osp.appcontrol.operation.VIEW=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.CALENDAR
+PROVIDER_ALIAS=tizen.calendar
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.VIEW=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.TODO
+PROVIDER_ALIAS=tizen.todo
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.BT
+PROVIDER_ALIAS=tizen.bluetooth
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.DIAL
+PROVIDER_ALIAS=tizen.phone
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/dial
+#osp.appcontrol.CALL
+PROVIDER_ALIAS=tizen.phone
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/call
+#osp.appcontrol.BROWSER
+PROVIDER_ALIAS=tizen.internet
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.MEDIA
+PROVIDER_ALIAS=tizen.filemanager
+osp.appcontrol.operation.PICK=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.MESSAGE
+PROVIDER_ALIAS=tizen.messages
+osp.appcontrol.operation.EDIT=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.EMAIL
+PROVIDER_ALIAS=tizen.email
+osp.appcontrol.operation.EDIT=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.IMAGE
+PROVIDER_ALIAS=tizen.imageviewer
+osp.appcontrol.operation.VIEW=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.VIDEO
+PROVIDER_ALIAS=tizen.videoplayer
+osp.appcontrol.operation.PLAY=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.AUDIO
+PROVIDER_ALIAS=tizen.musicplayer
+osp.appcontrol.operation.PLAY=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.CAMERA
+PROVIDER_ALIAS=tizen.camera
+osp.appcontrol.operation.CAPTURE=http://tizen.org/appcontrol/operation/createcontent
+#osp.appcontrol.SETTINGS
+PROVIDER_ALIAS=tizen.settings
+osp.appcontrol.operation.DEFAULT=http://tizen.org/appcontrol/operation/configure
+#osp.appcontrol.provider.contact
+PROVIDER_ALIAS=tizen.contacts
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.add=http://tizen.org/appcontrol/operation/add
+osp.appcontrol.operation.edit=http://tizen.org/appcontrol/operation/edit
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.calendar
+PROVIDER_ALIAS=tizen.calendar
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.todo
+PROVIDER_ALIAS=tizen.todo
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.provider.bluetooth
+PROVIDER_ALIAS=tizen.bluetooth
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.provider.call
+PROVIDER_ALIAS=tizen.phone
+osp.appcontrol.operation.call=http://tizen.org/appcontrol/operation/call
+osp.appcontrol.operation.dial=http://tizen.org/appcontrol/operation/dial
+#osp.appcontrol.provider.browser
+PROVIDER_ALIAS=tizen.internet
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.media
+PROVIDER_ALIAS=tizen.filemanager
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#osp.appcontrol.provider.message
+PROVIDER_ALIAS=tizen.messages
+osp.appcontrol.operation.compose=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.provider.email
+PROVIDER_ALIAS=tizen.email
+osp.appcontrol.operation.compose=http://tizen.org/appcontrol/operation/compose
+#osp.appcontrol.provider.image
+PROVIDER_ALIAS=tizen.imageviewer
+osp.appcontrol.operation.view=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.imageeditor
+PROVIDER_ALIAS=tizen.imageeditor
+osp.appcontrol.operation.crop=http://tizen.org/appcontrol/operation/crop
+#osp.appcontrol.provider.video
+PROVIDER_ALIAS=tizen.videoplayer
+osp.appcontrol.operation.play=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.audio
+PROVIDER_ALIAS=tizen.musicplayer
+osp.appcontrol.operation.play=http://tizen.org/appcontrol/operation/view
+#osp.appcontrol.provider.camera
+PROVIDER_ALIAS=tizen.camera
+osp.appcontrol.operation.capture=http://tizen.org/appcontrol/operation/createcontent
+osp.appcontrol.operation.record=http://tizen.org/appcontrol/operation/createcontent
+#osp.appcontrol.provider.settings
+PROVIDER_ALIAS=tizen.settings
+osp.appcontrol.operation.configure=http://tizen.org/appcontrol/operation/configure
+#osp.appcontrol.provider.certificatemanager
+PROVIDER_ALIAS=tizen.certificatemanager
+osp.appcontrol.operation.pick=http://tizen.org/appcontrol/operation/pick
+#http://tizen.org/appcontrol/provider/contact
+PROVIDER_ALIAS=tizen.contacts
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+http://tizen.org/appcontrol/operation/add=http://tizen.org/appcontrol/operation/add
+http://tizen.org/appcontrol/operation/edit=http://tizen.org/appcontrol/operation/edit
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/calendar
+PROVIDER_ALIAS=tizen.calendar
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/bluetooth
+PROVIDER_ALIAS=tizen.bluetooth
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+#http://tizen.org/appcontrol/provider/call
+PROVIDER_ALIAS=tizen.phone
+http://tizen.org/appcontrol/operation/call=http://tizen.org/appcontrol/operation/call
+http://tizen.org/appcontrol/operation/dial=http://tizen.org/appcontrol/operation/dial
+#http://tizen.org/appcontrol/provider/browser
+PROVIDER_ALIAS=tizen.internet
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/media
+PROVIDER_ALIAS=tizen.filemanager
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
+#http://tizen.org/appcontrol/provider/message
+PROVIDER_ALIAS=tizen.messages
+http://tizen.org/appcontrol/operation/compose=http://tizen.org/appcontrol/operation/compose
+#http://tizen.org/appcontrol/provider/email
+PROVIDER_ALIAS=tizen.email
+http://tizen.org/appcontrol/operation/compose=http://tizen.org/appcontrol/operation/compose
+#http://tizen.org/appcontrol/provider/image
+PROVIDER_ALIAS=tizen.imageviewer
+http://tizen.org/appcontrol/operation/view=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/video
+PROVIDER_ALIAS=tizen.videoplayer
+http://tizen.org/appcontrol/operation/play=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/audio
+PROVIDER_ALIAS=tizen.musicplayer
+http://tizen.org/appcontrol/operation/play=http://tizen.org/appcontrol/operation/view
+#http://tizen.org/appcontrol/provider/camera
+PROVIDER_ALIAS=tizen.camera
+http://tizen.org/appcontrol/operation/capture=http://tizen.org/appcontrol/operation/createcontent
+http://tizen.org/appcontrol/operation/record=http://tizen.org/appcontrol/operation/createcontent
+#http://tizen.org/appcontrol/provider/settings
+PROVIDER_ALIAS=tizen.settings
+http://tizen.org/appcontrol/operation/configure=http://tizen.org/appcontrol/operation/configure
+#http://tizen.org/appcontrol/provider/certificatemanager
+PROVIDER_ALIAS=tizen.certificatemanager
+http://tizen.org/appcontrol/operation/pick=http://tizen.org/appcontrol/operation/pick
diff --git a/res/x86/usr/etc/app-control-appid.ini b/res/x86/usr/etc/app-control-appid.ini
new file mode 100644 (file)
index 0000000..0e1afcb
--- /dev/null
@@ -0,0 +1,18 @@
+#Alias
+tizen.internet=kmcele1k0n.Internet
+tizen.filemanager=0pnxz8hbsr.MyFiles
+tizen.camera=hdufar9ycj.Camera
+tizen.gallery=ijudt7w61q.Gallery
+tizen.imageviewer=jysyv9o1dc.ImageViewer
+tizen.videoplayer=npwf0scb88.VideoPlayer
+tizen.memo=zunqjlsnce.Memo
+tizen.contacts=f9uev8hsyo.Contacts
+tizen.calendar=ph1vq2phrp.Calendar
+tizen.events=ph1vq2phrp.Calendar
+tizen.email=vxqbrefica.Email
+tizen.settings=kto5jikgul.Settings
+tizen.messages=8r4r5ddzzn.Messages
+tizen.musicplayer=dhrul6qzj3.MusicPlayer
+tizen.bluetooth=kto5jikgul.Settings
+tizen.phone=zktdpemtmw.Phone
+samsung.snote=smemo-efl
diff --git a/res/x86/usr/etc/app-control-info.ini b/res/x86/usr/etc/app-control-info.ini
new file mode 100644 (file)
index 0000000..4a6843d
--- /dev/null
@@ -0,0 +1,31 @@
+#tizen.todo
+Title=APPCONTROL_PROVIDER_TODO
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/pick
+Path=libosp-ac-calendar.so
+LaunchType=2
+Public=0
+Category=osp.appcontrol.category.calendar
+#tizen.imageeditor
+Title=APPCONTROL_PROVIDER_IMAGE_EDITOR
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/crop
+Path=libosp-ac-media.so
+LaunchType=2
+Public=0
+Category=osp.appcontrol.category.image
+#tizen.certificatemanager
+Title=APPCONTROL_PROVIDER_CERTIFICATE_MANAGER
+Overridable=No
+Vendor=Samsung
+OPID_Count=1
+OPID_0=http://tizen.org/appcontrol/operation/pick
+Path=libosp-ac-certmgr.so
+LaunchType=2
+Public=1
+Name=CertificateManager
+Category=osp.appcontrol.category.certificate
diff --git a/src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp b/src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp
new file mode 100755 (executable)
index 0000000..f156682
--- /dev/null
@@ -0,0 +1,200 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        BluetoothAppControlDllEntry.cpp
+ * @brief      This is the implementation for the BluetoothAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FBaseInteger.h>
+#include <FBaseLong.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FNetBt_BluetoothAdapterUtility.h>
+#include <FSys_SystemInfoImpl.h>
+#include <FApp_Aul.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Net::Bluetooth;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+static const wchar_t __allowedAppControlTable[][2][64] =
+{
+       {L"osp.appcontrol.BT", L"osp.appcontrol.operation.PICK"},
+       {L"osp.appcontrol.provider.bluetooth", L"osp.appcontrol.operation.pick"},
+       {L"http://tizen.org/appcontrol/provider/bluetooth", L"http://tizen.org/appcontrol/operation/pick"},
+       {L"tizen.bluetooth", L"http://tizen.org/appcontrol/operation/pick"},
+};
+
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Bluetooth AppControl");
+
+       result r = E_SUCCESS;
+       bool isBtSupported = false;
+       _AppMessageImpl msg;
+
+       r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/network.bluetooth", isBtSupported);
+       SysTryReturnResult(NID_APP, (r == E_SUCCESS) && (isBtSupported == true), E_SYSTEM, "[%s] Bluetooth is not supported.", GetErrorMessage(r));
+
+       const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
+       SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+       SysLog(NID_APP, "Bluetooth AppControl.");
+
+       msg.AddData(pMap);
+       msg.AddData(L"launch-type", L"pick");
+
+       __processId = _AppControlManager::GetInstance()->Launch(msg, "ug-bluetooth-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
+
+       SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Bluetooth AppControl is failed.");
+       SysLog(NID_APP, "StartAppControl: Launching Bluetooth AppControl succeeded.");
+
+       __req = req;
+
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+       String dataStr;
+       int majClassType = 0;
+       int minClassType = 0;
+       int svcClassType = 0;
+       unsigned long svcType = 0;
+
+       HashMap* pResult = new (std::nothrow) HashMap();
+       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+       r = pResult->Construct();
+
+       switch (res)
+       {
+       case SERVICE_RESULT_SUCCEEDED:
+               {
+                       const char* pBuf = appsvc_get_data(pBundle, "address");
+                       if (pBuf)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"addr_val"), new (std::nothrow) String(pBuf));
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, "name");
+                       if (pBuf)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"dev_name"), new (std::nothrow) String(pBuf));
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, "major_class");
+                       if (pBuf)
+                       {
+                               Integer::Decode(String(pBuf), majClassType);
+                               majClassType = (int)_BluetoothAdapterUtility::ConvertToMajorDeviceClassType((bt_major_device_class_e)majClassType);
+
+                               pResult->Add(new (std::nothrow) String(L"maj_cls_type"), new (std::nothrow) String(Integer::ToString(majClassType)));
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, "minor_class");
+                       if (pBuf)
+                       {
+                               Integer::Decode(String(pBuf), minClassType);
+                               minClassType = (int)_BluetoothAdapterUtility::ConvertToMinorDeviceClassType((bt_major_device_class_e)majClassType, (bt_minor_device_class_e)minClassType);
+
+                               pResult->Add(new (std::nothrow) String(L"min_cls_type"), new (std::nothrow) String(Integer::ToString(minClassType)));
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, "service_class");
+                       if (pBuf)
+                       {
+                               Integer::Decode(String(pBuf), svcClassType);
+                               svcClassType = (int)_BluetoothAdapterUtility::ConvertToServiceClassList(svcClassType);
+
+                               pResult->Add(new (std::nothrow) String(L"svc_cls_type"), new (std::nothrow) String(Integer::ToString(svcClassType)));
+                       }
+
+                       int len = 0;
+                       char** ppArrayBuf = (char**)appsvc_get_data_array(pBundle, "uuids", &len);
+                       if (len > 0 && ppArrayBuf != null)
+                       {
+                               svcType = _BluetoothAdapterUtility::ConvertToServiceList(ppArrayBuf, len);
+                               for (int i = 0; i < len; i++)
+                               {
+                                       if (ppArrayBuf[i])
+                                       {
+                                               free(ppArrayBuf[i]);
+                                       }
+                               }
+                               free(ppArrayBuf);
+                       }
+
+                       pResult->Add(new (std::nothrow) String(L"svc_type"), new (std::nothrow) String(Long::ToString(svcType)));
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+               // fall through
+       case SERVICE_RESULT_CANCELED:
+               // fall through
+       default:
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+       __req = -1;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/bluetooth-app-control/CMakeLists.txt b/src/bluetooth-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..a3d1dcf
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-bluetooth)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       BluetoothAppControlDllEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/browser-app-control/BrowserAppControlDLLEntry.cpp b/src/browser-app-control/BrowserAppControlDLLEntry.cpp
new file mode 100644 (file)
index 0000000..4fa6205
--- /dev/null
@@ -0,0 +1,107 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        BrowserAppControlDllEntry.cpp
+ * @brief      This is the implementation for the BrowserAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+#include <appfw/app_service.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_AppArg.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+
+
+static const wchar_t __allowedAppControlTable[][2][64] =
+{
+       {L"osp.appcontrol.BROWSER", L"osp.appcontrol.operation.DEFAULT"},
+       {L"osp.appcontrol.provider.browser", L"osp.appcontrol.operation.view"},
+       {L"http://tizen.org/appcontrol/provider/browser", L"http://tizen.org/appcontrol/operation/view"},
+       {L"tizen.internet", L"http://tizen.org/appcontrol/operation/view"},
+};
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Browser AppControl");
+
+       const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
+       SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+       _AppMessageImpl msg;
+
+       char* pUriLiteral = null;
+       if (pMap)
+       {
+               msg.AddData(pMap);
+
+               if (pUri == null)
+               {
+                       // if there is not pUri, then search for "url" key.
+                       const String* pUriData = static_cast<const String*>(pMap->GetValue(String(L"url")));
+                       if (pUriData)
+                       {
+                               pUriLiteral = _StringConverter::CopyToCharArrayN(*pUriData);
+                       }
+               }
+       }
+
+       result r = _AppControlManager::GetInstance()->LaunchPkg(msg, "org.tizen.browser", SERVICE_OPERATION_VIEW, NULL, pUriLiteral, NULL, 0);
+       if (IsFailed(r))
+       {
+               r = _AppControlManager::GetInstance()->LaunchPkg(msg, "com.samsung.browser", SERVICE_OPERATION_VIEW, NULL, pUriLiteral, NULL, 0);
+       }
+
+       delete [] pUriLiteral;
+
+       SysTryLog(NID_APP, !IsFailed(r), "[%s] System error.", GetErrorMessage(r));
+
+       SysLog(NID_APP, "StartAppControl: Launching Browser AppControl succeeded");
+
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       return E_SUCCESS;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/browser-app-control/CMakeLists.txt b/src/browser-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..b5fb60f
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-browser)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       BrowserAppControlDLLEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/calendar-app-control/CMakeLists.txt b/src/calendar-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..50157e6
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-calendar)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       CalendarAppControlDllEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/calendar-app-control/CalendarAppControlDllEntry.cpp b/src/calendar-app-control/CalendarAppControlDllEntry.cpp
new file mode 100755 (executable)
index 0000000..c1d6ba7
--- /dev/null
@@ -0,0 +1,272 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        CalendarAppControlDllEntry.cpp
+ * @brief      This is the implementation for the CalendarAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FIo_FileImpl.h>
+#include <FSys_EnvironmentImpl.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::System;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+static const wchar_t __allowedAppControlPickTable[][2][64] =
+{
+       {L"osp.appcontrol.CALENDAR", L"osp.appcontrol.operation.PICK"},
+       {L"osp.appcontrol.provider.calendar", L"osp.appcontrol.operation.pick"},
+       {L"http://tizen.org/appcontrol/provider/calendar", L"http://tizen.org/appcontrol/operation/pick"},
+       {L"tizen.calendar", L"http://tizen.org/appcontrol/operation/pick"},
+};
+
+static const wchar_t __allowedAppControlViewTable[][2][64] =
+{
+       {L"osp.appcontrol.CALENDAR", L"osp.appcontrol.operation.VIEW"},
+       {L"osp.appcontrol.provider.calendar", L"osp.appcontrol.operation.view"},
+       {L"http://tizen.org/appcontrol/provider/calendar", L"http://tizen.org/appcontrol/operation/view"},
+       {L"tizen.calendar", L"http://tizen.org/appcontrol/operation/view"},
+};
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Calendar AppControl");
+
+       result r = E_SUCCESS;
+       bool hasOutput = false;
+
+       __req = req;
+
+       const bool isCalendarView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 4, aId, oId);
+       const bool isCalendarPick = _AppControlManager::IsAllowedAppControl(__allowedAppControlPickTable, 4, aId, oId);
+
+       if (isCalendarPick)
+       {
+               SysLog(NID_APP, "Calendar AppControl : PICK operation.");
+
+               hasOutput = true;
+
+               const String* pItemTypeValue = static_cast<const String*>(pMap->GetValue(String(L"itemType")));
+               if (pItemTypeValue == null || (*pItemTypeValue != L"event" && *pItemTypeValue != L"todo"))
+               {
+                       SysLog(NID_APP, "itemType is invalid.");
+                       r = E_SUCCESS;
+                       goto CATCH;
+               }
+               const String* pSelectionModeValue = static_cast<const String*>(pMap->GetValue(String(L"selectionMode")));
+               if (pSelectionModeValue == null || (*pSelectionModeValue != L"single" && *pSelectionModeValue != L"multiple"))
+               {
+                       SysLog(NID_APP, "selectionMode is invalid.");
+                       r = E_SUCCESS;
+                       goto CATCH;
+               }
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "calendar-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
+               SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl succeeded.");
+       }
+       else if (isCalendarView)
+       {
+               SysLog(NID_APP, "Calendar AppControl : VIEW operation.");
+
+               const String* pViewTypeValue = static_cast<const String*>(pMap->GetValue(String(L"viewType")));
+               if (pViewTypeValue == null)
+               {
+                       SysLog(NID_APP, "viewType is invalid.");
+                       r = E_SUCCESS;
+                       goto CATCH;
+               }
+
+               if (*pViewTypeValue == L"vcs")
+               {
+                       const String* pPathValue = static_cast<const String*>(pMap->GetValue(String(L"path")));
+                       if (pPathValue == null || pPathValue->GetLength() == 0)
+                       {
+                               SysLog(NID_APP, "path is invalid.");
+                               r = E_SUCCESS;
+                               goto CATCH;
+                       }
+               }
+               else if (*pViewTypeValue == L"event")
+               {
+                       const String* pEventIdValue = static_cast<const String*>(pMap->GetValue(String(L"eventId")));
+                       if (pEventIdValue == null || pEventIdValue->GetLength() == 0)
+                       {
+                               SysLog(NID_APP, "eventId is invalid.");
+                               r = E_SUCCESS;
+                               goto CATCH;
+                       }
+               }
+               else if (*pViewTypeValue == L"todo")
+               {
+                       const String* pTodoIdValue = static_cast<const String*>(pMap->GetValue(String(L"todoId")));
+                       if (pTodoIdValue == null || pTodoIdValue->GetLength() == 0)
+                       {
+                               SysLog(NID_APP, "todoId is invalid.");
+                               r = E_SUCCESS;
+                               goto CATCH;
+                       }
+               }
+               else
+               {
+                       SysLog(NID_APP, "viewType is invalid.");
+                       r = E_SUCCESS;
+                       goto CATCH;
+               }
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               const String& tmp = msg.GetValue(L"viewType");
+               if (!tmp.IsEmpty())
+               {
+                       msg.AddData(L"itemType", tmp);
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "calendar-detail-efl", APPSVC_OPERATION_VIEW, NULL, NULL, NULL, 0);
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
+               SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl succeeded.");
+       }
+
+       return E_SUCCESS;
+
+CATCH:
+
+       if (hasOutput)
+       {
+               _AppControlManager::GetInstance()->FinishAppControl(req, APP_CTRL_RESULT_FAILED, null);
+       }
+
+       __req = -1;
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+
+       HashMap* pResult = null;
+
+       switch (res)
+       {
+       case SERVICE_RESULT_SUCCEEDED:
+               {
+                       pResult = new (std::nothrow) HashMap();
+                       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+                       r = pResult->Construct();
+
+                       const char* pData = appsvc_get_data(pBundle, "itemType");
+                       if (pData)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"itemType"), new (std::nothrow) String(pData));
+                       }
+
+                       int count = 0;
+                       const char** pPaths = null;
+                       pPaths = appsvc_get_data_array(pBundle, "path", &count);
+
+                       if (pPaths)
+                       {
+                               String* pPathValue = new (std::nothrow) String();
+                               SysTryCatch(NID_APP, pPathValue != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+                               for (int i = 0; i< count; i++)
+                               {
+                                       if (i != 0)
+                                       {
+                                               pPathValue->Append(L";");
+                                       }
+
+                                       pPathValue->Append(pPaths[i]);
+                               }
+
+                               pResult->Add(new (std::nothrow) String(L"path"), pPathValue);
+                       }
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+               break;
+#if 0
+       case SERVICE_RESULT_CANCELED:
+               pResult->Add(*(new (std::nothrow) String(L"Canceled")));
+               break;
+#endif
+       default:
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+       __req = -1;
+
+       if (pResult)
+       {
+               pResult->RemoveAll(true);
+               delete pResult;
+       }
+
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/call-app-control/AppControlDLLEntry.cpp b/src/call-app-control/AppControlDLLEntry.cpp
new file mode 100644 (file)
index 0000000..b7d15db
--- /dev/null
@@ -0,0 +1,134 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        AppControlDllEntry.cpp
+ * @brief      This is the implementation for the AppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+
+static const wchar_t __allowedAppControlCallTable[][2][64] =
+{
+       {L"osp.appcontrol.CALL", L"osp.appcontrol.operation.DEFAULT"},
+       {L"osp.appcontrol.provider.call", L"osp.appcontrol.operation.call"},
+       {L"http://tizen.org/appcontrol/provider/call", L"http://tizen.org/appcontrol/operation/call"},
+       {L"tizen.phone", L"http://tizen.org/appcontrol/operation/call"},
+};
+
+static const wchar_t __allowedAppControlDialTable[][2][64] =
+{
+       {L"osp.appcontrol.DIAL", L"osp.appcontrol.operation.DEFAULT"},
+       {L"osp.appcontrol.provider.call", L"osp.appcontrol.operation.dial"},
+       {L"http://tizen.org/appcontrol/provider/call", L"http://tizen.org/appcontrol/operation/dial"},
+       {L"tizen.phone", L"http://tizen.org/appcontrol/operation/dial"},
+};
+
+
+result
+StartAppControl(int req, const String& providerId, const String& operationId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Call AppControl");
+
+       result r = E_SUCCESS;
+       const char* pParam = null;
+       bool callMode = true;
+
+       static const char CALL_PKG_NAME[] = "org.tizen.call";
+       static const char DIAL_PKG_NAME[] = "org.tizen.phone";
+       static const char CALL_PKG_NAME_COMMERCIAL[] = "com.samsung.call";
+       static const char DIAL_PKG_NAME_COMMERCIAL[] = "com.samsung.phone";
+
+       const bool isCall = _AppControlManager::IsAllowedAppControl(__allowedAppControlCallTable, 4, providerId, operationId);
+       const bool isDial = _AppControlManager::IsAllowedAppControl(__allowedAppControlDialTable, 4, providerId, operationId);
+
+       SysTryReturnResult(NID_APP, isCall || isDial, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", providerId.GetPointer(), operationId.GetPointer());
+
+       callMode = isCall;
+
+       if (pMap)
+       {
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               String phoneNumber = appsvc_get_data(msg.GetBundle(), "tel");
+               if (!phoneNumber.IsEmpty())
+               {
+                       phoneNumber.Insert(L"tel:", 0);
+
+                       pParam = _StringConverter::CopyToCharArrayN(phoneNumber);
+                       SysTryCatch(NID_APP, pParam != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] String conversion failure.");
+
+                       if (callMode)
+                       {
+                               r = _AppControlManager::GetInstance()->LaunchPkg(CALL_PKG_NAME, APPSVC_OPERATION_CALL, NULL, pParam, NULL, 0);
+                               if (IsFailed(r))
+                               {
+                                       r = _AppControlManager::GetInstance()->LaunchPkg(CALL_PKG_NAME_COMMERCIAL, APPSVC_OPERATION_CALL, NULL, pParam, NULL, 0);
+                               }
+                       }
+                       else
+                       {
+                               r = _AppControlManager::GetInstance()->LaunchPkg(DIAL_PKG_NAME, APPSVC_OPERATION_DIAL, NULL, pParam, NULL, 0);
+                               if (IsFailed(r))
+                               {
+                                       r = _AppControlManager::GetInstance()->LaunchPkg(DIAL_PKG_NAME_COMMERCIAL, APPSVC_OPERATION_DIAL, NULL, pParam, NULL, 0);
+                               }
+                       }
+
+                       SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
+
+                       SysLog(NID_APP, "StartAppControl: Launching Call AppControl succeeded");
+               }
+       }
+CATCH:
+       delete[] pParam;
+
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       return E_SUCCESS;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/call-app-control/CMakeLists.txt b/src/call-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..6bfab3a
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-call)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       AppControlDLLEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/camera-app-control/CMakeLists.txt b/src/camera-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..be75c6e
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-camera)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       CameraAppControlDllEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/camera-app-control/CameraAppControlDllEntry.cpp b/src/camera-app-control/CameraAppControlDllEntry.cpp
new file mode 100755 (executable)
index 0000000..3e63acf
--- /dev/null
@@ -0,0 +1,145 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        CameraAppControlDllEntry.cpp
+ * @brief      This is the implementation for the CameraAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       result r = E_SYSTEM;
+       SysLog(NID_APP, "StartAppControl: Entry to Camera AppControl");
+
+       if (aId == "osp.appcontrol.CAMERA"
+                       || aId == L"osp.appcontrol.provider.camera"
+                       || aId == L"tizen.camera"
+                       || aId == L"http://tizen.org/appcontrol/provider/camera")
+       {
+               SysLog(NID_APP, "oId : %ls", oId.GetPointer());
+
+               if (pMap)
+               {
+                       char buffer[10] = {0, };
+
+                       _AppMessageImpl msg;
+                       msg.AddData(pMap);
+
+                       const String& str = msg.GetValue(L"type");
+                       if (str == L"camcorder")
+                       {
+                               strncpy(buffer, "video/3gp", 9);
+                       }
+                       else
+                       {
+                               strncpy(buffer, "image/jpg", 9);
+                       }
+
+                       __req = req;
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "org.tizen.camera-app", APPSVC_OPERATION_CREATE_CONTENT, buffer, NULL, OnAppControlResult, 0);
+                       if (__processId <= 0)
+                       {
+                               __processId = _AppControlManager::GetInstance()->Launch(msg, "com.samsung.camera-app", APPSVC_OPERATION_CREATE_CONTENT, buffer, NULL, OnAppControlResult, 0);
+                       }
+               }
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Camera AppControl is failed.");
+
+               r = E_SUCCESS;
+               SysLog(NID_APP, "StartAppControl: Launching Camera AppControl succeeded");
+       }
+
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+
+       HashMap* pResult = new (std::nothrow) HashMap();
+       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+       r = pResult->Construct();
+
+       switch (res)
+       {
+       case SERVICE_RESULT_SUCCEEDED:
+               {
+                       const char* pFile = appsvc_get_data(pBundle, SERVICE_DATA_SELECTED);
+                       if (pFile)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(pFile));
+                       }
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+               break;
+       case SERVICE_RESULT_CANCELED:
+               break;
+       default:
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+       __req = -1;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/certmgr-app-control/CMakeLists.txt b/src/certmgr-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..af24be3
--- /dev/null
@@ -0,0 +1,27 @@
+SET (this_target osp-ac-certmgr)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       CertMgrAppControlDllEntry.cpp
+       CertificateListForm.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/certmgr-app-control/CertMgrAppControlDllEntry.cpp b/src/certmgr-app-control/CertMgrAppControlDllEntry.cpp
new file mode 100644 (file)
index 0000000..c486451
--- /dev/null
@@ -0,0 +1,193 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        CertMgrAppControlDllEntry.cpp
+ * @brief      This is the implementation for the CertMgrAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+#include <unique_ptr.h>
+#include <FAppAppControl.h>
+#include <FAppUiApp.h>
+#include <FAppIAppFrame.h>
+#include <FBaseColIList.h>
+#include <FBaseColArrayList.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseDataType.h>
+#include <FBaseSysLog.h>
+#include <FBaseString.h>
+#include <FBaseErrors.h>
+#include <FBaseErrorDefine.h>
+#include <FUiCtrlFrame.h>
+#include <FOspConfig.h>
+#include <FApp_AppControlManager.h>
+#include "CertificateListForm.h"
+
+namespace Tizen { namespace Base { namespace Collection
+{
+class IList;
+} } } // Tizen::Base::Collection
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Finish(bool isSelected, int certId);
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int reqId);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+#ifdef __cplusplus
+}
+#endif
+
+namespace
+{
+int __reqId = -1;
+CertificateListForm* __pCertificateListForm = null;
+Tizen::Ui::Controls::Frame* __pFrame = null;
+const wchar_t __allowedAppControlTable[][2][64] =
+{
+       {L"osp.appcontrol.provider.certificatemanager", L"osp.appcontrol.operation.pick"},
+       {L"http://tizen.org/appcontrol/provider/certificatemanager", L"http://tizen.org/appcontrol/operation/pick"},
+       {L"tizen.certificatemanager", L"http://tizen.org/appcontrol/operation/pick"},
+};
+}
+
+result
+StartAppControl(int reqId, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       result r = E_SUCCESS;
+
+       UiApp* pApp = null;
+       IAppFrame* pAppFrame = null;
+       Tizen::Ui::Controls::Frame* pFrame = null;
+
+       __reqId = reqId;
+
+       SysLog(NID_SEC_CERT, "Enter.");
+
+       SysAssertf(!__pCertificateListForm, "CertificateListForm is already constructed.");
+       SysAssertf(!__pFrame, "Frame is already prepared.");
+
+       SysTryReturnResult(NID_SEC_CERT, _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 3, aId, oId), E_SYSTEM
+               , "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+       SysLog(NID_SEC_CERT, "Certificate Manager AppControl.");
+
+       // Get AppFrame
+       pApp = Application::GetInstance();
+       SysTryReturnResult(NID_SEC_CERT, pApp, E_SYSTEM, "UiApp instance is not available.");
+       pAppFrame = pApp->GetAppFrame();
+       SysTryReturnResult(NID_SEC_CERT, pAppFrame, E_SYSTEM, "AppFrame instance is not available.");
+       pFrame = pAppFrame->GetFrame();
+       SysTryReturnResult(NID_SEC_CERT, pFrame, E_SYSTEM, "Frame instance is not available.");
+
+       // Add the form to the frame
+       std::unique_ptr<CertificateListForm> pCertificateListForm(new (std::nothrow) CertificateListForm());
+       SysTryReturnResult(NID_SEC_CERT, pCertificateListForm, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+       r = pCertificateListForm->Initialize();
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pFrame->AddControl(*(pCertificateListForm.get()));
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pFrame->SetCurrentForm(*(pCertificateListForm.get()));
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       // Draw and Show the form
+       r = pCertificateListForm->Draw();
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pFrame = pFrame;
+       __pCertificateListForm = pCertificateListForm.release();
+
+       SysLog(NID_SEC_CERT, "Exit.");
+
+       return r;
+}
+
+result
+TerminateAppControl(int reqId)
+{
+       result r = E_SUCCESS;
+
+       if (__reqId == reqId)
+       {
+               SysLog(NID_SEC_CERT, "The current value of reqId is %d.", reqId);
+
+               SysAssertf(__pFrame != null, "Frame instance must not be null.");
+               SysAssertf(__pCertificateListForm != null, "CertificateListForm instance must not be null.");
+
+               r = __pFrame->RemoveControl(*__pCertificateListForm);
+               SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               __reqId = -1;
+               __pCertificateListForm = null;
+               __pFrame = null;
+       }
+
+       return r;
+}
+
+void
+Finish(bool isSelected, int certId)
+{
+       result r = E_SUCCESS;
+
+       SysLog(NID_SEC_CERT, "The current value of certId is %d.", certId);
+
+       std::unique_ptr<HashMap, AllElementsDeleter> pList(new (std::nothrow) HashMap());
+       SysTryCatch(NID_SEC_CERT, pList != null, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+       r = pList->Construct(2);
+       SysTryCatch(NID_SEC_CERT, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       if (isSelected)
+       {
+               SysLog(NID_SEC_CERT, "The current value of isSelected is true.");
+               SysTryCatch(NID_SEC_CERT, certId >= 0, , E_INVALID_ARG, "[%s] Invalid Certificate ID.", GetErrorMessage(E_INVALID_ARG));
+
+               pList->Add(new (std::nothrow) String(L"Id"), new (std::nothrow) String(Integer(certId).ToString()));
+               SysTryCatch(NID_SEC_CERT, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               // send result
+               _AppControlManager::GetInstance()->FinishAppControl(__reqId, APP_CTRL_RESULT_SUCCEEDED, pList.release());
+       }
+       else
+       {
+               SysLog(NID_SEC_CERT, "The current value of isSelected is false.");
+
+               // send result
+               _AppControlManager::GetInstance()->FinishAppControl(__reqId, APP_CTRL_RESULT_CANCELED, null);
+       }
+
+       return;
+
+CATCH:
+       _AppControlManager::GetInstance()->FinishAppControl(__reqId, APP_CTRL_RESULT_FAILED, null);
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+}
diff --git a/src/certmgr-app-control/CertificateListForm.cpp b/src/certmgr-app-control/CertificateListForm.cpp
new file mode 100644 (file)
index 0000000..ca3d867
--- /dev/null
@@ -0,0 +1,272 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       CertificateListForm.cpp
+ * @brief      This file contains the implementation of CertificateListForm class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseDataType.h>
+#include <FBaseErrors.h>
+#include <FBaseErrorDefine.h>
+#include <FBaseString.h>
+#include <FBaseSysLog.h>
+#include <FGrpDimension.h>
+#include <FGrpRectangle.h>
+#include <FUiCtrlCustomItem.h>
+#include <FUiCtrlFooter.h>
+#include <FUiCtrlForm.h>
+#include <FUiCtrlFooter.h>
+#include <FUiCtrlListItemBase.h>
+#include <FUiCtrlListView.h>
+#include <FSecCert_CertService.h>
+#include <FSecCert_CertTypes.h>
+#include "CertificateListForm.h"
+
+
+using namespace Tizen::Base;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Graphics;
+using namespace Tizen::Security::Cert;
+
+extern "C"
+{
+void Finish(bool isSelected, int certId);
+}
+
+static const int HD_RESOLUTION_WIDTH = 720;
+static const int ITEM_HEIGHT = 112; // in 720X1280px resolution
+static const int ITEM_LEFT_MARGIN = 26; // in 720X1280px resolution
+static const wchar_t EMPTY_LIST_STRING[] = L"No Certificate";
+static const wchar_t TITLE_STRING[] = L"USER CERTIFICATES";
+
+CertificateListForm::CertificateListForm(void)
+       : __pCertList(null)
+       , __pCertIndex(null)
+       , __certCount(0)
+       , __itemLeftMargin(ITEM_LEFT_MARGIN)
+       , __itemHeight(ITEM_HEIGHT)
+{
+}
+
+CertificateListForm::~CertificateListForm(void)
+{
+}
+
+result
+CertificateListForm::Initialize(void)
+{
+       result r = E_SUCCESS;
+
+       r = Construct(FORM_STYLE_INDICATOR | FORM_STYLE_TITLE | FORM_STYLE_FOOTER);
+       SysTryReturnResult(NID_SEC_CERT, !IsFailed(r), E_SYSTEM, "Failed to construct CertificateListForm.");
+
+       return r;
+}
+
+result
+CertificateListForm::OnInitializing(void)
+{
+       result r = E_SUCCESS;
+
+       int count = 0;
+       int certCount = 0;
+       int invalidCount = 0;
+       Footer* pFooter = null;
+
+       r = SetTitleText(TITLE_STRING, ALIGNMENT_LEFT);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       // footer
+       pFooter = GetFooter();
+       SysTryReturnResult(NID_SEC_CERT, pFooter != null, E_SYSTEM, "Footer instance is not available.");
+
+       r = pFooter->SetStyle(FOOTER_STYLE_SEGMENTED_TEXT);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pFooter->SetBackButton();
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SetFormBackEventListener(this);
+
+       // load user certificates
+       _CertFieldInfos* pRawCertList = null;
+       certCount = _CertService::GetUserCertFieldInfoN(pRawCertList);
+       r = GetLastResult();
+       std::unique_ptr<_CertFieldInfos[]> pCertList(pRawCertList);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       // trivial condition
+       SysAssertf(((certCount > 0) && (pCertList != null)) || ((certCount == 0) && (pCertList == null))
+               , "A system error has been occurred. Because invalid cert count was returned.");
+
+       // cert index : count only for valid certificate
+       std::unique_ptr<int[]> pCertIndex(new (std::nothrow) int[certCount]);
+       SysTryReturnResult(NID_SEC_CERT, pCertIndex != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+       // assign number of certificate which is valid(certTitle or subjectName must be exist)
+       for (count = 0; count < certCount; count++)
+       {
+               if (!pCertList[count].certTitle[0] && !pCertList[count].subjectName[0])
+               {
+                       invalidCount++;
+                       continue;
+               }
+               pCertIndex[count - invalidCount] = count;
+       }
+       __certCount = certCount - invalidCount;
+
+       // listview
+       std::unique_ptr<ListView> pListView(new (std::nothrow) ListView());
+       SysTryReturnResult(NID_SEC_CERT, pListView != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+       if (__itemHeight == ITEM_HEIGHT && __itemLeftMargin == ITEM_LEFT_MARGIN)
+       {
+               double ratio = 1.0;
+               double logicalWidth = HD_RESOLUTION_WIDTH;
+               Dimension tempDim = CoordinateSystem::GetLogicalResolution();
+               logicalWidth = tempDim.width;
+               SysAssertf(logicalWidth > 0.0, "invalid logical resolution (%lf)", logicalWidth);
+
+               ratio = logicalWidth / HD_RESOLUTION_WIDTH;
+
+               // __itemHeight : 112 = logicalWidth : HD_RESOLUTION_WIDTH(720)
+               __itemHeight = static_cast<int>(__itemHeight * ratio);
+
+               // __itemLeftMargin : 26 = logicalWidth : HD_RESOLUTION_WIDTH(720)
+               __itemLeftMargin = static_cast<int>(__itemLeftMargin * ratio);
+       }
+
+       Rectangle rect(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height);
+       r = pListView->Construct(rect, true, false);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pListView->SetItemProvider(*this);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pListView->SetTextOfEmptyList(EMPTY_LIST_STRING);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pListView->AddListViewItemEventListener(*this);
+
+       r = AddControl(*(pListView.release()));
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+
+       __pCertIndex = std::move(pCertIndex);
+       __pCertList = std::move(pCertList);
+
+       return r;
+}
+
+result
+CertificateListForm::OnTerminating(void)
+{
+       return E_SUCCESS;
+}
+
+// IFormBackEventListener
+void
+CertificateListForm::OnFormBackRequested(Form& source)
+{
+       Finish(false, -1);
+}
+
+// IListViewItemProvider
+ListItemBase*
+CertificateListForm::CreateItem(int index, int itemWidth)
+{
+       result r = E_SUCCESS;
+       int validIndex = 0;
+       ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
+
+       Rectangle rect(__itemLeftMargin, 0, itemWidth - (__itemLeftMargin * 2), __itemHeight);
+       Dimension dim(itemWidth, __itemHeight);
+
+       SysLog(NID_SEC_CERT, "The current value of index is %d", index);
+
+       // convert to valid index
+       SysAssertf((index >= 0) && (index < __certCount), "index (%d) is out of range.", index);
+       SysAssertf(__pCertIndex != null, "__pCertIndex instance must not be null.");
+       validIndex = __pCertIndex[index];
+       SysLog(NID_SEC_CERT, "The current value of validIndex is %d", validIndex);
+
+       // make item
+       std::unique_ptr<CustomItem> pItem(new (std::nothrow) CustomItem());
+       SysTryReturn(NID_SEC_CERT, pItem != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+       r = pItem->Construct(dim, style);
+       SysTryReturn(NID_SEC_CERT, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       // prevent overflow
+       __pCertList[validIndex].certTitle[_MAX_ISSUER_SUBJECT_NAME_SIZE] = '\0';
+       __pCertList[validIndex].subjectName[_MAX_ISSUER_SUBJECT_NAME_SIZE] = '\0';
+
+       SysLog(NID_SEC_CERT, "The current value of certFileId is %d", __pCertList[validIndex].certFileId);
+
+       // add to item, certFileId become elementId
+       if (__pCertList[validIndex].certTitle[0])
+       {       // it has valid certTitle
+               SysLog(NID_SEC_CERT, "The current value of certTitle is %s", __pCertList[validIndex].certTitle);
+               r = pItem->AddElement(rect, __pCertList[validIndex].certFileId, __pCertList[validIndex].certTitle);
+               SysTryReturn(NID_SEC_CERT, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {       // it is not reached because it already checked by OnInitializing method.
+               SysAssertf(__pCertList[validIndex].subjectName[0], "_CertFieldInfos instance must not be null.");
+
+               // it has valid subjectName
+               SysLog(NID_SEC_CERT, "The current value of subjectName is %s", __pCertList[validIndex].subjectName);
+               r = pItem->AddElement(rect, __pCertList[validIndex].certFileId, __pCertList[validIndex].subjectName);
+               SysTryReturn(NID_SEC_CERT, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+
+       return pItem.release();
+}
+
+bool
+CertificateListForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
+{
+       delete pItem;
+       return true;
+}
+
+int
+CertificateListForm::GetItemCount(void)
+{
+       SysLog(NID_SEC_CERT, "The current value of __certCount is %d", __certCount);
+       return __certCount;
+}
+
+// IListViewItemEventListener
+void
+CertificateListForm::OnListViewItemStateChanged(ListView &listView, int index, int elementId, ListItemStatus status)
+{
+       SysLog(NID_SEC_CERT, "The current value of elementId(certFileId) is %d", elementId);
+       Finish(true, elementId);
+}
+
+void
+CertificateListForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
+{
+}
+
+void
+CertificateListForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
+{
+}
diff --git a/src/certmgr-app-control/CertificateListForm.h b/src/certmgr-app-control/CertificateListForm.h
new file mode 100644 (file)
index 0000000..88b0f36
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file               CertificateListForm.h
+ * @brief              This file contains the declaration of CertificateListForm class.
+ */
+
+#ifndef _CERTIFICATELISTFORM_H_
+#define _CERTIFICATELISTFORM_H_
+
+#include <unique_ptr.h>
+#include <FBaseDataType.h>
+#include <FUiCtrlForm.h>
+#include <FUiCtrlIFormBackEventListener.h>
+#include <FUiCtrlIListViewItemEventListener.h>
+#include <FUiCtrlIListViewItemProvider.h>
+#include <FUiCtrlListViewTypes.h>
+#include <FUiCtrlListItemBase.h>
+
+
+namespace Tizen { namespace Ui { namespace Controls
+{
+class ListView;
+} } } // Tizen::Ui::Controls
+
+namespace Tizen { namespace Security { namespace Cert
+{
+struct _CertFieldInfos;
+} } } // Tizen::Security::Cert
+
+class CertificateListForm
+       : public Tizen::Ui::Controls::Form
+       , virtual public Tizen::Ui::Controls::IListViewItemProvider
+       , virtual public Tizen::Ui::Controls::IListViewItemEventListener
+       , virtual public Tizen::Ui::Controls::IFormBackEventListener
+{
+
+// Construction
+public:
+       CertificateListForm(void);
+       virtual ~CertificateListForm(void);
+       result Initialize(void);
+
+private:
+       // prevent copy and assignment
+       CertificateListForm(const CertificateListForm& rhs);
+       CertificateListForm& operator =(const CertificateListForm& rhs);
+
+       // Form
+       virtual result OnInitializing(void);
+       virtual result OnTerminating(void);
+
+       // IFormBackEventListener
+       virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
+
+       // IListViewItemProvider
+       virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth);
+       virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth);
+       virtual int GetItemCount(void);
+
+       // IListViewItemEventListener
+       virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);
+       virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state);
+       virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);
+
+private:
+       std::unique_ptr<Tizen::Security::Cert::_CertFieldInfos[]> __pCertList;
+       std::unique_ptr<int[]> __pCertIndex;
+       int __certCount;
+       int __itemLeftMargin;
+       int __itemHeight;
+};
+
+#endif //_CERTIFICATELISTFORM_H_
diff --git a/src/contact-app-control/CMakeLists.txt b/src/contact-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..b02076f
--- /dev/null
@@ -0,0 +1,28 @@
+SET (this_target osp-ac-contact)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+  /usr/include/contacts-svc
+       )
+
+SET (${this_target}_SOURCE_FILES
+       ContactAppControlDllEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+TARGET_LINK_LIBRARIES(${this_target} "-lcontacts-service2")
+
+OSP_STRIP(${this_target})
diff --git a/src/contact-app-control/ContactAppControlDllEntry.cpp b/src/contact-app-control/ContactAppControlDllEntry.cpp
new file mode 100755 (executable)
index 0000000..557b303
--- /dev/null
@@ -0,0 +1,1059 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        ContactAppControlDllEntry.cpp
+ * @brief      This is the implementation for the ContactAppControlDllEntry.cpp class.
+ */
+
+#include <unique_ptr.h>
+#include <appsvc/appsvc.h>
+#include <contacts.h>
+
+#include <FBaseSysLog.h>
+#include <FBaseInteger.h>
+#include <FBaseUtilStringUtil.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+#include <FBaseColAllElementsDeleter.h>
+
+#include <FBase_StringConverter.h>
+#include <FIo_FileImpl.h>
+#include <FSys_EnvironmentImpl.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::System;
+using namespace Tizen::Social;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static char PICK_OP_SEL_MODE_KEY[] = "selectionMode";
+static char PICK_OP_RET_KEY_RET_TYPE[] = "returnType";
+static char PICK_OP_RET_KEY_VALUE[] = "value";
+
+static char EDIT_OP_KEY_CONTACT_ID[] = "contactId";
+static char EDIT_OP_KEY_PHONE[] = "phone";
+static char EDIT_OP_KEY_EMAIL[] = "email";
+static char EDIT_OP_KEY_URL[] = "url";
+
+static char VIEW_OP_KEY_VIEW_TYPE[] = "viewType";
+static char VIEW_OP_KEY_VCARD_PATH[] = "path";
+static char VIEW_OP_KEY_CONTACT_ID[] = "contactId";
+
+static char VIEW_OP_VALUE_CONTACT[] = "contact";
+static char VIEW_OP_VALUE_VCARD[] = "vcf";
+static int  VIEW_OP_VALUE_LENGTH_MAX = 7;
+
+static char PICK_OP_SEL_MODE_VALUE_SINGLE[] = "single";
+static char PICK_OP_SEL_MODE_VALUE_MULTIPLE[] = "multiple";
+
+static char PICK_OP_RET_VALUE_PHONE[] = "phone";
+static char PICK_OP_RET_VALUE_EMAIL[] = "email";
+static char PICK_OP_RET_VALUE_VCARD[] = "vcard";
+static char PICK_OP_RET_VALUE_CONTACT_ID[] = "contactId";
+
+static int PICK_OP_SEL_MODE_VALUE_LENGTH_MAX = 8;
+static int PICK_OP_RET_VALUE_LENGTH_MAX = 10;
+
+static char ADD_OP_KEY_NUMBER[] = "phone";
+static char ADD_OP_KEY_EMAIL[] = "email";
+static char ADD_OP_KEY_URL[] = "url";
+
+
+static char CORE_OP_KEY_TYPE[] = "type";
+static char CORE_OP_KEY_PERSON_ID[] = "ct_person_id";
+static char CORE_OP_KEY_NUMBER[] = "ct_num";
+static char CORE_OP_KEY_EMAIL[] = "ct_email";
+static char CORE_OP_KEY_URL[] = "ct_web";
+static char CORE_OP_KEY_VCARD[] = "ct_vcard";
+
+static char CORE_OP_VALUE_EDIT_PERSON[] = "11";
+static char CORE_OP_VALUE_EDIT_PERSON_BY_SEL[] = "20";
+
+static char CORE_OP_VALUE_VIEW_PERSON[] = "0";
+
+// PICK
+static char CORE_OP_VALUE_PICK_PERSON_ID[] = "11";
+static char CORE_OP_VALUE_PICK_NUMBER[] = "12";
+static char CORE_OP_VALUE_PICK_EMAIL[] = "13";
+static char CORE_OP_VALUE_PICK_VCARD[] = "14";
+static char CORE_OP_VALUE_PICK_PERSON_ID_LIST[] = "31";
+static char CORE_OP_VALUE_PICK_NUMBER_LIST[] = "32";
+static char CORE_OP_VALUE_PICK_EMAIL_LIST[] = "33";
+
+static char CORE_OP_VALUE_ADD_CONTACT[] = "21";
+
+static char CORE_RESULT_TYPE_KEY_NUMBER[] = "num_id";
+static char CORE_RESULT_TYPE_KEY_NUMBER_LIST[] = "num_id_list";
+static char CORE_RESULT_TYPE_KEY_EMAIL[] = "email_id";
+static char CORE_RESULT_TYPE_KEY_EMAIL_LIST[] = "email_id_list";
+static char CORE_RESULT_TYPE_KEY_PERSON[] = "person_id";
+static char CORE_RESULT_TYPE_KEY_PERSON_LIST[] = "person_id_list";
+static char CORE_RESULT_TYPE_KEY_VCARD[] = "vcard";
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+static const wchar_t __allowedAppControlPickTable[][2][64] =
+{
+       {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.PICK"},
+       {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.pick"},
+       {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/pick"},
+       {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/pick"},
+};
+
+static const wchar_t __allowedAppControlAddTable[][2][64] =
+{
+       {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.ADD"},
+       {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.add"},
+       {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/add"},
+       {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/add"},
+};
+
+static const wchar_t __allowedAppControlEditTable[][2][64] =
+{
+       {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.EDIT"},
+       {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.edit"},
+       {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/edit"},
+       {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/edit"},
+};
+
+static const wchar_t __allowedAppControlViewTable[][2][64] =
+{
+       {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.VIEW"},
+       {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.view"},
+       {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/view"},
+       {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/view"},
+};
+
+class ScopedConnection
+{
+public:
+       ScopedConnection(void)
+       : __connected(false)
+       {
+               int ret = contacts_connect2();
+               if (ret == CONTACTS_ERROR_NONE)
+               {
+                       __connected = true;
+               }
+       }
+
+       ~ScopedConnection(void)
+       {
+               if (__connected)
+               {
+                       contacts_disconnect2();
+               }
+       }
+
+       bool IsConnected(void) const
+       {
+               return __connected;
+       }
+
+private:
+       bool __connected;
+};
+
+
+class ScopedHandle
+{
+public:
+       ScopedHandle(contacts_record_h handle)
+       : __handle(handle)
+       {
+       }
+
+       ~ScopedHandle(void)
+       {
+               if (__handle != null)
+               {
+                       contacts_record_destroy(__handle, true);
+               }
+       }
+
+       contacts_record_h Get(void)
+       {
+               return __handle;
+       }
+
+       contacts_record_h Release(void)
+       {
+               contacts_record_h handle = __handle;
+               __handle = null;
+
+               return handle;
+       }
+
+private:
+       contacts_record_h __handle;
+};
+
+class ScopedList
+{
+public:
+       ScopedList(contacts_list_h handle)
+       : __handle(handle)
+       {
+       }
+
+       ~ScopedList(void)
+       {
+               if (__handle != null)
+               {
+                       contacts_list_destroy(__handle, true);
+               }
+       }
+
+       contacts_list_h Get(void)
+       {
+               return __handle;
+       }
+
+private:
+       contacts_list_h __handle;
+};
+
+class ScopedFilter
+{
+public:
+       ScopedFilter(contacts_filter_h filter)
+       : __filter(filter)
+       {
+       }
+
+       ~ScopedFilter(void)
+       {
+               if (__filter != null)
+               {
+                       contacts_filter_destroy(__filter);
+               }
+       }
+
+       contacts_filter_h Get(void)
+       {
+               return __filter;
+       }
+
+private:
+       contacts_filter_h __filter;
+};
+
+class ScopedQuery
+{
+public:
+       ScopedQuery(contacts_query_h query)
+       : __query(query)
+       {
+       }
+
+       ~ScopedQuery(void)
+       {
+               if (__query != null)
+               {
+                       contacts_query_destroy(__query);
+               }
+       }
+
+       contacts_query_h Get(void)
+       {
+               return __query;
+       }
+
+private:
+       contacts_query_h __query;
+};
+result
+StartAppControlForPick(const String* pUri, const String* pMime, const IMap* pMap)
+{
+       _AppMessageImpl msg;
+       msg.AddData(pMap);
+
+       const char* pBuf = appsvc_get_data(msg.GetBundle(), PICK_OP_SEL_MODE_KEY);
+       if (pBuf == null)
+       {
+               SysLog(NID_APP, "selectionMode has not been set");
+               return E_INVALID_ARG;
+       }
+
+       if (strncmp(pBuf, PICK_OP_SEL_MODE_VALUE_SINGLE, PICK_OP_SEL_MODE_VALUE_LENGTH_MAX) == 0)
+       {
+               pBuf = appsvc_get_data(msg.GetBundle(), PICK_OP_RET_KEY_RET_TYPE);
+               if (pBuf == null)
+               {
+                       SysLog(NID_APP, "returnType has not been set");
+                       return E_INVALID_ARG;
+               }
+
+               if (strncmp(pBuf, PICK_OP_RET_VALUE_PHONE, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_NUMBER);
+               }
+               else if (strncmp(pBuf, PICK_OP_RET_VALUE_EMAIL, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_EMAIL);
+               }
+               else if (strncmp(pBuf, PICK_OP_RET_VALUE_VCARD, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_VCARD);
+               }
+               else if (strncmp(pBuf, PICK_OP_RET_VALUE_CONTACT_ID, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_PERSON_ID);
+               }
+               else
+               {
+                       SysLog(NID_APP, "returnType must be one of phone, email, contactId, or vcard.");
+                       return E_INVALID_ARG;
+               }
+       }
+       else if (strncmp(pBuf, PICK_OP_SEL_MODE_VALUE_MULTIPLE, PICK_OP_SEL_MODE_VALUE_LENGTH_MAX) == 0)
+       {
+               pBuf = appsvc_get_data(msg.GetBundle(), PICK_OP_RET_KEY_RET_TYPE);
+               if (pBuf == null)
+               {
+                       SysLog(NID_APP, "returnType has not been set");
+                       return E_INVALID_ARG;
+               }
+
+               if (strncmp(pBuf, PICK_OP_RET_VALUE_PHONE, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_NUMBER_LIST);
+               }
+               else if (strncmp(pBuf, PICK_OP_RET_VALUE_EMAIL, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_EMAIL_LIST);
+               }
+               else if (strncmp(pBuf, PICK_OP_RET_VALUE_CONTACT_ID, PICK_OP_RET_VALUE_LENGTH_MAX) == 0)
+               {
+                       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_PICK_PERSON_ID_LIST);
+               }
+               else
+               {
+                       SysLog(NID_APP, "returnType must be one of phone, email, contactId.");
+                       return E_INVALID_ARG;
+               }
+       }
+       else
+       {
+               SysLog(NID_APP, "selectionMode must be either of single or multiple.");
+               return E_INVALID_ARG;
+       }
+
+       __processId = _AppControlManager::GetInstance()->Launch(msg, "contacts-list-efl", NULL, NULL, NULL, OnAppControlResult, 0);
+       
+       SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Contacts List AppControl is failed.");
+
+       return E_SUCCESS;
+}
+
+result
+StartAppControlForAdd(const String* pUri, const String* pMime, const IMap* pMap)
+{
+       _AppMessageImpl msg;
+       msg.AddData(pMap);
+
+       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_ADD_CONTACT);
+
+       const char* pBuf = appsvc_get_data(msg.GetBundle(), ADD_OP_KEY_NUMBER);
+       if (pBuf != null)
+       {
+               msg.AddData(CORE_OP_KEY_NUMBER, String(pBuf));
+       }
+
+       pBuf = appsvc_get_data(msg.GetBundle(), ADD_OP_KEY_EMAIL);
+       if (pBuf != null)
+       {
+               msg.AddData(CORE_OP_KEY_EMAIL, String(pBuf));
+       }
+
+       pBuf = appsvc_get_data(msg.GetBundle(), ADD_OP_KEY_URL);
+       if (pBuf != null)
+       {
+               msg.AddData(CORE_OP_KEY_URL, String(pBuf));
+       }
+
+       __processId = _AppControlManager::GetInstance()->Launch(msg, "contacts-details-efl", NULL, NULL, NULL, NULL, 0);
+
+       SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Contacts Details AppControl is failed.");
+
+       return E_SUCCESS;
+}
+
+result
+StartAppControlForEdit(const String* pUri, const String* pMime, const IMap* pMap)
+{
+       _AppMessageImpl msg;
+       msg.AddData(pMap);
+
+       const char* pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_CONTACT_ID);
+       if (pBuf != null)
+       {
+               int contactId = atoi(pBuf);
+               int personId = -1;
+
+               ScopedConnection conn;
+               if (conn.IsConnected())
+               {
+                       contacts_record_h contactHandle = null;
+                       int ret = contacts_db_get_record(_contacts_simple_contact._uri, contactId, &contactHandle);
+                       if (ret == CONTACTS_ERROR_NONE)
+                       {
+                               contacts_record_get_int(contactHandle, _contacts_simple_contact.person_id, &personId);
+                               contacts_record_destroy(contactHandle, true);
+                       }
+
+                       SysLog(NID_APP, "contact ID(%s) -> person ID(%d).", pBuf, personId);
+               }
+
+               msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_EDIT_PERSON);
+               msg.AddData(CORE_OP_KEY_PERSON_ID, Integer::ToString(personId));
+
+               pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_PHONE);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_NUMBER, String(pBuf));
+               }
+
+               pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_EMAIL);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_EMAIL, String(pBuf));
+               }
+
+               pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_URL);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_URL, String(pBuf));
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "contacts-details-efl", NULL, NULL, NULL, NULL, 0);
+               
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Contacts Details AppControl is failed.");
+       }
+       else
+       {
+               msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_EDIT_PERSON_BY_SEL);
+
+               pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_PHONE);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_NUMBER, String(pBuf));
+               }
+
+               pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_EMAIL);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_EMAIL, String(pBuf));
+               }
+
+               pBuf = appsvc_get_data(msg.GetBundle(), EDIT_OP_KEY_URL);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_URL, String(pBuf));
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "contacts-list-efl", NULL, NULL, NULL, NULL, 0);
+               
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Contacts List AppControl is failed.");
+       }
+
+       return E_SUCCESS;
+}
+
+result
+StartAppControlForView( const String* pUri, const String* pMime, const IMap* pMap)
+{
+
+       _AppMessageImpl msg;
+       msg.AddData(pMap);
+
+       msg.AddData(CORE_OP_KEY_TYPE, CORE_OP_VALUE_VIEW_PERSON);
+
+       const char* pBuf = appsvc_get_data(msg.GetBundle(), VIEW_OP_KEY_VIEW_TYPE);
+       if (pBuf == null)
+       {
+               SysLog(NID_APP, "viewType has not been set");
+               return E_SUCCESS;
+       }
+
+       if (strncmp(pBuf, VIEW_OP_VALUE_CONTACT, VIEW_OP_VALUE_LENGTH_MAX) == 0)
+       {
+               int contactId = -1;
+               int personId = -1;
+
+               ScopedConnection conn;
+               
+               pBuf = appsvc_get_data(msg.GetBundle(), VIEW_OP_KEY_CONTACT_ID);
+               if (pBuf != null)
+               {
+                       contactId = atoi(pBuf);
+
+                       if (conn.IsConnected())
+                       {
+                               contacts_record_h contactHandle = null;
+                               int ret = contacts_db_get_record(_contacts_simple_contact._uri, contactId, &contactHandle);
+                               if (ret == CONTACTS_ERROR_NONE)
+                               {
+                                       contacts_record_get_int(contactHandle, _contacts_simple_contact.person_id, &personId);
+                                       contacts_record_destroy(contactHandle, true);
+
+                               }
+                       }
+               }
+               else
+               {
+                       SysLog(NID_APP, "The value for contactId is not set.");
+                       return E_SUCCESS;
+               }
+
+               msg.AddData(CORE_OP_KEY_PERSON_ID, Integer::ToString(personId));
+       }
+       else if (strncmp(pBuf, VIEW_OP_VALUE_VCARD, VIEW_OP_VALUE_LENGTH_MAX) == 0)
+       {
+               pBuf = appsvc_get_data(msg.GetBundle(), VIEW_OP_KEY_VCARD_PATH);
+               if (pBuf != null)
+               {
+                       msg.AddData(CORE_OP_KEY_VCARD, pBuf);
+               }
+               else
+               {
+                       SysLog(NID_APP, "The value for path is not set.");
+                       return E_SUCCESS;
+               }
+
+       }
+       else
+       {
+               SysLog(NID_APP, "viewType must be either of vcf or contact.");
+               return E_SUCCESS;
+       }
+       
+       __processId = _AppControlManager::GetInstance()->Launch(msg, "contacts-details-efl", NULL, NULL, NULL, NULL, 0);
+
+       SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Contacts Details AppControl is failed.");
+
+       return E_SUCCESS;
+}
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Contact AppControl");
+
+       result r = E_SUCCESS;
+
+       const bool isContactPick = _AppControlManager::IsAllowedAppControl(__allowedAppControlPickTable, 4, aId, oId);
+       const bool isContactAdd = _AppControlManager::IsAllowedAppControl(__allowedAppControlAddTable, 4, aId, oId);
+       const bool isContactEdit = _AppControlManager::IsAllowedAppControl(__allowedAppControlEditTable, 4, aId, oId);
+       const bool isContactView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 4, aId, oId);
+
+       SysTryReturnResult(NID_APP, isContactPick || isContactAdd || isContactEdit || isContactView, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+       SysLog(NID_APP, "Contact AppControl : %ls operation.", oId.GetPointer());
+
+       if (isContactPick)
+       {
+               SysLog(NID_APP, "Contact AppControl : PICK operation.");
+
+               __req = req;
+
+               r = StartAppControlForPick(pUri, pMime, pMap);
+               if (r == E_INVALID_ARG)
+               {
+                       SysLog(NID_APP, "Finish pick operation.");
+                       _AppControlManager::GetInstance()->FinishAppControl(__req, APP_CTRL_RESULT_FAILED, null);
+
+                       __req = -1;
+
+                       return E_SUCCESS;
+               }
+               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
+
+               SysLog(NID_APP, "StartAppControl: Launching Contact AppControl succeeded");
+       }
+       else if (isContactAdd)
+       {
+               SysLog(NID_APP, "Contact AppControl : ADD operation.");
+
+               r = StartAppControlForAdd(pUri, pMime, pMap);
+               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
+
+               SysLog(NID_APP, "StartAppControl: Launching Contact AppControl succeeded");
+       }
+       else if (isContactEdit)
+       {
+               SysLog(NID_APP, "Contact AppControl : EDIT operation.");
+
+               r = StartAppControlForEdit(pUri, pMime, pMap);
+               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
+
+               SysLog(NID_APP, "StartAppControl: Launching Contact AppControl succeeded");
+       }
+       else if (isContactView)
+       {
+               SysLog(NID_APP, "Contact AppControl : VIEW operation.");
+
+               r = StartAppControlForView(pUri, pMime, pMap);
+               SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
+
+               SysLog(NID_APP, "StartAppControl: Launching Contact AppControl succeeded");
+       }
+
+       return r;
+
+CATCH:
+       __req = -1;
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+void
+OnAppControlResultForPickNumber(const char* pRawData, HashMap* pResult)
+{
+       ScopedConnection conn;
+       if (!conn.IsConnected())
+       {
+               return;
+       }
+
+       int numberId = atoi(pRawData);
+       char* pPhoneNumber = null;
+
+       contacts_record_h recordHandle = null;
+
+       int ret = contacts_db_get_record(_contacts_number._uri, numberId, &recordHandle);
+       if (ret == CONTACTS_ERROR_NONE)
+       {
+               ScopedHandle numberHandle(recordHandle);
+               contacts_record_get_str_p(numberHandle.Get(), _contacts_number.number, &pPhoneNumber);
+
+               pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(PICK_OP_RET_VALUE_PHONE));
+               pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(pPhoneNumber));
+       }
+}
+
+void
+OnAppControlResultForPickNumberList(const char* pRawData, HashMap* pResult)
+{
+       ScopedConnection conn;
+       if (!conn.IsConnected())
+       {
+               return;
+       }
+
+       int id = 0;
+       bool isFirst = true;
+       String numbers;
+       String encodedString(pRawData);
+       std::unique_ptr<ByteBuffer> pDecodeByteBuffer(StringUtil::DecodeBase64StringN(encodedString));
+       
+       while (pDecodeByteBuffer->GetInt(id) == E_SUCCESS)
+       {
+               char* pNumber = null;
+               contacts_record_h recordHandle = null;
+               int ret = contacts_db_get_record(_contacts_number._uri, id, &recordHandle);
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       continue;
+               }
+       
+               ScopedHandle numberHandle(recordHandle);
+               
+               contacts_record_get_str_p(numberHandle.Get(), _contacts_number.number, &pNumber);
+
+               if(!isFirst)
+               {
+                       numbers.Append(L";");
+               }
+               else
+               {
+                       isFirst = false;
+               }
+
+               numbers.Append(pNumber);
+       }
+
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(L"phone"));
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(numbers));
+}
+
+
+void
+OnAppControlResultForPickEmail(const char* pRawData, HashMap* pResult)
+{
+       ScopedConnection conn;
+       if (!conn.IsConnected())
+       {
+               return;
+       }
+
+       char* pEmail = null;
+       int emailId = atoi(pRawData);
+       contacts_record_h recordHandle = null;
+
+       int ret = contacts_db_get_record(_contacts_email._uri, emailId, &recordHandle);
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+       ScopedHandle emailHandle(recordHandle);
+
+       contacts_record_get_str_p(emailHandle.Get(), _contacts_email.email, &pEmail);
+
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(PICK_OP_RET_VALUE_EMAIL));
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(pEmail));
+}
+
+void
+OnAppControlResultForPickEmailList(const char* pRawData, HashMap* pResult)
+{
+       ScopedConnection conn;
+       if (!conn.IsConnected())
+       {
+               return;
+       }
+
+       int id = 0;
+       bool isFirst = true;
+       String emailIds;
+       String encodedString(pRawData);
+       std::unique_ptr<ByteBuffer> pDecodeByteBuffer(StringUtil::DecodeBase64StringN(encodedString));
+
+       while (pDecodeByteBuffer->GetInt(id) == E_SUCCESS)
+       {
+               char* pEmail = null;
+               contacts_record_h recordHandle = null;
+               int ret = contacts_db_get_record(_contacts_email._uri, id, &recordHandle);
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       continue;
+               }
+
+               ScopedHandle emailHandle(recordHandle);
+               contacts_record_get_str_p(emailHandle.Get(), _contacts_email.email, &pEmail);
+
+               if(!isFirst)
+               {
+                       emailIds.Append(L";");
+               }
+               else
+               {
+                       isFirst = false;
+               }
+
+               emailIds.Append(pEmail);
+       }
+
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(L"email"));
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(emailIds));
+}
+
+void
+OnAppControlResultForPickContact(const char* pRawData, HashMap* pResult)
+{
+       ScopedConnection conn;
+       if (!conn.IsConnected())
+       {
+               return;
+       }
+
+       int personId = atoi(pRawData);
+       int contactId = 0;
+
+       unsigned int simple_contact_projection[] = {
+               _contacts_simple_contact.id,
+               _contacts_simple_contact.address_book_id,
+       };
+
+       contacts_filter_h filterHandle = null;
+       int ret = contacts_filter_create(_contacts_simple_contact._uri, &filterHandle);
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+       ScopedFilter filter(filterHandle);
+       contacts_filter_add_int(filter.Get(), _contacts_simple_contact.person_id, CONTACTS_MATCH_EQUAL, personId);
+
+       contacts_query_h queryHandle = null;
+       ret = contacts_query_create(_contacts_simple_contact._uri, &queryHandle);
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+       ScopedQuery query(queryHandle);
+       ret = contacts_query_set_filter(query.Get(), filter.Get());
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+       ret = contacts_query_set_projection(query.Get(), simple_contact_projection, sizeof(simple_contact_projection)/sizeof(unsigned int));
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+       ret = contacts_query_set_sort(query.Get(), _contacts_simple_contact.address_book_id, true);
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+
+       contacts_list_h listHandle = null;
+       ret = contacts_db_get_records_with_query(query.Get(), 0, 0, &listHandle);
+       if (ret != CONTACTS_ERROR_NONE)
+       {
+               return;
+       }
+
+       ScopedList contactList(listHandle);
+
+       unsigned int count = 0;
+       contacts_list_get_count(contactList.Get(), &count);
+       if (count <= 0)
+       {
+               return;
+       }
+
+       contacts_record_h contactHandle = null;
+       contacts_list_get_current_record_p(contactList.Get(), &contactHandle);
+       contacts_record_get_int(contactHandle, _contacts_simple_contact.id, &contactId);
+
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(PICK_OP_RET_VALUE_CONTACT_ID));
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(Integer::ToString(contactId)));
+}
+
+void
+OnAppControlResultForPickContactList(const char* pRawData, HashMap* pResult)
+{
+       ScopedConnection conn;
+       if (!conn.IsConnected())
+       {
+               return;
+       }
+
+       String personIds;
+       int id = 0;
+       int contactId;
+       bool isFirst = true;
+       String encodedString(pRawData);
+       std::unique_ptr<ByteBuffer> pDecodeByteBuffer(StringUtil::DecodeBase64StringN(encodedString));
+
+       while (pDecodeByteBuffer->GetInt(id) == E_SUCCESS)
+       {
+               unsigned int simple_contact_projection[] = {
+                       _contacts_simple_contact.id,
+                       _contacts_simple_contact.address_book_id,
+               };
+
+               contacts_record_h contactHandle = null;
+
+               contacts_filter_h filterHandle = null;
+               int ret = contacts_filter_create(_contacts_simple_contact._uri, &filterHandle);
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       break;
+               }
+
+               ScopedFilter filter(filterHandle);
+               
+
+               contacts_filter_add_int(filter.Get(), _contacts_simple_contact.person_id, CONTACTS_MATCH_EQUAL, id);
+
+               contacts_query_h queryHandle = null;
+               ret = contacts_query_create(_contacts_simple_contact._uri, &queryHandle);
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       break;
+               }
+
+               ScopedQuery query(queryHandle);
+
+               ret = contacts_query_set_filter(query.Get(), filter.Get());
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       break;
+               }
+
+               ret = contacts_query_set_projection(query.Get(), simple_contact_projection, sizeof(simple_contact_projection)/sizeof(unsigned int));
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       break;
+               }
+
+               ret = contacts_query_set_sort(query.Get(), _contacts_simple_contact.address_book_id, true);
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       break;
+               }
+
+
+               contacts_list_h listHandle = null;
+               ret = contacts_db_get_records_with_query(query.Get(), 0, 0, &listHandle);
+               if (ret != CONTACTS_ERROR_NONE)
+               {
+                       break;
+               }
+
+               ScopedList contactList(listHandle);
+               unsigned int count = 0;
+               contacts_list_get_count(contactList.Get(), &count);
+               if (count > 0)
+               {
+                       contacts_list_get_current_record_p(contactList.Get(), &contactHandle);
+                       contacts_record_get_int(contactHandle, _contacts_simple_contact.id, &contactId);
+                       if (!isFirst)
+                       {
+                               personIds.Append(L";");
+                       }
+                       else
+                       {
+                               isFirst = false;
+                       }
+
+                       personIds.Append(id);
+
+               }
+       }
+
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(PICK_OP_RET_VALUE_CONTACT_ID));
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(personIds));
+
+       contacts_disconnect2();
+
+}
+
+void
+OnAppControlResultForPickVcard(const char* pRawData, HashMap* pResult)
+{
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_RET_TYPE), new (std::nothrow) String(PICK_OP_RET_VALUE_VCARD));
+       pResult->Add(new (std::nothrow) String(PICK_OP_RET_KEY_VALUE), new (std::nothrow) String(pRawData));
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+       AppCtrlResult appControlResult = APP_CTRL_RESULT_SUCCEEDED;
+       std::unique_ptr<HashMap, AllElementsDeleter> pResult(null);
+
+       switch (res)
+       {   
+       case SERVICE_RESULT_SUCCEEDED:
+               {   
+                       pResult.reset(new (std::nothrow) HashMap());
+                       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+                       r = pResult->Construct();
+                       SysTryCatch(NID_APP, !IsFailed(r), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+                       const char* pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_NUMBER);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickNumber(pBuf, pResult.get());
+                               break;
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_EMAIL);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickEmail(pBuf, pResult.get());
+                               break;
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_PERSON);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickContact(pBuf, pResult.get());
+                               break;
+                       }
+                               
+                       pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_VCARD);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickVcard(pBuf, pResult.get());
+                               break;
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_NUMBER_LIST);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickNumberList(pBuf, pResult.get());
+                               break;
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_EMAIL_LIST);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickEmailList(pBuf, pResult.get());
+                               break;
+                       }
+
+                       pBuf = appsvc_get_data(pBundle, CORE_RESULT_TYPE_KEY_PERSON_LIST);
+                       if (pBuf != null)
+                       {
+                               OnAppControlResultForPickContactList(pBuf, pResult.get());
+                               break;
+                       }
+
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+       case SERVICE_RESULT_CANCELED:
+       default:
+               appControlResult = APP_CTRL_RESULT_FAILED;
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, appControlResult, pResult.release());
+
+CATCH:
+       __req = -1;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/media-app-control/CMakeLists.txt b/src/media-app-control/CMakeLists.txt
new file mode 100644 (file)
index 0000000..708e2ff
--- /dev/null
@@ -0,0 +1,27 @@
+SET (this_target osp-ac-media)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       MediaAppControlDLLEntry.cpp
+       ParseUtil.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/media-app-control/MediaAppControlDLLEntry.cpp b/src/media-app-control/MediaAppControlDLLEntry.cpp
new file mode 100755 (executable)
index 0000000..e10f1ca
--- /dev/null
@@ -0,0 +1,429 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        MediaAppControlDllEntry.cpp
+ * @brief      This is the implementation for the MediaAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+
+#include "ParseUtil.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
+
+#define _DUMMY_APPCONTROL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+void OnAppControlResultGallery(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+static const wchar_t __allowedAppControlImageTable[][2][64] =
+{
+       {L"osp.appcontrol.IMAGE", L"osp.appcontrol.operation.VIEW"},
+       {L"osp.appcontrol.provider.image", L"osp.appcontrol.operation.view"},
+       {L"http://tizen.org/appcontrol/provider/image", L"http://tizen.org/appcontrol/operation/view"},
+       {L"tizen.imageviewer", L"http://tizen.org/appcontrol/operation/view"},
+};
+
+static const wchar_t __allowedAppControlVideoTable[][2][64] =
+{
+       {L"osp.appcontrol.VIDEO", L"osp.appcontrol.operation.PLAY"},
+       {L"osp.appcontrol.provider.video", L"osp.appcontrol.operation.play"},
+       {L"http://tizen.org/appcontrol/provider/video", L"http://tizen.org/appcontrol/operation/play"},
+       {L"tizen.videoplayer", L"http://tizen.org/appcontrol/operation/view"},
+};
+
+static const wchar_t __allowedAppControlAudioTable[][2][64] =
+{
+       {L"osp.appcontrol.AUDIO", L"osp.appcontrol.operation.PLAY"},
+       {L"osp.appcontrol.provider.audio", L"osp.appcontrol.operation.play"},
+       {L"http://tizen.org/appcontrol/provider/audio", L"http://tizen.org/appcontrol/operation/play"},
+       {L"tizen.musicplayer", L"http://tizen.org/appcontrol/operation/view"},
+};
+
+static const wchar_t __allowedAppControlMediaTable[][2][64] =
+{
+       {L"osp.appcontrol.MEDIA", L"osp.appcontrol.operation.PICK"},
+       {L"osp.appcontrol.provider.media", L"osp.appcontrol.operation.pick"},
+       {L"http://tizen.org/appcontrol/provider/media", L"http://tizen.org/appcontrol/operation/pick"},
+       {L"tizen.filemanager", L"http://tizen.org/appcontrol/operation/pick"},
+};
+
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUriData, const String* pMime, const IMap* pMap)
+{
+       result r = E_SYSTEM;
+       SysLog(NID_APP, "StartAppControl: Entry to Media AppControl");
+
+       const bool isImage = _AppControlManager::IsAllowedAppControl(__allowedAppControlImageTable, 4, aId, oId);
+       const bool isVideo = _AppControlManager::IsAllowedAppControl(__allowedAppControlVideoTable, 4, aId, oId);
+       const bool isAudio = _AppControlManager::IsAllowedAppControl(__allowedAppControlAudioTable, 4, aId, oId);
+       const bool isMedia = _AppControlManager::IsAllowedAppControl(__allowedAppControlMediaTable, 4, aId, oId);
+
+       if (isImage)
+       {
+               char* pPath = null;
+               SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               const String& type = msg.GetValue(KEY_TYPE);
+               String value = msg.GetValue(KEY_PATH);
+
+               if (!value.IsEmpty())
+               {
+                       if (!value.StartsWith(L"file://", 0))
+                       {
+                               SysLog(NID_APP, "Inserting file scheme for %ls.", value.GetPointer());
+                               value.Insert(L"file://", 0);
+                       }
+                       pPath = _StringConverter::CopyToCharArrayN(value);              // Store the path
+               }
+
+               SysLog(NID_APP, "type(%ls), path(%ls)", type.GetPointer(), value.GetPointer());
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "image-viewer-efl", APPSVC_OPERATION_VIEW, NULL, pPath, NULL, 0);
+
+               delete [] pPath;
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Image AppControl is failed.");
+               r = E_SUCCESS;
+       }
+       else if (isAudio)
+       {
+               char* pPath = null;
+               char* pUri = null;
+               SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               String tmp = msg.GetValue(L"path");
+               if (!tmp.IsEmpty())
+               {
+                       if (tmp.StartsWith(L"http://", 0)
+                                       || tmp.StartsWith(L"rtsp://", 0)
+                                       || tmp.StartsWith(L"https://", 0))
+                       {
+                               // URI
+                               pUri = _StringConverter::CopyToCharArrayN(tmp);
+                               int i = 0;
+                               r = tmp.LastIndexOf(L'.', tmp.GetLength() - 1, i);
+                               if (r == E_SUCCESS)
+                               {
+                                       String extension;
+                                       tmp.SubString(i + 1, extension);
+
+                                       String mime;
+                                       r = _AppControlManager::GetMimeFromExt(extension, mime);
+                                       if (!IsFailed(r))
+                                       {
+                                               if (mime.Equals(L"video/3gpp", true))
+                                               {
+                                                       SysLog(NID_APP, "Fix-up for audio appcontrol with [video/3gpp].");
+                                                       mime = L"audio/3gpp";
+                                               }
+                                               pPath = _StringConverter::CopyToCharArrayN(mime);
+                                               SysLog(NID_APP, "URI(%s), MIME(%s) for music player", pUri, pPath);
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               // normal file path
+                               pUri = _StringConverter::CopyToCharArrayN(tmp);         // Store the path
+                       }
+               }
+
+               // Check the exit on back option.
+               const String& exit = msg.GetValue(L"ExitOnBack");
+               if (!exit.IsEmpty())
+               {
+                       bundle_del(msg.GetBundle(), "__APP_SVC_K_WIN_ID__");
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "org.tizen.sound-player", APPSVC_OPERATION_VIEW, pPath, pUri, NULL, 0);
+               if (__processId <= 0)
+               {
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "com.samsung.sound-player", APPSVC_OPERATION_VIEW, pPath, pUri, NULL, 0);
+               }
+
+               delete [] pPath;
+               delete [] pUri;
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Audio AppControl is failed.");
+               r = E_SUCCESS;
+       }
+       else if (isVideo)
+       {
+               char* pPath = null;
+               SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               String tmp = msg.GetValue(L"path");
+               if (!tmp.IsEmpty())
+               {
+                       if (tmp.StartsWith(L"http://", 0)
+                                       || tmp.StartsWith(L"rtsp://", 0)
+                                       || tmp.StartsWith(L"file://", 0)
+                                       || tmp.StartsWith(L"https://", 0))
+                       {
+                               SysLog(NID_APP, "URI input");
+                       }
+                       else
+                       {
+                               // [INFO] path should be absolute path
+                               tmp.Insert(L"file://", 0);
+                       }
+                       pPath = _StringConverter::CopyToCharArrayN(tmp);                // Store the path
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "org.tizen.video-player", APPSVC_OPERATION_VIEW, NULL, pPath, NULL, 0);
+               if (__processId <= 0)
+               {
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "com.samsung.video-player", APPSVC_OPERATION_VIEW, NULL, pPath, NULL, 0);
+               }
+
+               delete [] pPath;
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Video AppControl is failed.");      
+               r = E_SUCCESS;
+       }
+       else if (isMedia)
+       {
+               const int TYPE_ALL = 0;
+               const int TYPE_AUDIO = 1;
+               const int TYPE_VIDEO = 2;
+               const int TYPE_IMAGE = 3;
+
+               bool singleSelection = true;
+               int type = -1;
+
+               SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               const char* pBuf = appsvc_get_data(msg.GetBundle(), "selectionType");
+               if (pBuf)
+               {
+                       singleSelection = !(strncmp(pBuf, "multiple", 9) == 0);
+               }
+
+               pBuf = appsvc_get_data(msg.GetBundle(), "type");
+               if (pBuf)
+               {
+                       if (strncmp(pBuf, "all", sizeof("all")) == 0)
+                       {
+                               type = TYPE_ALL;
+                       }
+                       else if (strncmp(pBuf, "image", sizeof("image")) == 0)
+                       {
+                               type = TYPE_IMAGE;
+                       }
+                       else if (strncmp(pBuf, "video", sizeof("video")) == 0)
+                       {
+                               type = TYPE_VIDEO;
+                       }
+                       else if (strncmp(pBuf, "audio", sizeof("audio")) == 0)
+                       {
+                               type = TYPE_AUDIO;
+                       }
+               }
+
+               switch (type)
+               {
+               case TYPE_ALL:
+                       msg.AddData(L"file_type", L"ALL");
+
+                       msg.AddData(L"select_type", (singleSelection) ? "SINGLE_FILE" : "MULTI_FILE");
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "myfile-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
+
+                       __req = req;
+                       break;
+               case TYPE_AUDIO:
+                       msg.AddData(L"file_type", L"SOUND");
+                       
+                       msg.AddData(L"select_type", (singleSelection) ? "SINGLE_FILE" : "MULTI_FILE");
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "myfile-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
+
+                       __req = req;
+                       break;
+               case TYPE_IMAGE:
+                       msg.AddData(L"file-type", L"image");
+
+                       msg.AddData(L"launch-type", (singleSelection) ? "select-one" : "select-multiple");
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "gallery-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResultGallery, 0);
+
+                       __req = req;
+                       break;
+               case TYPE_VIDEO:
+                       msg.AddData(L"file-type", L"video");
+
+                       msg.AddData(L"launch-type", (singleSelection) ? "select-one" : "select-multiple");
+                       __processId = _AppControlManager::GetInstance()->Launch(msg, "gallery-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResultGallery, 0);
+
+                       __req = req;
+                       break;
+               default:
+                       SysLog(NID_APP, "Wrong type or no type information.");
+                       break;
+               }
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Media AppControl is failed.");
+               r = E_SUCCESS;
+       }
+       else if (aId == L"osp.appcontrol.provider.imageeditor")
+       {
+#if defined (_DUMMY_APPCONTROL)
+               SysLogException(NID_MEDIA, E_SUCCESS, "NOT IMPLEMENTED");
+               HashMap* pResult = null;
+               pResult = new (std::nothrow) HashMap();
+               SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+               r = pResult->Construct();
+
+               pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(L"/opt/media/Images/image2.jpg"));
+               _AppControlManager::GetInstance()->FinishAppControl(req, 0, pResult);
+               delete pResult;
+               r = E_SUCCESS;
+#endif
+       }
+
+       return r;
+
+CATCH:
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       SysLog(NID_APP, "@@@@@@ OnAppControlResult for myfiles");
+
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+
+       HashMap* pResult = new (std::nothrow) HashMap();
+       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+       r = pResult->Construct();
+
+       switch (res)
+       {
+       case SERVICE_RESULT_SUCCEEDED:
+               {
+                       const char* const pData = appsvc_get_data(pBundle, "result");
+                       if (pData)
+                       {
+                               SysLog(NID_APP, "Received data is [%s].", pData);
+
+                               // [INFO] '?' delimiter for multifile files
+                               String tmp = pData;
+                               tmp.Replace(L'?', L';');
+                               SysLog(NID_APP, "Converted string is [%ls].", tmp.GetPointer());
+                               pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(tmp));
+                       }
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+               break;
+#if 0
+       case SERVICE_RESULT_CANCELED:
+               break;
+#endif
+       default:
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+       __req = -1;
+}
+
+void
+OnAppControlResultGallery(void* b, int requestCode, service_result_e res, void* userData)
+{
+       SysLog(NID_APP, "@@@@@@ OnAppControlResult for gallery");
+
+       // the result from ug does not follow service protocol
+       // success -> ("path", value)
+       // cancel -> ("ug-quit", "normal")
+
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+
+       const char* pData = appsvc_get_data(pBundle, "path");
+
+       if (pData)
+       {
+               HashMap* pResult = new (std::nothrow) HashMap();
+               SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+               r = pResult->Construct();
+
+               SysLog(NID_APP, "Received data is [%s].", pData);
+               pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(pData));
+               _AppControlManager::GetInstance()->FinishAppControl(__req, APP_CTRL_RESULT_SUCCEEDED, pResult);
+       }
+       else
+       {
+               pData = appsvc_get_data(pBundle, "ug-quit");
+               SysLog(NID_APP, "The operation cancled or finished (%s)", (pData) ? pData : "no-data");
+               _AppControlManager::GetInstance()->FinishAppControl(__req, APP_CTRL_RESULT_CANCELED, null);
+       }
+
+CATCH:
+       __req = -1;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/media-app-control/ParseUtil.cpp b/src/media-app-control/ParseUtil.cpp
new file mode 100644 (file)
index 0000000..c821b96
--- /dev/null
@@ -0,0 +1,242 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 <FBaseSysLog.h>
+#include "ParseUtil.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
+
+result
+ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, int &value)
+{
+       result r = E_SUCCESS;
+       String token;
+
+       StringTokenizer strTok(src, delimeter); 
+       SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] delimeter:%ls", delimeter.GetPointer());
+       
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               if ( key == token )
+               {
+                       String strValue;
+                       r = strTok.GetNextToken(strValue);
+                       SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+                       r = Integer::Parse(strValue, value);
+                       SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));                     
+               }
+       }       
+
+CATCH:
+       return r;
+}
+
+result
+ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String &value)
+{
+       result r = E_SUCCESS;
+       String token;
+
+       StringTokenizer strTok(src, delimeter);
+       SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] Propagating.");
+       
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               if ( key == token )
+               {
+                       r = strTok.GetNextToken(value);
+                       SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+               else            // In case of additional collon such as path:http://localhost:8080/xxx
+               {
+                       r = value.Append(delimeter);
+                       SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+                       r = value.Append(token);
+                       SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+       }       
+
+CATCH:
+       return r;
+}
+
+result
+SplitParameters(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key, Tizen::Base::String &value)
+{
+       result r = E_SUCCESS;
+       String token;
+       int i = 0;
+
+       StringTokenizer strTok(src, delimeter); 
+       SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] Propagating.");
+
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               switch (i)
+               {
+                       case 0:
+                               key = token;
+                               break;
+                       case 1:
+                               value = token;
+                               break;
+                       default :
+                               value.Append(delimeter);
+                               value.Append(token);
+                               break;
+               }
+               i++;
+       }       
+
+CATCH:
+       return r;
+}
+
+result
+FindKey(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key)
+{
+       result r = E_SUCCESS;
+       String token;
+
+       StringTokenizer strTok(src, delimeter);
+       SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] Propagating.");
+       
+       while (strTok.HasMoreTokens())
+       {
+               r = strTok.GetNextToken(token);
+               SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               key = token;            // Get the key which occurs first.
+               break;
+       }
+
+CATCH:
+       return r;
+}
+
+result
+FindKeyUnit(const UnitTransMap* pMap, const Tizen::Base::String& srcKey, Tizen::Base::String& dstKey, UnitType &srcType, UnitType &dstType, Tizen::Base::String &conCatStr, int& conCatIndex )
+{      
+       result r = E_SUCCESS;
+       int i = 0;      
+
+       SysTryCatch(NID_APP, pMap, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Propagating.");
+
+       while ( pMap[i].srcKey != null && pMap[i].dstKey != null )
+       {
+               if ( srcKey.Equals(String(pMap[i].srcKey), true))
+               {
+                       dstKey = String(pMap[i].dstKey);
+                       srcType = pMap[i].srcType;
+                       dstType = pMap[i].dstType;
+
+                       if ( pMap[i].conCatStr )
+                       {
+                               conCatStr = String(pMap[i].conCatStr);
+                       }
+                       else
+                       {
+                               conCatStr = String(L"");
+                       }
+
+                       conCatIndex = pMap[i].conCatIndex;
+
+//                     SysLog(NID_APP, "src:%s, dst:%s, srcType:%d, dstType:%d, conCat:%s, conCatIndex:%d", pMap[i].srcKey,pMap[i].dstKey,pMap[i].srcType,pMap[i].dstType,pMap[i].conCatStr,pMap[i].conCatIndex);
+               }
+               i++;
+       }
+       
+CATCH:
+       return r;
+}
+
+result
+PeekListValue(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String& value )
+{
+       result r = E_SUCCESS;
+       String *pNodeData=null;
+
+       SysTryCatch(NID_APP, pList != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The obj was not found.\n");
+       SysTryCatch(NID_APP, pList->GetCount() > index , r = E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Propagating..\n");
+       
+       pNodeData = dynamic_cast<String*>(const_cast<Object*>(pList->GetAt(index)));
+       SysTryCatch(NID_APP, pNodeData != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file was not found.\n");
+       SysTryCatch(NID_APP, pNodeData->GetLength() > 0 , r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file path is too short.\n");
+
+       r = ParseParameter(*pNodeData, key, delimeter, value);
+
+CATCH:
+       return r;
+}
+
+result
+FindListKey(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, Tizen::Base::String& key )
+{
+       result r = E_SUCCESS;
+       String *pNodeData=null;
+
+       SysTryCatch(NID_APP, pList != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The obj was not found.\n");
+       SysTryCatch(NID_APP, pList->GetCount() > index , r = E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Propagating.list count:%d, index:%d", pList->GetCount(), index);
+       
+       pNodeData = dynamic_cast<String*>(const_cast<Object*>(pList->GetAt(index)));
+       SysTryCatch(NID_APP, pNodeData != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file was not found.\n");
+       SysTryCatch(NID_APP, pNodeData->GetLength() > 0 , r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file path is too short.\n");
+       
+       r = FindKey(*pNodeData, delimeter, key);
+       
+CATCH:
+       return r;
+}
+
+int
+CountListKey(const Tizen::Base::Collection::IList* pList, const Tizen::Base::String& delimeter, const Tizen::Base::String& key )
+{
+       result r = E_SUCCESS;
+       int count = 0;
+       int matchCount = 0;
+       ClearLastResult();
+       SysTryCatch(NID_APP, pList != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The obj was not found.\n");
+
+       count = pList->GetCount();
+
+       for (int i = 0; i<count; i++ )
+       {
+               String value;
+               r = FindListKey(pList, i, delimeter, value);
+               if ( r == E_SUCCESS && value == key )
+               {
+                       matchCount++;
+               }
+       }
+       
+CATCH:
+       SetLastResult(r);
+       return matchCount;
+}
+
+
diff --git a/src/media-app-control/ParseUtil.h b/src/media-app-control/ParseUtil.h
new file mode 100644 (file)
index 0000000..3c85237
--- /dev/null
@@ -0,0 +1,63 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// 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 _PARSE_UTIL_H_
+#define _PARSE_UTIL_H_
+
+#include <FBase.h>
+
+static const Tizen::Base::String DELIMETER = L":";
+static const Tizen::Base::String KEY_TYPE = L"type";
+static const Tizen::Base::String KEY_PATH = L"path";
+
+static const Tizen::Base::String KEY_IMAGE = L"image";
+static const Tizen::Base::String KEY_AUDIO = L"audio";
+static const Tizen::Base::String KEY_VIDEO = L"video";
+
+enum UnitType
+{
+       UNIT_NONE,
+       UNIT_MSEC,
+       UNIT_KBPS,
+       UNIT_HHMMSS,
+       UNIT_STRING,
+       UNIT_PIXEL,
+       UNIT_BYTE,
+};
+
+typedef struct
+{
+       wchar_t* srcKey;
+       wchar_t* dstKey;
+       UnitType srcType;
+       UnitType dstType;
+       wchar_t* conCatStr;             //Concat
+       int conCatIndex;
+}UnitTransMap;
+
+result ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, int &value);
+result ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String &value);
+result SplitParameters(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key, Tizen::Base::String &value);
+
+result FindKey(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key);
+result FindKeyUnit(const UnitTransMap* pMap, const Tizen::Base::String& srcKey, Tizen::Base::String& dstKey, UnitType &srcType, UnitType &dstType, Tizen::Base::String &conCatStr, int& conCatIndex );
+
+result PeekListValue(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String& value );
+result FindListKey(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, Tizen::Base::String& key );
+int CountListKey(const Tizen::Base::Collection::IList* pList, const Tizen::Base::String& delimeter, const Tizen::Base::String& key );
+
+#endif
diff --git a/src/message-app-control/CMakeLists.txt b/src/message-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..9a7c6de
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-message)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       MessageAppControlDllEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/message-app-control/MessageAppControlDllEntry.cpp b/src/message-app-control/MessageAppControlDllEntry.cpp
new file mode 100755 (executable)
index 0000000..819496d
--- /dev/null
@@ -0,0 +1,225 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        BluetoothAppControlDllEntry.cpp
+ * @brief      This is the implementation for the BluetoothAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+static int __processId = -1;
+
+static const wchar_t __allowedAppControlMessageTable[][2][64] =
+{
+       {L"osp.appcontrol.MESSAGE", L"osp.appcontrol.operation.EDIT"},
+       {L"osp.appcontrol.provider.message", L"osp.appcontrol.operation.compose"},
+       {L"http://tizen.org/appcontrol/provider/message", L"http://tizen.org/appcontrol/operation/compose"},
+       {L"tizen.messages", L"http://tizen.org/appcontrol/operation/compose"},
+};
+
+static const wchar_t __allowedAppControlEmailTable[][2][64] =
+{
+       {L"osp.appcontrol.EMAIL", L"osp.appcontrol.operation.EDIT"},
+       {L"osp.appcontrol.provider.email", L"osp.appcontrol.operation.compose"},
+       {L"http://tizen.org/appcontrol/provider/email", L"http://tizen.org/appcontrol/operation/compose"},
+       {L"tizen.email", L"http://tizen.org/appcontrol/operation/compose"},
+};
+
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Message AppControl");
+
+       result r = E_SUCCESS;
+
+       SysLog(NID_APP, "aId : %ls, oId : %ls", aId.GetPointer(), oId.GetPointer());
+
+       const bool isMessage = _AppControlManager::IsAllowedAppControl(__allowedAppControlMessageTable, 4, aId, oId);
+       const bool isEmail = _AppControlManager::IsAllowedAppControl(__allowedAppControlEmailTable, 4, aId, oId);
+
+       SysTryReturnResult(NID_APP, isMessage || isEmail, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+       if (isMessage)
+       {
+               SysLog(NID_APP, "Message AppControl starts..");
+
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               // to
+               String tmp = msg.GetValue(L"to");
+               if (!tmp.IsEmpty())
+               {
+                       // cc
+                       String tmpCc = msg.GetValue(L"cc");
+                       if (!tmpCc.IsEmpty())
+                       {
+                               tmp.Append(L';' + tmpCc);
+                       }
+
+                       // bcc
+                       String tmpBcc = msg.GetValue(L"bcc");
+                       if (!tmpBcc.IsEmpty())
+                       {
+                               tmp.Append(L';' + tmpBcc);
+                       }
+
+                       tmp.Replace(L';', L',');
+                       msg.AddData(SERVICE_DATA_TO, tmp);
+               }
+
+               // subject
+               tmp = msg.GetValue(L"subject");
+               if (!tmp.IsEmpty())
+               {
+                       SysLog(NID_APP, "subject: [%ls]", tmp.GetPointer());
+                       msg.AddData(SERVICE_DATA_SUBJECT, tmp);
+               }
+
+               // text
+               tmp = msg.GetValue(L"text");
+               if (!tmp.IsEmpty())
+               {
+                       SysLog(NID_APP, "text: [%ls]", tmp.GetPointer());
+                       msg.AddData(SERVICE_DATA_TEXT, tmp);
+               }
+
+               // vcard
+               String tmpVcard = msg.GetValue(L"attachVcard");
+
+               // vcalendar
+               String tmpVcal = msg.GetValue(L"attachVcalendar");
+
+               // video
+               String tmpVideo = msg.GetValue(L"attachVideo");
+               if (!tmpVideo.IsEmpty())
+               {
+                       String delim(L'\n');
+                       String tmpTotal = tmpVcard + delim + tmpVcal + delim + tmpVideo;
+                       SysLog(NID_APP, "total: [%ls]", tmpTotal.GetPointer());
+                       msg.AddData(L"ATTACHFILE", tmpTotal);
+               }
+               else
+               {
+                       // image
+                       String tmpImage = msg.GetValue(L"attachImage");
+
+                       // audio
+                       String tmpAudio = msg.GetValue(L"attachAudio");
+
+                       String delim(L'\n');
+                       String tmpTotal = tmpVcard + delim + tmpVcal + delim + tmpImage + delim + tmpAudio;
+                       SysLog(NID_APP, "total: [%ls]", tmpTotal.GetPointer());
+                       msg.AddData(L"ATTACHFILE", tmpTotal);
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "msg-composer-efl", APPSVC_OPERATION_SEND, NULL, NULL, NULL, 0);
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Email AppControl is failed.");
+               SysLog(NID_APP, "StartAppControl: Launching Message AppControl succeeded.");
+
+       }
+       if (isEmail)
+       {
+               SysLog(NID_APP, "Email AppControl starts..");
+
+               char* pUri = NULL;
+               _AppMessageImpl msg;
+               msg.AddData(pMap);
+
+               String attach = msg.GetValue(L"attachments");
+               if (!attach.IsEmpty())
+               {
+                       pUri = _StringConverter::CopyToCharArrayN(attach);
+               }
+
+               String tmp = msg.GetValue(L"to");
+               if (!tmp.IsEmpty())
+               {
+                       msg.AddData(SERVICE_DATA_TO, tmp);
+               }
+
+               tmp = msg.GetValue(L"cc");
+               if (!tmp.IsEmpty())
+               {
+                       msg.AddData(SERVICE_DATA_CC, tmp);
+               }
+
+               tmp = msg.GetValue(L"bcc");
+               if (!tmp.IsEmpty())
+               {
+                       msg.AddData(SERVICE_DATA_BCC, tmp);
+               }
+
+               tmp = msg.GetValue(L"subject");
+               if (!tmp.IsEmpty())
+               {
+                       msg.AddData(SERVICE_DATA_SUBJECT, tmp);
+               }
+
+               tmp = msg.GetValue(L"text");
+               if (!tmp.IsEmpty())
+               {
+                       msg.AddData(SERVICE_DATA_TEXT, tmp);
+               }
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "email-composer-efl", APPSVC_OPERATION_SEND, NULL, pUri, NULL, 0);
+
+               delete [] pUri;
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Email AppControl is failed.");
+               SysLog(NID_APP, "StartAppControl: Launching Email AppControl succeeded.");
+       }
+
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/setting-app-control/CMakeLists.txt b/src/setting-app-control/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..3bbd5df
--- /dev/null
@@ -0,0 +1,26 @@
+SET (this_target osp-ac-setting)
+
+INCLUDE_DIRECTORIES (
+  ${COMMON_INCLUDE_DIRS}
+       )
+
+SET (${this_target}_SOURCE_FILES
+       SettingAppControlDllEntry.cpp
+       )
+       
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
diff --git a/src/setting-app-control/SettingAppControlDllEntry.cpp b/src/setting-app-control/SettingAppControlDllEntry.cpp
new file mode 100755 (executable)
index 0000000..20765f7
--- /dev/null
@@ -0,0 +1,371 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file        SettingAppControlDllEntry.cpp
+ * @brief      This is the implementation for the SettingAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FSys_SystemInfoImpl.h>
+#include <FApp_Aul.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+const String CATEGORY_LOCATION = L"Location";
+const String LOCATION_GPS_ENABLED = L"GPSEnabled";
+const String LOCATION_WPS_ENABLED = L"WPSEnabled";
+
+const String CATEGORY_BLUETOOTH_VISIBILITY = L"Bluetooth.Visibility";
+const String BLUETOOTH_VISIBILITY_OFF = L"GPSEnabled";
+const String BLUETOOTH_VISIBILITY_ALWAYS_ON = L"GPSEnabled";
+const String BLUETOOTH_VISIBILITY_1MIN_ON = L"GPSEnabled";
+const String BLUETOOTH_VISIBILITY_2MIN_ON = L"GPSEnabled";
+
+const String CATEGORY_TV_OUT = L"TvOut";
+const String TV_OUT_ENABLED = L"TVOutEnabled";
+const String TV_OUT_DISABLED = L"TVOutDisabled";
+
+const String CATEGORY_USB = L"USB";
+const String USB_KIES = L"Kies";
+const String USB_MASS_STORAGE = L"MassStorage";
+const String USB_INTERNET_SHARING = L"InternetSharing";
+const String USB_DEBUGGING = L"UsbDebugging";
+
+const String CATEGORY_FONT_TYPE = L"FontType";
+const String FONT_TYPE_DEFAULT = L"Unknown";
+
+const String CATEGORY_FONT_SIZE = L"FontSize";
+const String FONT_SIZE_SMALL = L"Small";
+const String FONT_SIZE_MEDIUM = L"Medium";
+const String FONT_SIZE_LARGE = L"Large";
+
+const String CATEGORY_THEME = L"Theme";
+const String THEME_DEFAULT = L"Unknown";
+
+static int __req = -1;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+void OnBluetoothAppControlResult(void*, int, service_result_e, void*);
+
+static const wchar_t __allowedAppControlTable[][2][64] =
+{
+       {L"osp.appcontrol.SETTINGS", L"osp.appcontrol.operation.DEFAULT"},
+       {L"osp.appcontrol.provider.settings", L"osp.appcontrol.operation.configure"},
+       {L"http://tizen.org/appcontrol/provider/settings", L"http://tizen.org/appcontrol/operation/configure"},
+       {L"tizen.settings", L"http://tizen.org/appcontrol/operation/configure"},
+};
+
+static int __processId = -1;
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+       SysLog(NID_APP, "StartAppControl: Entry to Setting AppControl");
+
+       HashMap resultList;
+       result r = E_SUCCESS;
+
+       const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
+       SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+
+       SysLog(NID_APP, "Setting AppControl.");
+
+       _AppMessageImpl msg;
+       msg.AddData(pMap);
+
+       String category = msg.GetValue(L"category");
+
+       r = resultList.Construct();
+       SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagated.", GetErrorMessage(r));
+
+       if (category == CATEGORY_LOCATION)
+       {
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "setting-location-efl", NULL, NULL, NULL, OnAppControlResult, 0);
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Setting Location AppControl is failed.");
+
+               SysLog(NID_APP, "[%s] %ls Setting AppControl started.", GetErrorMessage(r), CATEGORY_LOCATION.GetPointer());
+
+               __req = req;
+       }
+       else if (category == CATEGORY_BLUETOOTH_VISIBILITY)
+       {
+               //String* pArg1 = null;
+               //String* pArg2 = null;
+               //String* pArg3 = null;
+               bool isBtSupported = false;
+
+               r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"BluetoothSupported", isBtSupported);
+               SysTryCatch(NID_APP, (r == E_SUCCESS) && (isBtSupported == true), r = E_SYSTEM, E_SYSTEM, "[%s] Bluetooth is not supported.", GetErrorMessage(r));
+
+               msg.AddData(L"launch-type", L"visibility");
+
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "ug-bluetooth-efl", APPSVC_OPERATION_VIEW, NULL, NULL, OnBluetoothAppControlResult, 0);
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Bluetooth Visiblity  AppControl is failed.");
+               SysLog(NID_APP, "StartAppControl: Launching Bluetooth Visiblity AppControl succeeded.");
+
+               __req = req;
+       }
+#if 0
+       else if (category == CATEGORY_TV_OUT)
+       {
+               String* pArg1 = null;
+               String* pArg2 = null;
+               String* pArg3 = null;
+
+               pArg1 = new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED);
+               SysTryCatch(NID_APP, pArg1 != null, r = E_OUT_OF_MEMORY,
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg1);
+
+               pArg2 = new (std::nothrow) String(CATEGORY_TV_OUT);
+               SysTryCatch(NID_APP, pArg2 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg2);
+
+               pArg3 = new (std::nothrow) String(TV_OUT_DISABLED);
+               SysTryCatch(NID_APP, pArg3 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg3);
+
+               SysLog(NID_APP, "%ls Setting AppControl finished with result(%ls, %ls, %ls).",
+                               CATEGORY_TV_OUT.GetPointer(), pArg1->GetPointer(), pArg2->GetPointer(), pArg3->GetPointer());
+               _AppControlManager::GetInstance()->FinishAppControl(req, &resultList);
+       }
+       else if (category == CATEGORY_USB)
+       {
+               String* pArg1 = null;
+               String* pArg2 = null;
+               String* pArg3 = null;
+
+               pArg1 = new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED);
+               SysTryCatch(NID_APP, pArg1 != null, r = E_OUT_OF_MEMORY,
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg1);
+
+               pArg2 = new (std::nothrow) String(CATEGORY_USB);
+               SysTryCatch(NID_APP, pArg2 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg2);
+
+               pArg3 = new (std::nothrow) String(USB_KIES);
+               SysTryCatch(NID_APP, pArg3 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg3);
+
+               SysLog(NID_APP, "%ls Setting AppControl finished with result(%ls, %ls, %ls).",
+                               CATEGORY_USB.GetPointer(), pArg1->GetPointer(), pArg2->GetPointer(), pArg3->GetPointer());
+               _AppControlManager::GetInstance()->FinishAppControl(req, &resultList);
+       }
+#endif
+       else if (category == CATEGORY_FONT_TYPE)
+       {
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "setting-font-efl", NULL, NULL, NULL, OnAppControlResult, 0);
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Setting Font AppControl is failed.");
+               SysLog(NID_APP, "[%s] %ls Setting AppControl started.", GetErrorMessage(r), CATEGORY_FONT_TYPE.GetPointer());
+       }
+       else if (category == CATEGORY_FONT_SIZE)
+       {
+               __processId = _AppControlManager::GetInstance()->Launch(msg, "setting-font-efl", NULL, NULL, NULL, OnAppControlResult, 0);
+
+               SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Setting Accessibility AppControl is failed.");
+
+               SysLog(NID_APP, "[%s] %ls Setting AppControl started.", GetErrorMessage(r), CATEGORY_FONT_SIZE.GetPointer());
+       }
+#if 0
+       else if (category == CATEGORY_THEME)
+       {
+               String* pArg1 = null;
+               String* pArg2 = null;
+               String* pArg3 = null;
+
+               pArg1 = new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED);
+               SysTryCatch(NID_APP, pArg1 != null, r = E_OUT_OF_MEMORY,
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg1);
+
+               pArg2 = new (std::nothrow) String(CATEGORY_THEME);
+               SysTryCatch(NID_APP, pArg2 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg2);
+
+               pArg3 = new (std::nothrow) String(THEME_DEFAULT);
+               SysTryCatch(NID_APP, pArg3 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
+                               E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+               resultList.Add(*pArg3);
+
+               SysLog(NID_APP, "%ls Setting AppControl finished with result(%ls, %ls, %ls).",
+                               CATEGORY_THEME.GetPointer(), pArg1->GetPointer(), pArg2->GetPointer(), pArg3->GetPointer());
+               _AppControlManager::GetInstance()->FinishAppControl(req, &resultList);
+       }
+#endif
+       else
+       {
+               _AppControlManager::GetInstance()->FinishAppControl(req, APP_CTRL_RESULT_FAILED, null);
+       }
+
+       return r;
+
+CATCH:
+       resultList.RemoveAll(true);
+
+       return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+       if (__processId >= 0)
+       {
+               _Aul::TerminateApplicationByPid(__processId);           
+       }
+       return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+
+       HashMap* pResult = new (std::nothrow) HashMap();
+       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+       r = pResult->Construct();
+
+       switch (res)
+       {
+       case SERVICE_RESULT_SUCCEEDED:
+               {
+                       const char* pCategory = appsvc_get_data(pBundle, "category");
+                       if (pCategory)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(pCategory));
+                       }
+
+                       const char* pData = appsvc_get_data(pBundle, "State");
+                       if (pData)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"GPS"), new (std::nothrow) String(pData));
+                       }
+
+                       pData = appsvc_get_data(pBundle, "FontType");
+                       if (pData)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"type"), new (std::nothrow) String(pData));
+                       }
+
+                       pData = appsvc_get_data(pBundle, "FontSize");
+                       if (pData)
+                       {
+                               pResult->Add(new (std::nothrow) String(L"size"), new (std::nothrow) String(pData));
+                       }
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+               break;
+#if 0
+       case SERVICE_RESULT_CANCELED:
+               break;
+#endif
+       default:
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+       __req = -1;
+}
+
+void
+OnBluetoothAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+       result r = E_SYSTEM;
+       bundle* pBundle = static_cast<bundle*>(b);
+
+       HashMap* pResult = new (std::nothrow) HashMap();
+       SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+       r = pResult->Construct();
+
+       switch (res)
+       {
+       case SERVICE_RESULT_SUCCEEDED:
+               {
+                       pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(L"Bluetooth.Visibility"));
+
+                       const char* pBuf = appsvc_get_data(pBundle, "visibility");
+                       if (pBuf)
+                       {
+                               switch (*pBuf)
+                               {
+                               case '0':
+                                       pBuf = "Off";
+                                       break;
+                               case '1':
+                               case '2':
+                               case '3':
+                                       pBuf = "TimeLimitedOn";
+                                       break;
+                               case '4':
+                                       pBuf = "AlwaysOn";
+                                       break;
+                               default:
+                                       pBuf = "Off";
+                                       break;
+                               }
+                               pResult->Add(new (std::nothrow) String(L"visibility"), new (std::nothrow) String(pBuf));
+                       }
+               }
+               break;
+       case SERVICE_RESULT_FAILED:
+               //fall through
+       case SERVICE_RESULT_CANCELED:
+               //fall through
+       default:
+               break;
+       }
+
+       _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+       __req = -1;
+}
+
+#ifdef __cplusplus
+}
+#endif