Merge ab/6749736 in stage.

Bug: 167233921
Merged-In: I084e1ce2f7e37043485d67eca211a2bafc57c1d4
Change-Id: I39678cb2ee2352f49481fadc25a6244f990401b4
diff --git a/citadel/citadeld.te b/citadel/citadeld.te
index a1b7a6d..266dee2 100644
--- a/citadel/citadeld.te
+++ b/citadel/citadeld.te
@@ -9,6 +9,7 @@
 init_daemon_domain(citadeld)
 
 binder_call(citadeld, hal_power_stats_default)
+allow citadeld hal_power_stats_vendor_service:service_manager find;
 
 # Let citadeld find and use statsd.
 hwbinder_use(citadeld)
diff --git a/citadel/vndservice.te b/citadel/vndservice.te
index 880c09c..a756bce 100644
--- a/citadel/vndservice.te
+++ b/citadel/vndservice.te
@@ -1 +1,2 @@
 type citadeld_service, vndservice_manager_type;
+type hal_power_stats_vendor_service,      vndservice_manager_type;
diff --git a/citadel/vndservice_contexts b/citadel/vndservice_contexts
index b4df996..2e1be43 100644
--- a/citadel/vndservice_contexts
+++ b/citadel/vndservice_contexts
@@ -1 +1,2 @@
 android.hardware.citadel.ICitadeld  u:object_r:citadeld_service:s0
+power.stats-vendor                  u:object_r:hal_power_stats_vendor_service:s0
diff --git a/common/property.te b/common/property.te
index f014ad5..50f7b34 100644
--- a/common/property.te
+++ b/common/property.te
@@ -1 +1 @@
-type vendor_device_prop, property_type;
+vendor_internal_prop(vendor_device_prop)
diff --git a/mm/file.te b/mm/file.te
index ee45803..8541232 100644
--- a/mm/file.te
+++ b/mm/file.te
@@ -1,2 +1,4 @@
 type mm_logd_vendor_data_file, file_type, data_file_type;
+type debugfs_page_owner, debugfs_type, fs_type;
+type sysfs_fastrpc, sysfs_type, fs_type;
 
diff --git a/mm/genfs_contexts b/mm/genfs_contexts
new file mode 100644
index 0000000..57b26d4
--- /dev/null
+++ b/mm/genfs_contexts
@@ -0,0 +1,2 @@
+genfscon debugfs /page_owner                          u:object_r:debugfs_page_owner:s0
+genfscon sysfs /kernel/fastrpc/total_dma_kb            u:object_r:sysfs_fastrpc:s0
diff --git a/power-libperfmgr/property.te b/power-libperfmgr/property.te
index 5e889ac..6f6e3a7 100644
--- a/power-libperfmgr/property.te
+++ b/power-libperfmgr/property.te
@@ -1 +1 @@
-type vendor_power_prop, property_type;
+vendor_internal_prop(vendor_power_prop)
diff --git a/powerstats/file_contexts b/powerstats/file_contexts
new file mode 100644
index 0000000..905e630
--- /dev/null
+++ b/powerstats/file_contexts
@@ -0,0 +1 @@
+/(vendor|system/vendor)/bin/hw/android\.hardware\.power.stats-service\.pixel u:object_r:hal_power_stats_default_exec:s0
diff --git a/powerstats/hal_power_stats_default.te b/powerstats/hal_power_stats_default.te
new file mode 100644
index 0000000..7e00470
--- /dev/null
+++ b/powerstats/hal_power_stats_default.te
@@ -0,0 +1,5 @@
+add_service(hal_power_stats_default, hal_power_stats_vendor_service)
+
+vndbinder_use(hal_power_stats)
+add_service(hal_power_stats_server, hal_power_stats_service)
+
diff --git a/thermal/property.te b/thermal/property.te
index 57065a3..676c85a 100644
--- a/thermal/property.te
+++ b/thermal/property.te
@@ -1,2 +1,2 @@
 #thermal HAL
-type vendor_thermal_prop, property_type;
+vendor_internal_prop(vendor_thermal_prop)
diff --git a/wifi_sniffer/property.te b/wifi_sniffer/property.te
index df29700..ca72d35 100644
--- a/wifi_sniffer/property.te
+++ b/wifi_sniffer/property.te
@@ -1 +1 @@
-type vendor_wifi_sniffer_prop, property_type;
+vendor_internal_prop(vendor_wifi_sniffer_prop)