From 2a7f57102850ecb9264a8965dbe802fd4b038bc1 Mon Sep 17 00:00:00 2001
From: Siarhei Vishniakou <svv@google.com>
Date: Wed, 10 May 2017 19:37:06 -0700
Subject: [PATCH] Allow shell access on /dev/uhid node

Node for /dev/uhid driver needs to be accessible
by shell for the 'hid' command in frameworks/base/cmds.
This CL is in support of another CL c/2048848, topic
'Refactor hid command in /frameworks/base/cmds'
in internal master.

Bug: 34052337
Test: CTS test for GamepadTestCase#testButtonA; Checked that
cat /dev/uhid does not raise permission error.

Change-Id: I861c1226b4a67272af7c2a93d7811bf87a083478
---
 private/shell.te | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/private/shell.te b/private/shell.te
index 9bc0bd150..afb1f49ba 100644
--- a/private/shell.te
+++ b/private/shell.te
@@ -1,5 +1,8 @@
 typeattribute shell coredomain;
 
+# allow shell input injection
+allow shell uhid_device:chr_file rw_file_perms;
+
 # systrace support - allow atrace to run
 allow shell debugfs_tracing:dir r_dir_perms;
 allow shell debugfs_tracing:file r_file_perms;
-- 
GitLab