%make_install
mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
ln -s ../ode.service %{buildroot}/%{_unitdir}/multi-user.target.wants/ode.service
+ln -s ../org.tizen.ode-lockscreen.service %{buildroot}/%{_unitdir}/multi-user.target.wants/org.tizen.ode-lockscreen.service
%find_lang secure-erase
%find_lang ode
Tizen ODE User Interface for device policy management
%define odeapp_home %{TZ_SYS_RO_APP}/org.tizen.ode
+%define odelockscreen_home %{TZ_SYS_RO_APP}/org.tizen.ode-lockscreen
%post -n org.tizen.ode
ln -sf %{odeapp_home}/bin/org.tizen.ode /usr/bin/ode
%{odeapp_home}/bin/*
%{odeapp_home}/res/*
%{TZ_SYS_RO_PACKAGES}/org.tizen.ode.xml
+%{odelockscreen_home}/bin/*
+%{odelockscreen_home}/res/*
+%{_unitdir}/org.tizen.ode-lockscreen.service
+%{_unitdir}/multi-user.target.wants/org.tizen.ode-lockscreen.service
## Secure Erase Interface Package ################################
%package -n org.tizen.secure-erase
[Unit]
Description=@PROJECT_NAME@ management daemon
Before=deviced.service
+After=amd.service
[Service]
Type=simple
dlog
glib-2.0
bundle
+ notification
efl-extension
elementary
capi-appfw-application
)
SET(ODE_APPS_ODE ${ODE_APPS}/ode)
+SET(ODE_APPS_ODE_LOCKSCREEN ${ODE_APPS}/lockscreen)
SET(ODE_APPS_SECURE_ERASE ${ODE_APPS}/secure-erase)
ADD_SUBDIRECTORY(${ODE_APPS_ODE})
+ADD_SUBDIRECTORY(${ODE_APPS_ODE_LOCKSCREEN})
ADD_SUBDIRECTORY(${ODE_APPS_SECURE_ERASE})
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(org.tizen.ode-lockscreen C)
+
+INCLUDE_DIRECTORIES(./include)
+INCLUDE_DIRECTORIES(../ode/include)
+
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(ODE_LOCKSCREEN REQUIRED
+ vconf
+ capi-system-system-settings
+)
+
+INCLUDE_DIRECTORIES(${EFL_APP_INCLUDE_DIRS} ${ODE_LIB} ${ODE_LOCKSCREEN_INCLUDE_DIRS})
+LINK_DIRECTORIES(${EFL_APP_LIBRARY_DIRS} ${ODE_LOCKSCREEN_LIBRARY_DIRS})
+
+SET(PACKAGE_SRC src/main.c
+ src/ui.c
+ ../ode/src/ode-app-widget.c)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${PACKAGE_SRC})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/bin)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${EFL_APP_LIBRARIES} ${ODE_LOCKSCREEN_LIBRARIES} ode)
+
+ADD_CUSTOM_TARGET(org.tizen.ode-lockscreen.edj
+ COMMAND edje_cc -no-save -id ${CMAKE_CURRENT_SOURCE_DIR}/res/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.ode-lockscreen.edc
+ ${CMAKE_BINARY_DIR}/org.tizen.ode-lockscreen.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.ode-lockscreen.edc)
+
+CONFIGURE_FILE(systemd/${PROJECT_NAME}.service.in systemd/${PROJECT_NAME}.service)
+
+ADD_DEPENDENCIES(${PROJECT_NAME} org.tizen.ode-lockscreen.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/org.tizen.ode-lockscreen.edj DESTINATION ${APP_INSTALL_PREFIX}/${PROJECT_NAME}/res)
+INSTALL(FILES systemd/${PROJECT_NAME}.service DESTINATION ${SYSTEMD_UNIT_DIR})
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 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 __ODE_LOCKSCREEN_H__
+#define __ODE_LOCKSCREEN_H__
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <app.h>
+#include <app_common.h>
+#include <Elementary.h>
+#include <dlog.h>
+
+#include <ode/internal-encryption.h>
+
+#include "ode-app-widget.h"
+
+void create_lockscreen_view(const char *viewtype);
+
+#endif /* __ODE_LOCKSCREEN_H__ */
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 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.0;
+ #include "./password.edc"
+}
--- /dev/null
+group { "pin-base";
+ images {
+ image: "dot.png" COMP;
+ }
+ parts {
+ rect { "base"; scale;
+ desc { "default";
+ min: 240 148;
+ max: 240 148;
+ color: 0 0 0 0;
+ }
+ }
+ }
+}
+
+group { "pin";
+ images {
+ image: "dot.png" COMP;
+ }
+ inherit: "pin-base";
+ parts {
+ rect { "base"; scale;
+ desc { "default";
+ min: 240 148;
+ max: 240 148;
+ color: 0 0 0 0;
+ }
+ }
+ image { "feedback"; scale;
+ repeat;
+ desc { "default";
+ fixed: 1 1;
+ aspect: 1.0 1.0;
+ min: 128 128;
+ max: 128 128;
+ color: 0 0 0 0;
+ visible: 0;
+ rel1.to: "base";
+ rel2.to: "base";
+ image.normal: "dot.png";
+ }
+ desc { "press";
+ inherit: "default" 0.0;
+ color: 0 0 0 (0.3*255);
+ visible: 1;
+ }
+ desc { "pressed";
+ inherit: "default" 0.0;
+ color: 0 0 0 (0.3*255);
+ min: 256 256;
+ max: 256 256;
+ visible: 1;
+ }
+ }
+ text { "number"; scale;
+ effect: FAR_SOFT_SHADOW;
+ repeat;
+ desc { "default";
+ color: 255 255 255 255;
+ color2: 128 128 128 50;
+ color3: 128 128 128 25;
+ text {
+ size: 72;
+ font: "Sans";
+ align: 0.5 0.5;
+ }
+ }
+ }
+ text { "letter"; scale;
+ effect: FAR_SOFT_SHADOW;
+ repeat;
+ desc { "default";
+ color: 255 255 255 255;
+ color2: 128 128 128 50;
+ color3: 128 128 128 25;
+ text {
+ size: 29;
+ font: "Sans";
+ align: 0.5 1.0;
+ }
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "mouse,down,1";
+ source: "base";
+ action: STATE_SET "press" 0.0;
+ target: "feedback";
+ after: "press,effect";
+ }
+ program {
+ name: "press,effect";
+ action: STATE_SET "pressed" 0.0;
+ target: "feedback";
+ transition: DECEL 0.2;
+ }
+ program {
+ signal: "mouse,up,1";
+ source: "base";
+ action: STATE_SET "default" 0.0;
+ target: "feedback";
+ transition: DECEL 0.2;
+ }
+ program {
+ signal: "mouse,clicked,1";
+ source: "base";
+ in: 0.1 0;
+ action: SIGNAL_EMIT "button,clicked" "keypaditem";
+ }
+ }
+}
+
+group { "clear";
+ images {
+ image: "back_nor.png" COMP;
+ image: "back_press.png" COMP;
+ }
+ parts {
+ rect { "base"; scale;
+ desc { "default";
+ color: 0 0 0 0;
+ }
+ }
+ image { "button"; scale;
+ repeat;
+ desc { "default";
+ align: 0.5 0.5;
+ image.normal: "back_nor.png";
+ }
+ desc { "pressed";
+ image.normal: "back_press.png";
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "mouse,down,1";
+ source: "base";
+ action: STATE_SET "pressed" 0.0;
+ target: "button";
+ }
+ program {
+ signal: "mouse,up,1";
+ source: "base";
+ action: STATE_SET "default" 0.0;
+ target: "button";
+ }
+ program {
+ signal: "mouse,clicked,1";
+ source: "base";
+ action: SIGNAL_EMIT "button,clicked" "keypaditem";
+ }
+ }
+}
+
+group { "simple-password";
+ styles {
+ style { "title_style";
+ base: "font=Tizen:style=Regular color=#FFFFFF font_size=40 wrap=none align=center";
+ }
+ }
+ parts {
+ rect { "bg.base";
+ desc { "default";
+ color: 55 166 184 255;
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ }
+ }
+ rect { "bg";
+ desc { "default";
+ color: 0 0 0 25;
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ }
+ }
+ spacer { "padding.bg.top"; scale;
+ desc { "default";
+ min: 0 199;
+ max: -1 199;
+ align: 0.5 0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 0.0; to: "bg"; offset: 0 38;}
+ rel2 { relative: 1.0 1.0; to: "bg";}
+ }
+ }
+ textblock { "text.title"; scale;
+ effect: FAR_SOFT_SHADOW;
+ desc { "default";
+ min: 0 54;
+ max: -1 54;
+ align: 0.5 0.0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1.0; to: "padding.bg.top";}
+ rel2 { relative: 1.0 1.0; to: "bg";}
+ text { style: "title_style";
+ elipsis: -1.0;
+ }
+ }
+ }
+ spacer { "padding.title.bottom"; scale;
+ desc { "default";
+ min: 0 84;
+ max: -1 84;
+ align: 0.0 0.0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 1.0; to: "text.title";}
+ rel2 { relative: 1.0 1.0; to: "bg";}
+ }
+ }
+ swallow { "entry"; scale;
+ desc { "default";
+ min: 0 96;
+ max: -1 96;
+ fixed: 1 1;
+ align: 0.5 0;
+ rel1 { relative: 0.0 1.0; to: "padding.title.bottom"; offset: 0 9;}
+ rel2 { relative: 1.0 1.0; to: "bg";}
+ }
+ }
+ table { "keypad"; scale;
+ desc { "default";
+ rel1 { relative: 0.0 (1280-134-592)/1280;}
+ rel2 { relative: 1.0 (1280-134)/1280;}
+ }
+ table {
+ #define ITEM(part_name, source_name, x, y) \
+ item { \
+ source: source_name; \
+ name: part_name; \
+ position: x y; \
+ weight: 1.0 1.0; \
+ span: 1 1; \
+ align: -1.0 -1.0; \
+ }
+ items {
+ ITEM("1", "pin", 1, 1);
+ ITEM("2", "pin", 2, 1);
+ ITEM("3", "pin", 3, 1);
+ ITEM("4", "pin", 1, 2);
+ ITEM("5", "pin", 2, 2);
+ ITEM("6", "pin", 3, 2);
+ ITEM("7", "pin", 1, 3);
+ ITEM("8", "pin", 2, 3);
+ ITEM("9", "pin", 3, 3);
+ ITEM("0", "pin", 2, 4);
+ ITEM("clear", "clear", 3, 4);
+ ITEM("accept", "pin-base", 1, 4);
+ }
+ }
+ }
+ spacer { "padding.bottom"; scale;
+ desc { "default";
+ min: 0 134;
+ max: -1 134;
+ align: 0 1.0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 0.0; to: "bg";}
+ rel2 { relative: 1.0 1.0; to: "bg";}
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 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 "ode-lockscreen.h"
+
+int main(int argc, char *argv[])
+{
+ setenv("HOME", "/root", 1);
+
+ if (argc < 2) {
+ fprintf(stderr, "Other arguments is needed\n");
+ return EXIT_FAILURE;
+ }
+
+ int state = ODE_STATE_UNENCRYPTED;
+ ode_internal_encryption_get_state(&state);
+ if (state != ODE_STATE_ENCRYPTED) {
+ return EXIT_SUCCESS;
+ }
+
+ elm_init(argc, argv);
+
+ if (!strncmp(argv[1], "viewtype", sizeof("viewtype"))) {
+ if (argc < 3) {
+ fprintf(stderr, "Other arguments is needed\n");
+ return EXIT_FAILURE;
+ }
+ create_lockscreen_view(argv[2]);
+ }
+
+ elm_run();
+
+ return EXIT_SUCCESS;
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2017 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 "ode-lockscreen.h"
+
+#define PIN_LIMIT_SIZE 4
+#define EDJ_PATH "/usr/apps/org.tizen.ode-lockscreen/res/org.tizen.ode-lockscreen.edj"
+
+static int verify_password(Evas_Object *layout)
+{
+ Evas_Object *entry = (Evas_Object *)elm_object_part_content_get(layout, "entry");
+ const char *key = elm_entry_entry_get(entry);
+ bool result = false;
+
+ ode_internal_encryption_verify_password(key, &result);
+ if (result) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Correct password.");
+ ode_internal_encryption_mount(key);
+ exit(0);
+ } else {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Incorrect password.");
+ elm_object_part_text_set(layout, "text.title", "Incorrect PIN");
+ elm_entry_entry_set(entry, "");
+ }
+
+ return 0;
+}
+
+static void pin_entry_activated_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *layout = (Evas_Object *)data;
+ const char *pin = elm_entry_entry_get(obj);
+ static bool activated;
+
+ if (pin && strlen(pin) == PIN_LIMIT_SIZE) {
+ if (!activated) {
+ verify_password(layout);
+ activated = true;
+ }
+ return;
+ } else if (pin && strlen(pin) == 1) {
+ elm_object_part_text_set(layout, "text.title", "Enter PIN");
+ }
+
+ activated = false;
+ return;
+}
+
+static void key_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ const char *text = edje_object_part_text_get(obj, "number");
+ Evas_Object *layout = (Evas_Object *)data;
+ if (layout) {
+ Evas_Object *entry = elm_object_part_content_get(layout, "entry");
+ elm_entry_entry_insert(entry, text);
+ }
+}
+
+static void backkey_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+ Evas_Object *layout = (Evas_Object *)data;
+ if (layout) {
+ Evas_Object *entry = elm_object_part_content_get(layout, "entry");
+ Evas_Object *entry_text = elm_entry_textblock_get(entry);
+ Evas_Textblock_Cursor *cursor = evas_object_textblock_cursor_get(entry_text);
+ evas_textblock_cursor_char_prev(cursor);
+ evas_textblock_cursor_char_delete(cursor);
+ }
+}
+
+static void set_key_button(Evas_Object *layout, int row, int col, const char *number, const char *text, Edje_Signal_Cb callback)
+{
+ Evas_Object *edje = NULL, *item = NULL;
+
+ edje = elm_layout_edje_get(layout);
+ if (edje == NULL) {
+ return;
+ }
+
+ item = edje_object_part_table_child_get(edje, "keypad", col, row);
+ edje_object_part_text_set(item, "number", number);
+ edje_object_part_text_set(item, "letter", text);
+
+ if (callback) {
+ edje_object_signal_callback_add(item, "button,clicked", "keypaditem", callback, layout);
+ }
+}
+
+static void create_keypad(Evas_Object *parent)
+{
+ set_key_button(parent, 1, 1, "1", NULL, key_clicked_cb);
+ set_key_button(parent, 1, 2, "2", "ABC", key_clicked_cb);
+ set_key_button(parent, 1, 3, "3", "DEF", key_clicked_cb);
+ set_key_button(parent, 2, 1, "4", "GHI", key_clicked_cb);
+ set_key_button(parent, 2, 2, "5", "JKL", key_clicked_cb);
+ set_key_button(parent, 2, 3, "6", "MNO", key_clicked_cb);
+ set_key_button(parent, 3, 1, "7", "PQRS", key_clicked_cb);
+ set_key_button(parent, 3, 2, "8", "TUV", key_clicked_cb);
+ set_key_button(parent, 3, 3, "9", "WXYZ", key_clicked_cb);
+ set_key_button(parent, 4, 3, NULL, NULL, backkey_clicked_cb);
+ set_key_button(parent, 4, 2, "0", NULL, key_clicked_cb);
+ set_key_button(parent, 4, 1, NULL, NULL, NULL);
+
+ return;
+}
+
+static void create_simple_password_view(Evas_Object *parent)
+{
+ Evas_Object *layout = NULL, *entry = NULL;
+ static Elm_Entry_Filter_Limit_Size limit_size = {
+ .max_char_count = PIN_LIMIT_SIZE,
+ .max_byte_count = 0,
+ };
+
+ layout = ode_create_layout(parent, EDJ_PATH, "simple-password");
+ elm_object_part_text_set(layout, "text.title", "Enter PIN");
+
+ entry = elm_entry_add(layout);
+ elm_entry_password_set(entry, EINA_TRUE);
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_size);
+ elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
+ elm_entry_input_panel_hide(entry);
+ elm_entry_editable_set(entry, EINA_FALSE);
+ elm_object_focus_allow_set(entry, EINA_FALSE);
+ evas_object_pass_events_set(entry, EINA_TRUE);
+ elm_object_part_content_set(layout, "entry", entry);
+
+ elm_entry_text_style_user_push(entry, "DEFAULT='font=Sans:style=Regular color=#FFFFFF font_size=220 wrap=none align=center'");
+
+ evas_object_smart_callback_add(entry, "changed", pin_entry_activated_cb, layout);
+ evas_object_show(entry);
+
+ create_keypad(layout);
+
+ elm_object_part_content_set(parent, "elm.swallow.content", layout);
+ return;
+}
+
+void create_lockscreen_view(const char *viewtype)
+{
+ Evas_Object *window = NULL, *conformant = NULL, *layout = NULL;
+
+ window = ode_create_win("ode-lockscreen");
+ elm_win_indicator_opacity_set(window, ELM_WIN_INDICATOR_BG_TRANSPARENT);
+
+ conformant = ode_create_conformant(window);
+ elm_object_signal_emit(conformant, "elm,state,indicator,overlap", "elm");
+
+ layout = ode_create_layout(conformant, NULL, NULL);
+ elm_object_content_set(conformant, layout);
+
+ if (!strcmp(viewtype, "simple-password")) {
+ create_simple_password_view(layout);
+ } else {
+ /* Do not support */
+ dlog_print(DLOG_ERROR, LOG_TAG, "Do not support");
+ }
+
+ evas_object_show(window);
+ return;
+}
--- /dev/null
+[Unit]
+Description=@PROJECT_NAME@
+Before=systemd-user-sessions.service
+After=ac.service boot-animation.service
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System
+ExecStartPre=/bin/sleep 2
+ExecStart=@APP_INSTALL_PREFIX@/@PROJECT_NAME@/bin/@PROJECT_NAME@ viewtype simple-password
+ExecReload=/bin/kill -HUP $MAINPID
+CapabilityBoundingSet=~CAP_MAC_ADMIN
+CapabilityBoundingSet=~CAP_MAC_OVERRIDE
+CapabilityBoundingSet=~CAP_DAC_OVERRIDE
+EnvironmentFile=/run/tizen-system-env
+EnvironmentFile=/run/xdg-root-env
+
+[Install]
+WantedBy=multi-user.target