@@ -143,6 +143,7 @@ ApplicationManagerImpl::ApplicationManagerImpl(
143
143
: settings_(am_settings)
144
144
, applications_list_lock_(true )
145
145
, audio_pass_thru_active_(false )
146
+ , audio_pass_thru_app_id_(0 )
146
147
, driver_distraction_state_(
147
148
hmi_apis::Common_DriverDistractionState::INVALID_ENUM)
148
149
, is_vr_session_strated_(false )
@@ -784,6 +785,17 @@ bool ApplicationManagerImpl::BeginAudioPassThrough() {
784
785
}
785
786
}
786
787
788
+ bool ApplicationManagerImpl::BeginAudioPassThru (uint32_t app_id) {
789
+ sync_primitives::AutoLock lock (audio_pass_thru_lock_);
790
+ if (audio_pass_thru_active_) {
791
+ return false ;
792
+ } else {
793
+ audio_pass_thru_active_ = true ;
794
+ audio_pass_thru_app_id_ = app_id;
795
+ return true ;
796
+ }
797
+ }
798
+
787
799
bool ApplicationManagerImpl::EndAudioPassThrough () {
788
800
sync_primitives::AutoLock lock (audio_pass_thru_lock_);
789
801
if (audio_pass_thru_active_) {
@@ -794,6 +806,17 @@ bool ApplicationManagerImpl::EndAudioPassThrough() {
794
806
}
795
807
}
796
808
809
+ bool ApplicationManagerImpl::EndAudioPassThru (uint32_t app_id) {
810
+ sync_primitives::AutoLock lock (audio_pass_thru_lock_);
811
+ if (audio_pass_thru_active_ && audio_pass_thru_app_id_ == app_id) {
812
+ audio_pass_thru_active_ = false ;
813
+ audio_pass_thru_app_id_ = 0 ;
814
+ return true ;
815
+ } else {
816
+ return false ;
817
+ }
818
+ }
819
+
797
820
hmi_apis::Common_DriverDistractionState::eType
798
821
ApplicationManagerImpl::driver_distraction_state () const {
799
822
return driver_distraction_state_;
@@ -3222,9 +3245,8 @@ void ApplicationManagerImpl::UnregisterApplication(
3222
3245
3223
3246
commands_holder_->Clear (app_to_remove);
3224
3247
3225
- if (audio_pass_thru_active_ ) {
3248
+ if (EndAudioPassThru (app_id) ) {
3226
3249
// May be better to put this code in MessageHelper?
3227
- EndAudioPassThrough ();
3228
3250
StopAudioPassThru (app_id);
3229
3251
MessageHelper::SendStopAudioPathThru (*this );
3230
3252
}
@@ -4441,6 +4463,11 @@ void ApplicationManagerImpl::AddMockApplication(ApplicationSharedPtr mock_app) {
4441
4463
apps_size_ = applications_.size ();
4442
4464
applications_list_lock_.Release ();
4443
4465
}
4466
+
4467
+ void ApplicationManagerImpl::SetMockMediaManager (
4468
+ media_manager::MediaManager* mock_media_manager) {
4469
+ media_manager_ = mock_media_manager;
4470
+ }
4444
4471
#endif // BUILD_TESTS
4445
4472
#ifdef SDL_REMOTE_CONTROL
4446
4473
struct MobileAppIdPredicate {
0 commit comments