summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/appMain/hmi_capabilities.json10
-rw-r--r--src/appMain/sdl_preloaded_pt.json25
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h15
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h7
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h7
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h13
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc97
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h85
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc65
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc51
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc68
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc258
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc64
-rw-r--r--src/components/application_manager/src/app_service_manager.cc58
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc71
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc40
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc4
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc43
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc57
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc7
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc80
-rw-r--r--src/components/application_manager/test/app_service_manager_test.cc8
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h8
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc20
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc8
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h7
-rw-r--r--src/components/include/application_manager/state_controller.h11
-rw-r--r--src/components/include/policy/policy_external/policy/policy_listener.h6
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h19
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_listener.h6
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h19
-rw-r--r--src/components/include/test/application_manager/mock_state_controller.h10
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h4
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h14
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_listener.h1
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h4
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h12
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h1
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h4
-rw-r--r--src/components/interfaces/HMI_API.xml62
-rw-r--r--src/components/interfaces/MOBILE_API.xml139
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h8
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h21
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h16
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h10
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h1
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc36
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc26
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc10
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc20
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc10
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc7
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h7
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h21
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h16
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h10
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h1
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc47
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc25
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc18
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc20
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc16
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc26
87 files changed, 2752 insertions, 262 deletions
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index 481c6d0c6b..71c0b14100 100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -242,6 +242,16 @@
"resolutionWidth": 35,
"resolutionHeight": 35
}
+ },
+ {
+ "name": "alertIcon",
+ "imageTypeSupported": [
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution": {
+ "resolutionWidth": 225,
+ "resolutionHeight": 225
+ }
}
],
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 4e39a735d1..75dda3f5d5 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -33,7 +33,8 @@
"COMMUNICATION": 6,
"NORMAL": 4,
"NONE": 0
- }
+ },
+ "lock_screen_dismissal_enabled": true
},
"functional_groupings": {
"Base-4": {
@@ -271,6 +272,13 @@
"hmi_levels": ["BACKGROUND",
"FULL",
"LIMITED"]
+ },
+ "CloseApplication": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
}
}
},
@@ -599,6 +607,14 @@
"NONE"
]
},
+ "UnpublishAppService": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
"GetAppServiceData": {
"hmi_levels": [
"FULL",
@@ -1912,6 +1928,13 @@
}
}
},
+ "LockScreenDismissalWarning":{
+ "languages":{
+ "en-us":{
+ "textBody": "Swipe down to dismiss, acknowledging that you are not the driver"
+ }
+ }
+ },
"Notifications": {
"languages": {
"de-de": {
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 0642dd3cd1..98992a20d5 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -348,15 +348,16 @@ class MessageHelper {
bool is_unexpected_disconnect,
ApplicationManager& app_mngr);
- static ns_smart_device_link::ns_smart_objects::SmartObjectSPtr
- GetBCActivateAppRequestToHMI(
+ static smart_objects::SmartObjectSPtr GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectSPtr GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+
static void SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr);
@@ -725,6 +726,14 @@ class MessageHelper {
hmi_apis::Common_Language::eType language);
/**
+ * @brief Converts mobile language to string representation
+ * @param language Mobile UI language
+ * @return Mobile language string representation
+ */
+ static std::string MobileLanguageToString(
+ mobile_apis::Language::eType language);
+
+ /**
* @brief Converts string to mobile language enum value
* @param language language as string
* @return Mobile language enum value
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index abffd3eebb..917f8be559 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -204,6 +204,9 @@ class PolicyHandler : public PolicyHandlerInterface,
uint32_t TimeoutExchangeMSec() const OVERRIDE;
void OnExceededTimeout() OVERRIDE;
void OnSystemReady() OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
void PTUpdatedAt(Counters counter, int value) OVERRIDE;
void add_listener(PolicyHandlerObserver* listener) OVERRIDE;
void remove_listener(PolicyHandlerObserver* listener) OVERRIDE;
@@ -661,6 +664,8 @@ class PolicyHandler : public PolicyHandlerInterface,
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) FINAL;
+ void OnLockScreenDismissalStateChanged() FINAL;
+
protected:
/**
* Starts next retry exchange policy table
@@ -807,7 +812,6 @@ class PolicyHandler : public PolicyHandlerInterface,
std::vector<FunctionalGroupPermission> CollectAppPermissions(
const uint32_t connection_key);
- private:
static const std::string kLibrary;
/**
@@ -817,7 +821,6 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void GetRegisteredLinks(std::map<std::string, std::string>& out_links) const;
- private:
mutable sync_primitives::RWLock policy_manager_lock_;
std::shared_ptr<PolicyManager> policy_manager_;
void* dl_handle_;
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 b3166154fd..2953e35645 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
@@ -131,6 +131,7 @@ extern const char* initial_text;
extern const char* duration;
extern const char* progress_indicator;
extern const char* alert_type;
+extern const char* alert_icon;
extern const char* play_tone;
extern const char* soft_buttons;
extern const char* soft_button_id;
@@ -256,6 +257,7 @@ extern const char* key_press_mode;
// duplicate names from hmi_request
extern const char* limited_character_list;
extern const char* auto_complete_text;
+extern const char* auto_complete_list;
extern const char* navigation_text;
// vehicle info
@@ -418,7 +420,6 @@ extern const char* const language_supported;
extern const char* const keyboard_layout_supported;
extern const char* const keypress_mode_supported;
extern const char* const limited_characters_list_supported;
-extern const char* const auto_complete_text_supported;
extern const char* const send_location_enabled;
extern const char* const get_way_points_enabled;
extern const char* const entity_type;
@@ -481,6 +482,8 @@ namespace mobile_notification {
extern const char* state;
extern const char* syncp_timeout;
extern const char* syncp_url;
+extern const char* lock_screen_dismissal_enabled;
+extern const char* lock_screen_dismissal_warning;
} // namespace mobile_notification
namespace hmi_levels {
@@ -527,7 +530,7 @@ extern const char* keyboard_properties;
extern const char* method_name;
extern const char* keyboard_layout;
extern const char* limited_character_list;
-extern const char* auto_complete_text;
+extern const char* auto_complete_list;
extern const char* file;
extern const char* file_name;
extern const char* retry;
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
index f3b2966fca..77da28cc91 100644
--- a/src/components/application_manager/include/application_manager/state_controller_impl.h
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -186,9 +186,9 @@ class StateControllerImpl : public event_engine::EventObserver,
virtual bool IsStateActive(HmiState::StateID state_id) const;
private:
- int64_t SendBCActivateApp(ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority);
+ int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority);
/**
* @brief The HmiLevelConflictResolver struct
* Move other application to HmiStates if applied moved to FULL or LIMITED
@@ -378,10 +378,11 @@ class StateControllerImpl : public event_engine::EventObserver,
const mobile_apis::VideoStreamingState::eType video_state);
/**
- * @brief OnActivateAppResponse calback for activate app response
+ * @brief OnHMIResponse callback for activate app or close application
+ * response
* @param message Smart Object
*/
- void OnActivateAppResponse(const smart_objects::SmartObject& message);
+ void OnHMIResponse(const smart_objects::SmartObject& message);
/**
* @brief OnAppDeactivated callback for OnAppDeactivated notification
@@ -449,7 +450,7 @@ class StateControllerImpl : public event_engine::EventObserver,
typedef std::list<HmiState::StateID> StateIDList;
StateIDList active_states_;
mutable sync_primitives::Lock active_states_lock_;
- std::map<uint32_t, HmiStatePtr> waiting_for_activate_;
+ std::map<uint32_t, HmiStatePtr> waiting_for_response_;
ApplicationManager& app_mngr_;
};
} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h
new file mode 100644
index 0000000000..fdeadfa7c0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASUnpublishAppServiceRequest command class
+ **/
+class ASUnpublishAppServiceRequest : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASUnpublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASUnpublishAppServiceRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASUnpublishAppServiceRequest class destructor
+ **/
+ virtual ~ASUnpublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASUnpublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h
new file mode 100644
index 0000000000..51edd2dadb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASUnpublishAppServiceResponse command class
+ **/
+class ASUnpublishAppServiceResponse : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASUnpublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASUnpublishAppServiceResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASUnpublishAppServiceResponse class destructor
+ **/
+ virtual ~ASUnpublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASUnpublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
new file mode 100644
index 0000000000..4a883b92ee
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UnpublishAppServiceRequest command class
+ **/
+class UnpublishAppServiceRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief UnpublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UnpublishAppServiceRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief UnpublishAppServiceRequest class destructor
+ **/
+ virtual ~UnpublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnpublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h
new file mode 100644
index 0000000000..512e39eea0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UnpublishAppServiceResponse command class
+ **/
+class UnpublishAppServiceResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief UnpublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UnpublishAppServiceResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief UnpublishAppServiceResponse class destructor
+ **/
+ virtual ~UnpublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnpublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
index 1cec2ccdce..3090ea8ced 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
@@ -50,6 +50,8 @@
#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h"
#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h"
#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h"
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
@@ -126,6 +128,11 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::ASPublishAppServiceRequest>()
: factory.GetCreator<commands::ASPublishAppServiceResponse>();
+ case hmi_apis::FunctionID::AppService_UnpublishAppService:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASUnpublishAppServiceRequest>()
+ : factory
+ .GetCreator<commands::ASUnpublishAppServiceResponse>();
case hmi_apis::FunctionID::AppService_OnAppServiceData:
return app_mngr::commands::Command::CommandSource::SOURCE_HMI == source
? factory.GetCreator<
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
index 76be96cf8f..5c44fb5fae 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
@@ -47,6 +47,8 @@
#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h"
#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h"
#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
@@ -120,6 +122,16 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator(
return factory.GetCreator<commands::PublishAppServiceResponse>();
}
break;
+ case mobile_apis::FunctionID::UnpublishAppServiceID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source &&
+ mobile_apis::messageType::response != message_type) {
+ return factory.GetCreator<commands::UnpublishAppServiceRequest>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source &&
+ mobile_apis::messageType::request != message_type) {
+ return factory.GetCreator<commands::UnpublishAppServiceResponse>();
+ }
+ break;
case mobile_apis::FunctionID::OnAppServiceDataID:
return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source
? factory.GetCreator<
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
new file mode 100644
index 0000000000..30905b5fa2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASUnpublishAppServiceRequest::~ASUnpublishAppServiceRequest() {}
+
+void ASUnpublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_id].asString();
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service || service->mobile_service) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::INVALID_ID,
+ "Invalid Service ID",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ bool ret = application_manager_.GetAppServiceManager().UnpublishAppService(
+ service_id);
+
+ if (!ret) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::REJECTED,
+ "The app service with that requested service ID does not exist",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::SUCCESS,
+ NULL,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
new file mode 100644
index 0000000000..0c8b479da8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASUnpublishAppServiceResponse::~ASUnpublishAppServiceResponse() {}
+
+void ASUnpublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
index c168b4bf2f..53d1bf82fa 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -120,12 +120,6 @@ void PublishAppServiceRequest::Run() {
return;
}
- if (app->IsFullscreen()) {
- // Service should be activated if app is in the foreground
- application_manager_.GetAppServiceManager().ActivateAppService(
- service_record[strings::service_id].asString());
- }
-
response_params[strings::app_service_record] = service_record;
SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
new file mode 100644
index 0000000000..2cb43bce07
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+UnpublishAppServiceRequest::UnpublishAppServiceRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {}
+
+void UnpublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_id].asString();
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+
+ if (!service || service->connection_key != connection_key()) {
+ SendResponse(false,
+ mobile_apis::Result::INVALID_ID,
+ "No app service with the requested service ID was published "
+ "by this application");
+ return;
+ }
+
+ bool ret = application_manager_.GetAppServiceManager().UnpublishAppService(
+ service_id);
+
+ if (!ret) {
+ SendResponse(
+ false,
+ mobile_apis::Result::INVALID_ID,
+ "The app service with that requested service ID does not exist");
+ return;
+ }
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, NULL);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
new file mode 100644
index 0000000000..22450ecc4c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+UnpublishAppServiceResponse::UnpublishAppServiceResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+UnpublishAppServiceResponse::~UnpublishAppServiceResponse() {}
+
+void UnpublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
index f64f353767..4236ac23f9 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -53,6 +53,8 @@
#include "hmi/as_perform_app_service_interaction_response_to_hmi.h"
#include "hmi/as_publish_app_service_request.h"
#include "hmi/as_publish_app_service_response.h"
+#include "hmi/as_unpublish_app_service_request.h"
+#include "hmi/as_unpublish_app_service_response.h"
#include "hmi/on_as_app_service_data_notification.h"
#include "hmi/on_as_app_service_data_notification_from_hmi.h"
@@ -132,6 +134,8 @@ typedef Types<commands::ASAppServiceActivationRequest,
commands::ASPerformAppServiceInteractionResponseToHMI,
commands::ASPublishAppServiceRequest,
commands::ASPublishAppServiceResponse,
+ commands::ASUnpublishAppServiceRequest,
+ commands::ASUnpublishAppServiceResponse,
commands::OnASAppServiceDataNotification,
commands::OnASAppServiceDataNotificationFromHMI>
HMICommandsListFirst;
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
index e77b21ca6d..69bff3ad76 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -49,6 +49,8 @@
#include "mobile/perform_app_service_interaction_response_from_mobile.h"
#include "mobile/publish_app_service_request.h"
#include "mobile/publish_app_service_response.h"
+#include "mobile/unpublish_app_service_request.h"
+#include "mobile/unpublish_app_service_response.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
@@ -118,7 +120,9 @@ typedef Types<commands::GetAppServiceDataRequest,
commands::PerformAppServiceInteractionResponse,
commands::PerformAppServiceInteractionResponseFromMobile,
commands::PublishAppServiceRequest,
- commands::PublishAppServiceResponse>
+ commands::PublishAppServiceResponse,
+ commands::UnpublishAppServiceRequest,
+ commands::UnpublishAppServiceResponse>
MobileCommandsListFirst;
TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h
new file mode 100644
index 0000000000..9847f567e0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BasicCommunicationCloseApplicationRequest command class
+ **/
+class BasicCommunicationCloseApplicationRequest
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief BasicCommunicationCloseApplicationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationCloseApplicationRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief BasicCommunicationCloseApplicationRequest class destructor
+ **/
+ ~BasicCommunicationCloseApplicationRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h
new file mode 100644
index 0000000000..9576684b77
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BasicCommunicationCloseApplicationResponse command class
+ **/
+class BasicCommunicationCloseApplicationResponse
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief BasicCommunicationCloseApplicationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationCloseApplicationResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief BasicCommunicationCloseApplicationResponse class destructor
+ **/
+ ~BasicCommunicationCloseApplicationResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
new file mode 100644
index 0000000000..b965e880b4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
@@ -0,0 +1,85 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CloseApplicationRequest command class
+ **/
+class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief CloseApplicationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CloseApplicationRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief CloseApplicationRequest class destructor
+ **/
+ ~CloseApplicationRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloseApplicationRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h
new file mode 100644
index 0000000000..c7b649f4e9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CloseApplicationResponse command class
+ **/
+class CloseApplicationResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief CloseApplicationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CloseApplicationResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief CloseApplicationResponse class destructor
+ **/
+ ~CloseApplicationResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloseApplicationResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
new file mode 100644
index 0000000000..b021faefd8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BasicCommunicationCloseApplicationRequest::
+ BasicCommunicationCloseApplicationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BasicCommunicationCloseApplicationRequest::
+ ~BasicCommunicationCloseApplicationRequest() {}
+
+void BasicCommunicationCloseApplicationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
new file mode 100644
index 0000000000..2e56271cf2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BasicCommunicationCloseApplicationResponse::
+ BasicCommunicationCloseApplicationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BasicCommunicationCloseApplicationResponse::
+ ~BasicCommunicationCloseApplicationResponse() {}
+
+void BasicCommunicationCloseApplicationResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
index 2f3ee60a16..4229369acc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
@@ -59,12 +59,35 @@ struct OnDriverDistractionProcessor {
void operator()(ApplicationSharedPtr application) {
if (application) {
- (*on_driver_distraction_so_)[strings::params][strings::connection_key] =
- application->app_id();
+ // Create modifiable copy of base message
+ smart_objects::SmartObject message = *on_driver_distraction_so_;
+ message[strings::params][strings::connection_key] = application->app_id();
const RPCParams params;
policy::CheckPermissionResult result;
application_manager_.GetPolicyHandler().CheckPermissions(
application, stringified_function_id_, params, result);
+ auto& msg_params = message[strings::msg_params];
+ const bool is_lock_screen_dismissal_exists = msg_params.keyExists(
+ mobile_notification::lock_screen_dismissal_enabled);
+
+ if (is_lock_screen_dismissal_exists &&
+ msg_params[mobile_notification::lock_screen_dismissal_enabled]
+ .asBool()) {
+ const auto language =
+ MessageHelper::MobileLanguageToString(application->ui_language());
+
+ const auto warning_message =
+ application_manager_.GetPolicyHandler()
+ .LockScreenDismissalWarningMessage(language);
+ // Only allow lock screen dismissal if a warning message is available
+ if (warning_message && !warning_message->empty()) {
+ msg_params[mobile_notification::lock_screen_dismissal_warning] =
+ *warning_message;
+ } else {
+ msg_params[mobile_notification::lock_screen_dismissal_enabled] =
+ false;
+ }
+ }
if (result.hmi_level_permitted != policy::kRpcAllowed) {
MobileMessageQueue messages;
application->SwapMobileMessageQueue(messages);
@@ -72,15 +95,19 @@ struct OnDriverDistractionProcessor {
std::remove_if(
messages.begin(),
messages.end(),
- [this](smart_objects::SmartObjectSPtr message) {
+ [](smart_objects::SmartObjectSPtr message) {
return (*message)[strings::params][strings::function_id]
- .asString() == stringified_function_id_;
+ .asUInt() ==
+ mobile_api::FunctionID::OnDriverDistractionID;
}),
messages.end());
- application->PushMobileMessage(on_driver_distraction_so_);
+ application->SwapMobileMessageQueue(messages);
+ application->PushMobileMessage(
+ std::make_shared<smart_objects::SmartObject>(message));
return;
}
- command_.SendNotificationToMobile(on_driver_distraction_so_);
+ command_.SendNotificationToMobile(
+ std::make_shared<smart_objects::SmartObject>(message));
}
}
@@ -108,14 +135,12 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const hmi_apis::Common_DriverDistractionState::eType state =
+ const auto state =
static_cast<hmi_apis::Common_DriverDistractionState::eType>(
(*message_)[strings::msg_params][hmi_notification::state].asInt());
application_manager_.set_driver_distraction_state(state);
- smart_objects::SmartObjectSPtr on_driver_distraction =
- std::make_shared<smart_objects::SmartObject>();
-
+ auto on_driver_distraction = std::make_shared<smart_objects::SmartObject>();
if (!on_driver_distraction) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -127,6 +152,17 @@ void OnDriverDistractionNotification::Run() {
(*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
state;
+ const auto lock_screen_dismissal =
+ application_manager_.GetPolicyHandler().LockScreenDismissalEnabledState();
+
+ if (lock_screen_dismissal &&
+ hmi_apis::Common_DriverDistractionState::DD_ON == state) {
+ (*on_driver_distraction)
+ [strings::msg_params]
+ [mobile_notification::lock_screen_dismissal_enabled] =
+ *lock_screen_dismissal;
+ }
+
const ApplicationSet applications =
application_manager_.applications().GetData();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index 7173aaf2d0..908f31cd51 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -350,6 +350,23 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
MessageHelper::SubscribeApplicationToSoftButton(
(*message_)[strings::msg_params], app, function_id());
}
+
+ if ((*message_)[strings::msg_params].keyExists(strings::alert_icon)) {
+ auto verification_result = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::alert_icon],
+ app,
+ application_manager_);
+
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SendResponse(false, verification_result);
+ return;
+ }
+
+ msg_params[strings::alert_icon] =
+ (*message_)[strings::msg_params][strings::alert_icon];
+ }
+
// app_id
msg_params[strings::app_id] = app_id;
msg_params[strings::duration] = default_timeout_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
new file mode 100644
index 0000000000..736f0355dc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
@@ -0,0 +1,118 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/close_application_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CloseApplicationRequest::CloseApplicationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CloseApplicationRequest::~CloseApplicationRequest() {}
+
+void CloseApplicationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ LOG4CXX_ERROR(logger_, "Application does not exist");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::app_id] = connection_key();
+ SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_CloseApplication,
+ &msg_params,
+ true);
+}
+
+void CloseApplicationRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ auto msg_params = message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_BasicCommunication);
+ if (success) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ LOG4CXX_ERROR(logger_, "Application does not exist");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ auto on_app_exit = [app](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kApplicationExit, app);
+ };
+
+ application_manager_.GetPluginManager().ForEachPlugin(on_app_exit);
+ application_manager_.state_controller().SetRegularState(
+ app,
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ mobile_apis::VideoStreamingState::NOT_STREAMABLE,
+ false);
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
new file mode 100644
index 0000000000..934804e1b1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/close_application_response.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CloseApplicationResponse::CloseApplicationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CloseApplicationResponse::~CloseApplicationResponse() {}
+
+void CloseApplicationResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index 39363bbad1..ffd8a7dc81 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -161,7 +161,8 @@ void ResetGlobalPropertiesRequest::Run() {
key_board_properties[hmi_request::limited_character_list] =
limited_character_list;*/
- key_board_properties[hmi_request::auto_complete_text] = "";
+ key_board_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
msg_params[hmi_request::keyboard_properties] = key_board_properties;
}
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 bbfc61d463..3b13b00968 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
@@ -68,8 +68,7 @@ SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {}
void SetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
ApplicationSharedPtr app = application_manager_.application(connection_key());
@@ -90,11 +89,9 @@ void SetGlobalPropertiesRequest::Run() {
mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS;
- if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) {
+ if (msg_params.keyExists(strings::menu_icon)) {
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::menu_icon],
- app,
- application_manager_);
+ msg_params[strings::menu_icon], app, application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
@@ -103,18 +100,29 @@ void SetGlobalPropertiesRequest::Run() {
}
}
// Check for image file(s) in vrHelpItem
- if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) {
+ if (msg_params.keyExists(strings::vr_help)) {
if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
- (*message_)[strings::msg_params][strings::vr_help],
- app,
- application_manager_)) {
+ msg_params[strings::vr_help], app, application_manager_)) {
LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
+ if (msg_params.keyExists(strings::keyboard_properties)) {
+ if (!msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_list) &&
+ msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_text)) {
+ LOG4CXX_ERROR(logger_, "Replacing deprecated autoCompleteText property");
+ msg_params[strings::keyboard_properties][strings::auto_complete_list][0] =
+ msg_params[strings::keyboard_properties][strings::auto_complete_text]
+ .asString();
+ }
+ msg_params[strings::keyboard_properties].erase(strings::auto_complete_text);
+ }
+
if (IsWhiteSpaceExist()) {
LOG4CXX_ERROR(logger_, "White spaces found");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
@@ -549,16 +557,21 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
if (msg_params[strings::keyboard_properties].keyExists(
- strings::auto_complete_text)) {
- str =
- msg_params[strings::keyboard_properties][strings::auto_complete_text]
- .asCharArray();
+ strings::auto_complete_list)) {
+ const smart_objects::SmartArray* acl_array =
+ msg_params[strings::keyboard_properties][strings::auto_complete_list]
+ .asArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid keyboard_properties "
- "auto_complete_text syntax check failed");
- return true;
+ smart_objects::SmartArray::const_iterator it = acl_array->begin();
+
+ for (; it != acl_array->end(); ++it) {
+ str = it->asCharArray();
+ if (!CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_,
+ "Invalid keyboard_properties "
+ "auto_complete_list syntax check failed");
+ return true;
+ }
}
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 0d3158d841..1acb2a7438 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -126,6 +126,26 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed(
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
return false;
}
+
+ if (!app->is_navi() &&
+ ((mobile_apis::ButtonName::NAV_CENTER_LOCATION == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_IN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_OUT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_TILT_TOGGLE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_CLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_COUNTERCLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_HEADING_TOGGLE == btn_id))) {
+ return false;
+ }
+
return true;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
index 0734e1935d..0434eb05ec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
@@ -158,6 +158,8 @@
#endif // EXTERNAL_PROPRIETARY_MODE
#include "sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h"
@@ -317,6 +319,13 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::ActivateAppRequest>()
: factory.GetCreator<commands::ActivateAppResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_CloseApplication: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::BasicCommunicationCloseApplicationRequest>()
+ : factory.GetCreator<
+ commands::BasicCommunicationCloseApplicationResponse>();
+ }
#ifdef EXTERNAL_PROPRIETARY_MODE
case hmi_apis::FunctionID::BasicCommunication_DecryptCertificate: {
return hmi_apis::messageType::request == message_type
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 1a1d4f725c..11f3d78026 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -42,6 +42,8 @@
#include "sdl_rpc_plugin/commands/mobile/alert_response.h"
#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h"
#include "sdl_rpc_plugin/commands/mobile/change_registration_response.h"
+#include "sdl_rpc_plugin/commands/mobile/close_application_request.h"
+#include "sdl_rpc_plugin/commands/mobile/close_application_response.h"
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h"
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_command_request.h"
@@ -356,6 +358,11 @@ CommandCreator& MobileCommandFactory::get_command_creator(
: factory
.GetCreator<commands::GetCloudAppPropertiesResponse>();
}
+ case mobile_apis::FunctionID::CloseApplicationID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CloseApplicationRequest>()
+ : factory.GetCreator<commands::CloseApplicationResponse>();
+ }
case mobile_apis::FunctionID::GenericResponseID: {
using app_mngr::commands::Command;
return factory.GetCreator<commands::GenericResponse>();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index 8f2feed877..2f8f5c2849 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -192,6 +192,14 @@ const int32_t kMobileProtocolType_ = 0;
const int32_t kProtocolVersion_ = 3;
const uint32_t kCorrelationId_ = 1939u;
const uint32_t kAppId_ = 2014u;
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
+
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
} // namespace
class HMICommandsNotificationsTest
@@ -240,6 +248,9 @@ class HMICommandsNotificationsTest
.WillByDefault(ReturnRef(mock_event_dispatcher_));
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
+ ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
}
am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock,
@@ -259,6 +270,8 @@ class HMICommandsNotificationsTest
.WillByDefault(Return(vc));
ON_CALL(**app_mock, IsAudioApplication())
.WillByDefault(Return(media || navi || vc));
+ ON_CALL(**app_mock, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
return app;
}
#if defined(OS_POSIX)
@@ -1793,11 +1806,26 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
EXPECT_CALL(app_mngr_, set_driver_distraction_state(state));
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1805,16 +1833,28 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
TEST_F(HMICommandsNotificationsTest,
OnDriverDistractionNotificationInvalidApp) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
ApplicationSharedPtr invalid_app;
application_set_.insert(invalid_app);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1825,21 +1865,33 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::mobile_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
application_set_.insert(app_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_));
EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _))
.WillOnce(GetArg3(&result));
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
.WillOnce(GetMessage(message));
- EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
+ ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
command->Run();
EXPECT_EQ(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
index 802ad01d0b..5e0083d395 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
@@ -52,22 +52,65 @@ namespace hmi_commands_test {
namespace on_driver_distraction_notification {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Eq;
+using ::testing::NiceMock;
using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::SetArgumentPointee;
+
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::hmi::OnDriverDistractionNotification;
using namespace am::commands;
+using test::components::commands_test::MobileResultCodeIs;
+
+namespace {
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
-typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
+} // namespace
class HMIOnDriverDistractionNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
HMIOnDriverDistractionNotificationTest()
- : app_set_lock_(std::make_shared<sync_primitives::Lock>()) {}
+ : mock_app_(CreateMockApp())
+ , app_set_lock_(std::make_shared<sync_primitives::Lock>())
+ , accessor(app_set_, app_set_lock_) {
+ app_set_.insert(mock_app_);
+ InitMocksRelations();
+ }
+
+ typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+ typedef boost::optional<bool> OptionalBool;
+
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
+ }
+
+ MockAppPtr mock_app_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_;
- policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
+ am::ApplicationSet app_set_;
+ DataAccessor<am::ApplicationSet> accessor;
+ NiceMock<policy_test::MockPolicyHandlerInterface>
+ mock_policy_handler_interface_;
+
+ void InitMocksRelations() {
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor));
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_interface_));
+ }
};
MATCHER_P2(CheckNotificationParams, function_id, state, "") {
@@ -87,71 +130,232 @@ ACTION_P(GetArg3, result) {
arg3 = *result;
}
-TEST_F(HMIOnDriverDistractionNotificationTest, Run_PushMobileMessage_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ACTION_P(SetMessage, lockScreenDismissalWarning) {
+ smart_objects::SmartObject& notification = arg0;
+
+ notification[application_manager::strings::msg_params]
+ [application_manager::mobile_notification::
+ lock_screen_dismissal_warning] = lockScreenDismissalWarning;
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
+ .WillOnce(GetArg3(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto LSDW_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en, LSDW_message);
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_PushMobileMessage_If_DisallowedByPolicy) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcDisallowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
.WillOnce(GetArg3(&result));
- EXPECT_CALL(*mock_app,
+ MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(*mock_app_,
PushMobileMessage(CheckNotificationParams(
- am::mobile_api::FunctionID::OnDriverDistractionID, state)));
+ am::mobile_api::FunctionID::OnDriverDistractionID, state)))
+ .WillOnce(SaveArg<0>(&pushed_message));
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
command->Run();
+
+ ASSERT_TRUE((*pushed_message)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*pushed_message)[am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
}
TEST_F(HMIOnDriverDistractionNotificationTest,
- Run_SendNotificationToMobile_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ Run_SendNotificationIfLockScreenDismissalMissed) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>()));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
+ .WillByDefault(GetArg3(&result));
+
+ MessageSharedPtr command_result;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
+
+ command->Run();
+
+ auto& msg_params =
+ (*command_result)[application_manager::strings::msg_params];
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_enabled));
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_warning));
+}
+
+// LSDW - lock screen dimissal
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_LSDWMessageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(false)));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ // LockScreenDismissalWarning won't be added to message if value of
+ // LockScreenDismissalEnabledState is false
+ std::string required_language = "en-us";
+ EXPECT_CALL(mock_policy_handler_interface_,
+ LockScreenDismissalWarningMessage(required_language))
+ .Times(0);
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
.WillOnce(GetArg3(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
CheckNotificationParams(
am::mobile_api::FunctionID::OnDriverDistractionID, state),
- Command::CommandSource::SOURCE_SDL));
-
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
command->Run();
+
+ EXPECT_FALSE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
}
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SpecifiedLanguageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ // In case when specified language is absent in policy table, will added
+ // message on default language (en-us)
+ const mobile_apis::Language::eType mobile_language =
+ mobile_apis::Language::FR_FR;
+ std::string required_language = "FR-FR";
+ ON_CALL(*mock_app_, ui_language()).WillByDefault(ReturnRef(mobile_language));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(mobile_language))
+ .WillByDefault(Return(required_language));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
+ .WillOnce(GetArg3(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
+}
} // namespace on_driver_distraction_notification
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index 01f8f313b6..786f2b6bd1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -106,6 +106,23 @@ TEST_F(SubscribeButtonRequestTest, Run_SubscriptionNotAllowed_UNSUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NavSubscriptionNotAllowed_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::REJECTED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_UiIsNotSupported_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
@@ -203,6 +220,53 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
const mobile_apis::ButtonName::eType kButtonName =
mobile_apis::ButtonName::OK;
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index bab8147d9f..a85921a8cd 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -72,10 +72,44 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
std::string service_type = manifest[strings::service_type].asString();
- if (FindServiceByProvider(connection_key, service_type)) {
- LOG4CXX_WARN(logger_,
- "Service already exists for this provider, rejecting");
- return smart_objects::SmartObject();
+ AppService* found_service =
+ FindServiceByProvider(connection_key, service_type);
+ if (found_service) {
+ // Check if there is a different existing service with the same updated
+ // name.
+ if (manifest.keyExists(strings::service_name)) {
+ auto service_by_name =
+ FindServiceByName(manifest[strings::service_name].asString());
+ if (service_by_name) {
+ auto service_by_name_id =
+ service_by_name->record[strings::service_id].asString();
+ auto found_service_id =
+ found_service->record[strings::service_id].asString();
+ if (service_by_name_id != found_service_id) {
+ LOG4CXX_WARN(logger_,
+ "A service already exists with this name, rejecting");
+ return smart_objects::SmartObject();
+ }
+ }
+ }
+ LOG4CXX_WARN(logger_, "Service already exists for this provider, updating");
+ published_services_lock_.Acquire();
+ found_service->record[strings::service_manifest] = manifest;
+ found_service->record[strings::service_published] = true;
+ smart_objects::SmartObject updated_service_record = found_service->record;
+ published_services_lock_.Release();
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ AppServiceUpdated(updated_service_record,
+ mobile_apis::ServiceUpdateReason::MANIFEST_UPDATE,
+ msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ return updated_service_record;
}
if (manifest.keyExists(strings::service_name) &&
@@ -131,10 +165,16 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
- // Activate the new service if it is the default for its service type, or if
- // no service is active of its service type
+ // Activate the new service if it is the default for its service type, if
+ // no service is active of its service type, or it is a mobile app in full.
AppService* active_service = ActiveServiceForType(service_type);
- if (!active_service || app_service.default_service) {
+ ApplicationSharedPtr app = NULL;
+ if (mobile_service && connection_key) {
+ app = app_manager_.application(connection_key);
+ }
+
+ if (!active_service || app_service.default_service ||
+ (app && app->IsFullscreen())) {
ActivateAppService(service_id);
}
@@ -163,7 +203,9 @@ bool AppServiceManager::UnpublishAppService(const std::string service_id) {
// Activate embedded service, if available
auto embedded_service = EmbeddedServiceForType(
record[strings::service_manifest][strings::service_type].asString());
- if (embedded_service) {
+ if (embedded_service &&
+ (embedded_service->record[strings::service_id].asString() !=
+ service_id)) {
embedded_service->record[strings::service_active] = true;
AppServiceUpdated(embedded_service->record,
mobile_apis::ServiceUpdateReason::ACTIVATED,
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 3a92009d4f..317ad2933f 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -3907,30 +3907,69 @@ void ApplicationManagerImpl::SendDriverDistractionState(
LOG4CXX_WARN(logger_, "DriverDistractionState is INVALID_ENUM");
return;
}
- smart_objects::SmartObjectSPtr on_driver_distraction =
- std::make_shared<smart_objects::SmartObject>();
- (*on_driver_distraction)[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- (*on_driver_distraction)[strings::params][strings::function_id] =
- mobile_api::FunctionID::OnDriverDistractionID;
- (*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
- driver_distraction_state();
- (*on_driver_distraction)[strings::params][strings::connection_key] =
- application->app_id();
+ auto create_notification = [application, this]() {
+ auto notification = std::make_shared<smart_objects::SmartObject>();
+ auto& msg_params = (*notification)[strings::msg_params];
+ auto& params = (*notification)[strings::params];
+
+ params[strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ params[strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::OnDriverDistractionID);
+ msg_params[mobile_notification::state] = driver_distraction_state();
+ const auto lock_screen_dismissal =
+ policy_handler_->LockScreenDismissalEnabledState();
+
+ if (lock_screen_dismissal &&
+ hmi_apis::Common_DriverDistractionState::DD_ON ==
+ driver_distraction_state()) {
+ bool dismissal_enabled = *lock_screen_dismissal;
+ if (dismissal_enabled) {
+ const auto language =
+ MessageHelper::MobileLanguageToString(application->ui_language());
+
+ const auto warning_message =
+ policy_handler_->LockScreenDismissalWarningMessage(language);
+ // Only allow lock screen dismissal if a warning message is available
+ if (warning_message && !warning_message->empty()) {
+ msg_params[mobile_notification::lock_screen_dismissal_warning] =
+ *warning_message;
+ } else {
+ dismissal_enabled = false;
+ }
+ }
+ msg_params[mobile_notification::lock_screen_dismissal_enabled] =
+ dismissal_enabled;
+ }
+
+ params[strings::connection_key] = application->app_id();
+ return notification;
+ };
- const std::string function_id = MessageHelper::StringifiedFunctionID(
- static_cast<mobile_apis::FunctionID::eType>(
- (*on_driver_distraction)[strings::params][strings::function_id]
- .asUInt()));
const RPCParams params;
+ const std::string function_id = MessageHelper::StringifiedFunctionID(
+ mobile_api::FunctionID::OnDriverDistractionID);
const mobile_apis::Result::eType check_result =
CheckPolicyPermissions(application, function_id, params);
if (mobile_api::Result::SUCCESS == check_result) {
- rpc_service_->ManageMobileCommand(on_driver_distraction,
+ rpc_service_->ManageMobileCommand(create_notification(),
commands::Command::SOURCE_SDL);
} else {
- application->PushMobileMessage(on_driver_distraction);
+ MobileMessageQueue messages;
+ application->SwapMobileMessageQueue(messages);
+ messages.erase(
+ std::remove_if(
+ messages.begin(),
+ messages.end(),
+ [](smart_objects::SmartObjectSPtr message) {
+ return (*message)[strings::params][strings::function_id]
+ .asUInt() ==
+ mobile_apis::FunctionID::OnDriverDistractionID;
+ }),
+ messages.end());
+ application->SwapMobileMessageQueue(messages);
+ application->PushMobileMessage(create_notification());
}
}
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index 0f5bc80d56..7f4b14835f 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -135,6 +135,46 @@ void InitCapabilities() {
hmi_apis::Common_ButtonName::CUSTOM_BUTTON));
button_enum_name.insert(std::make_pair(std::string("SEARCH"),
hmi_apis::Common_ButtonName::SEARCH));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_CENTER_LOCATION"),
+ hmi_apis::Common_ButtonName::NAV_CENTER_LOCATION));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_IN"), hmi_apis::Common_ButtonName::NAV_ZOOM_IN));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_OUT"), hmi_apis::Common_ButtonName::NAV_ZOOM_OUT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_UP"), hmi_apis::Common_ButtonName::NAV_PAN_UP));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_RIGHT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_DOWN"), hmi_apis::Common_ButtonName::NAV_PAN_DOWN));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_LEFT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_LEFT"), hmi_apis::Common_ButtonName::NAV_PAN_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_TILT_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_TILT_TOGGLE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_CLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_CLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_COUNTERCLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_COUNTERCLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_HEADING_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_HEADING_TOGGLE));
text_fields_enum_name.insert(std::make_pair(
std::string("mainField1"), hmi_apis::Common_TextFieldName::mainField1));
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index 9aff403e09..04e2067916 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -105,6 +105,8 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_GetFilePath] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_CloseApplication] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR;
@@ -231,6 +233,8 @@ generate_function_to_interface_convert_map() {
convert_map[RC_OnRemoteControlSettings] = HmiInterfaces::HMI_INTERFACE_RC;
convert_map[AppService_PublishAppService] =
HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_UnpublishAppService] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
convert_map[AppService_GetAppServiceData] =
HmiInterfaces::HMI_INTERFACE_AppService;
convert_map[AppService_PerformAppServiceInteraction] =
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 6530004499..28f8fd88bb 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -332,6 +332,15 @@ std::string MessageHelper::CommonLanguageToString(
return std::string();
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType language) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+ const char* str = 0;
+ EnumConversionHelper<mobile_apis::Language::eType>::EnumToCString(language,
+ &str);
+ return str ? str : std::string();
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id) {
using namespace smart_objects;
@@ -623,15 +632,16 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
msg_params = *MessageHelper::CreateAppVrHelp(application);
msg_params[hmi_request::menu_title] = "";
- 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_text] = "";
- msg_params[hmi_request::keyboard_properties] = key_board_properties;
+ keyboard_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[hmi_request::keyboard_properties] = keyboard_properties;
msg_params[strings::app_id] = application->app_id();
@@ -1789,12 +1799,16 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr) {
DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+ if (hmi_apis::Common_HMILevel::NONE == level) {
+ LOG4CXX_WARN(logger_,
+ "BC.ActivateApp cannot be used to deactivate an application");
+ return NULL;
+ }
const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectSPtr message =
@@ -1831,6 +1845,23 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
return message;
}
+smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+
+ const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication;
+ (*message)[strings::params][strings::message_type] = MessageType::kRequest;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+ (*message)[strings::msg_params][strings::app_id] = app->app_id();
+
+ return message;
+}
+
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr) {
LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index d94a364c8c..cac09bd5f3 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -177,41 +177,6 @@ struct DeactivateApplication {
StateController& state_ctrl_;
};
-struct SDLAllowedNotification {
- SDLAllowedNotification(const connection_handler::DeviceHandle& device_id,
- PolicyManager* policy_manager,
- StateController& state_controller)
- : device_id_(device_id)
- , policy_manager_(policy_manager)
- , state_controller_(state_controller) {}
-
- void operator()(const ApplicationSharedPtr& app) {
- DCHECK_OR_RETURN_VOID(policy_manager_);
- if (device_id_ == app->device()) {
- std::string hmi_level = "NONE";
- mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level);
- if ("BACKGROUND" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else if ("FULL" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL;
- } else if ("LIMITED" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED;
- } else if ("NONE" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE;
- } else {
- return;
- }
- state_controller_.SetRegularState(app, default_mobile_hmi, true);
- }
- }
-
- private:
- connection_handler::DeviceHandle device_id_;
- PolicyManager* policy_manager_;
- StateController& state_controller_;
-};
-
/**
* @brief Gets from system list of currently registered applications and
* create collection of links device-to-application
@@ -861,6 +826,15 @@ void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from,
policy_manager_->OnDeviceSwitching(device_id_from, device_id_to);
}
+void PolicyHandler::OnLockScreenDismissalStateChanged() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto accessor = application_manager_.applications();
+ const auto apps = accessor.GetData();
+ for (auto& app : apps) {
+ application_manager_.SendDriverDistractionState(app);
+ }
+}
+
void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
@@ -1609,6 +1583,19 @@ void PolicyHandler::OnSystemReady() {
policy_manager_->OnSystemReady();
}
+const boost::optional<bool> PolicyHandler::LockScreenDismissalEnabledState()
+ const {
+ POLICY_LIB_CHECK(boost::optional<bool>());
+ return policy_manager_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyHandler::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ POLICY_LIB_CHECK(boost::optional<std::string>());
+ return policy_manager_->LockScreenDismissalWarningMessage(language);
+}
+
void PolicyHandler::PTUpdatedAt(Counters counter, int value) {
POLICY_LIB_CHECK_VOID();
policy_manager_->PTUpdatedAt(counter, value);
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index d325ef5b32..eaa7535385 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -98,6 +98,7 @@ const char* initial_text = "initialText";
const char* duration = "duration";
const char* progress_indicator = "progressIndicator";
const char* alert_type = "alertType";
+const char* alert_icon = "alertIcon";
const char* play_tone = "playTone";
const char* soft_buttons = "softButtons";
const char* soft_button_id = "softButtonID";
@@ -223,6 +224,7 @@ const char* key_press_mode = "keypressMode";
// duplicate names from hmi_request
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_text = "autoCompleteText";
+const char* auto_complete_list = "autoCompleteList";
const char* navigation_text = "navigationText";
// vehicle info
@@ -379,7 +381,6 @@ const char* const keyboard_layout_supported = "keyboardLayoutSupported";
const char* const keypress_mode_supported = "keypressModeSupported";
const char* const limited_characters_list_supported =
"limitedCharactersListSupported";
-const char* const auto_complete_text_supported = "autoCompleteTextSupported";
const char* const send_location_enabled = "sendLocationEnabled";
const char* const get_way_points_enabled = "getWayPointsEnabled";
const char* const entity_type = "entityType";
@@ -442,6 +443,8 @@ namespace mobile_notification {
const char* state = "state";
const char* syncp_timeout = "Timeout";
const char* syncp_url = "URL";
+const char* lock_screen_dismissal_enabled = "lockScreenDismissalEnabled";
+const char* lock_screen_dismissal_warning = "lockScreenDismissalWarning";
} // namespace mobile_notification
namespace hmi_levels {
@@ -486,7 +489,7 @@ const char* keyboard_properties = "keyboardProperties";
const char* method_name = "methodName";
const char* keyboard_layout = "keyboardLayout";
const char* limited_character_list = "limitedCharacterList";
-const char* auto_complete_text = "autoCompleteText";
+const char* auto_complete_list = "autoCompleteList";
const char* file = "file";
const char* file_name = "fileName";
const char* retry = "retry";
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index c791f58047..994c7b8b7f 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -68,7 +68,7 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr)
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
HmiStatePtr state,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
@@ -101,12 +101,17 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
static_cast<hmi_apis::Common_HMILevel::eType>(
resolved_state->hmi_level());
- if (send_activate_app) {
- const int64_t corr_id = SendBCActivateApp(app, hmi_level, true);
- if (-1 != corr_id) {
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- corr_id);
- waiting_for_activate_[app->app_id()] = resolved_state;
+ if (request_hmi_state_change) {
+ const int64_t result = RequestHMIStateChange(app, hmi_level, true);
+ if (-1 != result) {
+ const uint32_t corr_id = static_cast<uint32_t>(result);
+ subscribe_on_event(
+ hmi_apis::Common_HMILevel::NONE == hmi_level
+ ? hmi_apis::FunctionID::BasicCommunication_CloseApplication
+ : hmi_apis::FunctionID::BasicCommunication_ActivateApp,
+ corr_id);
+ waiting_for_response_[app->app_id()] = resolved_state;
+ app_mngr_.set_application_id(corr_id, app->hmi_app_id());
return;
}
LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
@@ -120,7 +125,7 @@ void StateControllerImpl::SetRegularState(
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_regular = app->RegularHmiState();
@@ -132,13 +137,13 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_regular->system_context());
- SetRegularState(app, hmi_state, send_activate_app);
+ SetRegularState(app, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
@@ -150,7 +155,7 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level));
hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level));
hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state, send_activate_app);
+ SetRegularState(app, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
@@ -159,7 +164,7 @@ void StateControllerImpl::SetRegularState(
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr hmi_state =
@@ -169,7 +174,7 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, send_activate_app);
+ SetRegularState(app, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
@@ -636,8 +641,9 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
const SmartObject& message = event.smart_object();
const FunctionID::eType id = static_cast<FunctionID::eType>(event.id());
switch (id) {
- case FunctionID::BasicCommunication_ActivateApp: {
- OnActivateAppResponse(message);
+ case FunctionID::BasicCommunication_ActivateApp:
+ case FunctionID::BasicCommunication_CloseApplication: {
+ OnHMIResponse(message);
break;
}
case FunctionID::BasicCommunication_OnAppActivated: {
@@ -791,31 +797,33 @@ void StateControllerImpl::OnApplicationRegistered(
OnStateChanged(app, initial_state, new_state);
}
-int64_t StateControllerImpl::SendBCActivateApp(
+int64_t StateControllerImpl::RequestHMIStateChange(
ApplicationConstSharedPtr app,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr bc_activate_app_request =
- MessageHelper::GetBCActivateAppRequestToHMI(
- app,
- app_mngr_.connection_handler().get_session_observer(),
- app_mngr_.GetPolicyHandler(),
- level,
- send_policy_priority,
- app_mngr_);
- if (!bc_activate_app_request) {
- LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest");
+ smart_objects::SmartObjectSPtr request = NULL;
+ if (hmi_apis::Common_HMILevel::NONE == level) {
+ request = MessageHelper::GetBCCloseApplicationRequestToHMI(app, app_mngr_);
+ } else {
+ request = MessageHelper::GetBCActivateAppRequestToHMI(
+ app,
+ app_mngr_.GetPolicyHandler(),
+ level,
+ send_policy_priority,
+ app_mngr_);
+ }
+ if (!request) {
+ LOG4CXX_ERROR(logger_, "Unable to create request");
return -1;
}
- if (!app_mngr_.GetRPCService().ManageHMICommand(bc_activate_app_request)) {
- LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateAppRequest");
+ if (!app_mngr_.GetRPCService().ManageHMICommand(request)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
return -1;
}
- const int64_t corr_id =
- (*bc_activate_app_request)[strings::params][strings::correlation_id]
- .asInt();
- return corr_id;
+ const uint32_t corr_id =
+ (*request)[strings::params][strings::correlation_id].asUInt();
+ return static_cast<int64_t>(corr_id);
}
void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
@@ -890,18 +898,18 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
SetRegularState(app, new_regular, false);
}
-void StateControllerImpl::OnActivateAppResponse(
+void StateControllerImpl::OnHMIResponse(
const smart_objects::SmartObject& message) {
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- const int32_t correlation_id =
- message[strings::params][strings::correlation_id].asInt();
+ const uint32_t correlation_id =
+ message[strings::params][strings::correlation_id].asUInt();
const uint32_t hmi_app_id = app_mngr_.application_id(correlation_id);
ApplicationSharedPtr application =
app_mngr_.application_by_hmi_app(hmi_app_id);
if (application && hmi_apis::Common_Result::SUCCESS == code) {
- HmiStatePtr pending_state = waiting_for_activate_[application->app_id()];
+ HmiStatePtr pending_state = waiting_for_response_[application->app_id()];
DCHECK_OR_RETURN_VOID(pending_state);
ApplyRegularState(application, pending_state);
}
diff --git a/src/components/application_manager/test/app_service_manager_test.cc b/src/components/application_manager/test/app_service_manager_test.cc
index 0f2b4469a2..daabdeedf4 100644
--- a/src/components/application_manager/test/app_service_manager_test.cc
+++ b/src/components/application_manager/test/app_service_manager_test.cc
@@ -60,6 +60,7 @@ const std::string kServiceType = "MEDIA";
const std::string kServiceName = "service_name";
const std::string kServiceId = "service_id";
const std::string kPolicyAppId = "p_app_id";
+const std::string kPolicyAppId2 = "p_app_id2";
const uint32_t kConnectionKey = 43629;
const uint32_t kHMIConnectionKey = 0;
@@ -83,6 +84,7 @@ class AppServiceManagerTest : public testing::Test {
public:
AppServiceManagerTest()
: mock_app_ptr_(new MockApplication)
+ , mock_app_ptr2_(new MockApplication)
, app_service_manager_(mock_app_manager_, mock_last_state_)
, mock_message_helper_(
application_manager::MockMessageHelper::message_helper_mock()) {
@@ -101,10 +103,15 @@ class AppServiceManagerTest : public testing::Test {
.WillByDefault(ReturnRef(mock_settings_));
ON_CALL(*mock_app_ptr_, policy_app_id())
.WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_ptr2_, policy_app_id())
+ .WillByDefault(Return(kPolicyAppId2));
ON_CALL(mock_last_state_, get_dictionary()).WillByDefault(ReturnRef(dict_));
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
+ auto app_ptr2 = std::static_pointer_cast<am::Application>(mock_app_ptr2_);
ON_CALL(mock_app_manager_, application(kConnectionKey))
.WillByDefault(Return(app_ptr));
+ ON_CALL(mock_app_manager_, application(kConnectionKey + 1))
+ .WillByDefault(Return(app_ptr2));
}
protected:
@@ -192,6 +199,7 @@ class AppServiceManagerTest : public testing::Test {
Json::Value dict_;
std::vector<std::string> embedded_services_;
std::shared_ptr<MockApplication> mock_app_ptr_;
+ std::shared_ptr<MockApplication> mock_app_ptr2_;
MockApplicationManager mock_app_manager_;
resumption_test::MockLastState mock_last_state_;
MockApplicationManagerSettings mock_settings_;
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index ec13137abe..29afd36e52 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -168,6 +168,8 @@ class MockMessageHelper {
hmi_apis::Common_LightName::eType(const std::string& lightName));
MOCK_METHOD1(CommonLanguageToString,
std::string(hmi_apis::Common_Language::eType));
+ MOCK_METHOD1(MobileLanguageToString,
+ std::string(mobile_apis::Language::eType));
MOCK_METHOD2(CreateModuleInfoSO,
smart_objects::SmartObjectSPtr(uint32_t function_id,
ApplicationManager& app_mngr));
@@ -201,14 +203,16 @@ class MockMessageHelper {
MessageHelper::ChoiceSetVRCommandsStatus(
const smart_objects::SmartObject&));
- MOCK_METHOD6(GetBCActivateAppRequestToHMI,
+ MOCK_METHOD5(GetBCActivateAppRequestToHMI,
smart_objects::SmartObjectSPtr(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr));
+ MOCK_METHOD2(GetBCCloseApplicationRequestToHMI,
+ smart_objects::SmartObjectSPtr(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
MOCK_METHOD2(GetOnAppInterfaceUnregisteredNotificationToMobile,
ns_smart_device_link::ns_smart_objects::SmartObjectSPtr(
int32_t connection_key,
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 0629619397..3284224237 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -366,20 +366,25 @@ std::string MessageHelper::CommonLanguageToString(
return MockMessageHelper::message_helper_mock()->CommonLanguageToString(lang);
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType lang) {
+ return MockMessageHelper::message_helper_mock()->MobileLanguageToString(lang);
+}
+
smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()->GetBCActivateAppRequestToHMI(
- app,
- session_observer,
- policy_handler,
- level,
- send_policy_priority,
- app_mngr);
+ app, policy_handler, level, send_policy_priority, app_mngr);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->GetBCCloseApplicationRequestToHMI(app, app_mngr);
}
ns_smart_device_link::ns_smart_objects::SmartObjectSPtr
@@ -589,4 +594,5 @@ void MessageHelper::BroadcastCapabilityUpdate(
MockMessageHelper::message_helper_mock()->BroadcastCapabilityUpdate(
msg_params, app_mngr);
}
+
} // namespace application_manager
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index fbada47fec..9621e20629 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -1036,7 +1036,7 @@ class StateControllerImplTest : public ::testing::Test {
(*bc_activate_app_request)[am::strings::params]
[am::strings::correlation_id] = corr_id;
ON_CALL(message_helper_mock_,
- GetBCActivateAppRequestToHMI(_, _, _, hmi_lvl, _, _))
+ GetBCActivateAppRequestToHMI(_, _, hmi_lvl, _, _))
.WillByDefault(Return(bc_activate_app_request));
ON_CALL(app_manager_mock_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
@@ -1969,12 +1969,6 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
StateLevelPair(LimitedState(), Common_HMILevel::LIMITED));
hmi_states.push_back(
StateLevelPair(BackgroundState(), Common_HMILevel::BACKGROUND));
- hmi_states.push_back(
- StateLevelPair(createHmiState(HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- VideoStreamingState::NOT_STREAMABLE,
- SystemContext::SYSCTXT_MAIN),
- Common_HMILevel::NONE));
std::vector<StateLevelPair> initial_hmi_states = hmi_states;
std::vector<StateLevelPair>::iterator it = hmi_states.begin();
std::vector<StateLevelPair>::iterator it2 = initial_hmi_states.begin();
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index 708c4ddd32..835ddedd28 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -38,6 +38,8 @@
#include <set>
#include <string>
#include <vector>
+#include "boost/optional.hpp"
+
#include "application_manager/application.h"
#include "application_manager/policies/policy_handler_observer.h"
#include "interfaces/MOBILE_API.h"
@@ -49,6 +51,7 @@
#include "smart_objects/smart_object.h"
#include "utils/callable.h"
#include "utils/custom_string.h"
+#include "utils/optional.h"
using namespace ::rpc::policy_table_interface_base;
namespace policy {
@@ -121,6 +124,10 @@ class PolicyHandlerInterface {
virtual uint32_t TimeoutExchangeMSec() const = 0;
virtual void OnExceededTimeout() = 0;
virtual void OnSystemReady() = 0;
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
virtual void PTUpdatedAt(Counters counter, int value) = 0;
virtual void add_listener(PolicyHandlerObserver* listener) = 0;
virtual void remove_listener(PolicyHandlerObserver* listener) = 0;
diff --git a/src/components/include/application_manager/state_controller.h b/src/components/include/application_manager/state_controller.h
index 753581db0e..fa0d65eb0c 100644
--- a/src/components/include/application_manager/state_controller.h
+++ b/src/components/include/application_manager/state_controller.h
@@ -43,25 +43,25 @@ class StateController {
public:
virtual void SetRegularState(ApplicationSharedPtr app,
HmiStatePtr state,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
virtual void SetRegularState(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
virtual void SetRegularState(ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
virtual void SetRegularState(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
virtual void SetRegularState(
ApplicationSharedPtr app,
@@ -82,9 +82,6 @@ class StateController {
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) = 0;
- virtual int64_t SendBCActivateApp(ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority) = 0;
/**
* @brief OnVideoStreamingStarted process video streaming started
* @param app projection or navigation application starting streaming
diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h
index 8299d019f5..c64a6d5496 100644
--- a/src/components/include/policy/policy_external/policy/policy_listener.h
+++ b/src/components/include/policy/policy_external/policy/policy_listener.h
@@ -175,6 +175,12 @@ class PolicyListener {
virtual void OnUpdateHMIStatus(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level) = 0;
+
+ /**
+ * @brief Notify Connected mobile apps about changing state of
+ * LockScreenDismissal
+ */
+ virtual void OnLockScreenDismissalStateChanged() = 0;
};
} // namespace policy
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 331b579365..aecc4b607a 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -36,6 +36,7 @@
#include <vector>
#include "utils/callable.h"
+#include "utils/optional.h"
#include "policy/access_remote.h"
#include "policy/cache_manager_interface.h"
@@ -165,6 +166,24 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual void KmsChanged(int kilometers) = 0;
/**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message. In case when specified language
+ * is absent in policy table will be returned message on default language
+ * ("en-us"). Otherwise returns uninitialized boost::optional<std::string>
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
+
+ /**
* @brief Increments counter of ignition cycles
*/
virtual void IncrementIgnitionCycles() = 0;
diff --git a/src/components/include/policy/policy_regular/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h
index 0907e42142..f12bb2e85f 100644
--- a/src/components/include/policy/policy_regular/policy/policy_listener.h
+++ b/src/components/include/policy/policy_regular/policy/policy_listener.h
@@ -157,6 +157,12 @@ class PolicyListener {
virtual void OnUpdateHMIStatus(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level) = 0;
+
+ /**
+ * @brief Notify Connected mobile apps about changing state
+ * LockScreenDismissal
+ */
+ virtual void OnLockScreenDismissalStateChanged() = 0;
};
} // namespace policy
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index f82657ef26..713f71dcdb 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -35,6 +35,7 @@
#include <cstdint>
#include <vector>
+#include "boost/optional.hpp"
#include "policy/access_remote.h"
#include "policy/cache_manager_interface.h"
@@ -43,6 +44,7 @@
#include "policy/policy_types.h"
#include "policy/usage_statistics/statistics_manager.h"
#include "utils/callable.h"
+#include "utils/optional.h"
namespace policy {
class PolicySettings;
@@ -165,6 +167,23 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual void KmsChanged(int kilometers) = 0;
/**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message
+ * @param language_code Specific language for which need message
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
+
+ /**
* @brief Increments counter of ignition cycles
*/
virtual void IncrementIgnitionCycles() = 0;
diff --git a/src/components/include/test/application_manager/mock_state_controller.h b/src/components/include/test/application_manager/mock_state_controller.h
index 5518e01383..20a84e7f00 100644
--- a/src/components/include/test/application_manager/mock_state_controller.h
+++ b/src/components/include/test/application_manager/mock_state_controller.h
@@ -49,24 +49,24 @@ class MockStateController : public am::StateController {
MOCK_METHOD3(SetRegularState,
void(am::ApplicationSharedPtr app,
am::HmiStatePtr state,
- const bool SendActivateApp));
+ const bool request_hmi_state_change));
MOCK_METHOD5(SetRegularState,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp));
+ const bool request_hmi_state_change));
MOCK_METHOD3(SetRegularState,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp));
+ const bool request_hmi_state_change));
MOCK_METHOD6(SetRegularState,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp));
+ const bool request_hmi_state_change));
MOCK_METHOD2(SetRegularState,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType hmi_level));
@@ -82,7 +82,7 @@ class MockStateController : public am::StateController {
MOCK_METHOD2(OnApplicationRegistered,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level));
- MOCK_METHOD3(SendBCActivateApp,
+ MOCK_METHOD3(RequestHMIStateChange,
int64_t(am::ApplicationConstSharedPtr app,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority));
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index 059442f424..342debca0a 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -109,6 +109,10 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(OnExceededTimeout, void());
MOCK_METHOD0(OnSystemReady, void());
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
MOCK_METHOD1(add_listener, void(policy::PolicyHandlerObserver* listener));
MOCK_METHOD1(remove_listener, void(policy::PolicyHandlerObserver* listener));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
index 6f754ad2c9..0a6bef45dd 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -110,6 +110,10 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
policy_table::AppServiceParameters* app_service_parameters));
MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_CONST_METHOD1(GetDeviceConsent,
DeviceConsent(const std::string& device_id));
MOCK_METHOD2(SetDeviceConsent,
@@ -120,11 +124,11 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_CONST_METHOD1(GetCachedDeviceConsent,
DeviceConsent(const std::string& device_id));
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
- MOCK_METHOD3(GetUserFriendlyMsg,
- std::vector<UserFriendlyMessage>(
- const std::vector<std::string>& msg_codes,
- const std::string& language,
- const std::string& active_hmi_language));
+ MOCK_CONST_METHOD3(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language,
+ const std::string& active_hmi_language));
MOCK_METHOD2(GetUpdateUrls,
void(const std::string& service_type,
EndpointUrls& out_end_points));
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
index 1e42423a03..e6ee086b31 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
@@ -103,6 +103,7 @@ class MockPolicyListener : public ::policy::PolicyListener {
void(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level));
+ MOCK_METHOD0(OnLockScreenDismissalStateChanged, void());
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index 7ebf73ae54..309e357235 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -77,6 +77,10 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(ResetUserConsent, bool());
MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string());
MOCK_METHOD1(KmsChanged, void(int kilometers));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD0(IncrementIgnitionCycles, void());
MOCK_METHOD0(ForcePTExchange, std::string());
MOCK_METHOD0(ForcePTExchangeAtUserRequest, std::string());
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
index dacdaf202f..c296701e34 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -91,11 +91,15 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD2(SetHybridAppPreference,
void(const std::string& policy_app_id,
const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
- MOCK_METHOD2(GetUserFriendlyMsg,
- std::vector<UserFriendlyMessage>(
- const std::vector<std::string>& msg_codes,
- const std::string& language));
+ MOCK_CONST_METHOD2(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language));
MOCK_CONST_METHOD2(
GetAppServiceParameters,
void(const std::string& policy_app_id,
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
index f409100a49..7958bd3304 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
@@ -96,6 +96,7 @@ class MockPolicyListener : public ::policy::PolicyListener {
void(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level));
+ MOCK_METHOD0(OnLockScreenDismissalStateChanged, void());
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 73bf2d387b..a670e99bef 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -78,6 +78,10 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(ResetUserConsent, bool());
MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string());
MOCK_METHOD1(KmsChanged, void(int kilometers));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD0(IncrementIgnitionCycles, void());
MOCK_METHOD0(ForcePTExchange, std::string());
MOCK_METHOD0(ForcePTExchangeAtUserRequest, std::string());
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index dc8b19cd53..d21718e66d 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -116,6 +116,27 @@
<element name="SOURCE" />
<element name="SHUFFLE" />
<element name="REPEAT" />
+
+ <!-- Navigation Subscription Buttons -->
+ <element name="NAV_CENTER_LOCATION" />
+ <element name="NAV_ZOOM_IN" />
+ <element name="NAV_ZOOM_OUT" />
+ <element name="NAV_PAN_UP" />
+ <element name="NAV_PAN_UP_RIGHT" />
+ <element name="NAV_PAN_RIGHT" />
+ <element name="NAV_PAN_DOWN_RIGHT" />
+ <element name="NAV_PAN_DOWN" />
+ <element name="NAV_PAN_DOWN_LEFT" />
+ <element name="NAV_PAN_LEFT" />
+ <element name="NAV_PAN_UP_LEFT" />
+ <element name="NAV_TILT_TOGGLE">
+ <description>If supported, this toggles between a top-down view and an angled/3D view. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
+ <element name="NAV_ROTATE_CLOCKWISE" />
+ <element name="NAV_ROTATE_COUNTERCLOCKWISE" />
+ <element name="NAV_HEADING_TOGGLE">
+ <description>If supported, this toggles between locking the orientation to north or to the vehicle's heading. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
</enum>
<enum name="ButtonEventMode">
@@ -670,6 +691,9 @@
<element name="locationImage">
<description>The optional image of a destination / location</description>
</element>
+ <element name="alertIcon">
+ <description>The image field for Alert</description>
+ </element>
</enum>
<enum name="TextAlignment">
@@ -2915,8 +2939,11 @@
<description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
<description>If omitted, the entire keyboard will be enabled.</description>
</param>
- <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
- <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
+ <param name="autoCompleteList" type="String" maxlength="1000" minsize="0" maxsize="100" array="true" mandatory="false">
+ <description>
+ Allows an app to prepopulate the text field with a list of suggested or completed entries as the user types.
+ If empty, the auto-complete list will be removed from the screen.
+ </description>
</param>
</struct>
@@ -4013,6 +4040,14 @@
</function>
<function name="ActivateApp" messagetype="response">
</function>
+ <function name="CloseApplication" messagetype="request">
+ <description>Request from the application to exit the foreground.</description>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of selected application.</description>
+ </param>
+ </function>
+ <function name="CloseApplication" messagetype="response">
+ </function>
<function name="OnAppActivated" messagetype="notification">
<description>Must be sent by HU system when the user clicks on app in the list of registered apps or on soft button with 'STEAL_FOCUS' action.</description>
<param name="appID" type="Integer" mandatory="true">
@@ -4611,6 +4646,12 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application requested this RPC.</description>
</param>
+ <param name="alertIcon" type="Common.Image" mandatory="false" >
+ <description>
+ Image to be displayed for the corresponding alert. See Image.
+ If omitted, no (or the default if applicable) icon should be displayed.
+ </description>
+ </param>
</function>
<function name="Alert" messagetype="response">
<param name="tryAgainTime" type="Integer" mandatory="false" minvalue="0" maxvalue="2000000000">
@@ -6368,7 +6409,10 @@
<interface name="AppService" version="1.0.0" date="2019-03-18">
<description>Interface used for interacting with app services as a producer or consumer</description>
<function name="PublishAppService" messagetype="request">
- <description>Registers a service offered by this app on the module</description>
+ <description>
+ Registers a service offered by this app on the module.
+ Subsequent calls with the same service type will update the manifest for that service.
+ </description>
<param name="appServiceManifest" type="Common.AppServiceManifest" mandatory="true">
<description> The manifest of the service that wishes to be published.</description>
@@ -6383,6 +6427,18 @@
</param>
</function>
+ <function name="UnpublishAppService" messagetype="request">
+ <description>Unpublish an existing service published by the HMI.</description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> The ID of the service to be unpublished. </description>
+ </param>
+ </function>
+
+ <function name="UnpublishAppService" messagetype="response">
+ <description>The response to UnpublishAppService</description>
+ </function>
+
<function name="OnAppServiceData" messagetype="notification">
<description>This notification includes the data that is updated from the specific service. HMI->SDL if the HMI is a producer, SDL->HMI if the HMI is a consumer</description>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index ec92d14b08..0166f10f52 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -623,6 +623,26 @@
<element name="SOURCE" since="4.5" />
<element name="SHUFFLE" since="4.5" />
<element name="REPEAT" since="4.5" />
+ <!-- Navigation Buttons -->
+ <element name="NAV_CENTER_LOCATION" since="6.0" />
+ <element name="NAV_ZOOM_IN" since="6.0" />
+ <element name="NAV_ZOOM_OUT" since="6.0" />
+ <element name="NAV_PAN_UP" since="6.0" />
+ <element name="NAV_PAN_UP_RIGHT" since="6.0" />
+ <element name="NAV_PAN_RIGHT" since="6.0" />
+ <element name="NAV_PAN_DOWN_RIGHT" since="6.0" />
+ <element name="NAV_PAN_DOWN" since="6.0" />
+ <element name="NAV_PAN_DOWN_LEFT" since="6.0" />
+ <element name="NAV_PAN_LEFT" since="6.0" />
+ <element name="NAV_PAN_UP_LEFT" since="6.0" />
+ <element name="NAV_TILT_TOGGLE" since="6.0" >
+ <description>If supported, this toggles between a top-down view and an angled/3D view. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
+ <element name="NAV_ROTATE_CLOCKWISE" since="6.0" />
+ <element name="NAV_ROTATE_COUNTERCLOCKWISE" since="6.0" />
+ <element name="NAV_HEADING_TOGGLE" since="6.0" >
+ <description>If supported, this toggles between locking the orientation to north or to the vehicle's heading. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
</enum>
<enum name="MediaClockFormat" since="1.0">
@@ -875,7 +895,11 @@
<element name="locationImage" since="4.0">
<description>The optional image of a destination / location</description>
</element>
-
+
+ <element name="alertIcon" since="6.0">
+ <description>The image field for Alert</description>>
+ </element>
+
</enum>
<enum name="CharacterSet" since="1.0">
@@ -2387,25 +2411,34 @@
<description>Configuration of on-screen keyboard (if available).</description>
<param name="language" type="Language" mandatory="false">
<description>The keyboard language.</description>
- </param>
+ </param>
<param name="keyboardLayout" type="KeyboardLayout" mandatory="false" >
<description>Desired keyboard layout.</description>
- </param>
+ </param>
<param name="keypressMode" type="KeypressMode" mandatory="false" >
<description>
Desired keypress mode.
If omitted, this value will be set to RESEND_CURRENT_ENTRY.
</description>
- </param>
+ </param>
<param name="limitedCharacterList" type="String" maxlength="1" minsize="1" maxsize="100" array="true" mandatory="false">
<description>Array of keyboard characters to enable.</description>
<description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
<description>If omitted, the entire keyboard will be enabled.</description>
- </param>
- <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
- <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
- </param>
- </struct>
+ </param>
+ <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false" deprecated="true" since="6.0">
+ <description>Deprecated, use autoCompleteList instead.</description>
+ <history>
+ <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false" since="3.0" until="6.0" />
+ </history>
+ </param>
+ <param name="autoCompleteList" type="String" maxlength="1000" minsize="0" maxsize="100" array="true" mandatory="false" since="6.0">
+ <description>
+ Allows an app to prepopulate the text field with a list of suggested or completed entries as the user types.
+ If empty, the auto-complete list will be removed from the screen.
+ </description>
+ </param>
+ </struct>
<struct name="DeviceInfo" since="3.0">
<description>Various information about connecting device.</description>
@@ -2656,6 +2689,8 @@
<element name="GetAppServiceDataID" value="53" hexvalue="35" since="5.1" />
<element name="GetFileID" value="54" hexvalue="36" since="5.1" />
<element name="PerformAppServiceInteractionID" value="55" hexvalue="37" since="5.1" />
+ <element name="UnpublishAppServiceID" value="56" hexvalue="38" since="6.0" />
+ <element name="CloseApplicationID" value="58" hexvalue="3A" since="6.0" />
<!--
Base Notifications
@@ -4935,6 +4970,13 @@
If omitted on supported displays, the displayed alert shall not have any SoftButtons.
</description>
</param>
+
+ <param name="alertIcon" type="Image" mandatory="false" since="6.0">
+ <description>
+ Image struct determining whether static or dynamic icon.
+ If omitted on supported displays, no (or the default if applicable) icon should be displayed.
+ </description>
+ </param>
</function>
@@ -7243,10 +7285,16 @@
</function>
<function name="PublishAppService" functionID="PublishAppServiceID" messagetype="request" since="5.1">
- <description>Registers a service offered by this app on the module</description>
+ <description>
+ Registers a service offered by this app on the module.
+ Subsequent calls with the same service type will update the manifest for that service.
+ </description>
<param name="appServiceManifest" type="AppServiceManifest" mandatory="true">
- <description> The manifest of the service that wishes to be published.</description>
+ <description>
+ The manifest of the service that wishes to be published.
+ If already published, the updated manifest for this service.
+ </description>
</param>
</function>
@@ -7278,6 +7326,38 @@
</param>
</function>
+ <function name="UnpublishAppService" functionID="UnpublishAppServiceID" messagetype="request" since="6.0">
+ <description> Unpublish an existing service published by this application. </description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> The ID of the service to be unpublished. </description>
+ </param>
+ </function>
+
+ <function name="UnpublishAppService" functionID="UnpublishAppServiceID" messagetype="response" since="6.0">
+ <description> The response to UnpublishAppService </description>
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true, if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="DISALLOWED"/>
+ <element name="INVALID_DATA"/>
+ <element name="INVALID_ID"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
<function name="GetAppServiceData" functionID="GetAppServiceDataID" messagetype="request" since="5.1">
<description> This request asks the module for current data related to the specific service. It also includes an option to subscribe to that service for future updates</description>
@@ -7353,6 +7433,28 @@
</param>
</function>
+ <function name="CloseApplication" functionID="CloseApplicationID" messagetype="request" since="6.0">
+ <description>Request from the application to exit the foreground and enter HMI_NONE.</description>
+ </function>
+
+ <function name="CloseApplication" functionID="CloseApplicationID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed </description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <element name="SUCCESS"/>
+ <element name="DISALLOWED"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="IGNORED"/>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
<!-- Notifications -->
<function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification" since="1.0">
@@ -7524,6 +7626,21 @@
<param name="state" type="DriverDistractionState" mandatory="true">
<description>Current State of Driver Distraction</description>
</param>
+ <param name="lockScreenDismissalEnabled" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ If enabled, the lock screen will be able to be dismissed while connected to SDL, allowing users
+ the ability to interact with the app. Dismissals should include a warning to the user and ensure
+ that they are not the driver.
+ </description>
+ </param>
+ <param name="lockScreenDismissalWarning" type="String" mandatory="false" since="6.0">
+ <description>
+ Warning message to be displayed on the lock screen when dismissal is enabled.
+ This warning should be used to ensure that the user is not the driver of the vehicle,
+ ex. `Swipe down to dismiss, acknowledging that you are not the driver.`.
+ This parameter must be present if "lockScreenDismissalEnabled" is set to true.
+ </description>
+ </param>
</function>
<function name="OnPermissionsChange" functionID="OnPermissionsChangeID" messagetype="notification" since="2.0">
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h
index 15eb51565d..19a475371d 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_CACHE_MANAGER_H_
#include <map>
+#include "boost/optional.hpp"
#include "policy/cache_manager_interface.h"
#include "policy/pt_ext_representation.h"
@@ -158,6 +159,11 @@ class CacheManager : public CacheManagerInterface {
*/
virtual const VehicleInfo GetVehicleInfo() const;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
/**
* @brief Get a list of enabled cloud applications
* @param enabled_apps List filled with the policy app id of each enabled
@@ -283,7 +289,7 @@ class CacheManager : public CacheManagerInterface {
std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
- const std::string& active_hmi_language);
+ const std::string& active_hmi_language) const;
/**
* @brief GetLockScreenIcon allows to obtain lock screen icon url;
diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
index 980ad42dcd..0cbbb6df1f 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
@@ -35,6 +35,7 @@
#include <string>
#include <vector>
+#include "boost/optional.hpp"
#include "policy/policy_table/types.h"
#include "policy/pt_representation.h"
@@ -270,6 +271,24 @@ class CacheManagerInterface {
const std::string& policy_app_id) const = 0;
/**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message. In case when specified language
+ * is absent in policy table will be returned message on default language
+ * ("en-us"). Otherwise returns uninitialized boost::optional<std::string>
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
+
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -290,7 +309,7 @@ class CacheManagerInterface {
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
- const std::string& active_hmi_language) = 0;
+ const std::string& active_hmi_language) const = 0;
/**
* @brief Get list of URL to send PTS to
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 2f8f6cf070..9dd2b3c6ec 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -148,6 +148,11 @@ class PolicyManagerImpl : public PolicyManager {
*/
void KmsChanged(int kilometers) OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
/**
* @brief Increments counter of ignition cycles
*/
@@ -851,6 +856,17 @@ class PolicyManagerImpl : public PolicyManager {
const std::shared_ptr<policy_table::Table> snapshot);
/**
+ * @brief Compares current policies to the updated one.
+ * Trigger actions in case if certain fields after udate was changes.
+ * This function should be called after PT update.
+ * Actions require already updated policy table
+ * @param update Shared pointer to policy table udpate
+ * @param snapshot Shared pointer to old copy of policy table
+ */
+ void CheckPermissionsChangesAfterUpdate(const policy_table::Table& update,
+ const policy_table::Table& snapshot);
+
+ /**
* @brief Processes results from policy table update analysis done by
* CheckPermissionsChanges() by filling ApplicationsPoliciesActions struct
* with actions which should be done for every application and passes them to
diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h
index 28b0caf95b..ad16d6e59d 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h
@@ -472,6 +472,16 @@ enum FunctionID {
PerformAppServiceInteractionID = 55,
/**
+ * @brief UnpublishAppServiceID.
+ */
+ UnpublishAppServiceID = 56,
+
+ /**
+ * @brief CloseApplicationID.
+ */
+ CloseApplicationID = 58,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h
index 994fd86579..8795e2690f 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/types.h
@@ -364,6 +364,7 @@ struct ModuleConfig : CompositeType {
Optional<String<0, 65535> > certificate;
Optional<Boolean> preloaded_pt;
Optional<Boolean> full_app_id_supported;
+ Optional<Boolean> lock_screen_dismissal_enabled;
public:
ModuleConfig();
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index bd38f7bf8f..4170e7aaa6 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1561,10 +1561,44 @@ bool CacheManager::UnknownRPCPassthroughAllowed(
return false;
}
+const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState()
+ const {
+ boost::optional<bool> empty;
+ CACHE_MANAGER_CHECK(empty);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+ policy_table::ModuleConfig& module_config = pt_->policy_table.module_config;
+ if (module_config.lock_screen_dismissal_enabled.is_initialized()) {
+ return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled);
+ }
+ return empty;
+}
+
+const boost::optional<std::string>
+CacheManager::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ boost::optional<std::string> empty;
+ CACHE_MANAGER_CHECK(empty);
+
+ const std::string lock_screen_dismissal_warning_message =
+ "LockScreenDismissalWarning";
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ std::vector<std::string> msg_codes{lock_screen_dismissal_warning_message};
+
+ const auto messages = GetUserFriendlyMsg(msg_codes, language, "en-us");
+
+ if (messages.empty() || messages[0].text_body.empty()) {
+ return empty;
+ }
+
+ return boost::optional<std::string>(messages[0].text_body);
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
- const std::string& active_hmi_language) {
+ const std::string& active_hmi_language) const {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<UserFriendlyMessage> result;
CACHE_MANAGER_CHECK(result);
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 15900f0187..42b67734ae 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -491,6 +491,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
ProcessAppPolicyCheckResults(
results, pt_update->policy_table.app_policies_section.apps);
+ CheckPermissionsChangesAfterUpdate(*pt_update, *policy_table_snapshot);
+
listener_->OnCertificateUpdated(
*(pt_update->policy_table.module_config.certificate));
@@ -538,6 +540,17 @@ CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
return out_results;
}
+void PolicyManagerImpl::CheckPermissionsChangesAfterUpdate(
+ const policy_table::Table& update, const policy_table::Table& snapshot) {
+ const auto new_lock_screen_dismissal_enabled =
+ update.policy_table.module_config.lock_screen_dismissal_enabled;
+ const auto old_lock_screen_dismissal_enabled =
+ snapshot.policy_table.module_config.lock_screen_dismissal_enabled;
+ if (new_lock_screen_dismissal_enabled != old_lock_screen_dismissal_enabled) {
+ listener()->OnLockScreenDismissalStateChanged();
+ }
+}
+
void PolicyManagerImpl::ProcessAppPolicyCheckResults(
const CheckAppPolicyResults& results,
const policy_table::ApplicationPolicies& app_policies) {
@@ -1738,6 +1751,19 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
}
}
+const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyManagerImpl::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->LockScreenDismissalWarningMessage(language);
+}
+
void PolicyManagerImpl::IncrementIgnitionCycles() {
cache_->IncrementIgnitionCycles();
}
diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc
index bb25623b35..6dc4d53aa1 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -1159,6 +1159,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("UnpublishAppService" == literal) {
+ *result = UnpublishAppServiceID;
+ return true;
+ }
+
+ if ("CloseApplication" == literal) {
+ *result = CloseApplicationID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;
diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc
index ca3f8a1648..d39b3f7623 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -788,8 +788,9 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
, preloaded_date(impl::ValueMember(value__, "preloaded_date"))
, certificate(impl::ValueMember(value__, "certificate"))
, preloaded_pt(impl::ValueMember(value__, "preloaded_pt"))
- , full_app_id_supported(
- impl::ValueMember(value__, "full_app_id_supported")) {}
+ , full_app_id_supported(impl::ValueMember(value__, "full_app_id_supported"))
+ , lock_screen_dismissal_enabled(
+ impl::ValueMember(value__, "lock_screen_dismissal_enabled")) {}
void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
exchange_after_x_days = from.exchange_after_x_days;
@@ -801,6 +802,7 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
endpoints = from.endpoints;
notifications_per_minute_by_priority =
from.notifications_per_minute_by_priority;
+ lock_screen_dismissal_enabled = from.lock_screen_dismissal_enabled;
certificate.assign_if_valid(from.certificate);
vehicle_make.assign_if_valid(from.vehicle_make);
@@ -834,6 +836,9 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField("vehicle_year", vehicle_year, &result__);
impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("preloaded_date", preloaded_date, &result__);
+ impl::WriteJsonField("lock_screen_dismissal_enabled",
+ lock_screen_dismissal_enabled,
+ &result__);
return result__;
}
@@ -883,6 +888,9 @@ bool ModuleConfig::is_valid() const {
if (!preloaded_date.is_valid()) {
return false;
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -925,6 +933,9 @@ bool ModuleConfig::struct_empty() const {
if (notifications_per_minute_by_priority.is_initialized()) {
return false;
}
+ if (lock_screen_dismissal_enabled.is_initialized()) {
+ return false;
+ }
if (vehicle_make.is_initialized()) {
return false;
}
@@ -979,6 +990,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
notifications_per_minute_by_priority.ReportErrors(
&report__->ReportSubobject("notifications_per_minute_by_priority"));
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ lock_screen_dismissal_enabled.ReportErrors(
+ &report__->ReportSubobject("lock_screen_dismissal_enabled"));
+ }
if (!vehicle_make.is_valid()) {
vehicle_make.ReportErrors(&report__->ReportSubobject("vehicle_make"));
}
@@ -1037,6 +1052,7 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
seconds_between_retries.SetPolicyTableType(pt_type);
endpoints.SetPolicyTableType(pt_type);
notifications_per_minute_by_priority.SetPolicyTableType(pt_type);
+ lock_screen_dismissal_enabled.SetPolicyTableType(pt_type);
vehicle_make.SetPolicyTableType(pt_type);
vehicle_model.SetPolicyTableType(pt_type);
vehicle_year.SetPolicyTableType(pt_type);
diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc
index f4cac214a5..5592fdecd8 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -76,7 +76,8 @@ const std::string kCreateSchema =
" `vehicle_model` VARCHAR(45), "
" `vehicle_year` VARCHAR(4), "
" `preloaded_date` VARCHAR (10), "
- " `certificate` VARCHAR (45) "
+ " `certificate` VARCHAR (45), "
+ " `lock_screen_dismissal_enabled` BOOL"
"); "
"CREATE TABLE IF NOT EXISTS `functional_group`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
@@ -459,7 +460,7 @@ const std::string kInsertInitData =
" VALUES (0, 0, 0, 0); "
"INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,"
" `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, "
- " `exchange_after_x_days`, `timeout_after_x_seconds`) "
+ " `exchange_after_x_days`, `timeout_after_x_seconds`)"
" VALUES(1, 0, 0, 0, 0, 0); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); "
@@ -734,7 +735,7 @@ const std::string kUpdateModuleConfig =
" `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
" `timeout_after_x_seconds` = ?, `vehicle_make` = ?, "
" `vehicle_model` = ?, `vehicle_year` = ?, `preloaded_date` = ?, "
- " `certificate` = ? ";
+ " `certificate` = ?, lock_screen_dismissal_enabled = ?";
const std::string kInsertEndpoint =
"INSERT INTO `endpoint` (`service`, `url`, `application_id`) "
@@ -785,7 +786,8 @@ const std::string kSelectModuleConfig =
"SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
" `exchange_after_x_kilometers`, `exchange_after_x_days`, "
" `timeout_after_x_seconds`, `vehicle_make`,"
- " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate` "
+ " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate`, "
+ " `lock_screen_dismissal_enabled` "
" FROM `module_config`";
const std::string kSelectEndpoints =
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index 1bb0cf0fa1..d5950f9d42 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -552,6 +552,9 @@ void SQLPTRepresentation::GatherModuleConfig(
*config->vehicle_year = query.GetString(7);
*config->preloaded_date = query.GetString(8);
*config->certificate = query.GetString(9);
+ if (!query.IsNull(10)) {
+ *config->lock_screen_dismissal_enabled = query.GetBoolean(10);
+ }
}
utils::dbms::SQLQuery endpoints(db());
@@ -1412,6 +1415,10 @@ bool SQLPTRepresentation::SaveModuleConfig(
config.certificate.is_initialized() ? query.Bind(9, *(config.certificate))
: query.Bind(9);
+ config.lock_screen_dismissal_enabled.is_initialized()
+ ? query.Bind(10, *(config.lock_screen_dismissal_enabled))
+ : query.Bind(10);
+
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect update module config");
return false;
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h
index 30732f685c..1c28b596c0 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -146,6 +146,10 @@ class CacheManager : public CacheManagerInterface {
*/
virtual const VehicleInfo GetVehicleInfo() const;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
/**
* @brief Get a list of enabled cloud applications
* @param enabled_apps List filled with the policy app id of each enabled
@@ -267,7 +271,8 @@ class CacheManager : public CacheManagerInterface {
* @return Array of appropriate messages parameters
*/
std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language);
+ const std::vector<std::string>& msg_codes,
+ const std::string& language) const;
/**
* @brief Get list of URLs related to particular service
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
index da15a4ecab..e8f2644bc5 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
@@ -35,11 +35,13 @@
#include <string>
#include <vector>
+#include "boost/optional.hpp"
#include "policy/policy_settings.h"
#include "policy/policy_table/types.h"
#include "policy/policy_types.h"
#include "policy/usage_statistics/counter.h"
+#include "utils/optional.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -255,6 +257,23 @@ class CacheManagerInterface {
const std::string& policy_app_id) const = 0;
/**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message. In case when specified language
+ * is absent in policy table will be returned message on default language
+ * ("en-us"). Otherwise returns uninitialized boost::optional<std::string>
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language_code) const = 0;
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -274,7 +293,7 @@ class CacheManagerInterface {
*/
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
- const std::string& language) = 0;
+ const std::string& language) const = 0;
/**
* @brief Get list of URLs related to particular service
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index 1860f7e591..13d19e1a41 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -162,6 +162,11 @@ class PolicyManagerImpl : public PolicyManager {
*/
void KmsChanged(int kilometers) OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
/**
* @brief Increments counter of ignition cycles
*/
@@ -820,6 +825,17 @@ class PolicyManagerImpl : public PolicyManager {
const std::shared_ptr<policy_table::Table> snapshot);
/**
+ * @brief Compares current policies to the updated one.
+ * Trigger actions in case if certain fields after update were changed.
+ * This function should be called after PT update.
+ * Actions require already updated policy table
+ * @param update Shared pointer to policy table update
+ * @param snapshot Shared pointer to old copy of policy table
+ */
+ void CheckPermissionsChangesAfterUpdate(const policy_table::Table& update,
+ const policy_table::Table& snapshot);
+
+ /**
* @brief Fill structure to be sent with OnPermissionsChanged notification
*
* @param Policy table struct, which contains rpc functional groups data
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
index 679950277d..ad1d05f59b 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
@@ -457,6 +457,16 @@ enum FunctionID {
PerformAppServiceInteractionID = 55,
/**
+ * @brief UnpublishAppServiceID.
+ */
+ UnpublishAppServiceID = 56,
+
+ /**
+ * @brief CloseApplicationID.
+ */
+ CloseApplicationID = 58,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h
index e41069a86c..c2a8f901ad 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h
@@ -302,6 +302,7 @@ struct ModuleConfig : CompositeType {
Optional<String<4, 4> > vehicle_year;
Optional<String<0, 10> > preloaded_date;
Optional<String<0, 65535> > certificate;
+ Optional<Boolean> lock_screen_dismissal_enabled;
public:
ModuleConfig();
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 94ce52b6f1..d121886765 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -856,8 +856,47 @@ bool CacheManager::UnknownRPCPassthroughAllowed(
return false;
}
+const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ boost::optional<bool> empty;
+ CACHE_MANAGER_CHECK(empty);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+ policy_table::ModuleConfig& module_config = pt_->policy_table.module_config;
+ if (module_config.lock_screen_dismissal_enabled.is_initialized()) {
+ LOG4CXX_TRACE(logger_,
+ "state = " << *module_config.lock_screen_dismissal_enabled);
+ return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled);
+ }
+ LOG4CXX_TRACE(logger_, "state = empty");
+ return empty;
+}
+
+const boost::optional<std::string>
+CacheManager::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ boost::optional<std::string> empty;
+ CACHE_MANAGER_CHECK(empty);
+
+ const std::string lock_screen_dismissal_warning_message =
+ "LockScreenDismissalWarning";
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ std::vector<std::string> msg_codes{lock_screen_dismissal_warning_message};
+
+ const auto messages = GetUserFriendlyMsg(msg_codes, language);
+
+ if (messages.empty() || messages[0].text_body.empty()) {
+ return empty;
+ }
+
+ return boost::optional<std::string>(messages[0].text_body);
+}
+
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language) {
+ const std::vector<std::string>& msg_codes,
+ const std::string& language) const {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<UserFriendlyMessage> result;
CACHE_MANAGER_CHECK(result);
@@ -903,6 +942,12 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
UserFriendlyMessage msg;
msg.message_code = *it;
+ msg.tts = *message_string.tts;
+ msg.label = *message_string.label;
+ msg.line1 = *message_string.line1;
+ msg.line2 = *message_string.line2;
+ msg.text_body = *message_string.textBody;
+
result.push_back(msg);
}
return result;
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 0884fc53b6..00a3d33379 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -356,6 +356,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
ForcePTExchange();
return false;
}
+ CheckPermissionsChangesAfterUpdate(*pt_update, *policy_table_snapshot);
listener_->OnCertificateUpdated(
*(pt_update->policy_table.module_config.certificate));
@@ -390,7 +391,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
void PolicyManagerImpl::CheckPermissionsChanges(
const std::shared_ptr<policy_table::Table> pt_update,
const std::shared_ptr<policy_table::Table> snapshot) {
- LOG4CXX_INFO(logger_, "Checking incoming permissions.");
+ LOG4CXX_AUTO_TRACE(logger_);
// Replace predefined policies with its actual setting, e.g. "123":"default"
// to actual values of default section
@@ -401,6 +402,17 @@ void PolicyManagerImpl::CheckPermissionsChanges(
CheckAppPolicy(this, pt_update, snapshot));
}
+void PolicyManagerImpl::CheckPermissionsChangesAfterUpdate(
+ const policy_table::Table& update, const policy_table::Table& snapshot) {
+ const auto new_lock_screen_dismissal_enabled =
+ update.policy_table.module_config.lock_screen_dismissal_enabled;
+ const auto old_lock_screen_dismissal_enabled =
+ snapshot.policy_table.module_config.lock_screen_dismissal_enabled;
+ if (new_lock_screen_dismissal_enabled != old_lock_screen_dismissal_enabled) {
+ listener()->OnLockScreenDismissalStateChanged();
+ }
+}
+
void PolicyManagerImpl::PrepareNotificationData(
const policy_table::FunctionalGroupings& groups,
const policy_table::Strings& group_names,
@@ -1068,6 +1080,17 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
}
}
+const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState()
+ const {
+ return cache_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyManagerImpl::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ return cache_->LockScreenDismissalWarningMessage(language);
+}
+
void PolicyManagerImpl::IncrementIgnitionCycles() {
cache_->IncrementIgnitionCycles();
}
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index 421ccacded..8fc5b0b369 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -859,6 +859,10 @@ bool IsValidEnum(FunctionID val) {
return true;
case PerformAppServiceInteractionID:
return true;
+ case UnpublishAppServiceID:
+ return true;
+ case CloseApplicationID:
+ return true;
case OnHMIStatusID:
return true;
case OnAppInterfaceUnregisteredID:
@@ -1022,6 +1026,10 @@ const char* EnumToJsonString(FunctionID val) {
return "GetAppServiceData";
case PerformAppServiceInteractionID:
return "PerformAppServiceInteraction";
+ case UnpublishAppServiceID:
+ return "UnpublishAppService";
+ case CloseApplicationID:
+ return "CloseApplication";
case OnHMIStatusID:
return "OnHMIStatus";
case OnAppInterfaceUnregisteredID:
@@ -1346,6 +1354,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("UnpublishAppService" == literal) {
+ *result = UnpublishAppServiceID;
+ return true;
+ }
+
+ if ("CloseApplication" == literal) {
+ *result = CloseApplicationID;
+ return true;
+ }
+
if ("OnHMIStatus" == literal) {
*result = OnHMIStatusID;
return true;
diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc
index bdf1329dee..7fdfde996c 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -678,7 +678,9 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
, vehicle_model(impl::ValueMember(value__, "vehicle_model"))
, vehicle_year(impl::ValueMember(value__, "vehicle_year"))
, preloaded_date(impl::ValueMember(value__, "preloaded_date"))
- , certificate(impl::ValueMember(value__, "certificate")) {}
+ , certificate(impl::ValueMember(value__, "certificate"))
+ , lock_screen_dismissal_enabled(
+ impl::ValueMember(value__, "lock_screen_dismissal_enabled")) {}
void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
// device_certificates = from.device_certificates; // According to the
@@ -692,6 +694,8 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
notifications_per_minute_by_priority =
from.notifications_per_minute_by_priority;
+ lock_screen_dismissal_enabled = from.lock_screen_dismissal_enabled;
+
vehicle_make.assign_if_valid(from.vehicle_make);
vehicle_model.assign_if_valid(from.vehicle_model);
vehicle_year.assign_if_valid(from.vehicle_year);
@@ -723,6 +727,9 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField("vehicle_year", vehicle_year, &result__);
impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("preloaded_date", preloaded_date, &result__);
+ impl::WriteJsonField("lock_screen_dismissal_enabled",
+ lock_screen_dismissal_enabled,
+ &result__);
return result__;
}
@@ -754,6 +761,9 @@ bool ModuleConfig::is_valid() const {
if (!notifications_per_minute_by_priority.is_valid()) {
return false;
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ return false;
+ }
if (!vehicle_make.is_valid()) {
return false;
}
@@ -808,6 +818,9 @@ bool ModuleConfig::struct_empty() const {
if (notifications_per_minute_by_priority.is_initialized()) {
return false;
}
+ if (lock_screen_dismissal_enabled.is_initialized()) {
+ return false;
+ }
if (vehicle_make.is_initialized()) {
return false;
}
@@ -863,6 +876,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
notifications_per_minute_by_priority.ReportErrors(
&report__->ReportSubobject("notifications_per_minute_by_priority"));
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ lock_screen_dismissal_enabled.ReportErrors(
+ &report__->ReportSubobject("lock_screen_dismissal_enabled"));
+ }
if (!vehicle_make.is_valid()) {
vehicle_make.ReportErrors(&report__->ReportSubobject("vehicle_make"));
}
@@ -902,6 +919,7 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
seconds_between_retries.SetPolicyTableType(pt_type);
endpoints.SetPolicyTableType(pt_type);
notifications_per_minute_by_priority.SetPolicyTableType(pt_type);
+ lock_screen_dismissal_enabled.SetPolicyTableType(pt_type);
vehicle_make.SetPolicyTableType(pt_type);
vehicle_model.SetPolicyTableType(pt_type);
vehicle_year.SetPolicyTableType(pt_type);
diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc
index a97b0ab153..b3816d37f8 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -71,7 +71,8 @@ const std::string kCreateSchema =
" `certificate` TEXT, "
" `vehicle_make` VARCHAR(45), "
" `vehicle_model` VARCHAR(45), "
- " `vehicle_year` VARCHAR(4) "
+ " `vehicle_year` VARCHAR(4), "
+ " `lock_screen_dismissal_enabled` BOOL"
"); "
"CREATE TABLE IF NOT EXISTS `functional_group`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
@@ -419,7 +420,7 @@ const std::string kInsertInitData =
" VALUES (0, 0, 0, 0); "
"INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,"
" `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, "
- " `exchange_after_x_days`, `timeout_after_x_seconds`) "
+ " `exchange_after_x_days`, `timeout_after_x_seconds`)"
" VALUES(1, 0, 0, 0, 0, 0); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); "
@@ -674,15 +675,17 @@ const std::string kInsertLanguage =
"INSERT OR IGNORE INTO `language` (`code`) VALUES (?)";
const std::string kInsertMessageString =
- "INSERT INTO `message` (`language_code`, `message_type_name`) "
- "VALUES (?, ?)";
+ "INSERT INTO `message` (`language_code`, `message_type_name`, `tts`, "
+ "`label`, `line1`, `line2`, `textBody`) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?)";
const std::string kUpdateModuleConfig =
"UPDATE `module_config` SET `preloaded_pt` = ?, "
" `exchange_after_x_ignition_cycles` = ?,"
" `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
" `timeout_after_x_seconds` = ?, `certificate` = ?, `vehicle_make` = ?, "
- " `vehicle_model` = ?, `vehicle_year` = ? ";
+ " `vehicle_model` = ?, `vehicle_year` = ?, lock_screen_dismissal_enabled "
+ "= ?";
const std::string kInsertEndpoint =
"INSERT INTO `endpoint` (`service`, `url`, `application_id`) "
@@ -722,7 +725,7 @@ const std::string kSelectModuleConfig =
"SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
" `exchange_after_x_kilometers`, `exchange_after_x_days`, "
" `timeout_after_x_seconds`, `certificate`, `vehicle_make`,"
- " `vehicle_model`, `vehicle_year` "
+ " `vehicle_model`, `vehicle_year` ,`lock_screen_dismissal_enabled`"
" FROM `module_config`";
const std::string kSelectEndpoints =
@@ -907,6 +910,5 @@ const std::string kSaveModuleMeta =
"`ignition_cycles_since_last_exchange` = ? ";
const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`";
-
} // namespace sql_pt
} // namespace policy
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 20ba9ec651..8ac04ba5f3 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -525,7 +525,9 @@ void SQLPTRepresentation::GatherModuleConfig(
*config->vehicle_make = query.GetString(6);
*config->vehicle_model = query.GetString(7);
*config->vehicle_year = query.GetString(8);
- *config->preloaded_date = query.GetString(9);
+ if (!query.IsNull(9)) {
+ *config->lock_screen_dismissal_enabled = query.GetBoolean(9);
+ }
}
utils::dbms::SQLQuery endpoints(db());
@@ -1365,6 +1367,9 @@ bool SQLPTRepresentation::SaveModuleConfig(
: query.Bind(7);
config.vehicle_year.is_initialized() ? query.Bind(8, *(config.vehicle_year))
: query.Bind(8);
+ config.lock_screen_dismissal_enabled.is_initialized()
+ ? query.Bind(9, *(config.lock_screen_dismissal_enabled))
+ : query.Bind(9);
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect update module config");
return false;
@@ -1519,6 +1524,25 @@ bool SQLPTRepresentation::SaveMessageString(
query.Bind(0, lang);
query.Bind(1, type);
+ if (strings.tts.is_valid() && strings.tts.is_initialized()) {
+ query.Bind(2, (*strings.tts));
+ }
+
+ if (strings.label.is_valid() && strings.label.is_initialized()) {
+ query.Bind(3, (*strings.label));
+ }
+
+ if (strings.line1.is_valid() && strings.line1.is_initialized()) {
+ query.Bind(4, *(strings.line1));
+ }
+
+ if (strings.line2.is_valid() && strings.line2.is_initialized()) {
+ query.Bind(5, (*strings.line2));
+ }
+
+ if (strings.textBody.is_valid() && strings.textBody.is_initialized()) {
+ query.Bind(6, (*strings.textBody));
+ }
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into message.");