Revert "Remove the sysfs_fs_lifetime_write type"

This reverts the change to car_product/sepolicy/public/file.te
in commit 0b8205346b8c5cb7dd4cd98152d7cfa2534f2127. The private
sepolicy is adapted to keep sysfs_fs_ext4 and sysfs_fs_f2fs still
readable by carservice_app.

Reason for revert: b/165797366, breaking API compatibility

Bug: 157793539
Bug: 165797366

Test: m
Test: flash the bench and check the label of /sys/fs/ext4;
Test: check /system/product/etc/selinux/product_sepolicy.cil;
Test: adb pull /vendor/etc/selinux/precompiled_sepolicy; and
Test: sesearch -A -s carservice_app -t sysfs precompiled_sepolicy
Change-Id: Ie633df42364272ae2af016d3d396a17430323ba0
diff --git a/car_product/sepolicy/private/carservice_app.te b/car_product/sepolicy/private/carservice_app.te
index 49a3c6f..2fd2095 100644
--- a/car_product/sepolicy/private/carservice_app.te
+++ b/car_product/sepolicy/private/carservice_app.te
@@ -66,8 +66,9 @@
 allow carservice_app statsd:binder call;
 
 # To access /sys/fs/<type>/<partition>/lifetime_write_kbytes
-r_dir_file(carservice_app, sysfs_fs_ext4)
-r_dir_file(carservice_app, sysfs_fs_f2fs)
+allow carservice_app sysfs:dir { open read search };
+allow carservice_app sysfs_fs_ext4_features:dir { open read search};
+allow carservice_app sysfs_fs_f2fs:dir { open read search };
 
 set_prop(carservice_app, ctl_start_prop)
 set_prop(carservice_app, ctl_stop_prop)
diff --git a/car_product/sepolicy/private/genfs_contexts b/car_product/sepolicy/private/genfs_contexts
deleted file mode 100644
index e8e6e9f..0000000
--- a/car_product/sepolicy/private/genfs_contexts
+++ /dev/null
@@ -1 +0,0 @@
-genfscon sysfs /fs/ext4 u:object_r:sysfs_fs_ext4:s0
diff --git a/car_product/sepolicy/public/file.te b/car_product/sepolicy/public/file.te
index 8703f35..11bf839 100644
--- a/car_product/sepolicy/public/file.te
+++ b/car_product/sepolicy/public/file.te
@@ -1,4 +1,8 @@
+# This type for lifetime_write_kbytes files which resides in
+# /sys/fs/<filesystem>/<partition>/lifetime_writes_kbytes
+# Vendors are supposed to extend genfs_contexts with the
+# partition names for their devices.
+type sysfs_fs_lifetime_write, sysfs_type, fs_type;
+
 # /data/system/car
 type system_car_data_file, file_type, data_file_type, core_data_file_type;
-# /sys/fs/ext4
-type sysfs_fs_ext4, sysfs_type, fs_type;