自实现的 android.hardware.xxxx@1.0-service 没有开机自启动

问题描述

push android.hardware.xxxx@1.0-service/vednor/bin/hw;

push 'android.hardware.xxxx@1.0-service.rc' 到 /vendor/etc/init/;

reboot 设备后,xxx 服务没有自动启动。

经检查 rc 文件与同类 service 无差异。

问题分析

直接运行 xxx 服务正常。同时经检查 rc 文件与同类 service 无差异。

怀疑是权限问题。

使用 ls -al -Z 查看,rc 文件权限相同,但 xxxx 文件 SELinux 权限不同:

xml 复制代码
-rwxr-xr-x 1 root   shell  u:object_r:hal_mcucomm_default_exec:s0                   11648 2009-01-01 08:00 android.hardware.mcucomm@1.0-service
-rwxr-xr-x 1 root   shell  u:object_r:vendor_file:s0                                  82856 2024-08-02 16:25 android.hardware.xxxx@1.0-service
-rwxr-xr-x 1 root   shell  u:object_r:hal_settings_default_exec:s0                  29904 2009-01-01 08:00 android.hardware.settings@1.0-service

所以问题应该是 SELinux 权限不同导致。

问题解决

使用命令修改 xxxx 文件 SELinux 权限与同类一致即可。

复制代码
chcon u:object_r:hal_mcucomm_default_exec:s0 android.hardware.xxxx@1.0-service
相关推荐
砖厂小工5 小时前
用 GLM + OpenClaw 打造你的 AI PR Review Agent — 让龙虾帮你审代码
android·github
张拭心5 小时前
春节后,有些公司明确要求 AI 经验了
android·前端·人工智能
张拭心6 小时前
Android 17 来了!新特性介绍与适配建议
android·前端
Kapaseker8 小时前
Compose 进阶—巧用 GraphicsLayer
android·kotlin
黄林晴8 小时前
Android17 为什么重写 MessageQueue
android
阿巴斯甜1 天前
Android 报错:Zip file '/Users/lyy/develop/repoAndroidLapp/l-app-android-ble/app/bu
android
Kapaseker1 天前
实战 Compose 中的 IntrinsicSize
android·kotlin
xq95271 天前
Andorid Google 登录接入文档
android
黄林晴1 天前
告别 Modifier 地狱,Compose 样式系统要变天了
android·android jetpack
冬奇Lab2 天前
Android触摸事件分发、手势识别与输入优化实战
android·源码阅读