Create /data/misc/stats-data/ and /data/misc/stats-service/ in statsd.rc
rather than during the runtime of statsd
The purpose of this change is to prevent causing selinux violation by
trying to mkdir to /data/misc/ directory when statsd doesn't have
permission to do so.
Bug: 71537285
Test: manually tested to make sure that there's no sepolicy violation
Change-Id: I9c4ccecc416f41923c9b24dd44a388d135fecc07
diff --git a/cmds/statsd/statsd.rc b/cmds/statsd/statsd.rc
index 437f9a8..c260ae1 100644
--- a/cmds/statsd/statsd.rc
+++ b/cmds/statsd/statsd.rc
@@ -16,3 +16,8 @@
class main
user statsd
group statsd log
+
+on post-fs-data
+ # Create directory for statsd
+ mkdir /data/misc/stats-data/ 0770 statsd statsd
+ mkdir /data/misc/stats-service/ 0770 statsd statsd