diff --git a/frameworks/com.ohos.permissionmanager/.gitignore b/frameworks/com.ohos.permissionmanager/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..39187ebed671ccfd399a7e88520b1075926c058e --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/.gitignore @@ -0,0 +1,4 @@ +/node_modules +/local.properties +/.idea +**/build \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/AppScope/app.json5 b/frameworks/com.ohos.permissionmanager/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..a10a999dd6c31cc2ffe849a1df979faa4387bdc7 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/AppScope/app.json5 @@ -0,0 +1,11 @@ +{ + "app": { + "bundleName": "com.ohos.permissionmanager", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true + } +} diff --git a/frameworks/com.ohos.permissionmanager/AppScope/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4fe2f85945857ee885481b8b8d6750c9caa8ccf3 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "权限管理" + } + ] +} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/icon.png b/frameworks/com.ohos.permissionmanager/AppScope/resources/base/media/app_icon.png similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/icon.png rename to frameworks/com.ohos.permissionmanager/AppScope/resources/base/media/app_icon.png diff --git a/frameworks/com.ohos.permissionmanager/build-profile.json5 b/frameworks/com.ohos.permissionmanager/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..2b4b922c095c5cd140560953e8a6be0e23706e1e --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/build-profile.json5 @@ -0,0 +1,50 @@ +{ + "app": { + "compileSdkVersion": 9, + "compatibleSdkVersion": 9, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "settings", + "srcPath": "./settings", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "grant", + "srcPath": "./grant", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/.gitignore b/frameworks/com.ohos.permissionmanager/entry/.gitignore index 7d5b7a94f4dcf381f03ff21f28f8a2494b58023f..4f9a973815d0b5e49bc8547681a6b4bc7a178d12 100644 --- a/frameworks/com.ohos.permissionmanager/entry/.gitignore +++ b/frameworks/com.ohos.permissionmanager/entry/.gitignore @@ -1,2 +1,3 @@ -/build /node_modules +/.preview +/build \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/build-profile.json5 b/frameworks/com.ohos.permissionmanager/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7dc37bb919dada5132609c409200db266559004f --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/entry/build-profile.json5 @@ -0,0 +1,13 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/build.gradle b/frameworks/com.ohos.permissionmanager/entry/build.gradle deleted file mode 100644 index 05a33cd3adb09a68a581b9f7c02c57d3911630e8..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -apply plugin: 'com.huawei.ohos.hap' -//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 -ohos { - compileSdkVersion 8 - defaultConfig { - compatibleSdkVersion 8 - } - buildTypes { - release { - proguardOpt { - proguardEnabled false - rulesFiles 'proguard-rules.pro' - } - } - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) - testImplementation 'junit:junit:4.13.1' -} diff --git a/frameworks/com.ohos.permissionmanager/entry/hvigorfile.js b/frameworks/com.ohos.permissionmanager/entry/hvigorfile.js new file mode 100644 index 0000000000000000000000000000000000000000..d7720ee6a7aad5c617d1fd2f6fc8c87067bfa32c --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/entry/hvigorfile.js @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks diff --git a/frameworks/com.ohos.permissionmanager/entry/package-lock.json b/frameworks/com.ohos.permissionmanager/entry/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..15bc7145be1490029883067847743ea7134cf545 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/entry/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "entry", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/frameworks/com.ohos.permissionmanager/entry/package.json b/frameworks/com.ohos.permissionmanager/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c7685ac4e7c0d79df04c96744f0d8f22cb4a9025 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/entry/package.json @@ -0,0 +1,14 @@ +{ + "license": "ISC", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": {} +} diff --git a/frameworks/com.ohos.permissionmanager/entry/proguard-rules.pro b/frameworks/com.ohos.permissionmanager/entry/proguard-rules.pro deleted file mode 100644 index f7666e47561d514b2a76d5a7dfbb43ede86da92a..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/proguard-rules.pro +++ /dev/null @@ -1 +0,0 @@ -# config module specific ProGuard rules here. \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/config.json b/frameworks/com.ohos.permissionmanager/entry/src/main/config.json deleted file mode 100644 index c49d18bd78815dd57651dfbce7b749277302697f..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.permissionmanager", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.permissionmanager", - "name": ".MyApplication", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index", - "pages/second" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/app.ets b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/Application/AbilityStage.ts similarity index 75% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/app.ets rename to frameworks/com.ohos.permissionmanager/entry/src/main/ets/Application/AbilityStage.ts index 9ae634daa0e52dc81de9365c78bb0df598f4c085..ef2476eac3c53e8bcba2374518e95b961024e48b 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/app.ets +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/Application/AbilityStage.ts @@ -13,11 +13,10 @@ * limitations under the License. */ -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/build.gradle b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 40% rename from frameworks/com.ohos.permissionmanager/build.gradle rename to frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/MainAbility.ts index 35a87ae70948d9db71ff7c09f7013d942bd6fff2..220392de6eeda736ea34ef95b93e68a58148c878 100644 --- a/frameworks/com.ohos.permissionmanager/build.gradle +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,37 +13,37 @@ * limitations under the License. */ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -apply plugin: 'com.huawei.ohos.app' - -//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 -ohos { - compileSdkVersion 8 - supportSystem "standard" -} - -buildscript { - repositories { - maven { - url 'https://repo.huaweicloud.com/repository/maven/' - } - maven { - url 'https://developer.huawei.com/repo/' - } +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) } - dependencies { - classpath 'com.huawei.ohos:hap:3.0.5.2' - classpath 'com.huawei.ohos:decctest:1.2.7.2' + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") } -} - -allprojects { - repositories { - maven { - url 'https://repo.huaweicloud.com/repository/maven/' - } - maven { - url 'https://developer.huawei.com/repo/' - } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") } -} +}; diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/index.ets b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index a438be437ac49ace945f8423caf1256896724bdf..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,53 +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 router from '@system.router'; - -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}`) - } -} - -@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/permissionmanager/src/main/ets/MainAbility/app.ets b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/pages/index.ets similarity index 69% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/app.ets rename to frameworks/com.ohos.permissionmanager/entry/src/main/ets/pages/index.ets index 9ae634daa0e52dc81de9365c78bb0df598f4c085..f32a5a189a31a6046cb0798ff6b595404522ec5f 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/app.ets +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/ets/pages/index.ets @@ -13,11 +13,20 @@ * limitations under the License. */ -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/module.json5 b/frameworks/com.ohos.permissionmanager/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..083571ffe6bc294331f5eff458220ef0c3758b77 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/module.json5 @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file 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 b93f540e29265a34f883a977c442fa85349b94ca..490210a3908f47722dc942d49dacc98b97669a5f 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 @@ -1,12 +1,16 @@ { "string": [ { - "name": "entry_MainAbility", - "value": "entry_MainAbility" + "name": "entry_desc", + "value": "description" }, { - "name": "description_mainability", - "value": "eTS_Empty Ability" + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" } ] } \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/profile/main_pages.json b/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/frameworks/com.ohos.permissionmanager/gradle.properties b/frameworks/com.ohos.permissionmanager/gradle.properties deleted file mode 100644 index eff9877ed17ce0c7f86eb94a7ee0e56fdddf7002..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/gradle.properties +++ /dev/null @@ -1,28 +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. -# - -# Project-wide Gradle settings. -# IDE (e.g. DevEco Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# If the Chinese output is garbled, please configure the following parameter. -# This function is enabled by default when the DevEco Studio builds the hap/app,if you need disable gradle parallel,you should set org.gradle.parallel false. -# more information see https://docs.gradle.org/current/userguide/performance.html -# org.gradle.parallel=false -# org.gradle.jvmargs=-Dfile.encoding=GBK \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/gradlew b/frameworks/com.ohos.permissionmanager/gradlew deleted file mode 100644 index 29df508644aab8f3c05f6426799cafda051d26a5..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/gradlew +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env sh - -# -# 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. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/frameworks/com.ohos.permissionmanager/gradlew.bat b/frameworks/com.ohos.permissionmanager/gradlew.bat deleted file mode 100644 index 9db1ef2e26e3751925fdf8fb43fa8e532ed90376..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/gradlew.bat +++ /dev/null @@ -1,103 +0,0 @@ -@rem -@rem Copyright (c) 2021-2022 Huawei Device Co., Ltd. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/.gitignore b/frameworks/com.ohos.permissionmanager/grant/.gitignore similarity index 46% rename from frameworks/com.ohos.permissionmanager/permissionmanager/.gitignore rename to frameworks/com.ohos.permissionmanager/grant/.gitignore index 7d5b7a94f4dcf381f03ff21f28f8a2494b58023f..4f9a973815d0b5e49bc8547681a6b4bc7a178d12 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/.gitignore +++ b/frameworks/com.ohos.permissionmanager/grant/.gitignore @@ -1,2 +1,3 @@ -/build /node_modules +/.preview +/build \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/grant/build-profile.json5 b/frameworks/com.ohos.permissionmanager/grant/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7dc37bb919dada5132609c409200db266559004f --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/build-profile.json5 @@ -0,0 +1,13 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/grant/hvigorfile.js b/frameworks/com.ohos.permissionmanager/grant/hvigorfile.js new file mode 100644 index 0000000000000000000000000000000000000000..d7720ee6a7aad5c617d1fd2f6fc8c87067bfa32c --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/hvigorfile.js @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks diff --git a/frameworks/com.ohos.permissionmanager/grant/package-lock.json b/frameworks/com.ohos.permissionmanager/grant/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..af634257bf3cf5c0ebedba056385bf0128ec7623 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "permissionmanager", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/frameworks/com.ohos.permissionmanager/grant/package.json b/frameworks/com.ohos.permissionmanager/grant/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4ec964862d62025f94cc2e9da5ecd933b3ac5375 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/package.json @@ -0,0 +1,13 @@ +{ + "name": "permissionmanager", + "version": "1.0.0", + "ohos": { + "org": "huawei", + "buildTool": "hvigor", + "directoryLevel": "module" + }, + "description": "example description", + "repository": {}, + "license": "ISC", + "dependencies": {} +} diff --git a/frameworks/com.ohos.permissionmanager/settings.gradle b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/Application/AbilityStage.ts similarity index 75% rename from frameworks/com.ohos.permissionmanager/settings.gradle rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/Application/AbilityStage.ts index e34e79a3b30aa13255a0b66b317208107707634a..ef2476eac3c53e8bcba2374518e95b961024e48b 100644 --- a/frameworks/com.ohos.permissionmanager/settings.gradle +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/Application/AbilityStage.ts @@ -13,4 +13,10 @@ * limitations under the License. */ -include ':entry', ':permissionmanager' +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/ets/GrantAbility/GrantAbility.ts b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/GrantAbility/GrantAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..aed924bd879462193b19efbdeb6c15b88d122ce8 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/GrantAbility/GrantAbility.ts @@ -0,0 +1,77 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +var TAG = "PermissionManager_GrantAbility:" + +export default class GrantAbility extends Ability { + onCreate(want, launchParam) { + console.log(TAG + "[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + globalThis.context = this.context; + } + + onDestroy() { + console.log(TAG + "[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log(TAG + "[Demo] MainAbility onWindowStageCreate") + let context = this.context; + + windowStage.getMainWindow().then(win => { + console.log(TAG + "get main window success."); + globalThis.win = win; + }).catch(error => { + console.log(TAG + "get main window failed. Cause: " + JSON.stringify(error)); + }) + + // start extension + var want = { + "bundleName": "com.ohos.permissionmanager", + "abilityName": "ServiceExtAbility" + } + context.startAbility(want).then((data) => { + console.info(TAG + "startAbility success:" + JSON.stringify(data)); + }).catch((error) => { + console.error(TAG + "startAbility fail:" + JSON.stringify(error)) + }) + +// windowStage.setUIContent(this.context, "pages/dialogPlus", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log(TAG + "[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log(TAG + "[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log(TAG + "[Demo] MainAbility onBackground") + + if (globalThis.win) { + let context = globalThis.extensionContext; + + context.terminateSelf(); + } + } +}; diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfc3072781b781c0fdece2e24f8d491d2e5e21c1 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,91 @@ +/* + * 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 Extension from '@ohos.application.ServiceExtension' +import window from '@ohos.window'; +import display from '@ohos.display'; + +var TAG = "PermissionManager_GrantAbility:" + +export default class ServiceExtAbility extends Extension { + onCreate(want) { + console.info(TAG + 'ServiceExtAbility onCreate'); + globalThis.extensionContext = this.context + // get window + let win = globalThis.win; + // load content + let path = "pages/dialogPlus"; +// win.resetSize(500, 500).then(() => { +// console.log(TAG + 'resetSize success') +// }).catch(() => { +// console.log(TAG + 'resetSize fail') +// }) + win.loadContent(path).then(() => { + console.log(TAG + "window loadContent " + path + " success."); + + // show window + win.show().then(() => { + console.log(TAG + "show window success."); + }).catch(error => { + console.error(TAG + "show window failed. Cause: " + JSON.stringify(error)); + }) + }).catch(error => { + console.error(TAG + "window loadContent failed. Cause: " + JSON.stringify(error)); + }) + } + + onRequest(want, startId) { + console.info(TAG + 'ServiceExtAbility onRequest id:' + JSON.stringify(startId)); + + globalThis.startId = startId; + + // get window + let win = globalThis.win; + + if (startId != 1) { + // show window + win.show().then(() => { + console.log(TAG + "show window success."); + }).catch(error => { + console.error(TAG + "show window failed. Cause: " + JSON.stringify(error)); + }) + } + } + + onConnect(want) { + console.info(TAG + 'ServiceExtAbility onConnect'); + return want; + } + + onDisconnect() { + console.info(TAG + 'ServiceExtAbility onDisconnect'); + } + + onDestroy() { + console.info(TAG + 'ServiceExtAbility onDestroy'); + + // get window + let win = globalThis.win; + + // destroy window + win.destroy().then(() => { + console.log(TAG + "destroy window success"); + + globalThis.win = 0; + }).catch(error => { + console.error(TAG + "destroy window failed. Cause: " + JSON.stringify(error)); + }) + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/components/dialog.ets b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/components/dialog.ets similarity index 84% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/components/dialog.ets rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/components/dialog.ets index c0fc08c7521ac77c44c931347326874ba21522fb..6c8d673c09041faf0838961deaa8ab37cea2c391 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/components/dialog.ets +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/components/dialog.ets @@ -13,9 +13,9 @@ * limitations under the License. */ -import { getPermissionGroup } from '../utils/utils.ets' -import { BundleFlag, USER_ID } from '../model/bundle.ets' -import Constants from '../utils/constant.ets' +import { getPermissionGroup } from '../utils/utils' +import { BundleFlag, USER_ID } from '../model/bundle' +import Constants from '../utils/constant' import featureAbility from '@ohos.ability.featureAbility' import abilityAccessCtrl from '@ohos.abilityAccessCtrl' import bundle from '@ohos.bundle' @@ -125,6 +125,7 @@ export struct privacyDialog { if((this.initStatus == Constants.INIT_NEED_TO_TERMINATED) || (this.count >= this.grantGroups.length)) { this.controller.close() this.answerRequest() + globalThis.extensionContext.terminateSelf() this.initStatus = Constants.INIT_NEED_TO_WAIT return false } @@ -136,7 +137,7 @@ export struct privacyDialog { console.log(TAG + "getApplicationName bundleName:" + data) console.log(TAG + "getApplicationName userId:" + Math.floor(uid/200000)) bundle.getApplicationInfo(data, BundleFlag.GET_BUNDLE_DEFAULT, Math.floor(uid/200000)).then(applicationInfo => { - Resmgr.getResourceManager(data).then(item => { + Resmgr.getResourceManager(globalThis.context, data).then(item => { item.getString(applicationInfo.labelId, (err, value) => { if (value == undefined) { this.appName = applicationInfo.label @@ -186,7 +187,7 @@ export struct privacyDialog { this.result.forEach(result => { results.push(result) }) - featureAbility.terminateSelfWithResult({ + globalThis.context.terminateSelfWithResult({ resultCode: ret, want: { parameters: { @@ -201,25 +202,18 @@ export struct privacyDialog { this.count = 0; this.initStatus = Constants.INIT_NEED_TO_WAIT this.result = [] - featureAbility.getWant((err, want) => { - if (err.code != 0) { - console.log(TAG + "featureAbility.getWant err:" + err) - this.initStatus = Constants.INIT_NEED_TO_TERMINATED - return - } - this.reqPerms = want.parameters['ohos.user.grant.permission'] - this.accessTokenId = want.parameters['ohos.aafwk.param.callerToken'] - if (this.reqPerms == undefined || this.accessTokenId == undefined || this.reqPerms.length == 0) { - console.log(TAG + "invalid parameters") - this.initStatus = Constants.INIT_NEED_TO_TERMINATED - return - } - console.log(TAG + "request permission=" + JSON.stringify(this.reqPerms) + ", tokenId = " + this.accessTokenId) - console.log(TAG + "permission state=" + JSON.stringify(want.parameters['ohos.user.grant.permission.state'])); - this.result = new Array(this.reqPerms.length).fill(-1); - this.getgrantGroups(want.parameters['ohos.user.grant.permission.state']); - this.getApplicationName(want.parameters['ohos.aafwk.param.callerUid']) - }) + this.reqPerms = globalThis.abilityWant.parameters['ohos.user.grant.permission'] + this.accessTokenId = globalThis.abilityWant.parameters['ohos.aafwk.param.callerToken'] + if (this.reqPerms == undefined || this.accessTokenId == undefined || this.reqPerms.length == 0) { + console.log(TAG + "invalid parameters") + this.initStatus = Constants.INIT_NEED_TO_TERMINATED + return + } + console.log(TAG + "request permission=" + JSON.stringify(this.reqPerms) + ", tokenId = " + this.accessTokenId) + console.log(TAG + "permission state=" + JSON.stringify(globalThis.abilityWant.parameters['ohos.user.grant.permission.state'])); + this.result = new Array(this.reqPerms.length).fill(-1); + this.getgrantGroups(globalThis.abilityWant.parameters['ohos.user.grant.permission.state']); + this.getApplicationName(globalThis.abilityWant.parameters['ohos.aafwk.param.callerUid']) } aboutToDisappear() { diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/bundle.ets b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/model/bundle.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/bundle.ets rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/model/bundle.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/permissionGroup.ets b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/model/permissionGroup.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/model/permissionGroup.ets rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/model/permissionGroup.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/constant.ets b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/utils/constant.ets similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/constant.ets rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/utils/constant.ets diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/utils.ets b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/utils/utils.ets similarity index 99% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/utils.ets rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/utils/utils.ets index 4d289e9d902fa5cc358657479605a5871eacb98a..3db94e30f94e66b8c93d6f67a01306db1c4a4511 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/common/utils/utils.ets +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/common/utils/utils.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { permissionGroups, groups } from "../model/permissionGroup.ets" +import { permissionGroups, groups } from "../model/permissionGroup" export function getPermissionGroup(permission: string) { for (var i = 0; i < permissionGroups.length; i++) { diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/pages/dialogPlus.ets b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/pages/dialogPlus.ets similarity index 93% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/pages/dialogPlus.ets rename to frameworks/com.ohos.permissionmanager/grant/src/main/ets/pages/dialogPlus.ets index 64cd5506085ed1b5d942dea09c0059e72e59ce2e..1f825b5930dd02771c48fc2db5c5497d58172ef5 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/GrantAbility/pages/dialogPlus.ets +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/ets/pages/dialogPlus.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { privacyDialog } from "../common/components/dialog.ets" +import { privacyDialog } from "../common/components/dialog" import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; var TAG = "PermissionManager_GrantAbility:" @@ -26,7 +26,7 @@ struct dialogPlusPage { privacyDialogController: CustomDialogController = new CustomDialogController({ builder: privacyDialog({ cancel: this.privacyCancel, confirm: this.privacyAccept, count:$count, result: $result }), cancel: this.privacyExist, - autoCancel: true, + autoCancel: false, alignment: DialogAlignment.Center }) async privacyAccept(group, accessTokenId, permissionList, userFixedFlag) { @@ -63,9 +63,11 @@ struct dialogPlusPage { console.info(TAG + "exist") } aboutToAppear() { + console.log(TAG + "dialogPlus appear") this.privacyDialogController.open() } build() { + Column() {}.backgroundColor('#000000') } } diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/module.json5 b/frameworks/com.ohos.permissionmanager/grant/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e974a65ab05ea52808d1df645ba9fa7fd6a4c899 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/module.json5 @@ -0,0 +1,53 @@ +{ + "module": { + "name": "grant", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "mainElement": "GrantAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.ohos.permissionmanager.GrantAbility", + "srcEntrance": "./ets/GrantAbility/GrantAbility.ts", + "description": "$string:description_grantability", + "icon": "$media:icon", + "label": "$string:permissionmanager_GrantAbility", + "visible": true, + "launchType": "standard", + } + ], + "extensionAbilities": [ + { + "icon": "$media:icon", + "name": "ServiceExtAbility", + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "type": "service", + "visible": true + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_SENSITIVE_PERMISSIONS", + }, + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + }, + { + "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO", + } + ] + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/color.json b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/element/color.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/color.json rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/element/color.json diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fad9426989ca48fa5a0635bcb71edc6f77ae117d --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/element/string.json @@ -0,0 +1,64 @@ +{ + "string": [ + { + "name": "permissionmanager_MainAbility", + "value": "authority management" + }, + { + "name": "description_mainability", + "value": "authority management" + }, + { + "name": "permissionmanager_GrantAbility", + "value": "apply for permission" + }, + { + "name": "no_permission", + "value": "no permission" + }, + { + "name": "no_data", + "value": "no data" + }, + { + "name": "authority_management", + "value": "authority management" + }, + { + "name": "other_permissions", + "value": "other permissions" + }, + { + "name": "application", + "value": "application" + }, + { + "name": "authority", + "value": "authority" + }, + { + "name": "media_document", + "value": "Media and documents" + }, + { + "name": "textInput_placeholder", + "value": "search application" + }, + { + "name": "allowed", + "value": "allowed" + }, + { + "name": "banned", + "value": "banned" + }, + { + "name": "description_grantability", + "value": "apply for permission" + }, + { + "name": "Authorization_failed", + "value": "Authorization failure!" + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_call_logs.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_call_logs.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_call_logs.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_call_logs.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_dropzone.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_dropzone.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_dropzone.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_dropzone.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_exercise.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_exercise.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_exercise.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_exercise.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_forward.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_forward.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_forward.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_forward.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_more.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_more.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_more.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_more.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_multi_device_vector.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_multi_device_vector.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_multi_device_vector.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_multi_device_vector.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_nearby.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_nearby.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_nearby.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_nearby.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_calendar.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_calendar.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_calendar.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_calendar.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_camera.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_camera.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_camera.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_camera.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_contacts_group.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_contacts_group.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_contacts_group.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_contacts_group.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_folder.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_folder.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_folder.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_folder.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_gps.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_gps.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_gps.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_gps.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_message.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_message.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_message.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_message.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_phone.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_phone.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_phone.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_phone.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_voice.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_voice.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_public_voice.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_public_voice.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_sport.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_sport.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_sport.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_sport.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_ssensor.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_ssensor.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/ic_ssensor.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/ic_ssensor.svg diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/icon.png b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/icon.png differ diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/in_app_installations.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/in_app_installations.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/in_app_installations.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/in_app_installations.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/left.png b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/left.png similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/left.png rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/left.png diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/loading.gif b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/loading.gif similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/loading.gif rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/loading.gif diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/noinstallationpackage.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/noinstallationpackage.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/noinstallationpackage.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/noinstallationpackage.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/nopermission.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/nopermission.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/nopermission.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/nopermission.svg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/radioactive.jpg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/radioactive.jpg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/radioactive.jpg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/radioactive.jpg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/radiodefault.jpg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/radiodefault.jpg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/radiodefault.jpg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/radiodefault.jpg diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/rightarrow.png b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/rightarrow.png similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/rightarrow.png rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/rightarrow.png diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/search.png b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/search.png similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/search.png rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/search.png diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/searchnoresult.svg b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/searchnoresult.svg similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/media/searchnoresult.svg rename to frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/media/searchnoresult.svg diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/profile/main_pages.json b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..29aaa87eccbacdf46cacd3ddb5c1f2528d8f0249 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/dialogPlus" + ] +} diff --git a/frameworks/com.ohos.permissionmanager/grant/src/main/resources/zh_CN/element/string.json b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7f36560f0ec6e60f35273296fb79b046533b74c7 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/grant/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,64 @@ +{ + "string": [ + { + "name": "permissionmanager_MainAbility", + "value": "权限管理" + }, + { + "name": "description_mainability", + "value": "权限管理" + }, + { + "name": "permissionmanager_GrantAbility", + "value": "权限申请" + }, + { + "name": "no_permission", + "value": "暂无权限" + }, + { + "name": "no_data", + "value": "暂无数据" + }, + { + "name": "authority_management", + "value": "权限管理" + }, + { + "name": "other_permissions", + "value": "其它权限" + }, + { + "name": "application", + "value": "应用" + }, + { + "name": "authority", + "value": "权限" + }, + { + "name": "media_document", + "value": "媒体和文件" + }, + { + "name": "textInput_placeholder", + "value": "搜索应用" + }, + { + "name": "allowed", + "value": "已允许" + }, + { + "name": "banned", + "value": "已禁止" + }, + { + "name": "description_grantability", + "value": "权限申请" + }, + { + "name": "Authorization_failed", + "value": "授权失败!" + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/hvigorfile.js b/frameworks/com.ohos.permissionmanager/hvigorfile.js new file mode 100644 index 0000000000000000000000000000000000000000..5f2735e3deeaf655828407544bbed9365c258278 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/hvigorfile.js @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').appTasks \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/package-lock.json b/frameworks/com.ohos.permissionmanager/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..638b410244d9b7d9adc2c752d9b8741c2149fbab --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/package-lock.json @@ -0,0 +1,1643 @@ +{ + "name": "permissionmanager", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@ohos/hvigor": { + "version": "1.0.6", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor/-/@ohos/hvigor-1.0.6.tgz", + "integrity": "sha512-jjp7vpvUOMW1Nf7TdyhOtonwWHoSyBJLUiZTQqIx/GJV4UJyIqsiURUOqFwncQ4L7PDdeHuWly4uEelknYeWhg==", + "requires": { + "@ohos/hvigor-base": "1.0.6", + "interpret": "1.4.0", + "liftoff": "4.0.0", + "mute-stdout": "1.0.0", + "pretty-hrtime": "1.0.0", + "v8flags": "3.2.0", + "yargs": "7.1.0" + } + }, + "@ohos/hvigor-base": { + "version": "1.0.6", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-base/-/@ohos/hvigor-base-1.0.6.tgz", + "integrity": "sha512-cRDnWICTxmpNiFb9clIioqP5Oik1seLCICztXVhZqultrHuxwTheCRUZrHwlpyWdkSB2Al+FFBqmSwzIgZX4IQ==", + "requires": { + "json5": "2.2.0", + "log4js": "6.4.1", + "undertaker": "1.2.1" + } + }, + "@ohos/hvigor-ohos-plugin": { + "version": "1.0.6", + "resolved": "https://repo.harmonyos.com/npm/@ohos/hvigor-ohos-plugin/-/@ohos/hvigor-ohos-plugin-1.0.6.tgz", + "integrity": "sha512-MAAi8uJxMzODUoSSNfBr+fU4HQ20dfQtkje9I+X4asc7qY2kAplW/q9f5XS8IOvv8zhC8OcSgsAXOAJuLMstOQ==", + "requires": { + "@ohos/hvigor-base": "1.0.6", + "@ohos/sdkmanager-common": "1.1.3", + "ajv": "8.10.0", + "archiver": "5.3.0", + "execa": "5.1.1", + "fs-extra": "10.0.0", + "glob": "7.2.0", + "iconv-lite": "0.6.3", + "json5": "2.2.0", + "lodash": "4.17.21", + "pretty-hrtime": "1.0.3", + "resolve-package-path": "4.0.3" + }, + "dependencies": { + "fs-extra": { + "version": "10.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=" + } + } + }, + "@ohos/sdkmanager-common": { + "version": "1.1.3", + "resolved": "https://repo.harmonyos.com/npm/@ohos/sdkmanager-common/-/@ohos/sdkmanager-common-1.1.3.tgz", + "integrity": "sha512-d2uhVauDDJZIUvyyaWWoavG4N/jLyfF5IH5kEXKV6R8HNf3606H1zDQzA+UZtOfwwJFXhD9djRjnVFNB8xc7aw==" + }, + "ajv": { + "version": "8.10.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ajv/-/ajv-8.10.0.tgz", + "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "archiver": { + "version": "5.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/archiver/-/archiver-5.3.0.tgz", + "integrity": "sha512-iUw+oDwK0fgNpvveEsdQ0Ase6IIKztBJU2U0E9MzszMfmVVUyv1QJhS2ITW9ZCqx8dktAxVAjWWkKehuZE8OPg==", + "requires": { + "archiver-utils": "^2.1.0", + "async": "^3.2.0", + "buffer-crc32": "^0.2.1", + "readable-stream": "^3.6.0", + "readdir-glob": "^1.0.0", + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" + } + }, + "archiver-utils": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/archiver-utils/-/archiver-utils-2.1.0.tgz", + "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", + "requires": { + "glob": "^7.1.4", + "graceful-fs": "^4.2.0", + "lazystream": "^1.0.0", + "lodash.defaults": "^4.2.0", + "lodash.difference": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.isplainobject": "^4.0.6", + "lodash.union": "^4.6.0", + "normalize-path": "^3.0.0", + "readable-stream": "^2.0.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, + "arr-filter": { + "version": "1.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/arr-filter/-/arr-filter-1.1.2.tgz", + "integrity": "sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4=", + "requires": { + "make-iterator": "^1.0.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" + }, + "arr-map": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/arr-map/-/arr-map-2.0.2.tgz", + "integrity": "sha1-Onc0X/wc814qkYJWAfnljy4kysQ=", + "requires": { + "make-iterator": "^1.0.0" + } + }, + "array-each": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=" + }, + "array-initial": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-initial/-/array-initial-1.1.0.tgz", + "integrity": "sha1-L6dLJnOTccOUe9enrcc74zSz15U=", + "requires": { + "array-slice": "^1.0.0", + "is-number": "^4.0.0" + } + }, + "array-last": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-last/-/array-last-1.3.0.tgz", + "integrity": "sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg==", + "requires": { + "is-number": "^4.0.0" + } + }, + "array-slice": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==" + }, + "async": { + "version": "3.2.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" + }, + "async-done": { + "version": "1.3.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/async-done/-/async-done-1.3.2.tgz", + "integrity": "sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.2", + "process-nextick-args": "^2.0.0", + "stream-exhaust": "^1.0.1" + } + }, + "async-settle": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/async-settle/-/async-settle-1.0.0.tgz", + "integrity": "sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs=", + "requires": { + "async-done": "^1.2.2" + } + }, + "bach": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/bach/-/bach-1.2.0.tgz", + "integrity": "sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA=", + "requires": { + "arr-filter": "^1.1.1", + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "array-each": "^1.0.0", + "array-initial": "^1.0.0", + "array-last": "^1.1.1", + "async-done": "^1.2.2", + "async-settle": "^1.0.0", + "now-and-later": "^2.0.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bl": { + "version": "4.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://repo.huaweicloud.com/repository/npm/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "camelcase": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "collection-map": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/collection-map/-/collection-map-1.0.0.tgz", + "integrity": "sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw=", + "requires": { + "arr-map": "^2.0.2", + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "compress-commons": { + "version": "4.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/compress-commons/-/compress-commons-4.1.1.tgz", + "integrity": "sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ==", + "requires": { + "buffer-crc32": "^0.2.13", + "crc32-stream": "^4.0.2", + "normalize-path": "^3.0.0", + "readable-stream": "^3.6.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "crc-32": { + "version": "1.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==" + }, + "crc32-stream": { + "version": "4.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/crc32-stream/-/crc32-stream-4.0.2.tgz", + "integrity": "sha512-DxFZ/Hk473b/muq1VJ///PMNLj0ZMnzye9thBpmjpJKCc5eMgB95aK8zCGrGfQ90cWo561Te6HK9D+j4KPdM6w==", + "requires": { + "crc-32": "^1.2.0", + "readable-stream": "^3.4.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dependencies": { + "which": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "d": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "date-format": { + "version": "4.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/date-format/-/date-format-4.0.6.tgz", + "integrity": "sha512-B9vvg5rHuQ8cbUXE/RMWMyX2YA5TecT3jKF5fLtGNlzPlU7zblSPmAm2OImDbWL+LDOQ6pUm+4LOFz+ywS41Zw==" + }, + "debug": { + "version": "4.3.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "default-resolution": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/default-resolution/-/default-resolution-2.0.0.tgz", + "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=" + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "requires": { + "object-keys": "^1.0.12" + } + }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es5-ext": { + "version": "0.10.59", + "resolved": "https://repo.huaweicloud.com/repository/npm/es5-ext/-/es5-ext-0.10.59.tgz", + "integrity": "sha512-cOgyhW0tIJyQY1Kfw6Kr0viu9ZlUctVchRMZ7R0HiH3dxTSp5zJDLecwxUqPUrGKMsgBI1wd1FL+d9Jxfi4cLw==", + "requires": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "es6-weak-map": { + "version": "2.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/es6-weak-map/-/es6-weak-map-2.0.3.tgz", + "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "requires": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "execa": { + "version": "5.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "ext": { + "version": "1.6.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/ext/-/ext-1.6.0.tgz", + "integrity": "sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg==", + "requires": { + "type": "^2.5.0" + }, + "dependencies": { + "type": { + "version": "2.6.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/type/-/type-2.6.0.tgz", + "integrity": "sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "findup-sync": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/findup-sync/-/findup-sync-5.0.0.tgz", + "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.3", + "micromatch": "^4.0.4", + "resolve-dir": "^1.0.1" + } + }, + "fined": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fined/-/fined-2.0.0.tgz", + "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", + "requires": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^5.0.0", + "object.defaults": "^1.1.0", + "object.pick": "^1.3.0", + "parse-filepath": "^1.0.2" + } + }, + "flagged-respawn": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/flagged-respawn/-/flagged-respawn-2.0.0.tgz", + "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==" + }, + "flatted": { + "version": "3.2.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==" + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=" + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "requires": { + "for-in": "^1.0.1" + } + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "10.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs-extra/-/fs-extra-10.0.1.tgz", + "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==" + }, + "glob": { + "version": "7.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "global-modules": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + } + }, + "graceful-fs": { + "version": "4.2.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/graceful-fs/-/graceful-fs-4.2.9.tgz", + "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + }, + "has": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "homedir-polyfill": { + "version": "1.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", + "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://repo.huaweicloud.com/repository/npm/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" + }, + "hypium": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/hypium/-/hypium-1.0.0.tgz", + "integrity": "sha512-nl+RQVv2AU/5FvFRhsXyWO5wh+2huhdqRZ3bszBWZzW+kpNI3AT4ydvVRYIfaQbYwV4UlX/rSc7BtFjLAezhow==" + }, + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.8", + "resolved": "https://repo.huaweicloud.com/repository/npm/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "json5": { + "version": "2.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, + "last-run": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/last-run/-/last-run-1.1.1.tgz", + "integrity": "sha1-RblpQsF7HHnHchmCWbqUO+v4yls=", + "requires": { + "default-resolution": "^2.0.0", + "es6-weak-map": "^2.0.1" + } + }, + "lazystream": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "requires": { + "readable-stream": "^2.0.5" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + } + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "requires": { + "invert-kv": "^1.0.0" + } + }, + "liftoff": { + "version": "4.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/liftoff/-/liftoff-4.0.0.tgz", + "integrity": "sha512-rMGwYF8q7g2XhG2ulBmmJgWv25qBsqRbDn5gH0+wnuyeFt7QBJlHJmtg5qEdn4pN6WVAUMgXnIxytMFRX9c1aA==", + "requires": { + "extend": "^3.0.2", + "findup-sync": "^5.0.0", + "fined": "^2.0.0", + "flagged-respawn": "^2.0.0", + "is-plain-object": "^5.0.0", + "object.map": "^1.0.1", + "rechoir": "^0.8.0", + "resolve": "^1.20.0" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.difference": { + "version": "4.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.difference/-/lodash.difference-4.5.0.tgz", + "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.union": { + "version": "4.6.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/lodash.union/-/lodash.union-4.6.0.tgz", + "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" + }, + "log4js": { + "version": "6.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/log4js/-/log4js-6.4.1.tgz", + "integrity": "sha512-iUiYnXqAmNKiIZ1XSAitQ4TmNs8CdZYTAWINARF3LjnsLN8tY5m0vRwd6uuWj/yNY0YHxeZodnbmxKFUOM2rMg==", + "requires": { + "date-format": "^4.0.3", + "debug": "^4.3.3", + "flatted": "^3.2.4", + "rfdc": "^1.3.0", + "streamroller": "^3.0.2" + } + }, + "make-iterator": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "requires": { + "kind-of": "^6.0.2" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://repo.huaweicloud.com/repository/npm/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "mute-stdout": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/mute-stdout/-/mute-stdout-1.0.0.tgz", + "integrity": "sha1-WzLqB+tDyd7WEwQ0z5JvRrKn/U0=" + }, + "next-tick": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "now-and-later": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/now-and-later/-/now-and-later-2.0.1.tgz", + "integrity": "sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ==", + "requires": { + "once": "^1.3.2" + } + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.defaults": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", + "requires": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "object.map": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, + "object.reduce": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/object.reduce/-/object.reduce-1.0.1.tgz", + "integrity": "sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60=", + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "requires": { + "lcid": "^1.0.0" + } + }, + "parse-filepath": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", + "requires": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "path-root": { + "version": "0.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", + "requires": { + "path-root-regex": "^0.1.0" + } + }, + "path-root-regex": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=" + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "pretty-hrtime": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/pretty-hrtime/-/pretty-hrtime-1.0.0.tgz", + "integrity": "sha1-9ualItPmBwRSK/Db5oVu0g515Nw=" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readdir-glob": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/readdir-glob/-/readdir-glob-1.1.1.tgz", + "integrity": "sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA==", + "requires": { + "minimatch": "^3.0.4" + } + }, + "rechoir": { + "version": "0.8.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "requires": { + "resolve": "^1.20.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" + }, + "resolve": { + "version": "1.22.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } + }, + "resolve-package-path": { + "version": "4.0.3", + "resolved": "https://repo.huaweicloud.com/repository/npm/resolve-package-path/-/resolve-package-path-4.0.3.tgz", + "integrity": "sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==", + "requires": { + "path-root": "^0.1.1" + } + }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://repo.huaweicloud.com/repository/npm/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==" + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.11", + "resolved": "https://repo.huaweicloud.com/repository/npm/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", + "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==" + }, + "stream-exhaust": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/stream-exhaust/-/stream-exhaust-1.0.2.tgz", + "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==" + }, + "streamroller": { + "version": "3.0.6", + "resolved": "https://repo.huaweicloud.com/repository/npm/streamroller/-/streamroller-3.0.6.tgz", + "integrity": "sha512-Qz32plKq/MZywYyhEatxyYc8vs994Gz0Hu2MSYXXLD233UyPeIeRBZARIIGwFer4Mdb8r3Y2UqKkgyDghM6QCg==", + "requires": { + "date-format": "^4.0.6", + "debug": "^4.3.4", + "fs-extra": "^10.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "tar-stream": { + "version": "2.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + }, + "dependencies": { + "is-number": { + "version": "7.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + } + } + }, + "type": { + "version": "1.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" + }, + "undertaker": { + "version": "1.2.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/undertaker/-/undertaker-1.2.1.tgz", + "integrity": "sha512-71WxIzDkgYk9ZS+spIB8iZXchFhAdEo2YU8xYqBYJ39DIUIqziK78ftm26eecoIY49X0J2MLhG4hr18Yp6/CMA==", + "requires": { + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "bach": "^1.0.0", + "collection-map": "^1.0.0", + "es6-weak-map": "^2.0.1", + "last-run": "^1.1.0", + "object.defaults": "^1.0.0", + "object.reduce": "^1.0.0", + "undertaker-registry": "^1.0.0" + } + }, + "undertaker-registry": { + "version": "1.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/undertaker-registry/-/undertaker-registry-1.0.1.tgz", + "integrity": "sha1-XkvaMI5KiirlhPm5pDWaSZglzFA=" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "v8flags": { + "version": "3.2.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://repo.huaweicloud.com/repository/npm/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=" + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "y18n": { + "version": "3.2.2", + "resolved": "https://repo.huaweicloud.com/repository/npm/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==" + }, + "yargs": { + "version": "7.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" + } + }, + "yargs-parser": { + "version": "5.0.1", + "resolved": "https://repo.huaweicloud.com/repository/npm/yargs-parser/-/yargs-parser-5.0.1.tgz", + "integrity": "sha512-wpav5XYiddjXxirPoCTUPbqM0PXvJ9hiBMvuJgInvo4/lAOTZzUprArw17q2O1P2+GHhbBr18/iQwjL5Z9BqfA==", + "requires": { + "camelcase": "^3.0.0", + "object.assign": "^4.1.0" + } + }, + "zip-stream": { + "version": "4.1.0", + "resolved": "https://repo.huaweicloud.com/repository/npm/zip-stream/-/zip-stream-4.1.0.tgz", + "integrity": "sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==", + "requires": { + "archiver-utils": "^2.1.0", + "compress-commons": "^4.1.0", + "readable-stream": "^3.6.0" + } + } + } +} diff --git a/frameworks/com.ohos.permissionmanager/package.json b/frameworks/com.ohos.permissionmanager/package.json index 0967ef424bce6791893e9a57bb952f80fd536e93..eff7afc86f02b7523b2a155f4c5c8198841011dd 100644 --- a/frameworks/com.ohos.permissionmanager/package.json +++ b/frameworks/com.ohos.permissionmanager/package.json @@ -1 +1,18 @@ -{} +{ + "license":"ISC", + "devDependencies":{}, + "name":"permissionmanager", + "ohos":{ + "org":"huawei", + "directoryLevel":"project", + "buildTool":"hvigor" + }, + "description":"example description", + "repository":{}, + "version":"1.0.0", + "dependencies":{ + "@ohos/hvigor-ohos-plugin":"1.0.6", + "hypium":"^1.0.0", + "@ohos/hvigor":"1.0.6" + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/build.gradle b/frameworks/com.ohos.permissionmanager/permissionmanager/build.gradle deleted file mode 100644 index a59c134a17b1365325deba092e56593d49a0fe27..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -apply plugin: 'com.huawei.ohos.hap' -//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510 -ohos { - compileSdkVersion 8 - defaultConfig { - compatibleSdkVersion 8 - } - buildTypes { - release { - proguardOpt { - proguardEnabled false - rulesFiles 'proguard-rules.pro' - } - } - } - entryModules "entry" -} - -dependencies { - entryImplementation project(':entry') - implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) - testImplementation 'junit:junit:4.13.1' -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/proguard-rules.pro b/frameworks/com.ohos.permissionmanager/permissionmanager/proguard-rules.pro deleted file mode 100644 index f7666e47561d514b2a76d5a7dfbb43ede86da92a..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/proguard-rules.pro +++ /dev/null @@ -1 +0,0 @@ -# config module specific ProGuard rules here. \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json deleted file mode 100644 index 673178473c6654a145158d24159182784b62ad8b..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/config.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.permissionmanager", - "vendor": "ohos", - "version": { - "code": 1, - "name": "1.0.0" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.permissionmanager", - "name": ".MyApplication", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "permissionmanager", - "moduleType": "feature", - "installationFree": false - }, - "abilities": [ - { - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "description": "$string:description_mainability", - "label": "$string:permissionmanager_MainAbility", - "type": "page", - "launchType": "singleton" - }, - { - "visible": true, - "srcPath": "GrantAbility", - "name": ".GrantAbility", - "srcLanguage": "ets", - "description": "$string:description_grantability", - "label": "$string:permissionmanager_GrantAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/authority-management", - "pages/application-secondary", - "pages/application-tertiary", - "pages/authority-secondary", - "pages/authority-tertiary", - "pages/authority-tertiary-groups", - "pages/other-permissions" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/dialogPlus" - ], - "name": ".GrantAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.GET_SENSITIVE_PERMISSIONS", - "reason": "get sensitive permissions" - }, - { - "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", - "reason": "grant sensitive permissions" - }, - { - "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", - "reason": "revoke sensitive permissions" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "get applicationInfo" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "get applicationInfo" - } - ] - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/model/permissionGroup.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/model/permissionGroup.ets deleted file mode 100644 index 2aa04d62c75c748769658ebaa11e1b5c4e0bd616..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/model/permissionGroup.ets +++ /dev/null @@ -1,451 +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 const permissionGroups: any[] = [ - { - "permissionName": "ohos.permission.LOCATION_IN_BACKGROUND", - "groupName": "LOCATION", - "label": "后台定位权限", - "description": "允许应用在后台运行时获取位置信息。", - "groupId": 0 - }, - { - "permissionName": "ohos.permission.LOCATION", - "groupName": "LOCATION", - "label": "前台定位权限", - "description": "允许应用在前台运行时获取位置信息。", - "groupId": 0 - }, - { - "permissionName": "ohos.permission.CAMERA", - "groupName": "CAMERA", - "label": "拍摄照片和录制视频", - "description": "允许应用拍摄照片和视频。", - "groupId": 1 - }, - { - "permissionName": "ohos.permission.MICROPHONE", - "groupName": "MICROPHONE", - "label": "录制音频", - "description": "允许应用打开或关闭录音通路。", - "groupId": 2 - }, - { - "permissionName": "ohos.permission.ANSWER_CALL", - "groupName": "PHONE", - "label": "接听电话", - "description": "允许应用接听电话。", - "groupId": 3 - }, - { - "permissionName": "ohos.permission.MANAGE_VOICEMAIL", - "groupName": "PHONE", - "label": "语音信箱", - "description": "允许应用管理语音信箱。", - "groupId": 3 - }, - { - "permissionName": "ohos.permission.READ_CELL_MESSAGES", - "groupName": "SMS", - "label": "读取小区广播", - "description": "允许应用读取设备接收的小区广播信息。", - "groupId": 4 - }, - { - "permissionName": "ohos.permission.READ_MESSAGES", - "groupName": "SMS", - "label": "读取短彩信", - "description": "允许应用读取设备接收的短彩信信息。", - "groupId": 4 - }, - { - "permissionName": "ohos.permission.RECEIVE_MMS", - "groupName": "SMS", - "label": "接收彩信", - "description": "允许应用接收彩信。", - "groupId": 4 - }, - { - "permissionName": "ohos.permission.RECEIVE_SMS", - "groupName": "SMS", - "label": "接收短信", - "description": "允许应用接收短信。", - "groupId": 4 - }, - { - "permissionName": "ohos.permission.RECEIVE_WAP_MESSAGES", - "groupName": "SMS", - "label": "接收WAP消息", - "description": "允许应用接收和处理WAP消息。", - "groupId": 4 - }, - { - "permissionName": "ohos.permission.SEND_MESSAGES", - "groupName": "SMS", - "label": "发送短彩信", - "description": "允许应用发送短彩信", - "groupId": 4 - }, - { - "permissionName": "ohos.permission.READ_CONTACTS", - "groupName": "CONTACTS", - "label": "读取通讯录", - "description": "允许应用读取设备上存储的联系人信息。", - "groupId": 5 - }, - { - "permissionName": "ohos.permission.WRITE_CONTACTS", - "groupName": "CONTACTS", - "label": "新建/修改/删除通讯录", - "description": "允许应用新建/修改/删除设备上存储的联系人信息。", - "groupId": 5 - }, - { - "permissionName": "ohos.permission.READ_CALL_LOG", - "groupName": "CALL_LOG", - "label": "读取通话记录", - "description": "允许应用读取设备上的通话记录信息。", - "groupId": 6 - }, - { - "permissionName": "ohos.permission.WRITE_CALL_LOG", - "groupName": "CALL_LOG", - "label": "新建/修改/删除通话记录", - "description": "允许新建/修改/删除设备上的通话记录信息。", - "groupId": 6 - }, - { - "permissionName": "ohos.permission.MEDIA_LOCATION", - "groupName": "MEDIA", - "label": "允许应用访问拍摄位置", - "description": "应用访问用户媒体文件中的拍摄位置信息如经纬度信息。", - "groupId": 7 - }, - { - "permissionName": "ohos.permission.READ_MEDIA", - "groupName": "MEDIA", - "label": "允许应用读取媒体文件", - "description": "允许应用访问户媒体文件,如视频、音频、图片等。", - "groupId": 7 - }, - { - "permissionName": "ohos.permission.WRITE_MEDIA", - "groupName": "MEDIA", - "label": "允许应用读写媒体文件", - "description": "允许应用读写户媒体文件,如视频、音频、图片等。", - "groupId": 7 - }, - { - "permissionName": "ohos.permission.READ_CALENDAR", - "groupName": "CALENDAR", - "label": "读取日历", - "description": "允许应用读取日历。", - "groupId": 8 - }, - { - "permissionName": "ohos.permission.WRITE_CALENDAR", - "groupName": "CALENDAR", - "label": "修建/修改/删除日历", - "description": "允许应用修建/修改/删除日历。", - "groupId": 8 - }, - { - "permissionName": "ohos.permission.ACTIVITY_MOTION", - "groupName": "SPORT", - "label": "读取用户的运动状态", - "description": "允许应用程序读取用户的运动状态。", - "groupId": 9 - }, - { - "permissionName": "ohos.permission.READ_HEALTH_DATA", - "groupName": "HEALTH", - "label": "读取用户的健康数据", - "description": "允许应用程序读取用户的健康数据。", - "groupId": 10 - }, - { - "permissionName": "ohos.permission.DISTRIBUTED_DATASYNC", - "groupName": "OTHER", - "label": "多设备协同", - "description": "发现并访问其他设备。", - "groupId": 11 - } -]; - -export const groups: any[] = [ - { - "name": "LOCATION", - "groupName": "位置信息", - "icon": $r('app.media.ic_public_gps'), - "description": "访问您的位置信息", - "permissions": [ - "ohos.permission.LOCATION_IN_BACKGROUND", - "ohos.permission.LOCATION" - ], - "isShow":true - }, - { - "name": "CAMERA", - "groupName": "相机", - "icon": $r('app.media.ic_public_camera'), - "description": "访问您的相机", - "permissions": [ - "ohos.permission.CAMERA" - ], - "isShow":true - }, - { - "name": "MICROPHONE", - "groupName": "麦克风", - "icon": $r('app.media.ic_public_voice'), - "description": "访问您的麦克风", - "permissions": [ - "ohos.permission.MICROPHONE" - ], - "isShow":true - }, - { - "name": "PHONE", - "groupName": "电话", - "icon": $r('app.media.ic_public_phone'), - "description": "拨打电话和管理通话", - "permissions": [ - "ohos.permission.ANSWER_CALL", - "ohos.permission.MANAGE_VOICEMAIL" - ], - "isShow":false - }, - { - "name": "SMS", - "groupName": "信息", - "icon": $r('app.media.ic_public_message'), - "description": "发送和查看短信", - "permissions": [ - "ohos.permission.READ_CELL_MESSAGES", - "ohos.permission.READ_MESSAGES", - "ohos.permission.RECEIVE_MMS", - "ohos.permission.RECEIVE_SMS", - "ohos.permission.RECEIVE_WAP_MESSAGES", - "ohos.permission.SEND_MESSAGES" - ], - "isShow":false - }, - { - "name": "CONTACTS", - "groupName": "通讯录", - "icon": $r('app.media.ic_public_contacts_group'), - "description": "访问您的通讯录", - "permissions": [ - "ohos.permission.READ_CONTACTS", - "ohos.permission.WRITE_CONTACTS" - ], - "isShow":false - }, - { - "name": "CALL_LOG", - "groupName": "通话记录", - "icon": $r('app.media.ic_call_logs'), - "description": "读取和写入手机通话记录", - "permissions": [ - "ohos.permission.READ_CALL_LOG", - "ohos.permission.WRITE_CALL_LOG" - ], - "isShow":false - }, - { - "name": "MEDIA", - "groupName": "媒体和文件", - "icon": $r('app.media.ic_public_folder'), - "description": "访问您的媒体和文件", - "permissions": [ - "ohos.permission.MEDIA_LOCATION", - "ohos.permission.READ_MEDIA", - "ohos.permission.WRITE_MEDIA" - ], - "isShow":true - }, - { - "name": "CALENDAR", - "groupName": "日历", - "icon": $r('app.media.ic_public_calendar'), - "description": "访问日历和活动", - "permissions": [ - "ohos.permission.READ_CALENDAR", - "ohos.permission.WRITE_CALENDAR" - ], - "isShow":true - }, - { - "name": "SPORT", - "groupName": "健身运动", - "icon": $r('app.media.ic_sport'), - "description": "访问您的运动状态", - "permissions": [ - "ohos.permission.ACTIVITY_MOTION" - ], - "isShow":true - }, - { - "name": "HEALTH", - "groupName": "身体传感器", - "icon": $r('app.media.ic_ssensor'), - "description": "访问您的健康数据", - "permissions": [ - "ohos.permission.READ_HEALTH_DATA" - ], - "isShow":true - }, - { - "name": "OTHER", - "groupName": "其他权限", - "icon": $r('app.media.ic_more'), - "description": "访问您的其它权限", - "permissions": [ - "ohos.permission.DISTRIBUTED_DATASYNC" - ], - "isShow":false - } -]; - -export const permissionGroupPermissions: object = { - "LOCATION": ["ohos.permission.LOCATION_IN_BACKGROUND","ohos.permission.LOCATION"], - "CAMERA": ["ohos.permission.CAMERA"], - "MICROPHONE": ["ohos.permission.MICROPHONE"], - "PHONE": ["ohos.permission.ANSWER_CALL","ohos.permission.MANAGE_VOICEMAIL"], - "SMS": ["ohos.permission.READ_CELL_MESSAGES", "ohos.permission.READ_MESSAGES", "ohos.permission.RECEIVE_MMS", "ohos.permission.RECEIVE_SMS", "ohos.permission.RECEIVE_WAP_MESSAGES", "ohos.permission.SEND_MESSAGES"], - "CONTACTS": ["ohos.permission.READ_CONTACTS", "ohos.permission.WRITE_CONTACTS"], - "CALL_LOG": ["ohos.permission.READ_CALL_LOG", "ohos.permission.WRITE_CALL_LOG"], - "MEDIA": ["ohos.permission.MEDIA_LOCATION", "ohos.permission.READ_MEDIA", "ohos.permission.WRITE_MEDIA"], - "CALENDAR": ["ohos.permission.READ_CALENDAR", "ohos.permission.WRITE_CALENDAR"], - "SPORT": ["ohos.permission.ACTIVITY_MOTION"], - "HEALTH": ["ohos.permission.READ_HEALTH_DATA"], - "OTHER": ["ohos.permission.DISTRIBUTED_DATASYNC"] -}; - - -export const userGrantPermissions: string[] = [ - "ohos.permission.LOCATION_IN_BACKGROUND", - "ohos.permission.LOCATION", - "ohos.permission.CAMERA", - "ohos.permission.MICROPHONE", - "ohos.permission.ANSWER_CALL", - "ohos.permission.MANAGE_VOICEMAIL", - "ohos.permission.READ_CELL_MESSAGES", - "ohos.permission.READ_MESSAGES", - "ohos.permission.RECEIVE_MMS", - "ohos.permission.RECEIVE_SMS", - "ohos.permission.RECEIVE_WAP_MESSAGES", - "ohos.permission.SEND_MESSAGES", - "ohos.permission.READ_CONTACTS", - "ohos.permission.WRITE_CONTACTS", - "ohos.permission.READ_CALL_LOG", - "ohos.permission.WRITE_CALL_LOG", - "ohos.permission.MEDIA_LOCATION", - "ohos.permission.READ_MEDIA", - "ohos.permission.WRITE_MEDIA", - "ohos.permission.READ_CALENDAR", - "ohos.permission.WRITE_CALENDAR", - "ohos.permission.ACTIVITY_MOTION", - "ohos.permission.READ_HEALTH_DATA", - "ohos.permission.DISTRIBUTED_DATASYNC" -]; - -export const permissionDescriptions: object = { - "位置信息": "允许应用在后台运行时获取位置信息。" , - "相机": "允许应用拍摄照片和视频。" , - "麦克风": "允许应用打开或关闭录音通路。" , - "电话": "允许应用接听电话。" , - "信息": "允许应用发送短彩信。" , - "通讯录": "允许应用新建/修改/删除设备上存储的联系人信息。" , - "通话记录": "允许新建/修改/删除设备上的通话记录信息。" , - "媒体和文件": "允许应用访问户媒体文件,如视频、音频、图片等。" , - "日历": "允许应用修建/修改/删除日历。" , - "健身运动": "允许应用程序读取用户的运动状态。" , - "身体传感器": "允许应用程序读取用户的健康数据。" , - "其他权限": "允许应用与远程设备交换用户数据(如图片、音乐、视频、及应用数据等)。" -}; - -export const permissionPermissionGroup: object = { - "ohos.permission.LOCATION_IN_BACKGROUND": "LOCATION", - "ohos.permission.LOCATION": "LOCATION", - "ohos.permission.CAMERA": "CAMERA", - "ohos.permission.MICROPHONE": "MICROPHONE", - "ohos.permission.ANSWER_CALL": "PHONE", - "ohos.permission.MANAGE_VOICEMAIL": "PHONE", - "ohos.permission.READ_CELL_MESSAGES": "SMS", - "ohos.permission.READ_MESSAGES": "SMS", - "ohos.permission.RECEIVE_MMS": "SMS", - "ohos.permission.RECEIVE_SMS": "SMS", - "ohos.permission.RECEIVE_WAP_MESSAGES": "SMS", - "ohos.permission.SEND_MESSAGES": "SMS", - "ohos.permission.READ_CONTACTS": "CONTACTS", - "ohos.permission.WRITE_CONTACTS": "CONTACTS", - "ohos.permission.READ_CALL_LOG": "CALL_LOG", - "ohos.permission.WRITE_CALL_LOG": "CALL_LOG", - "ohos.permission.MEDIA_LOCATION": "MEDIA", - "ohos.permission.READ_MEDIA": "MEDIA", - "ohos.permission.WRITE_MEDIA": "MEDIA", - "ohos.permission.READ_CALENDAR": "CALENDAR", - "ohos.permission.WRITE_CALENDAR": "CALENDAR", - "ohos.permission.ACTIVITY_MOTION": "SPORT", - "ohos.permission.READ_HEALTH_DATA": "HEALTH", - "ohos.permission.DISTRIBUTED_DATASYNC": "OTHER" -}; - -export const permissionGroupIds: object = { - "ohos.permission.LOCATION_IN_BACKGROUND": "0", - "ohos.permission.LOCATION": "0", - "ohos.permission.CAMERA": "1", - "ohos.permission.MICROPHONE": "2", - "ohos.permission.ANSWER_CALL": "3", - "ohos.permission.MANAGE_VOICEMAIL": "3", - "ohos.permission.READ_CELL_MESSAGES": "4", - "ohos.permission.READ_MESSAGES": "4", - "ohos.permission.RECEIVE_MMS": "4", - "ohos.permission.RECEIVE_SMS": "4", - "ohos.permission.RECEIVE_WAP_MESSAGES": "4", - "ohos.permission.SEND_MESSAGES": "4", - "ohos.permission.READ_CONTACTS": "5", - "ohos.permission.WRITE_CONTACTS": "5", - "ohos.permission.READ_CALL_LOG": "6", - "ohos.permission.WRITE_CALL_LOG": "6", - "ohos.permission.MEDIA_LOCATION": "7", - "ohos.permission.READ_MEDIA": "7", - "ohos.permission.WRITE_MEDIA": "7", - "ohos.permission.READ_CALENDAR": "8", - "ohos.permission.WRITE_CALENDAR": "8", - "ohos.permission.ACTIVITY_MOTION": "9", - "ohos.permission.READ_HEALTH_DATA": "10", - "ohos.permission.DISTRIBUTED_DATASYNC": "11" -}; - -export const orderGroup: string[] = [ - "位置信息", - "相机", - "麦克风", - "电话", - "信息", - "通讯录", - "通话记录", - "媒体和文件", - "日历", - "健身运动", - "身体传感器", - "其他权限" -]; - -export const otherPermissionsLabel: object = { - "ohos.permission.DISTRIBUTED_DATASYNC": "多设备协同" -}; \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/constant.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/constant.ets deleted file mode 100644 index cd7dceeae73242a74934a446960e789ad704c817..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/constant.ets +++ /dev/null @@ -1,225 +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 class Constants { - // alphabetIndexer - static ALPHABETINDEXER_SELECTEDFONT_SIZE = 12; - static ALPHABETINDEXER_POPUPFONT_SIZE = 30; - static ALPHABETINDEXER_ITEMSIZE = 16; - static ALPHABETINDEXER_HEIGHT = 448; - static ALPHABETINDEXER_WIDTH = 36; - - // backBar - static BACKBAR_HEIGHT = 56; - static BACKBAR_MINHEIGHT = 56; - - // image of backBar - static BACKBAR_IMAGE_HEIGHT = 24; - static BACKBAR_IMAGE_WIDTH = 24; - static BACKBAR_IMAGE_MARGIN_TOP = 17; - static BACKBAR_IMAGE_MARGIN_LEFT = 12; - static BACKBAR_IMAGE_MARGIN_RIGHT = 15; - - // text of backBar - static BACKBAR_TEXT_FONT_SIZE = 20; - static BACKBAR_TEXT_FLEX_GROW = 1; - static BACKBAR_TEXT_MARGIN_TOP = 17; - - // dialog - static DIALOG_BORDER_RADIUS = 24; - static DIALOG_HEIGHT = 70; - static DIALOG_WIDTH = 336; - - // text of dialog - static DIALOG_TEXT_FONT_SIZE = 20; - static DIALOG_TEXT_MARGIN_TOP = 25; - - // search textInput - static TEXTINPUT_PADDING_LEFT = 36; - static TEXTINPUT_BORDER_RADIUS = 20; - static TEXTINPUT_PLACEHOLDER_Font_SIZE = 16; - static TEXTINPUT_HEIGHT = 40; - static TEXTINPUT_IMAGE_WIDTH = 16; - static TEXTINPUT_IMAGE_HEIGHT = 16; - static TEXTINPUT_IMAGE_MARGIN_LEFT = -300; - static TEXTINPUT_IMAGE_MARGIN_TOP = 12; - - // grid useSizeType - static GRID_MARGIN = '0vp'; - static GUTTER = 0; - static LEFT_XS_SPAN = 0; - static LEFT_XS_OFFSET = 0; - static LEFT_SM_SPAN = 0; - static LEFT_SM_OFFSET = 0; - static LEFT_MD_SPAN = 0; - static LEFT_MD_OFFSET = 0; - static LEFT_LG_SPAN = 2; - static LEFT_LG_OFFSET = 0; - 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 = 0; - static RIGHT_XS_OFFSET = 2; - 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; - - // 100% width,height - static FULL_WIDTH = '100%'; - static FULL_HEIGHT = '100%'; - - // public property style - static LAYOUT_WEIGHT = 1; - static FLEX_GROW = 1; - static TEXT_DECORATION_HEIGHT = 2; - static TEXT_MIDDLE_FONT_SIZE = 16; - static TEXT_SMAL_FONT_SIZE = 14; - static TEXT_SMALLER_FONT_SIZE = 12; - static CONSTRAINTSIZE_MINHEIGHT = 48; - static LISTITEM_ROW_HEIGHT = 48; - static LISTITEM_PADDING_LEFT = 24; - static LIST_PADDING_LEFT = 12 - static LISTITEM_PADDING_RIGHT = 12; - static IMAGE_HEIGHT = 24; - static IMAGE_WIDTH = 12; - static BORDER_RADIUS = 24; - - // application-secondary, authority-secondary - static FLEX_MARGIN_TOP = 8; - static FLEX_MARGIN_BOTTOM = 8; - static LIST_PADDING_TOP = 4; - static LIST_PADDING_BOTTOM = 4; - static ROW_MARGIN_TOP = 9; - static SECONDARY_TEXT_MARGIN_TOP = 19.5; - static SECONDARY_TEXT_MARGIN_LEFT = 48; - static SECONDARY_LIST_PADDING_LEFT = 12; - static SECONDARY_LIST_PADDING_RIGHT = 12; - - // application-tertiary - static TERTIARY_IMAGE_WIDTH = 64; - static TERTIARY_IMAGE_HEIGHT = 64; - static TERTIARY_IMAGE_MARGIN_LEFT = 12; - static TERTIARY_IMAGE_MARGIN_RIGHT = 12; - static TERTIARY_HALF_WIDTH = '50%'; - static TERTIARY_ROW_MARGIN_TOP = 24; - static TERTIARY_PERMISSION_ROW_MARGIN_TOP = 12; - static TERTIARY_RADIO_IMAGE_WIDTH = 24; - static TERTIARY_RADIO_IMAGE_HEIGHT = 24; - static TERTIARY_RADIO_IMAGE_MARGIN_TOP = 4; - static TERTIARY_LISTITEM_PADDING_LEFT = 24; - static TERTIARY_LISTITEM_PADDING_RIGHT = 24; - static TERTIARY_LISTITEM_MARGIN_TOP = 1; - static TERTIARY_LIST_PADDING_LEFT = 12; - static TERTIARY_LIST_PADDING_RIGHT = 12; - static TERTIARY_LIST_PADDING_TOP = 3; - static TERTIARY_LIST_PADDING_BOTTOM = 4; - - // authority-tertiary - static AUTHORITY_IMAGE_WIDTH = 40; - static AUTHORITY_IMAGE_HEIGHT = 40; - static AUTHORITY_IMAGE_MARGIN_RIGHT = 16; - static AUTHORITY_TOGGLE_WIDTH = 36; - static AUTHORITY_TOGGLE_HEIGHT = 20; - static AUTHORITY_ROW_HEIGHT = 72; - static AUTHORITY_CONSTRAINTSIZE_MINHEIGHT = 72; - static AUTHORITY_LISTITEM_PADDING_LEFT = 12; - static AUTHORITY_LISTITEM_PADDING_RIGHT = 12; - static AUTHORITY_TEXTINPUT_PADDING_LEFT = 12; - static AUTHORITY_TEXTINPUT_PADDING_RIGHT = 4; - static AUTHORITY_TEXT_MARGIN_TOP = 24; - static AUTHORITY_TEXT_MARGIN_LEFT = 0; - static AUTHORITY_ROW_MARGIN_TOP = 24; - static SEARCHNORESULT_IMAGE_WIDTH = 200; - static SEARCHNORESULT_IMAGE_HEIGHT = 200; - static AUTHORITY_COLUMN_HEIGHT = '95%'; - static AUTHORITY_ALPHABETINDEX_WIDTH = 24; - static AUTHORITY_ALPHABETINDEX_PADDING_TOP = 16; - static AUTHORITY_TEXT_DECORATION_WIDTH = '86%'; - static AUTHORITY_TEXT_DECORATION_MARGIN_LEFT = 53; - - // authority-management - static MANAGEMENT_IMAGE_WIDTH = 24; - static MANAGEMENT_IMAGE_HEIGHT = 24; - static MANAGEMENT_IMAGE_MARGIN_RIGHT = 16; - static MANAGEMENT_ROW_HEIGHT = 56; - static MANAGEMENT_TEXT_DECORATION_WIDTH = '90%'; - static MANAGEMENT_TEXT_DECORATION_MARGIN_LEFT = 40; - static MANAGEMENT_LODING_IMAGE_WIDTH = 48; - static MANAGEMENT_LODING_IMAGE_HEIGHT = 48; - static MANAGEMENT_LODING_ROW_HEIGHT = '90%'; - static MANAGEMENT_ROW_PADDING_LEFT = 12; - 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; - static APPLICATION_TEXT_MARGIN_RIGHT = 4; - static APPLICATION_LIST_PADDING_LEFT = 12; - static APPLICATION_LISTITEM_PADDING_LEFT = 12; - static APPLICATION_LISTITEM_PADDING_RIGHT = 12; - static APPLICATION_TEXTINPUT_PADDING_LEFT = 12; - static APPLICATION_TEXTINPUT_PADDING_TOP = 8; - static APPLICATION_TEXTINPUT_PADDING_RIGHT = 4; - static APPLICATION_COLUMN_HEIGHT = '93%'; - static APPLICATION_ALPHABETINDEX_MARGIN_TOP = 12; - static APPLICATION_ALPHABETINDEX_WIDTH = 24; - static APPLICATION_TEXT_DECORATION_WIDTH = '83%'; - static APPLICATION_TEXT_DECORATION_MARGIN_LEFT = 68; - - // slice - static SLICE_START = 0; - static SLICE_END = -1; - static SLICE_START_INDEX = 0; - static SLICE_END_INDEX = 1; - - // tabBar - static BAR_WIDTH = 250; - - // setTimeout - static DELAY_TIME = 1000; - static DELAY_TIME_MAX = 2000; - - // radio - static RADIO_ALLOW_NAME = '允许'; - static RADIO_ALLOW_INDEX = 0; - static RADIO_ALLOW_GROUP_NAME = 'radio'; - static RADIO_BAN_NAME = '禁止'; - static RADIO_BAN_INDEX = 1; - static RADIO_BAN_GROUP_NAME = 'radio'; - - // utils - static CHAR_CODE = 0; - static UNI_MAX = 40869; - static UNI_MIN = 19968; - - static PARMETER_BUNDLE_FLAG = 16; - static USERID = 100; - - static PERMISSION_INDEX = 0; - - static PERMISSION_NUM = 0; - - static PERMISSION_FLAG = 2; -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-secondary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-secondary.ets deleted file mode 100644 index 8d14b5bac574b93256b0a74b47f72a71b67cb3a5..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-secondary.ets +++ /dev/null @@ -1,332 +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 { backBar } from "../common/components/backBar.ets"; -import router from '@system.router'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import { groups } from "../common/model/permissionGroup.ets"; -import Constants from '../common/utils/constant.ets'; - -var TAG = 'PermissionManager_MainAbility:' - -const allowedStatus = 0; // Status: Allowed -const bannedStatus = 1; // Status: Banned - -class AllowedObj { - groupName: string; - permission: string[]; - constructor(groupName: string, permission: string[]) { - this.groupName = groupName; - this.permission = permission; - } -} // Class Allowed -class BannedObj { - groupName: string; - permission: string[]; - constructor(groupName: string, permission: string[]) { - this.groupName = groupName; - this.permission = permission; - } -} // Class Banned - -@Entry -@Component -struct appNamePlusPage { - @State allowedListItem: AllowedObj[] = []; // Array of allowed permissions - @State bannedListItem: BannedObj[] = []; // array of forbidden permissions - private routerData = router.getParams().routerData; // Routing jump data - - @Builder ListItemLayout(item, index, status) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Column() { - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text(item.groupName) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - }.margin({ top: Constants.FLEX_MARGIN_TOP, bottom: Constants.FLEX_MARGIN_BOTTOM }) - }.height(Constants.FULL_HEIGHT) - }.flexGrow(Constants.FLEX_GROW).constraintSize({ minHeight: Constants.CONSTRAINTSIZE_MINHEIGHT }) - Image($r('app.media.rightarrow')) - .objectFit(ImageFit.Contain) - .height(Constants.IMAGE_HEIGHT) - .width(Constants.IMAGE_WIDTH) - } - .width(Constants.FULL_WIDTH) - .height(Constants.LISTITEM_ROW_HEIGHT) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.FULL_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - } - } - }.onClick(() => { - if (status === 'allow') { - if (item.groupName == "其他权限") { - router.push({ - uri: 'pages/other-permissions', - params: { - routerData: this.routerData.bundleName, - backTitle: item.groupName, - permission: item.permission, - status: allowedStatus, - tokenId: this.routerData.tokenId - } - }); - } else { - router.push({ - uri: 'pages/application-tertiary', - params: { - routerData: this.routerData.bundleName, - backTitle: item.groupName, - permission: item.permission, - status: allowedStatus - } - }); - } - } - else if (status === 'banned') { - if (item.groupName == "其他权限") { - router.push({ - uri: 'pages/other-permissions', - params: { - routerData: this.routerData.bundleName, - backTitle: item.groupName, - permission: item.permission, - status: bannedStatus, - tokenId: this.routerData.tokenId - } - }); - } else { - router.push({ - uri: 'pages/application-tertiary', - params: { - routerData: this.routerData.bundleName, - backTitle: item.groupName, - permission: item.permission, - status: bannedStatus - } - }); - } - } - }) - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) - } - - /** - * Initialize permission status information and group permission information - */ - async initialPermissions() { - var reqPermissions = this.routerData.permissions; - var reqGroupIds = this.routerData.groupId; - - if (!reqGroupIds.length) { - this.allowedListItem = []; - this.bannedListItem = []; - return; - } - - for (let i = 0; i < reqGroupIds.length; i++) { - let id = reqGroupIds[i]; - let groupName = groups[id].groupName; - let groupReqPermissons = []; - for (let j = 0; j < reqPermissions.length; j++) { - let permission = reqPermissions[j]; - if (groups[id].permissions.indexOf(permission) != -1) { - groupReqPermissons.push(permission) - } - } - let isGranted = true; - for (let i = 0; i < groupReqPermissons.length; i++) { - let permission = groupReqPermissons[i] - let res = await abilityAccessCtrl.createAtManager().verifyAccessToken( - this.routerData.tokenId, permission); - if (res != 0) { - isGranted = false; - } - } - - if (isGranted) { - this.allowedListItem.push(new AllowedObj(groupName, groupReqPermissons)); - } else { - this.bannedListItem.push(new BannedObj(groupName, groupReqPermissons)); - } - } - } - - /** - * Lifecycle function, triggered once when this page is displayed - */ - onPageShow() { - console.log(TAG + 'onPageShow application-secondary') - this.initialPermissions(); - } - - /** - * Lifecycle function, triggered once when this page disappears - */ - onPageHide() { - console.log(TAG + 'onPageHide application-secondary') - setTimeout(()=> { - this.allowedListItem = []; - this.bannedListItem = []; - }, Constants.DELAY_TIME) - } - - build() { - Column(){ - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row({}) { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar({ title: JSON.stringify(this.routerData.labelId) }) - } - Row() { - Column() { - if (!this.allowedListItem.length && !this.bannedListItem.length) { - Row() { - List() { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Column() { - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text($r('app.string.no_permission')) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - }.margin({ top: Constants.FLEX_MARGIN_TOP, bottom: Constants.FLEX_MARGIN_BOTTOM }) - }.height(Constants.FULL_HEIGHT) - }.flexGrow(Constants.FLEX_GROW) - .constraintSize({minHeight: Constants.CONSTRAINTSIZE_MINHEIGHT }) - } - .width(Constants.FULL_WIDTH) - .height(Constants.LISTITEM_ROW_HEIGHT) - } - } - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) - } - .backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.ROW_MARGIN_TOP }) - .padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT }) - } else { - if (this.allowedListItem.length) { - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text($r('app.string.allowed')) - .fontSize(Constants.TEXT_SMAL_FONT_SIZE) - .margin({ - top: Constants.SECONDARY_TEXT_MARGIN_TOP, - left: Constants.SECONDARY_LIST_PADDING_RIGHT - }) - } - } - Row() { - List() { - ForEach(this.allowedListItem.slice(Constants.SLICE_START, this.allowedListItem.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX, 'allow') - }, item => item.toString()) - ForEach(this.allowedListItem.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX, 'allow') - }, item => item.toString()) - } - .backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.ROW_MARGIN_TOP }) - .padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT }) - } - if (this.bannedListItem.length) { - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text($r('app.string.banned')) - .fontSize(Constants.TEXT_SMAL_FONT_SIZE) - .margin({ - top: Constants.SECONDARY_TEXT_MARGIN_TOP, - left: Constants.SECONDARY_LIST_PADDING_RIGHT - }) - } - } - Row() { - List() { - ForEach(this.bannedListItem.slice(Constants.SLICE_START, this.bannedListItem.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX, 'banned') - }, item => item.toString()) - ForEach(this.bannedListItem.slice(Constants.SLICE_END), (item) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX, 'banned') - }, item => item.toString()) - } - .backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.ROW_MARGIN_TOP }) - .padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT }) - } - } - } - .width(Constants.FULL_WIDTH) - .height(Constants.FULL_HEIGHT) - } - .layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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/MainAbility/pages/application-tertiary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-tertiary.ets deleted file mode 100644 index 458788fc6ed3681e847eb302ea6ad0fab99368f9..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/application-tertiary.ets +++ /dev/null @@ -1,378 +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 { backBar } from "../common/components/backBar.ets"; -import router from '@system.router'; -import bundle from "@ohos.bundle"; -import { getAppLabel, getAppIcon, verifyAccessToken } from "../common/utils/utils"; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import { authorizeDialog } from "../common/components/dialog.ets"; -import { permissionDescriptions, permissionGroups } from "../common/model/permissionGroup.ets"; -import Constants from '../common/utils/constant.ets'; - -var TAG = 'PermissionManager_MainAbility:' - -let routerData = router.getParams().routerData; // Routing jump data -let backTitle = router.getParams().backTitle; // return title name -let status = router.getParams().status; // Status: Allowed, Forbidden -let permissions = router.getParams().permission; // permissions name -let nowGrantResult = Constants.PERMISSION_NUM; // Authorization results now -let nowRevokeResult = Constants.PERMISSION_NUM; // Now deauthorize results -let GrantResultFlag = []; // Authorization result Flag -let RevokeResultFlag = []; // Cancel authorization result Flag -class MeidaDocObj { - name: string - index: number - groupName: string - accessTokenId: string - permissions: [] - constructor( - name: string, - index: number, - groupName: string, - accessTokenId: string, - permissions: [] - ) { - this.name = name - this.index = index - this.groupName = groupName - this.accessTokenId = accessTokenId - this.permissions = permissions - } -}; // permission information class -class MediaListObj { - labelId: string - iconId: string - versionName: string - description: string - constructor( - labelId: string, - iconId: string, - versionName: string, - description: string - ) { - this.labelId = labelId - this.iconId = iconId - this.versionName = versionName - this.description = description - } -}; // Permission application information class - -@Entry -@Component -struct mediaDocumentPage { - build() { - Column() { - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row() { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar({ title: JSON.stringify(backTitle) }) - } - Row() { - Column() { - mediaDocumentItem() - }.width(Constants.FULL_WIDTH) - } - .layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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) - } - } - } -} - -@Component -struct mediaDocumentItem { - @State mediaDocListItem: MeidaDocObj[] = []; // Permission information array - @State mediaListItem: MediaListObj = { - labelId: '', - iconId: '', - versionName: '', - description: '' - }; // application info array - @State isCheckList: boolean[] = []; // Permission status array - - authorizeDialogController: CustomDialogController = new CustomDialogController({ - builder: authorizeDialog({ }), - autoCancel: true, - alignment: DialogAlignment.Center - }); - - /** - * Grant permissions to the app - * @param {Number} accessTokenId - * @param {String} permission permission name - */ - grantUserGrantedPermission(accessTokenId, permission) { - abilityAccessCtrl.createAtManager().grantUserGrantedPermission( - accessTokenId, permission, Constants.PERMISSION_FLAG).then((result) => { - nowGrantResult = result; - }) - .catch((error) => { - console.error(TAG + 'grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Deauthorize the app - * @param {Number} accessTokenId - * @param {String} permission permission name - */ - revokeUserGrantedPermission(accessTokenId, permission) { - abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( - accessTokenId, permission, Constants.PERMISSION_FLAG).then((result) => { - nowRevokeResult = result; - }) - .catch((error) => { - console.error(TAG + 'revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Lifecycle function, executed when the page is initialized - */ - aboutToAppear() { - let permissionDescription = permissionDescriptions[backTitle]; - bundle.getBundleInfo(routerData, Constants.PARMETER_BUNDLE_FLAG).then(res => { - Promise.all([getAppLabel(res.appInfo.labelId, res.name), - getAppIcon(res.appInfo.iconId, res.name)]) - .then((values) => { - this.mediaListItem = new MediaListObj( - String(values[0]), String(values[1]), res.versionName, permissionDescription); - }) - this.mediaDocListItem.push( - new MeidaDocObj( - Constants.RADIO_ALLOW_NAME, - Constants.RADIO_ALLOW_INDEX, - Constants.RADIO_ALLOW_GROUP_NAME, - res.appInfo.accessTokenId, - permissions - ) - ); - this.mediaDocListItem.push( - new MeidaDocObj( - Constants.RADIO_BAN_NAME, - Constants.RADIO_BAN_INDEX, - Constants.RADIO_BAN_GROUP_NAME, - res.appInfo.accessTokenId, - permissions - ) - ); - }).catch((error) => { - console.error(TAG + 'bundle.getBundleInfo failed. Cause: ' + JSON.stringify(error)); - this.mediaListItem = new MediaListObj('', '', '', permissionDescription); - this.mediaDocListItem.push( - new MeidaDocObj(Constants.RADIO_ALLOW_NAME, Constants.RADIO_ALLOW_INDEX, - Constants.RADIO_ALLOW_GROUP_NAME, '', permissions) - ); - this.mediaDocListItem.push( - new MeidaDocObj(Constants.RADIO_BAN_NAME, Constants.RADIO_BAN_INDEX, - Constants.RADIO_BAN_GROUP_NAME, '', permissions) - ); - }) - // Get permission status - if (!status) { - this.isCheckList = [true, false]; - } else { - this.isCheckList = [false, true]; - } - } - - build(){ - Column() { - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.mediaListItem.iconId) - .width(Constants.TERTIARY_IMAGE_WIDTH) - .height(Constants.TERTIARY_IMAGE_HEIGHT) - .margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT }) - Column() { - Row() { - Text(this.mediaListItem.labelId) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .textAlign(TextAlign.Start) - } - .width(Constants.TERTIARY_HALF_WIDTH) - Row() { - Text(this.mediaListItem.versionName) - .fontSize(Constants.TEXT_SMALLER_FONT_SIZE) - .textAlign(TextAlign.Start) - } - .width(Constants.TERTIARY_HALF_WIDTH) - } - } - } - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Text() - .fontSize(Constants.TEXT_SMALLER_FONT_SIZE) - .textAlign(TextAlign.Start) - }.margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT }) - } - } - .margin({ top: Constants.TERTIARY_ROW_MARGIN_TOP }) - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Text(backTitle + "访问权限") - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .textAlign(TextAlign.Start) - }.margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT }) - } - } - .height(Constants.LISTITEM_ROW_HEIGHT) - .margin({ top: Constants.TERTIARY_PERMISSION_ROW_MARGIN_TOP }) - Column() { - List() { - ForEach(this.mediaDocListItem, (item) => { - ListItem() { - Column() { - Row() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Text(item.name) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - if (this.isCheckList[item.index] === true) { - Image($r('app.media.radioactive')) - .width(Constants.TERTIARY_RADIO_IMAGE_WIDTH) - .height(Constants.TERTIARY_RADIO_IMAGE_HEIGHT) - .margin({ - top: Constants.TERTIARY_RADIO_IMAGE_MARGIN_TOP - }) - } else if (this.isCheckList[item.index] === false) { - Image($r('app.media.radiodefault')) - .width(Constants.TERTIARY_RADIO_IMAGE_WIDTH) - .height(Constants.TERTIARY_RADIO_IMAGE_HEIGHT) - .margin({ - top: Constants.TERTIARY_RADIO_IMAGE_MARGIN_TOP - }) - } - } - .backgroundColor($r('app.color.default_background_color')) - .width(Constants.FULL_WIDTH) - .height(Constants.LISTITEM_ROW_HEIGHT) - .onClick(() => { - item.permissions.forEach((permission) => { - if (!item.index) { - this.grantUserGrantedPermission(item.accessTokenId, permission) - if (nowGrantResult != Constants.PERMISSION_INDEX) { - GrantResultFlag.push(-1) - }else{ - GrantResultFlag.push(0) - } - } else { - this.revokeUserGrantedPermission(item.accessTokenId, permission) - if (nowRevokeResult != Constants.PERMISSION_INDEX) { - RevokeResultFlag.push(-1) - this.authorizeDialogController.open(); - setTimeout(()=> { - this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - }else{ - RevokeResultFlag.push(0) - } - } - }) - if (!item.index) { - if(GrantResultFlag.indexOf(-1) > -1){ - this.authorizeDialogController.open(); - setTimeout(()=> { - this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - }else{ - this.isCheckList = [true, false]; - } - }else{ - if (RevokeResultFlag.indexOf(-1) > -1){ - this.authorizeDialogController.open(); - setTimeout(()=> { - this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - }else{ - this.isCheckList = [false, true]; - } - } - }) - } - } - if (!item.index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.FULL_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - } - } - } - .onClick(() => { - }) - } - .padding({ - left: Constants.TERTIARY_LISTITEM_PADDING_LEFT, - right: Constants.TERTIARY_LISTITEM_PADDING_RIGHT - }) - .margin({ top: Constants.TERTIARY_LISTITEM_MARGIN_TOP }) - }, item => item.toString()) - } - .borderRadius(Constants.BORDER_RADIUS) - .backgroundColor($r('app.color.default_background_color')) - .padding({ - top: Constants.TERTIARY_LIST_PADDING_TOP, bottom: Constants.TERTIARY_LIST_PADDING_BOTTOM - }) - } - .padding({ - left: Constants.LIST_PADDING_LEFT, - right: Constants.LIST_PADDING_LEFT - }) - .width(Constants.FULL_WIDTH) - .height(Constants.FULL_HEIGHT) - } - .width(Constants.FULL_WIDTH) - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-management.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-management.ets deleted file mode 100644 index 28b8448d248e209085ed483e7da14994eaad445d..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-management.ets +++ /dev/null @@ -1,627 +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 { backBar } from "../common/components/backBar.ets"; -import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex.ets"; -import { textInput } from "../common/components/search.ets"; -import router from '@system.router'; -import bundle from "@ohos.bundle"; -import Resmgr from '@ohos.resourceManager'; -import { groups, userGrantPermissions,permissionGroupPermissions } from "../common/model/permissionGroup.ets"; -import { permissionGroups, permissionPermissionGroup, permissionGroupIds } from "../common/model/permissionGroup.ets"; -import { makePy } from "../common/utils/utils.ets"; -import Constants from '../common/utils/constant.ets'; - -var TAG = 'PermissionManager_MainAbility:' - -@Extend(Image) function customizeImage(width: number, height: number) { - .objectFit(ImageFit.Contain) - .width(width) - .height(height) -}; - -interface applicationPermissions { - 'bundleName': string, - 'iconId': string, - 'permissions': string[], - 'labelId': string, - 'tokenId': number, - 'groupId': number[] -}; - -interface permissionApplications { - 'permission': string, - 'groupName': string, - 'bundleNames': string[], - 'icon': string -}; - -interface groupPermission { - 'group': string, - 'permissions': string[], - 'groupName': string, - 'icon': string, - 'isShow':boolean -}; - -let bundleInfosList: any[] = []; // Permission information array - -@Entry -@Component -struct authorityManagementPage { - @Builder ListItemLayout(item, index) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Image(item.icon) - .customizeImage(Constants.MANAGEMENT_IMAGE_WIDTH, Constants.MANAGEMENT_IMAGE_HEIGHT) - .margin({ right: Constants.MANAGEMENT_IMAGE_MARGIN_RIGHT }) - Text(item.groupName) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - Image($r('app.media.rightarrow')) - .customizeImage(Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT) - } - .width(Constants.FULL_WIDTH) - .height(Constants.MANAGEMENT_ROW_HEIGHT) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.MANAGEMENT_TEXT_DECORATION_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - .margin({ left: Constants.MANAGEMENT_TEXT_DECORATION_MARGIN_LEFT }) - } - } - }.onClick(() => { - if (item.groupName === '其他权限' || item.groupName === '电话' || item.groupName === '通讯录' || item.groupName === '信息' - || item.groupName === '通话记录' || item.groupName === '日历') { - router.push({ - uri: 'pages/authority-secondary', - params: { routerData: this.allPermissionApplications, backTitle: item.groupName } - }) - } else { - var dataList = this.allPermissionApplications.filter((ele) => { - return ele.groupName === item.group - }) - - router.push({ - uri: 'pages/authority-tertiary-groups', - params: { routerData: dataList, backTitle: item.groupName } - }) - } - }) - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.MANAGEMENT_ROW_PADDING_RIGHT }) - } - - @State allApplicationPermissions: applicationPermissions[] = []; // All permissions apply - @State allPermissions: string[] = []; // All permissions - @State allSystemPermissions: string[] = []; // All system permissions - @State allUserPermissions: string[] = []; // All user rights - @State allPermissionApplications: permissionApplications [] = [] // All app permissions - @State allGroups: string[] = [] // All groups - @State allGroupPermission: groupPermission[] = [] // All group permissions - - /** - * Convert the permission array into key, value key-value objects for easy sorting - * @param {Array} order User rights - * @return {Object} return the processed object - */ - orderDict(order) { - let result = {}; - for (let i = 0; i < order.length; i++) { - let key = order[i]; - result[key] = i; - } - return result; - } - - /** - * Compare and sort the permission array according to the permission key value - * @param {String} prop Sort by permission - * @param {Object} orderSort objects to be sorted - * @return {Array} Returns a sorted array of permissions - */ - compare(prop, orderSort) { - return function(a, b) { - let aSortValue = orderSort[a[prop]]; - let bSortValue = orderSort[b[prop]]; - if (aSortValue == undefined) { - throw new Error('当前的字段不在排序列表里:' + a[prop]); - } - if (bSortValue == undefined) { - throw new Error('当前的字段不在排序列表里:' + b[prop]); - } - return aSortValue - bSortValue; - } - } - - /** - * Get all app permission information - * @param {Array} allPermissions All permissions - * @param {Object} allApplicationPermissions All app permissions - */ - getAllBundlePermissions(allPermissions: string[], allApplicationPermissions: applicationPermissions[]) { - bundle.getAllBundleInfo(Constants.PARMETER_BUNDLE_FLAG).then(async(res) => { - const bundleInfos = res; - var count = bundleInfos.length; - if (count <= 0) { - console.info(TAG + 'bundle.getAllBundleInfo result.length less than or equal to zero'); - return; - } - var infoIndex = 0; - for (let i = 0; i < count; i++) { - var info = bundleInfos[i]; - // Filter blank icon icon and text label resources - try { - const ret = await bundle.queryAbilityByWant({ - bundleName: info.name, - action: "action.system.home", - entities: ["entity.system.home"] - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION, Constants.USERID); - } catch(e) { - console.log(TAG + 'queryAbilityByWant catch error: ' + JSON.stringify(e)) - continue; - } - this.deduplicationPermissions(info, allPermissions, allApplicationPermissions); - this.updateAppLabel(infoIndex, info.name, info.appInfo.label); - this.updateAppIcon(infoIndex, info.name); - infoIndex = infoIndex + 1; - } - this.getAllPermissionApplications(); - let orderSort = this.orderDict(userGrantPermissions); - this.allPermissionApplications.sort(this.compare('permission', orderSort)); - this.getAllGroupPermission(); - bundleInfosList = this.allApplicationPermissions; - bundleInfosList.forEach((item) => { - if (!isNaN(item.labelId)) { - item.alphabeticalIndex = ''; - } else { - item.alphabeticalIndex = makePy(item.labelId)[0].slice(0, 1); // Get the first letter in the returned initials array - } - }) - }) - .catch((error) => { - console.error(TAG + 'bundle.getAllBundleInfo failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Get the corresponding permission group id according to the permission - * @param {String} permission app name id - * @return {Number} groupId - */ - getPermissionGroupByPermission(permission: string) { - for (let i = 0; i < permissionGroups.length; i++) { - if (permissionGroups[i].permissionName == permission) { - return groups[permissionGroups[i].groupId]; - } - } - } - - /** - * Get all app permission information - */ - getAllPermissionApplications() { - const this_ = this; - var leng = this_.allPermissions.length; - if (leng > 0) { - for (let i = 0; i < leng; i++) { - if (userGrantPermissions.indexOf(this_.allPermissions[i]) == -1) { - this_.allSystemPermissions.push(this_.allPermissions[i]); - } else { - this_.allUserPermissions.push(this_.allPermissions[i]); - } - } - } - for (let i = 0; i < this_.allUserPermissions.length; i++) { - var permissionGroup = this_.getPermissionGroupByPermission(this_.allUserPermissions[i]); - var icon: string = permissionGroup.icon; - var bundleNames: string[] = []; - for (let j = 0; j < this_.allApplicationPermissions.length; j++) { - if (this_.allApplicationPermissions[j].permissions.indexOf(this_.allUserPermissions[i]) != -1) { - bundleNames.push(this_.allApplicationPermissions[j].bundleName); - } - } - var pa: permissionApplications = { - 'permission': this_.allUserPermissions[i], - 'groupName': permissionGroup.name, - 'bundleNames': bundleNames, - 'icon': icon - }; - this_.allPermissionApplications.push(pa); - } - } - - /** - * Get permission group information - */ - getAllGroupPermission() { - const this_ = this; - var temp1 = []; - temp1 = ["LOCATION","CAMERA","MICROPHONE","MEDIA","CALENDAR","SPORT","HEALTH"]; - groups.forEach((item) => { - if (temp1.indexOf(item.name) > -1) { - var gp: groupPermission = { - "group": item.name, - "permissions": item.permissions, - 'groupName': item.groupName, - 'icon': item.icon, - 'isShow': item.isShow - }; - this_.allGroupPermission.push(gp); - } - }) - let temp2 = []; - groups.forEach((item) => { - if (item.isShow && temp1.indexOf(item.name) === -1) { - var gp: groupPermission = { - "group": item.name, - "permissions": item.permissions, - 'groupName': item.groupName, - 'icon': item.icon, - 'isShow': item.isShow - }; - temp2.push(item.name); - this_.allGroupPermission.push(gp); - } - }) - for (let i = 0; i < this_.allPermissionApplications.length; i++) { - if (this_.allGroups.indexOf(this_.allPermissionApplications[i].groupName) == -1 - && temp1.indexOf(this_.allPermissionApplications[i].groupName) == -1) { - this_.allGroups.push(this_.allPermissionApplications[i].groupName); - } - } - // Permission layout - var temp = this_.allGroups; - temp = temp.filter(function(item) { - return temp1.indexOf(item) == -1 && temp2.indexOf(item) == -1; - }); - if (temp.indexOf("OTHER") > -1) { - temp.splice(temp.indexOf("OTHER"),1); - temp.push("OTHER"); - }else { - temp.push("OTHER"); - } - this_.allGroups = temp; - for (let i = 0; i < this_.allGroups.length; i++) { - var permissions: string[] = permissionGroupPermissions[this_.allGroups[i]]; - var gp: groupPermission = { - "group": this_.allGroups[i], - "permissions": permissions, - 'groupName': '', - 'icon': '', - 'isShow': false - }; - this_.allGroupPermission.push(gp); - } - this.allGroupPermission.forEach((ele) => { - groups.forEach((item) => { - if (ele.group === item.name) { - ele.groupName = item.groupName; - ele.icon = item.icon; - ele.isShow = item.isShow; - } - }); - }) - } - - /** - * Deduplicate permission information and permission group information - * @param {Object} info bundleInfos Application Information - * @param {Array} allPermissions All permissions - * @param {Array} allApplicationPermissions All permissions apply - */ - deduplicationPermissions(info, allPermissions, allApplicationPermissions) { - var reqPermissionsLen = info.reqPermissions.length; - var reqUserPermissions: string[] = []; - if (reqPermissionsLen > 0) { - for (let j = 0; j < info.reqPermissions.length; j++) { - var permission = info.reqPermissions[j]; - if (allPermissions.indexOf(permission) == -1) { - allPermissions.push(permission); - } - if (userGrantPermissions.indexOf(permission) != -1) { - reqUserPermissions.push(permission); - } - } - } - let dePermissions = []; - let groupIds = []; - for (let i = 0; i < reqUserPermissions.length; i++) { - if(dePermissions.indexOf(permissionPermissionGroup[reqUserPermissions[i]]) == -1){ - dePermissions.push(permissionPermissionGroup[reqUserPermissions[i]]); - } - if(groupIds.indexOf(permissionGroupIds[reqUserPermissions[i]]) == -1){ - groupIds.push(permissionGroupIds[reqUserPermissions[i]]); - } - } - var ap: applicationPermissions = { - 'bundleName': info.name, - 'tokenId': info.appInfo.accessTokenId, - 'iconId': info.appInfo.iconId, - 'labelId': info.appInfo.labelId, - 'permissions': reqUserPermissions, - 'groupId': groupIds - }; - allApplicationPermissions.push(ap); - } - - /** - * Get app name resource - * @param {Number} index index of all app permissions array - * @param {String} bundleName Package names - * @param {String} labelName Application Name - */ - updateAppLabel(index, bundleName, labelName) { - Resmgr.getResourceManager(bundleName).then(item => { - if (index >= this.allApplicationPermissions.length) { - return; - } - var info = this.allApplicationPermissions[index]; - item.getString(info['labelId'], (error, value) => { - if (value == undefined) { - info['labelId'] = labelName; - } else { - info['labelId'] = value; - } - }) - }).catch(error => { - console.error(TAG + 'Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Get app icon resources - * @param {Number} index index of all app permissions array - * @param {String} bundleName Package names - */ - updateAppIcon(index, bundleName) { - Resmgr.getResourceManager(bundleName).then(item => { - if (index >= this.allApplicationPermissions.length) { - return; - } - var info = this.allApplicationPermissions[index]; - item.getMediaBase64(info['iconId'], (error, value) => { - info['iconId'] = value; - }) - }).catch(error => { - console.error(TAG + 'Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Lifecycle function, executed when the page is initialized - */ - aboutToAppear() { - console.log(TAG + 'on aboutToAppear, version 1.01'); - this.getAllBundlePermissions(this.allPermissions, this.allApplicationPermissions); - } - - build() { - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row() { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar( { title: JSON.stringify($r('app.string.authority_management')) }) - } - Row() { - Column() { - Column() { - Stack() { - Tabs() { - TabContent() { - Row() { - Column() { - Scroll() { - Row() { - List() { - ForEach(this.allGroupPermission.slice(Constants.SLICE_START, - this.allGroupPermission.length - 1), (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.allGroupPermission.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - }.backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.padding({ - left: Constants.MANAGEMENT_ROW_PADDING_LEFT, - right: Constants.MANAGEMENT_ROW_PADDING_RIGHT, - top: Constants.MANAGEMENT_ROW_PADDING_TOP - }) - } - }.width(Constants.FULL_WIDTH) - } - }.tabBar($r('app.string.authority')) - TabContent() { - applicationItem({ - applicationItem: bundleInfosList, - oldApplicationItem: bundleInfosList - }) - }.tabBar($r('app.string.application')) - } - .barWidth(Constants.BAR_WIDTH) - .barMode(BarMode.Fixed) - }.height(Constants.FULL_HEIGHT) - } - } - } - .layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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) - } - } -} - -@Component -struct applicationItem { - @State applicationItem: any[] = bundleInfosList // application info array - @State oldApplicationItem: any[] = bundleInfosList // Original application information array - @State searchResult: boolean = true // search results - - @Builder ListItemLayout(item, index) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Image(item.iconId) - .customizeImage(Constants.APPLICATION_IMAGE_WIDTH, Constants.APPLICATION_IMAGE_HEIGHT) - .margin({ right: Constants.APPLICATION_IMAGE_MARGIN_RIGHT }) - Text(item.labelId) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - Text(item.groupId.length + '项权限') - .fontSize(Constants.TEXT_SMAL_FONT_SIZE) - .fontColor($r('app.color.text_secondary_color')) - .margin({ right: Constants.APPLICATION_TEXT_MARGIN_RIGHT }) - Image($r('app.media.rightarrow')) - .customizeImage(Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT) - } - .width(Constants.FULL_WIDTH) - .height(Constants.AUTHORITY_ROW_HEIGHT) - .constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT }) - .padding({ left: Constants.APPLICATION_LIST_PADDING_LEFT}) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.APPLICATION_TEXT_DECORATION_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - .margin({ left: Constants.APPLICATION_TEXT_DECORATION_MARGIN_LEFT }) - } - } - }.onClick(() => { - router.push({ - uri: 'pages/application-secondary', - params: { routerData: item } - }); - }) - } - }.padding({ - left: Constants.APPLICATION_LISTITEM_PADDING_LEFT, - right: Constants.APPLICATION_LISTITEM_PADDING_RIGHT - }) - } - - build() { - Column() { - Row() { - textInput({ - placeholder: $r('app.string.textInput_placeholder'), - applicationItem: $applicationItem, - oldApplicationItem: $oldApplicationItem, - searchResult: $searchResult - }) - }.padding({ - left: Constants.APPLICATION_TEXTINPUT_PADDING_LEFT, - top: Constants.APPLICATION_TEXTINPUT_PADDING_TOP, - right: Constants.APPLICATION_TEXTINPUT_PADDING_RIGHT - }) - Scroll() { - Row() { - Flex({ alignItems: ItemAlign.Start }) { - Column() { - if (!this.applicationItem.length) { - if (this.searchResult) { - Row() { - List() { - ForEach(this.applicationItem.slice(Constants.SLICE_START, this.applicationItem.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.applicationItem.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - }.backgroundColor($r('app.color.default_background_color')).borderRadius(Constants.BORDER_RADIUS) - }.margin({ top: Constants.MANAGEMENT_ROW_MARGIN_TOP }) - .padding({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT }) - } else { - Row() { - Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Image($r('app.media.searchnoresult')) - .customizeImage(Constants.SEARCHNORESULT_IMAGE_WIDTH, Constants.SEARCHNORESULT_IMAGE_HEIGHT) - } - }.margin({ top: Constants.MANAGEMENT_ROW_MARGIN_TOP }) - .padding({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT }) - } - } else { - Row() { - List() { - ForEach(this.applicationItem.slice(Constants.SLICE_START, this.applicationItem.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.applicationItem.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - }.backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.MANAGEMENT_ROW_MARGIN_TOP }) - .padding({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT }) - } - } - .backgroundColor($r('app.color.background_color')) - .height(Constants.APPLICATION_COLUMN_HEIGHT) - Column() { - alphabetIndexerComponent({ applicationItem: $applicationItem, oldApplicationItem: $oldApplicationItem }) - } - .margin({ top: Constants.APPLICATION_ALPHABETINDEX_MARGIN_TOP }) - .width(Constants.APPLICATION_ALPHABETINDEX_WIDTH) - } - } - } - } - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-secondary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-secondary.ets deleted file mode 100644 index 61df8d7fd14f4031b4a9bc584ecb5d6dc5534a21..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-secondary.ets +++ /dev/null @@ -1,176 +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 { backBar } from "../common/components/backBar.ets"; -import { permissionGroups, groups } from "../common/model/permissionGroup.ets"; -import router from '@system.router'; -import Constants from '../common/utils/constant.ets'; - -var TAG = 'PermissionManager_MainAbility:' - -class CalendarObj { - permissionName: string - groupName: string - description: string - label: string - index: number - constructor(permissionName: string, groupName: string, description: string, label: string, index: number) { - this.permissionName = permissionName - this.groupName = groupName - this.description = description - this.label = label - this.index = index - } -} // Permission management secondary interface data class - -@Entry -@Component -struct appNamePage { - private backTitle = router.getParams().backTitle; // return title name - - build() { - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row() { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar({ title: JSON.stringify(this.backTitle) }) - } - Row() { - Column() { - Scroll() { - appNameItem() - } - } - }.layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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) - } - } -} - -@Component -struct appNameItem { - @State calendarListItem: CalendarObj[] = []; // Permission management secondary interface data array - private routerData = router.getParams().routerData; // Routing jump data - private backTitle = router.getParams().backTitle; // return title name - private allPermissionApplications = router.getParams().allPermissionApplications; // Array of all app permission names - - @Builder ListItemLayout(item, index) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Text(item.label) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - Image($r('app.media.rightarrow')) - .objectFit(ImageFit.Contain) - .height(Constants.IMAGE_HEIGHT) - .width(Constants.IMAGE_WIDTH) - } - .width(Constants.FULL_WIDTH) - .height(Constants.LISTITEM_ROW_HEIGHT) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.FULL_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - } - } - }.onClick(() => { - var dataList = this.routerData.filter((ele) => { - return ele.groupName === item.groupName; - }) - router.push({ - uri: 'pages/authority-tertiary', - params: { routerData: [dataList[item.index]], backTitle: item.label } - }); - }) - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) - } - - /** - * Lifecycle function, executed when the page is initialized - */ - aboutToAppear() { - var permissionsList = groups.filter((item) => { - return item.groupName === this.backTitle - }) - for (let i = 0; i < permissionsList[0].permissions.length; i++) { - permissionGroups.forEach((item) => { - if (item.permissionName === permissionsList[0].permissions[i]) { - this.calendarListItem.push( - new CalendarObj(item.permissionName, item.groupName, item.description, item.label, i) - ) - } - }) - } - } - - build() { - Row() { - Column() { - Row() { - List() { - ForEach(this.calendarListItem.slice(Constants.SLICE_START, this.calendarListItem.length - 1), (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.calendarListItem.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - }.backgroundColor($r('app.color.default_background_color')).borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.ROW_MARGIN_TOP }) - .padding({ left: Constants.LIST_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) - } - .width(Constants.FULL_WIDTH) - .height(Constants.FULL_HEIGHT) - } - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary-groups.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary-groups.ets deleted file mode 100644 index 4a133512091174822aa449d6f63f63d340515880..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary-groups.ets +++ /dev/null @@ -1,391 +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 { backBar } from "../common/components/backBar.ets"; -import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex.ets"; -import { textInput } from "../common/components/search.ets"; -import router from '@system.router'; -import bundle from "@ohos.bundle"; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import { getAppLabel, getAppIcon, verifyAccessToken} from "../common/utils/utils"; -import { makePy } from "../common/utils/utils.ets"; -import { authorizeDialog } from "../common/components/dialog.ets"; -import Constants from '../common/utils/constant.ets'; - -var TAG = 'PermissionManager_MainAbility:' - -@Extend(Image) function customizeImage(width: number, height: number) { - .objectFit(ImageFit.Contain) - .width(width) - .height(height) -} - -let routerData = router.getParams().routerData; // Routing jump data -let backTitle = router.getParams().backTitle; // return title name -let nowGrantResult = Constants.PERMISSION_NUM; // Authorization results now -let nowRevokeResult = Constants.PERMISSION_NUM; // Now deauthorize results -let GrantResultFlag = []; // Authorization result Flag -let RevokeResultFlag = []; // Cancel authorization result Flag - -class ApplicationObj { - labelId: string - iconId: string - index: number - accessTokenId: string - permission: string - alphabeticalIndex: string - constructor( - labelId: string, - iconId: string, - index: number, - accessTokenId: string, - permission: string, - alphabeticalIndex: string) { - this.labelId = labelId - this.iconId = iconId - this.index = index - this.accessTokenId = accessTokenId - this.permission = permission - this.alphabeticalIndex = alphabeticalIndex - } -} // application information - -@Entry -@Component -struct locationInfoPage { - build() { - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row() { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar({ title: JSON.stringify(backTitle) }) - } - Row() { - Column() { - applicationItem() - - }.width(Constants.FULL_WIDTH) - } - .layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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) - } - } -} - -@Component -struct applicationItem { - @State permissionNum: number = Constants.PERMISSION_NUM; // permission num - @State toggleIsOn: object = {}; // toggle switch state array - @State applicationList: ApplicationObj[] = []; // application info array - @State oldApplicationItem: ApplicationObj[] = []; // Original application information array - @State searchResult: boolean = true; // search results - - authorizeDialogController: CustomDialogController = new CustomDialogController({ - builder: authorizeDialog({ }), - autoCancel: true, - alignment: DialogAlignment.Center - }); - - @Builder ListItemLayout(item, index) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Image(item.iconId) - .customizeImage(Constants.AUTHORITY_IMAGE_WIDTH, Constants.AUTHORITY_IMAGE_HEIGHT) - .margin({ right: Constants.AUTHORITY_IMAGE_MARGIN_RIGHT }) - Text(item.labelId) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] }) - .selectedColor($r('app.color.toggle_color')) - .width(Constants.AUTHORITY_TOGGLE_WIDTH) - .height(Constants.AUTHORITY_TOGGLE_HEIGHT) - .onChange((isOn: boolean) => { - if (item.accessTokenId === '' || item.permission === '') { - return; - } - let _this = this; - if (isOn) { - let promises = routerData.map(it => new Promise((resolve, reject) => { - _this.grantUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); - })); - Promise.all(promises).then(function(results) { - if(results.indexOf(-1) != -1) { - _this.authorizeDialogController.open(); - _this.toggleIsOn[item.index] = false; - setTimeout(()=> { - _this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - } else { - _this.toggleIsOn[item.index] = true; - } - let num = Constants.PERMISSION_NUM; - for(let key in _this.toggleIsOn){ - if(_this.toggleIsOn[key]){ - num++; - } - } - _this.permissionNum = num; - }); - } else { - let promises = routerData.map(it => new Promise((resolve, reject) => { - _this.revokeUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); - })); - Promise.all(promises).then(function(results) { - if(results.indexOf(-1) != -1) { - _this.authorizeDialogController.open(); - _this.toggleIsOn[item.index] = true; - setTimeout(()=> { - _this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - } else { - _this.toggleIsOn[item.index] = false; - } - let num = Constants.PERMISSION_NUM; - for(let key in _this.toggleIsOn){ - if(_this.toggleIsOn[key]){ - num++; - } - } - _this.permissionNum = num; - }); - } - }) - } - .width(Constants.FULL_WIDTH) - .height(Constants.AUTHORITY_ROW_HEIGHT) - .constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT }) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.AUTHORITY_TEXT_DECORATION_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - .margin({ left: Constants.AUTHORITY_TEXT_DECORATION_MARGIN_LEFT }) - } - } - }.onClick(() => { - }) - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.AUTHORITY_LISTITEM_PADDING_RIGHT }) - } - - /** - * Grant permissions to the app - * @param {Number} accessTokenId - * @param {String} permission permission name - * @param {Number} index Array index to modify permission status - */ - grantUserGrantedPermission(accessTokenId, permission, index, resolve) { - abilityAccessCtrl.createAtManager().grantUserGrantedPermission( - accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { - // result: 0 Authorization succeeded; result: -1 Authorization failed - resolve(result); - }).catch(error => { - resolve(-1); - console.error(TAG + 'abilityAccessCtrl.createAtManager.grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Deauthorize the app - * @param {Number} accessTokenId - * @param {String} permission permission name - * @param {Number} index Array index to modify permission status - */ - revokeUserGrantedPermission(accessTokenId, permission, index, resolve) { - abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( - accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { - // result: 0 successfully cancel the authorization; result: -1 cancel the authorization failed - resolve(result); - }).catch(error => { - resolve(-1); - console.error(TAG + 'abilityAccessCtrl.createAtManager.revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Lifecycle function, executed when the page is initialized - */ - aboutToAppear() { - var bundleNames = [] - routerData.forEach(permissionmanager => { - permissionmanager.bundleNames.forEach( bundleName => { - if (bundleNames.indexOf(bundleName) == -1) { - bundleNames.push(bundleName) - } - }) - }) - for (let i = 0; i < bundleNames.length; i++) { - // Get BundleInfo based on bundle name - bundle.getBundleInfo(bundleNames[i], Constants.PARMETER_BUNDLE_FLAG).then(res => { - Promise.all([getAppLabel(res.appInfo.labelId, res.name), - getAppIcon(res.appInfo.iconId, res.name) - ]) - .then((values) => { - this.applicationList.push( - new ApplicationObj( - String(values[0]), - String(values[1]), - i, - res.appInfo.accessTokenId, - routerData[0].permission, - makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array - ); - this.oldApplicationItem.push( - new ApplicationObj( - String(values[0]), - String(values[1]), - i, - res.appInfo.accessTokenId, - routerData[0].permission, - makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array - ); - this.applicationList.sort((a,b) => a.index - b.index) - this.oldApplicationItem.sort((a,b) => a.index - b.index) - }); - // 0: have permission; -1: no permission - var boole = true; - this.permissionNum++; - for (let j = 0; j < routerData.length; j++) { - if (res.reqPermissions.indexOf(routerData[j].permission) == -1) { - continue - } - verifyAccessToken(res.appInfo.accessTokenId, routerData[j].permission).then((access) => { - if (Number(access) === Constants.PERMISSION_INDEX) { - if(boole){ - this.toggleIsOn[i] = true; - } - } else { - if(boole){ - this.permissionNum-- - } - boole = false; - this.toggleIsOn[i] = false; - } - }); - } - }).catch(() => { - this.applicationList.push( - new ApplicationObj('', '', 0, '', '', '') - ); - this.oldApplicationItem.push( - new ApplicationObj('', '', 0, '', '', '') - ); - }) - } - } - - build() { - Column() { - Row() { - textInput({ - placeholder: $r('app.string.textInput_placeholder'), - applicationItem: $applicationList, - oldApplicationItem: $oldApplicationItem, - searchResult: $searchResult - }) - }.padding({ - left: Constants.AUTHORITY_TEXTINPUT_PADDING_LEFT, - right: Constants.AUTHORITY_TEXTINPUT_PADDING_RIGHT - }) - Row() { - Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) { - Column() { - Flex({ justifyContent: FlexAlign.Start }) { - Text(this.permissionNum + '个应用获取此权限') - .fontSize(Constants.TEXT_SMAL_FONT_SIZE) - .fontColor($r('app.color.secondary_font_color')) - .margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP, left: Constants.AUTHORITY_TEXT_MARGIN_LEFT }) - } - Scroll() { - Row() { - Column() { - if (!this.applicationList.length) { - if (this.searchResult) { - Row() { - }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) - } else { - Row() { - Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Image($r('app.media.searchnoresult')) - .customizeImage(Constants.SEARCHNORESULT_IMAGE_WIDTH, Constants.SEARCHNORESULT_IMAGE_HEIGHT) - } - }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) - } - } else { - Row() { - List() { - ForEach(this.applicationList.slice(Constants.SLICE_START, this.applicationList.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.applicationList.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - } - .backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) - } - }.width(Constants.FULL_WIDTH) - .height(Constants.AUTHORITY_COLUMN_HEIGHT) - } - } - }.padding({ left: Constants.AUTHORITY_LISTITEM_PADDING_LEFT }) - Column() { - alphabetIndexerComponent({ applicationItem: $applicationList, oldApplicationItem: $oldApplicationItem }) - }.width(Constants.AUTHORITY_ALPHABETINDEX_WIDTH) - .padding({ top: Constants.AUTHORITY_ALPHABETINDEX_PADDING_TOP }) - } - } - } - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary.ets deleted file mode 100644 index 2f18b7b92bbfe5418fa05bf05a4494146b42f7b7..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/authority-tertiary.ets +++ /dev/null @@ -1,349 +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 { backBar } from "../common/components/backBar.ets"; -import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex.ets"; -import { textInput } from "../common/components/search.ets"; -import router from '@system.router'; -import bundle from "@ohos.bundle"; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import { getAppLabel, getAppIcon, verifyAccessToken } from "../common/utils/utils"; -import { makePy } from "../common/utils/utils.ets"; -import { authorizeDialog } from "../common/components/dialog.ets"; -import Constants from '../common/utils/constant.ets'; - -var TAG = 'PermissionManager_MainAbility:' - -@Extend(Image) function customizeImage(width: number, height: number) { - .objectFit(ImageFit.Contain) - .width(width) - .height(height) -} - -let routerData = router.getParams().routerData; // Routing jump data -let backTitle = router.getParams().backTitle; // return title name -class ApplicationObj { - labelId: string - iconId: string - index: number - accessTokenId: string - permission: string - alphabeticalIndex: string - constructor( - labelId: string, - iconId: string, - index: number, - accessTokenId: string, - permission: string, - alphabeticalIndex: string) { - this.labelId = labelId - this.iconId = iconId - this.index = index - this.accessTokenId = accessTokenId - this.permission = permission - this.alphabeticalIndex = alphabeticalIndex - } -} // application information - -@Entry -@Component -struct locationInfoPage { - build() { - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row() { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar({ title: JSON.stringify(backTitle) }) - } - Row() { - Column() { - applicationItem() - - }.width(Constants.FULL_WIDTH) - } - .layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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) - } - } -} - -@Component -struct applicationItem { - @State permissionNum: number = Constants.PERMISSION_NUM; // permission num - @State toggleIsOn: object = {}; // toggle switch state array - @State applicationList: ApplicationObj[] = []; // application info array - @State oldApplicationItem: ApplicationObj[] = []; // Original application information array - @State searchResult: boolean = true; // search results - - authorizeDialogController: CustomDialogController = new CustomDialogController({ - builder: authorizeDialog({ }), - autoCancel: true, - alignment: DialogAlignment.Center - }); - - @Builder ListItemLayout(item, index) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Image(item.iconId) - .customizeImage(Constants.AUTHORITY_IMAGE_WIDTH, Constants.AUTHORITY_IMAGE_HEIGHT) - .margin({ right: Constants.AUTHORITY_IMAGE_MARGIN_RIGHT }) - Text(item.labelId) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] }) - .selectedColor($r('app.color.toggle_color')) - .width(Constants.AUTHORITY_TOGGLE_WIDTH) - .height(Constants.AUTHORITY_TOGGLE_HEIGHT) - .onChange((isOn: boolean) => { - if (item.accessTokenId === '' || item.permission === '') { - return; - } - if (isOn) { - this.grantUserGrantedPermission(item.accessTokenId, item.permission, item.index); - } else { - this.revokeUserGrantedPermission(item.accessTokenId, item.permission, item.index); - } - }) - } - .width(Constants.FULL_WIDTH) - .height(Constants.AUTHORITY_ROW_HEIGHT) - .constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT }) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.AUTHORITY_TEXT_DECORATION_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - .margin({ left: Constants.AUTHORITY_TEXT_DECORATION_MARGIN_LEFT }) - } - } - }.onClick(() => { - }) - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.AUTHORITY_LISTITEM_PADDING_RIGHT }) - } - - /** - * Grant permissions to the app - * @param {Number} accessTokenId - * @param {String} permission permission name - * @param {Number} index Array index to modify permission status - */ - grantUserGrantedPermission(accessTokenId, permission, index) { - abilityAccessCtrl.createAtManager().grantUserGrantedPermission( - accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { - // result: 0 Authorization succeeded; result: -1 Authorization failed - if (result !== Constants.PERMISSION_INDEX) { - this.authorizeDialogController.open(); - this.toggleIsOn[index] = false; - setTimeout(()=> { - this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - } else { - this.toggleIsOn[index] = true; - } - let num = Constants.PERMISSION_NUM; - for(let key in this.toggleIsOn){ - if(this.toggleIsOn[key]){ - num++; - } - } - this.permissionNum = num; - }).catch(error => { - console.error(TAG + 'abilityAccessCtrl.createAtManager.grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); - }) - } - - /** - * Deauthorize the app - * @param {Number} accessTokenId - * @param {String} permission permission name - * @param {Number} index Array index to modify permission status - */ - revokeUserGrantedPermission(accessTokenId, permission, index) { - abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( - accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { - // result: 0 successfully cancel the authorization; result: -1 cancel the authorization failed - if (result !== Constants.PERMISSION_INDEX) { - this.authorizeDialogController.open(); - this.toggleIsOn[index] = true; - setTimeout(()=> { - this.authorizeDialogController.close(); - }, Constants.DELAY_TIME) - } else { - this.toggleIsOn[index] = false; - } - let num = Constants.PERMISSION_NUM; - for(let key in this.toggleIsOn){ - if(this.toggleIsOn[key]){ - num++; - } - } - this.permissionNum = num; - }) - } - - /** - * Lifecycle function, executed when the page is initialized - */ - aboutToAppear() { - for (let i = 0; i < routerData[0].bundleNames.length; i++) { - // Get BundleInfo based on bundle name - bundle.getBundleInfo(routerData[0].bundleNames[i], Constants.PARMETER_BUNDLE_FLAG).then(res => { - Promise.all([getAppLabel(res.appInfo.labelId, res.name), - getAppIcon(res.appInfo.iconId, res.name), - verifyAccessToken(res.appInfo.accessTokenId, routerData[0].permission)]) - .then((values) => { - this.applicationList.push( - new ApplicationObj( - String(values[0]), - String(values[1]), - i, - res.appInfo.accessTokenId, - routerData[0].permission, - makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array - ); - this.oldApplicationItem.push( - new ApplicationObj( - String(values[0]), - String(values[1]), - i, - res.appInfo.accessTokenId, - routerData[0].permission, - makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array - ); - this.applicationList.sort((a,b) => a.index - b.index) - this.oldApplicationItem.sort((a,b) => a.index - b.index) - // 0: have permission; -1: no permission - if (values[2] === Constants.PERMISSION_INDEX) { - this.toggleIsOn[i] = true; - this.permissionNum++; - } else { - this.toggleIsOn[i] = false; - } - }); - }).catch(() => { - this.applicationList.push( - new ApplicationObj('', '', 0, '', '', '') - ); - this.oldApplicationItem.push( - new ApplicationObj('', '', 0, '', '', '') - ); - }) - } - } - - build() { - Column() { - Row() { - textInput({ - placeholder: $r('app.string.textInput_placeholder'), - applicationItem: $applicationList, - oldApplicationItem: $oldApplicationItem, - searchResult: $searchResult - }) - }.padding({ - left: Constants.AUTHORITY_TEXTINPUT_PADDING_LEFT, - right: Constants.AUTHORITY_TEXTINPUT_PADDING_RIGHT - }) - Row() { - Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) { - Column() { - Flex({ justifyContent: FlexAlign.Start }) { - Text(this.permissionNum + '个应用获取此权限') - .fontSize(Constants.TEXT_SMAL_FONT_SIZE) - .fontColor($r('app.color.secondary_font_color')) - .margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP, left: Constants.AUTHORITY_TEXT_MARGIN_LEFT }) - } - Scroll() { - Row() { - Column() { - if (!this.applicationList.length) { - if (this.searchResult) { - Row() { - }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) - } else { - Row() { - Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Image($r('app.media.searchnoresult')) - .customizeImage(Constants.SEARCHNORESULT_IMAGE_WIDTH, Constants.SEARCHNORESULT_IMAGE_HEIGHT) - } - }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) - } - } else { - Row() { - List() { - ForEach(this.applicationList.slice(Constants.SLICE_START, this.applicationList.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.applicationList.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - } - .backgroundColor($r('app.color.default_background_color')) - .borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) - } - }.width(Constants.FULL_WIDTH) - .height(Constants.AUTHORITY_COLUMN_HEIGHT) - } - } - }.padding({ left: Constants.AUTHORITY_LISTITEM_PADDING_LEFT }) - Column() { - alphabetIndexerComponent({ applicationItem: $applicationList, oldApplicationItem: $oldApplicationItem }) - }.width(Constants.AUTHORITY_ALPHABETINDEX_WIDTH) - .padding({ top: Constants.AUTHORITY_ALPHABETINDEX_PADDING_TOP }) - } - } - } - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/other-permissions.ets b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/other-permissions.ets deleted file mode 100644 index 7a0882c7524609c3c5fdb8c92b453c6cf7bf4cc9..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/pages/other-permissions.ets +++ /dev/null @@ -1,170 +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 { backBar } from "../common/components/backBar.ets"; -import router from '@system.router'; -import Constants from '../common/utils/constant.ets'; -import { otherPermissionsLabel } from '../common/model/permissionGroup.ets' -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' - -var TAG = 'PermissionManager_MainAbility:' - -let routerData = router.getParams().routerData; // Routing jump data -let tokenId = router.getParams().tokenId; // tokenId for verify permission -let backTitle = router.getParams().backTitle; // return title name -let status = router.getParams().status; // Status: Allowed, Forbidden -let permissions = router.getParams().permission; // permissions name -let otherPermissionList = []; // otherPermission List -for (let i = 0; i < permissions.length; i++) { - otherPermissionList.push({ - permissionLabel: otherPermissionsLabel[permissions[i]], - permission: permissions[i] - }) -} - -@Entry -@Component -struct appNamePage { - build() { - GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { - Row() { - Row() - .useSizeType({ - xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, - sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, - md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, - lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() { - Column() { - Row() { - backBar({ title: JSON.stringify(backTitle) }) - } - Row() { - Column() { - Scroll() { - appNameItem() - } - } - }.layoutWeight(Constants.LAYOUT_WEIGHT) - } - } - .useSizeType({ - xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, - sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, - md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, - lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } - }) - .height(Constants.FULL_HEIGHT) - Row() - .useSizeType({ - xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, - sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, - md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, - lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } - }) - .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) - } - } - -/** - * Lifecycle function, triggered once when this page is displayed - */ - onPageShow() { - console.log(TAG + 'onPageShow other-permissions') - let isGranted = true; - permissions.forEach(permission => { - abilityAccessCtrl.createAtManager().verifyAccessToken(tokenId, permission).then(res => { - status = res; - }) - .catch(err => { - console.error(TAG + 'verifyAccessToken occure error: ' + JSON.stringify(err)) - }) - }) - } -} - -@Component -struct appNameItem { - @State otherPermissionListItem: string[] = otherPermissionList; // Other permission interface data array - @Builder ListItemLayout(item, index) { - ListItem() { - Row() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Text(item.permissionLabel) - .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) - .fontColor($r('app.color.text_color')) - .flexGrow(Constants.FLEX_GROW) - Image($r('app.media.rightarrow')) - .objectFit(ImageFit.Contain) - .height(Constants.IMAGE_HEIGHT) - .width(Constants.IMAGE_WIDTH) - } - .width(Constants.FULL_WIDTH) - .height(Constants.LISTITEM_ROW_HEIGHT) - } - if (!index) { - Row() { - Column() - .backgroundColor($r('app.color.text_decoration_color')) - .width(Constants.FULL_WIDTH) - .height(Constants.TEXT_DECORATION_HEIGHT) - } - } - }.onClick(() => { - router.push({ - uri: 'pages/application-tertiary', - params: { - routerData: routerData, - backTitle: item.permissionLabel, - permission: [item.permission], - status: status - } - }); - }) - } - }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) - } - - build() { - Row() { - Column() { - Row() { - List() { - ForEach(this.otherPermissionListItem.slice(Constants.SLICE_START, this.otherPermissionListItem.length - 1), - (item) => { - this.ListItemLayout(item, Constants.SLICE_START_INDEX) - }, item => item.toString()) - ForEach(this.otherPermissionListItem.slice(Constants.SLICE_END), (item, index) => { - this.ListItemLayout(item, Constants.SLICE_END_INDEX) - }, item => item.toString()) - }.backgroundColor($r('app.color.default_background_color')).borderRadius(Constants.BORDER_RADIUS) - .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) - }.margin({ top: Constants.ROW_MARGIN_TOP }) - .padding({ left: Constants.LIST_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) - } - .width(Constants.FULL_WIDTH) - .height(Constants.FULL_HEIGHT) - } - } -} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_actived.png b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_actived.png deleted file mode 100644 index 49991d108d51f1803ff3dcadc8870d69977908e7..0000000000000000000000000000000000000000 Binary files a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_actived.png and /dev/null differ diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_normal.png b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_normal.png deleted file mode 100644 index cdf5bb49392dfce97ea9fa1be0ace95715903498..0000000000000000000000000000000000000000 Binary files a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/media/icon_normal.png and /dev/null differ diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/properties/string.json b/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/properties/string.json deleted file mode 100644 index 127f01aeb3e034b0bc10cfdb98e59160afc9f5de..0000000000000000000000000000000000000000 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/default/properties/string.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "strings": { - "app_name": "CategoryPage", - "describe": "describe", - "category": "Category", - "itemChild": "ItemChild", - "item": "Item", - "search": "search...", - "you_search": "You search ", - "you_clicked": "You clicked ", - "tab": "Tab", - "more": "more >" - }, - "colors": { - "colorSubBackground": "#f1f3f5", - "appbar_subtitle_color": "#99000000", - "text_color": "#000000" - } -} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/.gitignore b/frameworks/com.ohos.permissionmanager/settings/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..4f9a973815d0b5e49bc8547681a6b4bc7a178d12 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/.gitignore @@ -0,0 +1,3 @@ +/node_modules +/.preview +/build \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/build-profile.json5 b/frameworks/com.ohos.permissionmanager/settings/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7dc37bb919dada5132609c409200db266559004f --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/build-profile.json5 @@ -0,0 +1,13 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default", + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/hvigorfile.js b/frameworks/com.ohos.permissionmanager/settings/hvigorfile.js new file mode 100644 index 0000000000000000000000000000000000000000..d7720ee6a7aad5c617d1fd2f6fc8c87067bfa32c --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/hvigorfile.js @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks diff --git a/frameworks/com.ohos.permissionmanager/settings/package-lock.json b/frameworks/com.ohos.permissionmanager/settings/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..ea6a79dd03427e2d55fcc37e1734216c76ff022c --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "settings", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/frameworks/com.ohos.permissionmanager/settings/package.json b/frameworks/com.ohos.permissionmanager/settings/package.json new file mode 100644 index 0000000000000000000000000000000000000000..00f3f0d66600eaa45a0b7e633df5c54541cf55fb --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/package.json @@ -0,0 +1,14 @@ +{ + "license": "ISC", + "devDependencies": {}, + "name": "settings", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.0", + "dependencies": {} +} diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/app.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/Application/AbilityStage.ts similarity index 71% rename from frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/app.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/Application/AbilityStage.ts index 1007addd5895518aa431843702e1c585e1d81bc2..c5840e536fb35e184dc92643ebfc9955d883353f 100644 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/app.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/Application/AbilityStage.ts @@ -12,12 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, + +import AbilityStage from "@ohos.application.AbilityStage" + +var TAG = "PermissionManager_MainAbility:" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log(TAG + "MyAbilityStage onCreate.") + } } \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/second.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/MainAbility/MainAbility.ts similarity index 35% rename from frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/second.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/MainAbility/MainAbility.ts index 2a9a10d491c54eabeb71b3387b548efb8098f1ce..6c6cceea6af0d30015684fbe92a5b05ec9552113 100644 --- a/frameworks/com.ohos.permissionmanager/entry/src/main/ets/MainAbility/pages/second.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/MainAbility/MainAbility.ts @@ -13,32 +13,41 @@ * limitations under the License. */ -import router from '@system.router'; - -@Entry -@Component -struct Second { - private content: string = "Second Page" - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - 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() - }) +import Ability from '@ohos.application.Ability'; + +var TAG = "PermissionManager_MainAbility:"; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log(TAG + "MainAbility onCreate, ability name is " + want.abilityName + "."); + globalThis.context = this.context; + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log(TAG + "MainAbility onWindowStageCreate."); + + globalThis.context = this.context; + + windowStage.setUIContent(this.context, "pages/authority-management", null); + } + + onForeground() { + // Ability has brought to foreground + console.log(TAG + "MainAbility onForeground."); + } + + onBackground() { + // Ability has back to background + console.log(TAG + "MainAbility onBackground."); + } + + onDestroy() { + console.log(TAG + "MainAbility onDestroy."); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log(TAG + "MainAbility onWindowStageDestroy."); } - .width('100%') - .height('100%') - } -} \ No newline at end of file +}; diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..beb3374dae74f5e2990c7bb6ba6f420c7459165f --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,87 @@ +/* + * 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 extension from '@ohos.application.ServiceExtensionAbility'; + +var TAG = "PermissionManager_MainAbility:"; + +export default class ServiceExtensionAbility extends extension { + /** + * Lifecycle function, called back when a service extension is started for initialization. + */ + onCreate(want) { + console.log(TAG + "ServiceExtensionAbility onCreate, ability name is " + want.abilityName); + + globalThis.ExtensonContext = this.context; + + // get window + let win = globalThis.win; + // load content + let path = "pages/authority-management"; + win.loadContent(path).then(() => { + console.log(TAG + "window loadContent " + path + " success."); + + // show window + win.show().then(() => { + console.log(TAG + "show window success."); + }).catch(error => { + console.error(TAG + "show window failed. Cause: " + JSON.stringify(error)); + }) + }).catch(error => { + console.error(TAG + "window loadContent failed. Cause: " + JSON.stringify(error)); + }) + } + + /** + * Lifecycle function, called back when a service extension is started or recall. + */ + onRequest(want, startId) { + console.log(TAG + "ServiceExtensionAbility onRequest. ability name is " + want.abilityName + + ", start id is " + startId); + + globalThis.startId = startId; + + // get window + let win = globalThis.win; + + if (startId != 1) { + // show window + win.show().then(() => { + console.log(TAG + "show window success."); + }).catch(error => { + console.error(TAG + "show window failed. Cause: " + JSON.stringify(error)); + }) + } + } + + /** + * Lifecycle function, called back before a service extension is destroyed. + */ + onDestroy() { + console.log(TAG + "ServiceExtensionAbility onDestroy."); + + // get window + let win = globalThis.win; + + // destroy window + win.destroy().then(() => { + console.log(TAG + "destroy window success"); + + globalThis.win = 0; + }).catch(error => { + console.error(TAG + "destroy window failed. Cause: " + JSON.stringify(error)); + }) + } +}; \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/alphabeticalIndex.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/alphabeticalIndex.ets similarity index 98% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/alphabeticalIndex.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/alphabeticalIndex.ets index 195b76c0611ab009ad52ed4017321cf1a58eaf2c..cc264d1d37b63f07cbeb2f0d675d3faa4186b168 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/alphabeticalIndex.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/alphabeticalIndex.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import Constants from '../utils/constant.ets'; +import Constants from '../utils/constant'; @Component export struct alphabetIndexerComponent { diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/backBar.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/backBar.ets similarity index 97% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/backBar.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/backBar.ets index 1920b99e5d6e17baef8a7bfa4d6c7ae460379aab..f8b8593fd58216f750cdda1f515fd625e2310077 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/backBar.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/backBar.ets @@ -14,7 +14,8 @@ */ import router from '@system.router'; -import Constants from '../utils/constant.ets'; + +import Constants from '../utils/constant'; @Component export struct backBar { diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/dialog.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/dialog.ets similarity index 96% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/dialog.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/dialog.ets index aecf0cf5f07edab216f6fb701dd6b5b34ba97f52..8e86dd6ab1ad56d5e7c698305ad2f8ea837d2cd5 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/dialog.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/dialog.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import Constants from '../utils/constant.ets'; +import Constants from '../utils/constant'; @CustomDialog export struct authorizeDialog { diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/search.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/search.ets similarity index 98% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/search.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/search.ets index d0de619113f3c0c0677ef1623c0c70b9977fc8e1..f74eaa6cd9d7fd384f0d7fd68a62cbb7134ad5cf 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/components/search.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/components/search.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import Constants from '../utils/constant.ets'; +import Constants from '../utils/constant'; @Component export struct textInput { diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/model/permissionGroup.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/model/permissionGroup.ets new file mode 100644 index 0000000000000000000000000000000000000000..44b77ea1e4efb136835bd56387d5cbe4b9032a15 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/model/permissionGroup.ets @@ -0,0 +1,455 @@ +/* + * 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 const permissionGroups: any[] = [ + { + "permissionName": "ohos.permission.LOCATION_IN_BACKGROUND", + "groupName": "LOCATION", + "label": "后台定位权限", + "description": "允许应用在后台运行时获取位置信息。", + "groupId": 0 + }, + { + "permissionName": "ohos.permission.LOCATION", + "groupName": "LOCATION", + "label": "前台定位权限", + "description": "允许应用在前台运行时获取位置信息。", + "groupId": 0 + }, + { + "permissionName": "ohos.permission.CAMERA", + "groupName": "CAMERA", + "label": "拍摄照片和录制视频", + "description": "允许应用拍摄照片和视频。", + "groupId": 1 + }, + { + "permissionName": "ohos.permission.MICROPHONE", + "groupName": "MICROPHONE", + "label": "录制音频", + "description": "允许应用打开或关闭录音通路。", + "groupId": 2 + }, + { + "permissionName": "ohos.permission.ANSWER_CALL", + "groupName": "PHONE", + "label": "接听电话", + "description": "允许应用接听电话。", + "groupId": 3 + }, + { + "permissionName": "ohos.permission.MANAGE_VOICEMAIL", + "groupName": "PHONE", + "label": "语音信箱", + "description": "允许应用管理语音信箱。", + "groupId": 3 + }, + { + "permissionName": "ohos.permission.READ_CELL_MESSAGES", + "groupName": "SMS", + "label": "读取小区广播", + "description": "允许应用读取设备接收的小区广播信息。", + "groupId": 4 + }, + { + "permissionName": "ohos.permission.READ_MESSAGES", + "groupName": "SMS", + "label": "读取短彩信", + "description": "允许应用读取设备接收的短彩信信息。", + "groupId": 4 + }, + { + "permissionName": "ohos.permission.RECEIVE_MMS", + "groupName": "SMS", + "label": "接收彩信", + "description": "允许应用接收彩信。", + "groupId": 4 + }, + { + "permissionName": "ohos.permission.RECEIVE_SMS", + "groupName": "SMS", + "label": "接收短信", + "description": "允许应用接收短信。", + "groupId": 4 + }, + { + "permissionName": "ohos.permission.RECEIVE_WAP_MESSAGES", + "groupName": "SMS", + "label": "接收WAP消息", + "description": "允许应用接收和处理WAP消息。", + "groupId": 4 + }, + { + "permissionName": "ohos.permission.SEND_MESSAGES", + "groupName": "SMS", + "label": "发送短彩信", + "description": "允许应用发送短彩信", + "groupId": 4 + }, + { + "permissionName": "ohos.permission.READ_CONTACTS", + "groupName": "CONTACTS", + "label": "读取通讯录", + "description": "允许应用读取设备上存储的联系人信息。", + "groupId": 5 + }, + { + "permissionName": "ohos.permission.WRITE_CONTACTS", + "groupName": "CONTACTS", + "label": "新建/修改/删除通讯录", + "description": "允许应用新建/修改/删除设备上存储的联系人信息。", + "groupId": 5 + }, + { + "permissionName": "ohos.permission.READ_CALL_LOG", + "groupName": "CALL_LOG", + "label": "读取通话记录", + "description": "允许应用读取设备上的通话记录信息。", + "groupId": 6 + }, + { + "permissionName": "ohos.permission.WRITE_CALL_LOG", + "groupName": "CALL_LOG", + "label": "新建/修改/删除通话记录", + "description": "允许新建/修改/删除设备上的通话记录信息。", + "groupId": 6 + }, + { + "permissionName": "ohos.permission.MEDIA_LOCATION", + "groupName": "MEDIA", + "label": "允许应用访问拍摄位置", + "description": "应用访问用户媒体文件中的拍摄位置信息如经纬度信息。", + "groupId": 7 + }, + { + "permissionName": "ohos.permission.READ_MEDIA", + "groupName": "MEDIA", + "label": "允许应用读取媒体文件", + "description": "允许应用访问户媒体文件,如视频、音频、图片等。", + "groupId": 7 + }, + { + "permissionName": "ohos.permission.WRITE_MEDIA", + "groupName": "MEDIA", + "label": "允许应用读写媒体文件", + "description": "允许应用读写户媒体文件,如视频、音频、图片等。", + "groupId": 7 + }, + { + "permissionName": "ohos.permission.READ_CALENDAR", + "groupName": "CALENDAR", + "label": "读取日历", + "description": "允许应用读取日历。", + "groupId": 8 + }, + { + "permissionName": "ohos.permission.WRITE_CALENDAR", + "groupName": "CALENDAR", + "label": "修建/修改/删除日历", + "description": "允许应用修建/修改/删除日历。", + "groupId": 8 + }, + { + "permissionName": "ohos.permission.ACTIVITY_MOTION", + "groupName": "SPORT", + "label": "读取用户的运动状态", + "description": "允许应用程序读取用户的运动状态。", + "groupId": 9 + }, + { + "permissionName": "ohos.permission.READ_HEALTH_DATA", + "groupName": "HEALTH", + "label": "读取用户的健康数据", + "description": "允许应用程序读取用户的健康数据。", + "groupId": 10 + }, + { + "permissionName": "ohos.permission.DISTRIBUTED_DATASYNC", + "groupName": "OTHER", + "label": "多设备协同", + "description": "发现并访问其他设备。", + "groupId": 11 + } +]; + +export const groups: any[] = [ + { + "name": "LOCATION", + "groupName": "位置信息", + "icon": $r('app.media.ic_public_gps'), + "description": "访问您的位置信息", + "permissions": [ + "ohos.permission.LOCATION_IN_BACKGROUND", + "ohos.permission.LOCATION" + ], + "isShow":true + }, + { + "name": "CAMERA", + "groupName": "相机", + "icon": $r('app.media.ic_public_camera'), + "description": "访问您的相机", + "permissions": [ + "ohos.permission.CAMERA" + ], + "isShow":true + }, + { + "name": "MICROPHONE", + "groupName": "麦克风", + "icon": $r('app.media.ic_public_voice'), + "description": "访问您的麦克风", + "permissions": [ + "ohos.permission.MICROPHONE" + ], + "isShow":true + }, + { + "name": "PHONE", + "groupName": "电话", + "icon": $r('app.media.ic_public_phone'), + "description": "拨打电话和管理通话", + "permissions": [ + "ohos.permission.ANSWER_CALL", + "ohos.permission.MANAGE_VOICEMAIL" + ], + "isShow":false + }, + { + "name": "SMS", + "groupName": "信息", + "icon": $r('app.media.ic_public_message'), + "description": "发送和查看短信", + "permissions": [ + "ohos.permission.READ_CELL_MESSAGES", + "ohos.permission.READ_MESSAGES", + "ohos.permission.RECEIVE_MMS", + "ohos.permission.RECEIVE_SMS", + "ohos.permission.RECEIVE_WAP_MESSAGES", + "ohos.permission.SEND_MESSAGES" + ], + "isShow":false + }, + { + "name": "CONTACTS", + "groupName": "通讯录", + "icon": $r('app.media.ic_public_contacts_group'), + "description": "访问您的通讯录", + "permissions": [ + "ohos.permission.READ_CONTACTS", + "ohos.permission.WRITE_CONTACTS" + ], + "isShow":false + }, + { + "name": "CALL_LOG", + "groupName": "通话记录", + "icon": $r('app.media.ic_call_logs'), + "description": "读取和写入手机通话记录", + "permissions": [ + "ohos.permission.READ_CALL_LOG", + "ohos.permission.WRITE_CALL_LOG" + ], + "isShow":false + }, + { + "name": "MEDIA", + "groupName": "媒体和文件", + "icon": $r('app.media.ic_public_folder'), + "description": "访问您的媒体和文件", + "permissions": [ + "ohos.permission.MEDIA_LOCATION", + "ohos.permission.READ_MEDIA", + "ohos.permission.WRITE_MEDIA" + ], + "isShow":true + }, + { + "name": "CALENDAR", + "groupName": "日历", + "icon": $r('app.media.ic_public_calendar'), + "description": "访问日历和活动", + "permissions": [ + "ohos.permission.READ_CALENDAR", + "ohos.permission.WRITE_CALENDAR" + ], + "isShow":true + }, + { + "name": "SPORT", + "groupName": "健身运动", + "icon": $r('app.media.ic_sport'), + "description": "访问您的运动状态", + "permissions": [ + "ohos.permission.ACTIVITY_MOTION" + ], + "isShow":true + }, + { + "name": "HEALTH", + "groupName": "身体传感器", + "icon": $r('app.media.ic_ssensor'), + "description": "访问您的健康数据", + "permissions": [ + "ohos.permission.READ_HEALTH_DATA" + ], + "isShow":true + }, + { + "name": "OTHER", + "groupName": "其他权限", + "icon": $r('app.media.ic_more'), + "description": "访问您的其它权限", + "permissions": [ + "ohos.permission.DISTRIBUTED_DATASYNC" + ], + "isShow":false + } +]; + +export const permissionGroupPermissions: object = { + "LOCATION": ["ohos.permission.LOCATION_IN_BACKGROUND","ohos.permission.LOCATION"], + "CAMERA": ["ohos.permission.CAMERA"], + "MICROPHONE": ["ohos.permission.MICROPHONE"], + "PHONE": ["ohos.permission.ANSWER_CALL","ohos.permission.MANAGE_VOICEMAIL"], + "SMS": ["ohos.permission.READ_CELL_MESSAGES", "ohos.permission.READ_MESSAGES", "ohos.permission.RECEIVE_MMS", "ohos.permission.RECEIVE_SMS", "ohos.permission.RECEIVE_WAP_MESSAGES", "ohos.permission.SEND_MESSAGES"], + "CONTACTS": ["ohos.permission.READ_CONTACTS", "ohos.permission.WRITE_CONTACTS"], + "CALL_LOG": ["ohos.permission.READ_CALL_LOG", "ohos.permission.WRITE_CALL_LOG"], + "MEDIA": ["ohos.permission.MEDIA_LOCATION", "ohos.permission.READ_MEDIA", "ohos.permission.WRITE_MEDIA"], + "CALENDAR": ["ohos.permission.READ_CALENDAR", "ohos.permission.WRITE_CALENDAR"], + "SPORT": ["ohos.permission.ACTIVITY_MOTION"], + "HEALTH": ["ohos.permission.READ_HEALTH_DATA"], + "OTHER": ["ohos.permission.DISTRIBUTED_DATASYNC"] +}; + + +export const userGrantPermissions: string[] = [ + "ohos.permission.LOCATION_IN_BACKGROUND", + "ohos.permission.LOCATION", + "ohos.permission.CAMERA", + "ohos.permission.MICROPHONE", + "ohos.permission.ANSWER_CALL", + "ohos.permission.MANAGE_VOICEMAIL", + "ohos.permission.READ_CELL_MESSAGES", + "ohos.permission.READ_MESSAGES", + "ohos.permission.RECEIVE_MMS", + "ohos.permission.RECEIVE_SMS", + "ohos.permission.RECEIVE_WAP_MESSAGES", + "ohos.permission.SEND_MESSAGES", + "ohos.permission.READ_CONTACTS", + "ohos.permission.WRITE_CONTACTS", + "ohos.permission.READ_CALL_LOG", + "ohos.permission.WRITE_CALL_LOG", + "ohos.permission.MEDIA_LOCATION", + "ohos.permission.READ_MEDIA", + "ohos.permission.WRITE_MEDIA", + "ohos.permission.READ_CALENDAR", + "ohos.permission.WRITE_CALENDAR", + "ohos.permission.ACTIVITY_MOTION", + "ohos.permission.READ_HEALTH_DATA", + "ohos.permission.DISTRIBUTED_DATASYNC" +]; + +export const permissionDescriptions: object = { + "位置信息": "允许应用在后台运行时获取位置信息。" , + "相机": "允许应用拍摄照片和视频。" , + "麦克风": "允许应用打开或关闭录音通路。" , + "电话": "允许应用接听电话。" , + "信息": "允许应用发送短彩信。" , + "通讯录": "允许应用新建/修改/删除设备上存储的联系人信息。" , + "通话记录": "允许新建/修改/删除设备上的通话记录信息。" , + "媒体和文件": "允许应用访问户媒体文件,如视频、音频、图片等。" , + "日历": "允许应用修建/修改/删除日历。" , + "健身运动": "允许应用程序读取用户的运动状态。" , + "身体传感器": "允许应用程序读取用户的健康数据。" , + "其他权限": "允许应用与远程设备交换用户数据(如图片、音乐、视频、及应用数据等)。" +}; + +export const permissionPermissionGroup: object = { + "ohos.permission.LOCATION_IN_BACKGROUND": "LOCATION", + "ohos.permission.LOCATION": "LOCATION", + "ohos.permission.CAMERA": "CAMERA", + "ohos.permission.MICROPHONE": "MICROPHONE", + "ohos.permission.ANSWER_CALL": "PHONE", + "ohos.permission.MANAGE_VOICEMAIL": "PHONE", + "ohos.permission.READ_CELL_MESSAGES": "SMS", + "ohos.permission.READ_MESSAGES": "SMS", + "ohos.permission.RECEIVE_MMS": "SMS", + "ohos.permission.RECEIVE_SMS": "SMS", + "ohos.permission.RECEIVE_WAP_MESSAGES": "SMS", + "ohos.permission.SEND_MESSAGES": "SMS", + "ohos.permission.READ_CONTACTS": "CONTACTS", + "ohos.permission.WRITE_CONTACTS": "CONTACTS", + "ohos.permission.READ_CALL_LOG": "CALL_LOG", + "ohos.permission.WRITE_CALL_LOG": "CALL_LOG", + "ohos.permission.MEDIA_LOCATION": "MEDIA", + "ohos.permission.READ_MEDIA": "MEDIA", + "ohos.permission.WRITE_MEDIA": "MEDIA", + "ohos.permission.READ_CALENDAR": "CALENDAR", + "ohos.permission.WRITE_CALENDAR": "CALENDAR", + "ohos.permission.ACTIVITY_MOTION": "SPORT", + "ohos.permission.READ_HEALTH_DATA": "HEALTH", + "ohos.permission.DISTRIBUTED_DATASYNC": "OTHER" +}; + +export const permissionGroupIds: object = { + "ohos.permission.LOCATION_IN_BACKGROUND": "0", + "ohos.permission.LOCATION": "0", + "ohos.permission.CAMERA": "1", + "ohos.permission.MICROPHONE": "2", + "ohos.permission.ANSWER_CALL": "3", + "ohos.permission.MANAGE_VOICEMAIL": "3", + "ohos.permission.READ_CELL_MESSAGES": "4", + "ohos.permission.READ_MESSAGES": "4", + "ohos.permission.RECEIVE_MMS": "4", + "ohos.permission.RECEIVE_SMS": "4", + "ohos.permission.RECEIVE_WAP_MESSAGES": "4", + "ohos.permission.SEND_MESSAGES": "4", + "ohos.permission.READ_CONTACTS": "5", + "ohos.permission.WRITE_CONTACTS": "5", + "ohos.permission.READ_CALL_LOG": "6", + "ohos.permission.WRITE_CALL_LOG": "6", + "ohos.permission.MEDIA_LOCATION": "7", + "ohos.permission.READ_MEDIA": "7", + "ohos.permission.WRITE_MEDIA": "7", + "ohos.permission.READ_CALENDAR": "8", + "ohos.permission.WRITE_CALENDAR": "8", + "ohos.permission.ACTIVITY_MOTION": "9", + "ohos.permission.READ_HEALTH_DATA": "10", + "ohos.permission.DISTRIBUTED_DATASYNC": "11" +}; + +export const orderGroup: string[] = [ + "位置信息", + "相机", + "麦克风", + "电话", + "信息", + "通讯录", + "通话记录", + "媒体和文件", + "日历", + "健身运动", + "身体传感器", + "其他权限" +]; + +export const otherPermissionsLabel: object = { + "ohos.permission.DISTRIBUTED_DATASYNC": "多设备协同" +}; + +export const noneIconApp: string[] = [ + "com.ohos.launcher" +] \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/utils/constant.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/utils/constant.ets new file mode 100644 index 0000000000000000000000000000000000000000..b63cd77b9adbcc64df558dc0bd437249f21f3325 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/utils/constant.ets @@ -0,0 +1,238 @@ +/* + * 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 class Constants { + // VERSION + static PERMISSION_MANAGER_VERSION = "2.0" + static MODULE_JSON_VERSION = 9; + + // $r() return Resource fix + static RESOURCE_FIX_SEARCH = "搜索应用"; + + // window + static WINDOW_TYPE_TOAST = 2107; + static STATUS_BAR_HEIGHT_RATE = 0.04; + static NAVIGATION_BAR_HEIGHT_RATE = 0.06; + static MOVE_TO_POSITION_WIDTH = 0; + + // alphabetIndexer + static ALPHABETINDEXER_SELECTEDFONT_SIZE = 12; + static ALPHABETINDEXER_POPUPFONT_SIZE = 30; + static ALPHABETINDEXER_ITEMSIZE = 16; + static ALPHABETINDEXER_HEIGHT = 448; + static ALPHABETINDEXER_WIDTH = 36; + + // backBar + static BACKBAR_HEIGHT = 56; + static BACKBAR_MINHEIGHT = 56; + + // image of backBar + static BACKBAR_IMAGE_HEIGHT = 24; + static BACKBAR_IMAGE_WIDTH = 24; + static BACKBAR_IMAGE_MARGIN_TOP = 17; + static BACKBAR_IMAGE_MARGIN_LEFT = 12; + static BACKBAR_IMAGE_MARGIN_RIGHT = 15; + + // text of backBar + static BACKBAR_TEXT_FONT_SIZE = 20; + static BACKBAR_TEXT_FLEX_GROW = 1; + static BACKBAR_TEXT_MARGIN_TOP = 17; + + // dialog + static DIALOG_BORDER_RADIUS = 24; + static DIALOG_HEIGHT = 70; + static DIALOG_WIDTH = 336; + + // text of dialog + static DIALOG_TEXT_FONT_SIZE = 20; + static DIALOG_TEXT_MARGIN_TOP = 25; + + // search textInput + static TEXTINPUT_PADDING_LEFT = 36; + static TEXTINPUT_BORDER_RADIUS = 20; + static TEXTINPUT_PLACEHOLDER_Font_SIZE = 16; + static TEXTINPUT_HEIGHT = 40; + static TEXTINPUT_IMAGE_WIDTH = 16; + static TEXTINPUT_IMAGE_HEIGHT = 16; + static TEXTINPUT_IMAGE_MARGIN_LEFT = -300; + static TEXTINPUT_IMAGE_MARGIN_TOP = 12; + + // grid useSizeType + static GRID_MARGIN = '0vp'; + static GUTTER = 0; + static LEFT_XS_SPAN = 0; + static LEFT_XS_OFFSET = 0; + static LEFT_SM_SPAN = 0; + static LEFT_SM_OFFSET = 0; + static LEFT_MD_SPAN = 0; + static LEFT_MD_OFFSET = 0; + static LEFT_LG_SPAN = 2; + static LEFT_LG_OFFSET = 0; + 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 = 0; + static RIGHT_XS_OFFSET = 2; + 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; + + // 100% width,height + static FULL_WIDTH = '100%'; + static FULL_HEIGHT = '100%'; + + // public property style + static LAYOUT_WEIGHT = 1; + static FLEX_GROW = 1; + static TEXT_DECORATION_HEIGHT = 2; + static TEXT_MIDDLE_FONT_SIZE = 16; + static TEXT_SMAL_FONT_SIZE = 14; + static TEXT_SMALLER_FONT_SIZE = 12; + static CONSTRAINTSIZE_MINHEIGHT = 48; + static LISTITEM_ROW_HEIGHT = 48; + static LISTITEM_PADDING_LEFT = 24; + static LIST_PADDING_LEFT = 12 + static LISTITEM_PADDING_RIGHT = 12; + static IMAGE_HEIGHT = 24; + static IMAGE_WIDTH = 12; + static BORDER_RADIUS = 24; + + // application-secondary, authority-secondary + static FLEX_MARGIN_TOP = 8; + static FLEX_MARGIN_BOTTOM = 8; + static LIST_PADDING_TOP = 4; + static LIST_PADDING_BOTTOM = 4; + static ROW_MARGIN_TOP = 9; + static SECONDARY_TEXT_MARGIN_TOP = 19.5; + static SECONDARY_TEXT_MARGIN_LEFT = 48; + static SECONDARY_LIST_PADDING_LEFT = 12; + static SECONDARY_LIST_PADDING_RIGHT = 12; + + // application-tertiary + static TERTIARY_IMAGE_WIDTH = 64; + static TERTIARY_IMAGE_HEIGHT = 64; + static TERTIARY_IMAGE_MARGIN_LEFT = 12; + static TERTIARY_IMAGE_MARGIN_RIGHT = 12; + static TERTIARY_HALF_WIDTH = '50%'; + static TERTIARY_ROW_MARGIN_TOP = 24; + static TERTIARY_PERMISSION_ROW_MARGIN_TOP = 12; + static TERTIARY_RADIO_IMAGE_WIDTH = 24; + static TERTIARY_RADIO_IMAGE_HEIGHT = 24; + static TERTIARY_RADIO_IMAGE_MARGIN_TOP = 4; + static TERTIARY_LISTITEM_PADDING_LEFT = 24; + static TERTIARY_LISTITEM_PADDING_RIGHT = 24; + static TERTIARY_LISTITEM_MARGIN_TOP = 1; + static TERTIARY_LIST_PADDING_LEFT = 12; + static TERTIARY_LIST_PADDING_RIGHT = 12; + static TERTIARY_LIST_PADDING_TOP = 3; + static TERTIARY_LIST_PADDING_BOTTOM = 4; + + // authority-tertiary + static AUTHORITY_IMAGE_WIDTH = 40; + static AUTHORITY_IMAGE_HEIGHT = 40; + static AUTHORITY_IMAGE_MARGIN_RIGHT = 16; + static AUTHORITY_TOGGLE_WIDTH = 36; + static AUTHORITY_TOGGLE_HEIGHT = 20; + static AUTHORITY_ROW_HEIGHT = 72; + static AUTHORITY_CONSTRAINTSIZE_MINHEIGHT = 72; + static AUTHORITY_LISTITEM_PADDING_LEFT = 12; + static AUTHORITY_LISTITEM_PADDING_RIGHT = 12; + static AUTHORITY_TEXTINPUT_PADDING_LEFT = 12; + static AUTHORITY_TEXTINPUT_PADDING_RIGHT = 4; + static AUTHORITY_TEXT_MARGIN_TOP = 24; + static AUTHORITY_TEXT_MARGIN_LEFT = 0; + static AUTHORITY_ROW_MARGIN_TOP = 24; + static SEARCHNORESULT_IMAGE_WIDTH = 200; + static SEARCHNORESULT_IMAGE_HEIGHT = 200; + static AUTHORITY_COLUMN_HEIGHT = '95%'; + static AUTHORITY_ALPHABETINDEX_WIDTH = 24; + static AUTHORITY_ALPHABETINDEX_PADDING_TOP = 16; + static AUTHORITY_TEXT_DECORATION_WIDTH = '86%'; + static AUTHORITY_TEXT_DECORATION_MARGIN_LEFT = 53; + + // authority-management + static MANAGEMENT_IMAGE_WIDTH = 24; + static MANAGEMENT_IMAGE_HEIGHT = 24; + static MANAGEMENT_IMAGE_MARGIN_RIGHT = 16; + static MANAGEMENT_ROW_HEIGHT = 56; + static MANAGEMENT_TEXT_DECORATION_WIDTH = '90%'; + static MANAGEMENT_TEXT_DECORATION_MARGIN_LEFT = 40; + static MANAGEMENT_LODING_IMAGE_WIDTH = 48; + static MANAGEMENT_LODING_IMAGE_HEIGHT = 48; + static MANAGEMENT_LODING_ROW_HEIGHT = '90%'; + static MANAGEMENT_ROW_PADDING_LEFT = 12; + 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; + static APPLICATION_TEXT_MARGIN_RIGHT = 4; + static APPLICATION_LIST_PADDING_LEFT = 12; + static APPLICATION_LISTITEM_PADDING_LEFT = 12; + static APPLICATION_LISTITEM_PADDING_RIGHT = 12; + static APPLICATION_TEXTINPUT_PADDING_LEFT = 12; + static APPLICATION_TEXTINPUT_PADDING_TOP = 8; + static APPLICATION_TEXTINPUT_PADDING_RIGHT = 4; + static APPLICATION_COLUMN_HEIGHT = '93%'; + static APPLICATION_ALPHABETINDEX_MARGIN_TOP = 12; + static APPLICATION_ALPHABETINDEX_WIDTH = 24; + static APPLICATION_TEXT_DECORATION_WIDTH = '83%'; + static APPLICATION_TEXT_DECORATION_MARGIN_LEFT = 68; + + // slice + static SLICE_START = 0; + static SLICE_END = -1; + static SLICE_START_INDEX = 0; + static SLICE_END_INDEX = 1; + + // tabBar + static BAR_WIDTH = 250; + + // setTimeout + static DELAY_TIME = 1000; + static DELAY_TIME_MAX = 2000; + + // radio + static RADIO_ALLOW_NAME = '允许'; + static RADIO_ALLOW_INDEX = 0; + static RADIO_ALLOW_GROUP_NAME = 'radio'; + static RADIO_BAN_NAME = '禁止'; + static RADIO_BAN_INDEX = 1; + static RADIO_BAN_GROUP_NAME = 'radio'; + + // utils + static CHAR_CODE = 0; + static UNI_MAX = 40869; + static UNI_MIN = 19968; + + static PARMETER_BUNDLE_FLAG = 16; + static USERID = 100; + + static PERMISSION_INDEX = 0; + + static PERMISSION_NUM = 0; + + static PERMISSION_FLAG = 2; +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/utils.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/utils/utils.ets similarity index 99% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/utils.ets rename to frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/utils/utils.ets index 08b2a34bebcb78e05be9f683a03c01fe8190767d..74d2683915273e3824a5099994e10e5ed13aec53 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/common/utils/utils.ets +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/common/utils/utils.ets @@ -15,8 +15,9 @@ import Resmgr from '@ohos.resourceManager'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import { permissionGroups, groups } from "../model/permissionGroup.ets"; -import Constants from '../utils/constant.ets'; + +import { permissionGroups, groups } from "../model/permissionGroup"; +import Constants from '../utils/constant'; /** * Get app name resource @@ -25,7 +26,7 @@ import Constants from '../utils/constant.ets'; */ export function getAppLabel(labelId, bundleName) { return new Promise((resolve) => { - Resmgr.getResourceManager(bundleName).then(item => { + Resmgr.getResourceManager(globalThis.context, bundleName).then(item => { item.getString(labelId, (error, value) => { resolve(value); }) @@ -42,7 +43,7 @@ export function getAppLabel(labelId, bundleName) { */ export function getAppIcon(iconId, bundleName) { return new Promise((resolve) => { - Resmgr.getResourceManager(bundleName).then(item => { + Resmgr.getResourceManager(globalThis.context, bundleName).then(item => { item.getMediaBase64(iconId, (error, value) => { resolve(value); }) diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/application-secondary.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/application-secondary.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc4ae987b0fd3f00a73b1f7215c6caa461433ceb --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/application-secondary.ets @@ -0,0 +1,346 @@ +/* + * 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 router from '@system.router'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; + +import { backBar } from "../common/components/backBar"; +import { groups } from "../common/model/permissionGroup"; +import Constants from '../common/utils/constant'; + +var TAG = 'PermissionManager_MainAbility:' + +const allowedStatus = 0; // Status: Allowed +const bannedStatus = 1; // Status: Banned + +// Class Allowed +class AllowedObj { + groupName: string; + permission: string[]; + constructor(groupName: string, permission: string[]) { + this.groupName = groupName; + this.permission = permission; + } +} + +// Class Banned +class BannedObj { + groupName: string; + permission: string[]; + constructor(groupName: string, permission: string[]) { + this.groupName = groupName; + this.permission = permission; + } +} + +@Entry +@Component +struct appNamePlusPage { + @State allowedListItem: AllowedObj[] = []; // Array of allowed permissions + @State bannedListItem: BannedObj[] = []; // array of forbidden permissions + private routerData = router.getParams().routerData; // Routing jump data + + /** + * Initialize permission status information and group permission information + */ + async initialPermissions() { + var reqPermissions = this.routerData.permissions; + var reqGroupIds = this.routerData.groupId; + + if (!reqGroupIds.length) { + this.allowedListItem = []; + this.bannedListItem = []; + return; + } + + for (let i = 0; i < reqGroupIds.length; i++) { + let id = reqGroupIds[i]; + let groupName = groups[id].groupName; + let groupReqPermissons = []; + for (let j = 0; j < reqPermissions.length; j++) { + let permission = reqPermissions[j]; + if (groups[id].permissions.indexOf(permission) != -1) { + groupReqPermissons.push(permission) + } + } + let isGranted = true; + for (let i = 0; i < groupReqPermissons.length; i++) { + let permission = groupReqPermissons[i] + let res = await abilityAccessCtrl.createAtManager().verifyAccessToken( + this.routerData.tokenId, permission); + if (res != 0) { + isGranted = false; + } + } + + if (isGranted) { + this.allowedListItem.push(new AllowedObj(groupName, groupReqPermissons)); + } else { + this.bannedListItem.push(new BannedObj(groupName, groupReqPermissons)); + } + } + } + + /** + * Lifecycle function, triggered once when this page is displayed + */ + onPageShow() { + console.log(TAG + 'onPageShow application-secondary'); + + this.initialPermissions(); + } + + /** + * Lifecycle function, triggered once when this page disappears + */ + onPageHide() { + console.log(TAG + 'onPageHide application-secondary'); + + setTimeout(()=> { + this.allowedListItem = []; + this.bannedListItem = []; + }, Constants.DELAY_TIME) + } + + @Builder ListItemLayout(item, index, status) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Column() { + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text(item.groupName) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + }.margin({ top: Constants.FLEX_MARGIN_TOP, bottom: Constants.FLEX_MARGIN_BOTTOM }) + }.height(Constants.FULL_HEIGHT) + }.flexGrow(Constants.FLEX_GROW).constraintSize({ minHeight: Constants.CONSTRAINTSIZE_MINHEIGHT }) + Image($r('app.media.rightarrow')) + .objectFit(ImageFit.Contain) + .height(Constants.IMAGE_HEIGHT) + .width(Constants.IMAGE_WIDTH) + } + .width(Constants.FULL_WIDTH) + .height(Constants.LISTITEM_ROW_HEIGHT) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.FULL_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + } + } + }.onClick(() => { + if (status === 'allow') { + if (item.groupName == "其他权限") { + router.push({ + uri: 'pages/other-permissions', + params: { + routerData: this.routerData.bundleName, + backTitle: item.groupName, + permission: item.permission, + status: allowedStatus, + tokenId: this.routerData.tokenId + } + }); + } else { + router.push({ + uri: 'pages/application-tertiary', + params: { + routerData: this.routerData.bundleName, + backTitle: item.groupName, + permission: item.permission, + status: allowedStatus + } + }); + } + } + else if (status === 'banned') { + if (item.groupName == "其他权限") { + router.push({ + uri: 'pages/other-permissions', + params: { + routerData: this.routerData.bundleName, + backTitle: item.groupName, + permission: item.permission, + status: bannedStatus, + tokenId: this.routerData.tokenId + } + }); + } else { + router.push({ + uri: 'pages/application-tertiary', + params: { + routerData: this.routerData.bundleName, + backTitle: item.groupName, + permission: item.permission, + status: bannedStatus + } + }); + } + } + }) + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) + } + + build() { + Column(){ + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row({}) { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar({ title: JSON.stringify(this.routerData.labelId) }) + } + Row() { + Column() { + if (!this.allowedListItem.length && !this.bannedListItem.length) { + Row() { + List() { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Column() { + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text($r('app.string.no_permission')) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + }.margin({ top: Constants.FLEX_MARGIN_TOP, bottom: Constants.FLEX_MARGIN_BOTTOM }) + }.height(Constants.FULL_HEIGHT) + }.flexGrow(Constants.FLEX_GROW) + .constraintSize({minHeight: Constants.CONSTRAINTSIZE_MINHEIGHT }) + } + .width(Constants.FULL_WIDTH) + .height(Constants.LISTITEM_ROW_HEIGHT) + } + } + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) + } + .backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.margin({ top: Constants.ROW_MARGIN_TOP }) + .padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT }) + } else { + if (this.allowedListItem.length) { + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text($r('app.string.allowed')) + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .margin({ + top: Constants.SECONDARY_TEXT_MARGIN_TOP, + left: Constants.SECONDARY_LIST_PADDING_RIGHT + }) + } + } + Row() { + List() { + ForEach(this.allowedListItem.slice(Constants.SLICE_START, this.allowedListItem.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX, 'allow') + }, item => item.toString()) + ForEach(this.allowedListItem.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX, 'allow') + }, item => item.toString()) + } + .backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ + top: Constants.LIST_PADDING_TOP, + bottom: Constants.LIST_PADDING_BOTTOM, + right: Constants.SECONDARY_LIST_PADDING_RIGHT + }) + }.margin({ top: Constants.ROW_MARGIN_TOP }) + .padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT }) + } + if (this.bannedListItem.length) { + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text($r('app.string.banned')) + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .margin({ + top: Constants.SECONDARY_TEXT_MARGIN_TOP, + left: Constants.SECONDARY_LIST_PADDING_RIGHT + }) + } + } + Row() { + List() { + ForEach(this.bannedListItem.slice(Constants.SLICE_START, this.bannedListItem.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX, 'banned') + }, item => item.toString()) + ForEach(this.bannedListItem.slice(Constants.SLICE_END), (item) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX, 'banned') + }, item => item.toString()) + } + .backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ + top: Constants.LIST_PADDING_TOP, + bottom: Constants.LIST_PADDING_BOTTOM, + right: Constants.SECONDARY_LIST_PADDING_RIGHT + }) + }.margin({ top: Constants.ROW_MARGIN_TOP }) + .padding({ left: Constants.SECONDARY_LIST_PADDING_LEFT, right: Constants.SECONDARY_LIST_PADDING_RIGHT }) + } + } + } + .width(Constants.FULL_WIDTH) + .height(Constants.FULL_HEIGHT) + } + .layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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/settings/src/main/ets/pages/application-tertiary.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/application-tertiary.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b6c3941bc3aa568246102887fe1e22a24a6e7ad --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/application-tertiary.ets @@ -0,0 +1,379 @@ +/* + * 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 router from '@system.router'; +import bundle from "@ohos.bundle"; + +import { backBar } from "../common/components/backBar"; +import { getAppLabel, getAppIcon, verifyAccessToken } from "../common/utils/utils"; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import { authorizeDialog } from "../common/components/dialog"; +import { permissionDescriptions, permissionGroups } from "../common/model/permissionGroup"; +import Constants from '../common/utils/constant'; + +var TAG = 'PermissionManager_MainAbility:' + +let routerData = router.getParams().routerData; // Routing jump data +let backTitle = router.getParams().backTitle; // return title name +let status = router.getParams().status; // Status: Allowed, Forbidden +let permissions = router.getParams().permission; // permissions name +let nowGrantResult = Constants.PERMISSION_NUM; // Authorization results now +let nowRevokeResult = Constants.PERMISSION_NUM; // Now deauthorize results +let GrantResultFlag = []; // Authorization result Flag +let RevokeResultFlag = []; // Cancel authorization result Flag +class MeidaDocObj { + name: string + index: number + groupName: string + accessTokenId: string + permissions: [] + constructor( + name: string, + index: number, + groupName: string, + accessTokenId: string, + permissions: [] + ) { + this.name = name + this.index = index + this.groupName = groupName + this.accessTokenId = accessTokenId + this.permissions = permissions + } +}; // permission information class +class MediaListObj { + labelId: string + iconId: string + versionName: string + description: string + constructor( + labelId: string, + iconId: string, + versionName: string, + description: string + ) { + this.labelId = labelId + this.iconId = iconId + this.versionName = versionName + this.description = description + } +}; // Permission application information class + +@Entry +@Component +struct mediaDocumentPage { + build() { + Column() { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row() { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar({ title: JSON.stringify(backTitle) }) + } + Row() { + Column() { + mediaDocumentItem() + }.width(Constants.FULL_WIDTH) + } + .layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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) + } + } + } +} + +@Component +struct mediaDocumentItem { + @State mediaDocListItem: MeidaDocObj[] = []; // Permission information array + @State mediaListItem: MediaListObj = { + labelId: '', + iconId: '', + versionName: '', + description: '' + }; // application info array + @State isCheckList: boolean[] = []; // Permission status array + + authorizeDialogController: CustomDialogController = new CustomDialogController({ + builder: authorizeDialog({ }), + autoCancel: true, + alignment: DialogAlignment.Center + }); + + /** + * Grant permissions to the app + * @param {Number} accessTokenId + * @param {String} permission permission name + */ + grantUserGrantedPermission(accessTokenId, permission) { + abilityAccessCtrl.createAtManager().grantUserGrantedPermission( + accessTokenId, permission, Constants.PERMISSION_FLAG).then((result) => { + nowGrantResult = result; + }) + .catch((error) => { + console.error(TAG + 'grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Deauthorize the app + * @param {Number} accessTokenId + * @param {String} permission permission name + */ + revokeUserGrantedPermission(accessTokenId, permission) { + abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( + accessTokenId, permission, Constants.PERMISSION_FLAG).then((result) => { + nowRevokeResult = result; + }) + .catch((error) => { + console.error(TAG + 'revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Lifecycle function, executed when the page is initialized + */ + aboutToAppear() { + let permissionDescription = permissionDescriptions[backTitle]; + bundle.getBundleInfo(routerData, Constants.PARMETER_BUNDLE_FLAG).then(res => { + Promise.all([getAppLabel(res.appInfo.labelId, res.name), + getAppIcon(res.appInfo.iconId, res.name)]) + .then((values) => { + this.mediaListItem = new MediaListObj( + String(values[0]), String(values[1]), res.versionName, permissionDescription); + }) + this.mediaDocListItem.push( + new MeidaDocObj( + Constants.RADIO_ALLOW_NAME, + Constants.RADIO_ALLOW_INDEX, + Constants.RADIO_ALLOW_GROUP_NAME, + res.appInfo.accessTokenId, + permissions + ) + ); + this.mediaDocListItem.push( + new MeidaDocObj( + Constants.RADIO_BAN_NAME, + Constants.RADIO_BAN_INDEX, + Constants.RADIO_BAN_GROUP_NAME, + res.appInfo.accessTokenId, + permissions + ) + ); + }).catch((error) => { + console.error(TAG + 'bundle.getBundleInfo failed. Cause: ' + JSON.stringify(error)); + this.mediaListItem = new MediaListObj('', '', '', permissionDescription); + this.mediaDocListItem.push( + new MeidaDocObj(Constants.RADIO_ALLOW_NAME, Constants.RADIO_ALLOW_INDEX, + Constants.RADIO_ALLOW_GROUP_NAME, '', permissions) + ); + this.mediaDocListItem.push( + new MeidaDocObj(Constants.RADIO_BAN_NAME, Constants.RADIO_BAN_INDEX, + Constants.RADIO_BAN_GROUP_NAME, '', permissions) + ); + }) + // Get permission status + if (!status) { + this.isCheckList = [true, false]; + } else { + this.isCheckList = [false, true]; + } + } + + build(){ + Column() { + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Image(this.mediaListItem.iconId) + .width(Constants.TERTIARY_IMAGE_WIDTH) + .height(Constants.TERTIARY_IMAGE_HEIGHT) + .margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT }) + Column() { + Row() { + Text(this.mediaListItem.labelId) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .textAlign(TextAlign.Start) + } + .width(Constants.TERTIARY_HALF_WIDTH) + Row() { + Text(this.mediaListItem.versionName) + .fontSize(Constants.TEXT_SMALLER_FONT_SIZE) + .textAlign(TextAlign.Start) + } + .width(Constants.TERTIARY_HALF_WIDTH) + } + } + } + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Text() + .fontSize(Constants.TEXT_SMALLER_FONT_SIZE) + .textAlign(TextAlign.Start) + }.margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT }) + } + } + .margin({ top: Constants.TERTIARY_ROW_MARGIN_TOP }) + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Text(backTitle + "访问权限") + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .textAlign(TextAlign.Start) + }.margin({ left: Constants.TERTIARY_IMAGE_MARGIN_LEFT, right: Constants.TERTIARY_IMAGE_MARGIN_RIGHT }) + } + } + .height(Constants.LISTITEM_ROW_HEIGHT) + .margin({ top: Constants.TERTIARY_PERMISSION_ROW_MARGIN_TOP }) + Column() { + List() { + ForEach(this.mediaDocListItem, (item) => { + ListItem() { + Column() { + Row() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Text(item.name) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + if (this.isCheckList[item.index] === true) { + Image($r('app.media.radioactive')) + .width(Constants.TERTIARY_RADIO_IMAGE_WIDTH) + .height(Constants.TERTIARY_RADIO_IMAGE_HEIGHT) + .margin({ + top: Constants.TERTIARY_RADIO_IMAGE_MARGIN_TOP + }) + } else if (this.isCheckList[item.index] === false) { + Image($r('app.media.radiodefault')) + .width(Constants.TERTIARY_RADIO_IMAGE_WIDTH) + .height(Constants.TERTIARY_RADIO_IMAGE_HEIGHT) + .margin({ + top: Constants.TERTIARY_RADIO_IMAGE_MARGIN_TOP + }) + } + } + .backgroundColor($r('app.color.default_background_color')) + .width(Constants.FULL_WIDTH) + .height(Constants.LISTITEM_ROW_HEIGHT) + .onClick(() => { + item.permissions.forEach((permission) => { + if (!item.index) { + this.grantUserGrantedPermission(item.accessTokenId, permission) + if (nowGrantResult != Constants.PERMISSION_INDEX) { + GrantResultFlag.push(-1) + }else{ + GrantResultFlag.push(0) + } + } else { + this.revokeUserGrantedPermission(item.accessTokenId, permission) + if (nowRevokeResult != Constants.PERMISSION_INDEX) { + RevokeResultFlag.push(-1) + this.authorizeDialogController.open(); + setTimeout(()=> { + this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + }else{ + RevokeResultFlag.push(0) + } + } + }) + if (!item.index) { + if(GrantResultFlag.indexOf(-1) > -1){ + this.authorizeDialogController.open(); + setTimeout(()=> { + this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + }else{ + this.isCheckList = [true, false]; + } + }else{ + if (RevokeResultFlag.indexOf(-1) > -1){ + this.authorizeDialogController.open(); + setTimeout(()=> { + this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + }else{ + this.isCheckList = [false, true]; + } + } + }) + } + } + if (!item.index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.FULL_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + } + } + } + .onClick(() => { + }) + } + .padding({ + left: Constants.TERTIARY_LISTITEM_PADDING_LEFT, + right: Constants.TERTIARY_LISTITEM_PADDING_RIGHT + }) + .margin({ top: Constants.TERTIARY_LISTITEM_MARGIN_TOP }) + }, item => item.toString()) + } + .borderRadius(Constants.BORDER_RADIUS) + .backgroundColor($r('app.color.default_background_color')) + .padding({ + top: Constants.TERTIARY_LIST_PADDING_TOP, bottom: Constants.TERTIARY_LIST_PADDING_BOTTOM + }) + } + .padding({ + left: Constants.LIST_PADDING_LEFT, + right: Constants.LIST_PADDING_LEFT + }) + .width(Constants.FULL_WIDTH) + .height(Constants.FULL_HEIGHT) + } + .width(Constants.FULL_WIDTH) + } +} diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-management.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-management.ets new file mode 100644 index 0000000000000000000000000000000000000000..125762562f3d28414dc613c0553543970096e802 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-management.ets @@ -0,0 +1,694 @@ +/* + * 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 router from '@system.router'; +import bundle from "@ohos.bundle"; +import Resmgr from '@ohos.resourceManager'; + +import { backBar } from "../common/components/backBar"; +import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex"; +import { textInput } from "../common/components/search"; +import { groups, userGrantPermissions,permissionGroupPermissions } from "../common/model/permissionGroup"; +import { permissionGroups, permissionPermissionGroup, permissionGroupIds, noneIconApp } from "../common/model/permissionGroup"; +import { makePy } from "../common/utils/utils"; +import Constants from '../common/utils/constant'; + +var TAG = 'PermissionManager_MainAbility:' + +@Extend(Image) function customizeImage(width: number, height: number) { + .objectFit(ImageFit.Contain) + .width(width) + .height(height) +}; + +interface applicationPermissions { + 'bundleName': string, + 'iconId': string, + 'permissions': string[], + 'labelId': string, + 'tokenId': number, + 'groupId': number[] +}; + +interface permissionApplications { + 'permission': string, + 'groupName': string, + 'bundleNames': string[], + 'icon': string +}; + +interface groupPermission { + 'group': string, + 'permissions': string[], + 'groupName': string, + 'icon': string, + 'isShow':boolean +}; + +let bundleInfosList: any[] = []; // Permission information array + +@Entry +@Component +struct authorityManagementPage { + @State allApplicationPermissions: applicationPermissions[] = []; // All permissions apply + @State allPermissions: string[] = []; // All permissions + @State allSystemPermissions: string[] = []; // All system permissions + @State allUserPermissions: string[] = []; // All user rights + @State allPermissionApplications: permissionApplications [] = [] // All app permissions + @State allGroups: string[] = [] // All groups + @State allGroupPermission: groupPermission[] = [] // All group permissions + + /** + * Convert the permission array into key, value key-value objects for easy sorting + * @param {Array} order User rights + * @return {Object} return the processed object + */ + orderDict(order) { + let result = {}; + for (let i = 0; i < order.length; i++) { + let key = order[i]; + result[key] = i; + } + return result; + } + + /** + * Compare and sort the permission array according to the permission key value + * @param {String} prop Sort by permission + * @param {Object} orderSort objects to be sorted + * @return {Array} Returns a sorted array of permissions + */ + compare(prop, orderSort) { + return function(a, b) { + let aSortValue = orderSort[a[prop]]; + let bSortValue = orderSort[b[prop]]; + if (aSortValue == undefined) { + throw new Error('当前的字段不在排序列表里:' + a[prop]); + } + if (bSortValue == undefined) { + throw new Error('当前的字段不在排序列表里:' + b[prop]); + } + return aSortValue - bSortValue; + } + } + + /** + * Get all app permission information + * @param {Array} allPermissions All permissions + * @param {Object} allApplicationPermissions All app permissions + */ + getAllBundlePermissions(allPermissions: string[], allApplicationPermissions: applicationPermissions[]) { + bundle.getAllBundleInfo(Constants.PARMETER_BUNDLE_FLAG).then(async(res) => { + const bundleInfos = res; + var count = bundleInfos.length; + + if (count <= 0) { + console.info(TAG + 'bundle.getAllBundleInfo result.length less than or equal to zero'); + return; + } + + var infoIndex = 0; + for (let i = 0; i < count; i++) { + // filter none icon application + try { + const ret = await bundle.queryAbilityByWant({ + bundleName: bundleInfos[i].name, + action: "action.system.home", + entities: ["entity.system.home"] + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION, Constants.USERID); + } catch(e) { + continue; + } + + // filter none icon app with skills + if (noneIconApp.indexOf(bundleInfos[i].name) != -1) { + continue; + } + + var info = bundleInfos[i]; + + this.deduplicationPermissions(info, allPermissions, allApplicationPermissions); + this.updateAppLabel(infoIndex, info.name, info.appInfo.label); + this.updateAppIcon(infoIndex, info.name); + + infoIndex = infoIndex + 1; + } + + this.getAllPermissionApplications(); + + let orderSort = this.orderDict(userGrantPermissions); + this.allPermissionApplications.sort(this.compare('permission', orderSort)); + this.getAllGroupPermission(); + + bundleInfosList = this.allApplicationPermissions; + bundleInfosList.forEach((item) => { + if (!isNaN(item.labelId)) { + item.alphabeticalIndex = ''; + } else { + item.alphabeticalIndex = makePy(item.labelId)[0].slice(0, 1); // Get the first letter in the returned initials array + } + }) + }) .catch((error) => { + console.error(TAG + 'bundle.getAllBundleInfo failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Get the corresponding permission group id according to the permission + * @param {String} permission app name id + * @return {Number} groupId + */ + getPermissionGroupByPermission(permission: string) { + for (let i = 0; i < permissionGroups.length; i++) { + if (permissionGroups[i].permissionName == permission) { + return groups[permissionGroups[i].groupId]; + } + } + } + + /** + * Get all app permission information + */ + getAllPermissionApplications() { + const this_ = this; + var leng = this_.allPermissions.length; + if (leng > 0) { + for (let i = 0; i < leng; i++) { + if (userGrantPermissions.indexOf(this_.allPermissions[i]) == -1) { + this_.allSystemPermissions.push(this_.allPermissions[i]); + } else { + this_.allUserPermissions.push(this_.allPermissions[i]); + } + } + } + for (let i = 0; i < this_.allUserPermissions.length; i++) { + var permissionGroup = this_.getPermissionGroupByPermission(this_.allUserPermissions[i]); + var icon: string = permissionGroup.icon; + var bundleNames: string[] = []; + for (let j = 0; j < this_.allApplicationPermissions.length; j++) { + if (this_.allApplicationPermissions[j].permissions.indexOf(this_.allUserPermissions[i]) != -1) { + bundleNames.push(this_.allApplicationPermissions[j].bundleName); + } + } + var pa: permissionApplications = { + 'permission': this_.allUserPermissions[i], + 'groupName': permissionGroup.name, + 'bundleNames': bundleNames, + 'icon': icon + }; + this_.allPermissionApplications.push(pa); + } + } + + /** + * Get permission group information + */ + getAllGroupPermission() { + const this_ = this; + var temp1 = []; + temp1 = ["LOCATION","CAMERA","MICROPHONE","MEDIA","CALENDAR","SPORT","HEALTH"]; + groups.forEach((item) => { + if (temp1.indexOf(item.name) > -1) { + var gp: groupPermission = { + "group": item.name, + "permissions": item.permissions, + 'groupName': item.groupName, + 'icon': item.icon, + 'isShow': item.isShow + }; + this_.allGroupPermission.push(gp); + } + }) + let temp2 = []; + groups.forEach((item) => { + if (item.isShow && temp1.indexOf(item.name) === -1) { + var gp: groupPermission = { + "group": item.name, + "permissions": item.permissions, + 'groupName': item.groupName, + 'icon': item.icon, + 'isShow': item.isShow + }; + temp2.push(item.name); + this_.allGroupPermission.push(gp); + } + }) + for (let i = 0; i < this_.allPermissionApplications.length; i++) { + if (this_.allGroups.indexOf(this_.allPermissionApplications[i].groupName) == -1 + && temp1.indexOf(this_.allPermissionApplications[i].groupName) == -1) { + this_.allGroups.push(this_.allPermissionApplications[i].groupName); + } + } + // Permission layout + var temp = this_.allGroups; + temp = temp.filter(function(item) { + return temp1.indexOf(item) == -1 && temp2.indexOf(item) == -1; + }); + if (temp.indexOf("OTHER") > -1) { + temp.splice(temp.indexOf("OTHER"),1); + temp.push("OTHER"); + }else { + temp.push("OTHER"); + } + this_.allGroups = temp; + for (let i = 0; i < this_.allGroups.length; i++) { + var permissions: string[] = permissionGroupPermissions[this_.allGroups[i]]; + var gp: groupPermission = { + "group": this_.allGroups[i], + "permissions": permissions, + 'groupName': '', + 'icon': '', + 'isShow': false + }; + this_.allGroupPermission.push(gp); + } + this.allGroupPermission.forEach((ele) => { + groups.forEach((item) => { + if (ele.group === item.name) { + ele.groupName = item.groupName; + ele.icon = item.icon; + ele.isShow = item.isShow; + } + }); + }) + } + + /** + * Deduplicate permission information and permission group information + * @param {Object} info bundleInfos Application Information + * @param {Array} allPermissions All permissions + * @param {Array} allApplicationPermissions All permissions apply + */ + deduplicationPermissions(info, allPermissions, allApplicationPermissions) { + var reqPermissionsLen = info.reqPermissions.length; + var reqUserPermissions: string[] = []; + if (reqPermissionsLen > 0) { + for (let j = 0; j < info.reqPermissions.length; j++) { + var permission = info.reqPermissions[j]; + if (allPermissions.indexOf(permission) == -1) { + allPermissions.push(permission); + } + if (userGrantPermissions.indexOf(permission) != -1) { + reqUserPermissions.push(permission); + } + } + } + let dePermissions = []; + let groupIds = []; + for (let i = 0; i < reqUserPermissions.length; i++) { + if(dePermissions.indexOf(permissionPermissionGroup[reqUserPermissions[i]]) == -1){ + dePermissions.push(permissionPermissionGroup[reqUserPermissions[i]]); + } + if(groupIds.indexOf(permissionGroupIds[reqUserPermissions[i]]) == -1){ + groupIds.push(permissionGroupIds[reqUserPermissions[i]]); + } + } + + // adapt different api + if (info.compatibleVersion >= Constants.MODULE_JSON_VERSION) { + info.appInfo.iconId = info.hapModuleInfos[0].abilityInfo[0].iconId; + } + + var ap: applicationPermissions = { + 'bundleName': info.name, + 'tokenId': info.appInfo.accessTokenId, + 'iconId': info.appInfo.iconId, + 'labelId': info.appInfo.labelId, + 'permissions': reqUserPermissions, + 'groupId': groupIds + }; + allApplicationPermissions.push(ap); + } + + /** + * Get app name resource + * @param {Number} index index of all app permissions array + * @param {String} bundleName Package names + * @param {String} labelName Application Name + */ + updateAppLabel(index, bundleName, labelName) { + Resmgr.getResourceManager(globalThis.context, bundleName).then(item => { + if (index >= this.allApplicationPermissions.length) { + return; + } + var info = this.allApplicationPermissions[index]; + item.getString(info['labelId']).then(value => { + if (value == undefined) { + info['labelId'] = labelName; + } else { + info['labelId'] = value; + } + }).catch(error => { + console.error(TAG + bundleName + 'Resmgr.getString failed. Cause: ' + JSON.stringify(error)); + }) + }).catch(error => { + console.error(TAG + bundleName + 'Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Get app icon resources + * @param {Number} index index of all app permissions array + * @param {String} bundleName Package names + */ + updateAppIcon(index, bundleName) { + Resmgr.getResourceManager(globalThis.context, bundleName).then(item => { + if (index >= this.allApplicationPermissions.length) { + return; + } + var info = this.allApplicationPermissions[index]; + item.getMediaBase64(info['iconId']).then(value => { + info['iconId'] = value; + }).catch(error => { + console.error(TAG + bundleName + 'Resmgr.getMediaBase64 failed. Cause: ' + JSON.stringify(error)); + }) + }).catch(error => { + console.error(TAG + bundleName + 'Resmgr.getResourceManager failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Lifecycle function, executed when the page is initialized + */ + aboutToAppear() { + console.log(TAG + 'on aboutToAppear in authority-management, version ' + Constants.PERMISSION_MANAGER_VERSION); + + this.getAllBundlePermissions(this.allPermissions, this.allApplicationPermissions); + } + + /** + * dump all permissionApplications + */ + dumpAllPermissionApplications() { + this.allPermissionApplications.forEach(permissionApplication => { + console.log(TAG + 'permissionApplication is ' + JSON.stringify(permissionApplication)); + }) + } + + /** + * dump all applicationPermissions + */ + dumpAllApplicationPermissions() { + this.allApplicationPermissions.forEach(applicationPermission => { + console.log(TAG + 'applicationPermission is ' + JSON.stringify(applicationPermission)); + }) + } + + /** + * dump all group permission + */ + dumpAllGroupPermission() { + this.allGroupPermission.forEach(groupPermission => { + console.log(TAG + 'groupPermission is ' + JSON.stringify(groupPermission)); + }) + return true; + } + + dumpItem(item) { + console.log(TAG + "item is " + JSON.stringify(item)); + + return true; + } + + build() { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row() { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar( { title: JSON.stringify($r('app.string.authority_management')) }) + } + Row() { + Column() { + Column() { + Stack() { + Tabs() { + TabContent() { + Row() { + Column() { + Scroll() { + Row() { + List() { + ForEach(this.allGroupPermission.slice(Constants.SLICE_START, + this.allGroupPermission.length - 1), (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.allGroupPermission.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + }.backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.padding({ + left: Constants.MANAGEMENT_ROW_PADDING_LEFT, + right: Constants.MANAGEMENT_ROW_PADDING_RIGHT, + top: Constants.MANAGEMENT_ROW_PADDING_TOP + }) + } + }.width(Constants.FULL_WIDTH) + } + }.tabBar($r('app.string.authority')) + TabContent() { + applicationItem({ + applicationItem: bundleInfosList, + oldApplicationItem: bundleInfosList + }) + }.tabBar($r('app.string.application')) + } + .barWidth(Constants.BAR_WIDTH) + .barMode(BarMode.Fixed) + }.height(Constants.FULL_HEIGHT) + } + } + } + .layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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) + } + } + + @Builder ListItemLayout(item, index) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Image(item.icon) + .customizeImage(Constants.MANAGEMENT_IMAGE_WIDTH, Constants.MANAGEMENT_IMAGE_HEIGHT) + .margin({ right: Constants.MANAGEMENT_IMAGE_MARGIN_RIGHT }) + Text(item.groupName) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + Image($r('app.media.rightarrow')) + .customizeImage(Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT) + } + .width(Constants.FULL_WIDTH) + .height(Constants.MANAGEMENT_ROW_HEIGHT) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.MANAGEMENT_TEXT_DECORATION_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + .margin({ left: Constants.MANAGEMENT_TEXT_DECORATION_MARGIN_LEFT }) + } + } + }.onClick(() => { + if (item.groupName === '其他权限' || item.groupName === '电话' || item.groupName === '通讯录' || item.groupName === '信息' + || item.groupName === '通话记录' || item.groupName === '日历') { + router.push({ + uri: 'pages/authority-secondary', + params: { routerData: this.allPermissionApplications, backTitle: item.groupName } + }) + } else { + var dataList = this.allPermissionApplications.filter((ele) => { + return ele.groupName === item.group + }) + + router.push({ + uri: 'pages/authority-tertiary-groups', + params: { routerData: dataList, backTitle: item.groupName } + }) + } + }) + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.MANAGEMENT_ROW_PADDING_RIGHT }) + } +} + +@Component +struct applicationItem { + @State applicationItem: any[] = bundleInfosList // application info array + @State oldApplicationItem: any[] = bundleInfosList // Original application information array + @State searchResult: boolean = true // search results + + /** + * dump application item + */ + dumpApplicationItem() { + this.applicationItem.forEach(application => { + console.log(TAG + 'application is ' + JSON.stringify(application)); + }) + return true; + } + + @Builder ListItemLayout(item, index) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Image(item.iconId) + .customizeImage(Constants.APPLICATION_IMAGE_WIDTH, Constants.APPLICATION_IMAGE_HEIGHT) + .margin({ right: Constants.APPLICATION_IMAGE_MARGIN_RIGHT }) + Text(item.labelId) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + Text(item.groupId.length + '项权限') + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .fontColor($r('app.color.text_secondary_color')) + .margin({ right: Constants.APPLICATION_TEXT_MARGIN_RIGHT }) + Image($r('app.media.rightarrow')) + .customizeImage(Constants.IMAGE_WIDTH, Constants.IMAGE_HEIGHT) + } + .width(Constants.FULL_WIDTH) + .height(Constants.AUTHORITY_ROW_HEIGHT) + .constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT }) + .padding({ left: Constants.APPLICATION_LIST_PADDING_LEFT}) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.APPLICATION_TEXT_DECORATION_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + .margin({ left: Constants.APPLICATION_TEXT_DECORATION_MARGIN_LEFT }) + } + } + }.onClick(() => { + router.push({ + uri: 'pages/application-secondary', + params: { routerData: item } + }); + }) + } + }.padding({ + left: Constants.APPLICATION_LISTITEM_PADDING_LEFT, + right: Constants.APPLICATION_LISTITEM_PADDING_RIGHT + }) + } + + build() { + Column() { + Row() { + textInput({ + placeholder: Constants.RESOURCE_FIX_SEARCH, + applicationItem: $applicationItem, + oldApplicationItem: $oldApplicationItem, + searchResult: $searchResult + }) + }.padding({ + left: Constants.APPLICATION_TEXTINPUT_PADDING_LEFT, + top: Constants.APPLICATION_TEXTINPUT_PADDING_TOP, + right: Constants.APPLICATION_TEXTINPUT_PADDING_RIGHT + }) + Scroll() { + Row() { + Flex({ alignItems: ItemAlign.Start }) { + Column() { + if (!this.applicationItem.length) { + if (this.searchResult) { + Row() { + List() { + ForEach(this.applicationItem.slice(Constants.SLICE_START, this.applicationItem.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.applicationItem.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + }.backgroundColor($r('app.color.default_background_color')).borderRadius(Constants.BORDER_RADIUS) + }.margin({ top: Constants.MANAGEMENT_ROW_MARGIN_TOP }) + .padding({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT }) + } else { + Row() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.searchnoresult')) + .customizeImage(Constants.SEARCHNORESULT_IMAGE_WIDTH, Constants.SEARCHNORESULT_IMAGE_HEIGHT) + } + }.margin({ top: Constants.MANAGEMENT_ROW_MARGIN_TOP }) + .padding({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT }) + } + } else { + Row() { + List() { + ForEach(this.applicationItem.slice(Constants.SLICE_START, this.applicationItem.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.applicationItem.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + }.backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.margin({ top: Constants.MANAGEMENT_ROW_MARGIN_TOP }) + .padding({ left: Constants.MANAGEMENT_ROW_PADDING_LEFT }) + } + } + .backgroundColor($r('app.color.background_color')) + .height(Constants.APPLICATION_COLUMN_HEIGHT) + Column() { + alphabetIndexerComponent({ applicationItem: $applicationItem, oldApplicationItem: $oldApplicationItem }) + } + .margin({ top: Constants.APPLICATION_ALPHABETINDEX_MARGIN_TOP }) + .width(Constants.APPLICATION_ALPHABETINDEX_WIDTH) + } + } + } + } + } +} diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-secondary.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-secondary.ets new file mode 100644 index 0000000000000000000000000000000000000000..b579100047eb5b3bdcf430e34a7e4aa51069abe7 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-secondary.ets @@ -0,0 +1,177 @@ +/* + * 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 router from '@system.router'; +import Constants from '../common/utils/constant'; + +import { backBar } from "../common/components/backBar"; +import { permissionGroups, groups } from "../common/model/permissionGroup"; + +var TAG = 'PermissionManager_MainAbility:' + +class CalendarObj { + permissionName: string + groupName: string + description: string + label: string + index: number + constructor(permissionName: string, groupName: string, description: string, label: string, index: number) { + this.permissionName = permissionName + this.groupName = groupName + this.description = description + this.label = label + this.index = index + } +} // Permission management secondary interface data class + +@Entry +@Component +struct appNamePage { + private backTitle = router.getParams().backTitle; // return title name + + build() { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row() { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar({ title: JSON.stringify(this.backTitle) }) + } + Row() { + Column() { + Scroll() { + appNameItem() + } + } + }.layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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) + } + } +} + +@Component +struct appNameItem { + @State calendarListItem: CalendarObj[] = []; // Permission management secondary interface data array + private routerData = router.getParams().routerData; // Routing jump data + private backTitle = router.getParams().backTitle; // return title name + private allPermissionApplications = router.getParams().allPermissionApplications; // Array of all app permission names + + @Builder ListItemLayout(item, index) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Text(item.label) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + Image($r('app.media.rightarrow')) + .objectFit(ImageFit.Contain) + .height(Constants.IMAGE_HEIGHT) + .width(Constants.IMAGE_WIDTH) + } + .width(Constants.FULL_WIDTH) + .height(Constants.LISTITEM_ROW_HEIGHT) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.FULL_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + } + } + }.onClick(() => { + var dataList = this.routerData.filter((ele) => { + return ele.groupName === item.groupName; + }) + router.push({ + uri: 'pages/authority-tertiary', + params: { routerData: [dataList[item.index]], backTitle: item.label } + }); + }) + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) + } + + /** + * Lifecycle function, executed when the page is initialized + */ + aboutToAppear() { + var permissionsList = groups.filter((item) => { + return item.groupName === this.backTitle + }) + for (let i = 0; i < permissionsList[0].permissions.length; i++) { + permissionGroups.forEach((item) => { + if (item.permissionName === permissionsList[0].permissions[i]) { + this.calendarListItem.push( + new CalendarObj(item.permissionName, item.groupName, item.description, item.label, i) + ) + } + }) + } + } + + build() { + Row() { + Column() { + Row() { + List() { + ForEach(this.calendarListItem.slice(Constants.SLICE_START, this.calendarListItem.length - 1), (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.calendarListItem.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + }.backgroundColor($r('app.color.default_background_color')).borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.margin({ top: Constants.ROW_MARGIN_TOP }) + .padding({ left: Constants.LIST_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) + } + .width(Constants.FULL_WIDTH) + .height(Constants.FULL_HEIGHT) + } + } +} diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-tertiary-groups.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-tertiary-groups.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3697126aa6c5300698133b9f0725c68cc1d976f --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-tertiary-groups.ets @@ -0,0 +1,388 @@ +/* + * 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 router from '@system.router'; +import bundle from "@ohos.bundle"; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; + +import { backBar } from "../common/components/backBar"; +import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex"; +import { textInput } from "../common/components/search"; +import { getAppLabel, getAppIcon, verifyAccessToken} from "../common/utils/utils"; +import { makePy } from "../common/utils/utils"; +import { authorizeDialog } from "../common/components/dialog"; +import Constants from '../common/utils/constant'; + +var TAG = 'PermissionManager_MainAbility:' + +@Extend(Image) function customizeImage(width: number, height: number) { + .objectFit(ImageFit.Contain) + .width(width) + .height(height) +} + +let routerData = router.getParams().routerData; // Routing jump data +let backTitle = router.getParams().backTitle; // return title name + +class ApplicationObj { + labelId: string + iconId: string + index: number + accessTokenId: number + permission: string + alphabeticalIndex: string + constructor( + labelId: string, + iconId: string, + index: number, + accessTokenId: number, + permission: string, + alphabeticalIndex: string) { + this.labelId = labelId + this.iconId = iconId + this.index = index + this.accessTokenId = accessTokenId + this.permission = permission + this.alphabeticalIndex = alphabeticalIndex + } +} // application information + +@Entry +@Component +struct locationInfoPage { + build() { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row() { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar({ title: JSON.stringify(backTitle) }) + } + Row() { + Column() { + applicationItem() + + }.width(Constants.FULL_WIDTH) + } + .layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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) + } + } +} + +@Component +struct applicationItem { + @State permissionNum: number = Constants.PERMISSION_NUM; // permission num + @State toggleIsOn: object = {}; // toggle switch state array + @State applicationList: ApplicationObj[] = []; // application info array + @State oldApplicationItem: ApplicationObj[] = []; // Original application information array + @State searchResult: boolean = true; // search results + + authorizeDialogController: CustomDialogController = new CustomDialogController({ + builder: authorizeDialog({ }), + autoCancel: true, + alignment: DialogAlignment.Center + }); + + @Builder ListItemLayout(item, index) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Image(item.iconId) + .customizeImage(Constants.AUTHORITY_IMAGE_WIDTH, Constants.AUTHORITY_IMAGE_HEIGHT) + .margin({ right: Constants.AUTHORITY_IMAGE_MARGIN_RIGHT }) + Text(item.labelId) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] }) + .selectedColor($r('app.color.toggle_color')) + .width(Constants.AUTHORITY_TOGGLE_WIDTH) + .height(Constants.AUTHORITY_TOGGLE_HEIGHT) + .onChange((isOn: boolean) => { + if (item.accessTokenId === '' || item.permission === '') { + return; + } + let _this = this; + if (isOn) { + let promises = routerData.map(it => new Promise((resolve, reject) => { + _this.grantUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); + })); + Promise.all(promises).then(function(results) { + if(results.indexOf(-1) != -1) { + _this.authorizeDialogController.open(); + _this.toggleIsOn[item.index] = false; + setTimeout(()=> { + _this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + } else { + _this.toggleIsOn[item.index] = true; + } + let num = Constants.PERMISSION_NUM; + for(let key in _this.toggleIsOn){ + if(_this.toggleIsOn[key]){ + num++; + } + } + _this.permissionNum = num; + }); + } else { + let promises = routerData.map(it => new Promise((resolve, reject) => { + _this.revokeUserGrantedPermission(item.accessTokenId, it.permission, item.index, resolve); + })); + Promise.all(promises).then(function(results) { + if(results.indexOf(-1) != -1) { + _this.authorizeDialogController.open(); + _this.toggleIsOn[item.index] = true; + setTimeout(()=> { + _this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + } else { + _this.toggleIsOn[item.index] = false; + } + let num = Constants.PERMISSION_NUM; + for(let key in _this.toggleIsOn){ + if(_this.toggleIsOn[key]){ + num++; + } + } + _this.permissionNum = num; + }); + } + }) + } + .width(Constants.FULL_WIDTH) + .height(Constants.AUTHORITY_ROW_HEIGHT) + .constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT }) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.AUTHORITY_TEXT_DECORATION_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + .margin({ left: Constants.AUTHORITY_TEXT_DECORATION_MARGIN_LEFT }) + } + } + }.onClick(() => { + }) + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.AUTHORITY_LISTITEM_PADDING_RIGHT }) + } + + /** + * Grant permissions to the app + * @param {Number} accessTokenId + * @param {String} permission permission name + * @param {Number} index Array index to modify permission status + */ + grantUserGrantedPermission(accessTokenId, permission, index, resolve) { + abilityAccessCtrl.createAtManager().grantUserGrantedPermission( + accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { + // result: 0 Authorization succeeded; result: -1 Authorization failed + resolve(result); + }).catch(error => { + resolve(-1); + console.error(TAG + 'abilityAccessCtrl.createAtManager.grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Deauthorize the app + * @param {Number} accessTokenId + * @param {String} permission permission name + * @param {Number} index Array index to modify permission status + */ + revokeUserGrantedPermission(accessTokenId, permission, index, resolve) { + abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( + accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { + // result: 0 successfully cancel the authorization; result: -1 cancel the authorization failed + resolve(result); + }).catch(error => { + resolve(-1); + console.error(TAG + 'abilityAccessCtrl.createAtManager.revokeUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Lifecycle function, executed when the page is initialized + */ + aboutToAppear() { + var bundleNames = [] + routerData.forEach(permissionApplication => { + permissionApplication.bundleNames.forEach( bundleName => { + if (bundleNames.indexOf(bundleName) == -1) { + bundleNames.push(bundleName) + } + }) + }) + for (let i = 0; i < bundleNames.length; i++) { + // Get BundleInfo based on bundle name + bundle.getBundleInfo(bundleNames[i], Constants.PARMETER_BUNDLE_FLAG).then(res => { + Promise.all([getAppLabel(res.appInfo.labelId, res.name), + getAppIcon(res.appInfo.iconId, res.name) + ]) + .then((values) => { + this.applicationList.push( + new ApplicationObj( + String(values[0]), + String(values[1]), + i, + res.appInfo.accessTokenId, + routerData[0].permission, + makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array + ); + this.oldApplicationItem.push( + new ApplicationObj( + String(values[0]), + String(values[1]), + i, + res.appInfo.accessTokenId, + routerData[0].permission, + makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array + ); + this.applicationList.sort((a,b) => a.index - b.index) + this.oldApplicationItem.sort((a,b) => a.index - b.index) + }); + // 0: have permission; -1: no permission + var boole = true; + this.permissionNum++; + for (let j = 0; j < routerData.length; j++) { + if (res.reqPermissions.indexOf(routerData[j].permission) == -1) { + continue + } + verifyAccessToken(res.appInfo.accessTokenId, routerData[j].permission).then((access) => { + if (Number(access) === Constants.PERMISSION_INDEX) { + if(boole){ + this.toggleIsOn[i] = true; + } + } else { + if(boole){ + this.permissionNum-- + } + boole = false; + this.toggleIsOn[i] = false; + } + }); + } + }).catch(() => { + this.applicationList.push( + new ApplicationObj('', '', 0, 0, '', '') + ); + this.oldApplicationItem.push( + new ApplicationObj('', '', 0, 0, '', '') + ); + }) + } + } + + build() { + Column() { + Row() { + textInput({ + placeholder: Constants.RESOURCE_FIX_SEARCH, + applicationItem: $applicationList, + oldApplicationItem: $oldApplicationItem, + searchResult: $searchResult + }) + }.padding({ + left: Constants.AUTHORITY_TEXTINPUT_PADDING_LEFT, + right: Constants.AUTHORITY_TEXTINPUT_PADDING_RIGHT + }) + Row() { + Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) { + Column() { + Flex({ justifyContent: FlexAlign.Start }) { + Text(this.permissionNum + '个应用获取此权限') + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .fontColor($r('app.color.secondary_font_color')) + .margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP, left: Constants.AUTHORITY_TEXT_MARGIN_LEFT }) + } + Scroll() { + Row() { + Column() { + if (!this.applicationList.length) { + if (this.searchResult) { + Row() { + }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) + } else { + Row() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.searchnoresult')) + .customizeImage(Constants.SEARCHNORESULT_IMAGE_WIDTH, Constants.SEARCHNORESULT_IMAGE_HEIGHT) + } + }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) + } + } else { + Row() { + List() { + ForEach(this.applicationList.slice(Constants.SLICE_START, this.applicationList.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.applicationList.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + } + .backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) + } + }.width(Constants.FULL_WIDTH) + .height(Constants.AUTHORITY_COLUMN_HEIGHT) + } + } + }.padding({ left: Constants.AUTHORITY_LISTITEM_PADDING_LEFT }) + Column() { + alphabetIndexerComponent({ applicationItem: $applicationList, oldApplicationItem: $oldApplicationItem }) + }.width(Constants.AUTHORITY_ALPHABETINDEX_WIDTH) + .padding({ top: Constants.AUTHORITY_ALPHABETINDEX_PADDING_TOP }) + } + } + } + } +} diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-tertiary.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-tertiary.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb9188f9b8cacb03c82a011eb8610754561dbd15 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/authority-tertiary.ets @@ -0,0 +1,350 @@ +/* + * 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 router from '@system.router'; +import bundle from "@ohos.bundle"; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; + +import { backBar } from "../common/components/backBar"; +import { alphabetIndexerComponent } from "../common/components/alphabeticalIndex"; +import { textInput } from "../common/components/search"; +import { getAppLabel, getAppIcon, verifyAccessToken } from "../common/utils/utils"; +import { makePy } from "../common/utils/utils"; +import { authorizeDialog } from "../common/components/dialog"; +import Constants from '../common/utils/constant'; + +var TAG = 'PermissionManager_MainAbility:' + +@Extend(Image) function customizeImage(width: number, height: number) { + .objectFit(ImageFit.Contain) + .width(width) + .height(height) +} + +let routerData = router.getParams().routerData; // Routing jump data +let backTitle = router.getParams().backTitle; // return title name +class ApplicationObj { + labelId: string + iconId: string + index: number + accessTokenId: string + permission: string + alphabeticalIndex: string + constructor( + labelId: string, + iconId: string, + index: number, + accessTokenId: string, + permission: string, + alphabeticalIndex: string) { + this.labelId = labelId + this.iconId = iconId + this.index = index + this.accessTokenId = accessTokenId + this.permission = permission + this.alphabeticalIndex = alphabeticalIndex + } +} // application information + +@Entry +@Component +struct locationInfoPage { + build() { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row() { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar({ title: JSON.stringify(backTitle) }) + } + Row() { + Column() { + applicationItem() + + }.width(Constants.FULL_WIDTH) + } + .layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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) + } + } +} + +@Component +struct applicationItem { + @State permissionNum: number = Constants.PERMISSION_NUM; // permission num + @State toggleIsOn: object = {}; // toggle switch state array + @State applicationList: ApplicationObj[] = []; // application info array + @State oldApplicationItem: ApplicationObj[] = []; // Original application information array + @State searchResult: boolean = true; // search results + + authorizeDialogController: CustomDialogController = new CustomDialogController({ + builder: authorizeDialog({ }), + autoCancel: true, + alignment: DialogAlignment.Center + }); + + @Builder ListItemLayout(item, index) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Image(item.iconId) + .customizeImage(Constants.AUTHORITY_IMAGE_WIDTH, Constants.AUTHORITY_IMAGE_HEIGHT) + .margin({ right: Constants.AUTHORITY_IMAGE_MARGIN_RIGHT }) + Text(item.labelId) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + Toggle({ type: ToggleType.Switch, isOn: this.toggleIsOn[item.index] }) + .selectedColor($r('app.color.toggle_color')) + .width(Constants.AUTHORITY_TOGGLE_WIDTH) + .height(Constants.AUTHORITY_TOGGLE_HEIGHT) + .onChange((isOn: boolean) => { + if (item.accessTokenId === '' || item.permission === '') { + return; + } + if (isOn) { + this.grantUserGrantedPermission(item.accessTokenId, item.permission, item.index); + } else { + this.revokeUserGrantedPermission(item.accessTokenId, item.permission, item.index); + } + }) + } + .width(Constants.FULL_WIDTH) + .height(Constants.AUTHORITY_ROW_HEIGHT) + .constraintSize({ minHeight: Constants.AUTHORITY_CONSTRAINTSIZE_MINHEIGHT }) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.AUTHORITY_TEXT_DECORATION_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + .margin({ left: Constants.AUTHORITY_TEXT_DECORATION_MARGIN_LEFT }) + } + } + }.onClick(() => { + }) + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.AUTHORITY_LISTITEM_PADDING_RIGHT }) + } + + /** + * Grant permissions to the app + * @param {Number} accessTokenId + * @param {String} permission permission name + * @param {Number} index Array index to modify permission status + */ + grantUserGrantedPermission(accessTokenId, permission, index) { + abilityAccessCtrl.createAtManager().grantUserGrantedPermission( + accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { + // result: 0 Authorization succeeded; result: -1 Authorization failed + if (result !== Constants.PERMISSION_INDEX) { + this.authorizeDialogController.open(); + this.toggleIsOn[index] = false; + setTimeout(()=> { + this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + } else { + this.toggleIsOn[index] = true; + } + let num = Constants.PERMISSION_NUM; + for(let key in this.toggleIsOn){ + if(this.toggleIsOn[key]){ + num++; + } + } + this.permissionNum = num; + }).catch(error => { + console.error(TAG + 'abilityAccessCtrl.createAtManager.grantUserGrantedPermission failed. Cause: ' + JSON.stringify(error)); + }) + } + + /** + * Deauthorize the app + * @param {Number} accessTokenId + * @param {String} permission permission name + * @param {Number} index Array index to modify permission status + */ + revokeUserGrantedPermission(accessTokenId, permission, index) { + abilityAccessCtrl.createAtManager().revokeUserGrantedPermission( + accessTokenId, permission, Constants.PERMISSION_FLAG).then(result => { + // result: 0 successfully cancel the authorization; result: -1 cancel the authorization failed + if (result !== Constants.PERMISSION_INDEX) { + this.authorizeDialogController.open(); + this.toggleIsOn[index] = true; + setTimeout(()=> { + this.authorizeDialogController.close(); + }, Constants.DELAY_TIME) + } else { + this.toggleIsOn[index] = false; + } + let num = Constants.PERMISSION_NUM; + for(let key in this.toggleIsOn){ + if(this.toggleIsOn[key]){ + num++; + } + } + this.permissionNum = num; + }) + } + + /** + * Lifecycle function, executed when the page is initialized + */ + aboutToAppear() { + for (let i = 0; i < routerData[0].bundleNames.length; i++) { + // Get BundleInfo based on bundle name + bundle.getBundleInfo(routerData[0].bundleNames[i], Constants.PARMETER_BUNDLE_FLAG).then(res => { + Promise.all([getAppLabel(res.appInfo.labelId, res.name), + getAppIcon(res.appInfo.iconId, res.name), + verifyAccessToken(res.appInfo.accessTokenId, routerData[0].permission)]) + .then((values) => { + this.applicationList.push( + new ApplicationObj( + String(values[0]), + String(values[1]), + i, + res.appInfo.accessTokenId, + routerData[0].permission, + makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array + ); + this.oldApplicationItem.push( + new ApplicationObj( + String(values[0]), + String(values[1]), + i, + res.appInfo.accessTokenId, + routerData[0].permission, + makePy(values[0])[0].slice(0, 1)) // Get the first letter in the returned initials array + ); + this.applicationList.sort((a,b) => a.index - b.index) + this.oldApplicationItem.sort((a,b) => a.index - b.index) + // 0: have permission; -1: no permission + if (values[2] === Constants.PERMISSION_INDEX) { + this.toggleIsOn[i] = true; + this.permissionNum++; + } else { + this.toggleIsOn[i] = false; + } + }); + }).catch(() => { + this.applicationList.push( + new ApplicationObj('', '', 0, '', '', '') + ); + this.oldApplicationItem.push( + new ApplicationObj('', '', 0, '', '', '') + ); + }) + } + } + + build() { + Column() { + Row() { + textInput({ + placeholder: Constants.RESOURCE_FIX_SEARCH, + applicationItem: $applicationList, + oldApplicationItem: $oldApplicationItem, + searchResult: $searchResult + }) + }.padding({ + left: Constants.AUTHORITY_TEXTINPUT_PADDING_LEFT, + right: Constants.AUTHORITY_TEXTINPUT_PADDING_RIGHT + }) + Row() { + Flex({ alignItems:ItemAlign.Start, justifyContent: FlexAlign.Start }) { + Column() { + Flex({ justifyContent: FlexAlign.Start }) { + Text(this.permissionNum + '个应用获取此权限') + .fontSize(Constants.TEXT_SMAL_FONT_SIZE) + .fontColor($r('app.color.secondary_font_color')) + .margin({ top: Constants.AUTHORITY_TEXT_MARGIN_TOP, left: Constants.AUTHORITY_TEXT_MARGIN_LEFT }) + } + Scroll() { + Row() { + Column() { + if (!this.applicationList.length) { + if (this.searchResult) { + Row() { + }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) + } else { + Row() { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.searchnoresult')) + .customizeImage(Constants.SEARCHNORESULT_IMAGE_WIDTH, Constants.SEARCHNORESULT_IMAGE_HEIGHT) + } + }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) + } + } else { + Row() { + List() { + ForEach(this.applicationList.slice(Constants.SLICE_START, this.applicationList.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.applicationList.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + } + .backgroundColor($r('app.color.default_background_color')) + .borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.margin({ top: Constants.AUTHORITY_ROW_MARGIN_TOP }) + } + }.width(Constants.FULL_WIDTH) + .height(Constants.AUTHORITY_COLUMN_HEIGHT) + } + } + }.padding({ left: Constants.AUTHORITY_LISTITEM_PADDING_LEFT }) + Column() { + alphabetIndexerComponent({ applicationItem: $applicationList, oldApplicationItem: $oldApplicationItem }) + }.width(Constants.AUTHORITY_ALPHABETINDEX_WIDTH) + .padding({ top: Constants.AUTHORITY_ALPHABETINDEX_PADDING_TOP }) + } + } + } + } +} diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/other-permissions.ets b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/other-permissions.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f58baa8ab021cf50333b912767b5ae72797102e --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/ets/pages/other-permissions.ets @@ -0,0 +1,172 @@ +/* + * 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 router from '@system.router'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; + +import { backBar } from "../common/components/backBar"; +import Constants from '../common/utils/constant'; +import { otherPermissionsLabel } from '../common/model/permissionGroup'; + +var TAG = 'PermissionManager_MainAbility:' + +let routerData = router.getParams().routerData; // Routing jump data +let tokenId = router.getParams().tokenId; // tokenId for verify permission +let backTitle = router.getParams().backTitle; // return title name +let status = router.getParams().status; // Status: Allowed, Forbidden +let permissions = router.getParams().permission; // permissions name +let otherPermissionList = []; // otherPermission List + +for (let i = 0; i < permissions.length; i++) { + otherPermissionList.push({ + permissionLabel: otherPermissionsLabel[permissions[i]], + permission: permissions[i] + }) +} + +@Entry +@Component +struct appNamePage { + build() { + GridContainer({ gutter: Constants.GUTTER, margin: Constants.GRID_MARGIN }) { + Row() { + Row() + .useSizeType({ + xs: { span: Constants.LEFT_XS_SPAN, offset: Constants.LEFT_XS_OFFSET }, + sm: { span: Constants.LEFT_SM_SPAN, offset: Constants.LEFT_SM_OFFSET }, + md: { span: Constants.LEFT_MD_SPAN, offset: Constants.LEFT_MD_OFFSET }, + lg: { span: Constants.LEFT_LG_SPAN, offset: Constants.LEFT_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() { + Column() { + Row() { + backBar({ title: JSON.stringify(backTitle) }) + } + Row() { + Column() { + Scroll() { + appNameItem() + } + } + }.layoutWeight(Constants.LAYOUT_WEIGHT) + } + } + .useSizeType({ + xs: { span: Constants.MIDDLE_XS_SPAN, offset: Constants.MIDDLE_XS_OFFSET }, + sm: { span: Constants.MIDDLE_SM_SPAN, offset: Constants.MIDDLE_SM_OFFSET }, + md: { span: Constants.MIDDLE_MD_SPAN, offset: Constants.MIDDLE_MD_OFFSET }, + lg: { span: Constants.MIDDLE_LG_SPAN, offset: Constants.MIDDLE_LG_OFFSET } + }) + .height(Constants.FULL_HEIGHT) + Row() + .useSizeType({ + xs: { span: Constants.RIGHT_XS_SPAN, offset: Constants.RIGHT_XS_OFFSET }, + sm: { span: Constants.RIGHT_SM_SPAN, offset: Constants.RIGHT_SM_OFFSET }, + md: { span: Constants.RIGHT_MD_SPAN, offset: Constants.RIGHT_MD_OFFSET }, + lg: { span: Constants.RIGHT_LG_SPAN, offset: Constants.RIGHT_LG_OFFSET } + }) + .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) + } + } + + /** + * Lifecycle function, triggered once when this page is displayed + */ + onPageShow() { + console.log(TAG + 'onPageShow other-permissions') + let isGranted = true; + permissions.forEach(permission => { + abilityAccessCtrl.createAtManager().verifyAccessToken(tokenId, permission).then(res => { + status = res; + }) + .catch(err => { + console.error(TAG + 'verifyAccessToken occure error: ' + JSON.stringify(err)) + }) + }) + } +} + +@Component +struct appNameItem { + @State otherPermissionListItem: string[] = otherPermissionList; // Other permission interface data array + @Builder ListItemLayout(item, index) { + ListItem() { + Row() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Row() { + Text(item.permissionLabel) + .fontSize(Constants.TEXT_MIDDLE_FONT_SIZE) + .fontColor($r('app.color.text_color')) + .flexGrow(Constants.FLEX_GROW) + Image($r('app.media.rightarrow')) + .objectFit(ImageFit.Contain) + .height(Constants.IMAGE_HEIGHT) + .width(Constants.IMAGE_WIDTH) + } + .width(Constants.FULL_WIDTH) + .height(Constants.LISTITEM_ROW_HEIGHT) + } + if (!index) { + Row() { + Column() + .backgroundColor($r('app.color.text_decoration_color')) + .width(Constants.FULL_WIDTH) + .height(Constants.TEXT_DECORATION_HEIGHT) + } + } + }.onClick(() => { + router.push({ + uri: 'pages/application-tertiary', + params: { + routerData: routerData, + backTitle: item.permissionLabel, + permission: [item.permission], + status: status + } + }); + }) + } + }.padding({ left: Constants.LISTITEM_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) + } + + build() { + Row() { + Column() { + Row() { + List() { + ForEach(this.otherPermissionListItem.slice(Constants.SLICE_START, this.otherPermissionListItem.length - 1), + (item) => { + this.ListItemLayout(item, Constants.SLICE_START_INDEX) + }, item => item.toString()) + ForEach(this.otherPermissionListItem.slice(Constants.SLICE_END), (item, index) => { + this.ListItemLayout(item, Constants.SLICE_END_INDEX) + }, item => item.toString()) + }.backgroundColor($r('app.color.default_background_color')).borderRadius(Constants.BORDER_RADIUS) + .padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM }) + }.margin({ top: Constants.ROW_MARGIN_TOP }) + .padding({ left: Constants.LIST_PADDING_LEFT, right: Constants.LISTITEM_PADDING_RIGHT }) + } + .width(Constants.FULL_WIDTH) + .height(Constants.FULL_HEIGHT) + } + } +} diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/module.json5 b/frameworks/com.ohos.permissionmanager/settings/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..8b8f3e9478c9b2421ca3c8086732924a7a3dd704 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/module.json5 @@ -0,0 +1,43 @@ +{ + "module": { + "name": "settings", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:settings_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.ohos.permissionmanager.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + } + ] + } +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/ar/properties/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/ar/profile/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/ar/properties/string.json rename to frameworks/com.ohos.permissionmanager/settings/src/main/resources/ar/profile/string.json diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/element/color.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..bfad4e8f80004c6d490dbdf0fa384817fb1f1016 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/element/color.json @@ -0,0 +1,76 @@ +{ + "color": [ + { + "name": "text_color", + "value": "#E5000000" + }, + { + "name": "background_color", + "value": "#f1f3f5" + }, + { + "name": "text_secondary_color", + "value": "#99000000" + }, + { + "name": "active_background_color", + "value": "#e5f3ff" + }, + { + "name": "divider_color", + "value": "#f3f4f6" + }, + { + "name": "text_decoration_color", + "value": "#f3f4f6" + }, + { + "name": "default_background_color", + "value": "#ffffff" + }, + { + "name": "button_color", + "value": "#0a59f7" + }, + { + "name": "secondary_font_color", + "value": "#66000000" + }, + { + "name": "toggle_color", + "value": "#409eff" + }, + { + "name": "color_Primary", + "value": "#E5000000" + }, + { + "name": "color_Secondary", + "value": "#99000000" + }, + { + "name": "color_Tertiary", + "value": "#66000000" + }, + { + "name": "color_Fourth", + "value": "#33000000" + }, + { + "name": "selected_Color", + "value": "#ffffff" + }, + { + "name": "popup_Color", + "value": "#FFFAF0" + }, + { + "name": "selected_Background_Color", + "value": "#CCCCCC" + }, + { + "name": "popup_Background_Color", + "value": "#D2B48C" + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6376b0c5d2124e019286b97d527822ead678b272 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/element/string.json @@ -0,0 +1,80 @@ +{ + "string": [ + { + "name": "settings_desc", + "value": "permissionmanager-settings" + }, + { + "name": "MainAbility_desc", + "value": "manage the permissions of all applications from the permission and application dimensions" + }, + { + "name": "MainAbility_label", + "value": "permission manage" + }, + { + "name": "no_permission", + "value": "no permissions" + }, + { + "name": "no_data", + "value": "no data" + }, + { + "name": "access_permission", + "value": "access permission" + }, + { + "name": "permission_access_record", + "value": "permission access record" + }, + { + "name": "authority_management", + "value": "authority managment" + }, + { + "name": "authority_tertiary_description", + "value": " applications have obtained this permission" + }, + { + "name": "authority_message", + "value": "application access permission in the last 7 days" + }, + { + "name": "other_permissions", + "value": "other permissions" + }, + { + "name": "application", + "value": "application" + }, + { + "name": "authority", + "value": "authority" + }, + { + "name": "media_document", + "value": "media document" + }, + { + "name": "allowed", + "value": "allowed" + }, + { + "name": "banned", + "value": "banned" + }, + { + "name": "location_info_message", + "value": "When the system location service is enabled, 19 applications can obtain the location of the device." + }, + { + "name": "Authorization_failed", + "value": "Authorization failed!" + }, + { + "name": "other_permission", + "value": "other permission" + } + ] +} \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_call_logs.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_call_logs.svg new file mode 100644 index 0000000000000000000000000000000000000000..42f8ad97c0a031fd0a42731e8994418e1d6accc2 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_call_logs.svg @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_dropzone.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_dropzone.svg new file mode 100644 index 0000000000000000000000000000000000000000..960483f7f3398245eafe7c9d6182419a32ebeb05 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_dropzone.svg @@ -0,0 +1,19 @@ + + + IC/ic_floatingwindow + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_exercise.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_exercise.svg new file mode 100644 index 0000000000000000000000000000000000000000..b488a424376659859601df4743a9293877be0e1e --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_exercise.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_forward.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_forward.svg new file mode 100644 index 0000000000000000000000000000000000000000..abac736115811fb7111ecea37f3fa063d627bd17 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_forward.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_more.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_more.svg new file mode 100644 index 0000000000000000000000000000000000000000..73ab2493876c2c2770b0329aa1652b9c5b72f946 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_more.svg @@ -0,0 +1,7 @@ + + + HM/ic/24x24/more1.5 + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_nearby.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_nearby.svg new file mode 100644 index 0000000000000000000000000000000000000000..4b201c865105325c085d7c761baef6087e4e57d3 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_nearby.svg @@ -0,0 +1,7 @@ + + + HM/ic/24x24/ic_nearby + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_calendar.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_calendar.svg new file mode 100644 index 0000000000000000000000000000000000000000..bfb163637ada7dffff34bdc44ada22a1dbb7537b --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_calendar.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_calendar + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_camera.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_camera.svg new file mode 100644 index 0000000000000000000000000000000000000000..535b7a305c97bdf9b89f721677b258440eadb8ca --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_camera.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_camera + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_contacts_group.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_contacts_group.svg new file mode 100644 index 0000000000000000000000000000000000000000..e01910786672f291f336e87ef79ea34ff1a6841f --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_contacts_group.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_contacts_group + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_folder.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_folder.svg new file mode 100644 index 0000000000000000000000000000000000000000..01a9fae004cf330b53f98d2b72c294fa1465c88e --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_folder.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_folder + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_gps.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_gps.svg new file mode 100644 index 0000000000000000000000000000000000000000..738516f856e056c84f33287f5e00ac34b6234b49 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_gps.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_gps + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_message.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_message.svg new file mode 100644 index 0000000000000000000000000000000000000000..79f77f671e5db7a338aaa32dd37bc3e83dd4e647 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_message.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_message + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_phone.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_phone.svg new file mode 100644 index 0000000000000000000000000000000000000000..df52fe39ccfecf5ac9f7ece40bb50377e79dffd1 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_phone.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_phone + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_voice.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_voice.svg new file mode 100644 index 0000000000000000000000000000000000000000..257ae0605e3c1fbb5370efec92c502f3a6e77157 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_public_voice.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_voice + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_sport.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_sport.svg new file mode 100644 index 0000000000000000000000000000000000000000..e9ed5719d253468323a09b2ff0ea6ca4dfc6d3a0 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_sport.svg @@ -0,0 +1,7 @@ + + + HM/ic/24x24/s0324ok + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_ssensor.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_ssensor.svg new file mode 100644 index 0000000000000000000000000000000000000000..1d6a076320427ea619df19cd1b760b6d30aa5851 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/ic_ssensor.svg @@ -0,0 +1,9 @@ + + + HM/ic/24x24/ssensor + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/icon.png b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/icon.png differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/in_app_installations.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/in_app_installations.svg new file mode 100644 index 0000000000000000000000000000000000000000..c40993ab5cedaefb586f94faf4c578f8faa93c57 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/in_app_installations.svg @@ -0,0 +1,13 @@ + + + HM/ic/24x24/in-app installations + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/left.png b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/left.png new file mode 100644 index 0000000000000000000000000000000000000000..3d2329c71504881e33df1d7a687002934cd01daa Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/left.png differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/loading.gif b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..915c1984cb8541c40f28762a09970b6578632aa3 Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/loading.gif differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/noinstallationpackage.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/noinstallationpackage.svg new file mode 100644 index 0000000000000000000000000000000000000000..5b10a66c6b63e6d73bfb96492ec59a900ed5335c --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/noinstallationpackage.svg @@ -0,0 +1,17 @@ + + + EmptyPage/08 NoInstallationPackage + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/nopermission.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/nopermission.svg new file mode 100644 index 0000000000000000000000000000000000000000..fe47a1df835fe7c7a296aa92bf009875373f30ad --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/nopermission.svg @@ -0,0 +1,16 @@ + + + EmptyPage/18 NoPermission + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/radioactive.jpg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/radioactive.jpg new file mode 100644 index 0000000000000000000000000000000000000000..55e2adeb54f5b48587302a9f8ed15d8d5e9b1834 Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/radioactive.jpg differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/radiodefault.jpg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/radiodefault.jpg new file mode 100644 index 0000000000000000000000000000000000000000..189d3ae2322a419ac0dc886fa6f4797daa651f10 Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/radiodefault.jpg differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/rightarrow.png b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/rightarrow.png new file mode 100644 index 0000000000000000000000000000000000000000..51aad9fae9c47616835ecc4841028e1c887565e8 Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/rightarrow.png differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/search.png b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/search.png new file mode 100644 index 0000000000000000000000000000000000000000..7f3716e47cc7db40b2b8a2b020ea0ec83fdf15a9 Binary files /dev/null and b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/search.png differ diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/searchnoresult.svg b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/searchnoresult.svg new file mode 100644 index 0000000000000000000000000000000000000000..e948acc0bbb8bc715385ff841418b60b81eb0997 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/media/searchnoresult.svg @@ -0,0 +1,22 @@ + + + EmptyPage/05 SearchNoResult + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/profile/main_pages.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..99ef8c9e53ddd72e4ad4b50a06327a3f75b90536 --- /dev/null +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,11 @@ +{ + "src": [ + "pages/authority-management", + "pages/application-secondary", + "pages/authority-secondary", + "pages/authority-tertiary", + "pages/application-tertiary", + "pages/other-permissions", + "pages/authority-tertiary-groups" + ] +} diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/dark/properties/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/dark/profile/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/dark/properties/string.json rename to frameworks/com.ohos.permissionmanager/settings/src/main/resources/dark/profile/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/en/properties/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/en/profile/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/en/properties/string.json rename to frameworks/com.ohos.permissionmanager/settings/src/main/resources/en/profile/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/light/properties/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/light/profile/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/light/properties/string.json rename to frameworks/com.ohos.permissionmanager/settings/src/main/resources/light/profile/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/zh/properties/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/zh/profile/string.json similarity index 100% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/ets/MainAbility/resources/zh/properties/string.json rename to frameworks/com.ohos.permissionmanager/settings/src/main/resources/zh/profile/string.json diff --git a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/zh_CN/element/string.json similarity index 56% rename from frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json rename to frameworks/com.ohos.permissionmanager/settings/src/main/resources/zh_CN/element/string.json index 0b97e458cf01aee6881223f0324a81ab1b3bcefe..982676ddd158ba2e31c7958822189a2630183cef 100644 --- a/frameworks/com.ohos.permissionmanager/permissionmanager/src/main/resources/base/element/string.json +++ b/frameworks/com.ohos.permissionmanager/settings/src/main/resources/zh_CN/element/string.json @@ -1,24 +1,16 @@ { "string": [ { - "name": "permissionmanager_MainAbility", - "value": "permissionmanager_MainAbility" + "name": "settings_desc", + "value": "权限管理-设置" }, { - "name": "description_mainability", - "value": "eTS_Empty Ability" + "name": "MainAbility_desc", + "value": "从权限和应用两个维度来管理所有应用申请的权限。" }, { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "permissionmanager_GrantAbility", - "value": "permissionmanager_GrantAbility" - }, - { - "name": "permissionmanager_description", - "value": "eTS_Empty Ability" + "name": "MainAbility_label", + "value": "权限管理" }, { "name": "no_permission", @@ -44,6 +36,10 @@ "name": "authority_tertiary_description", "value": "个应用获取此权限" }, + { + "name": "authority_message", + "value": "近7天的应用访问权限" + }, { "name": "other_permissions", "value": "其它权限" @@ -60,10 +56,6 @@ "name": "media_document", "value": "媒体和文件" }, - { - "name": "textInput_placeholder", - "value": "搜索应用" - }, { "name": "allowed", "value": "已允许" @@ -73,24 +65,16 @@ "value": "已禁止" }, { - "name": "description_grantability", - "value": "eTS_Empty Ability" - }, - { - "name": "entry_GrantAbility", - "value": "entry_GrantAbility" + "name": "location_info_message", + "value": "系统定位服务开关开启时,已允许19个应用获取此设备的位置。" }, { "name": "Authorization_failed", "value": "授权失败!" }, { - "name": "other_permission_label", - "value": "多设备协同" + "name": "other_permission", + "value": "其他权限" }, - { - "name": "other_permission_label_description", - "value": "多设备协同访问权限" - } ] } \ No newline at end of file