diff --git a/cmds/surfaceflinger/main_surfaceflinger.cpp b/cmds/surfaceflinger/main_surfaceflinger.cpp index 78b1007f5..6dbcf5c2f 100644 --- a/cmds/surfaceflinger/main_surfaceflinger.cpp +++ b/cmds/surfaceflinger/main_surfaceflinger.cpp @@ -20,6 +20,6 @@ using namespace android; int main(int argc, char** argv) { - SurfaceFlinger::publishAndJoinThreadPool(); + SurfaceFlinger::publishAndJoinThreadPool(true); return 0; } diff --git a/include/binder/BinderService.h b/include/binder/BinderService.h index 2316fef78..ca594d363 100644 --- a/include/binder/BinderService.h +++ b/include/binder/BinderService.h @@ -34,15 +34,15 @@ template class BinderService { public: - static status_t publish() { + static status_t publish(bool allowIsolated = false) { sp sm(defaultServiceManager()); - return sm->addService(String16(SERVICE::getServiceName()), new SERVICE()); + return sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated); } - static void publishAndJoinThreadPool() { + static void publishAndJoinThreadPool(bool allowIsolated = false) { sp proc(ProcessState::self()); sp sm(defaultServiceManager()); - sm->addService(String16(SERVICE::getServiceName()), new SERVICE()); + sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated); ProcessState::self()->startThreadPool(); IPCThreadState::self()->joinThreadPool(); } diff --git a/include/binder/IServiceManager.h b/include/binder/IServiceManager.h index 24e9e992c..2c297d64f 100644 --- a/include/binder/IServiceManager.h +++ b/include/binder/IServiceManager.h @@ -47,7 +47,8 @@ public: * Register a service. */ virtual status_t addService( const String16& name, - const sp& service) = 0; + const sp& service, + bool allowIsolated = false) = 0; /** * Return list of all existing services. diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 33b305dcc..1750640fc 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -151,12 +151,14 @@ public: return reply.readStrongBinder(); } - virtual status_t addService(const String16& name, const sp& service) + virtual status_t addService(const String16& name, const sp& service, + bool allowIsolated) { Parcel data, reply; data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor()); data.writeString16(name); data.writeStrongBinder(service); + data.writeInt32(allowIsolated ? 1 : 0); status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply); return err == NO_ERROR ? reply.readExceptionCode() : err; }