From c4e3374858776fdfabf5f8eb8f33770acd2dd277 Mon Sep 17 00:00:00 2001 From: fanchenxuan Date: Fri, 11 Apr 2025 17:46:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fanchenxuan --- .../ets/pages/authority-tertiary-groups.ets | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets b/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets index 85b3701..208861b 100644 --- a/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets +++ b/permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets @@ -525,23 +525,27 @@ struct applicationItem { } globalListen() { - this.globalIsOn = globalIsOn; - if (this.currentGroup == 'CAMERA') { - cameraManager = camera.getCameraManager(this.context); - cameraManager.on('cameraMute', (err, curMuted) => { - Log.info('curMuted: ' + JSON.stringify(curMuted) + ' err: ' + JSON.stringify(err)); - this.globalIsOn = !curMuted; - }) - } else { - let audioManager = audio.getAudioManager(); - let audioVolumeManager = audioManager.getVolumeManager(); - let groupId = audio.DEFAULT_VOLUME_GROUP_ID; - audioVolumeGroupManager = audioVolumeManager.getVolumeGroupManagerSync(groupId); - audioVolumeGroupManager.on('micStateChange', micStateChange => { - let muteState = audioVolumeGroupManager.isPersistentMicMute(); - Log.info('micStateChange: ' + JSON.stringify(muteState)); - this.globalIsOn = !muteState; - }) + try { + this.globalIsOn = globalIsOn; + if (this.currentGroup === 'CAMERA') { + cameraManager = camera.getCameraManager(this.context); + cameraManager.on('cameraMute', (err, curMuted) => { + Log.info('curMuted: ' + curMuted + ' err: ' + JSON.stringify(err)); + this.globalIsOn = !curMuted; + }) + } else { + let audioManager = audio.getAudioManager(); + let audioVolumeManager = audioManager.getVolumeManager(); + let groupId = audio.DEFAULT_VOLUME_GROUP_ID; + audioVolumeGroupManager = audioVolumeManager.getVolumeGroupManagerSync(groupId); + audioVolumeGroupManager.on('micStateChange', micStateChange => { + let muteState = audioVolumeGroupManager.isPersistentMicMute(); + Log.info('micStateChange: ' + muteState); + this.globalIsOn = !muteState; + }) + } + } catch (error) { + Log.error(`Register listening failed, code: ${error.code}, message: ${error.message}.`); } } -- Gitee