summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Vaganov <nvaganov@luxoft.com>2014-10-08 18:00:23 +0400
committerNikita Vaganov <nvaganov@luxoft.com>2014-10-08 18:00:23 +0400
commita0d905097cb7a5851a5628f447969d0ef0a11d88 (patch)
tree534f48b457597aef715d6bf3abe9fc4595adc329
parent94a710479924ba22ca133c3a491bf44a191b4a0e (diff)
parent87259f84ab14fa2508605c7b8a36730fdd3b910b (diff)
downloadsmartdevicelink-a0d905097cb7a5851a5628f447969d0ef0a11d88.tar.gz
Merge branch 'develop' into APPLINK-9492
-rw-r--r--customer-specific/pasa/src/appMain/smartDeviceLink.ini3
-rw-r--r--customer-specific/pasa/src/makefile3
-rw-r--r--src/3rd_party/CMakeLists.txt1
-rw-r--r--src/appMain/life_cycle.cc3
-rw-r--r--src/appMain/signal_handlers.cc5
-rw-r--r--src/appMain/smartDeviceLink.ini3
-rw-r--r--src/components/HMI/app/model/sdl/MediaModel.js4
-rw-r--r--src/components/HMI/app/model/sdl/Model.js2
-rw-r--r--src/components/HMI/app/model/sdl/NonMediaModel.js4
-rw-r--r--src/components/HMI/app/model/sdl/VehicleInfoModel.js39
-rw-r--r--src/components/application_manager/include/application_manager/application.h28
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h11
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h34
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h9
-rw-r--r--src/components/application_manager/include/application_manager/message.h6
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h14
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_event_observer.h2
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h48
-rw-r--r--src/components/application_manager/include/application_manager/usage_statistics.h4
-rw-r--r--src/components/application_manager/src/application_impl.cc27
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc119
-rw-r--r--src/components/application_manager/src/commands/hmi/get_urls.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc28
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc129
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc16
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc19
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_request.cc5
-rw-r--r--src/components/application_manager/src/message.cc25
-rw-r--r--src/components/application_manager/src/message_helper.cc119
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc2
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc2
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc217
-rw-r--r--src/components/application_manager/src/policies/policy_retry_sequence.cc16
-rw-r--r--src/components/application_manager/src/policies/pt_exchange_handler_ext.cc14
-rw-r--r--src/components/application_manager/src/policies/pt_exchange_handler_impl.cc5
-rw-r--r--src/components/application_manager/src/request_controller.cc8
-rw-r--r--src/components/application_manager/src/resume_ctrl.cpp47
-rw-r--r--src/components/application_manager/src/usage_statistics.cc5
-rw-r--r--src/components/config_profile/include/config_profile/profile.h7
-rw-r--r--src/components/config_profile/src/profile.cc23
-rw-r--r--src/components/include/protocol/raw_message.h13
-rw-r--r--src/components/include/utils/threads/thread_delegate.h2
-rw-r--r--src/components/include/utils/timer_thread.h53
-rw-r--r--src/components/interfaces/HMI_API.xml3
-rw-r--r--src/components/media_manager/include/media_manager/socket_streamer_adapter.h3
-rw-r--r--src/components/media_manager/src/socket_streamer_adapter.cc100
-rw-r--r--src/components/policy/src/policy/include/policy/cache_manager.h11
-rw-r--r--src/components/policy/src/policy/include/policy/policy_manager.h7
-rw-r--r--src/components/policy/src/policy/include/policy/policy_manager_impl.h2
-rw-r--r--src/components/policy/src/policy/include/policy/policy_types.h1
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct_ext/enums.cc8
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct_ext/enums.h2
-rw-r--r--src/components/policy/src/policy/src/cache_manager.cc43
-rw-r--r--src/components/policy/src/policy/src/policy_manager_impl.cc35
-rw-r--r--src/components/policy/src/policy/src/sql_pt_ext_representation.cc2
-rw-r--r--src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h18
-rw-r--r--src/components/policy/src/policy/usage_statistics/src/counter.cc10
-rw-r--r--src/components/protocol/CMakeLists.txt1
-rw-r--r--src/components/protocol/src/raw_message.cc13
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_packet.h10
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc17
-rw-r--r--src/components/protocol_handler/src/protocol_packet.cc20
-rw-r--r--src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml1
-rw-r--r--src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml4
-rw-r--r--src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml4
-rw-r--r--src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml4
-rw-r--r--src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml3
-rw-r--r--src/components/security_manager/CMakeLists.txt1
-rw-r--r--src/components/smart_objects/src/object_schema_item.cc6
-rw-r--r--src/components/utils/src/conditional_variable_posix.cc2
-rw-r--r--src/components/utils/src/threads/posix_thread.cc2
-rw-r--r--test/components/smart_objects/SchemaItem/test_CObjectSchemaItem.cpp15
73 files changed, 1041 insertions, 444 deletions
diff --git a/customer-specific/pasa/src/appMain/smartDeviceLink.ini b/customer-specific/pasa/src/appMain/smartDeviceLink.ini
index dbf12c964..d16740c88 100644
--- a/customer-specific/pasa/src/appMain/smartDeviceLink.ini
+++ b/customer-specific/pasa/src/appMain/smartDeviceLink.ini
@@ -90,6 +90,9 @@ HelpPromt = Please speak one of the following commands,Please say a command
; Default prompt items, separated by comma
TimeOutPromt = Please speak one of the following commands,Please say a command
HelpTitle = Available Vr Commands List
+; In case mobile app didn't send global properties default global properties will be sent after this timeout
+; max value TTSGlobalPropertiesTimeout 64K
+TTSGlobalPropertiesTimeout = 20
[FILESYSTEM RESTRICTIONS]
; Max allowed number of PutFile requests for one application in NONE
diff --git a/customer-specific/pasa/src/makefile b/customer-specific/pasa/src/makefile
index 28450ccff..4226633bc 100644
--- a/customer-specific/pasa/src/makefile
+++ b/customer-specific/pasa/src/makefile
@@ -86,8 +86,7 @@ clean lint metrics:
$(MAKE) -C components/interfaces OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/utils/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/smart_objects/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
- $(MAKE) -C components/config_profile/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
- $(MAKE) -C components/request_watchdog/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
+ $(MAKE) -C components/config_profile/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/hmi_message_handler/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/formatters/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
$(MAKE) -C components/connection_handler/src OPTIMIZATION=NONE TARGET_FLG=-Vgcc_ntoarmv7le_gpp $@
diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt
index 7697abc06..32b25b2a3 100644
--- a/src/3rd_party/CMakeLists.txt
+++ b/src/3rd_party/CMakeLists.txt
@@ -56,6 +56,7 @@ set(EXPAT_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE)
# --- libapr-1
add_subdirectory(apr-cmake)
+set(APR_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include PARENT_SCOPE)
set(APR_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE)
# --- apr-util
diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc
index 8ae94ac50..30783a52a 100644
--- a/src/appMain/life_cycle.cc
+++ b/src/appMain/life_cycle.cc
@@ -373,7 +373,9 @@ bool LifeCycle::InitMessageSystem() {
#endif // CUSTOMER_PASA
void LifeCycle::StopComponents() {
+ LOG4CXX_TRACE(logger_, "enter");
if (components_started == false) {
+ LOG4CXX_TRACE(logger_, "exit");
LOG4CXX_ERROR(logger_, "Components wasn't started");
return;
}
@@ -490,6 +492,7 @@ void LifeCycle::StopComponents() {
}
#endif // TIME_TESTER
components_started =false;
+ LOG4CXX_TRACE(logger_, "exit");
}
} // namespace main_namespace
diff --git a/src/appMain/signal_handlers.cc b/src/appMain/signal_handlers.cc
index 06684a860..51757358e 100644
--- a/src/appMain/signal_handlers.cc
+++ b/src/appMain/signal_handlers.cc
@@ -32,14 +32,17 @@
#include "signal_handlers.h"
#include "life_cycle.h"
+#include "utils/logger.h"
namespace main_namespace {
+CREATE_LOGGERPTR_GLOBAL(logger_, "SmartDeviceLinkMainApp")
void dummy_signal_handler(int32_t signal) {
}
void legacy_signal_handler(int32_t signal) {
+ LOG4CXX_TRACE(logger_, "legacy_signal_handler get signal " << signal);
LifeCycle::instance()->StopComponents();
}
-} // namespace main_namespace
+} // namespace main_namespace
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index 28beae9ed..1c8a48405 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -83,6 +83,9 @@ HelpPromt = Please speak one of the following commands,Please say a command
; Default prompt items, separated by comma
TimeOutPromt = Please speak one of the following commands,Please say a command
HelpTitle = Available Vr Commands List
+; In case mobile app didn't send global properties default global properties will be sent after this timeout
+; max value TTSGlobalPropertiesTimeout 64K
+TTSGlobalPropertiesTimeout = 20
[FILESYSTEM RESTRICTIONS]
; Max allowed number of PutFile requests for one application in NONE
diff --git a/src/components/HMI/app/model/sdl/MediaModel.js b/src/components/HMI/app/model/sdl/MediaModel.js
index 033ab0576..b51156d2f 100644
--- a/src/components/HMI/app/model/sdl/MediaModel.js
+++ b/src/components/HMI/app/model/sdl/MediaModel.js
@@ -40,7 +40,9 @@ SDL.SDLMediaModel = SDL.SDLAppModel.extend({
var subscribeVIData = {};
for (var key in SDL.SDLVehicleInfoModel.vehicleData) {
- subscribeVIData[key] = false;
+ if (key != "externalTemperature") {
+ subscribeVIData[key] = false;
+ }
}
this.set('subscribedData', subscribeVIData);
diff --git a/src/components/HMI/app/model/sdl/Model.js b/src/components/HMI/app/model/sdl/Model.js
index 432e6030a..f2ad26187 100644
--- a/src/components/HMI/app/model/sdl/Model.js
+++ b/src/components/HMI/app/model/sdl/Model.js
@@ -1070,6 +1070,8 @@ SDL.SDLModel = Em.Object.create({
}
if (params[i].autoCompleteText) {
SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.autoCompleteText', params[i].autoCompleteText);
+ } else {
+ SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.keyboardProperties.autoCompleteText', '');
}
} else {
SDL.SDLController.getApplicationModel(params.appID).set('globalProperties.' + i, params[i]);
diff --git a/src/components/HMI/app/model/sdl/NonMediaModel.js b/src/components/HMI/app/model/sdl/NonMediaModel.js
index ffb7ebcd0..d9a14b32f 100644
--- a/src/components/HMI/app/model/sdl/NonMediaModel.js
+++ b/src/components/HMI/app/model/sdl/NonMediaModel.js
@@ -40,7 +40,9 @@ SDL.SDLNonMediaModel = SDL.SDLAppModel.extend({
var subscribeVIData = {};
for (var key in SDL.SDLVehicleInfoModel.vehicleData) {
- subscribeVIData[key] = false;
+ if (key != "externalTemperature") {
+ subscribeVIData[key] = false;
+ }
}
this.set('subscribedData', subscribeVIData);
diff --git a/src/components/HMI/app/model/sdl/VehicleInfoModel.js b/src/components/HMI/app/model/sdl/VehicleInfoModel.js
index 3b8962021..f2b896190 100644
--- a/src/components/HMI/app/model/sdl/VehicleInfoModel.js
+++ b/src/components/HMI/app/model/sdl/VehicleInfoModel.js
@@ -103,6 +103,7 @@ SDL.SDLVehicleInfoModel = Em.Object
"fuelLevel_State": "VEHICLEDATA_FUELLEVEL_STATE",
"instantFuelConsumption": "VEHICLEDATA_FUELCONSUMPTION",
"prndl": "VEHICLEDATA_PRNDL",
+ "externalTemperature": "VEHICLEDATA_EXTERNTEMP",
"tirePressure": "VEHICLEDATA_TIREPRESSURE",
"odometer": "VEHICLEDATA_ODOMETER",
"beltStatus": "VEHICLEDATA_BELTSTATUS",
@@ -363,27 +364,27 @@ SDL.SDLVehicleInfoModel = Em.Object
var subscribeVIData = {};
for (var key in message.params) {
- if (key != 'appID' && SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key]) {
+
+ if (key === "clusterModeStatus") {
+ key = "clusterModes";
+ }
+
+ if (key != 'appID' && SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] === true) {
subscribeVIData[key] = {
dataType: this.eVehicleDataType[key],
resultCode: "DATA_ALREADY_SUBSCRIBED"
};
- } else if (key != 'appID' && !SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] && key !== "clusterModeStatus") {
- SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = message.params[key];
+ } else if (key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData) {
+ SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = true;
subscribeVIData[key] = {
dataType: this.eVehicleDataType[key],
resultCode: "SUCCESS"
};
- } else if (key != 'appID' && message.params[key] && key !== "clusterModeStatus") {
+ } else if (key === "externalTemperature") {
subscribeVIData[key] = {
dataType: this.eVehicleDataType[key],
resultCode: "VEHICLE_DATA_NOT_AVAILABLE"
- }
- } else if (key === "clusterModeStatus") {
- subscribeVIData["clusterModes"] = {
- dataType: this.eVehicleDataType["clusterModes"],
- resultCode: "SUCCESS"
- }
+ };
}
}
}
@@ -400,28 +401,28 @@ SDL.SDLVehicleInfoModel = Em.Object
var subscribeVIData = {};
for (var key in message.params) {
- if (key != 'appID' && !SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key]) {
+
+ if (key === "clusterModeStatus") {
+ key = "clusterModes";
+ }
+
+ if (key != 'appID' && SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] === false) {
SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = false;
subscribeVIData[key] = {
dataType: this.eVehicleDataType[key],
resultCode: "DATA_NOT_SUBSCRIBED"
};
- } else if (key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData && key !== "clusterModeStatus") {
+ } else if (key != 'appID' && key in SDL.SDLController.getApplicationModel(message.params.appID).subscribedData) {
SDL.SDLController.getApplicationModel(message.params.appID).subscribedData[key] = false;
subscribeVIData[key] = {
dataType: this.eVehicleDataType[key],
resultCode: "SUCCESS"
};
- } else if (key != 'appID' && message.params[key] && key !== "clusterModeStatus") {
+ } else if (key === "externalTemperature") {
subscribeVIData[key] = {
dataType: this.eVehicleDataType[key],
resultCode: "VEHICLE_DATA_NOT_AVAILABLE"
- }
- } else if (key === "clusterModeStatus") {
- subscribeVIData["clusterModes"] = {
- dataType: this.eVehicleDataType["clusterModes"],
- resultCode: "SUCCESS"
- }
+ };
}
}
}
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index a6256eb8a..82492928d 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -418,6 +418,34 @@ class Application : public virtual InitialApplicationData,
virtual connection_handler::DeviceHandle device() const = 0;
virtual void set_tts_speak_state(bool state_tts_speak) = 0;
virtual bool tts_speak_state() = 0;
+ /**
+ * @brief sets true if application has sent TTS GlobalProperties
+ * request with empty array help_prompt to HMI with level
+ * NONE BACKGROUND
+ * @param active contains state of sending TTS GlobalProperties
+ */
+ virtual void set_tts_properties_in_none(
+ bool active) = 0;
+ /**
+ * @brief returns true if application has sent TTS GlobalProperties
+ * otherwise return false
+ * @return flag tts_properties_in_none
+ */
+ virtual bool tts_properties_in_none() = 0;
+ /**
+ * @brief sets true if application has sent TTS GlobalProperties
+ * request with default array help_prompt to HMI with level
+ * FULL LIMITED
+ * @param active contains state of sending TTS GlobalProperties
+ */
+ virtual void set_tts_properties_in_full(
+ bool active) = 0;
+ /**
+ * @brief returns true if application has sent TTS GlobalProperties
+ * otherwise return false
+ * @return flag tts_properties_in_full
+ */
+ virtual bool tts_properties_in_full() = 0;
virtual void set_version(const Version& version) = 0;
virtual void set_name(const std::string& name) = 0;
virtual void set_is_media_application(bool is_media) = 0;
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index b6fa9e41f..80d5f1d9b 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -1,4 +1,4 @@
-/**
+/**
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -57,7 +57,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
ApplicationImpl(uint32_t application_id,
const std::string& mobile_app_id,
const std::string& app_name,
- usage_statistics::StatisticsManager* statistics_manager);
+ usage_statistics::StatisticsManager* const & statistics_manager);
~ApplicationImpl();
@@ -97,6 +97,10 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
connection_handler::DeviceHandle device() const;
void set_tts_speak_state(bool state_tts_speak);
bool tts_speak_state();
+ void set_tts_properties_in_none(bool active);
+ bool tts_properties_in_none();
+ void set_tts_properties_in_full(bool active);
+ bool tts_properties_in_full();
void set_version(const Version& ver);
void set_name(const std::string& name);
void set_is_media_application(bool is_media);
@@ -185,7 +189,8 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
bool is_app_allowed_;
bool has_been_activated_;
bool tts_speak_state_;
-
+ bool tts_properties_in_none_;
+ bool tts_properties_in_full_;
mobile_api::HMILevel::eType hmi_level_;
uint32_t put_file_in_none_count_;
uint32_t delete_file_in_none_count_;
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index e3f2b8b0a..14505a829 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -578,6 +578,28 @@ class ApplicationManagerImpl : public ApplicationManager,
bool IsHMICooperating() const;
/**
+ * @brief Method used to send default app tts globalProperties
+ * in case they were not provided from mobile side after defined time
+ */
+ void OnTimerSendTTSGlobalProperties();
+
+ /**
+ * @brief method adds application
+ * to tts_global_properties_app_list_
+ * @param app_id contains application which will
+ * send TTS global properties after timeout
+ */
+ void AddAppToTTSGlobalPropertiesList(const uint32_t app_id);
+
+ /**
+ * @brief method removes application
+ * from tts_global_properties_app_list_
+ * @param app_id contains application which will
+ * send TTS global properties after timeout
+ */
+ void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id);
+
+ /**
* Function used only by HMI request/response/notification base classes
* to change HMI app id to Mobile app id and vice versa.
* Dot use it inside Core
@@ -708,8 +730,15 @@ class ApplicationManagerImpl : public ApplicationManager,
*/
std::map<const int32_t, const uint32_t> appID_list_;
+ /**
+ * @brief Map contains applications which
+ * will send TTS global properties to HMI after timeout
+ */
+ std::map<uint32_t, TimevalStruct> tts_global_properties_app_list_;
+
bool audio_pass_thru_active_;
sync_primitives::Lock audio_pass_thru_lock_;
+ sync_primitives::Lock tts_global_properties_app_list_lock_;
bool is_distracting_driver_;
bool is_vr_session_strated_;
bool hmi_cooperating_;
@@ -718,7 +747,6 @@ class ApplicationManagerImpl : public ApplicationManager,
hmi_message_handler::HMIMessageHandler* hmi_handler_;
connection_handler::ConnectionHandler* connection_handler_;
- policy::PolicyManager* policy_manager_;
protocol_handler::ProtocolHandler* protocol_handler_;
request_controller::RequestController request_ctrl_;
@@ -767,6 +795,8 @@ class ApplicationManagerImpl : public ApplicationManager,
typedef utils::SharedPtr<ApplicationListUpdateTimer> ApplicationListUpdateTimerSptr;
ApplicationListUpdateTimerSptr application_list_update_timer_;
+ timer::TimerThread<ApplicationManagerImpl> tts_global_properties_timer_;
+
DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl);
FRIEND_BASE_SINGLETON_CLASS(ApplicationManagerImpl);
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h
index 4ee646e19..ce85a7017 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h
@@ -194,6 +194,15 @@ class PerformInteractionRequest : public CommandRequestImpl {
*/
void TerminatePerformInteraction();
+ /**
+ * @brief Checks parameter ChoiceID from response.
+ * @param app contains pointer to application
+ * @param choice_id contains ChoiceID from response.
+ * @return if ChoiceID from response is correct method returns TRUE
+ * otherwise returns FALSE.
+ */
+ bool CheckChoiceIDFromResponse(ApplicationSharedPtr app, int32_t choice_id);
+
// members
timer::TimerThread<PerformInteractionRequest> timer_;
diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h
index b23c93d45..d92c89adf 100644
--- a/src/components/application_manager/include/application_manager/message.h
+++ b/src/components/application_manager/include/application_manager/message.h
@@ -86,6 +86,8 @@ class Message {
const std::string& json_message() const;
const BinaryData* binary_data() const;
bool has_binary_data() const;
+ size_t data_size() const;
+ size_t payload_size() const;
const smart_objects::SmartObject& smart_object() const;
//! --------------------------------------------------------------------------
@@ -97,6 +99,8 @@ class Message {
void set_json_message(const std::string& json_message);
void set_protocol_version(ProtocolVersion version);
void set_smart_object(const smart_objects::SmartObject& object);
+ void set_data_size(size_t data_size);
+ void set_payload_size(size_t payload_size);
protocol_handler::MessagePriority Priority() const { return priority_; }
@@ -115,6 +119,8 @@ class Message {
// TODO(akandul): replace with shared_ptr
BinaryData* binary_data_;
+ size_t data_size_;
+ size_t payload_size_;
ProtocolVersion version_;
};
} // namespace application_manager
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 3a2d91a24..f0dc12ab8 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -457,6 +457,20 @@ class MessageHelper {
*/
static uint32_t GetAppCommandLimit(const std::string& policy_app_id);
+ /**
+ * @brief Creates TTS.SetGlobalProperties request and sends
+ * to HMI for VCA module.
+ * @param app contains application which sends TTS GlobalProperties to HMI
+ * after timeout or first time when application register with level NONE or
+ * BACKGROUND
+ * @param default_help_prompt
+ * if default_help_prompt=TRUE->TTSGlobalProperties request will be created with
+ * default helpPrompt array, otherwise TTSGlobalProperties request will be created
+ * with empty helpPrompt array.
+ */
+ static void SendTTSGlobalProperties(
+ ApplicationSharedPtr app, bool default_help_prompt);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/policies/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/policy_event_observer.h
index 401f4d491..3244f7b07 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_event_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_event_observer.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
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 f715a2c48..7814a79c7 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
@@ -42,6 +42,7 @@
#include "application_manager/policies/pt_exchange_handler.h"
#include "utils/logger.h"
#include "utils/singleton.h"
+#include "usage_statistics/statistics_manager.h"
namespace Json {
class Value;
@@ -56,10 +57,10 @@ class PolicyHandler :
public PolicyListener {
public:
virtual ~PolicyHandler();
- PolicyManager* LoadPolicyLibrary();
- PolicyManager* policy_manager() const {
+ bool LoadPolicyLibrary();
+ /*PolicyManager* policy_manager() const {
return policy_manager_;
- }
+ }*/
bool PolicyEnabled();
bool InitPolicyTable();
bool ResetPolicyTable();
@@ -73,6 +74,47 @@ class PolicyHandler :
const Permissions& permissions,
const HMILevel& default_hmi);
+ bool GetPriority(const std::string& policy_app_id, std::string* priority);
+ void CheckPermissions(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ CheckPermissionResult& result);
+
+ uint32_t GetNotificationsNumber(const std::string& priority);
+ DeviceConsent GetUserConsentForDevice(const std::string& device_id);
+ bool GetDefaultHmi(const std::string& policy_app_id,
+ std::string* default_hmi);
+ bool GetInitialAppData(const std::string& application_id,
+ StringArray* nicknames = NULL,
+ StringArray* app_hmi_types = NULL);
+ EndpointUrls GetUpdateUrls(int service_type);
+ void ResetRetrySequence();
+ int NextRetryTimeout();
+ int TimeoutExchange();
+ void OnExceededTimeout();
+ BinaryMessageSptr RequestPTUpdate();
+ const std::vector<int> RetrySequenceDelaysSeconds();
+
+ usage_statistics::StatisticsManager* const & GetStatisticManager();
+
+ /**
+ * Checks system action of application for permission of keep context
+ * @param system_action system action (see mobile api)
+ * @param policy_app_id unique application id
+ * @return false if system_action is KEEP_CONTEXT and it isn't allowed by policy
+ * otherwise true
+ */
+ bool CheckKeepContext(int system_action, const std::string& policy_app_id);
+
+ /**
+ * Checks system action of application for permission of steal focus
+ * @param system_action system action (see mobile api)
+ * @param policy_app_id unique application id
+ * @return false if system_action is STEAL_FOCUS and it isn't allowed by policy
+ * otherwise true
+ */
+ bool CheckStealFocus(int system_action, const std::string& policy_app_id);
+
/**
* Lets client to notify PolicyHandler that more kilometers expired
* @param kms New value of odometer
diff --git a/src/components/application_manager/include/application_manager/usage_statistics.h b/src/components/application_manager/include/application_manager/usage_statistics.h
index 188a3646f..08e17a834 100644
--- a/src/components/application_manager/include/application_manager/usage_statistics.h
+++ b/src/components/application_manager/include/application_manager/usage_statistics.h
@@ -1,4 +1,4 @@
-/**
+/**
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -42,7 +42,7 @@ namespace application_manager {
class UsageStatistics {
public:
UsageStatistics(const std::string& app_id,
- usage_statistics::StatisticsManager* statistics_manager);
+ usage_statistics::StatisticsManager* const& statistics_manager);
void RecordHmiStateChanged(mobile_apis::HMILevel::eType new_hmi_level);
void RecordAppRegistrationGuiLanguage(
mobile_apis::Language::eType gui_language);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index e307d2fb5..f65a77cda 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -1,4 +1,4 @@
-/**
+/**
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -74,11 +74,10 @@ namespace application_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
-ApplicationImpl::ApplicationImpl(
- uint32_t application_id,
+ApplicationImpl::ApplicationImpl(uint32_t application_id,
const std::string& mobile_app_id,
const std::string& app_name,
- usage_statistics::StatisticsManager* statistics_manager)
+ usage_statistics::StatisticsManager* const & statistics_manager)
: grammar_id_(0),
app_id_(application_id),
active_message_(NULL),
@@ -88,6 +87,8 @@ ApplicationImpl::ApplicationImpl(
is_app_allowed_(true),
has_been_activated_(false),
tts_speak_state_(false),
+ tts_properties_in_none_(false),
+ tts_properties_in_full_(false),
hmi_level_(mobile_api::HMILevel::HMI_NONE),
put_file_in_none_count_(0),
delete_file_in_none_count_(0),
@@ -247,6 +248,24 @@ bool ApplicationImpl::tts_speak_state() {
return tts_speak_state_;
}
+void ApplicationImpl::set_tts_properties_in_none(
+ bool active) {
+ tts_properties_in_none_ = active;
+}
+
+bool ApplicationImpl::tts_properties_in_none() {
+ return tts_properties_in_none_;
+}
+
+void ApplicationImpl::set_tts_properties_in_full(
+ bool active) {
+ tts_properties_in_full_ = active;
+}
+
+bool ApplicationImpl::tts_properties_in_full() {
+ return tts_properties_in_full_;
+}
+
void ApplicationImpl::set_hmi_level(
const mobile_api::HMILevel::eType& hmi_level) {
if (mobile_api::HMILevel::HMI_NONE != hmi_level_ &&
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 148d089d4..69be25935 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -78,7 +78,6 @@ ApplicationManagerImpl::ApplicationManagerImpl()
media_manager_(NULL),
hmi_handler_(NULL),
connection_handler_(NULL),
- policy_manager_(policy::PolicyHandler::instance()->LoadPolicyLibrary()),
protocol_handler_(NULL),
request_ctrl_(),
hmi_so_factory_(NULL),
@@ -93,7 +92,11 @@ ApplicationManagerImpl::ApplicationManagerImpl()
#ifdef TIME_TESTER
metric_observer_(NULL),
#endif // TIME_TESTER
- application_list_update_timer_(new ApplicationListUpdateTimer(this)) {
+ application_list_update_timer_(new ApplicationListUpdateTimer(this)),
+ tts_global_properties_timer_("TTSGLPRTimer",
+ this,
+ &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties,
+ true) {
std::srand(std::time(0));
}
@@ -101,8 +104,6 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
LOG4CXX_INFO(logger_, "Destructing ApplicationManager.");
SendOnSDLClose();
-
- policy_manager_ = NULL;
media_manager_ = NULL;
hmi_handler_ = NULL;
connection_handler_ = NULL;
@@ -116,12 +117,13 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
mobile_so_factory_ = NULL;
protocol_handler_ = NULL;
media_manager_ = NULL;
+ LOG4CXX_INFO(logger_, "Destroying Policy Handler");
+ policy::PolicyHandler::destroy();
}
bool ApplicationManagerImpl::Stop() {
LOG4CXX_INFO(logger_, "Stop ApplicationManager.");
application_list_update_timer_->stop();
-
try {
UnregisterAllApplications();
} catch (...) {
@@ -131,10 +133,8 @@ bool ApplicationManagerImpl::Stop() {
#ifndef CUSTOMER_PASA
// for PASA customer policy backup should happen OnExitAllApp(SUSPEND)
- if (policy_manager_) {
- LOG4CXX_INFO(logger_, "Unloading policy library.");
- policy::PolicyHandler::instance()->UnloadPolicyLibrary();
- }
+ LOG4CXX_INFO(logger_, "Unloading policy library.");
+ policy::PolicyHandler::instance()->UnloadPolicyLibrary();
#endif
return true;
}
@@ -296,11 +296,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
const std::string& app_name =
message[strings::msg_params][strings::app_name].asString();
+ usage_statistics::StatisticsManager* const& sm =
+ policy::PolicyHandler::instance()->GetStatisticManager();
ApplicationSharedPtr application(
- new ApplicationImpl(app_id, mobile_app_id, app_name, policy_manager_));
+ new ApplicationImpl(app_id, mobile_app_id, app_name,sm));
if (!application) {
usage_statistics::AppCounter count_of_rejections_sync_out_of_memory(
- policy_manager_, mobile_app_id,
+ sm, mobile_app_id,
usage_statistics::REJECTIONS_SYNC_OUT_OF_MEMORY);
++count_of_rejections_sync_out_of_memory;
@@ -312,7 +314,6 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
ManageMobileCommand(response);
return ApplicationSharedPtr();
}
-
application->set_device(device_id);
application->set_grammar_id(GenerateGrammarID());
mobile_api::Language::eType launguage_desired =
@@ -1368,7 +1369,7 @@ bool ApplicationManagerImpl::ManageHMICommand(
bool ApplicationManagerImpl::Init() {
LOG4CXX_TRACE(logger_, "Init application manager");
if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- if(!policy_manager_) {
+ if(!policy::PolicyHandler::instance()->LoadPolicyLibrary()) {
LOG4CXX_ERROR(logger_, "Policy library is not loaded. Check LD_LIBRARY_PATH");
return false;
}
@@ -1454,6 +1455,17 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
output[strings::params][strings::protocol_version] =
message.protocol_version();
if (message.binary_data()) {
+ if (message.payload_size() < message.data_size()) {
+ LOG4CXX_ERROR(logger_, "Incomplete binary" <<
+ " binary size should be " << message.data_size() <<
+ " payload data size is " << message.payload_size());
+ utils::SharedPtr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ message.connection_key(), message.function_id(),
+ message.correlation_id(), mobile_apis::Result::INVALID_DATA));
+ ManageMobileCommand(response);
+ return false;
+ }
output[strings::params][strings::binary_data] =
*(message.binary_data());
}
@@ -1475,9 +1487,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
return false;
}
if (output.validate() != smart_objects::Errors::OK) {
- LOG4CXX_WARN(
- logger_,
- "Incorrect parameter from HMI");
+ LOG4CXX_WARN(logger_, "Incorrect parameter from HMI");
output.erase(strings::msg_params);
output[strings::params][hmi_response::code] =
hmi_apis::Common_Result::INVALID_DATA;
@@ -1822,10 +1832,8 @@ void ApplicationManagerImpl::HeadUnitReset(
void ApplicationManagerImpl::HeadUnitSuspend() {
LOG4CXX_INFO(logger_, "ApplicationManagerImpl::HeadUnitSuspend");
#ifdef CUSTOMER_PASA
- if (policy_manager_) {
- LOG4CXX_INFO(logger_, "Unloading policy library.");
- policy::PolicyHandler::instance()->UnloadPolicyLibrary();
- }
+ LOG4CXX_INFO(logger_, "Unloading policy library.");
+ policy::PolicyHandler::instance()->UnloadPolicyLibrary();
resume_controller().SaveAllApplications();
resumption::LastState::instance()->SaveToFileSystem();
@@ -1924,6 +1932,8 @@ void ApplicationManagerImpl::UnregisterApplication(
bool is_resuming, bool is_unexpected_disconnect) {
LOG4CXX_INFO(logger_,
"ApplicationManagerImpl::UnregisterApplication " << app_id);
+ //remove appID from tts_global_properties_app_list_
+ RemoveAppFromTTSGlobalPropertiesList(app_id);
sync_primitives::AutoLock lock(applications_list_lock_);
@@ -2068,10 +2078,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
if (!policy::PolicyHandler::instance()->PolicyEnabled()) {
return mobile_apis::Result::SUCCESS;
}
- if (!policy_manager_ ) {
- LOG4CXX_WARN(logger_, "Policy library is not loaded.");
- return mobile_apis::Result::DISALLOWED;
- }
+
const std::string stringified_functionID =
MessageHelper::StringifiedFunctionID(function_id);
const std::string stringified_hmi_level =
@@ -2082,7 +2089,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
" in " << stringified_hmi_level <<
" rpc " << stringified_functionID);
policy::CheckPermissionResult result;
- policy_manager_->CheckPermissions(
+ policy::PolicyHandler::instance()->CheckPermissions(
policy_app_id,
stringified_hmi_level,
stringified_functionID,
@@ -2276,4 +2283,64 @@ void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
SendUpdateAppList(applications_ids);
}
+void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
+ std::vector<uint32_t> app_list;
+ {
+ sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
+ std::map<uint32_t, TimevalStruct>::iterator it =
+ tts_global_properties_app_list_.begin();
+ std::map<uint32_t, TimevalStruct>::iterator it_end =
+ tts_global_properties_app_list_.end();
+ date_time::TimeCompare time_comp;
+ for (; it != it_end; ++it) {
+ time_comp = date_time::DateTime::compareTime(
+ date_time::DateTime::getCurrentTime(), it->second);
+ if (date_time::GREATER == time_comp || date_time::EQUAL == time_comp) {
+ app_list.push_back(it->first);
+ }
+ }
+ }
+ if (!app_list.empty()) {
+ for (uint32_t i = 0; i < app_list.size(); ++i) {
+ LOG4CXX_INFO(logger_, "Send TTS GlobalProperties to HMI with default helpPrompt");
+ MessageHelper::SendTTSGlobalProperties(application(app_list[i]), true);
+ RemoveAppFromTTSGlobalPropertiesList(app_list[i]);
+ }
+ }
+}
+
+void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
+ const uint32_t app_id) {
+ LOG4CXX_INFO(logger_, "ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList");
+ uint16_t timeout = profile::Profile::instance()->tts_global_properties_timeout();
+ TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ current_time.tv_sec += timeout;
+ sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
+ if (tts_global_properties_app_list_.end() ==
+ tts_global_properties_app_list_.find(app_id)) {
+ tts_global_properties_app_list_[app_id] = current_time;
+ }
+ //if add first item need to start timer on one second
+ if (1 == tts_global_properties_app_list_.size()) {
+ LOG4CXX_INFO(logger_, "Start tts_global_properties_timer_");
+ tts_global_properties_timer_.start(1);
+ }
+}
+
+void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
+ const uint32_t app_id) {
+ LOG4CXX_INFO(logger_, "ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList");
+ sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
+ std::map<uint32_t, TimevalStruct>::iterator it =
+ tts_global_properties_app_list_.find(app_id);
+ if (tts_global_properties_app_list_.end() != it) {
+ tts_global_properties_app_list_.erase(it);
+ if (!(tts_global_properties_app_list_.size())) {
+ LOG4CXX_INFO(logger_, "Stop tts_global_properties_timer_");
+ //if container is empty need to stop timer
+ tts_global_properties_timer_.stop();
+ }
+ }
+}
+
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/get_urls.cc b/src/components/application_manager/src/commands/hmi/get_urls.cc
index 828ea2242..b3d0f6061 100644
--- a/src/components/application_manager/src/commands/hmi/get_urls.cc
+++ b/src/components/application_manager/src/commands/hmi/get_urls.cc
@@ -1,4 +1,4 @@
-/**
+/**
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -47,13 +47,11 @@ GetUrls::~GetUrls() {
void GetUrls::Run() {
LOG4CXX_INFO(logger_, "GetUrls::Run");
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
smart_objects::SmartObject& object = *message_;
object[strings::params][strings::message_type] = MessageType::kResponse;
- if (policy_manager) {
+ if (policy::PolicyHandler::instance()->PolicyEnabled()) {
policy::EndpointUrls endpoints =
- policy_manager->GetUpdateUrls(
+ policy::PolicyHandler::instance()->GetUpdateUrls(
object[strings::msg_params][hmi_request::service].asInt());
object[strings::msg_params].erase(hmi_request::service);
object[strings::msg_params][hmi_response::urls] =
diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc
index 1678841d7..9c03c0f62 100644
--- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification.cc
@@ -32,6 +32,8 @@
*/
#include "application_manager/commands/mobile/on_hmi_status_notification.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/message_helper.h"
#include "application_manager/message.h"
#include "interfaces/MOBILE_API.h"
@@ -51,6 +53,32 @@ void OnHMIStatusNotification::Run() {
(*message_)[strings::params][strings::message_type] = static_cast<int32_t> (
application_manager::MessageType::kNotification);
+ ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
+ (*message_)[strings::params][strings::connection_key].asUInt());
+ if (!app.valid()) {
+ LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist");
+ return;
+ }
+ mobile_apis::HMILevel::eType hmi_level =
+ static_cast<mobile_apis::HMILevel::eType>(
+ (*message_)[strings::msg_params][strings::hmi_level].asInt());
+ if ((mobile_apis::HMILevel::HMI_BACKGROUND == hmi_level) ||
+ (mobile_apis::HMILevel::HMI_NONE == hmi_level)) {
+ if (!(app->tts_properties_in_none())) {
+ app->set_tts_properties_in_none(true);
+ LOG4CXX_INFO(logger_, "OnHMIStatusNotification::Send TTS GlobalProperties"
+ " with empty array to HMI");
+ MessageHelper::SendTTSGlobalProperties(app, false);
+ }
+ } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) ||
+ (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) {
+ if (!(app->tts_properties_in_full())) {
+ app->set_tts_properties_in_full(true);
+ LOG4CXX_INFO(logger_, "OnHMIStatusNotification AddAppToTTSGlobalPropertiesList");
+ ApplicationManagerImpl::instance()->AddAppToTTSGlobalPropertiesList(
+ app->app_id());
+ }
+ }
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
index f9eee5f8d..874186cbb 100644
--- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc
@@ -296,7 +296,7 @@ void PerformInteractionRequest::onTimeOut() {
void PerformInteractionRequest::ProcessVRResponse(
const smart_objects::SmartObject& message) {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::ProcessVRNotification");
+ LOG4CXX_INFO(logger_, "PerformInteractionRequest::ProcessVRResponse");
const uint32_t app_id = connection_key();
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
if (!app.get()) {
@@ -307,12 +307,13 @@ void PerformInteractionRequest::ProcessVRResponse(
vr_response_recived = true;
vr_perform_interaction_code_ = static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
- if (mobile_apis::Result::ABORTED == vr_perform_interaction_code_) {
+ if (mobile_apis::Result::ABORTED == vr_perform_interaction_code_ ||
+ mobile_apis::Result::TIMED_OUT == vr_perform_interaction_code_) {
LOG4CXX_INFO(logger_, "VR response aborted");
if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
- LOG4CXX_INFO(logger_, "Abort send Close Popup");
+ LOG4CXX_INFO(logger_, "Aborted or Timeout Send Close Popup");
TerminatePerformInteraction();
- SendResponse(false, mobile_apis::Result::ABORTED);
+ SendResponse(false, vr_perform_interaction_code_);
return;
} else {
LOG4CXX_INFO(logger_, "Update timeout for UI");
@@ -323,81 +324,71 @@ void PerformInteractionRequest::ProcessVRResponse(
}
}
- if (mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- vr_perform_interaction_code_) {
- LOG4CXX_INFO(logger_, "VR response WARNINGS");
- TerminatePerformInteraction();
- SendResponse(true, mobile_apis::Result::WARNINGS);
- return;
- }
-
- int32_t choise_id = message[strings::msg_params][strings::choice_id].asInt();
- const PerformChoiceSetMap& choice_set_map = app
- ->performinteraction_choice_set_map();
- bool choice_id_chosen = false;
- LOG4CXX_INFO(logger_, "If command was choice id");
- for (PerformChoiceSetMap::const_iterator it = choice_set_map.begin();
- choice_set_map.end() != it; ++it) {
- const smart_objects::SmartObject& choice_set = (*it->second).getElement(
- strings::choice_set);
- for (size_t j = 0; j < choice_set.length(); ++j) {
- if (choise_id ==
- choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
- choice_id_chosen = true;
- break;
- }
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject* ptr_msg_params = NULL;
+ if (message[strings::msg_params].keyExists(strings::choice_id)) {
+ if (CheckChoiceIDFromResponse(
+ app, message[strings::msg_params][strings::choice_id].asInt())) {
+ msg_params[strings::choice_id] =
+ message[strings::msg_params][strings::choice_id].asInt();
+ ptr_msg_params = &msg_params;
+ } else {
+ LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI");
+ TerminatePerformInteraction();
+ SendResponse(false, mobile_apis::Result::GENERIC_ERROR,
+ "Wrong choiceID was received from HMI");
+ return;
}
}
- if (choice_id_chosen) {
- LOG4CXX_INFO(logger_, "Command was choice id!");
- TerminatePerformInteraction();
- (*message_)[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::PerformInteractionID);
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- msg_params[strings::choice_id] = choise_id;
- msg_params[strings::trigger_source] =
- static_cast<int32_t>(mobile_apis::TriggerSource::TS_VR);
- SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &(msg_params));
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+ if (mobile_apis::Result::UNSUPPORTED_RESOURCE ==
+ vr_perform_interaction_code_) {
+ LOG4CXX_INFO(logger_, "VR response WARNINGS");
+ result_code = mobile_apis::Result::WARNINGS;
} else {
- LOG4CXX_INFO(logger_, "Sending OnCommand notification");
- smart_objects::SmartObject* notification_so =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (!notification_so) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to allocate memory for perform interaction response.");
- return;
- }
- smart_objects::SmartObject& notification = *notification_so;
- notification = message;
- notification[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID);
- notification[strings::params][strings::message_type] =
- static_cast<int32_t>(kNotification);
- notification[strings::msg_params][strings::trigger_source] =
- static_cast<int32_t>(mobile_apis::TriggerSource::TS_VR);
- ApplicationManagerImpl::instance()->ManageMobileCommand(notification_so);
+ LOG4CXX_INFO(logger_, "VR response SUCCESS");
+ result_code = mobile_apis::Result::SUCCESS;
+ msg_params[strings::trigger_source] =
+ static_cast<int32_t>(mobile_apis::TriggerSource::TS_VR);
+ ptr_msg_params = &msg_params;
}
+ TerminatePerformInteraction();
+ SendResponse(true, result_code, NULL, ptr_msg_params);
}
void PerformInteractionRequest::ProcessPerformInteractionResponse(
const smart_objects::SmartObject& message) {
LOG4CXX_INFO(logger_,
"PerformInteractionRequest::ProcessPerformInteractionResponse");
+ const uint32_t app_id = connection_key();
+ ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ if (!app.get()) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ return;
+ }
ui_response_recived = true;
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params = message[strings::msg_params];
-
bool result = false;
+
mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
+ GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asUInt()));
+
if ((mobile_apis::Result::SUCCESS == result_code) ||
(mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code)) {
+ if (message[strings::msg_params].keyExists(strings::choice_id) &&
+ !(CheckChoiceIDFromResponse(
+ app, message[strings::msg_params][strings::choice_id].asInt()))) {
+ DisablePerformInteraction();
+ SendResponse(false, mobile_apis::Result::GENERIC_ERROR,
+ "Wrong choiceID was received from HMI");
+ return;
+ }
if (message[strings::msg_params].keyExists(strings::manual_text_entry)) {
msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_KEYBOARD;
} else {
@@ -842,6 +833,26 @@ void PerformInteractionRequest::TerminatePerformInteraction() {
DisablePerformInteraction();
}
+bool PerformInteractionRequest::CheckChoiceIDFromResponse(
+ ApplicationSharedPtr app, int32_t choice_id) {
+ LOG4CXX_INFO(logger_, "PerformInteractionRequest::CheckChoiceIDFromResponse");
+ const PerformChoiceSetMap& choice_set_map = app
+ ->performinteraction_choice_set_map();
+
+ for (PerformChoiceSetMap::const_iterator it = choice_set_map.begin();
+ choice_set_map.end() != it; ++it) {
+ const smart_objects::SmartObject& choice_set = (*it->second).getElement(
+ strings::choice_set);
+ for (size_t j = 0; j < choice_set.length(); ++j) {
+ if (choice_id ==
+ choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index 7dc647886..8b0ae253b 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -182,7 +182,7 @@ void RegisterAppInterfaceRequest::Run() {
LOG4CXX_ERROR_EXT(logger_, "Coincidence check failed.");
if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) {
usage_statistics::AppCounter count_of_rejections_duplicate_name(
- policy::PolicyHandler::instance()->policy_manager(), mobile_app_id,
+ policy::PolicyHandler::instance()->GetStatisticManager(), mobile_app_id,
usage_statistics::REJECTIONS_DUPLICATE_NAME);
++count_of_rejections_duplicate_name;
}
@@ -561,17 +561,9 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
policy::StringArray app_nicknames;
policy::StringArray app_hmi_types;
- // TODO(KKolodiy): need remove method policy_manager
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
- if (!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- return mobile_apis::Result::DISALLOWED;
- }
-
std::string mobile_app_id = message[strings::msg_params][strings::app_id].asString();
- const bool init_result = policy_manager->GetInitialAppData(mobile_app_id, &app_nicknames,
- &app_hmi_types);
+ const bool init_result = policy::PolicyHandler::instance()->GetInitialAppData(
+ mobile_app_id, &app_nicknames, &app_hmi_types);
if (!init_result) {
LOG4CXX_ERROR(logger_, "Error during initial application data check.");
@@ -587,7 +579,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
"Application name was not found in nicknames list.");
//App should be unregistered, if its name is not present in nicknames list
usage_statistics::AppCounter count_of_rejections_nickname_mismatch(
- policy_manager, mobile_app_id,
+ policy::PolicyHandler::instance()->GetStatisticManager(), mobile_app_id,
usage_statistics::REJECTIONS_NICKNAME_MISMATCH);
++count_of_rejections_nickname_mismatch;
return mobile_apis::Result::DISALLOWED;
diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
index c5f6322f0..5e62b789d 100644
--- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc
@@ -71,6 +71,11 @@ void ResetGlobalPropertiesRequest::Run() {
size_t obj_length = (*message_)[strings::msg_params][strings::properties]
.length();
+ //if application waits for sending ttsGlobalProperties need to remove this
+ //application from tts_global_properties_app_list_
+ LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList");
+ ApplicationManagerImpl::instance()->RemoveAppFromTTSGlobalPropertiesList(
+ app_id);
bool helpt_promt = false;
bool timeout_prompt = false;
@@ -184,23 +189,9 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt(
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
-
- const std::vector<std::string>& help_prompt = profile::Profile::instance()
- ->help_prompt();
-
smart_objects::SmartObject so_help_prompt = smart_objects::SmartObject(
smart_objects::SmartType_Array);
-
- for (uint32_t i = 0; i < help_prompt.size(); ++i) {
- smart_objects::SmartObject helpPrompt = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- helpPrompt[strings::text] = help_prompt[i];
- helpPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT;
- so_help_prompt[i] = helpPrompt;
- }
-
app->set_help_prompt(so_help_prompt);
-
return true;
}
diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
index 09e6da997..f7216c818 100644
--- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc
@@ -112,6 +112,11 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
+ //if application waits for sending ttsGlobalProperties need to remove this
+ //application from tts_global_properties_app_list_
+ LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList");
+ ApplicationManagerImpl::instance()->RemoveAppFromTTSGlobalPropertiesList(
+ app_id);
bool is_help_prompt_present = msg_params.keyExists(strings::help_prompt);
bool is_timeout_prompt_present = msg_params.keyExists(
strings::timeout_prompt);
diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc
index 52b0ee44f..bf200d72d 100644
--- a/src/components/application_manager/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_request.cc
@@ -135,9 +135,8 @@ void SliderRequest::on_event(const event_engine::Event& event) {
smart_objects::SmartObject response_msg_params = message[strings::msg_params];
if (response_code == hmi_apis::Common_Result::ABORTED) {
//Copy slider_position info to msg_params section
- // TODO(DK) : FIXME
- /*response_msg_params[strings::slider_position] =
- message[strings::params][strings::data][strings::slider_position];*/
+ response_msg_params[strings::slider_position] =
+ message[strings::params][strings::data][strings::slider_position];
}
const bool is_response_success =
diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc
index 274ce6a0c..832016e87 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -62,6 +62,8 @@ Message::Message(protocol_handler::MessagePriority priority)
priority_(priority),
connection_key_(0),
binary_data_(NULL),
+ data_size_(0),
+ payload_size_(0),
version_(kUnknownProtocol) {
}
@@ -75,6 +77,8 @@ Message& Message::operator=(const Message& message) {
set_correlation_id(message.correlation_id_);
set_connection_key(message.connection_key_);
set_message_type(message.type_);
+ set_data_size(message.data_size_);
+ set_payload_size(message.payload_size_);
if (message.binary_data_) {
set_binary_data(message.binary_data_);
}
@@ -92,13 +96,16 @@ bool Message::operator==(const Message& message) {
bool type = type_ == message.type_;
bool json_message = json_message_ == message.json_message_;
bool version = version_ == message.version_;
+ bool data_size = data_size_ == message.data_size_;
+ bool payload_size = payload_size_ == message.payload_size_;
+
bool binary_data = std::equal(binary_data_->begin(), binary_data_->end(),
message.binary_data_->begin(),
BinaryDataPredicate);
return function_id && correlation_id && connection_key && type && binary_data
- && json_message && version;
+ && json_message && version && data_size && payload_size;
}
Message::~Message() {
@@ -139,6 +146,14 @@ bool Message::has_binary_data() const {
return (binary_data_ != NULL);
}
+size_t Message::data_size() const {
+ return data_size_;
+}
+
+size_t Message::payload_size() const {
+ return payload_size_;
+}
+
void Message::set_function_id(int32_t id) {
function_id_ = id;
}
@@ -183,4 +198,12 @@ const smart_objects::SmartObject &Message::smart_object() const {
void Message::set_smart_object(const smart_objects::SmartObject& object) {
smart_object_ = object;
}
+
+void Message::set_data_size(size_t data_size) {
+ data_size_ = data_size;
+}
+
+void Message::set_payload_size(size_t payload_size) {
+ payload_size_ = payload_size;
+}
} // namespace application_manager
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc
index afc982e19..c8fb8b3e4 100644
--- a/src/components/application_manager/src/message_helper.cc
+++ b/src/components/application_manager/src/message_helper.cc
@@ -86,7 +86,7 @@ CommonAppPriorityMap app_priority_values = {
{"EMERGENCY", hmi_apis::Common_AppPriority::EMERGENCY},
{"NAVIGATION", hmi_apis::Common_AppPriority::NAVIGATION},
{"NONE", hmi_apis::Common_AppPriority::NONE},
- {"VOICECOMM", hmi_apis::Common_AppPriority::VOICE_COMMUNICATION},
+ {"VOICECOM", hmi_apis::Common_AppPriority::VOICE_COMMUNICATION},
{"INVALID_ENUM", hmi_apis::Common_AppPriority::INVALID_ENUM}
};
@@ -251,15 +251,10 @@ std::string MessageHelper::CommonLanguageToString(
}
uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) {
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
- if(!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- return 0;
- }
+
std::string priority;
- policy_manager->GetPriority(policy_app_id, &priority);
- return policy_manager-> GetNotificationsNumber(priority);
+ policy::PolicyHandler::instance()->GetPriority(policy_app_id, &priority);
+ return policy::PolicyHandler::instance()->GetNotificationsNumber(priority);
}
void MessageHelper::SendHMIStatusNotification(
@@ -353,17 +348,13 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI(
.tts_name());
}
std::string priority;
- // TODO(KKolodiy): need remove method policy_manager
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
- if (!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- } else {
- policy_manager->GetPriority(application_impl.mobile_app_id()->asString(), &priority);
- if (!priority.empty()) {
- message[strings::msg_params][strings::priority] = GetPriorityCode(priority);
- }
+
+ policy::PolicyHandler::instance()->GetPriority(
+ application_impl.mobile_app_id()->asString(), &priority);
+ if (!priority.empty()) {
+ message[strings::msg_params][strings::priority] = GetPriorityCode(priority);
}
+
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(notification));
}
@@ -574,11 +565,7 @@ smart_objects::SmartObject* MessageHelper::CreateDeviceListSO(
(*device_list_so)[strings::device_list] = smart_objects::SmartObject(
smart_objects::SmartType_Array);
smart_objects::SmartObject& list_so = (*device_list_so)[strings::device_list];
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
- if(!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- }
+
int32_t index = 0;
for (connection_handler::DeviceMap::const_iterator it = devices.begin();
devices.end() != it; ++it) {
@@ -587,16 +574,12 @@ smart_objects::SmartObject* MessageHelper::CreateDeviceListSO(
list_so[index][strings::name] = d.user_friendly_name();
list_so[index][strings::id] = it->second.device_handle();
- if(policy_manager) {
- const policy::DeviceConsent device_consent =
- policy_manager->GetUserConsentForDevice(it->second.mac_address());
- list_so[index][strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent;
- } else {
- list_so[index][strings::isSDLAllowed] = true;
- }
- ++index;
+ const policy::DeviceConsent device_consent =
+ policy::PolicyHandler::instance()->GetUserConsentForDevice(it->second.mac_address());
+ list_so[index][strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
}
+ ++index;
return device_list_so;
}
@@ -829,6 +812,51 @@ MessageHelper::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHM
return requests;
}
+void MessageHelper::SendTTSGlobalProperties(
+ ApplicationSharedPtr app, bool default_help_prompt) {
+ if (!app.valid()) {
+ return;
+ }
+ utils::SharedPtr<smart_objects::SmartObject> tts_global_properties(
+ new smart_objects::SmartObject);
+ if (tts_global_properties) {
+ smart_objects::SmartObject& so_to_send = *tts_global_properties;
+ so_to_send[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ so_to_send[strings::params][strings::message_type] =
+ static_cast<int>(hmi_apis::messageType::request);
+ so_to_send[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ so_to_send[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ so_to_send[strings::params][strings::correlation_id] =
+ ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ smart_objects::SmartObject msg_params = smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
+ msg_params[strings::help_prompt] = smart_objects::SmartObject(
+ smart_objects::SmartType_Array);
+ if (default_help_prompt) {
+ const CommandsMap& commands = app->commands_map();
+ CommandsMap::const_iterator it = commands.begin();
+ uint32_t index = 0;
+ for (; commands.end() != it; ++it) {
+ smart_objects::SmartObject item(smart_objects::SmartType_Map);
+ if ((*it->second).keyExists(strings::menu_params)){
+ item[strings::text] = (*it->second)[strings::menu_params][strings::menu_name].asString();
+ item[strings::type] = mobile_apis::SpeechCapabilities::SC_TEXT;
+ } else {
+ continue;
+ }
+ msg_params[strings::help_prompt][index++] = item;
+ }
+ }
+ app->set_help_prompt(msg_params[strings::help_prompt]);
+ msg_params[strings::app_id] = app->app_id();
+ so_to_send[strings::msg_params] = msg_params;
+ ApplicationManagerImpl::instance()->ManageHMICommand(tts_global_properties);
+ }
+}
+
smart_objects::SmartObject* MessageHelper::CreateAppVrHelp(
ApplicationConstSharedPtr app) {
smart_objects::SmartObject* result = new smart_objects::SmartObject(
@@ -1232,13 +1260,9 @@ void MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
std::string priority;
// TODO(KKolodiy): need remove method policy_manager
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
- if (!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- } else {
- policy_manager->GetPriority(app->mobile_app_id()->asString(), &priority);
- }
+
+ policy::PolicyHandler::instance()->GetPriority(
+ app->mobile_app_id()->asString(), &priority);
// According SDLAQ-CRS-2794
// SDL have to send ActivateApp without "proirity" parameter to HMI.
// in case of unconsented device
@@ -1247,7 +1271,8 @@ void MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
connection_handler::ConnectionHandlerImpl::instance()->
GetDataOnDeviceID(device_handle, NULL, NULL, &mac_adress, NULL);
- policy::DeviceConsent consent = policy_manager->GetUserConsentForDevice(mac_adress);
+ policy::DeviceConsent consent =
+ policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_adress);
if (!priority.empty() && (policy::DeviceConsent::kDeviceAllowed == consent)) {
(*message)[strings::msg_params]["priority"] = GetPriorityCode(priority);
}
@@ -2132,8 +2157,18 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
smart_objects::SmartObject soft_buttons = smart_objects::SmartObject(
smart_objects::SmartType_Array);
+ policy::PolicyHandler* policy_handler = policy::PolicyHandler::instance();
+ std::string app_mobile_id = app->mobile_app_id()->asString();
+
uint32_t j = 0;
- for (uint32_t i = 0; i < request_soft_buttons.length(); ++i) {
+ size_t size = request_soft_buttons.length();
+ for (uint32_t i = 0; i < size; ++i) {
+ int system_action = request_soft_buttons[i][strings::system_action].asInt();
+ if (!policy_handler->CheckKeepContext(system_action, app_mobile_id) ||
+ !policy_handler->CheckStealFocus(system_action, app_mobile_id)) {
+ return mobile_apis::Result::DISALLOWED;
+ }
+
switch (request_soft_buttons[i][strings::type].asInt()) {
case mobile_apis::SoftButtonType::SBT_IMAGE: {
if (!image_supported) {
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index be48faa81..e2293e381 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -117,6 +117,8 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
outgoing_message->set_protocol_version(
static_cast<application_manager::ProtocolVersion>(message
->protocol_version()));
+ outgoing_message->set_data_size(message->data_size());
+ outgoing_message->set_payload_size(message->payload_size());
if (!payload.data.empty()) {
outgoing_message->set_binary_data(
diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc
index f49ef2ece..2c3fe59c5 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index a1331e7ee..03304037c 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -67,6 +67,8 @@ namespace policy {
}\
}
+CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+
typedef std::set<application_manager::ApplicationSharedPtr> ApplicationList;
struct DeactivateApplication {
@@ -99,21 +101,30 @@ struct SDLAlowedNotification {
std::string hmi_level;
hmi_apis::Common_HMILevel::eType default_hmi;
+ mobile_apis::HMILevel::eType default_mobile_hmi;
policy_manager_->GetDefaultHmi(app->mobile_app_id()->asString(), &hmi_level);
if ("BACKGROUND" == hmi_level) {
default_hmi = hmi_apis::Common_HMILevel::BACKGROUND;
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
} else if ("FULL" == hmi_level) {
default_hmi = hmi_apis::Common_HMILevel::FULL;
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL;
} else if ("LIMITED" == hmi_level) {
default_hmi = hmi_apis::Common_HMILevel::LIMITED;
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED;
} else if ("NONE" == hmi_level) {
default_hmi = hmi_apis::Common_HMILevel::NONE;
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE;
} else {
return ;
}
- app->set_hmi_level(mobile_apis::HMILevel::HMI_NONE);
+ if (app->hmi_level() == default_mobile_hmi) {
+ LOG4CXX_INFO(logger_, "Application already in default hmi state.");
+ } else {
+ app->set_hmi_level(default_mobile_hmi);
+ application_manager::MessageHelper::SendHMIStatusNotification(*app);
+ }
application_manager::MessageHelper::SendActivateAppToHMI(app->app_id(), default_hmi);
- application_manager::MessageHelper::SendHMIStatusNotification(*app);
}
}
private:
@@ -121,8 +132,6 @@ struct SDLAlowedNotification {
PolicyManager* policy_manager_;
};
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
-
struct LinkAppToDevice {
explicit LinkAppToDevice(
std::map<std::string, std::string>& app_to_device_link)
@@ -210,11 +219,9 @@ PolicyHandler::PolicyHandler()
}
PolicyHandler::~PolicyHandler() {
- exchange_handler_->Stop();
- UnloadPolicyLibrary();
}
-PolicyManager* PolicyHandler::LoadPolicyLibrary() {
+bool PolicyHandler::LoadPolicyLibrary() {
if (!PolicyEnabled()) {
LOG4CXX_WARN(logger_, "System is configured to work without policy "
"functionality.");
@@ -225,14 +232,15 @@ PolicyManager* PolicyHandler::LoadPolicyLibrary() {
char* error_string = dlerror();
if (error_string == NULL) {
- policy_manager_ = CreateManager();
- policy_manager_->set_listener(this);
- event_observer_= new PolicyEventObserver(policy_manager_);
+ if (CreateManager()) {
+ policy_manager_->set_listener(this);
+ event_observer_= new PolicyEventObserver(policy_manager_);
+ }
} else {
LOG4CXX_ERROR(logger_, error_string);
}
- return policy_manager_;
+ return NULL != policy_manager_;
}
bool PolicyHandler::PolicyEnabled() {
@@ -396,6 +404,7 @@ const std::string PolicyHandler::ConvertUpdateStatus(PolicyTableStatus status) {
void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
bool is_allowed) {
+ POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
application_manager::ApplicationManagerImpl::instance()->connection_handler()
->GetDeviceID(device_id, &device_handle);
@@ -411,12 +420,21 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
for (; it_app_list != it_app_list_end; ++it_app_list) {
if (device_handle == (*it_app_list).get()->device()) {
- policy_manager_->ReactOnUserDevConsentForApp(
- it_app_list->get()->mobile_app_id()->asString(),
- is_allowed);
+ const std::string policy_app_id =
+ (*it_app_list)->mobile_app_id()->asString();
+
+ // If app has predata policy, which is assigned without device consent or
+ // with negative data consent, there no necessity to change smth and send
+ // notification for such app in case of device consent is not allowed
+ if (policy_manager_->IsPredataPolicy(policy_app_id) &&
+ !is_allowed) {
+ continue;
+ }
- policy_manager_->SendNotificationOnPermissionsUpdated(
- (*it_app_list).get()->mobile_app_id()->asString());
+ policy_manager_->ReactOnUserDevConsentForApp(policy_app_id,
+ is_allowed);
+
+ policy_manager_->SendNotificationOnPermissionsUpdated(policy_app_id);
}
}
}
@@ -828,6 +846,7 @@ bool PolicyHandler::UnloadPolicyLibrary() {
ret = (dlclose(dl_handle_) == 0);
dl_handle_ = 0;
}
+ exchange_handler_->Stop();
return ret;
}
@@ -918,7 +937,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
ApplicationList app_list = accessor.applications();
std::for_each(app_list.begin(), app_list.end(),
- SDLAlowedNotification(device_id, policy_manager()));
+ SDLAlowedNotification(device_id, policy_manager_));
}
#endif
}
@@ -961,6 +980,8 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
// TODO(PV): requires additonal checking
//app_manager->PutApplicationInFull(app);
app_manager->ActivateApplication(app);
+ // Put application in full
+ application_manager::MessageHelper::SendActivateAppToHMI(app->app_id());
}
// Skip device selection, since user already consented device usage
StartPTExchange(true);
@@ -1076,28 +1097,29 @@ void PolicyHandler::PTExchangeAtRegistration(const std::string& app_id) {
LOG4CXX_INFO(logger_, "PTExchangeAtIgnition");
POLICY_LIB_CHECK_VOID();
- if (policy_manager()->IsAppInUpdateList(app_id)) {
- StartPTExchange();
- } else if (false == on_ignition_check_done_) { // TODO(AG): add cond. var to handle this case.
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
- const int kSecondsInDay = 60 * 60 * 24;
- int days = current_time.tv_sec / kSecondsInDay;
-
- LOG4CXX_INFO(
- logger_,
- "\nIgnition cycles exceeded: " << std::boolalpha <<
- policy_manager_->ExceededIgnitionCycles()
- << "\nDays exceeded: " << std::boolalpha
- << policy_manager_->ExceededDays(days)
- << "\nStatusUpdateRequired: " << std::boolalpha
- << (policy_manager_->GetPolicyTableStatus() == StatusUpdateRequired));
- if (policy_manager_->ExceededIgnitionCycles()
- || policy_manager_->ExceededDays(days)
- || policy_manager_->GetPolicyTableStatus() == StatusUpdateRequired) {
+ if (policy_manager_) {
+ if (policy_manager_->IsAppInUpdateList(app_id)) {
StartPTExchange();
+ } else if (false == on_ignition_check_done_) { // TODO(AG): add cond. var to handle this case.
+ TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ const int kSecondsInDay = 60 * 60 * 24;
+ int days = current_time.tv_sec / kSecondsInDay;
+
+ LOG4CXX_INFO(
+ logger_,
+ "\nIgnition cycles exceeded: " << std::boolalpha <<
+ policy_manager_->ExceededIgnitionCycles()
+ << "\nDays exceeded: " << std::boolalpha
+ << policy_manager_->ExceededDays(days)
+ << "\nStatusUpdateRequired: " << std::boolalpha
+ << (policy_manager_->GetPolicyTableStatus() == StatusUpdateRequired));
+ if (policy_manager_->ExceededIgnitionCycles()
+ || policy_manager_->ExceededDays(days)
+ || policy_manager_->GetPolicyTableStatus() == StatusUpdateRequired) {
+ StartPTExchange();
+ }
}
}
-
on_ignition_check_done_ = true;
}
@@ -1190,6 +1212,113 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
}
}
+bool PolicyHandler::GetPriority(const std::string& policy_app_id,
+ std::string* priority) {
+ if (policy_manager_) {
+ return policy_manager_->GetPriority(policy_app_id, priority);
+ } else {
+ return false;
+ }
+}
+
+void PolicyHandler::CheckPermissions(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ CheckPermissionResult& result) {
+ if (policy_manager_) {
+ policy_manager_->CheckPermissions(app_id, hmi_level, rpc, result);
+ }
+}
+
+uint32_t PolicyHandler::GetNotificationsNumber(const std::string& priority) {
+ if (policy_manager_) {
+ return policy_manager_->GetNotificationsNumber(priority);
+ } else {
+ return 0;
+ }
+}
+
+DeviceConsent PolicyHandler::GetUserConsentForDevice(
+ const std::string& device_id) {
+ if (policy_manager_) {
+ return policy_manager_->GetUserConsentForDevice(device_id);
+ } else {
+ return PolicyEnabled() ? kDeviceHasNoConsent : kDeviceAllowed;
+ }
+}
+
+bool PolicyHandler::GetDefaultHmi(const std::string& policy_app_id,
+ std::string* default_hmi) {
+ bool result = false;
+ if (policy_manager_) {
+ result = policy_manager_->GetDefaultHmi(policy_app_id, default_hmi);
+ }
+ return result;
+}
+
+bool PolicyHandler::GetInitialAppData(const std::string& application_id,
+ StringArray* nicknames,
+ StringArray* app_hmi_types) {
+ bool result = false;
+ if (policy_manager_) {
+ result = policy_manager_->GetInitialAppData(application_id, nicknames, app_hmi_types);
+ }
+ return result;
+}
+
+EndpointUrls PolicyHandler::GetUpdateUrls(int service_type) {
+ if (policy_manager_) {
+ return policy_manager_->GetUpdateUrls(service_type);
+ }
+ return EndpointUrls();
+}
+
+void PolicyHandler::ResetRetrySequence() {
+ if (policy_manager_) {
+ policy_manager_->ResetRetrySequence();
+ }
+}
+
+int PolicyHandler::NextRetryTimeout() {
+ if (policy_manager_) {
+ return policy_manager_->NextRetryTimeout();
+ }
+ return 0;
+}
+
+int PolicyHandler::TimeoutExchange() {
+ if (policy_manager_) {
+ return policy_manager_->TimeoutExchange();
+ }
+ return 0;
+}
+
+void PolicyHandler::OnExceededTimeout() {
+ if (policy_manager_) {
+ policy_manager_->OnExceededTimeout();
+ }
+}
+
+BinaryMessageSptr PolicyHandler::RequestPTUpdate() {
+ if (policy_manager_) {
+ return policy_manager_->RequestPTUpdate();
+ } else {
+ return BinaryMessageSptr();
+ }
+}
+
+const std::vector<int> PolicyHandler::RetrySequenceDelaysSeconds() {
+ if (policy_manager_) {
+ return policy_manager_->RetrySequenceDelaysSeconds();
+ }
+ return std::vector<int>();
+}
+
+usage_statistics::StatisticsManager * const &
+PolicyHandler::GetStatisticManager() {
+ return (usage_statistics::StatisticsManager *&)policy_manager_;
+}
+
void PolicyHandler::AddStatisticsInfo(int type) {
POLICY_LIB_CHECK_VOID();
switch (static_cast<hmi_apis::Common_StatisticsType::eType>(type)) {
@@ -1286,5 +1415,21 @@ void PolicyHandler::OnUpdateRequestSentToMobile() {
policy_manager_->OnUpdateStarted();
}
+bool PolicyHandler::CheckKeepContext(int system_action,
+ const std::string& policy_app_id) {
+ const bool keep_context = system_action
+ == mobile_apis::SystemAction::KEEP_CONTEXT;
+ const bool allowed = policy_manager_->CanAppKeepContext(policy_app_id);
+ return !(keep_context && !allowed);
+}
+
+bool PolicyHandler::CheckStealFocus(int system_action,
+ const std::string& policy_app_id) {
+ const bool steal_focus = system_action
+ == mobile_apis::SystemAction::STEAL_FOCUS;
+ const bool allowed = policy_manager_->CanAppStealFocus(policy_app_id);
+ return !(steal_focus && !allowed);
+}
+
} // namespace policy
diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc
index 7ac19332b..e1b47a0d9 100644
--- a/src/components/application_manager/src/policies/policy_retry_sequence.cc
+++ b/src/components/application_manager/src/policies/policy_retry_sequence.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -41,6 +41,7 @@ namespace policy {
CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
RetrySequence::RetrySequence(PolicyHandler* const policy_handler)
+ // TODO (Risk copy of PolicyHandler Pointer)
: policy_handler_(policy_handler) {
}
@@ -52,24 +53,19 @@ void RetrySequence::StartNextRetry() {
LOG4CXX_TRACE(logger_, "Start next retry of exchanging PT");
DCHECK(policy_handler_);
// TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib
- PolicyManager* policy_manager = policy_handler_->policy_manager();
- if (!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- return;
- }
- BinaryMessageSptr pt_snapshot = policy_manager
+ BinaryMessageSptr pt_snapshot = policy_handler_
->RequestPTUpdate();
if (pt_snapshot) {
policy_handler_->SendMessageToSDK(*pt_snapshot);
- const int timeout = policy_manager->TimeoutExchange();
- const int seconds = policy_manager->NextRetryTimeout();
+ const int timeout = policy_handler_->TimeoutExchange();
+ const int seconds = policy_handler_->NextRetryTimeout();
LOG4CXX_DEBUG(logger_,
"Timeout response: " << timeout << " Next try: " << seconds);
if (timeout > 0) {
sleep(timeout);
- policy_manager->OnExceededTimeout();
+ policy_handler_->OnExceededTimeout();
}
if (seconds > 0) {
sleep(seconds);
diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc b/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc
index ec30333f1..eba808f40 100644
--- a/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc
+++ b/src/components/application_manager/src/policies/pt_exchange_handler_ext.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -59,24 +59,20 @@ PTExchangeHandlerExt::~PTExchangeHandlerExt() {
void PTExchangeHandlerExt::Start() {
LOG4CXX_TRACE(logger_, "Start exchange PT");
- PolicyManager* policy_manager = policy_handler_->policy_manager();
- if (!policy_manager) {
- LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
- return;
- }
+
const string policy_snapshot_file_name =
Profile::instance()->policies_snapshot_file_name();
const std::string system_files_path =
Profile::instance()->system_files_path();
const std::string policy_snapshot_full_path = system_files_path + '/' +
policy_snapshot_file_name;
- BinaryMessageSptr pt_snapshot = policy_manager->RequestPTUpdate();
+ BinaryMessageSptr pt_snapshot = policy_handler_->RequestPTUpdate();
if (pt_snapshot.valid()) {
if (file_system::CreateDirectoryRecursively(system_files_path) &&
file_system::WriteBinaryFile(policy_snapshot_full_path, *pt_snapshot)) {
MessageHelper::SendPolicyUpdate(policy_snapshot_full_path,
- policy_manager->TimeoutExchange(),
- policy_manager->RetrySequenceDelaysSeconds());
+ policy_handler_->TimeoutExchange(),
+ policy_handler_->RetrySequenceDelaysSeconds());
} else {
LOG4CXX_ERROR(logger_, "Failed to write snapshot file to " << policy_snapshot_file_name);
}
diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc
index 2f0ad267f..e28455aa3 100644
--- a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc
+++ b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc
@@ -60,9 +60,8 @@ void PTExchangeHandlerImpl::Start() {
retry_sequence_.stop();
}
- PolicyManager* policy_manager = policy_handler_->policy_manager();
- if (policy_manager) {
- policy_manager->ResetRetrySequence();
+ if (policy_handler_) {
+ policy_handler_->ResetRetrySequence();
}
retry_sequence_.start();
}
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index a9f5db075..4421ea8b3 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.cc
@@ -145,9 +145,9 @@ RequestController::TResult RequestController::addMobileRequest(
AutoLock auto_lock(mobile_request_list_lock_);
mobile_request_list_.push_back(request);
- LOG4CXX_INFO(logger_, "RequestController size is "
+ LOG4CXX_INFO(logger_, "mobile_request_list_ size is "
<< mobile_request_list_.size()
- << " Pending request size is "
+ << " pending_request_set_ size is "
<< pending_request_set_.size()
);
}
@@ -171,8 +171,8 @@ RequestController::TResult RequestController::addHMIRequest(
if (0 != raw_ptr->default_timeout()) {
pending_request_set_lock_.Acquire();
pending_request_set_.insert(request_info_ptr);
- LOG4CXX_INFO(logger_, "Pending request size is "
- << pending_request_set_.size() );
+ LOG4CXX_INFO(logger_, "pending_request_set_ size is "
+ << pending_request_set_.size());
UpdateTimer();
pending_request_set_lock_.Release();
} else {
diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp
index 85f3534ad..dff90a638 100644
--- a/src/components/application_manager/src/resume_ctrl.cpp
+++ b/src/components/application_manager/src/resume_ctrl.cpp
@@ -1,4 +1,4 @@
-#include <fstream>
+#include <fstream>
#include "application_manager/resume_ctrl.h"
#include "config_profile/profile.h"
@@ -135,31 +135,26 @@ bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
mobile_apis::HMILevel::eType default_hmi = mobile_apis::HMILevel::HMI_NONE;
if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
- if (policy_manager) {
- std::string policy_app_id = application->mobile_app_id()->asString();
- std::string default_hmi_string = "";
- bool result_get_hmi = policy_manager->GetDefaultHmi(policy_app_id, &default_hmi_string);
- if (true == result_get_hmi) {
- if ("BACKGROUND" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else if ("FULL" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_FULL;
- } else if ("LIMITED" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_LIMITED;
- } else if ("NONE" == default_hmi_string) {
- default_hmi = mobile_apis::HMILevel::HMI_NONE;
- } else {
- LOG4CXX_ERROR(logger_, "Unable to convert " + default_hmi_string + "to HMILevel");
- return false;
- }
+ std::string policy_app_id = application->mobile_app_id()->asString();
+ std::string default_hmi_string = "";
+ bool result_get_hmi = policy::PolicyHandler::instance()->GetDefaultHmi(
+ policy_app_id, &default_hmi_string);
+ if (true == result_get_hmi) {
+ if ("BACKGROUND" == default_hmi_string) {
+ default_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
+ } else if ("FULL" == default_hmi_string) {
+ default_hmi = mobile_apis::HMILevel::HMI_FULL;
+ } else if ("LIMITED" == default_hmi_string) {
+ default_hmi = mobile_apis::HMILevel::HMI_LIMITED;
+ } else if ("NONE" == default_hmi_string) {
+ default_hmi = mobile_apis::HMILevel::HMI_NONE;
} else {
- LOG4CXX_ERROR(logger_, "SetupDefaultHMILevel() unable to get default hmi_level for "
- << policy_app_id);
+ LOG4CXX_ERROR(logger_, "Unable to convert " + default_hmi_string + "to HMILevel");
+ return false;
}
} else {
- LOG4CXX_ERROR(logger_, "SetupDefaultHMILevel() Unable to load Policy ");
+ LOG4CXX_ERROR(logger_, "SetupDefaultHMILevel() unable to get default hmi_level for "
+ << policy_app_id);
}
}
@@ -179,14 +174,12 @@ bool ResumeCtrl::SetupHMILevel(ApplicationSharedPtr application,
#ifdef ENABLE_LOG
bool seted_up_hmi_level = hmi_level;
#endif
- policy::PolicyManager* policy_manager =
- policy::PolicyHandler::instance()->policy_manager();
const std::string device_id =
MessageHelper::GetDeviceMacAddressForHandle(application->device());
- if (check_policy && policy_manager &&
- policy_manager->GetUserConsentForDevice(device_id)
+ if (check_policy &&
+ policy::PolicyHandler::instance()->GetUserConsentForDevice(device_id)
!= policy::DeviceConsent::kDeviceAllowed) {
LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed");
SetupDefaultHMILevel(application);
diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc
index ece6dbdfc..c6878f056 100644
--- a/src/components/application_manager/src/usage_statistics.cc
+++ b/src/components/application_manager/src/usage_statistics.cc
@@ -53,9 +53,8 @@ std::string LanguageIdToString(Language::eType lang_id) {
} // namespace
-UsageStatistics::UsageStatistics(
- const std::string& app_id,
- usage_statistics::StatisticsManager* statistics_manager)
+UsageStatistics::UsageStatistics(const std::string& app_id,
+ StatisticsManager* const & statistics_manager)
: time_in_hmi_state_(statistics_manager, app_id),
app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI),
app_registration_language_vui_(statistics_manager, app_id, LANGUAGE_VUI),
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 24c4d0f1b..c7d990783 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -356,6 +356,12 @@ class Profile : public utils::Singleton<Profile> {
uint16_t transport_manager_tcp_adapter_port() const;
/**
+ * @brief Returns value of timeout after which sent
+ * tts global properties for VCA
+ */
+ uint16_t tts_global_properties_timeout() const;
+
+ /**
* @brief Reads a string value from the profile
*
* @param value Result value
@@ -664,6 +670,7 @@ class Profile : public utils::Singleton<Profile> {
std::string iap2_system_config_;
int iap2_hub_connect_attempts_;
int iap_hub_connection_wait_timeout_;
+ uint16_t tts_global_properties_timeout_;
FRIEND_BASE_SINGLETON_CLASS(Profile);
DISALLOW_COPY_AND_ASSIGN(Profile);
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 99a93df32..fe50d0426 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -149,6 +149,7 @@ const char* kIAP2SystemConfigKey = "IAP2SystemConfig";
const char* kIAP2HubConnectAttemptskey = "IAP2HubConnectAttempts";
const char* kIAPHubConnectionWaitTimeoutKey = "ConnectionWaitTimeout";
const char* kDefaultHubProtocolIndexKey = "DefaultHubProtocolIndex";
+const char* kTTSGlobalPropertiesTimeoutKey = "TTSGlobalPropertiesTimeout";
const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json";
const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json";
@@ -206,6 +207,7 @@ const std::pair<uint32_t, uint32_t> kGetVehicleDataFrequency = {5 , 1};
const uint32_t kDefaultMaxThreadPoolSize = 2;
const int kDefaultIAP2HubConnectAttempts = 0;
const int kDefaultIAPHubConnectionWaitTimeout = 10;
+const uint16_t kDefaultTTSGlobalPropertiesTimeout = 20;
} // namespace
@@ -277,15 +279,15 @@ Profile::Profile()
iap_system_config_(kDefaultIAPSystemConfig),
iap2_system_config_(kDefaultIAP2SystemConfig),
iap2_hub_connect_attempts_(kDefaultIAP2HubConnectAttempts),
- iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout) {
+ iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout),
+ tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout) {
}
Profile::~Profile() {
}
void Profile::config_file_name(const std::string& fileName) {
- if (false == fileName.empty()) {
- LOG4CXX_INFO(logger_, "setConfigFileName " << fileName);
+ if (false == fileName.empty()) {
config_file_name_ = fileName;
UpdateValues();
}
@@ -586,6 +588,10 @@ int Profile::iap_hub_connection_wait_timeout() const {
return iap_hub_connection_wait_timeout_;
}
+uint16_t Profile::tts_global_properties_timeout() const {
+ return tts_global_properties_timeout_;
+}
+
void Profile::UpdateValues() {
LOG4CXX_INFO(logger_, "Profile::UpdateValues");
@@ -972,7 +978,16 @@ ReadStringValue(&app_info_storage_, kDefaultAppInfoFileName,
vr_help_command_value.clear();
LOG_UPDATED_VALUE(vr_help_command_value, kHelpCommandKey,
kVrCommandsSection);
- }
+ }
+
+ //TTS GlobalProperties timeout
+ ReadUIntValue(&tts_global_properties_timeout_,
+ kDefaultTTSGlobalPropertiesTimeout,
+ kGlobalPropertiesSection,
+ kTTSGlobalPropertiesTimeoutKey);
+
+ LOG_UPDATED_VALUE(tts_global_properties_timeout_, kTTSGlobalPropertiesTimeoutKey,
+ kGlobalPropertiesSection);
// Application time scale maximum requests
ReadUIntValue(&app_time_scale_max_requests_,
diff --git a/src/components/include/protocol/raw_message.h b/src/components/include/protocol/raw_message.h
index 35daa5292..09b5eafb7 100644
--- a/src/components/include/protocol/raw_message.h
+++ b/src/components/include/protocol/raw_message.h
@@ -52,10 +52,12 @@ class RawMessage {
* \param protocolVersion Version of protocol of the message
* \param data Message string
* \param dataSize Message size
+ * \param payload_size Received data size
*/
- RawMessage(uint32_t connection_key, uint32_t protocolVersion,
- const uint8_t *const data_param, uint32_t dataSize,
- uint8_t type = ServiceType::kRpc);
+ RawMessage(uint32_t connection_key, uint32_t protocol_version,
+ const uint8_t *const data_param, uint32_t data_size,
+ uint8_t type = ServiceType::kRpc,
+ uint32_t payload_size = 0);
/**
* \brief Destructor
*/
@@ -78,6 +80,10 @@ class RawMessage {
*/
size_t data_size() const;
/**
+ * \brief Getter for actual data size
+ */
+ size_t payload_size() const;
+ /**
* \brief Version of SmartDeviceLink protocol
* used for transferring message.
*/
@@ -102,6 +108,7 @@ class RawMessage {
size_t data_size_;
uint32_t protocol_version_;
ServiceType service_type_;
+ size_t payload_size_;
bool waiting_;
DISALLOW_COPY_AND_ASSIGN(RawMessage);
};
diff --git a/src/components/include/utils/threads/thread_delegate.h b/src/components/include/utils/threads/thread_delegate.h
index c1fefaa90..fec9b748b 100644
--- a/src/components/include/utils/threads/thread_delegate.h
+++ b/src/components/include/utils/threads/thread_delegate.h
@@ -57,6 +57,8 @@ class ThreadDelegate {
/**
* Should be called to free all resources allocated in threadMain
* and exiting threadMain
+ * This function should be blocking and return only when threadMain() will be
+ * finished in other case segmantation failes are possible
*/
virtual bool exitThreadMain() {
return false;
diff --git a/src/components/include/utils/timer_thread.h b/src/components/include/utils/timer_thread.h
index 6cce49e5c..3c36786a2 100644
--- a/src/components/include/utils/timer_thread.h
+++ b/src/components/include/utils/timer_thread.h
@@ -172,7 +172,7 @@ class TimerThread {
sync_primitives::Lock state_lock_;
sync_primitives::ConditionalVariable termination_condition_;
volatile bool stop_flag_;
-
+ int32_t calculateMillisecondsLeft();
private:
DISALLOW_COPY_AND_ASSIGN(TimerDelegate);
};
@@ -206,6 +206,8 @@ class TimerThread {
TimerDelegate* delegate_;
//threads::Thread* thread_;
mutable bool is_running_;
+ mutable bool is_looper_;
+
DISALLOW_COPY_AND_ASSIGN(TimerThread);
};
@@ -216,7 +218,8 @@ TimerThread<T>::TimerThread(const char* name, T* callee, void (T::*f)(), bool is
callback_(f),
callee_(callee),
delegate_(NULL),
- is_running_(false) {
+ is_running_(false),
+ is_looper_(is_looper) {
if (is_looper) {
delegate_ = new TimerLooperDelegate(this);
} else {
@@ -273,7 +276,9 @@ template <class T>
void TimerThread<T>::onTimeOut() const {
if (callee_ && callback_) {
(callee_->*callback_)();
- is_running_ = false;
+ if (!is_looper_) {
+ is_running_ = false;
+ }
}
}
@@ -281,6 +286,7 @@ template <class T>
TimerThread<T>::TimerDelegate::TimerDelegate(const TimerThread* timer_thread)
: timer_thread_(timer_thread),
timeout_seconds_(0),
+ state_lock_(true),
stop_flag_(false) {
DCHECK(timer_thread_);
}
@@ -299,16 +305,14 @@ template <class T>
void TimerThread<T>::TimerDelegate::threadMain() {
using sync_primitives::ConditionalVariable;
sync_primitives::AutoLock auto_lock(state_lock_);
- const time_t end_time = time(NULL) + timeout_seconds_;
- int32_t wait_seconds_left = int32_t(difftime(end_time, time(NULL)));
while (!stop_flag_) {
// Sleep
+ int32_t wait_milliseconds_left = TimerDelegate::calculateMillisecondsLeft();
ConditionalVariable::WaitStatus wait_status =
- termination_condition_.WaitFor(auto_lock, wait_seconds_left * 1000);
- wait_seconds_left = int32_t(difftime(end_time, time(NULL)));
+ termination_condition_.WaitFor(auto_lock, wait_milliseconds_left);
// Quit sleeping or continue sleeping in case of spurious wake up
if (ConditionalVariable::kTimeout == wait_status ||
- wait_seconds_left <= 0) {
+ wait_milliseconds_left <= 0) {
break;
}
}
@@ -323,19 +327,7 @@ void TimerThread<T>::TimerLooperDelegate::threadMain() {
using sync_primitives::ConditionalVariable;
sync_primitives::AutoLock auto_lock(TimerDelegate::state_lock_);
while (!TimerDelegate::stop_flag_) {
- time_t cur_time = time(NULL);
- time_t end_time = std::numeric_limits<time_t>::max();
- if (TimerDelegate::timeout_seconds_ + cur_time > TimerDelegate::timeout_seconds_) { // no overflow occurred
- end_time = cur_time + TimerDelegate::timeout_seconds_;
- }
-
- int64_t wait_seconds_left = static_cast<int64_t>(difftime(end_time, cur_time));
- int32_t wait_milliseconds_left = std::numeric_limits<int32_t>::max();
- const int32_t millisecconds_in_second = 1000;
- if (wait_seconds_left < std::numeric_limits<int32_t>::max() / millisecconds_in_second) {
- wait_milliseconds_left = millisecconds_in_second * wait_seconds_left;
- }
-
+ int32_t wait_milliseconds_left = TimerDelegate::calculateMillisecondsLeft();
ConditionalVariable::WaitStatus wait_status =
TimerDelegate::termination_condition_.WaitFor(auto_lock, wait_milliseconds_left);
// Quit sleeping or continue sleeping in case of spurious wake up
@@ -347,7 +339,6 @@ void TimerThread<T>::TimerLooperDelegate::threadMain() {
LOG4CXX_DEBUG(logger_, "Timeout reset force: " << TimerDelegate::timeout_seconds_);
}
}
- TimerDelegate::stop_flag_ = false;
}
@@ -358,6 +349,8 @@ bool TimerThread<T>::TimerDelegate::exitThreadMain() {
stop_flag_ = true;
}
termination_condition_.NotifyOne();
+ // FIXME(AKutsan)
+ {sync_primitives::AutoLock wait_for_thread_main(state_lock_);}
return true;
}
@@ -367,6 +360,22 @@ void TimerThread<T>::TimerDelegate::setTimeOut(const uint32_t timeout_seconds) {
termination_condition_.NotifyOne();
}
+template <class T>
+int32_t TimerThread<T>::TimerThread::TimerDelegate::calculateMillisecondsLeft() {
+ time_t cur_time = time(NULL);
+ time_t end_time = std::numeric_limits<time_t>::max();
+ if (TimerDelegate::timeout_seconds_ + cur_time > TimerDelegate::timeout_seconds_) { // no overflow occurred
+ end_time = cur_time + TimerDelegate::timeout_seconds_;
+ }
+
+ int64_t wait_seconds_left = static_cast<int64_t>(difftime(end_time, cur_time));
+ int32_t wait_milliseconds_left = std::numeric_limits<int32_t>::max();
+ const int32_t millisecconds_in_second = 1000;
+ if (wait_seconds_left < std::numeric_limits<int32_t>::max() / millisecconds_in_second) {
+ wait_milliseconds_left = millisecconds_in_second * wait_seconds_left;
+ }
+ return wait_milliseconds_left;
+}
} // namespace timer
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 72e29faa2..986b6f0a0 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -2436,11 +2436,10 @@
</function>
<function name="SetGlobalProperties" messagetype="request">
<description>Sets some properties for the application initiated request.</description>
- <param name="helpPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
+ <param name="helpPrompt" type="Common.TTSChunk" minsize="0" maxsize="100" array="true" mandatory="false" >
<description>
The help prompt.
An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
</description>
</param>
<param name="timeoutPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
diff --git a/src/components/media_manager/include/media_manager/socket_streamer_adapter.h b/src/components/media_manager/include/media_manager/socket_streamer_adapter.h
index b176f95f4..87c705a20 100644
--- a/src/components/media_manager/include/media_manager/socket_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/socket_streamer_adapter.h
@@ -119,7 +119,7 @@ class SocketStreamerAdapter : public MediaAdapterImpl {
bool is_first_loop_;
volatile bool is_client_connected_;
volatile bool stop_flag_;
-
+ sync_primitives::Lock thread_lock;
DISALLOW_COPY_AND_ASSIGN(Streamer);
};
@@ -128,7 +128,6 @@ class SocketStreamerAdapter : public MediaAdapterImpl {
threads::Thread* thread_;
Streamer* streamer_;
MessageQueue<RawMessagePtr> messages_;
-
DISALLOW_COPY_AND_ASSIGN(SocketStreamerAdapter);
};
} // namespace media_manager
diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc
index 4814e8fc3..708b37dbe 100644
--- a/src/components/media_manager/src/socket_streamer_adapter.cc
+++ b/src/components/media_manager/src/socket_streamer_adapter.cc
@@ -60,52 +60,49 @@ SocketStreamerAdapter::~SocketStreamerAdapter() {
thread_->stop();
streamer_ = NULL;
delete thread_;
- if (socket_fd_ != -1) {
- ::close(socket_fd_);
- }
}
void SocketStreamerAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_INFO(logger, "SocketStreamerAdapter::start");
+ LOG4CXX_TRACE(logger, "enter " << application_key);
if (application_key == current_application_) {
LOG4CXX_INFO(logger, "Already running for app " << application_key);
- return;
- }
+ } else {
+ is_ready_ = true;
+ current_application_ = application_key;
- is_ready_ = true;
- current_application_ = application_key;
+ messages_.Reset();
- messages_.Reset();
-
- for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
- media_listeners_.end() != it;
- ++it) {
- (*it)->OnActivityStarted(application_key);
+ for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
+ media_listeners_.end() != it;
+ ++it) {
+ (*it)->OnActivityStarted(application_key);
+ }
}
+ LOG4CXX_TRACE(logger, "exit");
}
void SocketStreamerAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_INFO(logger, "SocketStreamerAdapter::stop");
+ LOG4CXX_TRACE(logger, "enter " << application_key);
if (application_key != current_application_) {
LOG4CXX_WARN(logger, "Streaming is not active for " << application_key);
- return;
- }
-
- is_ready_ = false;
- current_application_ = 0;
+ } else {
+ is_ready_ = false;
+ current_application_ = 0;
- if (streamer_) {
- streamer_->stop();
- messages_.Shutdown();
- }
+ if (streamer_) {
+ streamer_->stop();
+ messages_.Shutdown();
+ }
- for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
- media_listeners_.end() != it;
- ++it) {
- (*it)->OnActivityEnded(application_key);
+ for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
+ media_listeners_.end() != it;
+ ++it) {
+ (*it)->OnActivityEnded(application_key);
+ }
}
+ LOG4CXX_TRACE(logger, "exit");
}
bool SocketStreamerAdapter::is_app_performing_activity(
@@ -120,13 +117,15 @@ void SocketStreamerAdapter::Init() {
thread_ = new threads::Thread("SocketStreamer", streamer_);
const size_t kStackSize = 16384;
thread_->startWithOptions(threads::ThreadOptions(kStackSize));
+ } else {
+ LOG4CXX_WARN(logger, "thread is already exist");
}
}
void SocketStreamerAdapter::SendData(
int32_t application_key,
const RawMessagePtr message) {
- LOG4CXX_INFO(logger, "SocketStreamerAdapter::sendData");
+ LOG4CXX_INFO(logger, "SendData(application_key = " << application_key << ")");
if (application_key != current_application_) {
@@ -154,13 +153,13 @@ SocketStreamerAdapter::Streamer::~Streamer() {
}
void SocketStreamerAdapter::Streamer::threadMain() {
- LOG4CXX_INFO(logger, "Streamer::threadMain");
-
+ LOG4CXX_TRACE(logger,"enter " << this);
+ sync_primitives::AutoLock auto_lock(thread_lock);
start();
while (!stop_flag_) {
new_socket_fd_ = accept(server_->socket_fd_, NULL, NULL);
-
+ LOG4CXX_INFO(logger, "Client connectd " << new_socket_fd_);
if (0 > new_socket_fd_) {
LOG4CXX_ERROR(logger, "Socket is closed " << strerror(errno));
sleep(1);
@@ -197,18 +196,25 @@ void SocketStreamerAdapter::Streamer::threadMain() {
stop();
break;
}
-
server_->messages_.wait();
}
}
+ LOG4CXX_TRACE(logger,"exit " << this);
}
bool SocketStreamerAdapter::Streamer::exitThreadMain() {
- LOG4CXX_INFO(logger, "Streamer::exitThreadMain");
+ LOG4CXX_TRACE(logger,"enter " << this);
stop_flag_ = true;
stop();
server_->messages_.Shutdown();
- return false;
+ //exith threadMainshould whait while threadMain will be finished
+ if (server_->socket_fd_ != -1) {
+ shutdown(server_->socket_fd_, SHUT_RDWR);
+ close(server_->socket_fd_);
+ }
+ sync_primitives::AutoLock auto_lock(thread_lock);
+ LOG4CXX_TRACE(logger,"exit " << this);
+ return true;
}
void SocketStreamerAdapter::Streamer::start() {
@@ -247,23 +253,18 @@ void SocketStreamerAdapter::Streamer::start() {
}
void SocketStreamerAdapter::Streamer::stop() {
- LOG4CXX_INFO(logger, "SocketStreamerAdapter::Streamer::stop");
- if (!new_socket_fd_) {
- return;
- }
-
- if (-1 == shutdown(new_socket_fd_, SHUT_RDWR)) {
- LOG4CXX_ERROR(logger, "Unable to shutdown socket");
- return;
- }
-
- if (-1 == ::close(new_socket_fd_)) {
- LOG4CXX_ERROR(logger, "Unable to close socket");
- return;
+ LOG4CXX_TRACE(logger,"enter " << this);
+ if (0 == new_socket_fd_) {
+ LOG4CXX_ERROR(logger, "Client Socket does not exits: ");
+ } else if (-1 == shutdown(new_socket_fd_, SHUT_RDWR)) {
+ LOG4CXX_ERROR(logger, "Unable to shutdown socket " << strerror(errno));
+ } else if (-1 == ::close(new_socket_fd_)) {
+ LOG4CXX_ERROR(logger, "Unable to close socket " << strerror(errno));
}
- new_socket_fd_ = -1;
+ new_socket_fd_ = 0;
is_client_connected_ = false;
+ LOG4CXX_TRACE(logger,"exit" << this);
}
bool SocketStreamerAdapter::Streamer::is_ready() const {
@@ -285,7 +286,6 @@ bool SocketStreamerAdapter::Streamer::is_ready() const {
LOG4CXX_ERROR_EXT(logger, "The timeout expired");
result = false;
}
-
return result;
}
diff --git a/src/components/policy/src/policy/include/policy/cache_manager.h b/src/components/policy/src/policy/include/policy/cache_manager.h
index 320732c64..186837379 100644
--- a/src/components/policy/src/policy/include/policy/cache_manager.h
+++ b/src/components/policy/src/policy/include/policy/cache_manager.h
@@ -472,6 +472,17 @@ public:
FunctionalGroupIDs& allowed_groups,
FunctionalGroupIDs& disallowed_groups);
+ /**
+ * @brief GetUnconsentedGroups allows to obtain list of allowed and disallowed
+ * groups for specific application on certain device.
+ * @param device_id certain device
+ * @param policy_app_id application id.
+ * @param unconsented_groups list of unconsented groups.
+ */
+ void GetUnconsentedGroups(const std::string& device_id,
+ const std::string& policy_app_id,
+ FunctionalGroupIDs& unconsented_groups);
+
void RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name);
diff --git a/src/components/policy/src/policy/include/policy/policy_manager.h b/src/components/policy/src/policy/include/policy/policy_manager.h
index 36b771f90..61f23aa23 100644
--- a/src/components/policy/src/policy/include/policy/policy_manager.h
+++ b/src/components/policy/src/policy/include/policy/policy_manager.h
@@ -395,6 +395,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param new value for the parameter.
*/
virtual void SetVINValue(const std::string& value) = 0;
+
+ /**
+ * @brief Checks, if application has policy assigned w/o data consent
+ * @param policy_app_id Unique application id
+ * @return true, if policy assigned w/o data consent, otherwise -false
+ */
+ virtual bool IsPredataPolicy(const std::string& policy_app_id) = 0;
};
} // namespace policy
diff --git a/src/components/policy/src/policy/include/policy/policy_manager_impl.h b/src/components/policy/src/policy/include/policy/policy_manager_impl.h
index a7f1008c1..62e519ee6 100644
--- a/src/components/policy/src/policy/include/policy/policy_manager_impl.h
+++ b/src/components/policy/src/policy/include/policy/policy_manager_impl.h
@@ -167,6 +167,8 @@ class PolicyManagerImpl : public PolicyManager {
virtual void RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name);
+ virtual bool IsPredataPolicy(const std::string& policy_app_id);
+
protected:
virtual utils::SharedPtr<policy_table::Table> Parse(
const BinaryMessage& pt_content);
diff --git a/src/components/policy/src/policy/include/policy/policy_types.h b/src/components/policy/src/policy/include/policy/policy_types.h
index 93b0f8b77..4212df9b8 100644
--- a/src/components/policy/src/policy/include/policy/policy_types.h
+++ b/src/components/policy/src/policy/include/policy/policy_types.h
@@ -276,6 +276,7 @@ enum GroupType {
kTypeDefault = 0, // groups assigned to 'default' permissions section
kTypeAllowed, // groups allowed by user for specific application
kTypeDisallowed, // groups disallowed by user for specific application
+ kTypeUnconsented, // groups disallowed by default but consent may be changed by user
kTypePreconsented, // groups allowed for specific application without
// user consent by default (could be changed by user)
kTypeGeneral, // groups assigned to specific application
diff --git a/src/components/policy/src/policy/policy_table/table_struct_ext/enums.cc b/src/components/policy/src/policy/policy_table/table_struct_ext/enums.cc
index d40fee450..ad51f7599 100644
--- a/src/components/policy/src/policy/policy_table/table_struct_ext/enums.cc
+++ b/src/components/policy/src/policy/policy_table/table_struct_ext/enums.cc
@@ -7,7 +7,7 @@ bool IsValidEnum(Priority val) {
switch (val) {
case P_EMERGENCY: return true;
case P_NAVIGATION: return true;
- case P_VOICECOMM: return true;
+ case P_VOICECOM: return true;
case P_COMMUNICATION: return true;
case P_NORMAL: return true;
case P_NONE: return true;
@@ -18,7 +18,7 @@ const char* EnumToJsonString(Priority val) {
switch (val) {
case P_EMERGENCY: return "EMERGENCY";
case P_NAVIGATION: return "NAVIGATION";
- case P_VOICECOMM: return "VOICECOMM";
+ case P_VOICECOM: return "VOICECOM";
case P_COMMUNICATION: return "COMMUNICATION";
case P_NORMAL: return "NORMAL";
case P_NONE: return "NONE";
@@ -32,8 +32,8 @@ bool EnumFromJsonString(const std::string& literal, Priority* result) {
} else if ("NAVIGATION" == literal) {
*result = P_NAVIGATION;
return true;
- } else if ("VOICECOMM" == literal) {
- *result = P_VOICECOMM;
+ } else if ("VOICECOM" == literal) {
+ *result = P_VOICECOM;
return true;
} else if ("COMMUNICATION" == literal) {
*result = P_COMMUNICATION;
diff --git a/src/components/policy/src/policy/policy_table/table_struct_ext/enums.h b/src/components/policy/src/policy/policy_table/table_struct_ext/enums.h
index 5be102b04..5137477aa 100644
--- a/src/components/policy/src/policy/policy_table/table_struct_ext/enums.h
+++ b/src/components/policy/src/policy/policy_table/table_struct_ext/enums.h
@@ -9,7 +9,7 @@ namespace policy_table_interface_base {
enum Priority {
P_EMERGENCY,
P_NAVIGATION,
- P_VOICECOMM,
+ P_VOICECOM,
P_COMMUNICATION,
P_NORMAL,
P_NONE,
diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc
index b59c551b5..3cc317827 100644
--- a/src/components/policy/src/policy/src/cache_manager.cc
+++ b/src/components/policy/src/policy/src/cache_manager.cc
@@ -225,6 +225,47 @@ void CacheManager::GetConsentedGroups(const std::string &device_id,
LOG4CXX_TRACE_EXIT(logger_);
}
+void CacheManager::GetUnconsentedGroups(const std::string& device_id,
+ const std::string& policy_app_id,
+ FunctionalGroupIDs& unconsented_groups) {
+ LOG4CXX_TRACE_ENTER(logger_);
+#ifdef EXTENDED_POLICY
+ if (AppExists(policy_app_id)) {
+ policy_table::Strings::iterator iter_groups =
+ pt_->policy_table.app_policies[policy_app_id].groups.begin();
+ policy_table::Strings::iterator iter_groups_end =
+ pt_->policy_table.app_policies[policy_app_id].groups.end();
+
+ for (;iter_groups != iter_groups_end; ++iter_groups) {
+ policy_table::FunctionalGroupings::const_iterator func_groups =
+ pt_->policy_table.functional_groupings.find(*iter_groups);
+ // Try to find app-specific group in common groups list;
+ if (pt_->policy_table.functional_groupings.end() != func_groups) {
+ // Check if groups has user consents field.
+ if (func_groups->second.user_consent_prompt.is_initialized()) {
+ // Try to find certain group among already consented groups.
+ policy_table::DeviceData::const_iterator device_iter =
+ pt_->policy_table.device_data->find(device_id);
+ if (pt_->policy_table.device_data->end() != device_iter) {
+ policy_table::UserConsentRecords::const_iterator ucr_iter =
+ device_iter->second.user_consent_records->find(policy_app_id);
+ if (device_iter->second.user_consent_records->end() != ucr_iter) {
+ if ((*ucr_iter).second.consent_groups->end() ==
+ (*ucr_iter).second.consent_groups->find(*iter_groups)) {
+ unconsented_groups.push_back(GenerateHash(*iter_groups));
+ }
+ } else {
+ unconsented_groups.push_back(GenerateHash(*iter_groups));
+ }
+ }
+ }
+ }
+ }
+ }
+#endif // EXTENDED_POLICY
+ LOG4CXX_TRACE_EXIT(logger_);
+}
+
void CacheManager::RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name) {
#ifdef EXTENDED_POLICY
@@ -319,6 +360,8 @@ bool CacheManager::GetPermissionsForApp(const std::string &device_id,
GetConsentedGroups(device_id, app_id,
group_types[kTypeAllowed], group_types[kTypeDisallowed]);
+ GetUnconsentedGroups(device_id, app_id, group_types[kTypeUnconsented]);
+
GetAllAppGroups(kDeviceId, group_types[kTypeDevice]);
#endif // EXTENDED_POLICY
LOG4CXX_TRACE_EXIT(logger_);
diff --git a/src/components/policy/src/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy/src/policy_manager_impl.cc
index 2dff10903..fb31f940a 100644
--- a/src/components/policy/src/policy/src/policy_manager_impl.cc
+++ b/src/components/policy/src/policy/src/policy_manager_impl.cc
@@ -851,6 +851,9 @@ void PolicyManagerImpl::GetPermissionsForApp(
// Groups that allowed by default but can be changed by the user
FunctionalGroupIDs preconsented_groups = group_types[kTypePreconsented];
+ // Groups which has user consent promt but there is no any consnets now.
+ FunctionalGroupIDs unconsented_groups = group_types[kTypeUnconsented];
+
// Pull common groups from allowed and preconsented parts.
FunctionalGroupIDs allowed_preconsented = Merge(allowed_groups,
preconsented_groups);
@@ -864,21 +867,20 @@ void PolicyManagerImpl::GetPermissionsForApp(
// all disallowed groups from allowed table.
FunctionalGroupIDs common_allowed = ExcludeSame(all_allowed,
common_disallowed);
+ FunctionalGroupIDs consent_disallowed = ExcludeSame(unconsented_groups,
+ preconsented_groups);
- // Remove all disallowed groups from application specific groups.
- FunctionalGroupIDs no_disallowed = ExcludeSame(all_groups,
- common_disallowed);
-
- // Undefined groups are groups that have no allowed or disallowed type.
- FunctionalGroupIDs undefined_consent = ExcludeSame(no_disallowed,
- common_allowed);
+ // Disallowed groups are contain all directly disallowed,
+ // plus unconsented minus preconsented.
+ FunctionalGroupIDs all_disallowed = Merge(common_disallowed,
+ consent_disallowed);
// Fill result
- FillFunctionalGroupPermissions(undefined_consent, group_names,
+ FillFunctionalGroupPermissions(unconsented_groups, group_names,
kGroupUndefined, permissions);
FillFunctionalGroupPermissions(common_allowed, group_names,
kGroupAllowed, permissions);
- FillFunctionalGroupPermissions(common_disallowed, group_names,
+ FillFunctionalGroupPermissions(all_disallowed, group_names,
kGroupDisallowed, permissions);
#else
// In case of GENIVI all groups are allowed
@@ -1093,17 +1095,11 @@ void PolicyManagerImpl::RemovePendingPermissionChanges(
}
bool PolicyManagerImpl::CanAppKeepContext(const std::string& app_id) {
-#ifdef EXTENDED_POLICY
return cache.CanAppKeepContext(app_id);
-#endif // EXTENDED_POLICY
- return false;
}
bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) {
-#ifdef EXTENDED_POLICY
- cache.CanAppStealFocus(app_id);
-#endif // EXTENDED_POLICY
- return false;
+ return cache.CanAppStealFocus(app_id);
}
void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {
@@ -1140,7 +1136,12 @@ bool PolicyManagerImpl::IsAppInUpdateList(const std::string& app_id) const {
void PolicyManagerImpl::RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name) {
- cache.RemoveAppConsentForGroup(app_id, group_name);
+ cache.RemoveAppConsentForGroup(app_id, group_name);
+}
+
+bool PolicyManagerImpl::IsPredataPolicy(const std::string &policy_app_id) {
+ LOG4CXX_INFO(logger_, "IsPredataApp");
+ return cache.IsPredataPolicy(policy_app_id);
}
void PolicyManagerImpl::AddNewApplication(const std::string& application_id,
diff --git a/src/components/policy/src/policy/src/sql_pt_ext_representation.cc b/src/components/policy/src/policy/src/sql_pt_ext_representation.cc
index 4eb3f2dcb..24b400a02 100644
--- a/src/components/policy/src/policy/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/src/policy/src/sql_pt_ext_representation.cc
@@ -980,7 +980,7 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
return false;
}
query.Bind(0, device_id);
- query.Bind(1, CacheManager::GenerateHash(it_groups->first));
+ query.Bind(1, it_groups->first);
query.Bind(2, it_groups->second);
query.Bind(
3,
diff --git a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h
index e767aaafa..c19507fcf 100644
--- a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h
+++ b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -40,41 +40,41 @@ namespace usage_statistics {
class GlobalCounter {
public:
- GlobalCounter(StatisticsManager* statistics_manager,
+ GlobalCounter(StatisticsManager* const & statistics_manager,
GlobalCounterId counter_type);
void operator++() const;
private:
GlobalCounterId counter_type_;
- StatisticsManager* statistics_manager_;
+ StatisticsManager* const & statistics_manager_;
};
class AppCounter {
public:
- AppCounter(StatisticsManager* statistics_manager,
+ AppCounter(StatisticsManager* const & statistics_manager,
const std::string& app_id,
AppCounterId counter_type);
void operator++() const;
private:
std::string app_id_;
AppCounterId counter_type_;
- StatisticsManager* statistics_manager_;
+ StatisticsManager* const & statistics_manager_;
};
class AppInfo {
public:
- AppInfo(StatisticsManager* statistics_manager,
+ AppInfo(StatisticsManager* const & statistics_manager,
const std::string& app_id,
AppInfoId info_type);
void Update(const std::string& new_info) const;
private:
std::string app_id_;
AppInfoId info_type_;
- StatisticsManager* statistics_manager_;
+ StatisticsManager* const & statistics_manager_;
};
class AppStopwatch {
public:
- AppStopwatch(StatisticsManager* statistics_manager,
+ AppStopwatch(StatisticsManager* const & statistics_manager,
const std::string& app_id);
~AppStopwatch();
void Start(AppStopwatchId stopwatch_type);
@@ -84,7 +84,7 @@ class AppStopwatch {
// Fields
std::string app_id_;
AppStopwatchId stopwatch_type_;
- StatisticsManager* statistics_manager_;
+ StatisticsManager* const & statistics_manager_;
time_t start_time_;
};
diff --git a/src/components/policy/src/policy/usage_statistics/src/counter.cc b/src/components/policy/src/policy/usage_statistics/src/counter.cc
index 8ed19148d..123d54291 100644
--- a/src/components/policy/src/policy/usage_statistics/src/counter.cc
+++ b/src/components/policy/src/policy/usage_statistics/src/counter.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -38,7 +38,7 @@
namespace usage_statistics {
-GlobalCounter::GlobalCounter(StatisticsManager* statistics_manager,
+GlobalCounter::GlobalCounter(StatisticsManager* const & statistics_manager,
GlobalCounterId counter_type)
: counter_type_(counter_type),
statistics_manager_(statistics_manager) {
@@ -50,7 +50,7 @@ void GlobalCounter::operator++() const {
}
}
-AppCounter::AppCounter(StatisticsManager* statistics_manager,
+AppCounter::AppCounter(StatisticsManager* const & statistics_manager,
const std::string& app_id,
AppCounterId counter_type)
: app_id_(app_id),
@@ -64,7 +64,7 @@ void AppCounter::operator++() const {
}
}
-AppInfo::AppInfo(StatisticsManager* statistics_manager,
+AppInfo::AppInfo(StatisticsManager* const & statistics_manager,
const std::string& app_id,
AppInfoId info_type)
: app_id_(app_id),
@@ -78,7 +78,7 @@ void AppInfo::Update(const std::string& new_info) const {
}
}
-AppStopwatch::AppStopwatch(StatisticsManager* statistics_manager,
+AppStopwatch::AppStopwatch(StatisticsManager* const & statistics_manager,
const std::string& app_id)
: app_id_(app_id),
stopwatch_type_(SECONDS_HMI_NONE),
diff --git a/src/components/protocol/CMakeLists.txt b/src/components/protocol/CMakeLists.txt
index 2e4caac12..b8c1f88fc 100644
--- a/src/components/protocol/CMakeLists.txt
+++ b/src/components/protocol/CMakeLists.txt
@@ -1,5 +1,6 @@
include_directories(
./include
+ ${APR_INCLUDE_DIRECTORY}
)
set(SOURCES
diff --git a/src/components/protocol/src/raw_message.cc b/src/components/protocol/src/raw_message.cc
index b2300b6d4..348eb1619 100644
--- a/src/components/protocol/src/raw_message.cc
+++ b/src/components/protocol/src/raw_message.cc
@@ -36,14 +36,15 @@
namespace protocol_handler {
-RawMessage::RawMessage(uint32_t connection_key, uint32_t protocolVersion,
+RawMessage::RawMessage(uint32_t connection_key, uint32_t protocol_version,
const uint8_t *const data_param, uint32_t data_sz,
- uint8_t type)
+ uint8_t type, uint32_t payload_size)
: connection_key_(connection_key),
data_(NULL),
- data_size_(data_sz) ,
- protocol_version_(protocolVersion),
+ data_size_(data_sz),
+ protocol_version_(protocol_version),
service_type_(ServiceTypeFromByte(type)),
+ payload_size_(payload_size),
waiting_(false) {
if (data_sz > 0) {
data_ = new uint8_t[data_sz];
@@ -67,6 +68,10 @@ uint8_t *RawMessage::data() const {
return data_;
}
+size_t RawMessage::payload_size() const {
+ return payload_size_;
+}
+
size_t RawMessage::data_size() const {
return data_size_;
}
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
index a0f73b4ce..2e3d39fd4 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
@@ -263,6 +263,11 @@ class ProtocolPacket {
*/
uint8_t connection_id() const;
+ /**
+ * \brief Getter for data payload size
+ */
+ uint32_t payload_size() const;
+
private:
/**
*\brief Protocol header
@@ -275,6 +280,11 @@ class ProtocolPacket {
ProtocolData packet_data_;
/**
+ *\brief Actual size of received data
+ */
+ uint32_t payload_size_;
+
+ /**
*\brief Offset for multiframe messages
*/
uint32_t data_offset_;
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index c0f329294..858663499 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -755,8 +755,12 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
session_observer_->KeyFromPair(connection_id, packet->session_id());
const RawMessagePtr rawMessage(
- new RawMessage(connection_key, packet->protocol_version(), packet->data(),
- packet->total_data_bytes(), packet->service_type()));
+ new RawMessage(connection_key,
+ packet->protocol_version(),
+ packet->data(),
+ packet->total_data_bytes(),
+ packet->service_type(),
+ packet->payload_size()));
if (!rawMessage) {
LOG4CXX_TRACE_EXIT(logger_);
return RESULT_FAIL;
@@ -847,7 +851,14 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(
completePacket->protocol_version(),
completePacket->data(),
completePacket->total_data_bytes(),
- completePacket->service_type()));
+ completePacket->service_type(),
+ completePacket->payload_size()));
+
+ LOG4CXX_INFO(logger_,
+ "total_data_bytes " << completePacket->total_data_bytes() <<
+ " packet_size " << completePacket->packet_size() <<
+ " data size " << completePacket->data_size() <<
+ " payload_size " << completePacket->payload_size());
if (!rawMessage) {
LOG4CXX_TRACE_EXIT(logger_);
diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc
index 5ff890d41..19c73127c 100644
--- a/src/components/protocol_handler/src/protocol_packet.cc
+++ b/src/components/protocol_handler/src/protocol_packet.cc
@@ -39,7 +39,7 @@
namespace protocol_handler {
ProtocolPacket::ProtocolPacket()
- : data_offset_(0),
+ : payload_size_(0),
packet_id_(0),
connection_id_(0) {
}
@@ -54,7 +54,7 @@ ProtocolPacket::ProtocolPacket(uint8_t connection_id,
uint32_t packet_id)
: packet_header_(version, protection, frameType, serviceType,
frameData, sessionID, dataSize, messageID),
- data_offset_(0),
+ payload_size_(0),
packet_id_(packet_id),
connection_id_(connection_id) {
set_data(data, dataSize);
@@ -63,7 +63,7 @@ ProtocolPacket::ProtocolPacket(uint8_t connection_id,
ProtocolPacket::ProtocolPacket(uint8_t connection_id, uint8_t *data_param,
uint32_t data_size)
- : data_offset_(0),
+ : payload_size_(0),
packet_id_(0),
connection_id_(connection_id) {
RESULT_CODE result = deserializePacket(data_param, data_size);
@@ -130,11 +130,11 @@ uint32_t ProtocolPacket::packet_id() const {
RESULT_CODE ProtocolPacket::appendData(uint8_t *chunkData,
uint32_t chunkDataSize) {
- if (data_offset_ + chunkDataSize <= packet_data_.totalDataBytes) {
+ if (payload_size_ + chunkDataSize <= packet_data_.totalDataBytes) {
if (chunkData) {
if (packet_data_.data) {
- memcpy(packet_data_.data + data_offset_, chunkData, chunkDataSize);
- data_offset_ += chunkDataSize;
+ memcpy(packet_data_.data + payload_size_, chunkData, chunkDataSize);
+ payload_size_ += chunkDataSize;
return RESULT_OK;
}
}
@@ -194,14 +194,14 @@ RESULT_CODE ProtocolPacket::deserializePacket(const uint8_t *message,
data = new (std::nothrow) uint8_t[dataPayloadSize];
if (data) {
memcpy(data, message + offset, dataPayloadSize);
- data_offset_ = dataPayloadSize;
+ payload_size_ = dataPayloadSize;
} else {
return RESULT_FAIL;
}
}
if (packet_header_.frameType == FRAME_TYPE_FIRST) {
- data_offset_ = 0;
+ payload_size_ = 0;
const uint8_t *data = message + offset;
uint32_t total_data_bytes = data[0] << 24;
total_data_bytes |= data[1] << 16;
@@ -293,5 +293,9 @@ uint8_t ProtocolPacket::connection_id() const {
return connection_id_;
}
+uint32_t ProtocolPacket::payload_size() const {
+ return payload_size_;
+}
+
// End of Deserialization
} // namespace protocol_handler
diff --git a/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml b/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml
index afc6ea0ca..26cfe9abe 100644
--- a/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml
+++ b/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml
@@ -38,7 +38,6 @@ import "../models/Constants.js" as Constants
Item {
id: headerMenu
anchors.fill: parent
-
Text {
anchors.leftMargin: Constants.margin
anchors.topMargin: Constants.margin
diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml
index 46dd6b71d..d89747c3c 100644
--- a/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml
+++ b/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml
@@ -379,7 +379,7 @@ Item {
case Common.ClockUpdateMode.RESUME:
// Already resumed or cleared
if ((app.mediaClock.runningMode === Internal.MediaClockRunningMode.MCR_RUNNING)
- || (app.mediaClock.startTime === -1 && app.mediaClock.endTime === -1)) {
+ || (app.mediaClock.startTime === app.mediaClock.endTime)) {
resultCode = Common.Result.IGNORED
sendErrorResponce = true
break
@@ -567,7 +567,6 @@ Item {
}
function scrollableMessage (messageText, timeout, softButtons, appID) {
-
var softButtonsLog = "",
messageTextLog = "";
if (softButtons) {
@@ -591,7 +590,6 @@ Item {
"softButtons: [" + softButtonsLog + "]," +
"appID: " + appID + "', " +
"}}")
-
// TODO{ALeshin}: Also check HMILevel, when it will be available. It should be FULL otherwise - REJECTED
if (contentLoader.item.systemContext !== Common.SystemContext.SYSCTXT_MAIN) {
return { __retCode: Common.Result.REJECTED, __message: "System Context isn't MAIN" }
diff --git a/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml
index f796ad2b1..94eb72493 100644
--- a/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml
+++ b/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml
@@ -74,6 +74,10 @@ PopUp {
text: command
onClicked: {
sdlVR.onCommand(cmdID, appID === 0 ? undefined : appID);
+ if(dataContainer.activeVR) {
+ vrPopUp.complete();
+ vrHelpPopup.hide()
+ }
}
}
}
diff --git a/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml b/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml
index 422474f4a..231ab0313 100644
--- a/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml
+++ b/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml
@@ -119,7 +119,7 @@ GeneralView {
id: text1
width: parent.width
verticalAlignment: Text.AlignVCenter
- horizontalAlignment: dataContainer.hmiUITextAlignment
+ horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment
text: dataContainer.currentApplication.hmiUIText.mainField1
font.pixelSize: Constants.fontSize
color: Constants.primaryColor
@@ -128,7 +128,7 @@ GeneralView {
Text {
width: parent.width
verticalAlignment: Text.AlignVCenter
- horizontalAlignment: dataContainer.hmiUITextAlignment
+ horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment
text: dataContainer.currentApplication.hmiUIText.mainField2
font.pixelSize: Constants.fontSize
color: Constants.primaryColor
diff --git a/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml b/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml
index 72ca59688..ec9731d1c 100644
--- a/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml
+++ b/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml
@@ -48,9 +48,11 @@ GeneralView {
DBus.sendReply(dataContainer.scrollableMessageModel.async, { __retCode: dataContainer.scrollableMessageModel.result })
}
Component.onCompleted: {
+ dataContainer.scrollableMessageModel.result = Common.Result.ABORTED
dataContainer.scrollableMessageModel.running = true
timer.start()
}
+
Timer {
id: timer
interval: dataContainer.scrollableMessageModel.timeout
@@ -167,6 +169,7 @@ GeneralView {
function getBackButton(){
return backButton
}
+
/**
* Test Support Section End
*/
diff --git a/src/components/security_manager/CMakeLists.txt b/src/components/security_manager/CMakeLists.txt
index a883bd7cc..13a22a5b2 100644
--- a/src/components/security_manager/CMakeLists.txt
+++ b/src/components/security_manager/CMakeLists.txt
@@ -5,6 +5,7 @@ include_directories(
../utils/include/
${JSONCPP_INCLUDE_DIRECTORY}
${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/jsoncpp/include
+ ${APR_INCLUDE_DIRECTORY}
)
set (SOURCES
diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc
index 638609f40..8f572e427 100644
--- a/src/components/smart_objects/src/object_schema_item.cc
+++ b/src/components/smart_objects/src/object_schema_item.cc
@@ -95,14 +95,14 @@ void CObjectSchemaItem::applySchema(SmartObject& Object) {
for (SmartMap::const_iterator it = Object.map_begin(); it != Object.map_end(); ) {
const std::string& key = it->first;
if (mMembers.end() == mMembers.find(key)
- // FIXME(EZamakhov): Remove illigal usage of filed in AM
+ // FIXME(EZamakhov): Remove illegal usage of filed in AM
&& key.compare(connection_key) != 0
&& key.compare(binary_data) != 0
&& key.compare(app_id) != 0
) {
++it;
- // remove fake params
- Object.erase(key);
+ // FIXME(DK): remove fake params. There are error responses with params
+ // Object.erase(key);
} else {
it++;
}
diff --git a/src/components/utils/src/conditional_variable_posix.cc b/src/components/utils/src/conditional_variable_posix.cc
index 37751b097..a89f8cab6 100644
--- a/src/components/utils/src/conditional_variable_posix.cc
+++ b/src/components/utils/src/conditional_variable_posix.cc
@@ -126,7 +126,7 @@ ConditionalVariable::WaitStatus ConditionalVariable::WaitFor(
break;
}
default: {
- LOG4CXX_ERROR(logger_, "Failed to timewait for conditional variable");
+ LOG4CXX_ERROR(logger_, "Failed to timewait for conditional variable timedwait_status: " << timedwait_status);
}
}
diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc
index d52ad9467..faaadd673 100644
--- a/src/components/utils/src/threads/posix_thread.cc
+++ b/src/components/utils/src/threads/posix_thread.cc
@@ -187,7 +187,7 @@ bool Thread::startWithOptions(const ThreadOptions& options) {
pthread_result = pthread_create(&thread_handle_, &attributes, threadFunc, delegate_);
isThreadRunning_ = (pthread_result == EOK);
if (!isThreadRunning_) {
- LOG4CXX_WARN(logger_, "Couldn't cancel thread. Error code = "
+ LOG4CXX_WARN(logger_, "Couldn't create thread. Error code = "
<< pthread_result << "(\"" << strerror(pthread_result) << "\")");
} else {
LOG4CXX_INFO(logger_,"Created thread: " << name_);
diff --git a/test/components/smart_objects/SchemaItem/test_CObjectSchemaItem.cpp b/test/components/smart_objects/SchemaItem/test_CObjectSchemaItem.cpp
index 89177e1e3..54187e0d7 100644
--- a/test/components/smart_objects/SchemaItem/test_CObjectSchemaItem.cpp
+++ b/test/components/smart_objects/SchemaItem/test_CObjectSchemaItem.cpp
@@ -284,7 +284,7 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) {
const char* fake2 = "FAKE_PARAM2";
const char* fake3 = "FAKE_PARAM3";
- SmartObject obj;
+ SmartObject obj = SmartObject(SmartType::SmartType_Map);
obj[S_PARAMS][S_FUNCTION_ID] = 0;
obj[S_PARAMS][S_CORRELATION_ID] = 0XFF;
obj[S_PARAMS][S_PROTOCOL_VERSION] = 1;
@@ -298,11 +298,18 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) {
// Check apply schema
schema_item->applySchema(obj);
- // all fake parameters are romed on apply schema
+
+ EXPECT_TRUE(obj.keyExists(fake1));
+ EXPECT_TRUE(obj[S_PARAMS].keyExists(fake2));
+ EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(fake3));
+ EXPECT_EQ(Errors::OK, schema_item->validate(obj));
+
+ // all fake parameters are removed on unapply schema
+ schema_item->unapplySchema(obj);
+
EXPECT_FALSE(obj.keyExists(fake1));
EXPECT_FALSE(obj[S_PARAMS].keyExists(fake2));
EXPECT_FALSE(obj[S_MSG_PARAMS].keyExists(fake3));
- EXPECT_EQ(Errors::OK, schema_item->validate(obj));
obj[fake1] = SmartObject(static_cast<int64_t>(0));
obj[S_PARAMS][fake2] = SmartObject("123");
@@ -310,7 +317,7 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) {
// Check unapply schema
schema_item->unapplySchema(obj);
- // all fake parameters are romed on apply schema
+ // all fake parameters are removed on apply schema
EXPECT_FALSE(obj.keyExists(fake1));
EXPECT_FALSE(obj[S_PARAMS].keyExists(fake2));
EXPECT_FALSE(obj[S_MSG_PARAMS].keyExists(fake3));