#include <inputmethod_internal.h>
#include <app_control.h>
#include <app_preference.h>
+#include <ode/internal-encryption.h>
#ifdef HAVE_CBHM
#include <cbhm.h>
#endif
set_ime_size(g_floating_mode, ISE_CANDIDATE_REQ_NONE);
}
+static void register_preference_changed_callback(void)
+{
+ if (preference_set_changed_cb(ISE_CONFIG_KEYPAD_MODE, ise_keypad_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_keypad_mode_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_ENABLED_LANGUAGES, ise_enabled_languages_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_enabled_languages_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_SELECTED_LANGUAGE, ise_selected_language_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_selected_language_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_AUTO_CAPITALISE, ise_autocapital_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_autocapital_mode_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_AUTO_PUNCTUATE, ise_autopunctuate_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_autopunctuate_mode_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_SOUND_ON, ise_sound_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_sound_mode_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_VIBRATION_ON, ise_vibration_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_vibration_mode_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_PREVIEW_ON, ise_character_preview_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_character_preview_mode_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_SETTING, ise_setting_guide_popup_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_setting_guide_popup_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_LANGUAGE_CHANGE, ise_language_guide_popup_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_language_guide_popup_changed_cb()");
+
+ if (preference_set_changed_cb(ISE_CONFIG_FLOATING_MODE, ise_floating_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
+ LOGW("Failed to set ise_floating_mode_changed_cb()");
+}
+
+static void ise_mount_changed_cb(void *user_data)
+{
+ register_preference_changed_callback();
+}
+
void
ise_create()
{
if (!exist)
write_ise_config_values();
- if (preference_set_changed_cb(ISE_CONFIG_KEYPAD_MODE, ise_keypad_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_keypad_mode_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_ENABLED_LANGUAGES, ise_enabled_languages_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_enabled_languages_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_SELECTED_LANGUAGE, ise_selected_language_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_selected_language_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_AUTO_CAPITALISE, ise_autocapital_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_autocapital_mode_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_AUTO_PUNCTUATE, ise_autopunctuate_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_autopunctuate_mode_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_SOUND_ON, ise_sound_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_sound_mode_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_VIBRATION_ON, ise_vibration_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_vibration_mode_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_PREVIEW_ON, ise_character_preview_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_character_preview_mode_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_SETTING, ise_setting_guide_popup_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_setting_guide_popup_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_LANGUAGE_CHANGE, ise_language_guide_popup_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_language_guide_popup_changed_cb()");
- if (preference_set_changed_cb(ISE_CONFIG_FLOATING_MODE, ise_floating_mode_changed_cb, NULL) != PREFERENCE_ERROR_NONE)
- LOGW("Faild to set ise_floating_mode_changed_cb()");
+ int state;
+ if (ode_internal_encryption_get_state(&state) == ODE_ERROR_NONE) {
+ if (state == ODE_STATE_ENCRYPTED) {
+ if (ode_internal_encryption_set_mount_event_cb(ise_mount_changed_cb, NULL) != ODE_ERROR_NONE)
+ LOGW("Failed to set mount_event_cb()");
+ } else if (state == ODE_STATE_UNENCRYPTED) {
+ register_preference_changed_callback();
+ }
+ } else {
+ LOGW("Failed to get encryption_state");
+ }
}
init_recent_used_punctuation();
}