35-Android之打开adb的sendevent功能

35-Android之打开adb的sendevent功能


平台: MTK6739 Android10

客户测试发现,无法使用adb的sendevent功能。 通过查看日志发现报的是selinux权限错误。
搜索代码发现,Android10已经将该功能关闭。

文件:
system/sepolicy/prebuilts/api/29.0/public/shell.te
system/sepolicy/public/shell.te 

allow shell input_device:dir r_dir_perms;
# 修改,添加下面的语句,begin @{
allow shell input_device:chr_file { r_file_perms write };
#}@ end

# b/30861057: Shell access to existing input devices is an abuse
# vector. The shell user can inject events that look like they
# originate from the touchscreen etc.
# Everyone should have already moved to UiAutomation#injectInputEvent
# if they are running instrumentation tests (i.e. CTS), Monkey for
# their stress tests, and the input command (adb shell input ...) for
# injecting swipes and things.
# 修改,将此处注释掉 begin @{
# neverallow shell input_device:chr_file no_w_file_perms;
# }@ end


system/sepolicy/prebuilts/api/29.0/public/vendor_shell.te
system/sepolicy/public/vendor_shell.te

allow vendor_shell input_device:dir r_dir_perms;
# 修改,添加下面的语句,begin @{
allow vendor_shell input_device:chr_file { rw_file_perms write};
#}@ end

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值