diff --git a/AppScope/app.json b/AppScope/app.json index cb1e2bf9dfc46138544831ba1ad9322296210183..ae2906b83529ad3a2bbe48b5f8aa934c62959585 100644 --- a/AppScope/app.json +++ b/AppScope/app.json @@ -4,8 +4,8 @@ "app": { "bundleName": "com.ohos.permissionmanager", "vendor": "example", - "versionCode": 1000076, - "versionName": "1.7.6", + "versionCode": 1000075, + "versionName": "1.7.5", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 14, diff --git a/AppScope/app.json5 b/AppScope/app.json5 index fb84c462a43e807ffcf8d90dfc61474bb8de3d38..5c5d8f5c1d80594d635b6f03b3571069f4fce69f 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -16,8 +16,8 @@ "app": { "bundleName": "com.ohos.permissionmanager", "vendor": "example", - "versionCode": 1000076, - "versionName": "1.7.6", + "versionCode": 1000075, + "versionName": "1.7.5", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 14, diff --git a/build-profile.json5 b/build-profile.json5 index 399ad9a3785bba0fe922ca9403d3de44c95943f9..bbc94bb2cd8f94de1ef4cf76547109221bcfd263 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -19,9 +19,9 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": 18, - "compatibleSdkVersion": 18, - "targetSdkVersion": 18, + "compileSdkVersion": 16, + "compatibleSdkVersion": 16, + "targetSdkVersion": 16, "runtimeOS": "OpenHarmony" } ] diff --git a/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts b/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts index 1f0f9124a8a7ad3811313bbd0187b0b8ef50a148..bdb8160205e5f5431e81fa115f0f92fbb39c3117 100644 --- a/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts +++ b/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts @@ -68,16 +68,14 @@ export default class SecurityExtensionAbility extends extension { private async createWindow(name: string, windowType, rect, want): Promise { console.info(TAG + 'create securityWindow'); - let dialogSet: Set = GlobalContext.load('dialogSet'); + let dialogSet: Set = GlobalContext.load('dialogSet'); if (!dialogSet) { - dialogSet = new Set(); + dialogSet = new Set(); console.info(TAG + 'new dialogSet'); GlobalContext.store('dialogSet', dialogSet); } let callerToken: number = want.parameters['ohos.caller.uid']; - let windId: number = want.parameters['ohos.ability.params.windowId']; - let token: String = String(callerToken) + '_' + String(windId); - if (dialogSet.has(token)) { + if (dialogSet.has(callerToken)) { console.info(TAG + 'window already exists'); return; } @@ -86,20 +84,15 @@ export default class SecurityExtensionAbility extends extension { let storage: LocalStorage = new LocalStorage({ 'want': want, 'win': win }); await win.bindDialogTarget(want.parameters['ohos.ability.params.token'].value, () => { win.destroyWindow(); - let dialogSet: Set = GlobalContext.load('dialogSet'); + let dialogSet: Set = GlobalContext.load('dialogSet'); let callerToken: number = want.parameters['ohos.caller.uid']; - let windId: number = want.parameters['ohos.ability.params.windowId']; - let token: String = String(callerToken) + '_' + String(windId); - dialogSet.delete(token); + dialogSet.delete(callerToken); GlobalContext.store('dialogSet', dialogSet); if (dialogSet.size === 0) { this.context.terminateSelf(); } }); - try { - await win.setFollowParentWindowLayoutEnabled(true); - } catch(error) { - console.error(TAG + `setFollowParentWindowLayoutEnabled error: ${JSON.stringify(error)}`); + if (deviceInfo.deviceType !== 'wearable') { await win.moveWindowTo(rect.left, rect.top); await win.resize(rect.width, rect.height); }; @@ -107,7 +100,7 @@ export default class SecurityExtensionAbility extends extension { win.setWindowBackgroundColor(BG_COLOR); await win.showWindow(); console.info(TAG + 'showWindow end.'); - dialogSet.add(token); + dialogSet.add(callerToken); GlobalContext.store('dialogSet', dialogSet); } catch (err) { console.error(TAG + `window create failed! err: ${JSON.stringify(err)}`); diff --git a/permissionmanager/src/main/ets/common/utils/globalContext.ts b/permissionmanager/src/main/ets/common/utils/globalContext.ts index c3c9266857cb7e6f2f93c29cc45b360a8f181336..06bcf12aeba3a7381e1ecca6bfdd71a156059fe5 100644 --- a/permissionmanager/src/main/ets/common/utils/globalContext.ts +++ b/permissionmanager/src/main/ets/common/utils/globalContext.ts @@ -20,7 +20,7 @@ export class GlobalContext { bundleName: string; globalState: string; windowNum: number; - dialogSet: Set; + dialogSet: Set; public static getContext(): GlobalContext { if (!GlobalContext.instance) { diff --git a/permissionmanager/src/main/ets/pages/securityDialog.ets b/permissionmanager/src/main/ets/pages/securityDialog.ets index 61abd38fa7c5b51e2745e1d63735344ac3099f90..c8b285855ef08ee3c2ade4688625c5b2d1d26873 100644 --- a/permissionmanager/src/main/ets/pages/securityDialog.ets +++ b/permissionmanager/src/main/ets/pages/securityDialog.ets @@ -263,11 +263,9 @@ struct SecurityDialog { action: () => { this.dialogController?.close(); this.win.destroyWindow(); - let dialogSet: Set = GlobalContext.load('dialogSet'); + let dialogSet: Set = GlobalContext.load('dialogSet'); let callerToken: number = this.want.parameters['ohos.caller.uid']; - let windId: number = this.want.parameters['ohos.ability.params.windowId']; - let token: String = String(callerToken) + '_' + String(windId); - dialogSet.delete(token); + dialogSet.delete(callerToken); GlobalContext.store('dialogSet', dialogSet); if (dialogSet.size === 0) { this.context.terminateSelf(); @@ -287,16 +285,15 @@ struct SecurityDialog { autoCancel: false, cancel: () => { this.win.destroyWindow(); - let dialogSet: Set = GlobalContext.load('dialogSet'); + let dialogSet: Set = GlobalContext.load('dialogSet'); let callerToken: number = this.want.parameters['ohos.caller.uid']; - let windId: number = this.want.parameters['ohos.ability.params.windowId']; - let token: String = String(callerToken) + '_' + String(windId); - dialogSet.delete(token); + dialogSet.delete(callerToken); GlobalContext.store('dialogSet', dialogSet); if (dialogSet.size === 0) { this.context.terminateSelf(); } }, + offset: { dx: 0, dy: 0 - this.want.parameters['ohos.dialog.offset'] + 'px' } }); @Builder @@ -348,11 +345,9 @@ struct SecurityDialog { onCancel() { Log.info('Callback when the first button is clicked'); this.win.destroyWindow(); - let dialogSet: Set = GlobalContext.load('dialogSet'); + let dialogSet: Set = GlobalContext.load('dialogSet'); let callerToken: number = this.want.parameters['ohos.caller.uid']; - let windId: number = this.want.parameters['ohos.ability.params.windowId']; - let token: String = String(callerToken) + '_' + String(windId); - dialogSet.delete(token); + dialogSet.delete(callerToken); GlobalContext.store('dialogSet', dialogSet); if (dialogSet.size === 0) { this.context.terminateSelf(); @@ -423,11 +418,9 @@ struct SecurityDialog { data.reclaim(); reply.reclaim(); this.win.destroyWindow(); - let dialogSet: Set = GlobalContext.load('dialogSet'); + let dialogSet: Set = GlobalContext.load('dialogSet'); let callerToken: number = this.want.parameters['ohos.caller.uid']; - let windId: number = this.want.parameters['ohos.ability.params.windowId']; - let token: String = String(callerToken) + '_' + String(windId); - dialogSet.delete(token); + dialogSet.delete(callerToken); GlobalContext.store('dialogSet', dialogSet); if (dialogSet.size === 0) { this.context.terminateSelf();