diff --git a/frameworks/native/audioutils/BUILD.gn b/frameworks/native/audioutils/BUILD.gn index 2c16a5d0b6f3c04e925640a4a449f3ad231a4fde..34e8ab75fe5c1e43bc1856af25bc004db8494b1d 100644 --- a/frameworks/native/audioutils/BUILD.gn +++ b/frameworks/native/audioutils/BUILD.gn @@ -46,6 +46,7 @@ ohos_shared_library("audio_utils") { "./src/dfx_stat.cpp", "./src/dfx_utils.cpp", "./src/volume_ramp.cpp", + "./src/xperf_adapter.cpp", ] public_external_deps = [ "bounds_checking_function:libsec_shared" ] @@ -59,6 +60,7 @@ ohos_shared_library("audio_utils") { "hicollie:libhicollie", "hilog:libhilog", "hitrace:hitrace_meter", + "hiview:xperfservice_client", "init:libbegetutil", "ipc:ipc_single", "media_foundation:media_monitor_client", diff --git a/frameworks/native/audioutils/include/audio_performance_monitor.h b/frameworks/native/audioutils/include/audio_performance_monitor.h index 144a0ea2ff0c338e30a31355e63eb7a553dc6df7..bcd950bc2f9d3cbc10385146e44346e47e8df3bd 100644 --- a/frameworks/native/audioutils/include/audio_performance_monitor.h +++ b/frameworks/native/audioutils/include/audio_performance_monitor.h @@ -91,8 +91,9 @@ private: void JudgeNoise(uint32_t index, bool curState, uint32_t uid); void ReportEvent(DetectEvent reasonCode, int32_t periodMs, AudioPipeType pipeType, AdapterType adapterType, - uint32_t uid = 0); + uint32_t uid = 0, uint32_t sessionId = 0); std::string GetRunningHapNames(AdapterType adapterType); + void NotifyXperf(int32_t faultcode, uint32_t uid, uint32_t sessionId); int64_t silenceLastReportTime_ = -1; int64_t overTimeLastReportTime_ = -1; diff --git a/frameworks/native/audioutils/include/xperf_adapter.h b/frameworks/native/audioutils/include/xperf_adapter.h new file mode 100644 index 0000000000000000000000000000000000000000..ca856a1857dbd36b440cf8b10246fd7746ff2a71 --- /dev/null +++ b/frameworks/native/audioutils/include/xperf_adapter.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef XPERF_ADAPTER_H +#define XPERF_ADAPTER_H + +#include "audio_info.h" + +namespace OHOS { +namespace AudioStandard { +class XperfAdapter { +public: + static XperfAdapter& GetInstance(); + + void ReportStateChangeEventIfNeed(int32_t eventId, StreamUsage usage, uint32_t sessionId, int32_t pid, int32_t uid); + + void ReportFaultEvent(int32_t faultcode, uint32_t uid, uint32_t sessionId); +private: + XperfAdapter() = default; + ~XperfAdapter() = default; + + XperfAdapter(XperfAdapter&&) = delete; + XperfAdapter& operator=(const XperfAdapter&) = delete; + XperfAdapter& operator=(XperfAdapter&&) = delete; + + bool NeedNotifyXperf(StreamUsage usage); +}; +} // namespace AudioStandard +} // namespace OHOS +#endif //XPERF_ADAPTER_H \ No newline at end of file diff --git a/frameworks/native/audioutils/src/audio_performance_monitor.cpp b/frameworks/native/audioutils/src/audio_performance_monitor.cpp index cff561a93925e207c0ce3f7b4deff5abf1c3cd46..96a58e169cc376aa3f708a1ef827f6d263b81ba4 100644 --- a/frameworks/native/audioutils/src/audio_performance_monitor.cpp +++ b/frameworks/native/audioutils/src/audio_performance_monitor.cpp @@ -18,6 +18,7 @@ #include "audio_performance_monitor.h" #include "audio_performance_monitor_c.h" +#include "xperf_adapter.h" #include #include #include "audio_errors.h" @@ -211,11 +212,17 @@ std::string AudioPerformanceMonitor::GetRunningHapNames(AdapterType adapterType) return hapNames.str(); } +void AudioPerformanceMonitor::NotifyXperf(int32_t faultcode, uint32_t uid, uint32_t sessionId) +{ + XperfAdapter::GetInstance().ReportFaultEvent(faultcode, uid, sessionId); +} + void AudioPerformanceMonitor::ReportEvent(DetectEvent reasonCode, int32_t periodMs, AudioPipeType pipeType, - AdapterType adapterType, uint32_t uid) + AdapterType adapterType, uint32_t uid, uint32_t sessionId) { int64_t curRealTime = ClockTime::GetRealNano(); std::string hapNames = ""; + NotifyXperf(reasonCode, uid, sessionId); switch (reasonCode) { case SILENCE_EVENT: CHECK_AND_RETURN_LOG(curRealTime - silenceLastReportTime_ >= MIN_REPORT_INTERVAL_MS * AUDIO_NS_PER_MS, diff --git a/frameworks/native/audioutils/src/xperf_adapter.cpp b/frameworks/native/audioutils/src/xperf_adapter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..78cb328303cfd53f1e774832592c10bd4e29e2cd --- /dev/null +++ b/frameworks/native/audioutils/src/xperf_adapter.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LOG_TAG +#define LOG_TAG "XperfAdapter" +#endif + +#include "xperf_adapter.h" +#include "xperf_service_client.h" +#include "audio_info.h" + +namespace OHOS { +namespace AudioStandard { +XperfAdapter& XperfAdapter::GetInstance() +{ + static XperfAdapter instance; + return instance; +} + +bool XperfAdapter::NeedNotifyXperf(StreamUsage usage) +{ + if ((usage == STREAM_USAGE_MUSIC) || (usage == STREAM_USAGE_VOICE_COMMUNICATION) || + (usage == STREAM_USAGE_MOVIE)) { + return true; + } + + return false; +} + +void XperfAdapter::ReportStateChangeEventIfNeed(int32_t eventId, StreamUsage usage, uint32_t sessionId, + int32_t pid, int32_t uid) +{ + if (!NeedNotifyXperf(usage)) { + return; + } + auto timeNow = std::chrono::system_clock::now(); + auto durationSinceEpochMs = std::chrono::duration_cast(timeNow.time_since_epoch()); + + const std::string msg = "#UNIQUEID:" + std::to_string(sessionId) + + "#PID:" + std::to_string(pid) + + "#BUNDLE_NAME:" + std::to_string(uid) + + "#HAPPEN_TIME:" + std::to_string(durationSinceEpochMs.count()) + + "#STATUS:" + std::to_string(eventId); + + OHOS::HiviewDFX::XperfServiceClient::GetInstance().NotifyToXperf(HiviewDFX::DomainId::AUDIO, eventId, msg); +} + +void XperfAdapter::ReportFaultEvent(int32_t faultcode, uint32_t uid, uint32_t sessionId) +{ + auto timeNow = std::chrono::system_clock::now(); + auto durationSinceEpochMs = std::chrono::duration_cast(timeNow.time_since_epoch()); + + const std::string msg = "#UNIQUEID:" + std::to_string(sessionId) + + "#FAULT_ID:" + std::to_string(0) + + "#FAULT_CODE:" + std::to_string(faultcode) + + "#HAPPEN_TIME:" + std::to_string(durationSinceEpochMs.count()); + + OHOS::HiviewDFX::XperfServiceClient::GetInstance().NotifyToXperf(HiviewDFX::DomainId::AUDIO, + XPERF_EVENT_FAULT, msg); +} +} // namespace AudioStandard +} // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/audioutils/test/unittest/audio_utils_second_unit_test.cpp b/frameworks/native/audioutils/test/unittest/audio_utils_second_unit_test.cpp index 887a4612d6159351a19b4e7fa914c8f2834f7493..4034d4f16b9398b7b3412ad71d313f9046a105f8 100644 --- a/frameworks/native/audioutils/test/unittest/audio_utils_second_unit_test.cpp +++ b/frameworks/native/audioutils/test/unittest/audio_utils_second_unit_test.cpp @@ -26,6 +26,7 @@ #include "audio_scope_exit.h" #include "audio_safe_block_queue.h" #include "audio_utils_c.h" +#include "xperf_adapter.h" using namespace testing::ext; using namespace testing; @@ -274,5 +275,49 @@ HWTEST(AudioUtilsUnitTest, AudioLatencyMeasurement_001, TestSize.Level1) AudioLatencyMeasurement audioLatencyMeasurement(44100, 2, 16, "com.example.null", 1); EXPECT_EQ(audioLatencyMeasurement.sessionId_, 1); } + +/** + * @tc.name : Test NeedNotifyXperf API + * @tc.type : FUNC + * @tc.number: XperfAdapterNeedNotifyXperf_001 + * @tc.desc : Test NeedNotifyXperf. + */ +HWTEST(AudioUtilsUnitTest, XperfAdapterNeedNotifyXperf_001, TestSize.Level1) +{ + EXPECT_EQ(XperfAdapter::GetInstance().NeedNotifyXperf(STREAM_USAGE_MEDIA), true); +} + +/** + * @tc.name : Test NeedNotifyXperf API + * @tc.type : FUNC + * @tc.number: XperfAdapterNeedNotifyXperf_002 + * @tc.desc : Test NeedNotifyXperf. + */ +HWTEST(AudioUtilsUnitTest, XperfAdapterNeedNotifyXperf_002, TestSize.Level1) +{ + EXPECT_EQ(XperfAdapter::GetInstance().NeedNotifyXperf(STREAM_USAGE_VOICE_COMMUNICATION), true); +} + +/** + * @tc.name : Test NeedNotifyXperf API + * @tc.type : FUNC + * @tc.number: XperfAdapterNeedNotifyXperf_003 + * @tc.desc : Test NeedNotifyXperf. + */ +HWTEST(AudioUtilsUnitTest, XperfAdapterNeedNotifyXperf_003, TestSize.Level1) +{ + EXPECT_EQ(XperfAdapter::GetInstance().NeedNotifyXperf(STREAM_USAGE_MOVIE), true); +} + +/** + * @tc.name : Test NeedNotifyXperf API + * @tc.type : FUNC + * @tc.number: XperfAdapterNeedNotifyXperf_004 + * @tc.desc : Test NeedNotifyXperf. + */ +HWTEST(AudioUtilsUnitTest, XperfAdapterNeedNotifyXperf_004, TestSize.Level1) +{ + EXPECT_EQ(XperfAdapter::GetInstance().NeedNotifyXperf(STREAM_USAGE_NOTIFICATION_RINGTONE), false); +} } // namespace AudioStandard } // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/pulseaudio/modules/capturer/BUILD.gn b/frameworks/native/pulseaudio/modules/capturer/BUILD.gn index 133f5edbf009ddf8395cdf6c7be782b1784753bf..4f42a890d9bedb10c6538de3defe7b3661070eeb 100644 --- a/frameworks/native/pulseaudio/modules/capturer/BUILD.gn +++ b/frameworks/native/pulseaudio/modules/capturer/BUILD.gn @@ -18,6 +18,7 @@ config("capturer_config") { visibility = [ ":*" ] include_dirs = [ + "../hdi/", "../../../../../interfaces/inner_api/native/audiocommon/include", "../../../../../services/audio_service/common/include", "../../../audioschedule/include", diff --git a/frameworks/native/pulseaudio/modules/capturer/module_inner_capturer_sink.c b/frameworks/native/pulseaudio/modules/capturer/module_inner_capturer_sink.c index 56443737e954ecc9b803816be150057473a9e227..b20bd09a1c619fb33ed3aa934a50655374a879bc 100644 --- a/frameworks/native/pulseaudio/modules/capturer/module_inner_capturer_sink.c +++ b/frameworks/native/pulseaudio/modules/capturer/module_inner_capturer_sink.c @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -#include +#include #endif #ifndef LOG_TAG diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_sink.c b/frameworks/native/pulseaudio/modules/hdi/hdi_sink.c index 4c3814f484dde61d172ad884b53637617fe7f138..f84286a81a4bbad4710d2fa6785742078a13beba 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_sink.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_sink.c @@ -16,7 +16,7 @@ #define LOG_TAG "HdiSink" #endif -#include +#include #include #include #include diff --git a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c index 9ec6dacac5457aff77b72d7a1ce8c68b3cbd749a..76ea84996dde8f0189f43a9c10e05c8af50ba39d 100644 --- a/frameworks/native/pulseaudio/modules/hdi/hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/hdi_source.c @@ -16,7 +16,7 @@ #define LOG_TAG "HdiSource" #endif -#include +#include #include #include #include diff --git a/frameworks/native/pulseaudio/modules/hdi/module_hdi_sink.c b/frameworks/native/pulseaudio/modules/hdi/module_hdi_sink.c index 6ac5305bca67a2f46ef3600a3f43df9aa81d5942..8579129764d36fffad1c1534b2fe87a1e82da9cd 100644 --- a/frameworks/native/pulseaudio/modules/hdi/module_hdi_sink.c +++ b/frameworks/native/pulseaudio/modules/hdi/module_hdi_sink.c @@ -13,7 +13,7 @@ * limitations under the License. */ -#include +#include #include #include #include diff --git a/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c b/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c index f5b849e65a43d55fa75a01293a7466f39347bf55..53a000c1f81fc69fbbe655954c338b56fb03b8c4 100644 --- a/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c +++ b/frameworks/native/pulseaudio/modules/hdi/module_hdi_source.c @@ -15,7 +15,7 @@ #undef LOG_TAG #define LOG_TAG "ModuleHdiSource" -#include +#include #include #include #include diff --git a/frameworks/native/pulseaudio/modules/hdi/module_split_stream_sink.c b/frameworks/native/pulseaudio/modules/hdi/module_split_stream_sink.c index 0ef04f1a5be4ebd46f309d1de44e87d731cb0245..9619fcbfebba77d64b656fa3df10c50e88a10674 100644 --- a/frameworks/native/pulseaudio/modules/hdi/module_split_stream_sink.c +++ b/frameworks/native/pulseaudio/modules/hdi/module_split_stream_sink.c @@ -14,7 +14,7 @@ */ #ifdef HAVE_CONFIG_H -#include +#include #endif #undef LOG_TAG diff --git a/frameworks/native/pulseaudio/modules/hdi/config.h b/frameworks/native/pulseaudio/modules/hdi/pa_config.h similarity index 100% rename from frameworks/native/pulseaudio/modules/hdi/config.h rename to frameworks/native/pulseaudio/modules/hdi/pa_config.h diff --git a/interfaces/inner_api/native/audiocommon/include/audio_info.h b/interfaces/inner_api/native/audiocommon/include/audio_info.h index 85bfda844cfd55fd24bbc39fc2d757e3019adf38..3f524727836e8a36017614146b277d29493e83e3 100644 --- a/interfaces/inner_api/native/audiocommon/include/audio_info.h +++ b/interfaces/inner_api/native/audiocommon/include/audio_info.h @@ -1949,6 +1949,14 @@ enum BoostTriggerMethod : uint32_t { METHOD_WRITE_OR_READ, METHOD_MAX }; + +enum XperfEventId : int32_t { + XPERF_EVENT_START = 0, + XPERF_EVENT_STOP = 1, + XPERF_EVENT_RELEASE = 2, + XPERF_EVENT_FAULT = 3, + XPERF_EVENT_MAX = 4, +}; } // namespace AudioStandard } // namespace OHOS #endif // AUDIO_INFO_H diff --git a/services/audio_service/server/include/audio_process_in_server.h b/services/audio_service/server/include/audio_process_in_server.h index 12869f6f9c40cc22a7ca70d11dfd261d9a3db104..eb5bc6988170d04adffab9438d2ef5a650720dc5 100644 --- a/services/audio_service/server/include/audio_process_in_server.h +++ b/services/audio_service/server/include/audio_process_in_server.h @@ -155,6 +155,7 @@ private: bool CheckBGCapturer(); void WriterRenderStreamStandbySysEvent(uint32_t sessionId, int32_t standby); void ReportDataToResSched(std::unordered_map payload, uint32_t type); + void NotifyXperfOnPlayback(AudioMode audioMode, XperfEventId eventId); private: std::atomic muteFlag_ = false; diff --git a/services/audio_service/server/include/renderer_in_server.h b/services/audio_service/server/include/renderer_in_server.h index d713046253dc72b5d3ca065b58cacd53459538c7..83cdfd36bbb1bce8f139caf8588f96cae5dfd02b 100644 --- a/services/audio_service/server/include/renderer_in_server.h +++ b/services/audio_service/server/include/renderer_in_server.h @@ -148,7 +148,6 @@ public: int32_t SetAudioHapticsSyncId(const int32_t &audioHapticsSyncId); void InitDupBuffer(int32_t innerCapId); - public: const AudioProcessConfig processConfig_; private: diff --git a/services/audio_service/server/src/audio_process_in_server.cpp b/services/audio_service/server/src/audio_process_in_server.cpp index fe5501d79a459edb3ce59d4748e91bcacafe0e3c..18e8423dc3478c03e05f46762c314ddf6ed01502 100644 --- a/services/audio_service/server/src/audio_process_in_server.cpp +++ b/services/audio_service/server/src/audio_process_in_server.cpp @@ -20,6 +20,7 @@ #include "policy_handler.h" #include "securec.h" +#include "xperf_adapter.h" #include "iprocess_cb.h" #include "audio_errors.h" #include "audio_capturer_log.h" @@ -93,6 +94,7 @@ AudioProcessInServer::~AudioProcessInServer() if (processConfig_.audioMode == AUDIO_MODE_RECORD && needCheckBackground_) { TurnOffMicIndicator(CAPTURER_INVALID); } + NotifyXperfOnPlayback(processConfig_.audioMode, XPERF_EVENT_RELEASE); AudioStreamMonitor::GetInstance().DeleteCheckForMonitor(processConfig_.originalSessionId); } @@ -338,6 +340,7 @@ int32_t AudioProcessInServer::StartInner() processBuffer_->SetLastWrittenTime(ClockTime::GetCurNano()); AudioPerformanceMonitor::GetInstance().StartSilenceMonitor(sessionId_, processConfig_.appInfo.appTokenId); + NotifyXperfOnPlayback(processConfig_.audioMode, XPERF_EVENT_START); AUDIO_INFO_LOG("Start in server success!"); return SUCCESS; } @@ -376,6 +379,7 @@ int32_t AudioProcessInServer::Pause(bool isFlush) CoreServiceHandler::GetInstance().UpdateSessionOperation(sessionId_, SESSION_OPERATION_PAUSE); StreamDfxManager::GetInstance().CheckStreamOccupancy(sessionId_, processConfig_, false); AudioPerformanceMonitor::GetInstance().PauseSilenceMonitor(sessionId_); + NotifyXperfOnPlayback(processConfig_.audioMode, XPERF_EVENT_STOP); AUDIO_PRERELEASE_LOGI("Pause in server success!"); return SUCCESS; } @@ -403,6 +407,7 @@ int32_t AudioProcessInServer::Resume() processBuffer_->SetLastWrittenTime(ClockTime::GetCurNano()); CoreServiceHandler::GetInstance().UpdateSessionOperation(sessionId_, SESSION_OPERATION_START); audioStreamChecker_->MonitorOnAllCallback(AUDIO_STREAM_START, false); + NotifyXperfOnPlayback(processConfig_.audioMode, XPERF_EVENT_START); AUDIO_PRERELEASE_LOGI("Resume in server success!"); return SUCCESS; } @@ -446,6 +451,7 @@ int32_t AudioProcessInServer::Stop(int32_t stage) CoreServiceHandler::GetInstance().UpdateSessionOperation(sessionId_, SESSION_OPERATION_STOP); StreamDfxManager::GetInstance().CheckStreamOccupancy(sessionId_, processConfig_, false); AudioPerformanceMonitor::GetInstance().PauseSilenceMonitor(sessionId_); + NotifyXperfOnPlayback(processConfig_.audioMode, XPERF_EVENT_STOP); AUDIO_INFO_LOG("Stop in server success!"); return SUCCESS; } @@ -469,6 +475,7 @@ int32_t AudioProcessInServer::Release(bool isSwitchStream) CHECK_AND_RETURN_RET_LOG(ret == SUCCESS, ret, "Policy remove client failed, reason: %{public}d", ret); StreamDfxManager::GetInstance().CheckStreamOccupancy(sessionId_, processConfig_, false); ret = releaseCallback_->OnProcessRelease(this, isSwitchStream); + NotifyXperfOnPlayback(processConfig_.audioMode, XPERF_EVENT_RELEASE); AUDIO_INFO_LOG("notify service release result: %{public}d", ret); return SUCCESS; } @@ -877,5 +884,12 @@ uint32_t AudioProcessInServer::GetByteSizePerFrame() { return byteSizePerFrame_; } + +void AudioProcessInServer::NotifyXperfOnPlayback(AudioMode audioMode, XperfEventId eventId) { + CHECK_AND_RETURN(audioMode == AUDIO_MODE_PLAYBACK); + XperfAdapter::GetInstance().ReportStateChangeEventIfNeed(eventId, + processConfig_.rendererInfo.streamUsage, sessionId_, processConfig_.appInfo.appPid, + processConfig_.appInfo.appUid); +} } // namespace AudioStandard } // namespace OHOS diff --git a/services/audio_service/server/src/renderer_in_server.cpp b/services/audio_service/server/src/renderer_in_server.cpp index 70a59ae23e1928e453155c72d90f6eaf769e5624..c7bdba5f01fe05cc5ef8d35c027ff6e54a7fda7a 100644 --- a/services/audio_service/server/src/renderer_in_server.cpp +++ b/services/audio_service/server/src/renderer_in_server.cpp @@ -17,13 +17,16 @@ #endif #include "renderer_in_server.h" +#include #include #include "securec.h" +#include #include "audio_errors.h" #include "audio_renderer_log.h" #include "audio_utils.h" #include "audio_service.h" #include "futex_tool.h" +#include "xperf_adapter.h" #include "i_stream_manager.h" #ifdef RESSCHE_ENABLE #include "res_type.h" @@ -969,6 +972,11 @@ int32_t RendererInServer::Start() if (ret == SUCCESS) { StreamDfxManager::GetInstance().CheckStreamOccupancy(streamIndex_, processConfig_, true); } + + XperfAdapter::GetInstance().ReportStateChangeEventIfNeed(XPERF_EVENT_START, + processConfig_.rendererInfo.streamUsage, streamIndex_, processConfig_.appInfo.appPid, + processConfig_.appInfo.appUid); + return ret; } @@ -1112,6 +1120,9 @@ int32_t RendererInServer::Pause() audioStreamChecker_->MonitorOnAllCallback(AUDIO_STREAM_PAUSE, isStandbyTmp); StreamDfxManager::GetInstance().CheckStreamOccupancy(streamIndex_, processConfig_, false); AudioPerformanceMonitor::GetInstance().PauseSilenceMonitor(streamIndex_); + XperfAdapter::GetInstance().ReportStateChangeEventIfNeed(XPERF_EVENT_STOP, + processConfig_.rendererInfo.streamUsage, streamIndex_, processConfig_.appInfo.appPid, + processConfig_.appInfo.appUid); return SUCCESS; } @@ -1240,7 +1251,11 @@ int32_t RendererInServer::Stop() } status_ = I_STATUS_STOPPING; } - return StopInner(); + int32_t ret = StopInner(); + XperfAdapter::GetInstance().ReportStateChangeEventIfNeed(XPERF_EVENT_STOP, + processConfig_.rendererInfo.streamUsage, streamIndex_, processConfig_.appInfo.appPid, + processConfig_.appInfo.appUid); + return ret; } int32_t RendererInServer::StopInner() @@ -1331,6 +1346,9 @@ int32_t RendererInServer::Release(bool isSwitchStream) if (isDualToneEnabled_) { DisableDualTone(); } + XperfAdapter::GetInstance().ReportStateChangeEventIfNeed(XPERF_EVENT_RELEASE, + processConfig_.rendererInfo.streamUsage, streamIndex_, processConfig_.appInfo.appPid, + processConfig_.appInfo.appUid); return SUCCESS; }