diff options
Diffstat (limited to 'src/components/application_manager/src/application_manager_impl.cc')
-rw-r--r-- | src/components/application_manager/src/application_manager_impl.cc | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 097abc4645..c09ddffbb5 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -291,6 +291,28 @@ ApplicationManagerImpl::applications_with_navi() { DataAccessor<ApplicationSet> accessor = applications(); return FindAllApps(accessor, NaviAppPredicate); } + +bool LimitedMobileProjectionPredicate( const ApplicationSharedPtr app) { + return app ? (app->MobileProjectionEnabled() && + app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) : false; +} + +ApplicationSharedPtr ApplicationManagerImpl::get_limited_mobile_projection_application() + const { + DataAccessor<ApplicationSet> accessor = applications(); + return FindApp(accessor, LimitedMobileProjectionPredicate); +} + +bool MobileProjectionPredicate(const ApplicationSharedPtr app) { + return app ? app->MobileProjectionEnabled() : false; +} + +std::vector<ApplicationSharedPtr> +ApplicationManagerImpl::applications_with_mobile_projection() { + DataAccessor<ApplicationSet> accessor = applications(); + return FindAllApps(accessor, MobileProjectionPredicate); +} + std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button(uint32_t button) { SubscribedToButtonPredicate finder( @@ -353,6 +375,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( bool voice_state = app->is_voice_communication_supported(); bool media_state = app->is_media_application(); bool navi_state = app->is_navi(); + bool mobile_projection_state = app->MobileProjectionEnabled(); ApplicationSharedPtr active_app = active_application(); // Check app in FULL level if (active_app.valid()) { @@ -374,6 +397,10 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( if (navi_state && active_app->is_navi()) { return true; } + + if (mobile_projection_state && active_app->MobileProjectionEnabled()) { + return true; + } } // Check LIMITED apps @@ -398,6 +425,12 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( } } + if (mobile_projection_state) { + if (get_limited_mobile_projection_application().valid() && + (get_limited_mobile_projection_application()->app_id() != app->app_id())) + return true; + } + return false; } @@ -1180,7 +1213,7 @@ bool ApplicationManagerImpl::OnServiceStartedCallback( if (Compare<ServiceType, EQ, ONE>( type, ServiceType::kMobileNav, ServiceType::kAudio)) { - if (app->is_navi()) { + if (app->is_navi() || app->MobileProjectionEnabled()) { return StartNaviService(session_key, type); } else { LOG4CXX_WARN(logger_, "Refuse not navi application"); @@ -2900,7 +2933,7 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { + if (!app || (!app->is_navi() && !app->MobileProjectionEnabled())) { LOG4CXX_DEBUG(logger_, "There is no navi application with id: " << app_id); return; } @@ -2934,7 +2967,7 @@ void ApplicationManagerImpl::OnAppStreaming( LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { + if (!app || (!app->is_navi() && !app->MobileProjectionEnabled())) { LOG4CXX_DEBUG(logger_, " There is no navi application with id: " << app_id); return; } @@ -2954,7 +2987,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { + if (!app || (!app->is_navi() && !app->MobileProjectionEnabled())) { LOG4CXX_DEBUG(logger_, "There is no navi application with id: " << app_id); return; } @@ -3005,7 +3038,7 @@ void ApplicationManagerImpl::OnHMILevelChanged( } ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { + if (!app || (!app->is_navi() && !app->MobileProjectionEnabled())) { LOG4CXX_ERROR(logger_, "Navi application not found"); return; } @@ -3128,7 +3161,7 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { + if (!app || (!app->is_navi() && !app->MobileProjectionEnabled())) { LOG4CXX_ERROR(logger_, "Navi application not found"); return; } @@ -3149,7 +3182,7 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { + if (!app || (!app->is_navi() && !app->MobileProjectionEnabled())) { LOG4CXX_ERROR(logger_, "Navi application not found"); return; } |