Code review

Signed-off-by: wangzhen <wangzhen416@huawei.com>
This commit is contained in:
wangzhen
2026-02-03 22:11:15 +08:00
parent e8834e96a7
commit 8d6469b3bc
4 changed files with 3 additions and 14 deletions
@@ -424,7 +424,7 @@ void CallerConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &el
TAG_LOGI(AAFwkTag::LOCAL_CALL, "Callee ability terminated, notify all callers");
// Notify all callers that callee is terminating with proper release reason
localCallRecord_->NotifyCallersReleased(ON_RELEASE);
localCallRecord_->OnCallStubDied();
// Remove record from container
auto container = container_.lock();
@@ -125,16 +125,11 @@ bool LocalCallRecord::RemoveCaller(const std::shared_ptr<CallerCallBack>& callba
void LocalCallRecord::OnCallStubDied()
{
TAG_LOGI(AAFwkTag::LOCAL_CALL, "OnCallStubDied");
NotifyCallersReleased(ON_DIED);
}
void LocalCallRecord::NotifyCallersReleased(const std::string &releaseReason)
{
std::lock_guard lock(callersMutex_);
for (auto& callBack : callers_) {
if (callBack != nullptr) {
TAG_LOGI(AAFwkTag::LOCAL_CALL, "Notify caller released: %{public}s", releaseReason.c_str());
callBack->InvokeOnRelease(releaseReason);
TAG_LOGI(AAFwkTag::LOCAL_CALL, "Notify caller released");
callBack->InvokeOnRelease(ON_DIED);
}
}
}
@@ -39,11 +39,6 @@ public:
void AddCaller(const std::shared_ptr<CallerCallBack> &callback);
bool RemoveCaller(const std::shared_ptr<CallerCallBack> &callback);
void OnCallStubDied();
/**
* @brief Notify all callers with specific release reason
* @param releaseReason The release reason (ON_DIED or ON_RELEASE)
*/
void NotifyCallersReleased(const std::string &releaseReason);
void NotifyRemoteStateChanged(int32_t abilityState);
sptr<IRemoteObject> GetRemoteObject() const;
void InvokeCallBack() const;
@@ -935,7 +935,6 @@ HWTEST_F(LocalCallContainerTest, Local_Call_Container_OnAbilityDisconnectDone_05
connect->OnAbilityDisconnectDone(elementName, code);
EXPECT_TRUE(isOnReleaseCalled);
EXPECT_EQ(receivedReason, "release");
}
/**