!535 修复sensor死亡监听

Merge pull request !535 from HYH/master
This commit is contained in:
openharmony_ci 2023-12-21 12:44:38 +00:00 committed by Gitee
commit bbf049a0ef
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 4 additions and 4 deletions

View File

@ -61,10 +61,6 @@ void SensorService::OnStart()
SEN_HILOGW("SensorService has already started");
return;
}
if (clientDeathObserver_ == nullptr) {
clientDeathObserver_ = new (std::nothrow) DeathRecipientTemplate(*const_cast<SensorService *>(this));
CHKPV(clientDeathObserver_);
}
#ifdef HDF_DRIVERS_INTERFACE_SENSOR
if (!InitInterface()) {
SEN_HILOGE("Init interface error");
@ -403,6 +399,10 @@ void SensorService::RegisterClientDeathRecipient(sptr<IRemoteObject> sensorClien
{
CALL_LOG_ENTER;
CHKPV(sensorClient);
if (clientDeathObserver_ == nullptr) {
clientDeathObserver_ = new (std::nothrow) DeathRecipientTemplate(*const_cast<SensorService *>(this));
CHKPV(clientDeathObserver_);
}
sensorClient->AddDeathRecipient(clientDeathObserver_);
clientInfo_.SaveClientPid(sensorClient, pid);
}

0
services/src/sensor_service_stub.cpp Executable file → Normal file
View File