mirror of
https://github.com/openharmony/applications_permission_manager.git
synced 2026-07-01 20:44:13 -04:00
@@ -33,13 +33,14 @@ export default class GlobalExtensionAbility extends extension {
|
||||
if (!want.parameters) {
|
||||
return;
|
||||
}
|
||||
let resource: string = want.parameters['ohos.sensitive.resource'] as string ?? '';
|
||||
|
||||
if (!globalDialogModel.permissionCheck()) {
|
||||
this.context?.terminateSelf();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!globalDialogModel.statusCheck(this.context, want.parameters['ohos.sensitive.resource'] as string)) {
|
||||
if (!globalDialogModel.statusCheck(this.context, resource)) {
|
||||
this.context?.terminateSelf();
|
||||
return;
|
||||
}
|
||||
@@ -53,7 +54,7 @@ export default class GlobalExtensionAbility extends extension {
|
||||
height: dis.height
|
||||
};
|
||||
Log.info('want: ' + JSON.stringify(want));
|
||||
let property: Record<string, Object> = { 'globalState': want.parameters['ohos.sensitive.resource'] };
|
||||
let property: Record<string, Object> = { 'globalState': resource };
|
||||
let storage: LocalStorage = new LocalStorage(property);
|
||||
globalDialogModel.createWindow(this.context, navigationBarRect, storage).then(window => {
|
||||
globalWindow = window;
|
||||
|
||||
@@ -21,13 +21,14 @@ import { abilityAccessCtrl, bundleManager } from '@kit.AbilityKit';
|
||||
|
||||
const TAG = 'PermissionManager_Log:';
|
||||
const USER_ID = 100;
|
||||
let callerBundleName: string;
|
||||
|
||||
export default class MainAbility extends UIAbility {
|
||||
onCreate(want, launchParam): void {
|
||||
console.log(TAG + 'MainAbility onCreate, ability name is ' + want.abilityName + '.');
|
||||
|
||||
globalThis.bundleName = want.parameters.bundleName;
|
||||
GlobalContext.store('bundleName', want.parameters.bundleName);
|
||||
callerBundleName = want.parameters?.bundleName as string ?? '';
|
||||
GlobalContext.store('bundleName', callerBundleName);
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage): void {
|
||||
@@ -41,9 +42,9 @@ export default class MainAbility extends UIAbility {
|
||||
return;
|
||||
}
|
||||
|
||||
if (globalThis.bundleName) {
|
||||
globalThis.currentApp = globalThis.bundleName;
|
||||
this.getSperifiedApplication(globalThis.bundleName);
|
||||
if (callerBundleName) {
|
||||
globalThis.currentApp = callerBundleName;
|
||||
this.getSperifiedApplication(callerBundleName);
|
||||
} else {
|
||||
globalThis.currentApp = 'all';
|
||||
this.getAllApplications();
|
||||
@@ -79,9 +80,8 @@ export default class MainAbility extends UIAbility {
|
||||
|
||||
onNewWant(want): void {
|
||||
console.log(TAG + 'MainAbility onNewWant. want: ' + JSON.stringify(want));
|
||||
console.log(TAG + 'MainAbility onNewWant. bundleName: ' + JSON.stringify(want.parameters.bundleName));
|
||||
|
||||
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 !== bundleName) {
|
||||
console.log(TAG + 'MainAbility onNewWant. all -> app');
|
||||
|
||||
@@ -55,11 +55,11 @@ export function ReportDialogResult(wantPermissions: Permissions[]) {
|
||||
}
|
||||
|
||||
export function getCallerBundleInfo(want: WantInfo): CallerBundleInfo {
|
||||
let bundleName: string = want.parameters['ohos.aafwk.param.callerBundleName'];
|
||||
let bundleName: string = want.parameters['ohos.aafwk.param.callerBundleName'] ?? '';
|
||||
let uId: number = want.parameters['ohos.aafwk.param.callerUid'] ?? 0;
|
||||
let token: number = want.parameters['ohos.aafwk.param.callerToken'] ?? 0;
|
||||
let permissions: Permissions[] = want.parameters['ohos.user.setting.permission'];
|
||||
let globSwitch: number = want.parameters['ohos.user.setting.global_switch'];
|
||||
let permissions: Permissions[] = want.parameters['ohos.user.setting.permission'] ?? [];
|
||||
let globSwitch: number = want.parameters['ohos.user.setting.global_switch'] ?? -1;
|
||||
|
||||
const callerBundle: CallerBundleInfo = {
|
||||
bundleName: bundleName,
|
||||
|
||||
Reference in New Issue
Block a user