Remove the sysfs_fs_lifetime_write type

SysfsLifetimeWriteInfoProvider needs to read
/sys/fs/(ext4|f2fs)/<some partition>/lifetime_writes_kbytes.

sysfs_fs_lifetime_write was created for these files so allow rules could
be created for carservice_app.

But the files were never correctly labeled; becuase genfs_context does
not support regex; and file_contexts does not support sysfs. So
sys_fs_lifetime_write is useless given the current situation.

As a solution, we remove sysfs_fs_lifetime_write; and allow
carservice_app to read sysfs_fs_ext4 and sysfs_fs_f2fs. This is slightly
relaxed; but just reading these files should be good.

Fix: 157793539
Test: lunch aosp_osprey-userdebug && m
Test: check /sys/fs/ext4 to see if it has the correct type labeled
Test: then check /system/vendor/etc/selinux for the modified rules
Change-Id: I8d05094b528a4e5eec546ccb9ca871979b87bc84
diff --git a/car_product/sepolicy/private/carservice_app.te b/car_product/sepolicy/private/carservice_app.te
index 4841891..49a3c6f 100644
--- a/car_product/sepolicy/private/carservice_app.te
+++ b/car_product/sepolicy/private/carservice_app.te
@@ -66,7 +66,8 @@
 allow carservice_app statsd:binder call;
 
 # To access /sys/fs/<type>/<partition>/lifetime_write_kbytes
-allow carservice_app sysfs_fs_lifetime_write:file { getattr open read };
+r_dir_file(carservice_app, sysfs_fs_ext4)
+r_dir_file(carservice_app, sysfs_fs_f2fs)
 
 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
new file mode 100644
index 0000000..e8e6e9f
--- /dev/null
+++ b/car_product/sepolicy/private/genfs_contexts
@@ -0,0 +1 @@
+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 11bf839..8703f35 100644
--- a/car_product/sepolicy/public/file.te
+++ b/car_product/sepolicy/public/file.te
@@ -1,8 +1,4 @@
-# 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;