mirror of
https://gitee.com/openharmony/applications_permission_manager
synced 2024-11-23 11:19:46 +00:00
commit
47399dc183
@ -79,7 +79,7 @@ export default class GlobalExtensionAbility extends extension {
|
|||||||
try {
|
try {
|
||||||
let flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
|
let flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
|
||||||
let bundleInfo = bundleManager.getBundleInfoForSelfSync(flag);
|
let bundleInfo = bundleManager.getBundleInfoForSelfSync(flag);
|
||||||
let atManager =abilityAccessCtrl.createAtManager();
|
let atManager = abilityAccessCtrl.createAtManager();
|
||||||
let status =
|
let status =
|
||||||
atManager.verifyAccessTokenSync(bundleInfo.appInfo.accessTokenId, 'ohos.permission.MICROPHONE_CONTROL');
|
atManager.verifyAccessTokenSync(bundleInfo.appInfo.accessTokenId, 'ohos.permission.MICROPHONE_CONTROL');
|
||||||
if (status === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
if (status === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||||
|
@ -26,11 +26,6 @@ export default class MainAbility extends UIAbility {
|
|||||||
onCreate(want, launchParam): void {
|
onCreate(want, launchParam): void {
|
||||||
console.log(TAG + 'MainAbility onCreate, ability name is ' + want.abilityName + '.');
|
console.log(TAG + 'MainAbility onCreate, ability name is ' + want.abilityName + '.');
|
||||||
|
|
||||||
if (!this.permissionCheck()) {
|
|
||||||
this.context.terminateSelf();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
globalThis.bundleName = want.parameters.bundleName;
|
globalThis.bundleName = want.parameters.bundleName;
|
||||||
GlobalContext.store('bundleName', want.parameters.bundleName);
|
GlobalContext.store('bundleName', want.parameters.bundleName);
|
||||||
GlobalContext.store('context', this.context);
|
GlobalContext.store('context', this.context);
|
||||||
@ -41,6 +36,11 @@ export default class MainAbility extends UIAbility {
|
|||||||
console.log(TAG + 'MainAbility onWindowStageCreate.');
|
console.log(TAG + 'MainAbility onWindowStageCreate.');
|
||||||
globalThis.windowStage = windowStage;
|
globalThis.windowStage = windowStage;
|
||||||
globalThis.refresh = false;
|
globalThis.refresh = false;
|
||||||
|
if (!this.permissionCheck()) {
|
||||||
|
windowStage.loadContent('pages/transition');
|
||||||
|
this.context.terminateSelf();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (globalThis.bundleName) {
|
if (globalThis.bundleName) {
|
||||||
globalThis.currentApp = globalThis.bundleName;
|
globalThis.currentApp = globalThis.bundleName;
|
||||||
@ -82,14 +82,6 @@ export default class MainAbility extends UIAbility {
|
|||||||
console.log(TAG + 'MainAbility onNewWant. want: ' + JSON.stringify(want));
|
console.log(TAG + 'MainAbility onNewWant. want: ' + JSON.stringify(want));
|
||||||
console.log(TAG + 'MainAbility onNewWant. bundleName: ' + JSON.stringify(want.parameters.bundleName));
|
console.log(TAG + 'MainAbility onNewWant. bundleName: ' + JSON.stringify(want.parameters.bundleName));
|
||||||
|
|
||||||
if (!this.permissionCheck()) {
|
|
||||||
this.context.terminateSelf();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (globalThis.currentApp === undefined) {
|
|
||||||
this.context.terminateSelf();
|
|
||||||
}
|
|
||||||
let bundleName = want.parameters.bundleName ? want.parameters.bundleName : 'all';
|
let bundleName = want.parameters.bundleName ? want.parameters.bundleName : 'all';
|
||||||
if (globalThis.currentApp === 'all') {
|
if (globalThis.currentApp === 'all') {
|
||||||
if (globalThis.currentApp !== bundleName) {
|
if (globalThis.currentApp !== bundleName) {
|
||||||
@ -151,7 +143,7 @@ export default class MainAbility extends UIAbility {
|
|||||||
try {
|
try {
|
||||||
let flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
|
let flag = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
|
||||||
let bundleInfo = bundleManager.getBundleInfoForSelfSync(flag);
|
let bundleInfo = bundleManager.getBundleInfoForSelfSync(flag);
|
||||||
let atManager =abilityAccessCtrl.createAtManager();
|
let atManager = abilityAccessCtrl.createAtManager();
|
||||||
let status =
|
let status =
|
||||||
atManager.verifyAccessTokenSync(bundleInfo.appInfo.accessTokenId, 'ohos.permission.GET_INSTALLED_BUNDLE_LIST');
|
atManager.verifyAccessTokenSync(bundleInfo.appInfo.accessTokenId, 'ohos.permission.GET_INSTALLED_BUNDLE_LIST');
|
||||||
if (status === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
if (status === abilityAccessCtrl.GrantStatus.PERMISSION_DENIED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user