Allow access to trace_data_file from untrusted_app context
Bug: http://b/170257616
This allows native code in CTS tests to write their coverage profiles.
Like other cases of this pattern, this is only enabled with the
NATIVE_COVERAGE build parameter, and shouldn't affect release build
configurations.
Test: atest -a CtsNdkBinderTestCases and verify non-zero coverage in
cts/tests/tests/binder_ndk/libbinder_ndk_test/
Change-Id: Id78aa67750f33c4a8ec6e7fcf8418ff23fc27ac7
diff --git a/private/untrusted_app_all.te b/private/untrusted_app_all.te
index b4561fa..dec92f8 100644
--- a/private/untrusted_app_all.te
+++ b/private/untrusted_app_all.te
@@ -175,3 +175,9 @@
userdebug_or_eng(`
virtualizationservice_use(untrusted_app_all)
')
+
+with_native_coverage(`
+ # Allow writing coverage information to /data/misc/trace
+ allow domain method_trace_data_file:dir create_dir_perms;
+ allow domain method_trace_data_file:file create_file_perms;
+')