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

解决思路:开始抓去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; 然后编译就可以了。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值