开源鸿蒙6.1系统权限问题
·
开源鸿蒙6.1系统权限问题
失败信息
- 1.安装应用失败
# bm install -p entry-default-signed.hap
error: failed to install bundle.
code:9568266
error: install permission denied.
- 2.dump失败
# bm dump -a
error: failed to get information and the parameters may be wrong.
追踪原因
- 原因是6.1中的
base/startup/init/services/etc/console.cfg将权限等相关的参数全部移除了
{
"services" : [{
"name" : "console",
"path" : ["/system/bin/sh"],
"start-mode" : "condition",
"disabled" : 1,
"console" : 1,
"sandbox" : 0,
"uid" : "root",
"gid" : ["shell", "log", "readproc"],
"ondemand" : true,
"jobs" : {
"on-start" : "services:console"
},
"secon" : "u:r:console:s0"
}
]
}
- 而5.0中的
base/startup/init/services/etc/console.cfg有默认的权限
{
"services" : [{
"name" : "console",
"path" : ["/system/bin/sh"],
"start-mode" : "condition",
"disabled" : 1,
"console" : 1,
"sandbox" : 0,
"uid" : "root",
"gid" : ["shell", "log", "readproc"],
"ondemand" : true,
"jobs" : {
"on-start" : "services:console"
},
"secon" : "u:r:console:s0",
"permission" : [
"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"ohos.permission.DUMP",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.INSTALL_BUNDLE",
"ohos.permission.LISTEN_BUNDLE_CHANGE",
"ohos.permission.REMOVE_CACHE_FILES",
"ohos.permission.ACCELEROMETER",
"ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"ohos.permission.PERMISSION_USED_STATS",
"ohos.permission.NOTIFICATION_CONTROLLER",
"ohos.permission.PUBLISH_SYSTEM_COMMON_EVENT",
"ohos.permission.CLEAN_APPLICATION_DATA",
"ohos.permission.START_SYSTEM_DIALOG",
"ohos.permission.GET_RUNNING_INFO"
],
"permission_acls" : [
"ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"ohos.permission.DUMP",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.INSTALL_BUNDLE",
"ohos.permission.LISTEN_BUNDLE_CHANGE",
"ohos.permission.REMOVE_CACHE_FILES",
"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"ohos.permission.PERMISSION_USED_STATS",
"ohos.permission.NOTIFICATION_CONTROLLER",
"ohos.permission.PUBLISH_SYSTEM_COMMON_EVENT",
"ohos.permission.CLEAN_APPLICATION_DATA",
"ohos.permission.START_SYSTEM_DIALOG",
"ohos.permission.GET_RUNNING_INFO"
]
}
]
}
解决方法
- 保持当前6.1的风格,在产品侧去覆盖
- 1.新建
vendor/loongson/loongphone/etc/init/console.cfg,内容直接使用5.0的 - 2.
vendor/loongson/loongphone/etc/param/product_loongphone.para中添加
# Copyright (c) 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.
const.product.brand=default
const.build.product=default
const.product.shell.uid=2000 # add this
- 3.
vendor/loongson/loongphone/etc/BUILD.gn中添vender侧console.cfg文件的覆盖操作
# Copyright (c) 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("//build/ohos.gni")
ohos_prebuilt_etc("para_for_chip_prod") {
source = "./param/hardware_loongphone.para"
install_images = [ chip_prod_base_dir ]
relative_install_dir = "param"
part_name = "product_loongphone"
}
ohos_prebuilt_etc("para_for_sys_prod") {
source = "./param/product_loongphone.para"
install_images = [ sys_prod_base_dir ]
relative_install_dir = "param"
part_name = "product_loongphone"
}
ohos_prebuilt_etc("console.cfg") { # add this
source = "./init/console.cfg"
relative_install_dir = "init"
part_name = "product_loongphone"
subsystem_name = "product_loongphone"
}
group("product_etc_conf") {
deps = [
":para_for_chip_prod",
":para_for_sys_prod",
":console.cfg", # add this
]
}
更多推荐



所有评论(0)