#include "application_manager/commands/command_notification_impl.h"
#include "application_manager/message_helper.h"
#include "application_manager/mobile_message_handler.h"
+#include "application_manager/policies/policy_handler.h"
#include "connection_handler/connection_handler_impl.h"
#include "formatters/formatter_json_rpc.h"
#include "formatters/CFormatterJsonSDLRPCv2.hpp"
#include "config_profile/profile.h"
#include "utils/threads/thread.h"
#include "utils/file_system.h"
-#include "policies/policy_manager.h"
#include "application_manager/application_impl.h"
+#include "usage_statistics/counter.h"
namespace application_manager {
messages_to_hmi_("application_manager::ToHMHThreadImpl", this),
request_ctrl_(),
hmi_capabilities_(this),
- unregister_reason_(mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET),
+ unregister_reason_(mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF),
media_manager_(NULL),
- resume_ctrl_(this)
-{
+ resume_ctrl_(this) {
LOG4CXX_INFO(logger_, "Creating ApplicationManager");
- srand(time(NULL));
- if (!policies_manager_.Init()) {
- LOG4CXX_ERROR(logger_, "Policies manager initialization failed.");
- return;
- }
-
media_manager_ = media_manager::MediaManagerImpl::instance();
+ CreatePoliciesManager();
}
bool ApplicationManagerImpl::InitThread(threads::Thread* thread) {
ApplicationManagerImpl::~ApplicationManagerImpl() {
LOG4CXX_INFO(logger_, "Destructing ApplicationManager.");
+ if (policy_manager_) {
+ LOG4CXX_INFO(logger_, "Unloading policy library.");
+ policy::PolicyHandler::instance()->UnloadPolicyLibrary();
+ }
+ policy_manager_ = NULL;
media_manager_ = NULL;
hmi_handler_ = NULL;
connection_handler_ = NULL;
- policy_manager_ = NULL;
hmi_so_factory_ = NULL;
mobile_so_factory_ = NULL;
protocol_handler_ = NULL;
LOG4CXX_INFO(logger_, "Stop ApplicationManager.");
try {
UnregisterAllApplications();
- }
- catch(...) {
+ } catch (...) {
LOG4CXX_ERROR(logger_,
"An error occured during unregistering applications.");
}
sync_primitives::AutoLock lock(applications_list_lock_);
std::map<int32_t, ApplicationSharedPtr>::const_iterator it =
- applications_.find(app_id);
+ applications_.find(app_id);
if (applications_.end() != it) {
return it->second;
} else {
return result;
}
-std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_ivi(
- uint32_t vehicle_info) {
- std::vector<ApplicationSharedPtr> result;
- for (std::set<ApplicationSharedPtr>::iterator it = application_list_.begin();
- application_list_.end() != it;
- ++it) {
- if ((*it)->IsSubscribedToIVI(vehicle_info)) {
+std::vector<utils::SharedPtr<Application>> ApplicationManagerImpl::IviInfoUpdated(
+VehicleDataType vehicle_info, int value) {
+ // Notify Policy Manager if available about info it's interested in,
+ // i.e. odometer etc
+ switch (vehicle_info) {
+ case ODOMETER:
+ policy::PolicyHandler::instance()->KmsChanged(value);
+ break;
+ default:
+ break;
+ }
+
+ std::vector<utils::SharedPtr<application_manager::Application>> result;
+ for (std::set<utils::SharedPtr<application_manager::Application>>::iterator it = application_list_.begin();
+ application_list_.end() != it; ++it) {
+ if ((*it)->IsSubscribedToIVI(static_cast<uint32_t>(vehicle_info))) {
result.push_back(*it);
}
}
if (connection_handler_) {
connection_handler::ConnectionHandlerImpl* con_handler_impl =
static_cast<connection_handler::ConnectionHandlerImpl*>(
- connection_handler_);
+ connection_handler_);
if (con_handler_impl->GetDataOnSessionKey(connection_key, &app_id,
&sessions_list, &device_id)
== -1) {
}
}
- ApplicationSharedPtr application(new
- ApplicationImpl(app_id));
+ smart_objects::SmartObject& params = message[strings::msg_params];
+
+ const std::string mobile_app_id = params[strings::app_id].asString();
+ ApplicationSharedPtr application(new ApplicationImpl(app_id, mobile_app_id,
+ policy_manager_));
if (!application) {
+ usage_statistics::AppCounter count_of_rejections_sync_out_of_memory(
+ policy_manager_, mobile_app_id,
+ usage_statistics::REJECTIONS_SYNC_OUT_OF_MEMORY);
+ ++count_of_rejections_sync_out_of_memory;
+
utils::SharedPtr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
application->set_name(name);
application->set_device(device_id);
- application->set_grammar_id(GenerateGrammarID());
- application->set_language(
- static_cast<mobile_api::Language::eType>(
- message[strings::msg_params][strings::language_desired].asInt()));
- application->set_ui_language(
- static_cast<mobile_api::Language::eType>(
- message[strings::msg_params][strings::hmi_display_language_desired]
- .asInt()));
+ mobile_api::Language::eType launguage_desired =
+ static_cast<mobile_api::Language::eType>(params[strings::language_desired]
+ .asInt());
+ application->set_language(launguage_desired);
+ application->usage_report().RecordAppRegistrationVuiLanguage(
+ launguage_desired);
+
+ mobile_api::Language::eType hmi_display_language_desired =
+ static_cast<mobile_api::Language::eType>(params[strings::hmi_display_language_desired]
+ .asInt());
+ application->set_ui_language(hmi_display_language_desired);
+ application->usage_report().RecordAppRegistrationGuiLanguage(
+ hmi_display_language_desired);
Version version;
int32_t min_version =
}
}
if (curr_app->IsFullscreen()) {
- MessageHelper::ResetGlobalproperties(curr_app);
+ MessageHelper::RemoveAppDataFromHMI(curr_app);
}
}
}
}
mobile_apis::HMILevel::eType ApplicationManagerImpl::PutApplicationInLimited(
- ApplicationSharedPtr app) {
+ ApplicationSharedPtr app) {
DCHECK(app.get())
bool is_new_app_media = app->is_media_application();
}
mobile_api::HMILevel::eType ApplicationManagerImpl::PutApplicationInFull(
- ApplicationSharedPtr app) {
+ ApplicationSharedPtr app) {
DCHECK(app.get())
bool is_new_app_media = app->is_media_application();
}
}
- if ( result == mobile_api::HMILevel::HMI_FULL) {
+ if (result == mobile_api::HMILevel::HMI_FULL) {
app->set_hmi_level(result);
MessageHelper::SendActivateAppToHMI(app->app_id());
}
}
void ApplicationManagerImpl::DeactivateApplication(ApplicationSharedPtr app) {
+ MessageHelper::SendDeleteCommandRequestToHMI(app);
MessageHelper::ResetGlobalproperties(app);
}
if (true == profile::Profile::instance()->launch_hmi()) {
utils::SharedPtr<smart_objects::SmartObject> is_vr_ready(
MessageHelper::CreateModuleInfoSO(
- static_cast<uint32_t>(hmi_apis::FunctionID::VR_IsReady)));
+ static_cast<uint32_t>(hmi_apis::FunctionID::VR_IsReady)));
ManageHMICommand(is_vr_ready);
utils::SharedPtr<smart_objects::SmartObject> is_tts_ready(
void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
LOG4CXX_TRACE_ENTER(logger_);
- sync_primitives::AutoLock lock(audio_pass_thru_lock_);
if (NULL != media_manager_) {
media_manager_->StopMicrophoneRecording(application_key);
}
std::list<uint32_t> applications_list;
connection_handler::ConnectionHandlerImpl* con_handler_impl =
static_cast<connection_handler::ConnectionHandlerImpl*>(
- connection_handler_);
+ connection_handler_);
if (con_handler_impl->GetDataOnDeviceID(handle, &device_name,
&applications_list) == -1) {
LOG4CXX_ERROR(logger_, "Failed to extract device name for id " << handle);
utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message);
if (outgoing_message) {
messages_from_mobile_.PostMessage(
- impl::MessageFromMobile(outgoing_message));
+ impl::MessageFromMobile(outgoing_message));
} else {
LOG4CXX_WARN(logger_, "Incorrect message received");
}
const mobile_api::HMILevel::eType& hmi_level = app->hmi_level();
if (mobile_api::HMILevel::HMI_FULL == hmi_level &&
- app->hmi_supports_navi_streaming() ) {
+ app->hmi_supports_navi_streaming()) {
return true;
}
return false;
}
-uint32_t ApplicationManagerImpl::GenerateGrammarID() {
- return rand();
-}
-
bool ApplicationManagerImpl::OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type) {
+ const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type) {
LOG4CXX_INFO(logger_,
- "OnServiceStartedCallback " << type << " in session " << session_key);
+ "OnServiceStartedCallback " << type << " in session " << session_key);
ApplicationSharedPtr app = application(session_key);
LOG4CXX_INFO(logger_, "Video service is about to be started.");
if (media_manager_) {
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "An application is not registered.");
- return false;
+ LOG4CXX_ERROR_EXT(logger_, "An application is not registered.");
+ return false;
}
if (app->allowed_support_navigation()) {
media_manager_->StartVideoStreaming(session_key);
}
void ApplicationManagerImpl::OnServiceEndedCallback(const int32_t& session_key,
- const protocol_handler::ServiceType& type) {
+ const protocol_handler::ServiceType& type) {
LOG4CXX_INFO_EXT(
logger_,
"OnServiceEndedCallback " << type << " in session " << session_key);
}
break;
}
- case protocol_handler::kAudio:{
+ case protocol_handler::kAudio: {
LOG4CXX_INFO(logger_, "Stop audio service.");
if (media_manager_) {
media_manager_->StopAudioStreaming(session_key);
connection_handler_ = handler;
}
-void ApplicationManagerImpl::set_policy_manager(
- policies::PolicyManager* policy_manager) {
- policy_manager_ = policy_manager;
-}
-
void ApplicationManagerImpl::set_protocol_handler(
protocol_handler::ProtocolHandler* handler) {
protocol_handler_ = handler;
}
messages_to_mobile_.PostMessage(impl::MessageToMobile(message_to_send,
- final_message));
+ final_message));
}
bool ApplicationManagerImpl::ManageMobileCommand(
// Notifications from HMI have no such parameter
uint32_t correlation_id =
- (*message)[strings::params].keyExists(strings::correlation_id)
- ? (*message)[strings::params][strings::correlation_id].asUInt()
- : 0;
+ (*message)[strings::params].keyExists(strings::correlation_id)
+ ? (*message)[strings::params][strings::correlation_id].asUInt()
+ : 0;
uint32_t connection_key =
(*message)[strings::params][strings::connection_key].asUInt();
LOG4CXX_ERROR_EXT(logger_, "APPLICATION_NOT_REGISTERED");
smart_objects::SmartObject* response =
MessageHelper::CreateNegativeResponse(
- connection_key,
- static_cast<int32_t>(function_id),
- correlation_id,
- static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED));
+ connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED));
ApplicationManagerImpl::instance()->SendMessageToMobile(response);
return false;
// Message for "CheckPermission" must be with attached schema
mobile_so_factory().attachSchema(*message);
- policies::CheckPermissionResult result =
- policy_manager_->CheckPermission(app->app_id(),
- *message,
- app->hmi_level());
-
- if (policies::PermissionResult::PERMISSION_ALLOWED != result.result) {
- LOG4CXX_WARN(
+ if (policy_manager_) {
+ LOG4CXX_INFO(
logger_,
- "Request blocked by policies. " << "FunctionID: "
- << static_cast<int32_t>(function_id) << " Application HMI status: "
- << static_cast<int32_t>(app->hmi_level()));
+ "Checking permissions for " << app->mobile_app_id()->asString() << " in " << MessageHelper::StringifiedHMILevel(app->hmi_level()) << " rpc " << MessageHelper::StringifiedFunctionID(function_id));
+ policy::CheckPermissionResult result = policy_manager_->CheckPermissions(
+ app->mobile_app_id()->asString(),
+ MessageHelper::StringifiedHMILevel(app->hmi_level()),
+ MessageHelper::StringifiedFunctionID(function_id));
+
+ if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE
+ && function_id != mobile_apis::FunctionID::UnregisterAppInterfaceID) {
+ app->usage_report().RecordRpcSentInHMINone();
+ }
- smart_objects::SmartObject* response =
- MessageHelper::CreateBlockedByPoliciesResponse(function_id,
- mobile_apis::Result::REJECTED, correlation_id, connection_key);
+ if (!result.hmi_level_permitted) {
+ LOG4CXX_WARN(
+ logger_,
+ "Request blocked by policies. " << "FunctionID: " << static_cast<int32_t>(function_id) << " Application HMI status: " << static_cast<int32_t>(app->hmi_level()));
- ApplicationManagerImpl::instance()->SendMessageToMobile(response);
- return true;
+ app->usage_report().RecordPolicyRejectedRpcCall();
+
+ smart_objects::SmartObject* response =
+ MessageHelper::CreateBlockedByPoliciesResponse(function_id,
+ mobile_apis::Result::REJECTED, correlation_id, connection_key);
+
+ ApplicationManagerImpl::instance()->SendMessageToMobile(response);
+ return true;
+ }
}
}
smart_objects::SmartObject* response =
MessageHelper::CreateNegativeResponse(
- connection_key,
- static_cast<int32_t>(function_id),
- correlation_id,
- static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
+ connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
ApplicationManagerImpl::instance()->SendMessageToMobile(response);
return false;
void ApplicationManagerImpl::CreateHMIMatrix(HMIMatrix* matrix) {
}
-void ApplicationManagerImpl::CreatePoliciesManager(PoliciesManager* managaer) {
+void ApplicationManagerImpl::CreatePoliciesManager() {
+ LOG4CXX_INFO(logger_, "CreatePoliciesManager");
+ policy_manager_ = policy::PolicyHandler::instance()->LoadPolicyLibrary();
+ if (policy_manager_) {
+ LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT");
+ policy::PolicyHandler::instance()->InitPolicyTable();
+ // TODO(KKolodiy) in fact counter of starts
+ usage_statistics::GlobalCounter count_of_sync_reboots(
+ policy_manager_, usage_statistics::SYNC_REBOOTS);
+ ++count_of_sync_reboots;
+ }
}
bool ApplicationManagerImpl::CheckPolicies(smart_objects::SmartObject* message,
message.function_id(),
message.type(),
message.correlation_id())
- || !mobile_so_factory().attachSchema(output)
- || ((output.validate() != smart_objects::Errors::OK)
- && (output.validate() !=
- smart_objects::Errors::UNEXPECTED_PARAMETER))) {
+ || !mobile_so_factory().attachSchema(output)
+ || ((output.validate() != smart_objects::Errors::OK)
+ && (output.validate() !=
+ smart_objects::Errors::UNEXPECTED_PARAMETER))) {
LOG4CXX_WARN(logger_, "Failed to parse string to smart object");
utils::SharedPtr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
}
case ProtocolVersion::kHMI: {
int32_t result = formatters::FormatterJsonRpc::FromString <
- hmi_apis::FunctionID::eType, hmi_apis::messageType::eType > (
- message.json_message(), output);
+ hmi_apis::FunctionID::eType, hmi_apis::messageType::eType > (
+ message.json_message(), output);
LOG4CXX_INFO(
logger_,
"Convertion result: " << result << " function id "
break;
}
case ProtocolVersion::kV1: {
- static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema;
+ static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema;
- if (message.function_id() == 0 || message.type() == kUnknownType) {
- LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION");
+ if (message.function_id() == 0 || message.type() == kUnknownType) {
+ LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION");
- int32_t conversation_result =
- formatters::CFormatterJsonSDLRPCv1::fromString <
- NsSmartDeviceLinkRPC::V1::FunctionID::eType,
- NsSmartDeviceLinkRPC::V1::messageType::eType > (
- message.json_message(), output);
+ int32_t conversation_result =
+ formatters::CFormatterJsonSDLRPCv1::fromString <
+ NsSmartDeviceLinkRPC::V1::FunctionID::eType,
+ NsSmartDeviceLinkRPC::V1::messageType::eType > (
+ message.json_message(), output);
- if (formatters::CFormatterJsonSDLRPCv1::kSuccess
- == conversation_result) {
+ if (formatters::CFormatterJsonSDLRPCv1::kSuccess
+ == conversation_result) {
- smart_objects::SmartObject params = smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
+ smart_objects::SmartObject params = smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
- output[strings::params][strings::message_type] =
- NsSmartDeviceLinkRPC::V1::messageType::response;
- output[strings::params][strings::connection_key] = message.connection_key();
+ output[strings::params][strings::message_type] =
+ NsSmartDeviceLinkRPC::V1::messageType::response;
+ output[strings::params][strings::connection_key] = message.connection_key();
- output[strings::msg_params] =
- smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
- output[strings::msg_params][strings::success] = false;
- output[strings::msg_params][strings::result_code] =
- NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION;
+ output[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
+ output[strings::msg_params][strings::success] = false;
+ output[strings::msg_params][strings::result_code] =
+ NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION;
- smart_objects::SmartObject* msg_to_send = new smart_objects::SmartObject(output);
- v1_shema.attachSchema(*msg_to_send);
- SendMessageToMobile(msg_to_send);
- return false;
- }
+ smart_objects::SmartObject* msg_to_send = new smart_objects::SmartObject(output);
+ v1_shema.attachSchema(*msg_to_send);
+ SendMessageToMobile(msg_to_send);
+ return false;
}
+ }
- break;
+ break;
}
default:
// TODO(PV):
std::string output_string;
switch (message.getElement(jhs::S_PARAMS).getElement(jhs::S_PROTOCOL_TYPE)
.asInt()) {
- case 0:
- {
- if (message.getElement(jhs::S_PARAMS).getElement(jhs::S_PROTOCOL_VERSION).asInt() == 1) {
- if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
- return false;
- }
- output.set_protocol_version(application_manager::kV1);
- } else {
- if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
- LOG4CXX_WARN(logger_, "Failed to serialize smart object");
- return false;
- }
- output.set_protocol_version(application_manager::kV2);
+ case 0: {
+ if (message.getElement(jhs::S_PARAMS).getElement(jhs::S_PROTOCOL_VERSION).asInt() == 1) {
+ if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
+ output_string)) {
+ LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ return false;
+ }
+ output.set_protocol_version(application_manager::kV1);
+ } else {
+ if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
+ output_string)) {
+ LOG4CXX_WARN(logger_, "Failed to serialize smart object");
+ return false;
}
+ output.set_protocol_version(application_manager::kV2);
+ }
break;
}
unregister_reason_ = reason;
}
+void ApplicationManagerImpl::HeadUnitReset(
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) {
+ switch (reason) {
+ case mobile_api::AppInterfaceUnregisteredReason::MASTER_RESET:
+ policy::PolicyHandler::instance()->InitPolicyTable();
+ break;
+ case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS:
+ policy::PolicyHandler::instance()->RevertPolicyTable();
+ break;
+ }
+}
+
void ApplicationManagerImpl::UnregisterAllApplications() {
LOG4CXX_INFO(logger_, "ApplicationManagerImpl::UnregisterAllApplications " <<
unregister_reason_);
StopAudioPassThru(app_id);
MessageHelper::SendStopAudioPathThru();
}
- MessageHelper::ResetGlobalproperties(it->second);
+ MessageHelper::RemoveAppDataFromHMI(it->second);
MessageHelper::SendOnAppUnregNotificationToHMI(it->second);
applications_.erase(it);
application_list_.erase(app_to_remove);
void ApplicationManagerImpl::Mute(VRTTSSessionChanging changing_state) {
mobile_apis::AudioStreamingState::eType state =
- hmi_capabilities_.attenuated_supported()
- ? mobile_apis::AudioStreamingState::ATTENUATED
- : mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ hmi_capabilities_.attenuated_supported()
+ ? mobile_apis::AudioStreamingState::ATTENUATED
+ : mobile_apis::AudioStreamingState::NOT_AUDIBLE;
std::set<ApplicationSharedPtr>::const_iterator it = application_list_.begin();
std::set<ApplicationSharedPtr>::const_iterator itEnd = application_list_.end();
}
if ((!(vr_session_started())) &&
((*it)->audio_streaming_state() !=
- mobile_apis::AudioStreamingState::AUDIBLE)) {
+ mobile_apis::AudioStreamingState::AUDIBLE)) {
(*it)->set_audio_streaming_state(
- mobile_apis::AudioStreamingState::AUDIBLE);
+ mobile_apis::AudioStreamingState::AUDIBLE);
MessageHelper::SendHMIStatusNotification(*(*it));
}
}
}
mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
- const std::vector<uint8_t>& binary_data, const std::string& file_path,
- const uint32_t offset) {
+ const std::vector<uint8_t>& binary_data, const std::string& file_path,
+ const uint32_t offset) {
LOG4CXX_INFO(
- logger_,
- "SaveBinaryWithOffset binary_size = " << binary_data.size()
- << " offset = " << offset);
+ logger_,
+ "SaveBinaryWithOffset binary_size = " << binary_data.size()
+ << " offset = " << offset);
if (binary_data.size() > file_system::GetAvailableDiskSpace()) {
LOG4CXX_ERROR(logger_, "Out of free disc space.");
if (offset != 0) {
if (file_size != offset) {
LOG4CXX_INFO(
- logger_,
- "ApplicationManagerImpl::SaveBinaryWithOffset offset does'n match existing filesize");
+ logger_,
+ "ApplicationManagerImpl::SaveBinaryWithOffset offset does'n match existing filesize");
return mobile_apis::Result::INVALID_DATA;
}
file_stream = file_system::Open(file_path, std::ios_base::app);
} else {
LOG4CXX_INFO(
- logger_,
- "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite");
+ logger_,
+ "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite");
// if offset == 0: rewrite file
file_stream = file_system::Open(file_path, std::ios_base::out);
}