servicemanager started property

If something starts before servicemanager does,
intelligently wait for servicemanager to start rather
than sleeping for 1s.

Bug: 239382640
Test: boot
Change-Id: If0380c3a1fce937b0939cd6137fcb25f3e47d14c
diff --git a/microdroid/system/private/domain.te b/microdroid/system/private/domain.te
index d87df40..dc9691a 100644
--- a/microdroid/system/private/domain.te
+++ b/microdroid/system/private/domain.te
@@ -48,6 +48,7 @@
 
 # /dev/binder can be accessed by ... everyone! :)
 allow domain binder_device:chr_file rw_file_perms;
+get_prop(domain, servicemanager_prop)
 
 # Restrict binder ioctls to an allowlist. Additional ioctl commands may be
 # added to individual domains, but this sets safe defaults for all processes.
diff --git a/microdroid/system/private/property_contexts b/microdroid/system/private/property_contexts
index 16b40bc..89609b9 100644
--- a/microdroid/system/private/property_contexts
+++ b/microdroid/system/private/property_contexts
@@ -156,6 +156,8 @@
 
 heapprofd.enable u:object_r:heapprofd_prop:s0 exact bool
 
+servicemanager.ready u:object_r:servicemanager_prop:s0 exact bool
+
 # ART properties for CompOS
 dalvik.vm.                                  u:object_r:dalvik_config_prop:s0 prefix
 ro.dalvik.vm.                               u:object_r:dalvik_config_prop:s0 prefix
diff --git a/microdroid/system/private/servicemanager.te b/microdroid/system/private/servicemanager.te
index d51c827..91a8ad2 100644
--- a/microdroid/system/private/servicemanager.te
+++ b/microdroid/system/private/servicemanager.te
@@ -24,6 +24,7 @@
 add_service(servicemanager, service_manager_service)
 
 set_prop(servicemanager, ctl_interface_start_prop)
+set_prop(servicemanager, servicemanager_prop)
 
 # servicemanager is using bootstrap bionic
 use_bootstrap_libs(servicemanager)
diff --git a/microdroid/system/public/property.te b/microdroid/system/public/property.te
index f85ba76..a04fc19 100644
--- a/microdroid/system/public/property.te
+++ b/microdroid/system/public/property.te
@@ -24,6 +24,7 @@
 type ctl_stop_prop, property_type;
 type ctl_tombstone_transmit_prop, property_type;
 type ctl_zipfuse_prop, property_type;
+type servicemanager_prop, property_type;
 type debug_prop, property_type;
 type default_prop, property_type;
 type dev_mnt_prop, property_type;
diff --git a/private/compat/33.0/33.0.ignore.cil b/private/compat/33.0/33.0.ignore.cil
index 305116c..059b6aa 100644
--- a/private/compat/33.0/33.0.ignore.cil
+++ b/private/compat/33.0/33.0.ignore.cil
@@ -9,6 +9,7 @@
     device_config_vendor_system_native_prop
     hal_bootctl_service
     permissive_mte_prop
+    servicemanager_prop
     system_net_netd_service
     virtual_face_hal_prop
     virtual_fingerprint_hal_prop
diff --git a/private/property_contexts b/private/property_contexts
index cd880d3..dd8849b 100644
--- a/private/property_contexts
+++ b/private/property_contexts
@@ -220,6 +220,9 @@
 # heapprofd properties
 heapprofd.              u:object_r:heapprofd_prop:s0
 
+# servicemanager properties
+servicemanager.ready    u:object_r:servicemanager_prop:s0 exact bool
+
 # hwservicemanager properties
 hwservicemanager.       u:object_r:hwservicemanager_prop:s0
 
diff --git a/private/servicemanager.te b/private/servicemanager.te
index 56a41e1..95a9496 100644
--- a/private/servicemanager.te
+++ b/private/servicemanager.te
@@ -5,6 +5,7 @@
 read_runtime_log_tags(servicemanager)
 
 set_prop(servicemanager, ctl_interface_start_prop)
+set_prop(servicemanager, servicemanager_prop)
 
 # servicemanager is using bootstrap bionic
 use_bootstrap_libs(servicemanager)
diff --git a/public/domain.te b/public/domain.te
index d0310d3..0e1e799 100644
--- a/public/domain.te
+++ b/public/domain.te
@@ -80,6 +80,7 @@
 
 # /dev/binder can be accessed by ... everyone! :)
 allow { domain -hwservicemanager -vndservicemanager } binder_device:chr_file rw_file_perms;
+get_prop({domain -hwservicemanager -vndservicemanager }, servicemanager_prop)
 
 # Restrict binder ioctls to an allowlist. Additional ioctl commands may be
 # added to individual domains, but this sets safe defaults for all processes.
diff --git a/public/property.te b/public/property.te
index 9b538cf..865acc2 100644
--- a/public/property.te
+++ b/public/property.te
@@ -82,6 +82,7 @@
 system_restricted_prop(provisioned_prop)
 system_restricted_prop(restorecon_prop)
 system_restricted_prop(retaildemo_prop)
+system_restricted_prop(servicemanager_prop)
 system_restricted_prop(smart_idle_maint_enabled_prop)
 system_restricted_prop(socket_hook_prop)
 system_restricted_prop(sqlite_log_prop)