Add Internal Password popup to ode-app for temporary 07/114207/5
authoryeji01kim <yeji01.kim@samsung.com>
Fri, 10 Feb 2017 10:20:28 +0000 (19:20 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 13 Feb 2017 10:51:55 +0000 (19:51 +0900)
Change-Id: I7672f97bc41e0708682060be30f987b3cfc41900
Signed-off-by: yeji01kim <yeji01.kim@samsung.com>
tools/apps/ode/include/ode-app.h
tools/apps/ode/include/ode-password.h [changed mode: 0644->0755]
tools/apps/ode/src/ode-app-confirm.c
tools/apps/ode/src/password/confirm-popup.c [changed mode: 0644->0755]
tools/apps/ode/src/password/entry-popup.c [changed mode: 0644->0755]
tools/apps/ode/src/password/password.c [changed mode: 0644->0755]

index 01e0d78..779bd7c 100755 (executable)
@@ -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;
old mode 100644 (file)
new mode 100755 (executable)
index 9cfb7d7..7cf9b37
@@ -34,6 +34,8 @@ enum {
        CHANGE_PASSWORD,
        DELETE_PASSWORD,
        INSERT_SD_CARD,
+       INTERNAL_ENCRYPT_PASSWORD,
+       INTERNAL_DECRYPT_PASSWORD,
 };
 
 typedef struct {
index 091c332..f53ce26 100755 (executable)
@@ -17,6 +17,7 @@
  */
 
 #include "ode-app.h"
+#include "ode-password.h"
 #include <ode/external-encryption.h>
 #include <ode/internal-encryption.h>
 
@@ -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");
old mode 100644 (file)
new mode 100755 (executable)
index 5ca26b6..a40a362
@@ -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");
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index abe5ade..38f19db
@@ -17,6 +17,7 @@
  */
 
 #include <ode/external-encryption.h>
+#include <ode/internal-encryption.h>
 #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;
        }