summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2017-07-14 15:02:57 -0400
committerJackLivio <jack@livio.io>2017-07-14 15:02:57 -0400
commit3dc63916e89d15e84a6e7e636e764c8f794f3775 (patch)
tree768c5343a0073e71f31be2166f11c53fb1e8b0dd
parent22a014b3746b28d2b8a3a4049c60bb76db6a0861 (diff)
parente5a5aad135629e802aff7154a005fbf0351430a3 (diff)
downloadsdl_core-3dc63916e89d15e84a6e7e636e764c8f794f3775.tar.gz
Merge branch 'master' into develop
-rw-r--r--CHANGELOG.md92
-rw-r--r--COMMITTERS.md2
-rw-r--r--src/components/application_manager/include/application_manager/application.h5
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h2
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h9
-rw-r--r--src/components/application_manager/include/application_manager/request_info.h13
-rw-r--r--src/components/application_manager/src/app_launch/apps_launcher.cc3
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc7
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_system_request_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc3
-rw-r--r--src/components/application_manager/src/commands/mobile/system_request.cc7
-rw-r--r--src/components/application_manager/src/message.cc3
-rw-r--r--src/components/application_manager/src/policies/delegates/statistics_delegate.cc12
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc79
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc8
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc45
-rw-r--r--src/components/config_profile/src/ini_file.cc10
-rw-r--r--src/components/config_profile/src/profile.cc7
-rw-r--r--src/components/connection_handler/include/connection_handler/connection.h2
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h4
-rw-r--r--src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h11
-rw-r--r--src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h11
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h4
-rw-r--r--src/components/media_manager/src/audio/audio_stream_sender_thread.cc1
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_listener.cc5
-rw-r--r--src/components/policy/policy_external/include/policy/policy_types.h3
-rw-r--r--src/components/policy/policy_external/include/policy/status.h3
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc4
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc58
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc2
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc3
-rw-r--r--src/components/policy/policy_external/src/update_status_manager.cc2
-rw-r--r--src/components/policy/policy_regular/include/policy/status.h3
-rw-r--r--src/components/policy/policy_regular/include/policy/update_status_manager.h21
-rw-r--r--src/components/policy/policy_regular/include/policy/update_status_manager_interface.h3
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc40
-rw-r--r--src/components/policy/policy_regular/src/update_status_manager.cc78
-rw-r--r--src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h2
-rw-r--r--src/components/policy/policy_regular/test/update_status_manager_test.cc4
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_inl.h6
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h3
-rw-r--r--src/components/security_manager/src/ssl_context_impl.cc3
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h1
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc4
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc14
-rw-r--r--src/components/transport_manager/src/tcp/tcp_client_listener.cc47
-rw-r--r--src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc2
-rw-r--r--src/components/utils/src/file_system.cc28
-rw-r--r--src/components/utils/src/timer.cc2
50 files changed, 403 insertions, 284 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000..7b97dd0471
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,92 @@
+# 4.3.0 Release Candidate
+
+## New Features
+
+### EXTENDED_POLICY modes:
+- The `EXTENDED_POLICY` CMake variable (previously `ENABLE_EXTENDED_POLICY`) now has three possible configurations
+ - `HTTP` (previously `ENABLE_EXTENDED_POLICY: OFF`) - #941
+ - `PROPRIETARY` (previously `ENABLE_EXTENDED_POLICY: ON`) - #940
+ - `EXTERNAL_PROPRIETARY` (new, fully featured version of `PROPRIETARY` mode) - #942
+
+### EXTERNAL_PROPRIETARY mode:
+#### New policy table update sequence
+A new policy table update flow was created specifically for the `EXTERNAL_PROPRIETARY` policy mode
+
+- Requirements/Details - #933
+- Diagram - https://user-images.githubusercontent.com/10549248/26896053-9417c604-4b91-11e7-9e47-524c930eb542.png
+
+#### External Policy Manager
+As part of the `EXTERNAL_PROPRIETARY` policy mode, the concept of an "external policy manager" is necessary. This policy manager is a separate program which is in charge of encrypting/decrypting policy tables and attaching an HTTP header to the OnSystemRequest payload when performing a Policy Table Update.
+
+As part of this release, a sample application which performs this function was added to this repository for those who wish to implement this new policy mode, and this program can be started along with Core using an included bash script. This sample application does nothing with the policy table snapshot during the encryption and decryption phases, allowing for OEMs to implement their own encryption algorithms in their place.
+
+#### App permissions/User consent
+Users can now control what functional groups that they want apps to be able to access, as well as decide whether to enable SDL functionality at all on a device-by-device basis.
+
+ - Logic was added to allow the user to control what devices are permitted to use SDL functionality - #934
+ - Users are prompted when activating an app on a new device for the first time whether or not to allow the device to use SDL functionality (sequence shown in [this diagram](https://user-images.githubusercontent.com/10549248/26897493-ba378f2c-4b96-11e7-93b0-b24f01c7dc28.png))
+ - Logic was added to the Policy Manager to allow the user to control what apps have access to specific functional groups - #939
+ - Users are prompted when activating an app for the first time (or modifying permissions in settings) with information on what access a requested functional group requires. The user responds to determine whether or not to allow this functionality within the new app (sequence shown in [this diagram](https://user-images.githubusercontent.com/10549248/26902322-e6e02bf0-4ba6-11e7-98b3-c285396061a4.png))
+
+
+#### External user consent
+External user consent allows the HMI to define several groups of permissions within the policy table. This allows the user to enable/disable several functional groups at once.
+
+ - The `externalConsentStatus` field is included as part of a GetListOfPermissions response from SDL Core to communicate which groups are activated - #1047
+ - External consent groups can be used to enable sets of functional groups using the `disallowed_by_external_consent_entities_off` field in the Policy Table - #1049
+ - If this external consent group is set to `ON`, all functional groupings with this parameter are allowed by the user - #1048
+ - If this external consent group is set to `OFF`, all functional groupings with this parameter are disallowed by the user - #1050
+ - External consent groups can be used to disable sets of functional groups using the `disallowed_by_external_consent_entities_on` field in the Policy Table
+ - If this external consent group is set to `ON`, all functional groupings with this parameter are disallowed by the user
+ - If this external consent group is set to `OFF`, all functional groupings with this parameter are allowed by the user
+
+#### Cache Manager Function Implementations
+Prior to this release, several functions included in cache_manager.cc were not fully implemented and would not query the local policy table for defined rules and policies. The newly implemented functions for the `EXTERNAL_PROPRIETARY` cache manager are listed below:
+ - [CanAppKeepContext()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L310)
+ - [CanAppStealFocus()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L363)
+ - [GetDefaultHMI()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L374)
+ - [ResetUserConsent()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L391)
+ - [GetUserPermissionsForDevice()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L406)
+ - [GetPreconsentedGroups()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L477)
+ - [GetConsentedGroups()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L514)
+ - [GetUnconsentedGroups()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L549)
+ - [RemoveAppConsentForGroup()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L605)
+ - [GetDeviceGroupsFromPolicies()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L799)
+ - [SetDeviceData()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L975)
+ - [SetUserPermissionsForDevice()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1008)
+ - [ReactOnUserDevConsentForApp()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1043)
+ - [SetUserPermissionsForApp()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1076)
+ - [CountUnconsentedGroups()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1768)
+ - [SetMetaInfo()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1868)
+ - [IsMetaInfoPresent()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1884)
+ - [SetSystemLanguage()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1893)
+ - [CleanupUnpairedDevices()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L1919)
+ - [SetVinValue()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L2175)
+ - [ResetPT()](https://github.com/smartdevicelink/sdl_core/blob/release/4.3.0/src/components/policy/policy_external/src/cache_manager.cc#L2309)
+
+#### Security behavior
+Requirements/Details - #937
+
+### HMI_API additions:
+
+A new RPC was added as part of the implementation of `EXTERNAL_PROPRIETARY` policy mode
+
+ - [DecryptCertificate](https://github.com/smartdevicelink/sdl_core/blob/6283aa26e262d2d16ed1393989d8e0e062dba88d/src/components/interfaces/HMI_API.xml#L2468-L2476) RPC
+
+Several API additions were made as part of the implementation of the external user consent feature
+
+ - [EntityStatus](https://github.com/smartdevicelink/sdl_core/blob/6283aa26e262d2d16ed1393989d8e0e062dba88d/src/components/interfaces/HMI_API.xml#L1263-L1266) enum
+ - [ExternalConsentStatus](https://github.com/smartdevicelink/sdl_core/blob/6283aa26e262d2d16ed1393989d8e0e062dba88d/src/components/interfaces/HMI_API.xml#L1268-L1278) struct
+ - externalConsentStatus field added to [OnAppPermissionConsent](https://github.com/smartdevicelink/sdl_core/blob/6283aa26e262d2d16ed1393989d8e0e062dba88d/src/components/interfaces/HMI_API.xml#L4170-L4172) and [GetListOfPermissions](https://github.com/smartdevicelink/sdl_core/blob/6283aa26e262d2d16ed1393989d8e0e062dba88d/src/components/interfaces/HMI_API.xml#L4170-L4172)
+
+## Fixes
+- Includes fixes for all defects found by the Coverity scan tool that were introduced in this release - #1641
+- Includes fixes for several Coverity defects that were previously implemented in the `coverity` branch - #1637
+
+## Implemented proposals
+Two new evolution proposals were implemented in release 4.3.0:
+
+- Add API Patch Version [SDL-0050](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0050-add-api-patch-version.md)
+ - A patch version was added to the MOBILE API version, HMI API interface versions, and SyncMsgVersion struct
+- External Policy Manager [SDL-0045](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0045-external-policy-manager.md)
+ - Details for the implementation of this proposal can be found in the `External Policy Manager` section of these release notes
diff --git a/COMMITTERS.md b/COMMITTERS.md
index 284351aff1..210fceb421 100644
--- a/COMMITTERS.md
+++ b/COMMITTERS.md
@@ -41,7 +41,7 @@ set in the form of a pull request.
there must be comment which explains: When method will be called by thread? Which thread calls the method? e.g.)
* Do you have specific realization code comments?
* Add log messages.
-* There are no Google code style errors. (You can download Google [cppint.py](https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py))
+* There are no Google code style errors. (You can download Google [cpplint.py](https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py))
* Check branch naming.
* Check correct commit messages in commits (see Pull request message section).
* Check correct pull request target (`master` or `develop`)
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 08581b43c1..c523f61329 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -78,7 +78,10 @@ struct Version {
struct AppFile {
// need to use in std::map;
- AppFile() {}
+ AppFile()
+ : is_persistent(false)
+ , is_download_complete(false)
+ , file_type(mobile_apis::FileType::INVALID_ENUM) {}
AppFile(const std::string& name,
bool persistent,
bool download_complete,
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
index fffbab567f..987f773d44 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
@@ -104,7 +104,7 @@ class CreateInteractionChoiceSetRequest : public CommandRequestImpl {
* processing deleting sent commands if error from HMI received
*/
struct VRCommandInfo {
- VRCommandInfo() {}
+ VRCommandInfo() : cmd_id_(0), succesful_response_received_(false) {}
VRCommandInfo(uint32_t cmd_id)
: cmd_id_(cmd_id), succesful_response_received_(false) {}
uint32_t cmd_id_;
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 e2c4d73f5c..0b808b13f5 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
@@ -123,8 +123,8 @@ class PolicyHandler : public PolicyHandlerInterface,
EndpointUrls& out_end_points) OVERRIDE;
virtual std::string GetLockScreenIconUrl() const OVERRIDE;
uint32_t NextRetryTimeout() OVERRIDE;
- uint32_t TimeoutExchangeSec() OVERRIDE;
- uint32_t TimeoutExchangeMSec() OVERRIDE;
+ uint32_t TimeoutExchangeSec() const OVERRIDE;
+ uint32_t TimeoutExchangeMSec() const OVERRIDE;
void OnExceededTimeout() OVERRIDE;
void OnSystemReady() OVERRIDE;
void PTUpdatedAt(Counters counter, int value) OVERRIDE;
@@ -445,10 +445,6 @@ class PolicyHandler : public PolicyHandlerInterface,
void SetPolicyManager(utils::SharedPtr<PolicyManager> pm) {
policy_manager_ = pm;
}
-
- AppIds& last_used_app_ids() {
- return last_used_app_ids_;
- }
#endif // BUILD_TESTS
#ifdef ENABLE_SECURITY
@@ -609,7 +605,6 @@ class PolicyHandler : public PolicyHandlerInterface,
mutable sync_primitives::RWLock policy_manager_lock_;
utils::SharedPtr<PolicyManager> policy_manager_;
void* dl_handle_;
- AppIds last_used_app_ids_;
utils::SharedPtr<PolicyEventObserver> event_observer_;
uint32_t last_activated_app_id_;
diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h
index 216eb86cc5..5ebcac71f8 100644
--- a/src/components/application_manager/include/application_manager/request_info.h
+++ b/src/components/application_manager/include/application_manager/request_info.h
@@ -55,15 +55,22 @@ namespace request_controller {
typedef utils::SharedPtr<commands::Command> RequestPtr;
struct RequestInfo {
- enum RequestType { MobileRequest, HMIRequest };
+ enum RequestType { RequestNone, MobileRequest, HMIRequest };
- RequestInfo() {}
+ RequestInfo()
+ : timeout_msec_(0)
+ , app_id_(0)
+ , requst_type_(RequestNone)
+ , correlation_id_(0) {
+ start_time_ = date_time::DateTime::getCurrentTime();
+ updateEndTime();
+ }
virtual ~RequestInfo() {}
RequestInfo(RequestPtr request,
const RequestType requst_type,
const uint64_t timeout_msec)
- : request_(request), timeout_msec_(timeout_msec) {
+ : request_(request), timeout_msec_(timeout_msec), correlation_id_(0) {
start_time_ = date_time::DateTime::getCurrentTime();
updateEndTime();
requst_type_ = requst_type;
diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc
index 41465ae985..bf3ce1e0a9 100644
--- a/src/components/application_manager/src/app_launch/apps_launcher.cc
+++ b/src/components/application_manager/src/app_launch/apps_launcher.cc
@@ -95,7 +95,8 @@ AppsLauncher::Launcher::Launcher(
connection_handler::ConnectionHandler& connection_handler,
const uint16_t app_launch_max_retry_attempt,
const uint16_t app_launch_retry_wait_time)
- : retry_timer_(
+ : retry_index_(0)
+ , retry_timer_(
"AppsLauncherTimer",
new timer::TimerTaskImpl<Launcher>(this, &Launcher::LaunchNow))
, app_launch_max_retry_attempt_(app_launch_max_retry_attempt)
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 26dd131856..097abc4645 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -2775,9 +2775,10 @@ void ApplicationManagerImpl::Handle(const impl::AudioData message) {
return;
}
- command->Init();
- command->Run();
- command->CleanUp();
+ if (command->Init()) {
+ command->Run();
+ command->CleanUp();
+ }
}
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
index 8876ffa2e8..46ef39d806 100644
--- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -49,9 +49,11 @@ namespace commands {
CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
const MessageSharedPtr& message, ApplicationManager& application_manager)
: CommandRequestImpl(message, application_manager)
+ , choice_set_id_(0)
, expected_chs_count_(0)
, received_chs_count_(0)
, error_from_hmi_(false)
+ , is_timed_out_(false)
, vr_commands_lock_(true) {}
CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
index a17c76d9c1..c29ff3e2d3 100644
--- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
@@ -99,6 +99,10 @@ void OnSystemRequestNotification::Run() {
(*message_)[strings::msg_params][strings::file_type] = FileType::JSON;
} else if (RequestType::HTTP == request_type) {
(*message_)[strings::msg_params][strings::file_type] = FileType::BINARY;
+ if ((*message_)[strings::msg_params].keyExists(strings::url)) {
+ (*message_)[strings::msg_params][strings::timeout] =
+ policy_handler.TimeoutExchangeSec();
+ }
}
SendNotification();
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 ebc0e43838..b1dce9151f 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
@@ -312,8 +312,7 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters(
HmiInterfaces::STATE_AVAILABLE == tts_interface_state) {
result = true;
out_result_code = mobile_apis::Result::WARNINGS;
- out_response_info =
- std::string("Unsupported phoneme type sent in a prompt").c_str();
+ out_response_info = "Unsupported phoneme type sent in a prompt";
} else {
result =
PrepareResultForMobileResponse(ui_properties_info, tts_properties_info);
diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc
index 74d25508e0..0d3334a1a1 100644
--- a/src/components/application_manager/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/src/commands/mobile/system_request.cc
@@ -118,8 +118,7 @@ class QueryAppsDataValidator {
smart_objects::SmartArray::iterator applications_iterator =
objects_array->begin();
- for (; applications_iterator != objects_array->end();
- ++applications_iterator) {
+ for (; applications_iterator != objects_array->end();) {
const smart_objects::SmartObject& app_data = *applications_iterator;
if (!app_data.isValid()) {
@@ -133,7 +132,8 @@ class QueryAppsDataValidator {
LOG4CXX_WARN(logger_,
"Application hasn`t some of mandatory parameters. "
"Application will be skipped.");
- objects_array->erase(applications_iterator);
+
+ applications_iterator = objects_array->erase(applications_iterator);
continue;
}
@@ -186,6 +186,7 @@ class QueryAppsDataValidator {
return false;
}
has_response_valid_application = true;
+ ++applications_iterator;
}
return has_response_valid_application;
}
diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc
index a7c887d348..2206cf479f 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -66,7 +66,8 @@ Message::Message(protocol_handler::MessagePriority priority)
, payload_size_(0)
, version_(kUnknownProtocol) {}
-Message::Message(const Message& message) : priority_(message.priority_) {
+Message::Message(const Message& message)
+ : priority_(message.priority_), binary_data_(NULL) {
*this = message;
}
diff --git a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
index 11c1dc9a91..e668be4ed1 100644
--- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
+++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
@@ -39,6 +39,9 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
usage_statistics::GlobalCounterId type)
: type_(INCREMENT_GLOBAL)
, global_counter_(type)
+ , app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE)
+ , app_info_(usage_statistics::AppInfoId::APP_INFO_NONE)
+ , stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE)
, app_id_("")
, value_("")
, timespan_seconds_(0)
@@ -48,7 +51,10 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
const std::string& app_id,
usage_statistics::AppCounterId type)
: type_(INCREMENT_APP)
+ , global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE)
, app_counter_(type)
+ , app_info_(usage_statistics::AppInfoId::APP_INFO_NONE)
+ , stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE)
, app_id_(app_id)
, value_("")
, timespan_seconds_(0)
@@ -59,7 +65,10 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
usage_statistics::AppInfoId type,
const std::string& value)
: type_(SET)
+ , global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE)
+ , app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE)
, app_info_(type)
+ , stop_watch_(usage_statistics::AppStopwatchId::STOPWATCH_NONE)
, app_id_(app_id)
, value_(value)
, timespan_seconds_(0)
@@ -70,6 +79,9 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds)
: type_(ADD)
+ , global_counter_(usage_statistics::GlobalCounterId::GLOBAL_COUNTER_NONE)
+ , app_counter_(usage_statistics::AppCounterId::APP_COUNTER_NONE)
+ , app_info_(usage_statistics::AppInfoId::APP_INFO_NONE)
, stop_watch_(type)
, app_id_(app_id)
, value_("")
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 840b1ae0f8..ec8b36477c 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -64,31 +64,32 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
namespace {
using namespace mobile_apis;
-typedef std::map<RequestType::eType, std::string> RequestTypeMap;
+typedef std::map<mobile_apis::RequestType::eType, std::string> RequestTypeMap;
RequestTypeMap TypeToString = {
- {RequestType::INVALID_ENUM, "INVALID_ENUM"},
- {RequestType::HTTP, "HTTP"},
- {RequestType::FILE_RESUME, "FILE_RESUME"},
- {RequestType::AUTH_REQUEST, "AUTH_REQUEST"},
- {RequestType::AUTH_CHALLENGE, "AUTH_CHALLENGE"},
- {RequestType::AUTH_ACK, "AUTH_ACK"},
- {RequestType::PROPRIETARY, "PROPRIETARY"},
- {RequestType::QUERY_APPS, "QUERY_APPS"},
- {RequestType::LAUNCH_APP, "LAUNCH_APP"},
- {RequestType::LOCK_SCREEN_ICON_URL, "LOCK_SCREEN_ICON_URL"},
- {RequestType::TRAFFIC_MESSAGE_CHANNEL, "TRAFFIC_MESSAGE_CHANNEL"},
- {RequestType::DRIVER_PROFILE, "DRIVER_PROFILE"},
- {RequestType::VOICE_SEARCH, "VOICE_SEARCH"},
- {RequestType::NAVIGATION, "NAVIGATION"},
- {RequestType::PHONE, "PHONE"},
- {RequestType::CLIMATE, "CLIMATE"},
- {RequestType::SETTINGS, "SETTINGS"},
- {RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"},
- {RequestType::EMERGENCY, "EMERGENCY"},
- {RequestType::MEDIA, "MEDIA"},
- {RequestType::FOTA, "FOTA"}};
-
-const std::string RequestTypeToString(RequestType::eType type) {
+ {mobile_apis::RequestType::INVALID_ENUM, "INVALID_ENUM"},
+ {mobile_apis::RequestType::HTTP, "HTTP"},
+ {mobile_apis::RequestType::FILE_RESUME, "FILE_RESUME"},
+ {mobile_apis::RequestType::AUTH_REQUEST, "AUTH_REQUEST"},
+ {mobile_apis::RequestType::AUTH_CHALLENGE, "AUTH_CHALLENGE"},
+ {mobile_apis::RequestType::AUTH_ACK, "AUTH_ACK"},
+ {mobile_apis::RequestType::PROPRIETARY, "PROPRIETARY"},
+ {mobile_apis::RequestType::QUERY_APPS, "QUERY_APPS"},
+ {mobile_apis::RequestType::LAUNCH_APP, "LAUNCH_APP"},
+ {mobile_apis::RequestType::LOCK_SCREEN_ICON_URL, "LOCK_SCREEN_ICON_URL"},
+ {mobile_apis::RequestType::TRAFFIC_MESSAGE_CHANNEL,
+ "TRAFFIC_MESSAGE_CHANNEL"},
+ {mobile_apis::RequestType::DRIVER_PROFILE, "DRIVER_PROFILE"},
+ {mobile_apis::RequestType::VOICE_SEARCH, "VOICE_SEARCH"},
+ {mobile_apis::RequestType::NAVIGATION, "NAVIGATION"},
+ {mobile_apis::RequestType::PHONE, "PHONE"},
+ {mobile_apis::RequestType::CLIMATE, "CLIMATE"},
+ {mobile_apis::RequestType::SETTINGS, "SETTINGS"},
+ {mobile_apis::RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"},
+ {mobile_apis::RequestType::EMERGENCY, "EMERGENCY"},
+ {mobile_apis::RequestType::MEDIA, "MEDIA"},
+ {mobile_apis::RequestType::FOTA, "FOTA"}};
+
+const std::string RequestTypeToString(mobile_apis::RequestType::eType type) {
RequestTypeMap::const_iterator it = TypeToString.find(type);
if (TypeToString.end() != it) {
return (*it).second;
@@ -471,8 +472,12 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
const bool is_allowed) {
POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
- application_manager_.connection_handler().GetDeviceID(device_id,
- &device_handle);
+ if (!application_manager_.connection_handler().GetDeviceID(device_id,
+ &device_handle)) {
+ LOG4CXX_ERROR(logger_,
+ "Unable to get device handle for device_id: " << device_id);
+ return;
+ }
// In case of changed consent for device, related applications will be
// limited to pre_DataConsent permissions, if device disallowed, or switch
// back to their own permissions, if device allowed again, and must be
@@ -536,12 +541,6 @@ void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) {
}
}
-struct SmartObjectToInt {
- int operator()(const smart_objects::SmartObject& item) const {
- return item.asInt();
- }
-};
-
StatusNotifier PolicyHandler::AddApplication(
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
@@ -1021,16 +1020,8 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
- ApplicationSharedPtr app;
- uint32_t app_id = 0;
- if (last_used_app_ids_.empty()) {
- LOG4CXX_WARN(logger_, "last_used_app_ids_ is empty");
- return false;
- } else {
- app_id = last_used_app_ids_.back();
-
- app = application_manager_.application(app_id);
- }
+ const uint32_t app_id = GetAppIdForSending();
+ ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
LOG4CXX_WARN(logger_,
@@ -1573,11 +1564,11 @@ uint32_t PolicyHandler::NextRetryTimeout() {
return policy_manager_->NextRetryTimeout();
}
-uint32_t PolicyHandler::TimeoutExchangeSec() {
+uint32_t PolicyHandler::TimeoutExchangeSec() const {
return TimeoutExchangeMSec() / date_time::DateTime::MILLISECONDS_IN_SECOND;
}
-uint32_t PolicyHandler::TimeoutExchangeMSec() {
+uint32_t PolicyHandler::TimeoutExchangeMSec() const {
POLICY_LIB_CHECK(0);
return policy_manager_->TimeoutExchangeMSec();
}
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index ad50bbf104..e7788bf9ff 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -644,7 +644,7 @@ bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff(
DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false);
const time_t time_stamp =
- static_cast<time_t>(saved_app[strings::time_stamp].asUInt());
+ static_cast<time_t>(saved_app[strings::time_stamp].asInt());
time_t ign_off_time =
static_cast<time_t>(resumption_storage_->GetIgnOffTime());
const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
@@ -798,9 +798,13 @@ void ResumeCtrlImpl::OnAppRegistrationEnd() {
int32_t ResumeCtrlImpl::GetSavedAppHmiLevel(
const std::string& app_id, const std::string& device_id) const {
+ using namespace mobile_apis;
smart_objects::SmartObject saved_app;
if (resumption_storage_->GetSavedApplication(app_id, device_id, saved_app)) {
- const int32_t saved_hmi_level = saved_app[strings::hmi_level].asInt();
+ const HMILevel::eType saved_hmi_level =
+ static_cast<mobile_apis::HMILevel::eType>(
+ saved_app[strings::hmi_level].asInt());
+
return saved_hmi_level;
}
return static_cast<int32_t>(mobile_apis::HMILevel::INVALID_ENUM);
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 9713989f81..4c3e882eae 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -1997,34 +1997,59 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
EXPECT_EQ(app_in_none_id_1 || app_in_none_id_2, app_id);
}
-TEST_F(PolicyHandlerTest, SendMessageToSDK) {
- // Precondition
+TEST_F(PolicyHandlerTest,
+ SendMessageToSDK_SuitableAppPresent_ExpectedNotificationSending) {
BinaryMessage msg;
const std::string url = "test_url";
EnablePolicyAndPolicyManagerMock();
test_app.insert(mock_app_);
- // Expectations
+
EXPECT_CALL(app_manager_, application(kAppId1_))
.WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
+ EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
+ EXPECT_CALL(*mock_app_, policy_app_id())
+ .WillRepeatedly(Return(kPolicyAppId_));
+ EXPECT_CALL(*mock_app_, hmi_level())
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
+
+ const connection_handler::DeviceHandle test_device_id = 1u;
+ EXPECT_CALL(*mock_app_, device()).WillRepeatedly(Return(test_device_id));
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
+ .WillOnce(Return(kDeviceAllowed));
// Act
- policy_handler_.last_used_app_ids().push_back(kAppId1_);
EXPECT_CALL(mock_message_helper_,
SendPolicySnapshotNotification(kAppId1_, msg, url, _));
EXPECT_TRUE(policy_handler_.SendMessageToSDK(msg, url));
}
-TEST_F(PolicyHandlerTest, SendMessageToSDK_InavalidApp_UNSUCCESS) {
+TEST_F(PolicyHandlerTest,
+ SendMessageToSDK_NoSuitableApp_ExpectedNotificationNotSent) {
BinaryMessage msg;
const std::string url = "test_url";
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> invalid_app;
- policy_handler_.last_used_app_ids().push_back(kAppId1_);
+ test_app.insert(mock_app_);
EXPECT_CALL(app_manager_, application(kAppId1_))
- .WillOnce(Return(invalid_app));
- EXPECT_CALL(*mock_app_, policy_app_id()).Times(0);
+ .WillRepeatedly(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
+ EXPECT_CALL(*mock_app_, policy_app_id())
+ .WillRepeatedly(Return(kPolicyAppId_));
+ EXPECT_CALL(*mock_app_, hmi_level())
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
+ EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
+
+ const connection_handler::DeviceHandle test_device_id = 1u;
+ EXPECT_CALL(*mock_app_, device()).WillRepeatedly(Return(test_device_id));
+ EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
+ .WillOnce(Return(kDeviceDisallowed));
+
+ // Expected to get 0 as application id so SDL does not have valid application
+ // with such id
+ EXPECT_CALL(app_manager_, application(0))
+ .WillOnce(Return(
+ utils::SharedPtr<application_manager_test::MockApplication>()));
EXPECT_FALSE(policy_handler_.SendMessageToSDK(msg, url));
}
diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc
index 1c30c8b201..3245b096cb 100644
--- a/src/components/config_profile/src/ini_file.cc
+++ b/src/components/config_profile/src/ini_file.cc
@@ -39,6 +39,8 @@
#include <limits.h>
#include <stdint.h>
+#include "utils/logger.h"
+
#ifndef _WIN32
#include <unistd.h>
#else
@@ -53,6 +55,8 @@
namespace profile {
+CREATE_LOGGERPTR_GLOBAL(logger_, "Profile")
+
char* ini_write_inst(const char* fname, uint8_t flag) {
FILE* fp = 0;
@@ -272,9 +276,11 @@ char ini_write_value(const char* fname,
fclose(wr_fp);
fclose(rd_fp);
- remove(fname);
if (0 != rename(temp_fname, fname)) {
- remove(temp_fname);
+ if (0 != remove(temp_fname)) {
+ LOG4CXX_WARN_WITH_ERRNO(
+ logger_, "Unable to remove temp file: " << std::string(temp_fname));
+ }
return FALSE;
}
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 0871a769ba..beabc6afa8 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -322,6 +322,7 @@ Profile::Profile()
, server_port_(kDefaultServerPort)
, video_streaming_port_(kDefaultVideoStreamingPort)
, audio_streaming_port_(kDefaultAudioStreamingPort)
+ , stop_streaming_timeout_(kDefaultStopStreamingTimeout)
, time_testing_port_(kDefaultTimeTestingPort)
, hmi_capabilities_file_name_(kDefaultHmiCapabilitiesFileName)
, help_prompt_()
@@ -332,6 +333,8 @@ Profile::Profile()
, max_cmd_id_(kDefaultMaxCmdId)
, default_timeout_(kDefaultTimeout)
, app_resuming_timeout_(kDefaultAppResumingTimeout)
+ , app_resumption_save_persistent_data_timeout_(
+ kDefaultAppSavePersistentDataTimeout)
, app_dir_quota_(kDefaultDirQuota)
, app_hmi_level_none_time_scale_max_requests_(
kDefaultAppHmiLevelNoneTimeScaleMaxRequests)
@@ -363,6 +366,8 @@ Profile::Profile()
, recording_file_source_(kDefaultRecordingFileSourceName)
, recording_file_name_(kDefaultRecordingFileName)
, application_list_update_timeout_(kDefaultApplicationListUpdateTimeout)
+ , max_thread_pool_size_(kDefaultMaxThreadPoolSize)
+ , default_hub_protocol_index_(kDefaultHubProtocolIndex)
, iap_legacy_protocol_mask_(kDefaultLegacyProtocolMask)
, iap_hub_protocol_mask_(kDefaultHubProtocolMask)
, iap_pool_protocol_mask_(kDefaultPoolProtocolMask)
@@ -373,6 +378,8 @@ Profile::Profile()
, tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout)
, attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB)
, open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB)
+ , resumption_delay_before_ign_(kDefaultResumptionDelayBeforeIgn)
+ , resumption_delay_after_ign_(kDefaultResumptionDelayAfterIgn)
, hash_string_size_(kDefaultHashStringSize)
, use_db_for_resumption_(false)
, attempts_to_open_resumption_db_(kDefaultAttemptsToOpenResumptionDB)
diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h
index aafc562505..bd5858c4cd 100644
--- a/src/components/connection_handler/include/connection_handler/connection.h
+++ b/src/components/connection_handler/include/connection_handler/connection.h
@@ -41,6 +41,7 @@
#include "connection_handler/device.h"
#include "connection_handler/heartbeat_monitor.h"
#include "protocol/service_type.h"
+#include "protocol_handler/protocol_packet.h"
#ifdef ENABLE_SECURITY
namespace security_manager {
@@ -95,6 +96,7 @@ struct Session {
#endif // ENABLE_SECURITY
Session()
: service_list()
+ , protocol_version(::protocol_handler::PROTOCOL_VERSION_2)
#ifdef ENABLE_SECURITY
, ssl_context(NULL)
#endif // ENABLE_SECURITY
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index c5af16863a..a1c45c0bd6 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -105,8 +105,8 @@ class PolicyHandlerInterface {
EndpointUrls& out_end_points) = 0;
virtual std::string GetLockScreenIconUrl() const = 0;
virtual uint32_t NextRetryTimeout() = 0;
- virtual uint32_t TimeoutExchangeSec() = 0;
- virtual uint32_t TimeoutExchangeMSec() = 0;
+ virtual uint32_t TimeoutExchangeSec() const = 0;
+ virtual uint32_t TimeoutExchangeMSec() const = 0;
virtual void OnExceededTimeout() = 0;
virtual void OnSystemReady() = 0;
virtual void PTUpdatedAt(Counters counter, int value) = 0;
diff --git a/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h b/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h
index a74bb0592e..8cf3beaa55 100644
--- a/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h
+++ b/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h
@@ -38,11 +38,17 @@
namespace usage_statistics {
-enum GlobalCounterId { IAP_BUFFER_FULL, SYNC_OUT_OF_MEMORY, SYNC_REBOOTS };
+enum GlobalCounterId {
+ GLOBAL_COUNTER_NONE,
+ IAP_BUFFER_FULL,
+ SYNC_OUT_OF_MEMORY,
+ SYNC_REBOOTS
+};
-enum AppInfoId { LANGUAGE_GUI, LANGUAGE_VUI };
+enum AppInfoId { APP_INFO_NONE, LANGUAGE_GUI, LANGUAGE_VUI };
enum AppStopwatchId {
+ STOPWATCH_NONE,
SECONDS_HMI_FULL,
SECONDS_HMI_LIMITED,
SECONDS_HMI_BACKGROUND,
@@ -50,6 +56,7 @@ enum AppStopwatchId {
};
enum AppCounterId {
+ APP_COUNTER_NONE,
USER_SELECTIONS,
REJECTIONS_SYNC_OUT_OF_MEMORY,
REJECTIONS_NICKNAME_MISMATCH,
diff --git a/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h b/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h
index a74bb0592e..8cf3beaa55 100644
--- a/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h
+++ b/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h
@@ -38,11 +38,17 @@
namespace usage_statistics {
-enum GlobalCounterId { IAP_BUFFER_FULL, SYNC_OUT_OF_MEMORY, SYNC_REBOOTS };
+enum GlobalCounterId {
+ GLOBAL_COUNTER_NONE,
+ IAP_BUFFER_FULL,
+ SYNC_OUT_OF_MEMORY,
+ SYNC_REBOOTS
+};
-enum AppInfoId { LANGUAGE_GUI, LANGUAGE_VUI };
+enum AppInfoId { APP_INFO_NONE, LANGUAGE_GUI, LANGUAGE_VUI };
enum AppStopwatchId {
+ STOPWATCH_NONE,
SECONDS_HMI_FULL,
SECONDS_HMI_LIMITED,
SECONDS_HMI_BACKGROUND,
@@ -50,6 +56,7 @@ enum AppStopwatchId {
};
enum AppCounterId {
+ APP_COUNTER_NONE,
USER_SELECTIONS,
REJECTIONS_SYNC_OUT_OF_MEMORY,
REJECTIONS_NICKNAME_MISMATCH,
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index 8f6972fd52..2fad7b757e 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -104,8 +104,8 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
- MOCK_METHOD0(TimeoutExchangeSec, uint32_t());
- MOCK_METHOD0(TimeoutExchangeMSec, uint32_t());
+ MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t());
+ MOCK_CONST_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(OnExceededTimeout, void());
MOCK_METHOD0(OnSystemReady, void());
MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
index 7c18cb400b..9b0057dfe8 100644
--- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
+++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
@@ -67,6 +67,7 @@ AudioStreamSenderThread::AudioStreamSenderThread(
application_manager::ApplicationManager& app_mngr)
: session_key_(session_key)
, fileName_(fileName)
+ , offset_(0)
, shouldBeStoped_(false)
, shouldBeStoped_lock_()
, shouldBeStoped_cv_()
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
index a02ec17f90..647db1e1a3 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
@@ -42,7 +42,10 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
FromMicRecorderListener::FromMicRecorderListener(
const std::string& file_name,
application_manager::ApplicationManager& app_mngr)
- : reader_(NULL), file_name_(file_name), application_manager_(app_mngr) {}
+ : reader_(NULL)
+ , file_name_(file_name)
+ , current_application_(0)
+ , application_manager_(app_mngr) {}
FromMicRecorderListener::~FromMicRecorderListener() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h
index eff8cfdf7b..ab95659917 100644
--- a/src/components/policy/policy_external/include/policy/policy_types.h
+++ b/src/components/policy/policy_external/include/policy/policy_types.h
@@ -401,7 +401,8 @@ struct ExternalConsentStatusItem {
const EntityStatus status)
: entity_type_(type), entity_id_(id), status_(status) {}
- ExternalConsentStatusItem() {}
+ ExternalConsentStatusItem()
+ : entity_type_(0), entity_id_(0), status_(kStatusOff) {}
ExternalConsentStatusItem operator=(const ExternalConsentStatusItem& rhs) {
this->entity_id_ = rhs.entity_id_;
diff --git a/src/components/policy/policy_external/include/policy/status.h b/src/components/policy/policy_external/include/policy/status.h
index 53925c599a..18789ecf99 100644
--- a/src/components/policy/policy_external/include/policy/status.h
+++ b/src/components/policy/policy_external/include/policy/status.h
@@ -53,7 +53,8 @@ enum UpdateEvent {
kOnResetPolicyTableNoUpdate,
kScheduleUpdate,
kScheduleManualUpdate,
- kOnResetRetrySequence
+ kOnResetRetrySequence,
+ kNoEvent
};
const std::string kUpToDate = "UP_TO_DATE";
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 7c247f1759..22040c88b2 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -1082,9 +1082,7 @@ bool CacheManager::SetUserPermissionsForApp(
permissions.group_permissions.begin();
std::vector<FunctionalGroupPermission>::const_iterator iter_end =
permissions.group_permissions.end();
- if (out_app_permissions_changed) {
- *out_app_permissions_changed = false;
- }
+ *out_app_permissions_changed = false;
std::string group_name;
for (; iter != iter_end; ++iter) {
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index 12a02824f2..cb27e7f0b3 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -575,7 +575,6 @@ void FillNotificationData::UpdateParameters(
}
void FillNotificationData::ExcludeSame(RpcPermissions& rpc) {
- HMIPermissions& rpc_hmi_permissions = rpc.hmi_permissions;
HMIPermissions::const_iterator it_hmi_allowed =
rpc.hmi_permissions.find(kAllowedKey);
HMIPermissions::const_iterator it_hmi_undefined =
@@ -586,29 +585,28 @@ void FillNotificationData::ExcludeSame(RpcPermissions& rpc) {
// There is different logic of processing RPCs with and w/o 'parameters'
if (RpcParametersEmpty(rpc)) {
// First, remove disallowed from other types
- if (rpc_hmi_permissions.end() != it_hmi_user_disallowed) {
- if (rpc_hmi_permissions.end() != it_hmi_allowed) {
- ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey],
- rpc_hmi_permissions[kUserDisallowedKey]);
+ if (rpc.hmi_permissions.end() != it_hmi_user_disallowed) {
+ if (rpc.hmi_permissions.end() != it_hmi_allowed) {
+ ExcludeSameHMILevels(rpc.hmi_permissions[kAllowedKey],
+ rpc.hmi_permissions[kUserDisallowedKey]);
}
- if (rpc_hmi_permissions.end() != it_hmi_undefined) {
- ExcludeSameHMILevels(rpc_hmi_permissions[kUndefinedKey],
- rpc_hmi_permissions[kUserDisallowedKey]);
+ if (rpc.hmi_permissions.end() != it_hmi_undefined) {
+ ExcludeSameHMILevels(rpc.hmi_permissions[kUndefinedKey],
+ rpc.hmi_permissions[kUserDisallowedKey]);
}
}
// Then, remove undefined from allowed
- if (rpc_hmi_permissions.end() != it_hmi_undefined) {
- if (rpc_hmi_permissions.end() != it_hmi_allowed) {
- ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey],
- rpc_hmi_permissions[kUndefinedKey]);
+ if (rpc.hmi_permissions.end() != it_hmi_undefined) {
+ if (rpc.hmi_permissions.end() != it_hmi_allowed) {
+ ExcludeSameHMILevels(rpc.hmi_permissions[kAllowedKey],
+ rpc.hmi_permissions[kUndefinedKey]);
}
}
return;
}
- ParameterPermissions& rpc_parameter_permissions = rpc.parameter_permissions;
ParameterPermissions::const_iterator it_parameter_allowed =
rpc.parameter_permissions.find(kAllowedKey);
ParameterPermissions::const_iterator it_parameter_undefined =
@@ -619,34 +617,34 @@ void FillNotificationData::ExcludeSame(RpcPermissions& rpc) {
// First, removing allowed HMI levels from other types, permissions will be
// dependent on parameters instead of HMI levels since w/o parameters RPC
// won't passed to HMI
- if (rpc_hmi_permissions.end() != it_hmi_allowed) {
- if (rpc_hmi_permissions.end() != it_hmi_user_disallowed) {
- ExcludeSameHMILevels(rpc_hmi_permissions[kUserDisallowedKey],
- rpc_hmi_permissions[kAllowedKey]);
+ if (rpc.hmi_permissions.end() != it_hmi_allowed) {
+ if (rpc.hmi_permissions.end() != it_hmi_user_disallowed) {
+ ExcludeSameHMILevels(rpc.hmi_permissions[kUserDisallowedKey],
+ rpc.hmi_permissions[kAllowedKey]);
}
if (rpc.hmi_permissions.end() != it_hmi_undefined) {
- ExcludeSameHMILevels(rpc_hmi_permissions[kUndefinedKey],
- rpc_hmi_permissions[kAllowedKey]);
+ ExcludeSameHMILevels(rpc.hmi_permissions[kUndefinedKey],
+ rpc.hmi_permissions[kAllowedKey]);
}
}
// Removing disallowed parameters from allowed and undefined (by user consent)
- if (rpc_parameter_permissions.end() != it_parameter_user_disallowed) {
- if (rpc_parameter_permissions.end() != it_parameter_allowed) {
- ExcludeSameParameters(rpc_parameter_permissions[kAllowedKey],
- rpc_parameter_permissions[kUserDisallowedKey]);
+ if (rpc.parameter_permissions.end() != it_parameter_user_disallowed) {
+ if (rpc.parameter_permissions.end() != it_parameter_allowed) {
+ ExcludeSameParameters(rpc.parameter_permissions[kAllowedKey],
+ rpc.parameter_permissions[kUserDisallowedKey]);
}
- if (rpc_parameter_permissions.end() != it_parameter_undefined) {
- ExcludeSameParameters(rpc_parameter_permissions[kUndefinedKey],
- rpc_parameter_permissions[kUserDisallowedKey]);
+ if (rpc.parameter_permissions.end() != it_parameter_undefined) {
+ ExcludeSameParameters(rpc.parameter_permissions[kUndefinedKey],
+ rpc.parameter_permissions[kUserDisallowedKey]);
}
}
// Removing undefined (by user consent) parameters from allowed
- if (rpc_parameter_permissions.end() != it_parameter_undefined) {
- if (rpc_parameter_permissions.end() != it_parameter_allowed) {
- ExcludeSameParameters(rpc_parameter_permissions[kAllowedKey],
- rpc_parameter_permissions[kUndefinedKey]);
+ if (rpc.parameter_permissions.end() != it_parameter_undefined) {
+ if (rpc.parameter_permissions.end() != it_parameter_allowed) {
+ ExcludeSameParameters(rpc.parameter_permissions[kAllowedKey],
+ rpc.parameter_permissions[kUndefinedKey]);
}
}
}
diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc
index d7dd986abc..528d70a426 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -1660,7 +1660,7 @@ void ConsentRecords::ReportErrors(rpc::ValidationReport* report__) const {
if (!consent_groups.is_valid()) {
consent_groups.ReportErrors(&report__->ReportSubobject("consent_groups"));
}
- if (!consent_groups.is_valid()) {
+ if (!external_consent_status_groups.is_valid()) {
external_consent_status_groups.ReportErrors(
&report__->ReportSubobject("external_consent_status_groups"));
}
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index 48985fa835..1732f3c774 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -224,8 +224,7 @@ int SQLPTRepresentation::DaysBeforeExchange(uint16_t current) {
return limit;
}
- if (limit < 0 || last < 0 || current < 0 || current < last ||
- limit < (current - last)) {
+ if (limit < 0 || last < 0 || current < last || limit < (current - last)) {
return 0;
}
diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc
index 8b7635c25c..087db1149b 100644
--- a/src/components/policy/policy_external/src/update_status_manager.cc
+++ b/src/components/policy/policy_external/src/update_status_manager.cc
@@ -42,6 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
UpdateStatusManager::UpdateStatusManager()
: listener_(NULL)
, current_status_(utils::MakeShared<UpToDateStatus>())
+ , last_processed_event_(kNoEvent)
, apps_search_in_progress_(false)
, app_registered_from_non_consented_device_(true) {
update_status_thread_delegate_ = new UpdateThreadDelegate(this);
@@ -62,6 +63,7 @@ UpdateStatusManager::~UpdateStatusManager() {
void UpdateStatusManager::ProcessEvent(UpdateEvent event) {
sync_primitives::AutoLock lock(status_lock_);
current_status_->ProcessEvent(this, event);
+ last_processed_event_ = event;
DoTransition();
}
diff --git a/src/components/policy/policy_regular/include/policy/status.h b/src/components/policy/policy_regular/include/policy/status.h
index 074e3c1eef..c1ea2de4c1 100644
--- a/src/components/policy/policy_regular/include/policy/status.h
+++ b/src/components/policy/policy_regular/include/policy/status.h
@@ -53,7 +53,8 @@ enum UpdateEvent {
kOnResetPolicyTableNoUpdate,
kScheduleUpdate,
kScheduleManualUpdate,
- kOnResetRetrySequence
+ kOnResetRetrySequence,
+ kNoEvent
};
const std::string kUpToDate = "UP_TO_DATE";
diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h
index 89c6b7e7bb..a68d986d10 100644
--- a/src/components/policy/policy_regular/include/policy/update_status_manager.h
+++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h
@@ -83,9 +83,8 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
/**
* @brief Update status hanlder for PTS sending out
- * @param update_timeout Timeout for waiting of incoming PTU (msec)
*/
- void OnUpdateSentOut(uint32_t update_timeout);
+ void OnUpdateSentOut();
/**
* @brief Update status handler for PTU waiting timeout
@@ -216,24 +215,6 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
bool apps_search_in_progress_;
bool app_registered_from_non_consented_device_;
sync_primitives::Lock apps_search_in_progress_lock_;
-
- class UpdateThreadDelegate : public threads::ThreadDelegate {
- public:
- UpdateThreadDelegate(UpdateStatusManager* update_status_manager);
- ~UpdateThreadDelegate();
- virtual void threadMain();
- virtual void exitThreadMain();
- void updateTimeOut(const uint32_t timeout_ms);
-
- volatile uint32_t timeout_;
- volatile bool stop_flag_;
- sync_primitives::Lock state_lock_;
- sync_primitives::ConditionalVariable termination_condition_;
- UpdateStatusManager* update_status_manager_;
- };
-
- UpdateThreadDelegate* update_status_thread_delegate_;
- threads::Thread* thread_;
};
}
diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h
index e8da7b9b69..e118f9974f 100644
--- a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h
@@ -71,9 +71,8 @@ class UpdateStatusManagerInterface {
/**
* @brief Update status hanlder for PTS sending out
- * @param update_timeout Timeout for waiting of incoming PTU
*/
- virtual void OnUpdateSentOut(uint32_t update_timeout) = 0;
+ virtual void OnUpdateSentOut() = 0;
/**
* @brief Update status handler for PTU waiting timeout
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index bb7c68d22d..f05ac9cb67 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -319,10 +319,13 @@ void PolicyManagerImpl::StartPTExchange() {
if (update_status_manager_.IsUpdateRequired()) {
if (RequestPTUpdate() && !timer_retry_sequence_.is_running()) {
// Start retry sequency
- const int timeout_sec = NextRetryTimeout();
- LOG4CXX_DEBUG(logger_,
- "Start retry sequence timeout = " << timeout_sec);
- timer_retry_sequence_.Start(timeout_sec, timer::kPeriodic);
+ const uint32_t timeout_msec = NextRetryTimeout();
+
+ if (timeout_msec) {
+ LOG4CXX_DEBUG(logger_,
+ "Start retry sequence timeout = " << timeout_msec);
+ timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic);
+ }
}
}
}
@@ -805,7 +808,7 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() {
LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_);
uint32_t next = 0u;
if (retry_sequence_seconds_.empty() ||
- retry_sequence_index_ >= retry_sequence_seconds_.size()) {
+ retry_sequence_index_ > retry_sequence_seconds_.size()) {
return next;
}
@@ -853,16 +856,7 @@ void PolicyManagerImpl::OnExceededTimeout() {
}
void PolicyManagerImpl::OnUpdateStarted() {
- uint32_t update_timeout = TimeoutExchangeMSec();
- LOG4CXX_DEBUG(logger_,
- "Update timeout will be set to (milisec): " << update_timeout);
-
- send_on_update_sent_out_ =
- !wrong_ptu_update_received_ && !update_status_manager_.IsUpdatePending();
-
- if (send_on_update_sent_out_) {
- update_status_manager_.OnUpdateSentOut(update_timeout);
- }
+ update_status_manager_.OnUpdateSentOut();
cache_->SaveUpdateRequired(true);
}
@@ -1118,15 +1112,19 @@ void PolicyManagerImpl::set_cache_manager(
void PolicyManagerImpl::RetrySequence() {
LOG4CXX_INFO(logger_, "Start new retry sequence");
- RequestPTUpdate();
-
- uint32_t timeout = NextRetryTimeout();
+ update_status_manager_.OnUpdateTimeoutOccurs();
- if (!timeout && timer_retry_sequence_.is_running()) {
- timer_retry_sequence_.Stop();
+ const uint32_t timeout_msec = NextRetryTimeout();
+ LOG4CXX_DEBUG(logger_, "New retry sequence timeout = " << timeout_msec);
+ if (!timeout_msec) {
+ if (timer_retry_sequence_.is_running()) {
+ timer_retry_sequence_.Stop();
+ }
return;
}
- timer_retry_sequence_.Start(timeout, timer::kPeriodic);
+
+ RequestPTUpdate();
+ timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic);
}
} // namespace policy
diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc
index d683249718..941113c753 100644
--- a/src/components/policy/policy_regular/src/update_status_manager.cc
+++ b/src/components/policy/policy_regular/src/update_status_manager.cc
@@ -42,22 +42,11 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
UpdateStatusManager::UpdateStatusManager()
: listener_(NULL)
, current_status_(utils::MakeShared<UpToDateStatus>())
+ , last_processed_event_(kNoEvent)
, apps_search_in_progress_(false)
- , app_registered_from_non_consented_device_(true) {
- update_status_thread_delegate_ = new UpdateThreadDelegate(this);
- thread_ = threads::CreateThread("UpdateStatusThread",
- update_status_thread_delegate_);
- thread_->start();
-}
+ , app_registered_from_non_consented_device_(true) {}
-UpdateStatusManager::~UpdateStatusManager() {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(update_status_thread_delegate_);
- DCHECK(thread_);
- thread_->join();
- delete update_status_thread_delegate_;
- threads::DeleteThread(thread_);
-}
+UpdateStatusManager::~UpdateStatusManager() {}
void UpdateStatusManager::ProcessEvent(UpdateEvent event) {
sync_primitives::AutoLock lock(status_lock_);
@@ -78,29 +67,23 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) {
listener_ = listener;
}
-void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) {
+void UpdateStatusManager::OnUpdateSentOut() {
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(update_status_thread_delegate_);
- update_status_thread_delegate_->updateTimeOut(update_timeout);
ProcessEvent(kOnUpdateSentOut);
}
void UpdateStatusManager::OnUpdateTimeoutOccurs() {
LOG4CXX_AUTO_TRACE(logger_);
ProcessEvent(kOnUpdateTimeout);
- DCHECK(update_status_thread_delegate_);
- update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
}
void UpdateStatusManager::OnValidUpdateReceived() {
LOG4CXX_AUTO_TRACE(logger_);
- update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
ProcessEvent(kOnValidUpdateReceived);
}
void UpdateStatusManager::OnWrongUpdateReceived() {
LOG4CXX_AUTO_TRACE(logger_);
- update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
ProcessEvent(kOnWrongUpdateReceived);
}
@@ -204,57 +187,4 @@ void UpdateStatusManager::DoTransition() {
postponed_status_.reset();
}
-UpdateStatusManager::UpdateThreadDelegate::UpdateThreadDelegate(
- UpdateStatusManager* update_status_manager)
- : timeout_(0)
- , stop_flag_(false)
- , state_lock_(true)
- , update_status_manager_(update_status_manager) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Create UpdateThreadDelegate");
-}
-
-UpdateStatusManager::UpdateThreadDelegate::~UpdateThreadDelegate() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Delete UpdateThreadDelegate");
-}
-
-void UpdateStatusManager::UpdateThreadDelegate::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "UpdateStatusManager thread started (started normal)");
- sync_primitives::AutoLock auto_lock(state_lock_);
- while (false == stop_flag_) {
- if (timeout_ > 0) {
- LOG4CXX_DEBUG(logger_, "Timeout is greater then 0");
- sync_primitives::ConditionalVariable::WaitStatus wait_status =
- termination_condition_.WaitFor(auto_lock, timeout_);
- if (sync_primitives::ConditionalVariable::kTimeout == wait_status) {
- if (update_status_manager_) {
- update_status_manager_->OnUpdateTimeoutOccurs();
- }
- }
- } else {
- // Time is not active, wait until timeout will be set,
- // or UpdateStatusManager will be deleted
- termination_condition_.Wait(auto_lock);
- }
- }
-}
-
-void UpdateStatusManager::UpdateThreadDelegate::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(state_lock_);
- stop_flag_ = true;
- LOG4CXX_DEBUG(logger_, "before notify");
- termination_condition_.NotifyOne();
-}
-
-void UpdateStatusManager::UpdateThreadDelegate::updateTimeOut(
- const uint32_t timeout_ms) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(state_lock_);
- timeout_ = timeout_ms;
- termination_condition_.NotifyOne();
-}
-
} // namespace policy
diff --git a/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h b/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h
index 981ff1ca9e..924284c8cc 100644
--- a/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h
+++ b/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h
@@ -41,7 +41,7 @@ namespace policy {
class MockUpdateStatusManager : public UpdateStatusManager {
public:
MOCK_METHOD1(set_listener, void(PolicyListener* listener));
- MOCK_METHOD1(OnUpdateSentOut, void(uint32_t update_timeout));
+ MOCK_METHOD0(OnUpdateSentOut, void());
MOCK_METHOD0(OnUpdateTimeoutOccurs, void());
MOCK_METHOD0(OnValidUpdateReceived, void());
MOCK_METHOD0(OnWrongUpdateReceived, void());
diff --git a/src/components/policy/policy_regular/test/update_status_manager_test.cc b/src/components/policy/policy_regular/test/update_status_manager_test.cc
index 910494ff0d..9d0326d0be 100644
--- a/src/components/policy/policy_regular/test/update_status_manager_test.cc
+++ b/src/components/policy/policy_regular/test/update_status_manager_test.cc
@@ -47,13 +47,11 @@ using ::testing::Return;
class UpdateStatusManagerTest : public ::testing::Test {
protected:
utils::SharedPtr<UpdateStatusManager> manager_;
- const uint32_t k_timeout_;
utils::SharedPtr<MockPolicyListener> listener_;
public:
UpdateStatusManagerTest()
: manager_(utils::MakeShared<UpdateStatusManager>())
- , k_timeout_(1000)
, listener_(utils::MakeShared<MockPolicyListener>()) {}
void SetUp() OVERRIDE {
@@ -73,7 +71,7 @@ TEST_F(UpdateStatusManagerTest,
manager_->OnPolicyInit(true);
// Check
EXPECT_EQ("UPDATE_NEEDED", manager_->StringifiedUpdateStatus());
- manager_->OnUpdateSentOut(k_timeout_);
+ manager_->OnUpdateSentOut();
// Check
EXPECT_EQ("UPDATING", manager_->StringifiedUpdateStatus());
}
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
index 6070f5d757..b6b47c2ed8 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
@@ -547,12 +547,14 @@ void Nullable<T>::ReportErrors(ValidationReport* report) const {
* Optional class
*/
template <typename T>
-Optional<T>::Optional() {}
+Optional<T>::Optional()
+ : policy_table_type_(policy_table_interface_base::INVALID_PT_TYPE) {}
template <typename T>
template <typename U>
Optional<T>::Optional(const U& value)
- : value_(value) {}
+ : policy_table_type_(policy_table_interface_base::INVALID_PT_TYPE)
+ , value_(value) {}
template <typename T>
T& Optional<T>::operator*() {
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
index 05e9406317..6c8bb359af 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
@@ -350,7 +350,8 @@ inline Json::Value Nullable<T>::ToJsonValue() const {
template <typename T>
template <typename U>
Optional<T>::Optional(const Json::Value* value, const U& def_value)
- : value_(value, def_value) {}
+ : policy_table_type_(policy_table_interface_base::INVALID_PT_TYPE)
+ , value_(value, def_value) {}
template <typename T>
inline Json::Value Optional<T>::ToJsonValue() const {
diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc
index 6f53234867..e387739015 100644
--- a/src/components/security_manager/src/ssl_context_impl.cc
+++ b/src/components/security_manager/src/ssl_context_impl.cc
@@ -55,7 +55,8 @@ CryptoManagerImpl::SSLContextImpl::SSLContextImpl(SSL* conn,
, buffer_size_(maximum_payload_size)
, buffer_(new uint8_t[buffer_size_])
, is_handshake_pending_(false)
- , mode_(mode) {
+ , mode_(mode)
+ , max_block_size_(0) {
SSL_set_bio(connection_, bioIn_, bioOut_);
}
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
index ba8cbceb23..80338804ee 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
@@ -95,7 +95,6 @@ class TelemetryMonitor {
private:
std::string server_address_;
int16_t port_;
- bool is_ready_;
threads::Thread* thread_;
Streamer* streamer_;
ApplicationManagerObserver app_observer;
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
index 85e6dc3f96..743c95f2e6 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
@@ -255,9 +255,11 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices(
if (hci_read_remote_name_ret != 0) {
LOG4CXX_ERROR_WITH_ERRNO(logger_, "hci_read_remote_name failed");
+ int name_len = sizeof(deviceName) / sizeof(deviceName[0]);
strncpy(deviceName,
BluetoothDevice::GetUniqueDeviceId(bd_address).c_str(),
- sizeof(deviceName) / sizeof(deviceName[0]));
+ name_len - 1);
+ deviceName[name_len - 1] = '\0';
}
Device* bluetooth_device =
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
index 16960aa1d4..b4370e4b12 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
@@ -106,14 +106,12 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) {
if (0 == connect_status) {
LOG4CXX_DEBUG(logger_, "rfcomm Connect ok");
break;
- }
- if (errno != 111 && errno != 104) {
- LOG4CXX_DEBUG(logger_, "rfcomm Connect errno " << errno);
- break;
- }
- if (errno) {
- LOG4CXX_DEBUG(logger_, "rfcomm Connect errno " << errno);
- close(rfcomm_socket);
+ } else { // If connect_status is not 0, an errno is returned
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "rfcomm Connect failed");
+ close(rfcomm_socket); // Always close the socket upon error
+ if (errno != ECONNREFUSED && errno != ECONNRESET) {
+ break;
+ }
}
sleep(2);
} while (--attempts > 0);
diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
index 48f5dbd613..52a566c5ff 100644
--- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc
+++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
@@ -93,7 +93,10 @@ TransportAdapter::Error TcpClientListener::Init() {
server_address.sin_addr.s_addr = INADDR_ANY;
int optval = 1;
- setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
+ if (0 !=
+ setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_REUSEADDR failed");
+ }
if (bind(socket_,
reinterpret_cast<sockaddr*>(&server_address),
@@ -146,12 +149,28 @@ void SetKeepaliveOptions(const int fd) {
int keepintvl = 1;
#ifdef __linux__
int user_timeout = 7000; // milliseconds
- setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes));
- setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle));
- setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt));
- setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl));
- setsockopt(
- fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &user_timeout, sizeof(user_timeout));
+ if (0 != setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(yes))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_KEEPALIVE failed");
+ }
+ if (0 !=
+ setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepidle, sizeof(keepidle))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPIDLE failed");
+ }
+ if (0 !=
+ setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &keepcnt, sizeof(keepcnt))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPCNT failed");
+ }
+ if (0 != setsockopt(
+ fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepintvl, sizeof(keepintvl))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_KEEPINTVL failed");
+ }
+ if (0 != setsockopt(fd,
+ IPPROTO_TCP,
+ TCP_USER_TIMEOUT,
+ &user_timeout,
+ sizeof(user_timeout))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt TCP_USER_TIMEOUT failed");
+ }
#elif defined(__QNX__) // __linux__
// TODO(KKolodiy): Out of order!
const int kMidLength = 4;
@@ -246,10 +265,16 @@ void TcpClientListener::StopLoop() {
server_address.sin_family = AF_INET;
server_address.sin_port = htons(port_);
server_address.sin_addr.s_addr = INADDR_ANY;
- connect(byesocket,
- reinterpret_cast<sockaddr*>(&server_address),
- sizeof(server_address));
- shutdown(byesocket, SHUT_RDWR);
+ if (0 != connect(byesocket,
+ reinterpret_cast<sockaddr*>(&server_address),
+ sizeof(server_address))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "Failed to connect byesocket");
+ } else {
+ // Can only shutdown socket if connected
+ if (0 != shutdown(byesocket, SHUT_RDWR)) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "Failed to shutdown byesocket");
+ }
+ }
close(byesocket);
}
diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
index 081caec50a..135babdeb0 100644
--- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
+++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
@@ -267,7 +267,7 @@ void ThreadedSocketConnection::Transmit() {
const bool is_queue_empty = IsFramesToSendQueueEmpty();
// Send data if possible
- if (!is_queue_empty && (poll_fds[0].revents | POLLOUT)) {
+ if (!is_queue_empty && (poll_fds[0].revents & POLLOUT)) {
LOG4CXX_DEBUG(logger_, "frames_to_send_ not empty() ");
// send data
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc
index 91ff0c3b07..947b5b090a 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -60,8 +60,11 @@ uint64_t file_system::GetAvailableDiskSpace(const std::string& path) {
int64_t file_system::FileSize(const std::string& path) {
if (file_system::FileExists(path)) {
struct stat file_info = {0};
- stat(path.c_str(), &file_info);
- return file_info.st_size;
+ if (0 != stat(path.c_str(), &file_info)) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "Could not get file size: " << path);
+ } else {
+ return file_info.st_size;
+ }
}
return 0;
}
@@ -94,8 +97,12 @@ size_t file_system::DirectorySize(const std::string& path) {
if (file_system::IsDirectory(full_element_path)) {
size += DirectorySize(full_element_path);
} else {
- stat(full_element_path.c_str(), &file_info);
- size += file_info.st_size;
+ if (0 != stat(full_element_path.c_str(), &file_info)) {
+ LOG4CXX_WARN_WITH_ERRNO(
+ logger_, "Could not get file info: " << full_element_path);
+ } else {
+ size += file_info.st_size;
+ }
}
}
}
@@ -108,7 +115,9 @@ size_t file_system::DirectorySize(const std::string& path) {
std::string file_system::CreateDirectory(const std::string& name) {
if (!DirectoryExists(name)) {
- mkdir(name.c_str(), S_IRWXU);
+ if (0 != mkdir(name.c_str(), S_IRWXU)) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "Unable to create directory: " << name);
+ }
}
return name;
@@ -261,7 +270,10 @@ void file_system::remove_directory_content(const std::string& directory_name) {
remove_directory_content(full_element_path);
rmdir(full_element_path.c_str());
} else {
- remove(full_element_path.c_str());
+ if (0 != remove(full_element_path.c_str())) {
+ LOG4CXX_WARN_WITH_ERRNO(
+ logger_, "Unable to remove file: " << full_element_path);
+ }
}
}
}
@@ -411,7 +423,9 @@ bool file_system::CreateFile(const std::string& path) {
uint64_t file_system::GetFileModificationTime(const std::string& path) {
struct stat info;
- stat(path.c_str(), &info);
+ if (0 != stat(path.c_str(), &info)) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "Could not get file mod time: " << path);
+ }
#ifndef __QNXNTO__
return static_cast<uint64_t>(info.st_mtim.tv_nsec);
#else
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
index 642f16e574..b819b56f54 100644
--- a/src/components/utils/src/timer.cc
+++ b/src/components/utils/src/timer.cc
@@ -64,7 +64,7 @@ timer::Timer::~Timer() {
StopDelegate();
single_shot_ = true;
- delegate_.release();
+ delegate_.reset();
DeleteThread(thread_);
DCHECK(task_);
delete task_;