From: yeji01kim Date: Wed, 15 Jun 2016 02:21:29 +0000 (+0900) Subject: Apply device encryption sequence X-Git-Tag: submit/tizen/20160618.062648~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdf30a6968503ca866d4d119dbdbcd46390fb010;p=platform%2Fcore%2Fsecurity%2Fdevice-policy-manager.git Apply device encryption sequence This commit does not perform actual device encryption. Product should provide encryption backend to complete the operation Change-Id: I2dcbab861dba817960013dcef26c413ca5de40f2 Signed-off-by: yeji01kim --- diff --git a/libs/security.cpp b/libs/security.cpp index a5d4889..1dc8722 100644 --- a/libs/security.cpp +++ b/libs/security.cpp @@ -64,7 +64,7 @@ int SecurityPolicy::powerOffDevice() } } -int SecurityPolicy::setInternalStorageEncryption(const bool encrypt) +int SecurityPolicy::setInternalStorageEncryption(bool encrypt) { try { return context->methodCall("SecurityPolicy::setInternalStorageEncryption", encrypt); @@ -73,16 +73,16 @@ int SecurityPolicy::setInternalStorageEncryption(const bool encrypt) } } -bool SecurityPolicy::isInternalStorageEncrypted() +int SecurityPolicy::isInternalStorageEncrypted() { try { - return context->methodCall("SecurityPolicy::isInternalStorageEncrypted"); + return context->methodCall("SecurityPolicy::isInternalStorageEncrypted"); } catch (runtime::Exception& e) { - return false; + return -1; } } -int SecurityPolicy::setExternalStorageEncryption(const bool encrypt) +int SecurityPolicy::setExternalStorageEncryption(bool encrypt) { try { return context->methodCall("SecurityPolicy::setExternalStorageEncryption", encrypt); @@ -91,12 +91,12 @@ int SecurityPolicy::setExternalStorageEncryption(const bool encrypt) } } -bool SecurityPolicy::isExternalStorageEncrypted() +int SecurityPolicy::isExternalStorageEncrypted() { try { - return context->methodCall("SecurityPolicy::isExternalStorageEncrypted"); + return context->methodCall("SecurityPolicy::isExternalStorageEncrypted"); } catch (runtime::Exception& e) { - return false; + return -1; } } diff --git a/policy/security.hxx b/policy/security.hxx index 39b3418..db8ce1f 100644 --- a/policy/security.hxx +++ b/policy/security.hxx @@ -37,10 +37,10 @@ public: int wipeData(const int id); int reboot(); int powerOffDevice(); - int setInternalStorageEncryption(const bool encrypt); - bool isInternalStorageEncrypted(); - int setExternalStorageEncryption(const bool encrypt); - bool isExternalStorageEncrypted(); + int setInternalStorageEncryption(bool encrypt); + int isInternalStorageEncrypted(); + int setExternalStorageEncryption(bool encrypt); + int isExternalStorageEncrypted(); std::vector getFileNamesOnDevice(const std::string& path); std::vector getFileNamesWithAttributes(const std::string& path); diff --git a/server/data/PolicyManifest.xml b/server/data/PolicyManifest.xml index 04e7e4f..4a136b0 100644 --- a/server/data/PolicyManifest.xml +++ b/server/data/PolicyManifest.xml @@ -23,11 +23,9 @@ \n - allowed - allowed + + allowed - allowed - allowed allowed diff --git a/server/security.cpp b/server/security.cpp old mode 100644 new mode 100755 index 919174f..fefb117 --- a/server/security.cpp +++ b/server/security.cpp @@ -53,8 +53,8 @@ SecurityPolicy::SecurityPolicy(PolicyControlContext& ctxt) : ctxt.registerNonparametricMethod(this, (int)(SecurityPolicy::lockoutScreen)); ctxt.registerNonparametricMethod(this, (int)(SecurityPolicy::reboot)); ctxt.registerNonparametricMethod(this, (int)(SecurityPolicy::powerOffDevice)); - ctxt.registerNonparametricMethod(this, (bool)(SecurityPolicy::isInternalStorageEncrypted)); - ctxt.registerNonparametricMethod(this, (bool)(SecurityPolicy::isExternalStorageEncrypted)); + ctxt.registerNonparametricMethod(this, (int)(SecurityPolicy::isInternalStorageEncrypted)); + ctxt.registerNonparametricMethod(this, (int)(SecurityPolicy::isExternalStorageEncrypted)); ctxt.registerParametricMethod(this, (int)(SecurityPolicy::setInternalStorageEncryption)(bool)); ctxt.registerParametricMethod(this, (int)(SecurityPolicy::setExternalStorageEncryption)(bool)); ctxt.registerParametricMethod(this, (std::vector)(SecurityPolicy::getFileNamesOnDevice)(std::string)); @@ -110,11 +110,18 @@ int SecurityPolicy::powerOffDevice() return ret; } -int SecurityPolicy::setInternalStorageEncryption(const bool encrypt) +int SecurityPolicy::setInternalStorageEncryption(bool encrypt) { + std::string policy = context.getPolicy("internal-storage-encryption"); + if ((encrypt == true) && (policy == "encrypted")) { + return 0; + } else if ((encrypt == false) && (policy == "decrypted")) { + return 0; + } + try { Bundle bundle; - bundle.add("viewtype", encrypt ? "encryption" : "decryption"); + bundle.add("viewtype", encrypt ? "ENCRYPT_DEVICE" : "DECRYPT_DEVICE"); Launchpad launchpad(context.getPeerUid()); launchpad.launch(APPID_DEVICE_ENCRYPTION, bundle); @@ -126,50 +133,46 @@ int SecurityPolicy::setInternalStorageEncryption(const bool encrypt) return 0; } -bool SecurityPolicy::isInternalStorageEncrypted() +int SecurityPolicy::isInternalStorageEncrypted() { - INFO("Not implemented yet"); + std::string policy = context.getPolicy("internal-storage-encryption"); + if (policy == "encrypted") { + return true; + } + return false; } -int SecurityPolicy::setExternalStorageEncryption(const bool encrypt) +int SecurityPolicy::setExternalStorageEncryption(bool encrypt) { - int status; - - if (::vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &status) != 0) { - ERROR("Failed to read VCONFKEY_SYSMAN_MMC_STATUS"); - return -1; - } - - if (status != VCONFKEY_SYSMAN_MMC_MOUNTED) { - WARN("MMC was not mounted"); - return -1; - } - - int wasEncrypted; - if (::vconf_get_bool(VCONFKEY_SETAPPL_MMC_ENCRYPTION_STATUS_BOOL, &wasEncrypted) != 0) { - ERROR("Failed to read VCONFKEY_SETAPPL_MMC_ENCRYPTION_STATUS_BOOL"); - return -1; + std::string policy = context.getPolicy("external-storage-encryption"); + if ((encrypt == true) && (policy == "encrypted")) { + return 0; + } else if ((encrypt == false) && (policy == "decrypted")) { + return 0; } try { Bundle bundle; - bundle.add("_SYSPOPUP_CONTENT_", encrypt ? "odeencrypt" : "odedecrypt"); + bundle.add("viewtype", encrypt ? "ENCRYPT_SD_CARD" : "DECRYPT_SD_CARD"); - Syspopup syspopup("mmc-syspopup"); - if (syspopup.launch(bundle) < 0) { - ERROR("Failed to launch mmc-syspopup"); - return -1; - } + Launchpad launchpad(context.getPeerUid()); + launchpad.launch(APPID_DEVICE_ENCRYPTION, bundle); } catch (runtime::Exception& e) { + ERROR("Failed to start sd card encryption"); return -1; } return 0; } -bool SecurityPolicy::isExternalStorageEncrypted() +int SecurityPolicy::isExternalStorageEncrypted() { + std::string policy = context.getPolicy("external-storage-encryption"); + if (policy == "encrypted") { + return true; + } + return false; } diff --git a/server/server.cpp b/server/server.cpp index 9b3036c..6dd3744 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -65,7 +65,10 @@ int Server::updatePolicy(const std::string& name, const std::string& value, std::string old = policy.getContent(); policy.setContent(value); if (old != value) { - service->notify(event, info); + if (event != "") { + service->notify(event, info); + } + policyStorage->flush(); } } catch (runtime::Exception& e) { diff --git a/tools/ode/include/ode-app.h b/tools/ode/include/ode-app.h index 7368aea..3a74744 100755 --- a/tools/ode/include/ode-app.h +++ b/tools/ode/include/ode-app.h @@ -69,7 +69,7 @@ typedef enum { DECRYPT_SD_CARD, } dpm_encryption_viewtype; -typedef struct odedata { +typedef struct appdata { Evas_Object *win; Evas_Object *conform; Evas_Object *nf; @@ -83,8 +83,6 @@ typedef struct odedata { int view_type; } appdata_s; -appdata_s global_ad; - #define MSG_TEXT_STYLE "DEFAULT='font=Tizen:style=Regular font_size=30 color=#000000 wrap=mixed align=left'" #define NEEDED_BATTERY_PERCENT 80 diff --git a/tools/ode/res/edc_resource/encryption_device.edc b/tools/ode/res/edc_resource/encryption_device.edc index b7d4dde..56f9605 100755 --- a/tools/ode/res/edc_resource/encryption_device.edc +++ b/tools/ode/res/edc_resource/encryption_device.edc @@ -221,8 +221,8 @@ group { name: "sdcard_pw_button_layout"; group { name: "Encrypt_device_layout"; images { - image: "../images/icon.png" COMP; - image: "../images/warning.png" COMP; + image: "../images/icon_encrypt_check.png" COMP; + image: "../images/icon_encrypt_bar.png" COMP; } parts { part { name: "base"; @@ -271,7 +271,7 @@ group { name: "Encrypt_device_layout"; scale: 1; description { state: "default" 0.0; rel1 { relative: 0.0 1.0; to: "top_padding"; } - rel2 { relative: 0.0 1.0; to: "top_padding"; offset: 100 100;} + rel2 { relative: 0.0 1.0; to: "top_padding"; offset: 100 100; } } } part { name: "battery_icon"; @@ -282,11 +282,13 @@ group { name: "Encrypt_device_layout"; rel2 { relative: 1.0 1.0; to: "battery_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -301,7 +303,7 @@ group { name: "Encrypt_device_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.3; to: "battery_icon_base"; offset: 15 0;} + rel1 { relative: 1.0 0.3; to: "battery_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "battery_icon_base";} align: 0.0 0.5; } @@ -310,8 +312,8 @@ group { name: "Encrypt_device_layout"; type: SPACER; scale: 1; description { state: "default" 0.0; - rel1 { relative: 0.0 1.0; to: "battery_icon_base"; offset: 0 15; } - rel2 { relative: 1.0 1.0; to: "battery_icon_base"; offset: 0 115; } + rel1 { relative: 0.0 1.0; to: "battery_icon_base"; } + rel2 { relative: 1.0 1.0; to: "battery_icon_base"; offset: 0 100; } } } part { name: "charge_icon"; @@ -322,11 +324,13 @@ group { name: "Encrypt_device_layout"; rel2 { relative: 1.0 1.0; to: "charge_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -341,7 +345,7 @@ group { name: "Encrypt_device_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.3; to: "charge_icon_base"; offset: 15 0;} + rel1 { relative: 1.0 0.3; to: "charge_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "charge_icon_base";} } } @@ -349,8 +353,8 @@ group { name: "Encrypt_device_layout"; type: SPACER; scale: 1; description { state: "default" 0.0; - rel1 { relative: 0.0 1.0; to: "charge_icon_base"; offset: 0 15; } - rel2 { relative: 1.0 1.0; to: "charge_icon_base"; offset: 0 115; } + rel1 { relative: 0.0 1.0; to: "charge_icon_base"; } + rel2 { relative: 1.0 1.0; to: "charge_icon_base"; offset: 0 100; } } } part { name: "locktype_icon"; @@ -361,11 +365,13 @@ group { name: "Encrypt_device_layout"; rel2 { relative: 1.0 1.0; to: "locktype_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -380,7 +386,7 @@ group { name: "Encrypt_device_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.0; to: "locktype_icon_base"; offset: 15 0;} + rel1 { relative: 1.0 0.2; to: "locktype_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "locktype_icon_base";} align: 0.0 0.5; } @@ -472,8 +478,8 @@ group { name: "Encrypt_device_layout"; group { name: "Decrypt_device_layout"; images { - image: "../images/icon.png" COMP; - image: "../images/warning.png" COMP; + image: "../images/icon_encrypt_check.png" COMP; + image: "../images/icon_encrypt_bar.png" COMP; } parts { part { name: "base"; @@ -533,11 +539,13 @@ group { name: "Decrypt_device_layout"; rel2 { relative: 1.0 1.0; to: "battery_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -552,7 +560,7 @@ group { name: "Decrypt_device_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.3; to: "battery_icon_base"; offset: 15 0;} + rel1 { relative: 1.0 0.3; to: "battery_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "battery_icon_base";} align: 0.0 1.0; } @@ -561,8 +569,8 @@ group { name: "Decrypt_device_layout"; type: SPACER; scale: 1; description { state: "default" 0.0; - rel1 { relative: 0.0 1.0; to: "battery_icon_base"; offset: 0 15; } - rel2 { relative: 1.0 1.0; to: "battery_icon_base"; offset: 0 115; } + rel1 { relative: 0.0 1.0; to: "battery_icon_base"; } + rel2 { relative: 1.0 1.0; to: "battery_icon_base"; offset: 0 100; } } } part { name: "charge_icon"; @@ -573,11 +581,13 @@ group { name: "Decrypt_device_layout"; rel2 { relative: 1.0 1.0; to: "charge_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -592,7 +602,7 @@ group { name: "Decrypt_device_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.3; to: "charge_icon_base"; offset: 15 0;} + rel1 { relative: 1.0 0.3; to: "charge_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "charge_icon_base"; } align: 0.0 1.0; } @@ -652,8 +662,8 @@ group { name: "Decrypt_device_layout"; group { name: "Encrypt_sd_card_layout"; images { - image: "../images/icon.png" COMP; - image: "../images/warning.png" COMP; + image: "../images/icon_encrypt_check.png" COMP; + image: "../images/icon_encrypt_bar.png" COMP; } parts { part { name: "base"; @@ -721,11 +731,13 @@ group { name: "Encrypt_sd_card_layout"; rel2 { relative: 1.0 1.0; to: "sd_card_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -740,7 +752,7 @@ group { name: "Encrypt_sd_card_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.3; to: "sd_card_icon_base"; offset: 15 0; } + rel1 { relative: 1.0 0.3; to: "sd_card_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "sd_card_icon_base"; } align: 0.0 0.5; } @@ -749,8 +761,8 @@ group { name: "Encrypt_sd_card_layout"; type: SPACER; scale: 1; description { state: "default" 0.0; - rel1 { relative: 0.0 1.0; to: "sd_card_icon_base"; offset: 0 15; } - rel2 { relative: 1.0 1.0; to: "sd_card_icon_base"; offset: 0 115; } + rel1 { relative: 0.0 1.0; to: "sd_card_icon_base"; } + rel2 { relative: 1.0 1.0; to: "sd_card_icon_base"; offset: 0 100; } } } part { name: "sd_card_pw_icon"; @@ -761,12 +773,14 @@ group { name: "Encrypt_sd_card_layout"; rel2 { relative: 1.0 1.0; to: "sd_card_pw_icon_base"; } align: 0.5 0.5; max: 95 95; - image.normal: "../images/icon.png"; + image.normal: "../images/icon_encrypt_check.png"; + color: 153 153 153 255; visible: 0; } description { state: "default_warning" 0.0; inherit: "default" 0.0; - image.normal: "../images/warning.png"; + image.normal: "../images/icon_encrypt_bar.png"; + color: 0 0 0 255; } description { state: "default_hidden" 0.0; inherit: "default" 0.0; @@ -781,7 +795,7 @@ group { name: "Encrypt_sd_card_layout"; type: SWALLOW; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 0.3; to: "sd_card_pw_icon_base"; offset: 15 0; } + rel1 { relative: 1.0 0.3; to: "sd_card_pw_icon_base"; } rel2 { relative: 1.0 1.0; to_x: "top_padding"; to_y: "sd_card_pw_icon_base"; } align: 0.0 0.5; } @@ -850,8 +864,8 @@ group { name: "Encrypt_sd_card_layout"; group { name: "Decrypt_sd_card_layout"; images { - image: "../images/icon.png" COMP; - image: "../images/warning.png" COMP; + image: "../images/icon_encrypt_check.png" COMP; + image: "../images/icon_encrypt_bar.png" COMP; } parts { part { name: "base"; diff --git a/tools/ode/res/images/icon.png b/tools/ode/res/images/icon.png deleted file mode 100755 index 4939953..0000000 Binary files a/tools/ode/res/images/icon.png and /dev/null differ diff --git a/tools/ode/res/images/icon_encrypt_bar.png b/tools/ode/res/images/icon_encrypt_bar.png new file mode 100755 index 0000000..3d47caa Binary files /dev/null and b/tools/ode/res/images/icon_encrypt_bar.png differ diff --git a/tools/ode/res/images/icon_encrypt_check.png b/tools/ode/res/images/icon_encrypt_check.png new file mode 100755 index 0000000..a944ea1 Binary files /dev/null and b/tools/ode/res/images/icon_encrypt_check.png differ diff --git a/tools/ode/res/images/warning.png b/tools/ode/res/images/warning.png deleted file mode 100755 index 435b065..0000000 Binary files a/tools/ode/res/images/warning.png and /dev/null differ diff --git a/tools/ode/src/ode-app-confirm.c b/tools/ode/src/ode-app-confirm.c index 03116ab..abee81f 100755 --- a/tools/ode/src/ode-app-confirm.c +++ b/tools/ode/src/ode-app-confirm.c @@ -37,6 +37,8 @@ static void _confirm_btn_clicked_cb(void* data, Evas_Object* obj, void* event_in dlog_print(DLOG_DEBUG, LOG_TAG, "decrypt sd card confrim"); break; } + + ui_app_exit(); } static void set_confirm_next_btn_layout(Evas_Object* layout, appdata_s* ad, const char* btn_text) diff --git a/tools/ode/src/ode-app-main.c b/tools/ode/src/ode-app-main.c index 82b70c0..175793b 100755 --- a/tools/ode/src/ode-app-main.c +++ b/tools/ode/src/ode-app-main.c @@ -28,26 +28,20 @@ static void update_next_button_status(appdata_s* ad) if (ad->view_type == ENCRYPT_DEVICE) { if (ad->device_info.battery_status && ad->device_info.charger_status && ad->device_info.locktype_status) { - /* available next button */ elm_object_disabled_set(ad->device_info.next_button, EINA_FALSE); } else { - /* disabled next button */ elm_object_disabled_set(ad->device_info.next_button, EINA_TRUE); } } else if (ad->view_type == DECRYPT_DEVICE) { if (ad->device_info.battery_status && ad->device_info.charger_status) { - /* available next button */ elm_object_disabled_set(ad->device_info.next_button, EINA_FALSE); } else { - /* disabled next button */ elm_object_disabled_set(ad->device_info.next_button, EINA_TRUE); } } else if (ad->view_type == ENCRYPT_SD_CARD) { if (ad->device_info.sdcard_status) { - /* available next button */ elm_object_disabled_set(ad->device_info.next_button, EINA_FALSE); } else { - /* disabled next button */ elm_object_disabled_set(ad->device_info.next_button, EINA_TRUE); } } diff --git a/tools/ode/src/ode-app.c b/tools/ode/src/ode-app.c index 7c39339..e8b526f 100755 --- a/tools/ode/src/ode-app.c +++ b/tools/ode/src/ode-app.c @@ -83,12 +83,6 @@ static int create_base_gui(appdata_s* ad) ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); elm_win_conformant_set(ad->win, EINA_TRUE); elm_win_autodel_set(ad->win, EINA_TRUE); - - if (elm_win_wm_rotation_supported_get(ad->win)) { - int rots[4] = { 0, 90, 180, 270 }; - elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); - } - evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); /* Conformant */ @@ -118,7 +112,7 @@ static bool app_create(void* data) static void app_control(app_control_h app_control, void* data) { /* Handle the launch request. */ - appdata_s* ad = &global_ad; + appdata_s* ad = (appdata_s*)data; int ret; char *viewtype = NULL; @@ -215,6 +209,7 @@ static void ui_app_low_memory(app_event_info_h event_info, void* user_data) int main(int argc, char* argv[]) { + appdata_s ad = {0, }; int ret = 0; ui_app_lifecycle_callback_s event_callback = { 0, }; @@ -226,14 +221,14 @@ int main(int argc, char* argv[]) event_callback.resume = app_resume; event_callback.app_control = app_control; - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &global_ad); - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &global_ad); - ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &global_ad); - ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &global_ad); - ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &global_ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]); - ret = ui_app_main(argc, argv, &event_callback, &global_ad); + ret = ui_app_main(argc, argv, &event_callback, &ad); if (ret != APP_ERROR_NONE) dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main is failed. err = %d", ret); return ret;