After examining the Android source code in which you mention the Binder mechanism, you should look at the getMediaPlayerService () method and check how the service manager processes the media server. If you can fix this method and correctly define your service, you should be fine.
IMediaDeathNotifier::getMediaPlayerService() { LOGV("getMediaPlayerService"); Mutex::Autolock _l(sServiceLock); if (sMediaPlayerService.get() == 0) { sp<IServiceManager> sm = defaultServiceManager(); sp<IBinder> binder; do { binder = sm->getService(String16("media.player")); if (binder != 0) { break; } LOGW("Media player service not published, waiting..."); usleep(500000); // 0.5 s } while(true); if (sDeathNotifier == NULL) { sDeathNotifier = new DeathNotifier(); } binder->linkToDeath(sDeathNotifier); sMediaPlayerService = interface_cast<IMediaPlayerService>(binder); } LOGE_IF(sMediaPlayerService == 0, "no media player service!?"); return sMediaPlayerService; }
This method is located in: frameworks/base/media/libmedia/IMediaDeathNotifier.cpp
In addition, the service is installed by calling:
void MediaPlayerService::instantiate() { defaultServiceManager()->addService( String16("media.player"), new MediaPlayerService()); }
which can be found at: /frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp
source share