1*e4a36f41SAndroid Build Coastguard Workertypeattribute bootstat coredomain; 2*e4a36f41SAndroid Build Coastguard Worker 3*e4a36f41SAndroid Build Coastguard Workerinit_daemon_domain(bootstat) 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Worker# Collect metrics on boot time created by init 6*e4a36f41SAndroid Build Coastguard Workerget_prop(bootstat, boottime_prop) 7*e4a36f41SAndroid Build Coastguard Worker 8*e4a36f41SAndroid Build Coastguard Worker# Read/Write [persist.]sys.boot.reason and ro.boot.bootreason (write if empty) 9*e4a36f41SAndroid Build Coastguard Workerset_prop(bootstat, bootloader_boot_reason_prop) 10*e4a36f41SAndroid Build Coastguard Workerset_prop(bootstat, system_boot_reason_prop) 11*e4a36f41SAndroid Build Coastguard Workerset_prop(bootstat, last_boot_reason_prop) 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Workerread_runtime_log_tags(bootstat) 14*e4a36f41SAndroid Build Coastguard Worker 15*e4a36f41SAndroid Build Coastguard Worker# Allow persistent storage in /data/misc/bootstat. 16*e4a36f41SAndroid Build Coastguard Workerallow bootstat bootstat_data_file:dir rw_dir_perms; 17*e4a36f41SAndroid Build Coastguard Workerallow bootstat bootstat_data_file:file create_file_perms; 18*e4a36f41SAndroid Build Coastguard Worker 19*e4a36f41SAndroid Build Coastguard Workerallow bootstat metadata_file:dir search; 20*e4a36f41SAndroid Build Coastguard Workerallow bootstat metadata_bootstat_file:dir rw_dir_perms; 21*e4a36f41SAndroid Build Coastguard Workerallow bootstat metadata_bootstat_file:file create_file_perms; 22*e4a36f41SAndroid Build Coastguard Worker 23*e4a36f41SAndroid Build Coastguard Worker# ToDo: TBI move access for the following to a system health HAL 24*e4a36f41SAndroid Build Coastguard Worker 25*e4a36f41SAndroid Build Coastguard Worker# Allow access to /sys/fs/pstore/ and syslog 26*e4a36f41SAndroid Build Coastguard Workerallow bootstat pstorefs:dir search; 27*e4a36f41SAndroid Build Coastguard Workerallow bootstat pstorefs:file r_file_perms; 28*e4a36f41SAndroid Build Coastguard Workerallow bootstat kernel:system syslog_read; 29*e4a36f41SAndroid Build Coastguard Worker 30*e4a36f41SAndroid Build Coastguard Worker# Allow access to reading the logs to read aspects of system health 31*e4a36f41SAndroid Build Coastguard Workerread_logd(bootstat) 32*e4a36f41SAndroid Build Coastguard Worker 33*e4a36f41SAndroid Build Coastguard Worker# Allow bootstat write to statsd. 34*e4a36f41SAndroid Build Coastguard Workerunix_socket_send(bootstat, statsdw, statsd) 35*e4a36f41SAndroid Build Coastguard Worker 36*e4a36f41SAndroid Build Coastguard Worker### 37*e4a36f41SAndroid Build Coastguard Worker### Neverallow rules 38*e4a36f41SAndroid Build Coastguard Worker### 39*e4a36f41SAndroid Build Coastguard Worker 40*e4a36f41SAndroid Build Coastguard Workerneverallow { 41*e4a36f41SAndroid Build Coastguard Worker domain 42*e4a36f41SAndroid Build Coastguard Worker -bootstat 43*e4a36f41SAndroid Build Coastguard Worker -init 44*e4a36f41SAndroid Build Coastguard Worker} system_boot_reason_prop:property_service set; 45*e4a36f41SAndroid Build Coastguard Worker 46*e4a36f41SAndroid Build Coastguard Workerneverallow { 47*e4a36f41SAndroid Build Coastguard Worker domain 48*e4a36f41SAndroid Build Coastguard Worker -bootanim 49*e4a36f41SAndroid Build Coastguard Worker -bootstat 50*e4a36f41SAndroid Build Coastguard Worker -dumpstate 51*e4a36f41SAndroid Build Coastguard Worker userdebug_or_eng(`-incidentd') 52*e4a36f41SAndroid Build Coastguard Worker -init 53*e4a36f41SAndroid Build Coastguard Worker -platform_app 54*e4a36f41SAndroid Build Coastguard Worker -recovery 55*e4a36f41SAndroid Build Coastguard Worker -shell 56*e4a36f41SAndroid Build Coastguard Worker -system_server 57*e4a36f41SAndroid Build Coastguard Worker} { bootloader_boot_reason_prop last_boot_reason_prop }:file r_file_perms; 58*e4a36f41SAndroid Build Coastguard Worker# ... and refine, as these components should not set the last boot reason 59*e4a36f41SAndroid Build Coastguard Workerneverallow { bootanim recovery } last_boot_reason_prop:file r_file_perms; 60*e4a36f41SAndroid Build Coastguard Worker 61*e4a36f41SAndroid Build Coastguard Workerneverallow { 62*e4a36f41SAndroid Build Coastguard Worker domain 63*e4a36f41SAndroid Build Coastguard Worker -bootstat 64*e4a36f41SAndroid Build Coastguard Worker -init 65*e4a36f41SAndroid Build Coastguard Worker -system_server 66*e4a36f41SAndroid Build Coastguard Worker} { bootloader_boot_reason_prop last_boot_reason_prop }:property_service set; 67*e4a36f41SAndroid Build Coastguard Worker# ... and refine ... for a ro propertly no less ... keep this _tight_ 68*e4a36f41SAndroid Build Coastguard Workerneverallow system_server bootloader_boot_reason_prop:property_service set; 69