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

Commit 6df21c51 authored by guochuang's avatar guochuang
Browse files

resourcemanager: update clientInfo when create DeathNotifier



In ResourceManagerService::addResource(), if Pid and Uid are unTrusted,
the mClientInfo stored in DeathNotifier is not updated. At this time,
if the process where Pid is located is killed (lowmemorykiller),
it triggers:
DeathNotifier::binderDied() -> ResourceManagerService::removeResource()
It cannot correctly find pid from mMap(which stores callingpid & callinguid),
so noteStopVideo() will not be called, resulting in the video resource
not being released.

Change-Id: Id456e0e64e34b558ff54507ce010048d9559775b
Signed-off-by: default avatarguochuang <guochuang@xiaomi.corp-partner.google.com>
parent 5d729cd7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -310,6 +310,7 @@ Status ResourceManagerService::addResource(const ClientInfoParcel& clientInfo,
    mServiceLog->add(log);

    std::scoped_lock lock{mLock};
    ClientInfoParcel updatedClientInfo = clientInfo;
    if (!mProcessInfo->isPidUidTrusted(pid, uid)) {
        pid_t callingPid = IPCThreadState::self()->getCallingPid();
        uid_t callingUid = IPCThreadState::self()->getCallingUid();
@@ -317,6 +318,8 @@ Status ResourceManagerService::addResource(const ClientInfoParcel& clientInfo,
                __FUNCTION__, pid, uid, callingPid, callingUid);
        pid = callingPid;
        uid = callingUid;
        updatedClientInfo.pid = callingPid;
        updatedClientInfo.uid = callingUid;
    }
    ResourceInfos& infos = getResourceInfosForEdit(pid, mMap);
    ResourceInfo& info = getResourceInfoForEdit(clientInfo, client, infos);
@@ -342,7 +345,7 @@ Status ResourceManagerService::addResource(const ClientInfoParcel& clientInfo,
    }
    if (info.deathNotifier == nullptr && client != nullptr) {
        info.deathNotifier = DeathNotifier::Create(
            client, ref<ResourceManagerService>(), clientInfo);
            client, ref<ResourceManagerService>(), updatedClientInfo);
    }
    if (mObserverService != nullptr && !resourceAdded.empty()) {
        mObserverService->onResourceAdded(uid, pid, resourceAdded);