From e3a8d9bd013ebbbdfd46f7ea71084bbb845145b3 Mon Sep 17 00:00:00 2001 From: jerry Date: Wed, 13 Dec 2023 17:41:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E7=9A=84=E7=A6=81=E7=94=A8=E9=BA=A6?= =?UTF-8?q?=E5=85=8B=E9=A3=8E=E6=8E=A5=E5=8F=A3=E5=AF=BC=E8=87=B4=E9=82=A3?= =?UTF-8?q?=E8=BE=B9=E7=8A=B6=E6=80=81=E8=AE=A2=E9=98=85=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jerry Change-Id: Icc5fee0bc419b0becba08716cf9c34cacc091bd2 --- .../edm_plugin/src/disable_microphone_plugin.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/services/edm_plugin/src/disable_microphone_plugin.cpp b/services/edm_plugin/src/disable_microphone_plugin.cpp index 3ead8593f..c64f8b0e1 100644 --- a/services/edm_plugin/src/disable_microphone_plugin.cpp +++ b/services/edm_plugin/src/disable_microphone_plugin.cpp @@ -48,7 +48,18 @@ ErrCode DisableMicrophonePlugin::OnSetPolicy(bool &isDisallow) } system::SetParameter(PARAM_EDM_MIC_DISABLE, "true"); } else { - system::SetParameter(PARAM_EDM_MIC_DISABLE, "false"); + bool oldParameter = system::GetBoolParameter(PARAM_EDM_MIC_DISABLE, false); + if (oldParameter) { + auto audioSystemManager = OHOS::AudioStandard::AudioSystemManager::GetInstance(); + if (!audioSystemManager->IsMicrophoneMute()) { + audioSystemManager->SetMicrophoneMute(true); + system::SetParameter(PARAM_EDM_MIC_DISABLE, "false"); + audioSystemManager->SetMicrophoneMute(true); + audioSystemManager->SetMicrophoneMute(false); + } else { + system::SetParameter(PARAM_EDM_MIC_DISABLE, "false"); + } + } } return ERR_OK; } -- Gitee From 3e82862c38a04bcd53fd2c7caa291ee4d35c29cb Mon Sep 17 00:00:00 2001 From: jerry Date: Thu, 14 Dec 2023 09:25:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E5=AD=90=E7=B3=BB=E7=BB=9F=E7=9A=84=E7=A6=81=E7=94=A8=E9=BA=A6?= =?UTF-8?q?=E5=85=8B=E9=A3=8E=E6=8E=A5=E5=8F=A3=E5=AF=BC=E8=87=B4=E9=82=A3?= =?UTF-8?q?=E8=BE=B9=E7=8A=B6=E6=80=81=E8=AE=A2=E9=98=85=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jerry Change-Id: Ice34efa1643ac1cec84e89a77330524cbfc36e38 --- services/edm_plugin/src/disable_microphone_plugin.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/edm_plugin/src/disable_microphone_plugin.cpp b/services/edm_plugin/src/disable_microphone_plugin.cpp index c64f8b0e1..7a68834ed 100644 --- a/services/edm_plugin/src/disable_microphone_plugin.cpp +++ b/services/edm_plugin/src/disable_microphone_plugin.cpp @@ -41,7 +41,7 @@ ErrCode DisableMicrophonePlugin::OnSetPolicy(bool &isDisallow) EDMLOGI("DisableMicrophonePlugin OnSetPolicy...isDisallow = %{public}d", isDisallow); if (isDisallow) { auto audioSystemManager = OHOS::AudioStandard::AudioSystemManager::GetInstance(); - int32_t ret = audioSystemManager->SetMicrophoneMute(isDisallow); + int32_t ret = audioSystemManager->SetMicrophoneMute(true); if (ret != AUDIO_SET_MICROPHONE_MUTE_SUCCESS) { EDMLOGE("DisableMicrophonePlugin displayManager DisableMicrophone result %{public}d", ret); return EdmReturnErrCode::SYSTEM_ABNORMALLY; @@ -51,13 +51,12 @@ ErrCode DisableMicrophonePlugin::OnSetPolicy(bool &isDisallow) bool oldParameter = system::GetBoolParameter(PARAM_EDM_MIC_DISABLE, false); if (oldParameter) { auto audioSystemManager = OHOS::AudioStandard::AudioSystemManager::GetInstance(); + system::SetParameter(PARAM_EDM_MIC_DISABLE, "false"); if (!audioSystemManager->IsMicrophoneMute()) { + system::SetParameter(PARAM_EDM_MIC_DISABLE, "true"); audioSystemManager->SetMicrophoneMute(true); system::SetParameter(PARAM_EDM_MIC_DISABLE, "false"); - audioSystemManager->SetMicrophoneMute(true); audioSystemManager->SetMicrophoneMute(false); - } else { - system::SetParameter(PARAM_EDM_MIC_DISABLE, "false"); } } } -- Gitee