Need to do ipc between service running on vendor partition and clients running on system partition. I'm trying to use binder for the ipc, but with no luck. service code:
int main(int argc, char** argv)
{
//sp<ProcessState> proc(ProcessState::self());
//android::ProcessState::initWithDriver("/dev/vndbinder");
//ALOGI("Done init vndbinder from server side\n");
sp<HelloService> hello = new HelloService("HELLO-API");
sp<IServiceManager> sm = defaultServiceManager();
sm->addService(String16("hello.service"), hello);
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
return 0;
}
client code:
int main(int argc, char** argv)
{
//sp<ProcessState> proc(ProcessState::self());
//android::ProcessState::initWithDriver("/dev/vndbinder");
//ALOGI("Done init vndbinder from client side\n");
sp<IServiceManager> sm = defaultServiceManager();
if (sm == NULL) {
ALOGI("can not get service manager");
}
sp<IBinder> b = sm->getService(String16("hello.service"));
if (b == 0)
{
ALOGI("can't get hello service\n");
return -1;
}
else
{
ALOGI("we get hello service\n");
}
sp<IHello> hello(interface_cast<IHello>(b));
if (hello == NULL) {
ALOGI("can not cast interface");
}
...
If I run the server and client both from system/bin folder, I do see the communication. But if I run the server from vendor/bin folder and the client from system/bin folder, it always gives errors "ProcessState: Not able to get context object on /dev/vndbinder.".
Thanks for any suggestions!