Open ya1gaurav opened 2 years ago
If no one is running a service manager for you, you would have to do it yourself. Unit tests contain a few very primitive implementations of various servicemanager binder APIs, like this one for example. Those would give you a very rough idea how it could be done with libgbinder. It's not that hard, really, especially the early simple servicemanager APIs like the one called "aidl" in libgbinder.
Writing a real servicemanager (e.g. the one accessible via zero handle) would require a few changes in libgbinder, at least to provide an equivalent of ProcessState::becomeContextManager and keep an internal reference to the local servicemanager object (no more than one per binder device). AFAICT becoming the context manager is a one-way thing, i.e. there's no way to stop being the context manager.
I can imagine a function like gbinder_local_object_become_context_manager()
being added to libgbinder API if that's really going to be useful to somebody.
If no one is running a service manager for you, you would have to do it yourself. Unit tests contain a few very primitive implementations of various servicemanager binder APIs, like this one for example. Those would give you a very rough idea how it could be done with libgbinder. It's not that hard, really, especially the early simple servicemanager APIs like the one called "aidl" in libgbinder.
Writing a real servicemanager (e.g. the one accessible via zero handle) would require a few changes in libgbinder, at least to provide an equivalent of ProcessState::becomeContextManager and keep an internal reference to the local servicemanager object (no more than one per binder device). AFAICT becoming the context manager is a one-way thing, i.e. there's no way to stop being the context manager.
I can imagine a function like
gbinder_local_object_become_context_manager()
being added to libgbinder API if that's really going to be useful to somebody.
This would be helpful. A service (systemd service daemon) could be created which will become context manager & the service could be launched on bootup.
In case of android, servicemanager run as separate service during boot. In case of non android OS, how to run service manager using libgbinder?