自实现的 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
相关推荐
2501_916013747 分钟前
iOS 上架 App 全流程实战,应用打包、ipa 上传、App Store 审核与工具组合最佳实践
android·ios·小程序·https·uni-app·iphone·webview
2501_9151063216 分钟前
iOS 26 能耗监测全景,Adaptive Power、新电池视图
android·macos·ios·小程序·uni-app·cocoa·iphone
用户2018792831671 小时前
浅谈Android PID与UID原理
android
TimeFine1 小时前
Android AWS KVS WebRTC 通话声道切换到媒体音乐声道
android
用户2018792831673 小时前
Android文件下载完整性保证:快递员小明的故事
android
用户2018792831673 小时前
自定义 View 的 “快递失踪案”:为啥 invalidate () 喊不动 onDraw ()?
android
没有了遇见3 小时前
Android 稀奇古怪系列:新版本签名问题-Algorithm HmacPBESHA256 not available
android
小妖怪的夏天3 小时前
react native android设置邮箱,进行邮件发送
android·spring boot·react native
东风西巷3 小时前
Avast Cleanup安卓版(手机清理优化) 修改版
android·学习·智能手机·软件需求
用户2018792831673 小时前
Android断点续传原理:小明的"读书笔记"故事
android