mirror of
https://gitee.com/openharmony/base_location
synced 2024-11-23 14:59:51 +00:00
fix notification problem
Signed-off-by: 李文龙 <liwenlong22@huawei.com>
This commit is contained in:
parent
886e13a289
commit
8a7ede21dc
@ -149,6 +149,16 @@ void GeofenceRequest::SetBundleName(const std::string& bundleName)
|
||||
bundleName_ = bundleName;
|
||||
}
|
||||
|
||||
int32_t GeofenceRequest::GetUid()
|
||||
{
|
||||
return uid_;
|
||||
}
|
||||
|
||||
void GeofenceRequest::SetUid(int32_t uid)
|
||||
{
|
||||
uid_ = uid;
|
||||
}
|
||||
|
||||
void GeofenceRequest::ReadFromParcel(Parcel& data)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(geofenceRequestMutex_);
|
||||
@ -182,6 +192,7 @@ void GeofenceRequest::ReadFromParcel(Parcel& data)
|
||||
#endif
|
||||
callback_ = data.ReadObject<IRemoteObject>();
|
||||
bundleName_ = data.ReadString();
|
||||
uid_ = data.ReadInt32();
|
||||
auto wantAgent = data.ReadParcelable<AbilityRuntime::WantAgent::WantAgent>();
|
||||
if (wantAgent != nullptr) {
|
||||
wantAgent_ = *(wantAgent);
|
||||
@ -218,6 +229,7 @@ bool GeofenceRequest::Marshalling(Parcel& parcel) const
|
||||
#endif
|
||||
parcel.WriteRemoteObject(callback_);
|
||||
parcel.WriteString(bundleName_);
|
||||
parcel.WriteInt32(uid_);
|
||||
parcel.WriteParcelable(&wantAgent_);
|
||||
return true;
|
||||
}
|
||||
|
@ -80,6 +80,10 @@ public:
|
||||
|
||||
void SetBundleName(const std::string& bundleName);
|
||||
|
||||
int32_t GetUid();
|
||||
|
||||
void SetUid(int32_t uid);
|
||||
|
||||
void ReadFromParcel(Parcel& parcel);
|
||||
bool Marshalling(Parcel& parcel) const override;
|
||||
static std::shared_ptr<GeofenceRequest> Unmarshalling(Parcel& parcel);
|
||||
@ -92,6 +96,7 @@ private:
|
||||
GeoFence geofence_{0.0, 0.0, 0.0, WGS84};
|
||||
int scenario_;
|
||||
int fenceId_;
|
||||
int32_t uid_;
|
||||
AbilityRuntime::WantAgent::WantAgent wantAgent_;
|
||||
std::string bundleName_;
|
||||
mutable std::mutex geofenceRequestMutex_;
|
||||
|
@ -881,7 +881,7 @@ void GnssAbility::ReportGeofenceEvent(int fenceIndex, GeofenceEvent event)
|
||||
auto notificationRequestList = request->GetNotificationRequestList();
|
||||
if (transitionStatusList.size() == notificationRequestList.size()) {
|
||||
auto notificationRequest = notificationRequestList[i];
|
||||
notificationRequest.SetCreatorUid(IPCSkeleton::GetCallingUid());
|
||||
notificationRequest.SetCreatorUid(request->GetUid());
|
||||
Notification::NotificationHelper::PublishNotification(notificationRequest);
|
||||
} else {
|
||||
LBSLOGE(GNSS, "transitionStatusList size does not equals to notificationRequestList size");
|
||||
|
@ -736,6 +736,7 @@ int LocatorAbilityStub::PreAddGnssGeofence(MessageParcel &data, MessageParcel &r
|
||||
auto locatorAbility = LocatorAbility::GetInstance();
|
||||
auto request = GeofenceRequest::Unmarshalling(data);
|
||||
request->SetBundleName(identity.GetBundleName());
|
||||
request->SetUid(identity.GetUid());
|
||||
reply.WriteInt32(locatorAbility->AddGnssGeofence(request));
|
||||
return ERRCODE_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user