Merge "Allow "adb shell tradeinmode" on userdebug/eng builds." into main
diff --git a/private/shell.te b/private/shell.te
index 042540b..38c5ac8 100644
--- a/private/shell.te
+++ b/private/shell.te
@@ -42,6 +42,11 @@
domain_auto_trans(shell, vendor_shell_exec, vendor_shell)
+# Allow shell to execute tradeinmode on userdebug builds, for testing.
+userdebug_or_eng(`
+ domain_auto_trans(shell, tradeinmode_exec, tradeinmode)
+')
+
# Allow shell binaries to exec the perfetto cmdline util and have that
# transition into its own domain, so that it behaves consistently to
# when exec()-d by statsd.
diff --git a/private/tradeinmode.te b/private/tradeinmode.te
index 05315a4..821faf4 100644
--- a/private/tradeinmode.te
+++ b/private/tradeinmode.te
@@ -4,8 +4,14 @@
type tradeinmode_exec, exec_type, file_type, system_file_type;
allow tradeinmode adbd_tradeinmode:fd use;
-
allow tradeinmode adbd_tradeinmode:unix_stream_socket { read write ioctl };
+
+# Allow running from normal shell on userdebug/eng.
+userdebug_or_eng(`
+ allow tradeinmode { adbd shell }:fd use;
+ allow tradeinmode adbd:unix_stream_socket { read write ioctl };
+')
+
allow tradeinmode devpts:chr_file rw_file_perms;
# Allow executing am/content without a domain transition.