diff options
author | Andrey Oleynik <aoleynik@luxoft.com> | 2015-08-31 18:46:40 +0300 |
---|---|---|
committer | Andrey Oleynik <aoleynik@luxoft.com> | 2015-09-02 15:46:04 +0300 |
commit | c9f8988d4669c40221d1bde18bba464d8b4724bc (patch) | |
tree | 8c5cab2e6d3021ac4bb653223fec9cb6df46bd10 | |
parent | 12d569a8ae8f8822c3bba13c82f3667780d94250 (diff) | |
download | smartdevicelink-c9f8988d4669c40221d1bde18bba464d8b4724bc.tar.gz |
Fixes setting of HMI level for consequtive permissions validation.
HMI level must be set for just registred application since permissions
validation rely on HMI level.
Fixes: APPLINK-15635
Conflicts:
src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
src/components/application_manager/src/commands/mobile/register_app_interface_response.cc
src/components/application_manager/src/resumption/resume_ctrl.cc
3 files changed, 14 insertions, 15 deletions
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index 11c53f6bd..ac6971ac3 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -493,21 +493,26 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( } - // By default app subscribed to CUSTOM_BUTTON - // Need to send notification to HMI - SendSubscribeCustomButtonNotification(); - - MessageHelper::SendChangeRegistrationRequestToHMI(application); - - SendResponse(true, result, add_info.c_str(), &response_params); MessageHelper::SendOnAppRegisteredNotificationToHMI(*(application.get()), resumption, need_restore_vr); + + SendResponse(true, result, add_info.c_str(), &response_params); + + // Default HMI level should be set before any permissions validation, since it + // relies on HMI level. + resumer.SetupDefaultHMILevel(application); + if (result != mobile_apis::Result::RESUME_FAILED) { resumer.StartResumption(application, hash_id); } else { resumer.StartResumptionOnlyHMILevel(application); } + + // By default app subscribed to CUSTOM_BUTTON + // Need to send notification to HMI + SendSubscribeCustomButtonNotification(); + MessageHelper::SendChangeRegistrationRequestToHMI(application); } mobile_apis::Result::eType diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc index 25de8d3ef..b31879585 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc @@ -60,16 +60,14 @@ void RegisterAppInterfaceResponse::Run() { // Add registered application to the policy db right after response sent to // mobile to be able to check all other API according to app permissions - uint32_t connection_key = - (*message_)[strings::params][strings::connection_key].asUInt(); application_manager::ApplicationConstSharedPtr app = application_manager::ApplicationManagerImpl::instance()-> - application(connection_key); + application(connection_key()); if (app.valid()) { policy::PolicyHandler *policy_handler = policy::PolicyHandler::instance(); std::string mobile_app_id = app->mobile_app_id(); policy_handler->AddApplication(mobile_app_id); - SetHeartBeatTimeout(connection_key, mobile_app_id); + SetHeartBeatTimeout(connection_key(), mobile_app_id); } } diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp index 6dd46aa3d..19cad8013 100644 --- a/src/components/application_manager/src/resume_ctrl.cpp +++ b/src/components/application_manager/src/resume_ctrl.cpp @@ -451,8 +451,6 @@ bool ResumeCtrl::StartResumption(ApplicationSharedPtr application, return false; } - SetupDefaultHMILevel(application); - LOG4CXX_DEBUG(logger_, " Resume app_id = " << application->app_id() << " hmi_app_id = " << application->hmi_app_id() << " mobile_id = " << application->mobile_app_id() @@ -544,8 +542,6 @@ bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) { return false; } - SetupDefaultHMILevel(application); - LOG4CXX_DEBUG(logger_, "ENTER app_id = " << application->app_id() << "mobile_id = " << application->mobile_app_id()); |