Loading libs/binder/RpcServer.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -48,16 +48,20 @@ sp<RpcConnection> RpcServer::addClientConnection() { auto connection = RpcConnection::make(); connection->setForServer(sp<RpcServer>::fromExisting(this)); { std::lock_guard<std::mutex> _l(mLock); mConnections.push_back(connection); } return connection; } void RpcServer::setRootObject(const sp<IBinder>& binder) { LOG_ALWAYS_FATAL_IF(mRootObject != nullptr, "There can only be one root object"); std::lock_guard<std::mutex> _l(mLock); mRootObject = binder; } sp<IBinder> RpcServer::getRootObject() { std::lock_guard<std::mutex> _l(mLock); return mRootObject; } Loading libs/binder/include/binder/RpcServer.h +4 −13 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ #include <utils/Errors.h> #include <utils/RefBase.h> #include <mutex> // WARNING: This is a feature which is still in development, and it is subject // to radical change. Any production use of this may subject your code to any // number of problems. Loading @@ -30,9 +32,6 @@ namespace android { /** * This represents a server of an interface, which may be connected to by any * number of clients over sockets. * * This object is not (currently) thread safe. All calls to it are expected to * happen at process startup. */ class RpcServer final : public virtual RefBase { public: Loading @@ -50,17 +49,9 @@ public: */ sp<RpcConnection> addClientConnection(); /** * Allowing a server to explicitly drop clients would be easy to add here, * but it is not currently implemented, since users of this functionality * could not use similar functionality if they are running under real * binder. */ // void drop(const sp<RpcConnection>& connection); /** * The root object can be retrieved by any client, without any * authentication. * authentication. TODO(b/183988761) */ void setRootObject(const sp<IBinder>& binder); Loading @@ -77,8 +68,8 @@ private: bool mAgreedExperimental = false; std::mutex mLock; sp<IBinder> mRootObject; std::vector<sp<RpcConnection>> mConnections; // per-client }; Loading Loading
libs/binder/RpcServer.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -48,16 +48,20 @@ sp<RpcConnection> RpcServer::addClientConnection() { auto connection = RpcConnection::make(); connection->setForServer(sp<RpcServer>::fromExisting(this)); { std::lock_guard<std::mutex> _l(mLock); mConnections.push_back(connection); } return connection; } void RpcServer::setRootObject(const sp<IBinder>& binder) { LOG_ALWAYS_FATAL_IF(mRootObject != nullptr, "There can only be one root object"); std::lock_guard<std::mutex> _l(mLock); mRootObject = binder; } sp<IBinder> RpcServer::getRootObject() { std::lock_guard<std::mutex> _l(mLock); return mRootObject; } Loading
libs/binder/include/binder/RpcServer.h +4 −13 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ #include <utils/Errors.h> #include <utils/RefBase.h> #include <mutex> // WARNING: This is a feature which is still in development, and it is subject // to radical change. Any production use of this may subject your code to any // number of problems. Loading @@ -30,9 +32,6 @@ namespace android { /** * This represents a server of an interface, which may be connected to by any * number of clients over sockets. * * This object is not (currently) thread safe. All calls to it are expected to * happen at process startup. */ class RpcServer final : public virtual RefBase { public: Loading @@ -50,17 +49,9 @@ public: */ sp<RpcConnection> addClientConnection(); /** * Allowing a server to explicitly drop clients would be easy to add here, * but it is not currently implemented, since users of this functionality * could not use similar functionality if they are running under real * binder. */ // void drop(const sp<RpcConnection>& connection); /** * The root object can be retrieved by any client, without any * authentication. * authentication. TODO(b/183988761) */ void setRootObject(const sp<IBinder>& binder); Loading @@ -77,8 +68,8 @@ private: bool mAgreedExperimental = false; std::mutex mLock; sp<IBinder> mRootObject; std::vector<sp<RpcConnection>> mConnections; // per-client }; Loading