From 735a4b0a1e45eac6414895a73bcbc9ac5d1a6640 Mon Sep 17 00:00:00 2001 From: Sungbae Yoo Date: Mon, 4 Jul 2016 15:25:19 +0900 Subject: [PATCH 2/4] Migrate Krate-related apps from device-policy-manager Change-Id: I12fd2515cc4b91e79aeb66542219e829a6ae3693 Signed-off-by: Sungbae Yoo --- CMakeLists.txt | 94 ++++ LICENSE | 204 +++++++++ krate.manifest | 5 + module/CMakeLists.txt | 52 +++ module/data/DefaultZoneManifest.xml | 10 + module/data/zone_indicator_icon.png | Bin 0 -> 1213 bytes module/data/zone_noti_list_sub_icon.png | Bin 0 -> 4992 bytes module/pam.d/systemd-user-zone | 4 + module/session.cpp | 72 ++++ module/session.h | 35 ++ module/zone-builder.cpp | 76 ++++ module/zone-builder.h | 46 ++ module/zone-guard.h | 63 +++ module/zone.cpp | 105 +++++ packaging/krate.spec | 225 ++++++++++ server/CMakeLists.txt | 21 + server/systemd/krate.service.in | 11 + tools/CMakeLists.txt | 19 + tools/apps/CMakeLists.txt | 35 ++ tools/apps/kaskit/CMakeLists.txt | 40 ++ tools/apps/kaskit/include/conf.h | 39 ++ tools/apps/kaskit/include/kaskit.h | 63 +++ tools/apps/kaskit/include/widget.h | 32 ++ tools/apps/kaskit/org.tizen.kaskit.manifest | 5 + tools/apps/kaskit/org.tizen.kaskit.xml | 13 + tools/apps/kaskit/res/edje/app_icon.edc | 311 ++++++++++++++ tools/apps/kaskit/res/edje/launcher.edc | 90 ++++ tools/apps/kaskit/res/edje/org.tizen.kaskit.edc | 22 + tools/apps/kaskit/res/images/app_press_117.png | Bin 0 -> 3104 bytes tools/apps/kaskit/res/images/btn_delete_nor.png | Bin 0 -> 3701 bytes tools/apps/kaskit/res/images/btn_delete_press.png | Bin 0 -> 3742 bytes tools/apps/kaskit/res/images/core_check_bg.png | Bin 0 -> 1128 bytes .../kaskit/res/images/core_check_bg_stroke.png | Bin 0 -> 1141 bytes tools/apps/kaskit/res/images/core_check_icon.png | Bin 0 -> 1325 bytes tools/apps/kaskit/res/images/default_app_icon.png | Bin 0 -> 12850 bytes tools/apps/kaskit/res/images/folder_appicon_bg.png | Bin 0 -> 6266 bytes .../kaskit/res/images/icon_badge_container.png | Bin 0 -> 883 bytes tools/apps/kaskit/res/images/popup_bg.png | Bin 0 -> 1261 bytes tools/apps/kaskit/res/images/sub_badge.png | Bin 0 -> 6199 bytes tools/apps/kaskit/src/main.c | 254 +++++++++++ tools/apps/kaskit/src/ui.c | 290 +++++++++++++ tools/apps/kaskit/src/widget.c | 69 +++ tools/apps/keyguard/CMakeLists.txt | 37 ++ tools/apps/keyguard/include/keyguard.h | 56 +++ tools/apps/keyguard/include/widget.h | 35 ++ tools/apps/keyguard/org.tizen.keyguard.manifest | 5 + tools/apps/keyguard/org.tizen.keyguard.xml | 11 + tools/apps/keyguard/res/edje/keyguard.edc | 119 +++++ .../apps/keyguard/res/edje/org.tizen.keyguard.edc | 21 + tools/apps/keyguard/res/images/icon.png | Bin 0 -> 23271 bytes tools/apps/keyguard/res/images/theme_bg.png | Bin 0 -> 1311561 bytes tools/apps/keyguard/src/main.c | 202 +++++++++ tools/apps/keyguard/src/ui.c | 122 ++++++ tools/apps/keyguard/src/widget.c | 139 ++++++ tools/apps/setup-wizard/CMakeLists.txt | 40 ++ tools/apps/setup-wizard/include/setup-text.h | 53 +++ tools/apps/setup-wizard/include/widget.h | 39 ++ tools/apps/setup-wizard/include/zone-setup.h | 78 ++++ .../org.tizen.krate-setup-wizard.manifest | 5 + .../setup-wizard/org.tizen.krate-setup-wizard.xml | 11 + tools/apps/setup-wizard/res/data/KrateManifest.xml | 10 + tools/apps/setup-wizard/res/edje/layout.edc | 77 ++++ .../res/edje/org.tizen.krate-setup-wizard.edc | 24 ++ tools/apps/setup-wizard/res/edje/security.edc | 52 +++ tools/apps/setup-wizard/res/edje/setup.edc | 77 ++++ tools/apps/setup-wizard/res/edje/welcome.edc | 92 ++++ tools/apps/setup-wizard/res/images/icon.png | Bin 0 -> 57662 bytes tools/apps/setup-wizard/res/images/theme_bg.png | Bin 0 -> 6894 bytes tools/apps/setup-wizard/src/main.c | 170 ++++++++ tools/apps/setup-wizard/src/security.c | 285 ++++++++++++ tools/apps/setup-wizard/src/ui.c | 219 ++++++++++ tools/apps/setup-wizard/src/util.c | 175 ++++++++ tools/apps/setup-wizard/src/widget.c | 160 +++++++ tools/cli/CMakeLists.txt | 42 ++ tools/cli/krate-admin-cli.cpp | 478 +++++++++++++++++++++ tools/gumd-scripts/20_pam-krate-add.post | 4 + tools/gumd-scripts/20_pam-krate-remove.post | 4 + 77 files changed, 5147 insertions(+) create mode 100755 CMakeLists.txt create mode 100644 LICENSE create mode 100644 krate.manifest create mode 100644 module/CMakeLists.txt create mode 100644 module/data/DefaultZoneManifest.xml create mode 100755 module/data/zone_indicator_icon.png create mode 100755 module/data/zone_noti_list_sub_icon.png create mode 100644 module/pam.d/systemd-user-zone create mode 100644 module/session.cpp create mode 100644 module/session.h create mode 100644 module/zone-builder.cpp create mode 100644 module/zone-builder.h create mode 100644 module/zone-guard.h create mode 100644 module/zone.cpp create mode 100644 packaging/krate.spec create mode 100644 server/CMakeLists.txt create mode 100644 server/systemd/krate.service.in create mode 100755 tools/CMakeLists.txt create mode 100755 tools/apps/CMakeLists.txt create mode 100644 tools/apps/kaskit/CMakeLists.txt create mode 100644 tools/apps/kaskit/include/conf.h create mode 100644 tools/apps/kaskit/include/kaskit.h create mode 100644 tools/apps/kaskit/include/widget.h create mode 100644 tools/apps/kaskit/org.tizen.kaskit.manifest create mode 100644 tools/apps/kaskit/org.tizen.kaskit.xml create mode 100644 tools/apps/kaskit/res/edje/app_icon.edc create mode 100644 tools/apps/kaskit/res/edje/launcher.edc create mode 100644 tools/apps/kaskit/res/edje/org.tizen.kaskit.edc create mode 100644 tools/apps/kaskit/res/images/app_press_117.png create mode 100644 tools/apps/kaskit/res/images/btn_delete_nor.png create mode 100644 tools/apps/kaskit/res/images/btn_delete_press.png create mode 100644 tools/apps/kaskit/res/images/core_check_bg.png create mode 100644 tools/apps/kaskit/res/images/core_check_bg_stroke.png create mode 100644 tools/apps/kaskit/res/images/core_check_icon.png create mode 100644 tools/apps/kaskit/res/images/default_app_icon.png create mode 100644 tools/apps/kaskit/res/images/folder_appicon_bg.png create mode 100644 tools/apps/kaskit/res/images/icon_badge_container.png create mode 100644 tools/apps/kaskit/res/images/popup_bg.png create mode 100755 tools/apps/kaskit/res/images/sub_badge.png create mode 100644 tools/apps/kaskit/src/main.c create mode 100644 tools/apps/kaskit/src/ui.c create mode 100644 tools/apps/kaskit/src/widget.c create mode 100644 tools/apps/keyguard/CMakeLists.txt create mode 100644 tools/apps/keyguard/include/keyguard.h create mode 100644 tools/apps/keyguard/include/widget.h create mode 100644 tools/apps/keyguard/org.tizen.keyguard.manifest create mode 100644 tools/apps/keyguard/org.tizen.keyguard.xml create mode 100644 tools/apps/keyguard/res/edje/keyguard.edc create mode 100644 tools/apps/keyguard/res/edje/org.tizen.keyguard.edc create mode 100644 tools/apps/keyguard/res/images/icon.png create mode 100644 tools/apps/keyguard/res/images/theme_bg.png create mode 100644 tools/apps/keyguard/src/main.c create mode 100644 tools/apps/keyguard/src/ui.c create mode 100644 tools/apps/keyguard/src/widget.c create mode 100644 tools/apps/setup-wizard/CMakeLists.txt create mode 100644 tools/apps/setup-wizard/include/setup-text.h create mode 100644 tools/apps/setup-wizard/include/widget.h create mode 100644 tools/apps/setup-wizard/include/zone-setup.h create mode 100644 tools/apps/setup-wizard/org.tizen.krate-setup-wizard.manifest create mode 100644 tools/apps/setup-wizard/org.tizen.krate-setup-wizard.xml create mode 100644 tools/apps/setup-wizard/res/data/KrateManifest.xml create mode 100644 tools/apps/setup-wizard/res/edje/layout.edc create mode 100644 tools/apps/setup-wizard/res/edje/org.tizen.krate-setup-wizard.edc create mode 100644 tools/apps/setup-wizard/res/edje/security.edc create mode 100644 tools/apps/setup-wizard/res/edje/setup.edc create mode 100644 tools/apps/setup-wizard/res/edje/welcome.edc create mode 100644 tools/apps/setup-wizard/res/images/icon.png create mode 100644 tools/apps/setup-wizard/res/images/theme_bg.png create mode 100644 tools/apps/setup-wizard/src/main.c create mode 100644 tools/apps/setup-wizard/src/security.c create mode 100644 tools/apps/setup-wizard/src/ui.c create mode 100644 tools/apps/setup-wizard/src/util.c create mode 100644 tools/apps/setup-wizard/src/widget.c create mode 100644 tools/cli/CMakeLists.txt create mode 100644 tools/cli/krate-admin-cli.cpp create mode 100644 tools/gumd-scripts/20_pam-krate-add.post create mode 100644 tools/gumd-scripts/20_pam-krate-remove.post diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..ba4a34b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,94 @@ +# +# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +PROJECT(krate) + +IF(NOT DEFINED VERSION) + SET(VERSION "0.0.1") +ENDIF(NOT DEFINED VERSION) + +INCLUDE(FindPkgConfig) + +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "DEBUG") +ENDIF(NOT CMAKE_BUILD_TYPE) + +SET(KRATE_COMMON ${PROJECT_SOURCE_DIR}/common) +SET(KRATE_API ${PROJECT_SOURCE_DIR}/api) +SET(KRATE_LIB ${PROJECT_SOURCE_DIR}/lib) +SET(KRATE_SERVER ${PROJECT_SOURCE_DIR}/server) +SET(KRATE_VOLUME ${PROJECT_SOURCE_DIR}/volume) +SET(KRATE_TOOLS ${PROJECT_SOURCE_DIR}/tools) +SET(KRATE_MODULE ${PROJECT_SOURCE_DIR}/module) + +IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) + SET(CXX_STD "c++0x") +else() + SET(CXX_STD "c++11") +endif() + +SET(COMPILE_BASE_FLAGS "-g -fPIC -Werror -Wall -Wl,--as-needed -Wl,--no-whole-archive") +SET(CMAKE_C_FLAGS_PROFILING "${COMPILE_BASE_FLAGS} -O0 -pg") +SET(CMAKE_CXX_FLAGS_PROFILING "${COMPILE_BASE_FLAGS} -O0 -pg -std=${CXX_STD} -fno-rtti") +SET(CMAKE_C_FLAGS_DEBUG "${COMPILE_BASE_FLAGS} -O0 -ggdb") +SET(CMAKE_CXX_FLAGS_DEBUG "${COMPILE_BASE_FLAGS} -O0 -ggdb -std=${CXX_STD} -fno-rtti") +SET(CMAKE_C_FLAGS_RELEASE "${COMPILE_BASE_FLAGS} -O2 -DNDEBUG") +SET(CMAKE_CXX_FLAGS_RELEASE "${COMPILE_BASE_FLAGS} -O2 -DNDEBUG -std=${CXX_STD} -fno-rtti") +SET(CMAKE_C_FLAGS_CCOV "${COMPILE_BASE_FLAGS} -O0 --coverage") +SET(CMAKE_CXX_FLAGS_CCOV "${COMPILE_BASE_FLAGS} -O0 --coverage -std=${CXX_STD} -fno-rtti") + +IF(NOT DEFINED LIB_DIR) + SET(LIB_DIR "${CMAKE_INSTALL_LIBDIR}") +ENDIF(NOT DEFINED LIB_DIR) + +IF(NOT DEFINED INCLUDE_DIR) + SET(INCLUDE__DIR "${CMAKE_INSTALL_INCLUDEDIR}") +ENDIF(NOT DEFINED INCLUDE_DIR) + +IF(NOT DEFINED RUN_DIR) + SET(RUN_DIR "/run") +ENDIF(NOT DEFINED RUN_DIR) + +IF(NOT DEFINED BIN_DIR) + SET(BIN_DIR "${CMAKE_INSTALL_BINDIR}") +ENDIF(NOT DEFINED BIN_DIR) + +IF(NOT DEFINED HOME_DIR) + SET(HOME_DIR "/home") +ENDIF(NOT DEFINED HOME_DIR) + +IF(NOT DEFINED PAMD_DIR) + SET(PAMD_DIR "${SYSCONF_INSTALL_DIR}/pam.d") +ENDIF(NOT DEFINED PAMD_DIR) + +IF(NOT DEFINED SYSTEMD_UNIT_DIR) + SET(SYSTEMD_UNIT_DIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/system") +ENDIF(NOT DEFINED SYSTEMD_UNIT_DIR) + +IF(NOT DEFINED CONF_DIR) + SET(CONF_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/krate") +ENDIF(NOT DEFINED CONF_DIR) + +ADD_DEFINITIONS(-DUG_WAYLAND) + +#ADD_SUBDIRECTORY(${KRATE_COMMON}) +ADD_SUBDIRECTORY(${KRATE_SERVER}) +#ADD_SUBDIRECTORY(${KRATE_VOLUME}) +#ADD_SUBDIRECTORY(${KRATE_LIB}) +#ADD_SUBDIRECTORY(${KRATE_MODULE}) +ADD_SUBDIRECTORY(${KRATE_TOOLS}) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..26b7de6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,204 @@ +Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. + + 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/krate.manifest b/krate.manifest new file mode 100644 index 0000000..a76fdba --- /dev/null +++ b/krate.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt new file mode 100644 index 0000000..d7ef612 --- /dev/null +++ b/module/CMakeLists.txt @@ -0,0 +1,52 @@ +# +# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +PROJECT(zone-provider) + +FILE(GLOB ZONE_PAM_SRCS zone-builder.cpp + session.cpp + zone.cpp +) + +SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack") + +SET(ZONE_PAM_NAME "pam_zone") +ADD_LIBRARY(${ZONE_PAM_NAME} MODULE ${ZONE_PAM_SRCS}) +SET_TARGET_PROPERTIES(${ZONE_PAM_NAME} PROPERTIES PREFIX "" + COMPILE_DEFINITIONS PID_FILE_PATH="${RUN_INSTALL_DIR}/zone" + COMPILE_FLAGS "-fvisibility=hidden" +) + +FIND_PATH(PAM_INCLUDE_DIR NAMES security/pam_appl.h security/pam_ext.h security/pam_modules.h + HINTS ${PAM_ROOT_DIR} PATH_SUFFIXES include) +FIND_LIBRARY(PAM_LIBRARY pam HINTS ${PAM_ROOT_DIR} PATH_SUFFIXES ${LIB_INSTALL_DIR}) +MARK_AS_ADVANCED(PAM_INCLUDE_DIR PAM_LIBRARY) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PAM DEFAULT_MSG PAM_LIBRARY PAM_INCLUDE_DIR) + +INCLUDE_DIRECTORIES(${PAM_INCLUDE_DIR} ${DPM_COMMON}) +TARGET_LINK_LIBRARIES(${ZONE_PAM_NAME} ${PAM_LIBRARY} dpm-common pthread) + +TARGET_COMPILE_DEFINITIONS(${ZONE_PAM_NAME} PRIVATE + CONF_PATH="${CONF_INSTALL_DIR}" +) + +INSTALL(TARGETS ${ZONE_PAM_NAME} DESTINATION ${LIB_INSTALL_DIR}/security) +INSTALL(FILES data/DefaultZoneManifest.xml DESTINATION ${CONF_INSTALL_DIR}/zone RENAME owner.xml) +INSTALL(FILES data/zone_indicator_icon.png DESTINATION /opt/data/dpm) +INSTALL(FILES data/zone_noti_list_sub_icon.png DESTINATION /opt/data/dpm) +INSTALL(FILES pam.d/systemd-user-zone DESTINATION ${PAMD_INSTALL_DIR}) diff --git a/module/data/DefaultZoneManifest.xml b/module/data/DefaultZoneManifest.xml new file mode 100644 index 0000000..0660025 --- /dev/null +++ b/module/data/DefaultZoneManifest.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/module/data/zone_indicator_icon.png b/module/data/zone_indicator_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..c386ea578e3d1f20f20085df047bd38430148469 GIT binary patch literal 1213 zcmbVMO>Em#9CudMwS`vOU_u=qGR}$$EViE=JBih-bMg`zM!JwjY7R)PW52Xs>yO&* zlJ>H-0x3nH3JIo7+hGL;J3u8gfe;8qNC8w195^9B8ti~HqzRDF)J>JT=Qb%EsvWTW z@&51qf4~2?mvY0;cXu7`A_$^8GX(Sa+v`6a?fBie`Ksy*UaIJgSY@xGIEauntAxmm zp-iAWQnb05H8emFZDqYs^orRRCDk%$#n+*$hK zTAUgcvTW8)qDg&d-a#Yt!v%GIN{wmM;4yNbDq#Wxc?wxIrcGC>#;Gk{39tQah9b9A zys0>~?Nl+FBa@bcNP*@3q$u(R16V$*FV3a5;zDmDXXmN5)Jt}SiX%cFnY*j3vt%-M*^BiEXBR9ug8 zum#4syT2h{5ql$@baY%4Wg1%Qtbt4~1LG7vp*3BTSTO>kDM94JLMp`r5M{-%oRkGF zkxaxm09zcpVbdTI1~E1%@>~RfR5+TFc?iQo6oQ1D2C)`4W4fMVs;FgG$99|8#C@?+ z(m{%6IR(p_ZgoIz((){K(z40qh)DL2>ZWE@+-LmqY)1=`qn}1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(}%B@^;`L!Q28P<#$Y$hx86 zbWhbqQ&7j;ju3341GiJZET_ zg5G%MwKe;O2FS3yDx}FJ2Y9AqJPTN-gvb5j*QZv$r0KpBje!<^PtX8*51w86%He-6 zeRViYYz@6<6Chh94GuADTZ~Nj@Yjy|6VD%Cd7v@S^3KgVRB!w4p$*UY$W*>^XYaj> zYlWhyGaRZ2ILBzYwpVs7m=GHEaqGKvCwK1O{KLjTOWUl@@bie1vkxEK^z&bxSi7g| zvQJNF>`sGTt1!=)JrcT#uB!#+3vD0!-HzYh^+aQ!<;?%<@x{5_Evpl!-(A%I?ENPn zyM2*Xv2YPXQO)U+aP}ZDVI-;|I66;z^4O-P*3Ozgaa;3+oALPKM!&096>iwK{msU8 z)xo=K>r|zrl#qD}Kq?T|fOyhnp;$sif0+1E)(vd(M7x&;GN^{{Wyp*mOkH zuipw3AADb*ZneF7p>Fgq7i&X%x1aj@r>^%lEUxua#R7orqpe8HhtLS4bE5WN559Q! zZ%je0!KNcu9EFs;|MX@&lDlFGYW~(sn=jn8;*JwPzURy%)nl>Bs)Y)M!wN>?^R-_b zU-#@Q=j)FG_-C-`h$j_%Fwn3;+Lt`OExftwYwgc{ +#include +#include +#include +#include +#include +#include + +#include "session.h" +#include "exception.h" +#include "filesystem.h" + +bool isValidSessionLeader(pid_t pid) +{ + runtime::File proc("/proc/" + std::to_string(pid)); + return proc.exists(); +} + +void createSession(const runtime::User& user, const SessionBuilder& sessionBuilder) +{ + runtime::File file("/var/run/zone/" + user.getName()); + if (file.exists()) { + if (isValidSessionLeader(getSessionLeader(user))) { + throw runtime::Exception("Session already opened"); + } + file.remove(); + } else { + file.makeBaseDirectory(); + } + + sessionBuilder(user); + + file.create(0600); + file.lock(); + file.chown(user.getUid(), user.getGid()); + pid_t pid = ::getpid(); + file.write(&pid, sizeof(pid_t)); + file.unlock(); +} + +pid_t getSessionLeader(const runtime::User& user) +{ + runtime::File file("/var/run/zone/" + user.getName(), O_RDONLY); + file.lock(); + pid_t pid = -1; + file.read(&pid, sizeof(pid_t)); + file.unlock(); + + return pid; +} + +void destroySession(const runtime::User& user) +{ + std::string path = "/var/run/zone/" + user.getName(); + ::unlink(path.c_str()); +} diff --git a/module/session.h b/module/session.h new file mode 100644 index 0000000..df01173 --- /dev/null +++ b/module/session.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#ifndef __ZONE_SESSION_ENV_H__ +#define __ZONE_SESSION_ENV_H__ + +#include +#include + +#include +#include + +#include "auth/user.h" + +typedef std::function SessionBuilder; + +bool isValidSessionLeader(pid_t pid); +void createSession(const runtime::User& user, const SessionBuilder& sessionBuilder); +pid_t getSessionLeader(const runtime::User& user); +void destroySession(const runtime::User& user); + +#endif //!__ZONE_SESSION_ENV_H__ diff --git a/module/zone-builder.cpp b/module/zone-builder.cpp new file mode 100644 index 0000000..c36e9da --- /dev/null +++ b/module/zone-builder.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + #include + #include + #include + #include + #include + #include + +#include "zone-builder.h" + +#include "exception.h" +#include "filesystem.h" + +ZoneBuilder::ZoneBuilder(const runtime::User& user, const std::string& manifestPath) : + name(user.getName()), uid(user.getUid()), gid(user.getGid()) +{ + manifest.reset(xml::Parser::parseFile(manifestPath)); +} + +ZoneBuilder::~ZoneBuilder() +{ +} + +void ZoneBuilder::bindFilesystemNode(const std::string& source, const std::string& target, + const std::string& type, const std::string& options, + bool create) +{ + if (create) { + runtime::File dir(target); + if (!dir.exists()) { + dir.makeDirectory(true, uid, gid); + } + } + + runtime::Mount::mountEntry(source, target, type, options); +} + +void ZoneBuilder::containerize(bool create) +{ + int nsFlags = CLONE_NEWIPC | CLONE_NEWNS; + + if (::unshare(nsFlags)) { + throw runtime::Exception("Failed to unshare namespace"); + } + + if (::mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL) == -1) { + throw runtime::Exception("Failed to mount root filesystem"); + } + + xml::Node::NodeList entries = manifest->evaluate("/manifest/filesystem/entry"); + for (const xml::Node& entry : entries) { + bindFilesystemNode(entry.getProp("source"), entry.getProp("target"), + entry.getProp("type"), entry.getProp("options")); + } + + bindFilesystemNode("/home/" + name, + "/home/" + name + "/.zone/" + name, + "none", "rw,bind"); + + bindFilesystemNode("/home/" + name + "/.zone", "/home", + "none", "rw,rbind"); +} diff --git a/module/zone-builder.h b/module/zone-builder.h new file mode 100644 index 0000000..52b02a4 --- /dev/null +++ b/module/zone-builder.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + + #ifndef __ZONE_BUILDER_H__ + #define __ZONE_BUILDER_H__ + +#include +#include +#include + +#include "xml/parser.h" +#include "xml/document.h" +#include "auth/user.h" + +class ZoneBuilder { +public: + ZoneBuilder(const runtime::User& user, const std::string& manifestPath); + virtual ~ZoneBuilder(); + + void containerize(bool create = true); + +protected: + void bindFilesystemNode(const std::string& source, const std::string& target, + const std::string& type, const std::string& options, + bool create = true); +private: + std::string name; + uid_t uid; + gid_t gid; + std::unique_ptr manifest; +}; + + #endif //!__ZONE_BUILDER_H__ diff --git a/module/zone-guard.h b/module/zone-guard.h new file mode 100644 index 0000000..ded6ba2 --- /dev/null +++ b/module/zone-guard.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef __ZONE_GUARD_H__ +#define __ZONE_GUARD_H__ + +#include +#include +#include +#include + +#include + +#include "exception.h" + +class ZoneGuard { +public: + ZoneGuard(const std::string& name) : + zoneName(name), + semaphore(nullptr) + { + semaphore = ::sem_open(zoneName.c_str(), O_CREAT, 0700, 1); + if (semaphore == nullptr) { + throw runtime::Exception("Filed to create semaphore for zone guard"); + } + } + + ~ZoneGuard() + { + if (semaphore == nullptr) { + return; + } + + ::sem_post(semaphore); + ::sem_close(semaphore); + ::sem_unlink(zoneName.c_str()); + } + + void wait() + { + while ((::sem_wait(semaphore) == -1) && (errno == EINTR)); + } + +private: + std::string zoneName; + sem_t* semaphore; +}; + +#endif //!__ZONE_GUARD_H__ diff --git a/module/zone.cpp b/module/zone.cpp new file mode 100644 index 0000000..99b9699 --- /dev/null +++ b/module/zone.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +#include +#include +#include + +#include +#include + +#include "zone-guard.h" +#include "zone-builder.h" +#include "session.h" + +#include "exception.h" +#include "filesystem.h" +#include "xml/parser.h" +#include "xml/document.h" + +#define ZONE_MANIFEST_DIR CONF_PATH "/zone/" + +std::string buildZoneManifestPath(const std::string& name) +{ + return ZONE_MANIFEST_DIR + name + ".xml"; +} + +std::string getZoneName(pam_handle_t* handle) +{ + const void* retItem; + int error = ::pam_get_item(handle, PAM_USER, &retItem); + if (error != PAM_SUCCESS) { + throw runtime::Exception("Failed to get user"); + } + + return static_cast(retItem); +} + +void openZoneSession(const std::string& name) +{ + auto sessionBuilder = [](const runtime::User& user) { + ZoneBuilder builder(user, buildZoneManifestPath(user.getName())); + builder.containerize(); + }; + + createSession(runtime::User(name), sessionBuilder); +} + +void closeZoneSession(const std::string& name) +{ + destroySession(runtime::User(name)); +} + +extern "C" { +PAM_EXTERN __attribute__((visibility("default"))) +int pam_sm_open_session(pam_handle_t* pamh, int flags, int argc, const char* argv[]) +{ + try { + std::string name = getZoneName(pamh); + ZoneGuard zoneGuard(name); + zoneGuard.wait(); + + openZoneSession(name); + } catch (runtime::Exception& e) { + ::pam_syslog(pamh, LOG_ERR, "%s", e.what()); + return PAM_SESSION_ERR; + } + + return PAM_SUCCESS; +} + +PAM_EXTERN __attribute__((visibility("default"))) +int pam_sm_close_session(pam_handle_t* pamh, int flags, int argc, const char* argv[]) +{ + try { + std::string name = getZoneName(pamh); + ZoneGuard zoneGuard(name); + zoneGuard.wait(); + + closeZoneSession(name); + } catch (runtime::Exception& e) { + ::pam_syslog(pamh, LOG_ERR, "%s", e.what()); + return PAM_SESSION_ERR; + } + + return PAM_SUCCESS; +} + +#ifdef PAM_MODULE_ENTRY +PAM_MODULE_ENTRY("pam_zone"); +#endif + +} diff --git a/packaging/krate.spec b/packaging/krate.spec new file mode 100644 index 0000000..98c2fd0 --- /dev/null +++ b/packaging/krate.spec @@ -0,0 +1,225 @@ +Name: krate +Version: 0.0.1 +Release: 0 +License: Apache-2.0 +Source0: file://%{name}-%{version}.tar.gz +Summary: Tizen Krate Manager +Group: Security/Other +BuildRequires: gcc +BuildRequires: cmake +BuildRequires: pam-devel +BuildRequires: gettext-tools +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(pkgmgr) +BuildRequires: pkgconfig(pkgmgr-info) +BuildRequires: pkgconfig(aul) +BuildRequires: pkgconfig(appsvc) +BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(security-privilege-manager) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(capi-system-system-settings) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(key-manager) +BuildRequires: pkgconfig(auth-fw-admin) + +%description +The krate package provides a daemon which is responsible for managing each of +krates. + +%files +%manifest krate.manifest +%defattr(644,root,root,755) +#%attr(700,root,root) %{_sbindir}/zone-volume-manager +#%attr(755,root,root) %{_bindir}/krate +%{_unitdir}/krate.service +#%{_unitdir}/multi-user.target.wants/krate.service + +%prep +%setup -q + +%build +%{!?build_type:%define build_type "RELEASE"} + +%if %{build_type} == "DEBUG" || %{build_type} == "PROFILING" || %{build_type} == "CCOV" + CFLAGS="$CFLAGS -Wp,-U_FORTIFY_SOURCE" + CXXFLAGS="$CXXFLAGS -Wp,-U_FORTIFY_SOURCE" +%endif + +%{!?profile:%define profile "mobile"} + +%cmake . -DVERSION=%{version} \ + -DCMAKE_BUILD_TYPE=%{build_type} \ + -DTIZEN_PROFILE_NAME=%{profile} \ + -DRUN_DIR=%{TZ_SYS_RUN} \ + -DBIN_DIR=%{TZ_SYS_BIN} \ + -DHOME_DIR=%{TZ_SYS_HOME} \ + -DSYSTEMD_UNIT_DIR=%{_unitdir} \ + -DPAMD_DIR=/etc/pam.d \ + -DCONF_DIR=%{TZ_SYS_ETC}/krate \ + -DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \ + -DAPP_ICON_DIR_PREFIX="%{TZ_SYS_RO_ICONS}" \ + -DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}" + +make %{?jobs:-j%jobs} + +%install +%make_install +#mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants +#ln -s ../krate.service %{buildroot}/%{_unitdir}/multi-user.target.wants/krate.service + +%clean +rm -rf %{buildroot} + +%preun + +%postun + +%if 0 +## Krate Client Package ######################################################## +%package -n libkrate +Summary: Tizen Krate Client library +Group: Development/Libraries +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(libtzplatform-config) +Requires: %{name} = %{version}-%{release} +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description -n libkrate +The libkrate package contains the libraries needed to control inside of the krate. + +%post -n libkrate -p /sbin/ldconfig + +%postun -n libkrate -p /sbin/ldconfig + +%files -n libkrate +%manifest krate.manifest +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libkrate.so.%{version} +%{_libdir}/libkrate.so.0 + +## Devel Package ############################################################## +%package -n libkrate-devel +Summary: Libraries and header files for krate client development +Group: Development/Libraries +Requires: libkrate = %{version}-%{release} + +%description -n libkrate-devel +The libkrate-devel package includes the libraries and header files necessary for +developing the krate client program. + +%files -n libkrate-devel +%manifest krate.manifest +%defattr(644,root,root,755) +%{_libdir}/libkrate.so +%{_includedir}/krate +%{_libdir}/pkgconfig/krate.pc + +%endif + +## Krate Setup Wizard Package ################################################# +%package -n org.tizen.krate-setup-wizard +Summary: Tizen Krate setup wizard Interface +Group: Security/Other +BuildRequires: pkgconfig(efl-extension) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(zone) +Requires: libzone = %{version}-%{release} + +%description -n org.tizen.krate-setup-wizard +Tizen Krate setup wizard interface for zone + +%define setup_home %{TZ_SYS_RO_APP}/org.tizen.krate-setup-wizard + +%files -n org.tizen.krate-setup-wizard +%defattr(-,root,root,-) +%manifest tools/apps/setup-wizard/org.tizen.krate-setup-wizard.manifest +%{setup_home}/bin/* +%{setup_home}/res/* +%{TZ_SYS_RO_PACKAGES}/org.tizen.krate-setup-wizard.xml + +## Kaskit package ##################################################### +%package -n org.tizen.kaskit +Summary: Tizen Krate launcher Interface +Group: Security/Other +BuildRequires: pkgconfig(efl-extension) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(capi-appfw-app-manager) +BuildRequires: pkgconfig(badge) + +%description -n org.tizen.kaskit +Tizen Krate launcher interface + +%define launcher_home %{TZ_SYS_RO_APP}/org.tizen.kaskit + +%files -n org.tizen.kaskit +%defattr(-,root,root,-) +%manifest tools/apps/kaskit/org.tizen.kaskit.manifest +%{launcher_home}/bin/* +%{launcher_home}/res/* +%{TZ_SYS_RO_PACKAGES}/org.tizen.kaskit.xml + +## Keyguard package ##################################################### +%package -n org.tizen.keyguard +Summary: Tizen Krate keyguard Interface +Group: Security/Other +BuildRequires: pkgconfig(efl-extension) +BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(evas) +BuildRequires: pkgconfig(capi-ui-efl-util) +BuildRequires: pkgconfig(auth-fw) +BuildRequires: pkgconfig(shortcut) + +%description -n org.tizen.keyguard +Tizen Krate keyguard interface + +%define keyguard_home %{TZ_SYS_RO_APP}/org.tizen.keyguard + +%files -n org.tizen.keyguard +%defattr(-,root,root,-) +%manifest tools/apps/keyguard/org.tizen.keyguard.manifest +%{keyguard_home}/bin/* +%{keyguard_home}/res/* +%{TZ_SYS_RO_PACKAGES}/org.tizen.keyguard.xml + +%if 0 +## PAM Plugin Package ######################################################## +%package -n dpm-pam-krate +Summary: PAM Plugin for zone policy in device policy manager +Group: Development/Libraries +Requires: systemd + +%description -n dpm-pam-krate +PAM Plugin for zone policy in device policy manager and CLI tool + +%post -n dpm-pam-krate +mv /etc/pam.d/systemd-user /etc/pam.d/systemd-user.keep +cp /etc/pam.d/systemd-user-zone /etc/pam.d/systemd-user + +%postun -n dpm-pam-krate +mv /etc/pam.d/systemd-user.keep /etc/pam.d/systemd-user + +%files -n dpm-pam-krate +%manifest krate.manifest +%defattr(600,root,root,700) +%attr(700,root,root) %{_libdir}/security/pam_*.so +%attr(700,root,root) %{_sbindir}/krate-admin-cli +%attr(700,root,root) %dir %{TZ_SYS_ETC}/krate +%attr(600,root,root) %config %{TZ_SYS_ETC}/krate/owner.xml +%attr(700,root,root) /etc/gumd/useradd.d/20_pam-krate-add.post +%attr(700,root,root) /etc/gumd/userdel.d/20_pam-krate-remove.post +%attr(644,root,root) %{TZ_SYS_RO_ICONS}/krate/indicator_icon.png +%attr(644,root,root) %{TZ_SYS_RO_ICONS}/krate/noti_list_sub_icon.png +%config /etc/pam.d/* +%endif diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt new file mode 100644 index 0000000..7b5f240 --- /dev/null +++ b/server/CMakeLists.txt @@ -0,0 +1,21 @@ +# +# Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +SET(TARGET ${PROJECT_NAME}) + +CONFIGURE_FILE(systemd/krate.service.in systemd/krate.service) + +INSTALL(FILES systemd/krate.service DESTINATION ${SYSTEMD_UNIT_DIR}) diff --git a/server/systemd/krate.service.in b/server/systemd/krate.service.in new file mode 100644 index 0000000..1e9d228 --- /dev/null +++ b/server/systemd/krate.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=Krate + +[Service] +Type=simple +ExecStart=${TZ_SYS_BIN}/krate +Restart=on-failure +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100755 index 0000000..baa8c10 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,19 @@ +# +# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +SET(KRATE_APPS ${KRATE_TOOLS}/apps) + +ADD_SUBDIRECTORY(${KRATE_APPS}) diff --git a/tools/apps/CMakeLists.txt b/tools/apps/CMakeLists.txt new file mode 100755 index 0000000..6b27cd9 --- /dev/null +++ b/tools/apps/CMakeLists.txt @@ -0,0 +1,35 @@ +# +# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FIND_PACKAGE(PkgConfig REQUIRED) +PKG_CHECK_MODULES(EFL_APP REQUIRED + dlog + glib-2.0 + bundle + efl-extension + elementary + capi-appfw-application + capi-ui-efl-util + evas +) + +SET(KRATE_APPS_SETUP_WIZARD ${KRATE_APPS}/setup-wizard) +SET(KRATE_APPS_LAUNCHER ${KRATE_APPS}/kaskit) +SET(KRATE_APPS_KEYGUARD ${KRATE_APPS}/keyguard) + +ADD_SUBDIRECTORY(${KRATE_APPS_SETUP_WIZARD}) +ADD_SUBDIRECTORY(${KRATE_APPS_LAUNCHER}) +ADD_SUBDIRECTORY(${KRATE_APPS_KEYGUARD}) diff --git a/tools/apps/kaskit/CMakeLists.txt b/tools/apps/kaskit/CMakeLists.txt new file mode 100644 index 0000000..d20bae0 --- /dev/null +++ b/tools/apps/kaskit/CMakeLists.txt @@ -0,0 +1,40 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(org.tizen.kaskit C) + +INCLUDE_DIRECTORIES(./include) + +FIND_PACKAGE(PkgConfig REQUIRED) +PKG_CHECK_MODULES(KASKIT REQUIRED + capi-appfw-application + capi-appfw-package-manager + capi-appfw-app-manager + badge +) + +INCLUDE_DIRECTORIES(${EFL_APP_INCLUDE_DIRS} ${KASKIT_INCLUDE_DIRS}) +LINK_DIRECTORIES(${EFL_APP_LIBRARY_DIRS} ${KASKIT_LIBRARY_DIRS}) + +SET(PROJECT_SRC src/main.c + src/ui.c + src/widget.c) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") + +ADD_EXECUTABLE(${PROJECT_NAME} ${PROJECT_SRC}) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/bin) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${EFL_APP_LIBRARIES} ${KASKIT_LIBRARIES}) + +ADD_CUSTOM_TARGET(${PROJECT_NAME}.edj + COMMAND edje_cc -no-save -id ${CMAKE_CURRENT_SOURCE_DIR}/res/images + ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/${PROJECT_NAME}.edc + ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/res/edje/${PROJECT_NAME}.edc) + +ADD_DEPENDENCIES(${PROJECT_NAME} ${PROJECT_NAME}.edj) +INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.edj DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/res) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/images/default_app_icon.png DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/res/images) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.xml DESTINATION ${APP_SHARE_PACKAGES_DIR}) diff --git a/tools/apps/kaskit/include/conf.h b/tools/apps/kaskit/include/conf.h new file mode 100644 index 0000000..661f243 --- /dev/null +++ b/tools/apps/kaskit/include/conf.h @@ -0,0 +1,39 @@ +/* + * Tizen Krate launcher application + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef CONF_H_ +#define CONF_H_ + +#define RESOLUTION_SCALE_W 1.0 +#define RESOLUTION_SCALE_H 1.0 + +#define ICON_IMG_SIZE ((118) * (RESOLUTION_SCALE_W)) +#define ICON_TXT_SIZE_NORMAL ((int)((28) * (RESOLUTION_SCALE_H))) +#define ICON_TXT_COLOR "000000FF" +#define ICON_TXT_SHADOW_COLOR "88888888" + +#define ICON_SIZE_W ((720) * (RESOLUTION_SCALE_W) / 4) +#define ICON_SIZE_H ((1060) * (RESOLUTION_SCALE_H) / 5) + +#define MAX_BADGE_DISPLAY_COUNT 999 + +#define ALLOWED_ICON_DRAG_DISTANCE 100 +#define LONG_PRESS_TIME 0.75 + +#endif /* CONF_H_ */ diff --git a/tools/apps/kaskit/include/kaskit.h b/tools/apps/kaskit/include/kaskit.h new file mode 100644 index 0000000..da05681 --- /dev/null +++ b/tools/apps/kaskit/include/kaskit.h @@ -0,0 +1,63 @@ +/* + * Tizen Krate launcher application + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef __KASKIT_H__ +#define __KASKIT_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "org.tizen.kaskit" + +#if !defined(PACKAGE) +#define PACKAGE "org.tizen.kaskit" +#endif + +typedef struct { + Evas_Object* win; + Evas_Object* conform; + Evas_Object* layout; + Evas_Object* panel; + Evas_Object* scroller; + Evas_Object* app_view; + Eina_List* app_icon_list; + char* edj_path; +} uidata_s; + +void _create_kaskit_window(); +void _set_kaskit_window_title(const char *title); + +void _create_app_icon(const char* pkg_id, const char* app_id, const char* label, const char* icon, bool removable); +void _destroy_app_icon(const char* pkg_id); +void _update_app_icon_badge(const char* app_id, unsigned int count); + +void _icon_clicked_cb(const char *app_id); +void _icon_uninstalled_cb(const char *app_id); + +#endif /* __KASKIT_H__ */ diff --git a/tools/apps/kaskit/include/widget.h b/tools/apps/kaskit/include/widget.h new file mode 100644 index 0000000..6faf1b4 --- /dev/null +++ b/tools/apps/kaskit/include/widget.h @@ -0,0 +1,32 @@ +/* + * Tizen Krate launcher application + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef WIDGET_H_ +#define WIDGET_H_ + +#include +#include +#include +#include + +Evas_Object *_create_win(const char *package); +Evas_Object *_create_conformant(Evas_Object *parent); +Evas_Object *_create_layout(Evas_Object *parent, char *file, const char *group); + +#endif /* WIDGET_H_ */ diff --git a/tools/apps/kaskit/org.tizen.kaskit.manifest b/tools/apps/kaskit/org.tizen.kaskit.manifest new file mode 100644 index 0000000..a76fdba --- /dev/null +++ b/tools/apps/kaskit/org.tizen.kaskit.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/tools/apps/kaskit/org.tizen.kaskit.xml b/tools/apps/kaskit/org.tizen.kaskit.xml new file mode 100644 index 0000000..e51ac98 --- /dev/null +++ b/tools/apps/kaskit/org.tizen.kaskit.xml @@ -0,0 +1,13 @@ + + + + + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/packagemanager.info + http://tizen.org/privilege/packagemanager.admin + http://tizen.org/privilege/notification + + + + + diff --git a/tools/apps/kaskit/res/edje/app_icon.edc b/tools/apps/kaskit/res/edje/app_icon.edc new file mode 100644 index 0000000..9189df4 --- /dev/null +++ b/tools/apps/kaskit/res/edje/app_icon.edc @@ -0,0 +1,311 @@ +#include "../../include/conf.h" + +images { + image: "app_press_117.png" COMP; + image: "btn_delete_nor.png" COMP; + image: "btn_delete_press.png" COMP; + image: "icon_badge_container.png" COMP; + image: "folder_appicon_bg.png" COMP; + image: "sub_badge.png" COMP; +} + +styles { + style{ + name: "icon_label"; + base: "font=Tizen:style=Regular align=center color=#FFFFFFFF style=shadow,bottom shadow_color=#000000FF font_size=26 ellipsis=1.0 wrap=mixed"; + } + style{ + name: "icon_label_edit"; + base: "font=Tizen:style=Regular align=center color=#FFFFFFFF style=shadow,bottom shadow_color=#000000FF font_size=23 ellipsis=1.0 wrap=mixed"; + } +} + +group { name: "icon"; + parts { + part { name: "bg"; + type: RECT; + mouse_events: 1; + repeat_events: 1; + description { + state: "default" 0.0; + align: 0 0; + rel1{relative: 0.0 0.0; offset: 0 0;} + rel2{relative: 0.0 0.0; offset: ICON_SIZE_W ICON_SIZE_H;} + visible: 0; + } + } //"bg" + + part { name: "icon_content"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1{relative: 0.16 0; to: "bg";} + rel2{relative: 0.84 0.6; to: "bg";} + align: 0.5 0.5; + } + } //"icon_content" + + part { name: "icon_touch"; + type: IMAGE; + mouse_events: 1; + repeat_events: 1; + scale: 1; + description { + state: "default" 0.0; + rel1{relative: 0.0 0.0; to: "icon_content";} + rel2{relative: 1.0 1.0; to: "icon_content";} + aspect: 1.0 1.0; + aspect_preference: BOTH; + color: 0 0 0 0; + image { + normal: "app_press_117.png"; + } + } + description{ + state: "icon_touched" 0.0; + inherit: "default" 0.0; + color: 0 0 0 250; + } + } //"icon_touch" + + part { name: "app_icon_disable"; + type: IMAGE; + mouse_events: 1; + repeat_events: 0; + scale: 1; + description { + state: "default" 0.0; + rel1{relative: 0.0 0.0; to: "icon_content";} + rel2{relative: 1.0 1.0; to: "icon_content";} + aspect: 1.0 1.0; + aspect_preference: BOTH; + color: 0 0 0 0; + image { + normal: "folder_appicon_bg.png"; + } + visible: 0; + } + description{ + state: "disable" 0.0; + inherit: "default" 0.0; + color: 0 0 0 150; + visible: 1; + } + } //"app_icon_disable" + + part { name: "icon_name"; + type: TEXTBLOCK; + mouse_events: 1; + repeat_events: 1; + description { + state: "default" 0.0; + rel1{relative: 0.04 0.6; to: "bg";} + rel2{relative: 0.95 0.98; to: "bg";} + color: 255 255 255 255; + text { + style: "icon_label"; + align: 0.5 0.0; + } + } + description { + state: "disable" 0.0; + inherit: "default" 0.0; + color: 0 0 0 50; + } + description { + state: "hide" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } //"icon_name" + + part { name: "icon_badge"; + type: IMAGE; + scale: 0; + description { + state: "default" 0.0; + rel1{relative: 0.0 0.0; offset: -10 -1; to: "badge_text";} + rel2{relative: 1.0 1.0; offset: 13 1; to: "badge_text";} + visible: 0; + image + { + normal: "icon_badge_container.png"; + } + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } //"icon_badge" + + part { name: "badge_text"; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + visible: 0; + fixed: 1 1; + color: 255 255 255 255; + rel1{relative: 0.95 -0.05; to: "icon_content";} + rel2{relative: 0.95 -0.05; to: "icon_content";} + align: 1.0 0.0; + text { + font: "arial"; + size: 20; + text_class: "ATO002"; + min: 1 1; + max: 1 1; + } + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } //"badge_text" + + part { name: "icon_sub_badge"; + type: IMAGE; + scale: 0; + description { + state: "default" 0.0; + rel1{relative: 0.6 0.6; to: "icon_content";} + rel2{relative: 1.1 1.1; to: "icon_content";} + color: 255 255 255 255; + visible: 1; + aspect: 1.0 1.0; + aspect_preference: BOTH; + image + { + normal: "sub_badge.png"; + } + } + description { + state: "hide" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } //"icon_sub_badge" + + part { name: "uninstall_btn"; + type: IMAGE; + scale: 0; + description { + state: "default" 0.0; + rel1{relative: -0.1 -0.1; to: "icon_content";} + rel2{relative: 0.4 0.4; to: "icon_content";} + color: 255 255 255 0; + visible: 0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + image { + normal: "btn_delete_nor.png"; + } + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + visible: 1; + } + description { + state: "press" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + image { + normal: "btn_delete_press.png"; + } + visible: 1; + } + } //"uninstall_btn" + } + + programs { + program { name: "icon_touch_program"; + signal: "mouse,down,1"; + source: "icon_touch"; + action: STATE_SET "icon_touched" 0.0; + target: "icon_touch"; + transition: LINEAR 0.1; + } + program { name: "icon_touch_release_program"; + signal: "mouse,up,1"; + source: "icon_touch"; + action: STATE_SET "default" 0.0; + target: "icon_touch"; + transition: LINEAR 0.1; + } + program { name: "icon_sub_badge_show"; + signal: "icon_sub_badge_show"; + source: "source"; + action: STATE_SET "default" 0.0; + target: "icon_sub_badge"; + } + program { name: "icon_sub_badge_hide"; + signal: "icon_sub_badge_hide"; + source: "source"; + action: STATE_SET "hide" 0.0; + target: "icon_sub_badge"; + } + program { name: "uninstall_button_show"; + signal: "uninstall_button_show"; + source: "source"; + action: STATE_SET "show" 0.0; + target: "uninstall_btn"; + } + program { name: "uninstall_button_hide"; + signal: "uninstall_button_hide"; + source: "source"; + action: STATE_SET "default" 0.0; + target: "uninstall_btn"; + } + program { name: "uninstall_button_clicked"; + signal: "mouse,clicked,1"; + source: "uninstall_btn"; + action: SIGNAL_EMIT "uninstall_button_clicked" "source"; + } + program { name: "uninstall_button_mouse_down"; + signal: "mouse,down,1"; + source: "uninstall_btn"; + action: STATE_SET "press" 0.0; + target: "uninstall_btn"; + transition: DECELERATE 0.4; + } + program { name: "uninstall_button_mouse_up"; + signal: "mouse,up,1"; + source: "uninstall_btn"; + action: STATE_SET "show" 0.0; + target: "uninstall_btn"; + transition: DECELERATE 0.4; + } + program { name: "icon_badge_show"; + signal: "icon_badge_show"; + source: "source"; + action: STATE_SET "show" 0.0; + target: "icon_badge"; + target: "badge_text"; + } + program { name: "icon_badge_hide"; + signal: "icon_badge_hide"; + source: "source"; + action: STATE_SET "default" 0.0; + target: "icon_badge"; + target: "badge_text"; + } + program { name: "icon_disable"; + signal: "icon_disable"; + source: "source"; + action: STATE_SET "disable" 0.0; + target: "app_icon_disable"; + target: "icon_name"; + } + program { name: "icon_enable"; + signal: "icon_enable"; + source: "source"; + action: STATE_SET "default" 0.0; + target: "icon_name"; + target: "app_icon_disable"; + } + } +} diff --git a/tools/apps/kaskit/res/edje/launcher.edc b/tools/apps/kaskit/res/edje/launcher.edc new file mode 100644 index 0000000..d155b88 --- /dev/null +++ b/tools/apps/kaskit/res/edje/launcher.edc @@ -0,0 +1,90 @@ +group { name: "main_window"; + parts { + part { name: "bg"; + type: RECT; + mouse_events: 1; + repeat_events: 0; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1 {relative: 0.0 0.0;} + rel2 {relative: 1.0 1.0;} + } + } + part { name: "popup_window"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 {relative: 0.0 0.2; to: "bg"; offset: 22 0;} + rel2 {relative: 1.0 0.8; to: "bg"; offset: -22 0;} + } + } + programs { + program { name: "background_clicked_cb"; + signal: "mouse,clicked,1"; + source: "bg"; + action: SIGNAL_EMIT "bg_clicked" "layout"; + } + } + } +} + +group { name: "popup_layout"; + images{ + image: "popup_bg.png" COMP; + } + parts { + part { name: "bg"; + type: IMAGE; + description { state: "default" 0.0; + rel1 {relative: 0.0 0.0;} + rel2 {relative: 1.0 1.0;} + image { + normal: "popup_bg.png"; + border: 5 5 5 5; + } + } + } + part { name: "separator"; + type: RECT; + description { state: "default" 0.0; + rel1 { relative: 0.07 62/569; to: "bg";} + rel2 {relative: 0.93 64/569; to: "bg";} + color: 7 180 211 250; + } + } + part { name: "popup_title_bg"; + type: SWALLOW; + description { state: "default" 0.0; + rel1 {relative: 0.15 0; to: "bg";} + rel2 {relative: 0.85 62/569; to: "bg";} + color: 0 0 0 0; + visible: 0; + } + description { state: "done" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "popup_title"; + type: TEXT; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + rel1 { relative: 0.0 0.0; to: "popup_title_bg";} + rel2 { relative: 1.0 1.0; to: "popup_title_bg";} + color: 7 180 211 250; + visible: 1; + text { + text: ""; + size: 40; + } + } + } + part { name: "popup_content"; + type: SWALLOW; + description { state: "default"; + rel1 {relative: 0.0 0.0; to_x: "bg"; to_y: "separator"; offset: 22 22;} + rel2 {relative: 1.0 1.0; to: "bg"; offset: -22 -22;} + } + } + } +} diff --git a/tools/apps/kaskit/res/edje/org.tizen.kaskit.edc b/tools/apps/kaskit/res/edje/org.tizen.kaskit.edc new file mode 100644 index 0000000..b666153 --- /dev/null +++ b/tools/apps/kaskit/res/edje/org.tizen.kaskit.edc @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +collections { + base_scale: 1.8; + #include "launcher.edc" + #include "app_icon.edc" +} diff --git a/tools/apps/kaskit/res/images/app_press_117.png b/tools/apps/kaskit/res/images/app_press_117.png new file mode 100644 index 0000000000000000000000000000000000000000..5acae9d0ff39341450f2e0959cc91e8984ce0f35 GIT binary patch literal 3104 zcmaJ@c|4SB8y?C|B1JkF)2_^dp&9EiwrZGWXe46HyqFm?qnWYqrAQ%J(n!{_g;7+< zlIGykM|7T!B#<5T^0laDcIX# z38Fb*^_7+sef`%~+!almdDbpGBHNo6MCJe>43+H#fbE%NAAkUmsUgQZ0TU2t4TR?8 z!gIkLL{r#ID0vkF4QBd_*dUOJd9Xj3!T@++FTjV!GKI|4H$lKOswsqo#KCd?R)8qr9Dx8E8bT2UNJB%!Ua%e@hq5_7Fa!#PTGi0g(-k3fxgjhbIars)-TFfT3v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