相机监听

Signed-off-by: fanchenxuan <fanchenxuan@huawei.com>
This commit is contained in:
fanchenxuan 2023-08-29 18:12:14 +08:00
parent 9808a337a8
commit 49b52708aa
2 changed files with 16 additions and 4 deletions

View File

@ -135,9 +135,20 @@ struct appNamePlusPage {
resourceManager.getString(info.labelId, (error, value) => {
info.label = value;
})
resourceManager.getMediaBase64(info.iconId, (error, value) => {
info.icon = value;
})
try {
let iconDescriptor = resourceManager.getDrawableDescriptor(info.iconId);
info.icon = iconDescriptor?.getPixelMap();
} catch (error) {
console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`);
}
if (!info.icon) {
info.icon = await resourceManager.getMediaContentBase64(info.iconId);
}
if (!info.icon) {
info.icon = $r('app.media.icon');
}
var reqUserPermissions: string[] = [];
var acManager = abilityAccessCtrl.createAtManager();
if (info.permissions.length > 0) {

View File

@ -411,7 +411,8 @@ struct applicationItem {
this.globalIsOn = globalIsOn;
if (globalThis.currentPermissionGroup == "CAMERA") {
let cameraManager = camera.getCameraManager(globalThis.context);
cameraManager.on('cameraMute', curMuted => {
cameraManager.on('cameraMute', (err, curMuted) => {
console.log(TAG + 'curMuted: ' + JSON.stringify(curMuted) + ' err: ' + JSON.stringify(err));
this.globalIsOn = !curMuted;
})
} else {