summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2021-02-18 10:51:57 -0500
committerGitHub <noreply@github.com>2021-02-18 10:51:57 -0500
commit5e161aa7ced5db3b95e204ca36d2ac6f717f3beb (patch)
treea9d02d382d4c64bb1b902d8639f4f66e9b7eb1f3
parent37e40da4913d2f48c0964ac6c86de8e9bc498baa (diff)
downloadsdl_core-5e161aa7ced5db3b95e204ca36d2ac6f717f3beb.tar.gz
Add default value for maskInputCharacters to ResetGlobalProperties (#3635)
* Add `DISABLE_INPUT_KEY_MASK` to UI ResetGlobalProperties * Fix caching for keyboard properties
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc41
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc17
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc1
5 files changed, 61 insertions, 6 deletions
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 0b5217e918..5572dfd55d 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -594,6 +594,7 @@ extern const char* method_name;
extern const char* keyboard_layout;
extern const char* limited_character_list;
extern const char* auto_complete_list;
+extern const char* mask_input_characters;
extern const char* custom_keys;
extern const char* file;
extern const char* file_name;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
index 315fbee4eb..bbce4d2bb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
@@ -692,6 +692,13 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
cached_keyboard_props[hmi_request::auto_complete_list] =
(*saved_keyboard_props)[hmi_request::auto_complete_list];
}
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_request::mask_input_characters) &&
+ saved_keyboard_props->keyExists(hmi_request::mask_input_characters)) {
+ cached_keyboard_props[hmi_request::mask_input_characters] =
+ (*saved_keyboard_props)[hmi_request::mask_input_characters];
+ }
app->set_keyboard_props(cached_keyboard_props);
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
index e7e155ec48..4272005fba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
@@ -1523,6 +1523,47 @@ TEST_F(SetGlobalPropertiesRequestTest,
}
TEST_F(SetGlobalPropertiesRequestTest,
+ Run_RequestContainsMaskInputCharactersParam_KeyboardPropsCachedAsIs) {
+ MessageSharedPtr msg = CreateMsgParams();
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ keyboard_properties[am::hmi_request::mask_input_characters] =
+ hmi_apis::Common_KeyboardInputMask::ENABLE_INPUT_KEY_MASK;
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_NoMaskInputCharactersInRequestButPresentInSaved_SavedParamCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::mask_input_characters] =
+ hmi_apis::Common_KeyboardInputMask::USER_CHOICE_INPUT_KEY_MASK;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto cached_keyboard_props =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ cached_keyboard_props[am::hmi_request::mask_input_characters] =
+ hmi_apis::Common_KeyboardInputMask::USER_CHOICE_INPUT_KEY_MASK;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
Run_NoAutocompleteListInRequestButPresentInSaved_SavedArrayCachedAgain) {
MessageSharedPtr msg = CreateMsgParams();
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 52a4afa974..02edf75646 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -396,18 +396,23 @@ MessageHelper::CreateUIResetGlobalPropertiesRequest(
}
if (reset_result.keyboard_properties) {
- smart_objects::SmartObject key_board_properties =
+ smart_objects::SmartObject keyboard_properties =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- key_board_properties[strings::language] =
+ keyboard_properties[strings::language] =
static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
- key_board_properties[hmi_request::keyboard_layout] =
+ keyboard_properties[hmi_request::keyboard_layout] =
static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
- key_board_properties[hmi_request::auto_complete_list] =
+ keyboard_properties[hmi_request::auto_complete_list] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ keyboard_properties[strings::auto_complete_text] = "";
+ keyboard_properties[hmi_request::mask_input_characters] =
+ static_cast<int32_t>(
+ hmi_apis::Common_KeyboardInputMask::DISABLE_INPUT_KEY_MASK);
- key_board_properties[strings::auto_complete_text] = "";
(*ui_reset_global_prop_request)[hmi_request::keyboard_properties] =
- key_board_properties;
+ keyboard_properties;
+ application->set_keyboard_props(
+ smart_objects::SmartObject(smart_objects::SmartType_Map));
}
(*ui_reset_global_prop_request)[strings::app_id] = application->app_id();
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 5ee74c376d..a680653d6c 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -552,6 +552,7 @@ const char* method_name = "methodName";
const char* keyboard_layout = "keyboardLayout";
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_list = "autoCompleteList";
+const char* mask_input_characters = "maskInputCharacters";
const char* custom_keys = "customKeys";
const char* file = "file";
const char* file_name = "fileName";