开发过程中遇到Selinux问题分析

java 复制代码
2021-11-20 12:33:01.974 308-308/? E/SELinux: avc:  denied  { add } 
for pid=16582 uid=1000 name=event_usagestats scontext=u:r:system_app:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager permissive=0

2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err: java.lang.reflect.InvocationTargetException
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at com.meizu.dataservice.DataServiceApplication.registerEventUsageStats(DataServiceApplication.java:103)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at com.meizu.dataservice.DataServiceApplication.onCreate(DataServiceApplication.java:61)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6923)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.app.ActivityThread.access$1300(ActivityThread.java:260)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1955)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.os.Looper.loop(Looper.java:223)
2021-11-20 12:33:01.974 16582-16582/com.meizu.dataservice W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7955)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err: Caused by: java.lang.SecurityException: 
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.Parcel.createException(Parcel.java:2357)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.Parcel.readException(Parcel.java:2340)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.Parcel.readException(Parcel.java:2282)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.IServiceManager$Stub$Proxy.addService(IServiceManager.java:380)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:72)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.ServiceManager.addService(ServiceManager.java:197)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err:     at android.os.ServiceManager.addService(ServiceManager.java:166)
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice W/System.err: 	... 13 more
2021-11-20 12:33:01.975 16582-16582/com.meizu.dataservice D/DataServiceApplication: ### DataServiceApplication initFlymeNoVccUsageStats end
2021-11-20 12:33:01.980 16582-16582/com.meizu.dataservice E/DataServiceApplication: registerGpsReceiver
2021-11-20 12:33:01.980 16582-16582/com.meizu.dataservice D/DataServiceApplication: ### DataServiceApplication onCreate ###
java 复制代码
E/SELinux: avc:  denied  { add } 
for pid=16582 uid=1000 name=event_usagestats scontext=u:r:system_app:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager permissive=0

分析上述Log语句:

缺少什么权限: { add }权限;
谁缺少权限: scontext=u:r:system_app:s0
对谁缺少权限: tcontext=u:object_r:default_android_service:s0
什么类型的操作: tclass=service_manager

缺少什么权限: { add }权限;

谁缺少权限:scontext=u:r:system_app:s0

对谁缺少权限:tcontext=u:object_r:default_android_service:s0

什么类型的操作:tclass=service_manager

{ add } system_app default_android_service service_manager

A B C D

allow system_app default_android_service service_manager { add }

B C D A

操作语句:

allow system_app default_android_service:service_manager { add }

相关推荐
阿巴斯甜9 小时前
Android 报错:Zip file '/Users/lyy/develop/repoAndroidLapp/l-app-android-ble/app/bu
android
Kapaseker9 小时前
实战 Compose 中的 IntrinsicSize
android·kotlin
xq952710 小时前
Andorid Google 登录接入文档
android
黄林晴11 小时前
告别 Modifier 地狱,Compose 样式系统要变天了
android·android jetpack
冬奇Lab1 天前
Android触摸事件分发、手势识别与输入优化实战
android·源码阅读
城东米粉儿1 天前
Android MediaPlayer 笔记
android
Jony_1 天前
Android 启动优化方案
android
阿巴斯甜1 天前
Android studio 报错:Cause: error=86, Bad CPU type in executable
android
张小潇1 天前
AOSP15 Input专题InputReader源码分析
android
_小马快跑_1 天前
Kotlin | 协程调度器选择:何时用CoroutineScope配置,何时用launch指定?
android