summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/application_manager_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/application_manager_impl.cc')
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc54
1 files changed, 37 insertions, 17 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 04fcf2c53f..7814b58a35 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -304,7 +304,9 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
}
bool LimitedAppPredicate(const ApplicationSharedPtr app) {
- return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false;
+ return app ? app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED
+ : false;
}
ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
@@ -315,7 +317,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_navi() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -327,7 +330,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application()
bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_voice_communication_supported() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -349,7 +353,8 @@ ApplicationManagerImpl::applications_with_navi() {
bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) {
return app ? (app->mobile_projection_enabled() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -574,12 +579,16 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
HmiStatePtr initial_state =
CreateRegularState(std::shared_ptr<Application>(application),
+ mobile_apis::WindowType::MAIN,
mobile_apis::HMILevel::INVALID_ENUM,
mobile_apis::AudioStreamingState::INVALID_ENUM,
mobile_apis::VideoStreamingState::INVALID_ENUM,
mobile_api::SystemContext::SYSCTXT_MAIN);
- application->SetInitialState(initial_state);
+ application->SetInitialState(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ std::string(), // should not be tracked for main window
+ initial_state);
application->set_folder_name(policy_app_id + "_" +
application->mac_address());
@@ -1314,11 +1323,13 @@ void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) {
HmiStatePtr ApplicationManagerImpl::CreateRegularState(
std::shared_ptr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const {
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const {
HmiStatePtr state(new HmiState(app, *this));
+ state->set_window_type(window_type);
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_state);
state->set_video_streaming_state(video_state);
@@ -3063,7 +3074,9 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
params_permissions->undefined_params = result.list_of_undefined_params;
}
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE &&
+ // Record statistics for default window only
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE &&
function_id != MessageHelper::StringifiedFunctionID(
mobile_apis::FunctionID::UnregisterAppInterfaceID)) {
if (result.hmi_level_permitted != policy::kRpcAllowed) {
@@ -3074,7 +3087,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
#ifdef ENABLE_LOG
const std::string log_msg =
"Application: " + app->policy_app_id() + ", RPC: " + function_id +
- ", HMI status: " + MessageHelper::StringifiedHMILevel(app->hmi_level());
+ ", window_id: " + std::to_string(window_id) + ", HMI status: " +
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
#endif // ENABLE_LOG
if (result.hmi_level_permitted != policy::kRpcAllowed) {
LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg);
@@ -3147,7 +3161,10 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming(
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED);
+ return Compare<eType, EQ, ONE>(
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW),
+ HMI_FULL,
+ HMI_LIMITED);
}
bool ApplicationManagerImpl::CanAppStream(
@@ -3836,10 +3853,12 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
if (flag_diffirence_app_hmi_type) {
(*it)->set_app_types(transform_app_hmi_types);
(*it)->ChangeSupportingAppHMIType();
- if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ (*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
- } else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
- ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
+ } else if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) ||
+ (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
state_controller().SetRegularState(
*it, mobile_apis::HMILevel::HMI_BACKGROUND, true);
@@ -4342,9 +4361,10 @@ void ApplicationManagerImpl::ChangeAppsHMILevel(
LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id);
return;
}
- const mobile_apis::HMILevel::eType old_level = app->hmi_level();
+ const mobile_apis::HMILevel::eType old_level =
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW);
if (old_level != level) {
- app->set_hmi_level(level);
+ app->set_hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, level);
OnHMILevelChanged(app_id, old_level, level);
} else {
LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level);