# android recovery persistent log manager
type recovery_persist, domain;
type recovery_persist_exec, exec_type, file_type;

init_daemon_domain(recovery_persist)

allow recovery_persist pstorefs:dir search;
allow recovery_persist pstorefs:file r_file_perms;

allow recovery_persist recovery_data_file:file create_file_perms;
allow recovery_persist recovery_data_file:dir create_dir_perms;

###
### Neverallow rules
###
### recovery_persist should NEVER do any of this

# Block device access.
neverallow recovery_persist dev_type:blk_file { read write };

# ptrace any other app
neverallow recovery_persist domain:process ptrace;

# Write to /system.
neverallow recovery_persist system_file:dir_file_class_set write;

# Write to files in /data/data
neverallow recovery_persist { app_data_file system_data_file }:dir_file_class_set write;

# recovery_persist is not allowed to write anywhere other than recovery_data_file
neverallow recovery_persist { file_type -recovery_data_file -recovery_persist_tmpfs userdebug_or_eng(`-coredump_file') }:file write;