sync with master
authorJinkun Jang <jinkun.jang@samsung.com>
Sat, 16 Mar 2013 06:49:53 +0000 (15:49 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Sat, 16 Mar 2013 06:49:53 +0000 (15:49 +0900)
13 files changed:
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
data/dummy [new file with mode: 0644]
inc/CommonService.h [new file with mode: 0644]
inc/FApp_PackageManagerStub.h [new file with mode: 0755]
inc/FUi_UiManagerStub.h [new file with mode: 0644]
manifest.xml [new file with mode: 0755]
osp-common-service.manifest [new file with mode: 0644]
packaging/osp-common-service.spec [new file with mode: 0644]
src/CommonService.cpp [new file with mode: 0644]
src/CommonServiceEntry.cpp [new file with mode: 0644]
src/FApp_PackageManagerStub.cpp [new file with mode: 0755]
src/FUi_UiManagerStub.cpp [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..637c241
--- /dev/null
@@ -0,0 +1,64 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET (this_target osp-common-service)
+SET (APPID sjjevolsjk)
+
+SET(CMAKE_EXECUTABLE_SUFFIX ".exe")
+SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/output")
+
+INCLUDE_DIRECTORIES (
+       /usr/include/glib-2.0
+       /usr/lib/glib-2.0/include
+       /usr/include/ecore-1
+       /usr/include/eina-1
+       /usr/include/eina-1/eina
+       /usr/include/appfw
+       /usr/include/osp
+       /usr/include/osp/app
+       /usr/include/osp/base
+       /usr/include/osp/io
+       /usr/include/osp/system
+       /usr/include/osp/security
+       /usr/include/osp/ui
+       /usr/include/osp/server
+       /usr/include/chromium
+       inc
+       )
+
+SET (${this_target}_SOURCE_FILES
+       src/FApp_PackageManagerStub.cpp
+       src/FUi_UiManagerStub.cpp
+       src/CommonService.cpp
+       src/CommonServiceEntry.cpp
+       )
+
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fPIE -Wall -pthread -g3" )
+#SET(EXTRA_CFLAGS  "${EXTRA_CFLAGS} -fstack-protector -Wstack-protector" )
+
+## 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}")
+
+SET(CMAKE_SKIP_BUILD_RPATH FALSE)
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+SET(CMAKE_INSTALL_RPATH "/usr/lib/osp-server")
+SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+
+## Create Library
+ADD_EXECUTABLE (${this_target} ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} -Xlinker --no-undefined -Xlinker --as-needed -pie)
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw -lchromium")
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-uifw" )
+TARGET_LINK_LIBRARIES(${this_target} "-lutilX" )
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_x" )
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp-server -losp-appfw-server")
+
+INSTALL(TARGETS ${this_target} DESTINATION ../opt/apps/${APPID}/bin)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/manifest.xml DESTINATION ../opt/apps/${APPID}/info)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ DESTINATION ../opt/apps/${APPID}/data)
+
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
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/data/dummy b/data/dummy
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/inc/CommonService.h b/inc/CommonService.h
new file mode 100644 (file)
index 0000000..cd29365
--- /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 _COMMON_SERVICE_H_
+#define _COMMON_SERVICE_H_
+
+#include <unique_ptr.h>
+#include <FApp.h>
+#include <FBase.h>
+#include <FSystem.h>
+
+namespace Tizen { namespace App
+{
+class _PackageManagerStub;
+}}
+
+namespace Tizen { namespace Ui 
+{
+class _UiManagerStub;
+}} // Tizen::Ui
+
+/**
+ * @class      CommonService
+ * @brief
+ */
+class CommonService
+       : public Tizen::App::ServiceApp
+{
+public:
+       static Tizen::App::ServiceApp* CreateInstance(void);
+
+       CommonService(void);
+       virtual ~CommonService(void);
+
+       bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+       bool OnAppInitialized(void); 
+       bool OnAppWillTerminate(void);
+       bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+       void OnLowMemory(void);
+       void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+               
+private:
+       void InitializeServices(void);  
+
+       Tizen::App::_PackageManagerStub* __pPackageManagerStub;
+       std::unique_ptr<Tizen::Ui::_UiManagerStub> __pUiManagerStub;
+};
+
+#endif // _COMMON_SERVICE_H_
diff --git a/inc/FApp_PackageManagerStub.h b/inc/FApp_PackageManagerStub.h
new file mode 100755 (executable)
index 0000000..d74694e
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// 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        FApp_PackageManagerStub.h
+ * @brief      This is the header file of the _PackageManagerStub class.
+ *
+ * This header file contains the declarations of the _PackageManagerStub class.
+ */
+
+#ifndef _FAPP_INTERNAL_PACKAGE_MANAGER_STUB_H_
+#define _FAPP_INTERNAL_PACKAGE_MANAGER_STUB_H_
+
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FAppTypes.h>
+
+#include <FIo_IIpcServerEventListener.h>
+
+
+namespace Tizen { namespace App { namespace Package {
+class _PackageManagerImpl;
+}}}
+
+namespace Tizen { namespace App {
+
+class _PackageManagerStub :
+       public Tizen::Base::Object,
+       public Tizen::Io::_IIpcServerEventListener
+{
+
+public:
+       _PackageManagerStub(void);
+       virtual ~_PackageManagerStub(void);
+       result Construct(void);
+
+       // ipc handlers.
+       void OnInstallPackage(const PackageId& packageId, const Tizen::Base::String& packagePath, int listener, result* pRes);
+       void OnUninstallPackage(const PackageId& packageId, int listener, result* pRes);
+
+private:
+       _PackageManagerStub(const _PackageManagerStub& value);
+       _PackageManagerStub& operator =(const _PackageManagerStub& source);
+
+       // _IIpcServerEventListener
+       virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server);
+       virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server);
+       virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
+       virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
+       virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
+
+       // internal
+       result StartIpcServer(void);
+
+private:
+       Tizen::Io::_IpcServer* __pIpcServer;
+       Tizen::App::Package::_PackageManagerImpl* __pPackageManagerImpl;
+};     //_PackageManagerStub
+
+}} //Tizen::App
+
+#endif // _FAPP_INTERNAL_PACKAGE_MANAGER_STUB_H_
diff --git a/inc/FUi_UiManagerStub.h b/inc/FUi_UiManagerStub.h
new file mode 100644 (file)
index 0000000..494c75d
--- /dev/null
@@ -0,0 +1,66 @@
+//
+// 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        FUi_UiManagerStub.h
+ * @brief      This is the header file of the _UiManagerStub class.
+ *
+ * This header file contains the declarations of the _UiManagerStub class.
+ */
+
+#ifndef _FUI_INTERNAL_UI_MANAGER_STUB_H_
+#define _FUI_INTERNAL_UI_MANAGER_STUB_H_
+
+#include <unique_ptr.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FIo_IIpcServerEventListener.h>
+
+namespace Tizen { namespace Ui
+{
+
+class _UiManagerStub
+       : public Tizen::Base::Object
+       , public Tizen::Io::_IIpcServerEventListener
+{
+public:
+       _UiManagerStub(void);
+       virtual ~_UiManagerStub(void);
+       
+       result Construct(void);
+
+       bool OnSetZOrderGroup(unsigned int window, int windowZOrderGroup, result* pResult);
+
+private:
+       _UiManagerStub(const _UiManagerStub& rhs);
+       _UiManagerStub& operator =(const _UiManagerStub& rhs);
+
+       result StartIpcServer(void);
+
+       virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server);
+       virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server);
+       virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
+       virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
+       virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
+
+private:
+       std::unique_ptr<Tizen::Io::_IpcServer> __pIpcServer;
+}; // _UiManagerStub
+
+}} // Tizen::Ui
+
+#endif // _FUI_INTERNAL_UI_MANAGER_STUB_H_
\ No newline at end of file
diff --git a/manifest.xml b/manifest.xml
new file mode 100755 (executable)
index 0000000..6ea1925
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Manifest xmlns="http://schemas.tizen.org/2012/06/manifest">
+    <Id>sjjevolsjk</Id>
+    <Version>1.0.0</Version>
+    <Type>C++App</Type>
+    <Vendors>
+        <Vendor Locale="eng-GB">Samsung Electronics</Vendor>
+    </Vendors>
+    <Descriptions/>
+    <Url/>
+    <Requirements/>
+    <Apps>
+        <ApiVersion>2.1</ApiVersion>
+        <Secret/>
+        <Privileges>
+        </Privileges>
+        <ServiceApp SystemService="True" AutoRestart="False" Default="True" ExecutableName="osp-common-service" LaunchOnBoot="False">
+            <Names>
+                <Name Locale="eng-GB">osp-common-service</Name>
+            </Names>
+            <AppControls/>
+            <DataControls/>
+            <LaunchConditions/>
+            <Notifications/>
+        </ServiceApp>
+    </Apps>
+</Manifest>
diff --git a/osp-common-service.manifest b/osp-common-service.manifest
new file mode 100644 (file)
index 0000000..2aa4220
--- /dev/null
@@ -0,0 +1,11 @@
+<manifest>
+       <define>
+               <domain name="sjjevolsjk"/>
+       </define>
+       <request>
+               <domain name="sjjevolsjk"/>
+       </request>
+       <assign>
+               <filesystem path="/usr/share/license/osp-common-service" label="_"/>
+       </assign>
+</manifest>
diff --git a/packaging/osp-common-service.spec b/packaging/osp-common-service.spec
new file mode 100644 (file)
index 0000000..ca87e99
--- /dev/null
@@ -0,0 +1,57 @@
+Name: osp-common-service
+Summary:       osp common service
+Version:       1.2.1.0
+Release:       1
+Group:         System/Libraries
+License:       Apache License, Version 2.0 or Flora
+Source0:       %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(chromium)
+BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(pkgmgr)
+BuildRequires:  pkgconfig(osp-appfw)
+BuildRequires:  pkgconfig(osp-uifw)
+BuildRequires: osp-appfw-internal-devel
+BuildRequires: osp-uifw-internal-devel
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:         pkgconfig(utilX)
+
+# runtime requires
+Requires: chromium
+Requires: osp-appfw
+
+%description
+osp common service
+
+%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}
+%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 -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+%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
+/usr/etc/package-manager/backend/tpk -i /opt/apps/sjjevolsjk
+
+%files
+/opt/apps/sjjevolsjk/*
+%manifest osp-common-service.manifest
+/usr/share/license/%{name}
+
+
diff --git a/src/CommonService.cpp b/src/CommonService.cpp
new file mode 100644 (file)
index 0000000..3929809
--- /dev/null
@@ -0,0 +1,122 @@
+//
+// 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 "CommonService.h"
+#include "FApp_PackageManagerStub.h"
+#include "FUi_UiManagerStub.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::System;
+using namespace Tizen::Ui;
+
+CommonService::CommonService(void)
+       : __pPackageManagerStub(null)
+{
+       
+}
+
+CommonService::~CommonService(void)
+{
+       delete __pPackageManagerStub;
+}
+
+ServiceApp*
+CommonService::CreateInstance(void)
+{
+       // Create the instance through the constructor.
+       return new CommonService();
+}
+
+bool
+CommonService::OnAppInitializing(AppRegistry& appRegistry)
+{
+       // TODO:
+       // Initialize App specific data.
+       // The App's permanent data and context can be obtained from the appRegistry.
+       //
+       // If this method is successful, return true; otherwise, return false.
+       // If this method returns false, the App will be terminated.
+
+       // TODO: Add your initialization code here
+
+       return true;
+}
+
+bool
+CommonService::OnAppInitialized(void)
+{
+       InitializeServices();
+       
+       return true;
+}
+
+bool
+CommonService::OnAppWillTerminate(void)
+{
+       // TODO:
+       // Comment.
+
+       return true;
+}
+
+bool
+CommonService::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+       // TODO:
+       // Deallocate resources allocated by this App for termination.
+       // The App's permanent data and context can be saved via appRegistry.
+
+       // TODO: Add your termination code here
+
+       return true;
+}
+
+void
+CommonService::OnLowMemory(void)
+{
+       // TODO:
+       // Free unused resources or close the App.
+}
+
+void
+CommonService::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+       // TODO:
+       // Handle any changes in battery level here.
+       // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL.
+}
+
+void
+CommonService::InitializeServices(void)
+{
+       __pPackageManagerStub = new (std::nothrow) _PackageManagerStub();
+       SysAssert(__pPackageManagerStub != null);
+
+       result r = __pPackageManagerStub->Construct();
+       SysAssert(!IsFailed(r));        
+
+       unique_ptr<_UiManagerStub> pUiManagerStub(new (std::nothrow) _UiManagerStub());
+       SysTryReturnVoidResult(NID_UI, pUiManagerStub, E_OUT_OF_MEMORY, "Memory is insufficient.");
+
+       r = pUiManagerStub->Construct();
+       SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
+
+       __pUiManagerStub = move(pUiManagerStub);
+}
diff --git a/src/CommonServiceEntry.cpp b/src/CommonServiceEntry.cpp
new file mode 100644 (file)
index 0000000..ad25ee6
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// 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 "CommonService.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+_EXPORT_ int OspMain(int argc, char *pArgv[]);
+
+/**
+ * The entry function of Tizen C++ application called by the operating system.
+ */
+int
+OspMain(int argc, char *pArgv[])
+{
+       result r = E_SUCCESS;
+
+       AppLog("Application started.");
+       ArrayList* pArgs = new ArrayList();
+       pArgs->Construct();
+       for (int i = 0; i < argc; i++)
+       {
+               pArgs->Add(*(new String(pArgv[i])));
+       }
+
+       r = Tizen::App::ServiceApp::Execute(CommonService::CreateInstance, pArgs);
+       if (IsFailed(r))
+       {
+               AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
+               r &= 0x0000FFFF;
+       }
+
+       pArgs->RemoveAll(true);
+       delete pArgs;
+       AppLog("Application finished.");
+
+       return static_cast<int>(r);
+}
+#ifdef __cplusplus
+}
+#endif // __cplusplus
diff --git a/src/FApp_PackageManagerStub.cpp b/src/FApp_PackageManagerStub.cpp
new file mode 100755 (executable)
index 0000000..4acf358
--- /dev/null
@@ -0,0 +1,153 @@
+//
+// 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        FApp_PackageManagerStub.cpp
+ * @brief      This is the implementation for the _PackageManagerStub class.
+ */
+#include <cstdio>
+#include <dlfcn.h>
+#include <FAppPkgIPackageInstallationResponseListener.h>
+#include <FAppPkgIPackageUninstallationResponseListener.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FIo_IpcServer.h>
+#include <FSec_AccessController.h>
+#include <FApp_PackageManagerIpcMessages.h>
+#include "FAppPkg_PackageManagerImpl.h"
+#include "FApp_PackageManagerStub.h"
+
+
+namespace Tizen { namespace App {
+
+using namespace Tizen::App::Package;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Security;
+
+_PackageManagerStub::_PackageManagerStub()
+       :__pIpcServer(null)
+       ,__pPackageManagerImpl(null)
+{
+       SysLog(NID_APP, "_PackageManagerStub - Enter\n");
+}
+
+_PackageManagerStub::~_PackageManagerStub()
+{
+       if ( __pIpcServer != null)
+       {
+               __pIpcServer->Stop();
+               delete __pIpcServer;
+       }
+
+       SysLog(NID_APP, "_PackageManagerStub - Exit\n");
+}
+
+result
+_PackageManagerStub::Construct(void)
+{
+       SysLog(NID_APP, "_PackageManagerStub - Construct.");
+
+       __pPackageManagerImpl = Tizen::App::Package::_PackageManagerImpl::GetInstance();
+
+       result r = E_SUCCESS;
+       r = StartIpcServer();
+       SysTryReturn(NID_APP, !IsFailed(r), r, r, "failed to StartIpcServer.(%s)", GetErrorMessage(r));
+
+       return E_SUCCESS;
+}
+
+result
+_PackageManagerStub::StartIpcServer(void)
+{
+       SysLog(NID_APP, "_PackageManagerStub - StartIpcServer");
+
+       __pIpcServer = new (std::nothrow) _IpcServer();
+       SysTryReturn(NID_APP, __pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
+
+       result r = __pIpcServer->Construct( "osp.app.ipcserver.samplepackagemanager", *this, false);
+       SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.packagemanager");
+
+       r = __pIpcServer->Start();
+       SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Failed to Start IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.packagemanager");
+
+       return E_SUCCESS;
+
+CATCH:
+       delete __pIpcServer;
+       __pIpcServer = null;
+       return r;
+}
+
+void
+_PackageManagerStub::OnInstallPackage(const PackageId& packageId, const String& packagePath, int listener, result* pRes)
+{
+       SysLog(NID_APP, "kujaesung _PackageManagerStub::OnInstallPackage \n");
+       //SysTryReturnVoidResult(NID_APP, __pPackageManagerImpl != null, E_INVALID_STATE, "Invalid package manager state.");
+       //*pRes = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_PACKAGEMANAGER_INSTALL);
+       //SysTryReturnVoidResult(NID_APP, !IsFailed(*pRes), *pRes = E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+       //String appId;
+       //*pRes = __pPackageManagerImpl->InstallPackage(packageId, packagePath, (IPackageInstallationResponseListener*)listener);
+}
+
+void
+_PackageManagerStub::OnUninstallPackage(const PackageId& packageId, int listener, result* pRes)
+{
+       SysLog(NID_APP, "kujaesung _PackageManagerStub::OnUninstallPackage \n");
+       //SysTryReturnVoidResult(NID_APP, __pPackageManagerImpl != null, E_INVALID_STATE, "Invalid package manager state.");
+       //*pRes = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_PACKAGEMANAGER_INSTALL);
+       //SysTryReturnVoidResult(NID_APP, !IsFailed(*pRes), *pRes = E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+       //*pRes = __pPackageManagerImpl->UninstallPackage(packageId, (IPackageUninstallationResponseListener*)listener);
+}
+
+void
+_PackageManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
+{
+       SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), server.GetClientId());
+
+       IPC_BEGIN_MESSAGE_MAP(_PackageManagerStub, message)
+               IPC_MESSAGE_HANDLER_EX(PackageManager_InstallPackage, &server, OnInstallPackage)
+               IPC_MESSAGE_HANDLER_EX(PackageManager_UninstallPackage, &server, OnUninstallPackage)
+       IPC_END_MESSAGE_MAP()
+}
+
+void
+_PackageManagerStub::OnIpcServerStarted(const _IpcServer& server)
+{
+       SysLog(NID_APP, "_PackageManagerStub::OnIpcServerStarted \n");
+}
+
+void
+_PackageManagerStub::OnIpcServerStopped(const _IpcServer& server)
+{
+       SysLog(NID_APP, "_PackageManagerStub::OnIpcServerStopped \n");
+}
+
+void
+_PackageManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
+{
+       SysLog(NID_APP, "_PackageManagerStub::OnIpcClientConnected (clientId:%d)\n", clientId);
+}
+
+void
+_PackageManagerStub::OnIpcClientDisconnected(const _IpcServer&server, int clientId)
+{
+       SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId);
+}
+
+}}
diff --git a/src/FUi_UiManagerStub.cpp b/src/FUi_UiManagerStub.cpp
new file mode 100644 (file)
index 0000000..d35abeb
--- /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        FUi_UiManagerStub.cpp
+ * @brief      This is the implementation for the _UiManagerStub class.
+ */
+
+#include <cstdio>
+#include <dlfcn.h>
+#include <utilX.h>
+#include <Ecore_X.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+#include <FIo_IpcServer.h>
+#include <FSec_AccessController.h>
+#include <FUi_UiManagerIpcMessages.h>
+#include "FUi_UiManagerStub.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Security;
+
+namespace Tizen { namespace Ui
+{
+
+enum _ZOrderGroup
+{
+       _Z_ORDER_GROUP_HIGHEST,
+       _Z_ORDER_GROUP_HIGH,
+       _Z_ORDER_GROUP_NORMAL,
+};
+
+_UiManagerStub::_UiManagerStub(void)
+{
+}
+
+_UiManagerStub::~_UiManagerStub(void)
+{
+       if (__pIpcServer)
+       {
+               __pIpcServer->Stop();
+       }
+}
+
+result
+_UiManagerStub::Construct(void)
+{
+       result r = StartIpcServer();
+       SysTryReturnResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
+
+       return E_SUCCESS;
+}
+
+result
+_UiManagerStub::StartIpcServer(void)
+{
+       unique_ptr<_IpcServer> pIpcServer(new (std::nothrow) _IpcServer());
+       SysTryReturnResult(NID_UI, pIpcServer, E_OUT_OF_MEMORY, "Memory is insufficient.");
+
+       result r = pIpcServer->Construct(L"osp.ui.ipcserver.uimanager", *this, true);
+       SysTryReturnResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
+
+       r = pIpcServer->Start();
+       SysTryReturnResult(NID_UI, r == E_SUCCESS, r, "Propagating.");
+
+       __pIpcServer = move(pIpcServer);
+
+       return E_SUCCESS;
+}
+
+bool
+_UiManagerStub::OnSetZOrderGroup(unsigned int window, int windowZOrderGroup, result* pResult)
+{
+       SysLog(NID_UI, "IPC message(0x%x, %d) is received.", window, windowZOrderGroup);
+
+       *pResult = _AccessController::CheckSystemPrivilege(__pIpcServer->GetClientAppId(), _PRV_UIMANAGER);
+       SysTryReturn(NID_UI, *pResult == E_SUCCESS, true, *pResult, "[%s] Propagating.", GetErrorMessage(*pResult));
+
+       Ecore_X_Window win = (Ecore_X_Window)window;
+       ecore_x_icccm_transient_for_unset(win);
+       
+       if (windowZOrderGroup == _Z_ORDER_GROUP_NORMAL)
+       {
+               ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
+       }
+       else if (windowZOrderGroup == _Z_ORDER_GROUP_HIGHEST)
+       {
+               ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
+               utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_HIGH);
+       }
+       else if (windowZOrderGroup == _Z_ORDER_GROUP_HIGH)
+       {
+               ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NOTIFICATION);
+               utilx_set_system_notification_level((Display*)ecore_x_display_get(), win, UTILX_NOTIFICATION_LEVEL_NORMAL);
+       }
+
+       return true;
+}
+
+void
+_UiManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
+{
+       IPC_BEGIN_MESSAGE_MAP(_UiManagerStub, message)
+               IPC_MESSAGE_HANDLER_EX(UiManager_SetZOrderGroup, &server, OnSetZOrderGroup)
+       IPC_END_MESSAGE_MAP()
+}
+
+void
+_UiManagerStub::OnIpcServerStarted(const _IpcServer& server)
+{
+}
+
+void
+_UiManagerStub::OnIpcServerStopped(const _IpcServer& server)
+{
+}
+
+void
+_UiManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
+{
+}
+
+void
+_UiManagerStub::OnIpcClientDisconnected(const _IpcServer&server, int clientId)
+{
+}
+
+}} // Tizen::Ui