diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/config.json b/frameworks/com.ohos.permissionmanager/entry/src/main/config.json index 165e0d3bd16be20696ddac1f4660634cb7ffb98f..fb8fc1e71695110ce8fce76357df0def3d29d0bb 100644 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/config.json +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/config.json @@ -11,10 +11,10 @@ "module": { "package": "com.ohos.permissionmanager", "name": ".MyApplication", - "mainAbility": "com.ohos.permissionmanager.MainAbility", + "mainAbility": ".MainAbility", + "srcPath": "", "deviceType": [ - "phone", - "tablet" + "phone" ], "distro": { "deliveryWithInstall": true, @@ -34,10 +34,14 @@ ] } ], + "orientation": "unspecified", "visible": true, - "name": "com.ohos.permissionmanager.MainAbility", + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", "icon": "$media:icon", - "description": "$string:mainability_description", + "description": "$string:description_mainability", + "formsEnabled": false, "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" @@ -50,9 +54,10 @@ "type": "pageAbility" }, "pages": [ - "pages/index" + "pages/index", + "pages/second" ], - "name": "default", + "name": ".MainAbility", "window": { "designWidth": 720, "autoDesignWidth": false diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/app.ets b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/app.ets similarity index 97% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/app.ets rename to frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/app.ets index 9ae634daa0e52dc81de9365c78bb0df598f4c085..1007addd5895518aa431843702e1c585e1d81bc2 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/app.ets +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/app.ets @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -export default { + + export default { onCreate() { console.info('Application onCreate') }, onDestroy() { console.info('Application onDestroy') }, -} +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/java/com/ohos/permissionmanager/MainAbility.java b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/index.ets similarity index 43% rename from frameworks/com.ohos.permissionmanager/entry/src/main/java/com/ohos/permissionmanager/MainAbility.java rename to frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/index.ets index 4b70570892cb6b0e231a5ac34fde0c91b6683241..a438be437ac49ace945f8423caf1256896724bdf 100644 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/java/com/ohos/permissionmanager/MainAbility.java +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/index.ets @@ -13,19 +13,41 @@ * limitations under the License. */ -package com.ohos.permissionmanager; +import router from '@system.router'; -import ohos.ace.ability.AceAbility; -import ohos.aafwk.content.Intent; - -public class MainAbility extends AceAbility { - @Override - public void onStart(Intent intent) { - super.onStart(intent); - } +async function routePage() { + let options = { + uri: 'pages/second' + } + try { + await router.push(options) + } catch (err) { + console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) + } +} - @Override - public void onStop() { - super.onStop(); +@Entry +@Component +struct Index { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + routePage() + }) } -} + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/default/pages/index.ets b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/second.ets similarity index 68% rename from frameworks/com.ohos.permissionmanager/entry/src/main/ets/default/pages/index.ets rename to frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/second.ets index 5e693e0f5e895263df503b50680b067fc0009436..2a9a10d491c54eabeb71b3387b548efb8098f1ce 100644 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/default/pages/index.ets +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/second.ets @@ -13,16 +13,32 @@ * limitations under the License. */ +import router from '@system.router'; + @Entry @Component -struct Index { +struct Second { + private content: string = "Second Page" + build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') + Text(`${this.content}`) .fontSize(50) .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) } .width('100%') .height('100%') } -} +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/java/com/ohos/permissionmanager/MyApplication.java b/frameworks/com.ohos.permissionmanager/entry/src/main/java/com/ohos/permissionmanager/MyApplication.java deleted file mode 100644 index 6c8f0f649747c73fedd1c7f6f8bbbf4ff7684444..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/java/com/ohos/permissionmanager/MyApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ohos.permissionmanager; - -import ohos.aafwk.ability.AbilityPackage; - -public class MyApplication extends AbilityPackage { - @Override - public void onInitialize() { - super.onInitialize(); - } -} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/element/string.json index bc3df790ef54add880b08cf9dbd43bc45a9137d4..b93f540e29265a34f883a977c442fa85349b94ca 100644 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/element/string.json +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/element/string.json @@ -5,7 +5,7 @@ "value": "entry_MainAbility" }, { - "name": "mainability_description", + "name": "description_mainability", "value": "eTS_Empty Ability" } ] diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/app.ets b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/app.ets deleted file mode 100644 index 03748140d89081db2a38ad1b7076b234a4185bbd..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/app.ets +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onShow() { - console.info('Application onShow') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/i18n/en-US.json b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/i18n/en-US.json deleted file mode 100644 index 55561b83737c3c31d082fbfa11e5fc987a351104..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/i18n/zh-CN.json b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/i18n/zh-CN.json deleted file mode 100644 index cce1af06761a42add0cac1a0567aa3237eda8cb4..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/pages/index/index.ets b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/pages/index/index.ets deleted file mode 100644 index 61dc37aa5443151e25e529cd4e08219670768aaa..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/default/pages/index/index.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend, InstrumentLog} from "deccjsunit/index" -import testsuite from "../../../test/List.test.ets" -import featureAbility from "@ohos.ability.featureAbility" - -@Entry -@Component -struct MyComponent { - aboutToAppear() { - console.info("start run testcase!!!!") - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - const instrumentLog = new InstrumentLog({ - 'id': 'report', 'unity': 'true' - }) - core.addService('expect', expectExtend) - core.addService('report', instrumentLog) - core.init() - core.subscribeEvent('spec', instrumentLog) - core.subscribeEvent('suite', instrumentLog) - core.subscribeEvent('task', instrumentLog) - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - testsuite() - core.execute() - console.info('Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error('Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/test/ExampleJsunit.test.ets b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/test/ExampleJsunit.test.ets deleted file mode 100644 index c76c23ebb2e6db5bd021d5c6366e7fca8bdc1a40..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/test/ExampleJsunit.test.ets +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import app from '@system.app' - -export default function exampleJsunit() { - describe('appInfoTest', function () { - it('app_info_test_001', 0, function () { - var info = app.getInfo() - expect("1.0").assertEqual('1.0') - expect(info.versionCode).assertEqual('3') - }) - }) -} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/test/List.test.ets b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index 23005224d04a66d893c235ae3d8a75d7cb363473..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import exampleJsunit from "../test/ExampleJsunit.test.ets" - -export default function testsuite() { - exampleJsunit() -} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/java/com/ohos/permissionmanager/ExampleOhosTest.java b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/java/com/ohos/permissionmanager/ExampleOhosTest.java deleted file mode 100644 index e0c56a5cd908397fcedaa314224a4d7261152bc6..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/java/com/ohos/permissionmanager/ExampleOhosTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ohos.permissionmanager; - -import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class ExampleOhosTest { - @Test - public void testBundleName() { - final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); - assertEquals("com.ohos.permissionmanager", actualBundleName); - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/resources/base/element/string.json deleted file mode 100644 index 998415d3588045c96c5d9db329c45087769c1d92..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "finalApplication" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/resources/base/media/icon.png b/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/frameworks/com.ohos.permissionmanager/entry/src/ohosTest/resources/base/media/icon.png and /dev/null differ diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json index a4a9a97f0ef67c3b63977a95a086b41cd8388b72..b52bfa79ee54ce8efd71f3069a16b1b74430e478 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json @@ -11,7 +11,8 @@ "module": { "package": "com.ohos.permissionmanager", "name": ".MyApplication", - "mainAbility": "com.ohos.permissionmanager.GrantAbility", + "mainAbility": ".MainAbility", + "srcPath": "", "deviceType": [ "phone" ], @@ -24,21 +25,23 @@ "abilities": [ { "visible": true, - "name": "com.ohos.permissionmanager.MainAbility", - "description": "$string:mainability_description", + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "description": "$string:description_mainability", "label": "$string:permissionmanager_MainAbility", "type": "page", - "launchType": "standard", - "srcPath": "default" + "launchType": "standard" }, { "visible": true, - "name": "com.ohos.permissionmanager.GrantAbility", - "description": "$string:grantability_description", + "srcPath": "GrantAbility", + "name": ".GrantAbility", + "srcLanguage": "ets", + "description": "$string:description_grantability", "label": "$string:permissionmanager_GrantAbility", "type": "page", - "launchType": "standard", - "srcPath": "dynamic" + "launchType": "standard" } ], "js": [ @@ -55,7 +58,7 @@ "pages/application-tertiary", "pages/other-permissions" ], - "name": "default", + "name": ".MainAbility", "window": { "designWidth": 720, "autoDesignWidth": false @@ -69,7 +72,7 @@ "pages": [ "pages/dialogPlus" ], - "name": "dynamic", + "name": ".GrantAbility", "window": { "designWidth": 720, "autoDesignWidth": false @@ -99,4 +102,4 @@ } ] } -} +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/default/app.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/app.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/entry/src/main/ets/default/app.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/app.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/components/dialog.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/components/dialog.ets similarity index 84% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/components/dialog.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/components/dialog.ets index b5d27831965882f840958829b6840cb26a17d142..e467a29d28d8ac38a9dc21666964cdfefac88b4a 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/components/dialog.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/components/dialog.ets @@ -42,14 +42,14 @@ export struct privacyDialog { build() { Column() { - if ((this.initStatus != Constants.INIT_NEED_TO_WAIT) && this.verify(this.reqPerms[this.count])) { + if ((this.initStatus != Constants.INIT_NEED_TO_WAIT) && this.verify()) { Image(this.grantGroups[this.count].icon) .width(Constants.DIALOG_ICON_WIDTH) .height(Constants.DIALOG_ICON_HEIGHT) .margin({ top: Constants.DIALOG_ICON_MARGIN_TOP }) - Text(`${this.count + 1} / ${this.reqPerms.length}`) + Text(`${this.count + 1} / ${this.grantGroups.length}`) .fontSize(Constants.DIALOG_LABEL_FONT_SIZE) .fontColor($r('app.color.secondary_font_color')) .margin({ @@ -108,32 +108,12 @@ export struct privacyDialog { .height(Constants.DIALOG_HEIGHT) .width(Constants.DIALOG_WIDTH) } - async verify(permission) { + verify() { if((this.initStatus == Constants.INIT_NEED_TO_TERMINATED) || (this.count >= this.grantGroups.length)) { this.controller.close() this.aboutToDisappear() return false } - if(this.grantGroups[this.count] == 0) { - this.result[this.count] = -1 - this.count ++ - return false - } - var acManager = abilityAccessCtrl.createAtManager() - var flag = await acManager.getPermissionFlags(this.accessTokenId, permission) - console.log("GrantAbility permission: " + permission + " flag : " + flag) - if(flag == this.userFixedFlag) { - console.log("GrantAbility permission has been fixed:" + permission) - var ret = await acManager.verifyAccessToken(this.accessTokenId, permission) - if (ret == 0) { - this.result[this.count] = 0 - } else { - this.result[this.count] = -1 - } - this.count ++ - return false - } - this.result[this.count] = -1 return true } @@ -162,6 +142,39 @@ export struct privacyDialog { }) } + getgrantGroups() { + var acManager = abilityAccessCtrl.createAtManager() + var num =0 + this.reqPerms.forEach(async (permission, idx) => { + var flag = await acManager.getPermissionFlags(this.accessTokenId, permission) + if(flag == this.userFixedFlag) { + console.log("GrantAbility permission has been fixed:" + permission) + var ret = await acManager.verifyAccessToken(this.accessTokenId, permission) + if(ret == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { + this.result[idx] = abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED; + } + }else { + var group = getPermissionGroup(permission) + if(!group) { + console.log("GrantAbility permission not find:" + permission) + }else { + var exist = this.grantGroups.find(grantGroup => grantGroup.name == group.name) + if(!exist) { + this.grantGroups.push(group) + } + } + } + num ++ + if(num == this.reqPerms.length) { + if(this.grantGroups.length == 0) { + this.initStatus = Constants.INIT_NEED_TO_TERMINATED + }else { + this.initStatus = Constants.INIT_NEED_TO_VERIFY + } + } + }) + } + aboutToAppear() { this.count = 0; this.initStatus = Constants.INIT_NEED_TO_WAIT @@ -180,16 +193,8 @@ export struct privacyDialog { return } console.log("GrantAbility request permission=" + JSON.stringify(this.reqPerms) + ", tokenId = " + this.accessTokenId) - this.reqPerms.forEach(item => { - var group = getPermissionGroup(item) - if(!group) { - this.grantGroups.push(0) - console.log("GrantAbility permission not find:" + item) - }else { - this.grantGroups.push(group) - } - }) - this.initStatus = Constants.INIT_NEED_TO_VERIFY + this.result = new Array(this.reqPerms.length).fill(-1); + this.getgrantGroups(); this.getApplicationName(want.parameters['ohos.aafwk.param.callerUid']) }) } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/model/bundle.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/bundle.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/model/bundle.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/bundle.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/model/permissionGroup.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/permissionGroup.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/model/permissionGroup.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/permissionGroup.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/utils/constant.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/constant.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/utils/constant.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/constant.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/utils/utils.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/utils.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/common/utils/utils.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/utils.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/pages/dialogPlus.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/pages/dialogPlus.ets similarity index 58% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/pages/dialogPlus.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/pages/dialogPlus.ets index bb999651940bc9410fecd81d3ad8e879ed5d2053..e3d020a269e262ac46fc2fdd541e458d581c7f90 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/dynamic/pages/dialogPlus.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/pages/dialogPlus.ets @@ -28,44 +28,32 @@ struct dialogPlusPage { alignment: DialogAlignment.Center }) async privacyAccept(group, accessTokenId, permissionList, userFixedFlag) { - try { - var acManager = abilityAccessCtrl.createAtManager() - var num = 0 - group.permissions.forEach(async permission => { - console.log("GrantAbility grant permission:" + permission) - const result = await acManager.grantUserGrantedPermission(accessTokenId, permission, userFixedFlag) - num ++ - console.log("GrantAbility grant permission result:" + result) - var index = permissionList.indexOf(permission) - if (index == -1) { - console.log("GrantAbility grant permission index err:" + permission) - }else { - if (result == 0) { - this.result[index] = 0 - console.log("GrantAbility grant permission success:" + permission) - } else { - console.log("GrantAbility failed to grant permission:" + permission + " ret:" + result) + var acManager = abilityAccessCtrl.createAtManager() + var num = 0 + group.permissions.forEach(async permission => { + const result = await acManager.grantUserGrantedPermission(accessTokenId, permission, userFixedFlag) + num ++ + console.log("GrantAbility grant permission result:" + result + "permission" + permission) + if (result == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { + permissionList.forEach((req, idx) => { + if(req == permission) { + this.result[idx] = abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED; } - } - if(num == group.permissions.length) { - this.count ++ - } - }) - }catch { - this.count ++ - } + }) + console.log("GrantAbility grant permission success:" + permission) + } else { + console.log("GrantAbility failed to grant permission:" + permission + " ret:" + result) + } + if(num == group.permissions.length) { + this.count ++ + } + }) } async privacyCancel(group, accessTokenId, permissionList, userFixedFlag) { var acManager = abilityAccessCtrl.createAtManager() group.permissions.forEach(async permission => { - console.log("GrantAbility revoke permission:" + permission) const result = await acManager.revokeUserGrantedPermission(accessTokenId, permission, userFixedFlag) - console.log("GrantAbility revoke permission result:" + result) - var index = permissionList.indexOf(permission) - if (index != -1 && result == 0) { - this.result[index] = -1 - console.log("GrantAbility revoke permission:" + permission) - } + console.log("GrantAbility revoke permission result:" + result + "permission" + permission); }) this.count ++ } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/app.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/app.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/app.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/app.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/alphabeticalIndex.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/alphabeticalIndex.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/alphabeticalIndex.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/alphabeticalIndex.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/backBar.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/backBar.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/backBar.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/backBar.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/dialog.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/dialog.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/dialog.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/dialog.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/search.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/search.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/components/search.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/search.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/model/permissionGroup.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/model/permissionGroup.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/model/permissionGroup.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/model/permissionGroup.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/utils/constant.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/constant.ets similarity index 93% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/utils/constant.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/constant.ets index bfcd8362c75ea6b1fa68967a77c6647a0804d01b..4727e4470fd0ebddc6e2b87ec49097d353b688c8 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/utils/constant.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/constant.ets @@ -57,29 +57,30 @@ export default class Constants { static TEXTINPUT_IMAGE_MARGIN_TOP = 12; // grid useSizeType + static GRID_MARGIN = '0vp'; static GUTTER = 0; - static LEFT_XS_SPAN = 1; + static LEFT_XS_SPAN = 0; static LEFT_XS_OFFSET = 0; - static LEFT_SM_SPAN = 1; + static LEFT_SM_SPAN = 0; static LEFT_SM_OFFSET = 0; - static LEFT_MD_SPAN = 1; + static LEFT_MD_SPAN = 0; static LEFT_MD_OFFSET = 0; static LEFT_LG_SPAN = 2; static LEFT_LG_OFFSET = 0; - static MIDDLE_XS_SPAN = 1; - static MIDDLE_XS_OFFSET = 1; - static MIDDLE_SM_SPAN = 2; - static MIDDLE_SM_OFFSET = 1; - static MIDDLE_MD_SPAN = 6; - static MIDDLE_MD_OFFSET = 1; + static MIDDLE_XS_SPAN = 2; + static MIDDLE_XS_OFFSET = 0; + static MIDDLE_SM_SPAN = 4; + static MIDDLE_SM_OFFSET = 0; + static MIDDLE_MD_SPAN = 8; + static MIDDLE_MD_OFFSET = 0; static MIDDLE_LG_SPAN = 8; static MIDDLE_LG_OFFSET = 2; - static RIGHT_XS_SPAN = 1; + static RIGHT_XS_SPAN = 0; static RIGHT_XS_OFFSET = 2; - static RIGHT_SM_SPAN = 1; - static RIGHT_SM_OFFSET = 3; - static RIGHT_MD_SPAN = 1; - static RIGHT_MD_OFFSET = 7; + static RIGHT_SM_SPAN = 0; + static RIGHT_SM_OFFSET = 4; + static RIGHT_MD_SPAN = 0; + static RIGHT_MD_OFFSET = 8; static RIGHT_LG_SPAN = 2; static RIGHT_LG_OFFSET = 10; @@ -170,6 +171,7 @@ export default class Constants { static MANAGEMENT_ROW_PADDING_RIGHT = 12; static MANAGEMENT_ROW_PADDING_TOP = 8; static MANAGEMENT_ROW_MARGIN_TOP = 12; + static MANAGEMENT_TRANSPARENCY = 0.8; static APPLICATION_IMAGE_WIDTH = 40; static APPLICATION_IMAGE_HEIGHT = 40; static APPLICATION_IMAGE_MARGIN_RIGHT = 16; diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/utils/utils.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/utils.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/common/utils/utils.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/utils.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/application-secondary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-secondary.ets similarity index 98% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/application-secondary.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-secondary.ets index 0876bbb9b5fe75dfaeaa5c99dce020d11744047c..2bc4508b8cb347503b3e2298902dd14208581f97 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/application-secondary.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-secondary.ets @@ -177,7 +177,7 @@ struct appNamePlusPage { build() { Column(){ - GridContainer({ gutter: Constants.GUTTER }) { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row({}) { Row() .useSizeType({ @@ -187,7 +187,6 @@ struct appNamePlusPage { lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } }) .height(Constants.FULL_HEIGHT) - .backgroundColor(Color.White) Row() { Column() { Row() { @@ -285,7 +284,6 @@ struct appNamePlusPage { } .width(Constants.FULL_WIDTH) .height(Constants.FULL_HEIGHT) - .backgroundColor($r('app.color.background_color')) } .layoutWeight(Constants.LAYOUT_WEIGHT) } @@ -305,10 +303,12 @@ struct appNamePlusPage { lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } }) .height(Constants.FULL_HEIGHT) - .backgroundColor(Color.White) } .height(Constants.FULL_HEIGHT) - }.backgroundColor(Color.White) + .width(Constants.FULL_WIDTH) + .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .opacity(Constants.MANAGEMENT_TRANSPARENCY) + } } } } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/application-tertiary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-tertiary.ets similarity index 97% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/application-tertiary.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-tertiary.ets index b1d7eab8c1ba415e15e7e88cd60a979788962bd2..8ebddabed4aefa1433c0838c8738a97784a3d422 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/application-tertiary.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-tertiary.ets @@ -73,7 +73,7 @@ class MediaListObj { struct mediaDocumentPage { build() { Column() { - GridContainer({ gutter: Constants.GUTTER }) { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row() { Row() .useSizeType({ @@ -83,7 +83,6 @@ struct mediaDocumentPage { lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } }) .height(Constants.FULL_HEIGHT) - .backgroundColor(Color.White) Row() { Column() { Row() { @@ -116,11 +115,13 @@ struct mediaDocumentPage { lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } }) .height(Constants.FULL_HEIGHT) - .backgroundColor(Color.White) } .height(Constants.FULL_HEIGHT) + .width(Constants.FULL_WIDTH) + .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .opacity(Constants.MANAGEMENT_TRANSPARENCY) } - }.backgroundColor(Color.White) + } } } @@ -379,8 +380,7 @@ struct mediaDocumentItem { }) .width(Constants.FULL_WIDTH) .height(Constants.FULL_HEIGHT) - .backgroundColor($r('app.color.background_color')) } - .backgroundColor($r('app.color.background_color')).width(Constants.FULL_WIDTH) + .width(Constants.FULL_WIDTH) } } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-management.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-management.ets similarity index 98% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-management.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-management.ets index a1ee72c452beb2c62297a19384452d585ab6a078..e1da67e6d73d5a1a229199782bbbeddcb59ef463 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-management.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-management.ets @@ -380,7 +380,7 @@ struct authorityManagementPage { } build() { - GridContainer({ gutter: Constants.GUTTER }) { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row() { Row() .useSizeType({ @@ -423,7 +423,6 @@ struct authorityManagementPage { }) } }.width(Constants.FULL_WIDTH) - .backgroundColor($r('app.color.background_color')) } }.tabBar($r('app.string.authority')) TabContent() { @@ -433,7 +432,6 @@ struct authorityManagementPage { }) }.tabBar($r('app.string.application')) } - .backgroundColor($r('app.color.background_color')) .barWidth(Constants.BAR_WIDTH) .barMode(BarMode.Fixed) }.height(Constants.FULL_HEIGHT) @@ -460,6 +458,9 @@ struct authorityManagementPage { .height(Constants.FULL_HEIGHT) } .height(Constants.FULL_HEIGHT) + .width(Constants.FULL_WIDTH) + .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .opacity(Constants.MANAGEMENT_TRANSPARENCY) } } } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-secondary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-secondary.ets similarity index 96% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-secondary.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-secondary.ets index be6785d47e943d21037f6a891905a365f15008f9..b4c0b477195b1bcb81dd00eb83bac897c6d75678 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-secondary.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-secondary.ets @@ -39,7 +39,7 @@ struct appNamePage { private backTitle = router.getParams().backTitle; // return title name build() { - GridContainer({ gutter: Constants.GUTTER }) { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row() { Row() .useSizeType({ @@ -80,6 +80,9 @@ struct appNamePage { .height(Constants.FULL_HEIGHT) } .height(Constants.FULL_HEIGHT) + .width(Constants.FULL_WIDTH) + .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .opacity(Constants.MANAGEMENT_TRANSPARENCY) } } } @@ -166,7 +169,6 @@ struct appNameItem { } .width(Constants.FULL_WIDTH) .height(Constants.FULL_HEIGHT) - .backgroundColor($r('app.color.background_color')) } } } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-tertiary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary.ets similarity index 98% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-tertiary.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary.ets index f0ef99c12be14ea5c45a15c0be08e47d2433340d..d446a722b3e638b1caaabb97a5c0442f97eeabdc 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/authority-tertiary.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary.ets @@ -59,7 +59,7 @@ class ApplicationObj { @Component struct locationInfoPage { build() { - GridContainer({ gutter: Constants.GUTTER }) { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row() { Row() .useSizeType({ @@ -100,6 +100,9 @@ struct locationInfoPage { .height(Constants.FULL_HEIGHT) } .height(Constants.FULL_HEIGHT) + .width(Constants.FULL_WIDTH) + .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .opacity(Constants.MANAGEMENT_TRANSPARENCY) } } } @@ -288,7 +291,6 @@ struct applicationItem { left: Constants.AUTHORITY_TEXTINPUT_PADDING_LEFT, right: Constants.AUTHORITY_TEXTINPUT_PADDING_RIGHT }) - .backgroundColor($r('app.color.background_color')) Row() { Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) { Column() { @@ -331,7 +333,6 @@ struct applicationItem { } }.width(Constants.FULL_WIDTH) .height(Constants.AUTHORITY_COLUMN_HEIGHT) - .backgroundColor($r('app.color.background_color')) } } }.padding({ left: Constants.AUTHORITY_LISTITEM_PADDING_LEFT }) @@ -341,7 +342,6 @@ struct applicationItem { .padding({ top: Constants.AUTHORITY_ALPHABETINDEX_PADDING_TOP }) } } - .backgroundColor($r('app.color.background_color')) } } } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/other-permissions.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/other-permissions.ets similarity index 95% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/other-permissions.ets rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/other-permissions.ets index 8f29466ade22bdb42a4f0def89eebfa1d766f418..fb9e791a3d7c4123a3280ee117503b379b7e18f7 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/pages/other-permissions.ets +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/other-permissions.ets @@ -34,7 +34,7 @@ for (let i = 0; i < permissions.length; i++) { @Component struct appNamePage { build() { - GridContainer({ gutter: Constants.GUTTER }) { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { Row() { Row() .useSizeType({ @@ -75,6 +75,9 @@ struct appNamePage { .height(Constants.FULL_HEIGHT) } .height(Constants.FULL_HEIGHT) + .width(Constants.FULL_WIDTH) + .backgroundColor($r("sys.color.ohos_id_color_sub_background")) + .opacity(Constants.MANAGEMENT_TRANSPARENCY) } } } @@ -142,7 +145,6 @@ struct appNameItem { } .width(Constants.FULL_WIDTH) .height(Constants.FULL_HEIGHT) - .backgroundColor($r('app.color.background_color')) } } } diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/ar/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/ar/properties/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/ar/properties/string.json rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/ar/properties/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/dark/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/dark/properties/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/dark/properties/string.json rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/dark/properties/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/default/media/icon_actived.png b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_actived.png similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/default/media/icon_actived.png rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_actived.png diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/default/media/icon_normal.png b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_normal.png similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/default/media/icon_normal.png rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_normal.png diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/default/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/properties/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/default/properties/string.json rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/properties/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/en/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/en/properties/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/en/properties/string.json rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/en/properties/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/light/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/light/properties/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/light/properties/string.json rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/light/properties/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/zh/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/zh/properties/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/default/resources/zh/properties/string.json rename to frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/zh/properties/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/java/com/ohos/permissionmanager/MainAbility.java b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/java/com/ohos/permissionmanager/MainAbility.java deleted file mode 100644 index a9467b0bf286aa3aaf299ab6f452cc8aad329a36..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/java/com/ohos/permissionmanager/MainAbility.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ohos.permissionmanager; - -import ohos.ace.ability.AceAbility; -import ohos.aafwk.content.Intent; - -public class MainAbility extends AceAbility { - @Override - public void onStart(Intent intent) { - setInstanceName("main_ability"); - super.onStart(intent); - } - - @Override - public void onStop() { - super.onStop(); - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/java/com/ohos/permissionmanager/MyApplication.java b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/java/com/ohos/permissionmanager/MyApplication.java deleted file mode 100644 index 6c8f0f649747c73fedd1c7f6f8bbbf4ff7684444..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/java/com/ohos/permissionmanager/MyApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ohos.permissionmanager; - -import ohos.aafwk.ability.AbilityPackage; - -public class MyApplication extends AbilityPackage { - @Override - public void onInitialize() { - super.onInitialize(); - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json index db1d293a5cf6fa1503adc4e40c1b2df350c9be59..f505eefa0783e14fc77e248265e4b4ecf2f11a5c 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json +++ b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json @@ -5,7 +5,7 @@ "value": "permissionmanager_MainAbility" }, { - "name": "mainability_description", + "name": "description_mainability", "value": "eTS_Empty Ability" }, { @@ -81,7 +81,7 @@ "value": "系统定位服务开关开启时,已允许19个应用获取此设备的位置。" }, { - "name": "grantability_description", + "name": "description_grantability", "value": "eTS_Empty Ability" }, { diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/app.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/app.ets deleted file mode 100644 index 03748140d89081db2a38ad1b7076b234a4185bbd..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/app.ets +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onShow() { - console.info('Application onShow') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/i18n/en-US.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/i18n/en-US.json deleted file mode 100644 index 55561b83737c3c31d082fbfa11e5fc987a351104..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/i18n/zh-CN.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/i18n/zh-CN.json deleted file mode 100644 index cce1af06761a42add0cac1a0567aa3237eda8cb4..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/pages/index/index.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/pages/index/index.ets deleted file mode 100644 index 61dc37aa5443151e25e529cd4e08219670768aaa..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/default/pages/index/index.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Core, ExpectExtend, InstrumentLog} from "deccjsunit/index" -import testsuite from "../../../test/List.test.ets" -import featureAbility from "@ohos.ability.featureAbility" - -@Entry -@Component -struct MyComponent { - aboutToAppear() { - console.info("start run testcase!!!!") - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - const instrumentLog = new InstrumentLog({ - 'id': 'report', 'unity': 'true' - }) - core.addService('expect', expectExtend) - core.addService('report', instrumentLog) - core.init() - core.subscribeEvent('spec', instrumentLog) - core.subscribeEvent('suite', instrumentLog) - core.subscribeEvent('task', instrumentLog) - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - testsuite() - core.execute() - console.info('Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error('Operation failed. Cause: ' + JSON.stringify(error)); - }) - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/test/ExampleJsunit.test.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/test/ExampleJsunit.test.ets deleted file mode 100644 index c76c23ebb2e6db5bd021d5c6366e7fca8bdc1a40..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/test/ExampleJsunit.test.ets +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" -import app from '@system.app' - -export default function exampleJsunit() { - describe('appInfoTest', function () { - it('app_info_test_001', 0, function () { - var info = app.getInfo() - expect("1.0").assertEqual('1.0') - expect(info.versionCode).assertEqual('3') - }) - }) -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/test/List.test.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/test/List.test.ets deleted file mode 100644 index 23005224d04a66d893c235ae3d8a75d7cb363473..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/ets/test/List.test.ets +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import exampleJsunit from "../test/ExampleJsunit.test.ets" - -export default function testsuite() { - exampleJsunit() -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/java/com/ohos/permissionmanager/ExampleOhosTest.java b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/java/com/ohos/permissionmanager/ExampleOhosTest.java deleted file mode 100644 index e0c56a5cd908397fcedaa314224a4d7261152bc6..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/java/com/ohos/permissionmanager/ExampleOhosTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.ohos.permissionmanager; - -import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class ExampleOhosTest { - @Test - public void testBundleName() { - final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName(); - assertEquals("com.ohos.permissionmanager", actualBundleName); - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/resources/base/element/string.json deleted file mode 100644 index 0ad161e668b74a19e5820d0d5f43d017b6d43173..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "PermissionManager" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/resources/base/media/icon.png b/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/frameworks/com.ohos.permissionmanager/permissionmanager/src/ohosTest/resources/base/media/icon.png and /dev/null differ