开发过程中遇到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 }

相关推荐
何盖(何松影)3 小时前
Android T startingwindow使用总结
android
小李飞飞砖5 小时前
Android 依赖注入框架详解
android
SUNxuetian5 小时前
【Android Studio】升级AGP-8.6.1,Find Usage对Method失效的处理方法!
android·ide·gradle·android studio·安卓
阿华的代码王国5 小时前
【Android】搭配安卓环境及设备连接
android·java
__water6 小时前
RHA《Unity兼容AndroidStudio打Apk包》
android·unity·jdk·游戏引擎·sdk·打包·androidstudio
一起搞IT吧8 小时前
相机Camera日志实例分析之五:相机Camx【萌拍闪光灯后置拍照】单帧流程日志详解
android·图像处理·数码相机
浩浩乎@8 小时前
【openGLES】安卓端EGL的使用
android
Kotlin上海用户组10 小时前
Koin vs. Hilt——最流行的 Android DI 框架全方位对比
android·架构·kotlin
zzq199610 小时前
Android framework 开发者模式下,如何修改动画过度模式
android
木叶丸10 小时前
Flutter 生命周期完全指南
android·flutter·ios