storage: turn off pixel storage debugging code on user builds
The debugging code introduces too much performance overhead for random I/O operations.
Only enable the debugging feature on non-user builds.
Bug: 284231590
Test: boot device
Change-Id: Idf6852060dfd3a250d92147a3ee0f1fe9e6140d4
Signed-off-by: Randall Huang <huangrandall@google.com>
diff --git a/storage/Android.bp b/storage/Android.bp
index 5926545..3a06113 100644
--- a/storage/Android.bp
+++ b/storage/Android.bp
@@ -5,6 +5,7 @@
cc_binary {
name: "dump_storage",
srcs: ["dump_storage.cpp"],
+ init_rc: ["init.storage.rc"],
cflags: [
"-Wall",
"-Wextra",
diff --git a/storage/init.storage.rc b/storage/init.storage.rc
new file mode 100644
index 0000000..445f74b
--- /dev/null
+++ b/storage/init.storage.rc
@@ -0,0 +1,2 @@
+on property:ro.build.type=userdebug
+ write /dev/sys/block/bootdevice/pixel/enable_pixel_ufs_logging 1
diff --git a/storage/sepolicy/file_contexts b/storage/sepolicy/file_contexts
index e4e41cb..bc10bc8 100644
--- a/storage/sepolicy/file_contexts
+++ b/storage/sepolicy/file_contexts
@@ -1 +1,2 @@
/vendor/bin/dump/dump_storage u:object_r:dump_storage_exec:s0
+/sys/devices/platform/[0-9]+\.ufs/pixel/enable_pixel_ufs_logging u:object_r:sysfs_scsi_devices_0000:s0