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

Commit 76241ced authored by Devin Moore's avatar Devin Moore
Browse files

Fatal if RpcServer root object is set after it's running

The root object is expected to be set before the server is running.

Flag: EXEMPT protection for future
Test: atest binderRpcTest
Bug: 430314963
Change-Id: I176b03ef6d2f130c4c83812a02eea390bcedafe5
parent b18c8f50
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -158,12 +158,14 @@ void RpcServer::setSupportedFileDescriptorTransportModes(

void RpcServer::setRootObject(const sp<IBinder>& binder) {
    RpcMutexLockGuard _l(mLock);
    LOG_ALWAYS_FATAL_IF(mJoinThreadRunning, "Cannot set root object while running");
    mRootObjectFactory = nullptr;
    mRootObjectWeak = mRootObject = binder;
}

void RpcServer::setRootObjectWeak(const wp<IBinder>& binder) {
    RpcMutexLockGuard _l(mLock);
    LOG_ALWAYS_FATAL_IF(mJoinThreadRunning, "Cannot set root object while running");
    mRootObject.clear();
    mRootObjectFactory = nullptr;
    mRootObjectWeak = binder;