From ccd5c6695cc6220e05b368372c5ad011c02bd70b Mon Sep 17 00:00:00 2001 From: yeji01kim Date: Fri, 10 Feb 2017 19:20:28 +0900 Subject: [PATCH] Add Internal Password popup to ode-app for temporary Change-Id: I7672f97bc41e0708682060be30f987b3cfc41900 Signed-off-by: yeji01kim --- tools/apps/ode/include/ode-app.h | 2 ++ tools/apps/ode/include/ode-password.h | 2 ++ tools/apps/ode/src/ode-app-confirm.c | 26 ++++++++++++++++---------- tools/apps/ode/src/password/confirm-popup.c | 8 ++++++++ tools/apps/ode/src/password/entry-popup.c | 0 tools/apps/ode/src/password/password.c | 22 ++++++++++++++++++++++ 6 files changed, 50 insertions(+), 10 deletions(-) mode change 100644 => 100755 tools/apps/ode/include/ode-password.h mode change 100644 => 100755 tools/apps/ode/src/password/confirm-popup.c mode change 100644 => 100755 tools/apps/ode/src/password/entry-popup.c mode change 100644 => 100755 tools/apps/ode/src/password/password.c diff --git a/tools/apps/ode/include/ode-app.h b/tools/apps/ode/include/ode-app.h index 01e0d78..779bd7c 100755 --- a/tools/apps/ode/include/ode-app.h +++ b/tools/apps/ode/include/ode-app.h @@ -56,6 +56,8 @@ typedef struct dpm_encryption_info { int sdcard_status; int sdcard_pw_status; + int device_option; + char* sdcard_pw; Evas_Object *next_button; } dpm_encryption_info_s; diff --git a/tools/apps/ode/include/ode-password.h b/tools/apps/ode/include/ode-password.h old mode 100644 new mode 100755 index 9cfb7d7..7cf9b37 --- a/tools/apps/ode/include/ode-password.h +++ b/tools/apps/ode/include/ode-password.h @@ -34,6 +34,8 @@ enum { CHANGE_PASSWORD, DELETE_PASSWORD, INSERT_SD_CARD, + INTERNAL_ENCRYPT_PASSWORD, + INTERNAL_DECRYPT_PASSWORD, }; typedef struct { diff --git a/tools/apps/ode/src/ode-app-confirm.c b/tools/apps/ode/src/ode-app-confirm.c index 091c332..f53ce26 100755 --- a/tools/apps/ode/src/ode-app-confirm.c +++ b/tools/apps/ode/src/ode-app-confirm.c @@ -17,6 +17,7 @@ */ #include "ode-app.h" +#include "ode-password.h" #include #include @@ -28,8 +29,10 @@ char *confirm_button_text[] = { extern char *encrypt_header_text[]; static int sdcard_option_selected = 0; static int device_full_encryption_state = 0; +popup_data_s popup_data; /* for temporary */ #define sdcard_option_num 2 + static void _confirm_next_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) { int ret = 0; @@ -39,19 +42,22 @@ static void _confirm_next_btn_clicked_cb(void *data, Evas_Object *obj, void *eve switch (ad->view_type) { case ENCRYPT_DEVICE: dlog_print(DLOG_DEBUG, LOG_TAG, "encrypt device confirm"); - ret = ode_internal_encryption_encrypt("tizen", 0); - if (ret != 0) { - dlog_print(DLOG_DEBUG, LOG_TAG, "internal encryption failed"); - } - ui_app_exit(); + if (device_full_encryption_state == 0) + ad->device_info.device_option = 0; + else + ad->device_info.device_option = 1; + popup_data.parent = ad->base; + popup_data.popup = NULL; + popup_data.mode = INTERNAL_ENCRYPT_PASSWORD; + popup_data.callback_data = ad; + create_confirm_password_popup(&popup_data); break; case DECRYPT_DEVICE: dlog_print(DLOG_DEBUG, LOG_TAG, "decrypt device confirm"); - ret = ode_internal_encryption_decrypt("tizen"); - if (ret != 0) { - dlog_print(DLOG_DEBUG, LOG_TAG, "internal decryption failed"); - } - ui_app_exit(); + popup_data.parent = ad->base; + popup_data.popup = NULL; + popup_data.mode = INTERNAL_DECRYPT_PASSWORD; + create_confirm_password_popup(&popup_data); break; case ENCRYPT_SD_CARD: dlog_print(DLOG_DEBUG, LOG_TAG, "encrypt sd card confrim"); diff --git a/tools/apps/ode/src/password/confirm-popup.c b/tools/apps/ode/src/password/confirm-popup.c old mode 100644 new mode 100755 index 5ca26b6..a40a362 --- a/tools/apps/ode/src/password/confirm-popup.c +++ b/tools/apps/ode/src/password/confirm-popup.c @@ -120,6 +120,14 @@ static void confirm_password_popup_confirm_cb(void *data, Evas_Object *obj, void bool result = 0; popup_data_s *popup_data = (popup_data_s *)data; + /* for temporary start */ + if (popup_data->mode == INTERNAL_ENCRYPT_PASSWORD || popup_data->mode == INTERNAL_DECRYPT_PASSWORD) { + snprintf(popup_data->entry_data, PATH_MAX, "%s", elm_entry_entry_get(confirm_entry)); + evas_object_del(popup_data->popup); + password_result_callback(popup_data, "success"); + return; + } + /* for temporary end */ ret = ode_external_encryption_verify_password(elm_entry_entry_get(confirm_entry), &result); if (ret != ODE_ERROR_NONE) { dlog_print(DLOG_ERROR, LOG_TAG, "failed to verify password"); diff --git a/tools/apps/ode/src/password/entry-popup.c b/tools/apps/ode/src/password/entry-popup.c old mode 100644 new mode 100755 diff --git a/tools/apps/ode/src/password/password.c b/tools/apps/ode/src/password/password.c old mode 100644 new mode 100755 index abe5ade..38f19db --- a/tools/apps/ode/src/password/password.c +++ b/tools/apps/ode/src/password/password.c @@ -17,6 +17,7 @@ */ #include +#include #include "ode-password.h" static popup_data_s popup_data = {0,}; @@ -107,6 +108,27 @@ void password_result_callback(popup_data_s *data, const char *result) return; } break; + /* for temporary start */ + case INTERNAL_ENCRYPT_PASSWORD: + ret = ode_internal_encryption_init_password(data->entry_data); + if (ret != ODE_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "failed to create internal data"); + return; + } + ret = ode_internal_encryption_encrypt(data->entry_data, ad->device_info.device_option); + if (ret != 0) { + dlog_print(DLOG_DEBUG, LOG_TAG, "failed to encrypt internal storage"); + return; + } + break; + case INTERNAL_DECRYPT_PASSWORD: + ret = ode_internal_encryption_decrypt(data->entry_data); + if (ret != 0) { + dlog_print(DLOG_DEBUG, LOG_TAG, "failed to decrypt internal storage"); + return; + } + break; + /* for temporary end */ default: break; } -- 2.7.4