include!(concat!(env!("OUT_DIR"), "/service_manager_15.rs"));
crate::hub::impl_sm_module_body! { @custom_check_service
pub use android::os::IServiceManager::FLAG_IS_LAZY_SERVICE;
pub use android::os::ServiceDebugInfo::ServiceDebugInfo;
pub fn check_service(sm: &BpServiceManager, name: &str) -> Option<SIBinder> {
get_service(sm, name)
}
pub(crate) fn add_lazy_service(
sm: &BpServiceManager,
identifier: &str,
binder: SIBinder,
) -> std::result::Result<(), Status> {
sm.addService(
identifier,
&binder,
false,
DUMP_FLAG_PRIORITY_DEFAULT | FLAG_IS_LAZY_SERVICE,
)
}
pub fn get_service_debug_info(
sm: &BpServiceManager,
) -> Result<Vec<ServiceDebugInfo>> {
sm.getServiceDebugInfo().map_err(|e| e.into())
}
pub fn get_declared_instances(sm: &BpServiceManager, iface: &str) -> Vec<String> {
match sm.getDeclaredInstances(iface) {
Ok(result) => result,
Err(err) => {
log::error!("Failed to get_declared_instances({iface}): {err}");
Vec::new()
}
}
}
pub fn get_connection_info(
sm: &BpServiceManager,
name: &str,
) -> Option<android::os::ConnectionInfo::ConnectionInfo> {
match sm.getConnectionInfo(name) {
Ok(result) => result,
Err(err) => {
log::error!("Failed to get_connection_info({name}): {err}");
None
}
}
}
}