#include #include #include #include #include using namespace android; class LedService : public BBinder { public: status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case 1: printf("LedService::LED_ON\n"); return NO_ERROR; default: return BBinder::onTransact(code, data, reply, flags); } } }; int main() { sp proc(ProcessState::self()); sp sm(defaultServiceManager()); sm->addService( String16("led.service"), new LedService ); IPCThreadState::self()->joinThreadPool(); return 0; }