summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYana Chernysheva (GitHub) <59469418+ychernysheva@users.noreply.github.com>2021-02-12 15:51:05 +0200
committerGitHub <noreply@github.com>2021-02-12 08:51:05 -0500
commitd9e1e336459d29870fdd22cd63e31307c2bbc563 (patch)
treedb1fd03b255bf8bbd9b90b989338a42cf7f942d4
parentef607e4d41e8030826dce02481347b85eb5af20e (diff)
downloadsdl_core-d9e1e336459d29870fdd22cd63e31307c2bbc563.tar.gz
[SDL 0238] Feature Keyboard Enhancements (#3609)
* Add KeyboardCapabilities structure and related changes to HMI API * Add new smart object keys * Add changes to SetGlobalProperties request * Improve caching of keyboard properties
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc173
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc347
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc4
-rw-r--r--src/components/interfaces/HMI_API.xml41
6 files changed, 592 insertions, 2 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 932c65ae2d..b23e429925 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
@@ -591,6 +591,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* custom_keys;
extern const char* file;
extern const char* file_name;
extern const char* retry;
@@ -628,6 +629,9 @@ extern const char* image_capabilities;
extern const char* display_type;
extern const char* display_name;
extern const char* text_fields;
+extern const char* keyboard_capabilities;
+extern const char* supported_keyboards;
+extern const char* num_configurable_keys;
extern const char* media_clock_formats;
extern const char* graphic_supported;
extern const char* image_fields;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
index 190cb07459..fbf3056e58 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
@@ -203,7 +203,30 @@ class SetGlobalPropertiesRequest
*/
bool IsWhiteSpaceExist();
- /*
+ /**
+ * @brief helps to determine layout of interest. Returns keyboard layout,
+ * mentioned in current request. If not, returns saved keyboard layout for
+ * current app. If such layout wasn't saved, returns default keyboard layout
+ * (QWERTY)
+ * @return KeyboardLayout enum value
+ */
+ hmi_apis::Common_KeyboardLayout::eType GetKeyboardLayout() const;
+
+ /**
+ * @brief Returns allowed number of configurable keys for certain layout
+ * @return allowed number of configurable keys, if provided, and zero
+ * otherwise
+ */
+ uint32_t GetAllowedNumberOfConfigurableKeys() const;
+
+ /**
+ * @brief Checks provided custom keys against capabilities.
+ * @return true if the specified keyboard layout supports the number of
+ * custom keys provided.
+ */
+ bool ValidateCustomKeys() const;
+
+ /**
* @brief Prepare result code and result for sending to mobile application
* @param result_code contains result code for sending to mobile application
* @param info contains info for sending to mobile applicaion
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 396763ff98..315fbee4eb 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
@@ -151,6 +151,17 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
+ if (!ValidateCustomKeys()) {
+ SDL_LOG_ERROR(
+ "Number of customizable keys exceeds the maximum number for this "
+ "layout");
+ SendResponse(
+ false,
+ mobile_apis::Result::INVALID_DATA,
+ "customKeys exceeds the number of customizable keys in this Layout");
+ return;
+ }
+
// if application waits for sending ttsGlobalProperties need to remove this
// application from tts_global_properties_app_list_
application_manager_.RemoveAppFromTTSGlobalPropertiesList(connection_key());
@@ -642,7 +653,46 @@ void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
if (is_keyboard_props_present) {
out_params[hmi_request::keyboard_properties] =
msg_params[hmi_request::keyboard_properties];
- app->set_keyboard_props(msg_params[hmi_request::keyboard_properties]);
+ smart_objects::SmartObject cached_keyboard_props(
+ msg_params[hmi_request::keyboard_properties]);
+
+ if (cached_keyboard_props.keyExists(hmi_request::auto_complete_list)) {
+ auto auto_complete_list =
+ cached_keyboard_props[hmi_request::auto_complete_list].asArray();
+ if (auto_complete_list && auto_complete_list->empty()) {
+ cached_keyboard_props.erase(hmi_request::auto_complete_list);
+ }
+ }
+
+ auto saved_keyboard_props = app->keyboard_props();
+ if (!saved_keyboard_props) {
+ app->set_keyboard_props(cached_keyboard_props);
+ return;
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_request::keyboard_layout) &&
+ saved_keyboard_props->keyExists(hmi_request::keyboard_layout)) {
+ cached_keyboard_props[hmi_request::keyboard_layout] =
+ static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ (*saved_keyboard_props)[hmi_request::keyboard_layout].asInt());
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_response::language) &&
+ saved_keyboard_props->keyExists(hmi_response::language)) {
+ cached_keyboard_props[hmi_response::language] =
+ static_cast<hmi_apis::Common_Language::eType>(
+ (*saved_keyboard_props)[hmi_response::language].asInt());
+ }
+
+ if (!msg_params[hmi_request::keyboard_properties].keyExists(
+ hmi_request::auto_complete_list) &&
+ saved_keyboard_props->keyExists(hmi_request::auto_complete_list)) {
+ cached_keyboard_props[hmi_request::auto_complete_list] =
+ (*saved_keyboard_props)[hmi_request::auto_complete_list];
+ }
+ app->set_keyboard_props(cached_keyboard_props);
}
}
@@ -820,9 +870,130 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
}
}
+
+ if (msg_params[strings::keyboard_properties].keyExists(
+ hmi_request::custom_keys)) {
+ const smart_objects::SmartArray* custom_keys_array =
+ msg_params[strings::keyboard_properties][hmi_request::custom_keys]
+ .asArray();
+
+ for (auto keys : (*custom_keys_array)) {
+ if (!CheckSyntax(keys.asCharArray())) {
+ SDL_LOG_ERROR(
+ "Invalid keyboard_properties "
+ "custom_keys syntax check failed");
+ return true;
+ }
+ }
+ }
}
+
return false;
}
+hmi_apis::Common_KeyboardLayout::eType
+SetGlobalPropertiesRequest::GetKeyboardLayout() const {
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+ if (msg_params[strings::keyboard_properties].keyExists(
+ hmi_request::keyboard_layout)) {
+ return static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ msg_params[strings::keyboard_properties][hmi_request::keyboard_layout]
+ .asInt());
+ }
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ auto saved_keyboard_props = app->keyboard_props();
+ if (saved_keyboard_props) {
+ if (saved_keyboard_props->keyExists(hmi_request::keyboard_layout)) {
+ return static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ (*saved_keyboard_props)[hmi_request::keyboard_layout].asInt());
+ }
+ }
+
+ return hmi_apis::Common_KeyboardLayout::QWERTY;
+}
+
+uint32_t SetGlobalPropertiesRequest::GetAllowedNumberOfConfigurableKeys()
+ const {
+ SDL_LOG_AUTO_TRACE();
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ auto display_capabilities = app->display_capabilities();
+ if (!display_capabilities) {
+ SDL_LOG_WARN("Display capabilities are not available");
+ return 0;
+ }
+
+ auto* window_capabilities =
+ (*display_capabilities)[0][strings::window_capabilities].asArray();
+
+ if (!window_capabilities) {
+ SDL_LOG_WARN("Window capabilities are not available");
+ return 0;
+ }
+
+ if (!(*window_capabilities)[0].keyExists(
+ hmi_response::keyboard_capabilities)) {
+ SDL_LOG_WARN("Keyboard capabilities are not available");
+ return 0;
+ }
+
+ if (!(*window_capabilities)[0][hmi_response::keyboard_capabilities].keyExists(
+ hmi_response::supported_keyboards)) {
+ SDL_LOG_WARN("Data about supported keyboards is not available");
+ return 0;
+ }
+
+ auto supported_keyboards =
+ (*window_capabilities)[0][hmi_response::keyboard_capabilities]
+ [hmi_response::supported_keyboards]
+ .asArray();
+
+ const auto requested_layout = GetKeyboardLayout();
+ for (auto keyboard : (*supported_keyboards)) {
+ if (requested_layout ==
+ static_cast<hmi_apis::Common_KeyboardLayout::eType>(
+ keyboard[hmi_request::keyboard_layout].asInt())) {
+ return keyboard[hmi_response::num_configurable_keys].asUInt();
+ }
+ }
+
+ return 0;
+}
+
+bool SetGlobalPropertiesRequest::ValidateCustomKeys() const {
+ SDL_LOG_AUTO_TRACE();
+
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+
+ if (!msg_params.keyExists(strings::keyboard_properties)) {
+ SDL_LOG_WARN("Keyboard properties are not available");
+ return true;
+ }
+
+ if (!msg_params[strings::keyboard_properties].keyExists(
+ hmi_request::custom_keys)) {
+ SDL_LOG_WARN("Customizable keys are not available");
+ return true;
+ }
+
+ auto custom_keys_array =
+ msg_params[strings::keyboard_properties][hmi_request::custom_keys]
+ .asArray();
+ if (custom_keys_array) {
+ uint32_t requested_key_count = custom_keys_array->size();
+ uint32_t allowed_key_count = GetAllowedNumberOfConfigurableKeys();
+
+ if (requested_key_count > allowed_key_count) {
+ return false;
+ }
+ }
+
+ return true;
+}
} // namespace commands
} // namespace sdl_rpc_plugin
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 9b72d41f7e..e7e155ec48 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
@@ -397,6 +397,29 @@ class SetGlobalPropertiesRequestTest
ui_result, tts_result, rc_result, false);
}
+ void AddCustomizableKeys(MessageSharedPtr msg) {
+ SmartObject customizable_keys(smart_objects::SmartType_Array);
+ customizable_keys[0] = "%";
+ customizable_keys[1] = "@";
+ customizable_keys[2] = "&";
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::custom_keys] = customizable_keys;
+ }
+
+ std::shared_ptr<SmartObject> GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::eType layout, int num_allowed_keys) {
+ auto display_capabilities =
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
+ auto& supported_keyboards =
+ (*display_capabilities)[0][am::strings::window_capabilities][0]
+ [am::hmi_response::keyboard_capabilities]
+ [am::hmi_response::supported_keyboards];
+ supported_keyboards[0][am::hmi_request::keyboard_layout] = layout;
+ supported_keyboards[0][am::hmi_response::num_configurable_keys] =
+ num_allowed_keys;
+ return display_capabilities;
+ }
+
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
MockAppPtr mock_app_;
std::shared_ptr<application_manager_test::MockHelpPromptManager>
@@ -1262,6 +1285,330 @@ TEST_F(SetGlobalPropertiesRequestTest,
command->Run();
}
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_InvalidCustomizableKeys_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ SmartObject customizable_keys(smart_objects::SmartType_Array);
+ customizable_keys[0] = "%";
+ customizable_keys[1] = "\\n";
+ customizable_keys[2] = " ";
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::custom_keys] = customizable_keys;
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_DisallowedNumberOfCustomizableKeysAndLayoutFromRequest_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+
+ const int num_allowed_keys = 0;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTZ, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_DisallowedNumberOfCustomizableKeysAndSavedLayout_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ 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::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillOnce(Return(&saved_keyboard_props));
+
+ const int num_allowed_keys = 0;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTZ, num_allowed_keys);
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_DisallowedNumberOfCustomizableKeysAndDefaultLayout_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ const int num_allowed_keys = 0;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeysAndNotSupportedLayout_INVALID_DATA) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties]
+ [am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ ExpectInvalidData();
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeys_LayoutFromRequestCached) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ keyboard_properties[am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTY;
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeysAndSavedLayout_SavedLayoutCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ 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::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTZ, num_allowed_keys);
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto requested_keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ auto cached_keyboard_props(requested_keyboard_properties);
+ cached_keyboard_props[am::hmi_request::keyboard_layout] =
+ hmi_apis::Common_KeyboardLayout::QWERTZ;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_AllowedNumberOfCustomizableKeysAndDefaultLayout_KeyboardPropsCachedAsIs) {
+ MessageSharedPtr msg = CreateMsgParams();
+ AddCustomizableKeys(msg);
+
+ const int num_allowed_keys = 3;
+ auto display_capabilities = GetCapabilitiesForConfigurableKeyboard(
+ hmi_apis::Common_KeyboardLayout::QWERTY, num_allowed_keys);
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto requested_keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ EXPECT_CALL(*mock_app_, set_keyboard_props(requested_keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_RequestContainsLanguageParam_KeyboardPropsCachedAsIs) {
+ MessageSharedPtr msg = CreateMsgParams();
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ keyboard_properties[am::hmi_response::language] =
+ hmi_apis::Common_Language::EN_GB;
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_NoLanguageInRequestButPresentInSaved_SavedLanguageCachedAgain) {
+ 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_response::language] =
+ hmi_apis::Common_Language::EN_GB;
+ 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_response::language] =
+ hmi_apis::Common_Language::EN_GB;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_NoAutocompleteListInRequestButPresentInSaved_SavedArrayCachedAgain) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+
+ SmartObject autocomplete_list(smart_objects::SmartType_Array);
+ autocomplete_list[0] = "first";
+ autocomplete_list[1] = "second";
+ saved_keyboard_props[am::hmi_request::auto_complete_list] = autocomplete_list;
+ 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::auto_complete_list] =
+ autocomplete_list;
+ EXPECT_CALL(*mock_app_, set_keyboard_props(cached_keyboard_props));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_NewAutocompleteListInRequestAndAlsoPresentInSaved_TransferAndSaveNewArray) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ SmartObject new_list(smart_objects::SmartType_Array);
+ new_list[0] = "first_new_value";
+ new_list[1] = "second_new_value";
+ keyboard_properties[am::hmi_request::auto_complete_list] = new_list;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ SmartObject old_list(smart_objects::SmartType_Array);
+ old_list[0] = "old_value";
+ old_list[1] = "another_old_value";
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::auto_complete_list] = old_list;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+
+ command->Run();
+}
+
+TEST_F(
+ SetGlobalPropertiesRequestTest,
+ Run_EmptyAutocompleteListInRequestAndAlsoPresentInSaved_TransferButNotSaveEmptyArray) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ auto& keyboard_properties =
+ (*msg)[am::strings::msg_params][am::strings::keyboard_properties];
+ SmartObject new_list(smart_objects::SmartType_Array);
+ keyboard_properties[am::hmi_request::auto_complete_list] = new_list;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ SmartObject old_list(smart_objects::SmartType_Array);
+ old_list[0] = "old_value";
+ old_list[1] = "another_old_value";
+ auto saved_keyboard_props = SmartObject(smart_objects::SmartType_Map);
+ saved_keyboard_props[am::hmi_request::auto_complete_list] = old_list;
+ EXPECT_CALL(*mock_app_, keyboard_props())
+ .WillRepeatedly(Return(&saved_keyboard_props));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto properties_without_empty_list(keyboard_properties);
+ properties_without_empty_list.erase(am::hmi_request::auto_complete_list);
+ EXPECT_CALL(*mock_app_, set_keyboard_props(properties_without_empty_list));
+
+ command->Run();
+}
+
TEST_F(SetGlobalPropertiesRequestTest, Run_NoData_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 8d3aaf5b1a..87ff3fb05b 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -548,6 +548,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* custom_keys = "customKeys";
const char* file = "file";
const char* file_name = "fileName";
const char* retry = "retry";
@@ -585,6 +586,9 @@ const char* image_capabilities = "imageCapabilities";
const char* display_type = "displayType";
const char* display_name = "displayName";
const char* text_fields = "textFields";
+const char* keyboard_capabilities = "keyboardCapabilities";
+const char* supported_keyboards = "supportedKeyboards";
+const char* num_configurable_keys = "numConfigurableKeys";
const char* media_clock_formats = "mediaClockFormats";
const char* graphic_supported = "graphicSupported";
const char* image_fields = "imageFields";
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 1f531a786a..c18448281f 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -1343,6 +1343,7 @@
<element name="QWERTY" />
<element name="QWERTZ" />
<element name="AZERTY" />
+ <element name="NUMERIC"/>
</enum>
<enum name="KeyboardEvent">
@@ -1352,6 +1353,15 @@
<element name="ENTRY_VOICE" />
<element name="ENTRY_CANCELLED" />
<element name="ENTRY_ABORTED" />
+ <element name="INPUT_KEY_MASK_ENABLED"/>
+ <element name="INPUT_KEY_MASK_DISABLED"/>
+</enum>
+
+<enum name="KeyboardInputMask">
+ <description>Enumeration listing possible input character masking.</description>
+ <element name="ENABLE_INPUT_KEY_MASK" />
+ <element name="DISABLE_INPUT_KEY_MASK" />
+ <element name="USER_CHOICE_INPUT_KEY_MASK" />
</enum>
<enum name="KeypressMode">
@@ -3206,6 +3216,15 @@
If empty, the auto-complete list will be removed from the screen.
</description>
</param>
+ <param name="maskInputCharacters" type="KeyboardInputMask" mandatory="false">
+ <description>Allows an app to mask entered characters on HMI</description>
+ </param>
+ <param name="customKeys" type="String" maxlength="1" minsize="1" maxsize="10" array="true" mandatory="false">
+ <description>
+ Array of special characters to show in customizable keys.
+ If omitted, keyboard will show default special characters
+ </description>
+ </param>
</struct>
<struct name="Turn">
@@ -3701,6 +3720,25 @@
<param name="maximumNumberOfWindows" type="Integer" mandatory="true" />
</struct>
+ <struct name="KeyboardLayoutCapability">
+ <description>
+ Describes the capabilities of a single keyboard layout.
+ </description>
+ <param name="keyboardLayout" type="KeyboardLayout" mandatory="true"/>
+ <param name="numConfigurableKeys" type="Integer" minvalue="0" maxvalue="10" mandatory="true">
+ <description>Number of keys available for special characters, App can customize as per their needs.</description>
+ </param>
+ </struct>
+
+ <struct name="KeyboardCapabilities">
+ <param name="maskInputCharactersSupported" type="Boolean" mandatory="false">
+ <description>Availability of capability to mask input characters using keyboard. True: Available, False: Not Available</description>
+ </param>
+ <param name="supportedKeyboards" type="KeyboardLayoutCapability" minsize="1" maxsize="1000" array="true" mandatory="false">
+ <description>Capabilities of supported keyboard layouts by HMI.</description>
+ </param>
+ </struct>
+
<struct name="WindowCapability">
<param name="windowID" type="Integer" mandatory="false">
<description>
@@ -3735,6 +3773,9 @@
<param name="dynamicUpdateCapabilities" type="DynamicUpdateCapabilities" mandatory="false">
<description>Contains the head unit's capabilities for dynamic updating features declaring if the module will send dynamic update RPCs.</description>
</param>
+ <param name="keyboardCapabilities" type="KeyboardCapabilities" mandatory="false">
+ <description>See KeyboardCapabilities</description>
+ </param>
</struct>
<struct name="DisplayCapability">