Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6957b79 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: log debug server start/stop

09-24 03:19:36.379  3299  3301 I binderHostDeviceTest-service: RpcBinder: Started Binder debug on android.binderHostDeviceTestService
09-24 03:19:36.380  3302  3302 I servicedispatcher: Finish setting up RPC on service binderHostDeviceTestService on port 52133
09-24 03:19:36.778  3299  3301 I binderHostDeviceTest-service: RpcBinder: binder died, shutting down RpcServer for android.binderHostDeviceTestService

Before we didn't have logs when this happens, but it's a pretty significant event.

Fixes: 244597104
Test: binderHostDeviceTest
Change-Id: Ic22851663d18e4fd3d3518a2b25714582f8e05d6
parent 00a54e41
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -232,7 +232,10 @@ public:
          : mRpcServer(rpcServer), mKeepAliveBinder(keepAliveBinder), mBinder(binder) {}
    virtual ~RpcServerLink();
    void binderDied(const wp<IBinder>&) override {
        LOG_RPC_DETAIL("RpcServerLink: binder died, shutting down RpcServer");
        auto promoted = mBinder.promote();
        ALOGI("RpcBinder: binder died, shutting down RpcServer for %s",
              promoted ? String8(promoted->getInterfaceDescriptor()).c_str() : "<NULL>");

        if (mRpcServer == nullptr) {
            ALOGW("RpcServerLink: Unable to shut down RpcServer because it does not exist.");
        } else {
@@ -241,11 +244,7 @@ public:
        }
        mRpcServer.clear();

        auto promoted = mBinder.promote();
        if (promoted == nullptr) {
            ALOGW("RpcServerLink: Unable to remove link from parent binder object because parent "
                  "binder object is gone.");
        } else {
        if (promoted) {
            promoted->removeRpcServerLink(sp<RpcServerLink>::fromExisting(this));
        }
        mBinder.clear();
@@ -706,6 +705,7 @@ status_t BBinder::setRpcClientDebug(android::base::unique_fd socketFd,
        return status;
    }
    rpcServer->setMaxThreads(binderThreadPoolMaxCount);
    LOG(INFO) << "RpcBinder: Started Binder debug on " << getInterfaceDescriptor();
    rpcServer->start();
    e->mRpcServerLinks.emplace(link);
    LOG_RPC_DETAIL("%s(fd=%d) successful", __PRETTY_FUNCTION__, socketFdForPrint);