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
Merged-In: Idf6852060dfd3a250d92147a3ee0f1fe9e6140d4
Signed-off-by: Randall Huang <huangrandall@google.com>
diff --git a/storage/Android.bp b/storage/Android.bp
index 54e097e..c8671d1 100644
--- a/storage/Android.bp
+++ b/storage/Android.bp
@@ -5,6 +5,7 @@
sh_binary {
name: "dump_storage.sh",
src: "dump_storage.sh",
+ init_rc: ["init.storage.rc"],
vendor: true,
sub_dir: "dump",
}
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 eda4cf7..a0efd28 100644
--- a/storage/sepolicy/file_contexts
+++ b/storage/sepolicy/file_contexts
@@ -1 +1,2 @@
/vendor/bin/dump/dump_storage\.sh 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