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 | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 8c792750a8..e7e7868102 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -291,6 +291,29 @@ ApplicationManagerImpl::applications_with_navi() { DataAccessor<ApplicationSet> accessor = applications(); return FindAllApps(accessor, NaviAppPredicate); } + +bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) { + return app ? (app->mobile_projection_enabled() && + 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->mobile_projection_enabled() : 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 +376,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->mobile_projection_enabled(); ApplicationSharedPtr active_app = active_application(); // Check app in FULL level if (active_app.valid()) { @@ -374,6 +398,10 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( if (navi_state && active_app->is_navi()) { return true; } + + if (mobile_projection_state && active_app->mobile_projection_enabled()) { + return true; + } } // Check LIMITED apps @@ -398,6 +426,14 @@ 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,10 +1216,10 @@ bool ApplicationManagerImpl::OnServiceStartedCallback( if (Compare<ServiceType, EQ, ONE>( type, ServiceType::kMobileNav, ServiceType::kAudio)) { - if (app->is_navi()) { + if (app->is_navi() || app->mobile_projection_enabled()) { return StartNaviService(session_key, type); } else { - LOG4CXX_WARN(logger_, "Refuse not navi application"); + LOG4CXX_WARN(logger_, "Refuse not navi/projection application"); } } else { LOG4CXX_WARN(logger_, "Refuse unknown service"); @@ -2901,8 +2937,10 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_DEBUG(logger_, "There is no navi application with id: " << app_id); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_DEBUG( + logger_, + "There is no navi or projection application with id: " << app_id); return; } @@ -2935,8 +2973,10 @@ void ApplicationManagerImpl::OnAppStreaming( LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_DEBUG(logger_, " There is no navi application with id: " << app_id); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_DEBUG( + logger_, + " There is no navi or projection application with id: " << app_id); return; } DCHECK_OR_RETURN_VOID(media_manager_); @@ -2955,8 +2995,10 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_DEBUG(logger_, "There is no navi application with id: " << app_id); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_DEBUG( + logger_, + "There is no navi or projection application with id: " << app_id); return; } @@ -3006,8 +3048,8 @@ void ApplicationManagerImpl::OnHMILevelChanged( } ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_ERROR(logger_, "Navi application not found"); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); return; } @@ -3129,8 +3171,8 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_ERROR(logger_, "Navi application not found"); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); return; } @@ -3150,8 +3192,8 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application(app_id); - if (!app || !app->is_navi()) { - LOG4CXX_ERROR(logger_, "Navi application not found"); + if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { + LOG4CXX_ERROR(logger_, "Navi/Projection application not found"); return; } |