diff --git a/services/audiomanager/managersink/include/daudio_sink_dev.h b/services/audiomanager/managersink/include/daudio_sink_dev.h index 5fa56684090b7b9dad8f28a13371070f7a00ab03..87841dfd9c9c8a44629dc50df7279756921d871d 100644 --- a/services/audiomanager/managersink/include/daudio_sink_dev.h +++ b/services/audiomanager/managersink/include/daudio_sink_dev.h @@ -77,6 +77,7 @@ private: int32_t from_json(const json &j, AudioParam &audioParam); int32_t HandleEngineMessage(uint32_t type, std::string content, std::string devId); int32_t SendAudioEventToRemote(const AudioEvent &event); + void PullUpPage(); int32_t ParseDhidFromEvent(std::string args); int32_t ConvertString2Int(std::string val); @@ -93,6 +94,7 @@ private: std::map> micClientMap_; std::shared_ptr audioCtrlMgr_ = nullptr; static constexpr size_t WAIT_HANDLER_IDLE_TIME_US = 10000; + const std::string SUBTYPE = "mic"; sptr ipcSinkCallback_ = nullptr; std::atomic isPageStatus_ = false; diff --git a/services/audiomanager/managersink/src/daudio_sink_dev.cpp b/services/audiomanager/managersink/src/daudio_sink_dev.cpp index 9ce07833697c0739558fed0a037b2f945e98c30c..d17b4578fa97786296191ff175bd6e9969c94a18 100644 --- a/services/audiomanager/managersink/src/daudio_sink_dev.cpp +++ b/services/audiomanager/managersink/src/daudio_sink_dev.cpp @@ -162,7 +162,6 @@ int32_t DAudioSinkDev::TaskOpenDSpeaker(const std::string &args) NotifySourceDev(NOTIFY_OPEN_SPEAKER_RESULT, spkDhId_, ret); return ret; } - NotifySourceDev(NOTIFY_OPEN_SPEAKER_RESULT, std::to_string(dhId), ret); DHLOGI("Open speaker device task end, notify source ret %d.", ret); isSpkInUse_.store(true); @@ -289,12 +288,7 @@ int32_t DAudioSinkDev::TaskOpenDMic(const std::string &args) DHLOGE("Start capture failed, ret: %d.", ret); return ERR_DH_AUDIO_FAILED; } - std::string subType = "mic"; - bool isSensitive = false; - bool isSameAccount = false; - ipcSinkCallback_->OnNotifyResourceInfo(ResourceEventType::EVENT_TYPE_PULL_UP_PAGE, subType, devId_, - isSensitive, isSameAccount); - isPageStatus_.store(true); + PullUpPage(); NotifySourceDev(NOTIFY_OPEN_MIC_RESULT, jParam[KEY_DH_ID], ret); DHLOGI("Open mic device task end, notify source ret %d.", ret); isMicInUse_.store(true); @@ -326,10 +320,9 @@ int32_t DAudioSinkDev::TaskCloseDMic(const std::string &args) } micClientMap_.erase(dhId); if (isPageStatus_.load()) { - std::string subType = "mic"; bool isSensitive = false; bool isSameAccount = false; - ipcSinkCallback_->OnNotifyResourceInfo(ResourceEventType::EVENT_TYPE_CLOSE_PAGE, subType, devId_, + ipcSinkCallback_->OnNotifyResourceInfo(ResourceEventType::EVENT_TYPE_CLOSE_PAGE, SUBTYPE, devId_, isSensitive, isSameAccount); } isPageStatus_.store(false); @@ -501,6 +494,15 @@ int32_t DAudioSinkDev::ConvertString2Int(std::string val) return std::stoi(val); } +void DAudioSinkDev::PullUpPage() +{ + bool isSensitive = false; + bool isSameAccount = false; + ipcSinkCallback_->OnNotifyResourceInfo(ResourceEventType::EVENT_TYPE_PULL_UP_PAGE, SUBTYPE, devId_, + isSensitive, isSameAccount); + isPageStatus_.store(true); +} + void DAudioSinkDev::NotifySourceDev(const AudioEventType type, const std::string dhId, const int32_t result) { std::random_device rd;