mirror of
https://gitee.com/openharmony/applications_permission_manager
synced 2024-11-23 03:09:41 +00:00
commit
453b357b75
@ -30,6 +30,7 @@ export default class GlobalExtensionAbility extends extension {
|
||||
console.info(TAG + 'want: ' + JSON.stringify(want));
|
||||
|
||||
GlobalContext.store('globalState', want.parameters['ohos.sensitive.resource']);
|
||||
GlobalContext.store('context', this.context);
|
||||
|
||||
try {
|
||||
let dis = display.getDefaultDisplaySync();
|
||||
|
@ -16,6 +16,7 @@
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import bundleManager from '@ohos.bundle.bundleManager';
|
||||
import account_osAccount from '@ohos.account.osAccount';
|
||||
import { GlobalContext } from '../common/utils/globalContext';
|
||||
|
||||
const TAG = 'PermissionManager_MainAbility:';
|
||||
const USER_ID = 100;
|
||||
@ -23,6 +24,8 @@ const USER_ID = 100;
|
||||
export default class MainAbility extends UIAbility {
|
||||
onCreate(want, launchParam): void {
|
||||
console.log(TAG + 'MainAbility onCreate, ability name is ' + want.abilityName + '.');
|
||||
|
||||
GlobalContext.store('context', this.context);
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage): void {
|
||||
|
@ -95,8 +95,7 @@ export struct globalDialog {
|
||||
|
||||
confirm() {
|
||||
if (this.currentGroup === 'CAMERA') {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let cameraManager = camera.getCameraManager(GlobalContext.load('context'));
|
||||
cameraManager.muteCamera(true);
|
||||
if (this.controller !== undefined) {
|
||||
this.controller.close();
|
||||
|
@ -20,7 +20,6 @@ import Constants from '../utils/constant';
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontSize(Constants.TEXT_SMALLER_FONT_SIZE)
|
||||
.height(Constants.LOCATION_BUTTON_HEIGHT)
|
||||
.width(Constants.LOCATION_BUTTON_WIDTH)
|
||||
.borderRadius(Constants.LOCATION_BUTTON_RADIUS)
|
||||
.position({ x: Constants.LOCATION_BUTTON_POSITION_X, y: Constants.LOCATION_BUTTON_POSITION_Y })
|
||||
}
|
||||
|
@ -328,7 +328,6 @@ export default class Constants {
|
||||
static LOCATION_CANVAS_MARGIN_BOTTOM = 8;
|
||||
static LOCATION_CANVAS_INITIAL_SCALE = 1;
|
||||
static LOCATION_CANVAS_ZOOM_SCALE = 1.3;
|
||||
static LOCATION_BUTTON_WIDTH = 120;
|
||||
static LOCATION_BUTTON_HEIGHT = 32;
|
||||
static LOCATION_BUTTON_RADIUS = 16;
|
||||
static LOCATION_BUTTON_POSITION_X = 137.5;
|
||||
|
@ -97,8 +97,7 @@ struct authorityManagementPage {
|
||||
})
|
||||
})
|
||||
} else {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let cameraManager = camera.getCameraManager(GlobalContext.load('context'));
|
||||
let mute = cameraManager.isCameraMuted();
|
||||
GlobalContext.store('isMuteSupported', cameraManager.isCameraMuteSupported());
|
||||
router.pushUrl({
|
||||
|
@ -381,8 +381,7 @@ struct applicationItem {
|
||||
if (globalGroup.indexOf(this.currentGroup) !== -1) {
|
||||
this.globalIsOn = globalIsOn;
|
||||
if (this.currentGroup == "CAMERA") {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let cameraManager = camera.getCameraManager(GlobalContext.load('context'));
|
||||
cameraManager.on('cameraMute', (err, curMuted) => {
|
||||
console.log(TAG + 'curMuted: ' + JSON.stringify(curMuted) + ' err: ' + JSON.stringify(err));
|
||||
this.globalIsOn = !curMuted;
|
||||
@ -427,8 +426,7 @@ struct applicationItem {
|
||||
.onChange((isOn: boolean) => {
|
||||
if (isOn) {
|
||||
if (this.currentGroup == "CAMERA") {
|
||||
let context: any = this.context;
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let cameraManager = camera.getCameraManager(GlobalContext.load('context'));
|
||||
cameraManager.muteCamera(false);
|
||||
} else {
|
||||
let audioManager = audio.getAudioManager();
|
||||
|
@ -122,7 +122,6 @@ struct globalDialog {
|
||||
|
||||
accept() {
|
||||
Log.info('global accept');
|
||||
let context: any = this.context;
|
||||
if (this.globalState == MICROPHONE) {
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
@ -133,11 +132,11 @@ struct globalDialog {
|
||||
})
|
||||
})
|
||||
} else if (this.globalState == CAMERA) {
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let cameraManager = camera.getCameraManager(GlobalContext.load('context'));
|
||||
cameraManager.muteCamera(false);
|
||||
this.context.terminateSelf();
|
||||
} else {
|
||||
let cameraManager = camera.getCameraManager(context);
|
||||
let cameraManager = camera.getCameraManager(GlobalContext.load('context'));
|
||||
cameraManager.muteCamera(false);
|
||||
let audioManager = audio.getAudioManager();
|
||||
let audioVolumeManager = audioManager.getVolumeManager();
|
||||
|
Loading…
Reference in New Issue
Block a user