设置—用户—机主点击拍照设置头像,拍照之后,头像设置不上去

xiaoxiao2021-02-27  281

解决思路:开始抓去log,根据log信息显示的是
01-02 10:53:32.301 7529 7529 W Binder:7517_2: type=1400 audit(0.0:5513): avc: denied {  write } for path="/data/user_de/0/com.android.settings/cache/TakeEditUserPhoto2.jpg" dev="mmcblk0p29" ino=16528 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=file permissive=0  注:这种log信息在denied后面的{}里面表示缺少什么权限  缺少写入权限。之前给过相应的修改方法是在 device/qcom/sepolicy/msm8909/platform_app.te和priv_app.te里面分别加上 allow  platform_app  system_app_data_file:file {read write};和 allow priv_app system_app_data_file:file {read write};然后编译就解决这个问题了,但是后面测cts的时候却测不过了,只得重新修改。 后面降低了相机和相册的访问权限,将apk编译到system/app下面,并且去掉了android.mk 文件里面的LOCAL_CERTIFICATE := platform属性编译也可以修好,并且不影响CTS测试,但是由于降低了权限等级却不能访问SD卡了,所以这种修改方法会引起其他的问题滋生,也不能这么做。 然后又抓了一条log信息,发现和之前是一样的,还是权限问题 208: 08-02 12:33:01.054 22372 22372 W Binder:22356_4: type=1400 audit(0.0:440): avc: denied { write } for path="/data/user_de/0/com.android.settings/cache/TakeEditUserPhoto2.jpg" dev="dm-0" ino=115951 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=file permissive=0  修改方法: 在目录 android/system/sepolicy/platform_app.te 下加入 allow  platform_app  system_app_data_file:file create_file_perms; 然后编译就可以了。
转载请注明原文地址: https://www.6miu.com/read-9737.html

最新回复(0)