!1124 多用户需求:RegisterOnListener相关接口修改

Merge pull request !1124 from 韦国庆/master
This commit is contained in:
openharmony_ci 2024-10-17 10:51:13 +00:00 committed by Gitee
commit 597c3be32c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 26 additions and 12 deletions

View File

@ -121,11 +121,11 @@ public:
virtual int32_t StopSyncRemoteMissions(const std::string& devId) = 0;
virtual int32_t StopSyncMissionsFromRemote(const CallerInfo& callerInfo) = 0;
virtual int32_t RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) = 0;
virtual int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj)
virtual int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid)
{
return 0;
}
virtual int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj)
virtual int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid)
{
return 0;
}

View File

@ -62,8 +62,8 @@ public:
int32_t RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
int32_t RegisterDSchedEventListener(const DSchedEventType& type, const sptr<IRemoteObject>& obj) override;
int32_t UnRegisterDSchedEventListener(const DSchedEventType& type, const sptr<IRemoteObject>& obj) override;
int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid) override;
int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid) override;
int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
int32_t GetMissionInfos(const std::string& deviceId, int32_t numMissions,
std::vector<AAFwk::MissionInfo>& missionInfos) override;

View File

@ -157,8 +157,8 @@ public:
int32_t StopSyncRemoteMissions(const std::string& devId) override;
int32_t StopSyncMissionsFromRemote(const CallerInfo& callerInfo) override;
int32_t RegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
int32_t RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid) override;
int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj, int32_t callingUid) override;
int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
int32_t SetMissionContinueState(int32_t missionId, const AAFwk::ContinueState &state) override;
void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;

View File

@ -561,7 +561,8 @@ int32_t DistributedSchedProxy::UnRegisterDSchedEventListener(const DSchedEventTy
data, reply);
}
int32_t DistributedSchedProxy::RegisterOnListener(const std::string& type, const sptr<IRemoteObject>& obj)
int32_t DistributedSchedProxy::RegisterOnListener(const std::string& type,
const sptr<IRemoteObject>& obj, int32_t callingUid)
{
HILOGI("RegisterOnListener called");
sptr<IRemoteObject> remote = Remote();
@ -576,11 +577,13 @@ int32_t DistributedSchedProxy::RegisterOnListener(const std::string& type, const
}
PARCEL_WRITE_HELPER(data, String, type);
PARCEL_WRITE_HELPER(data, RemoteObject, obj);
PARCEL_WRITE_HELPER(data, Int32, callingUid);
PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_ON_LISTENER),
data, reply);
}
int32_t DistributedSchedProxy::RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj)
int32_t DistributedSchedProxy::RegisterOffListener(const std::string& type,
const sptr<IRemoteObject>& obj, int32_t callingUid)
{
HILOGI("RegisterOffListener called");
sptr<IRemoteObject> remote = Remote();
@ -595,6 +598,7 @@ int32_t DistributedSchedProxy::RegisterOffListener(const std::string& type, cons
}
PARCEL_WRITE_HELPER(data, String, type);
PARCEL_WRITE_HELPER(data, RemoteObject, obj);
PARCEL_WRITE_HELPER(data, Int32, callingUid);
PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_OFF_LISTENER),
data, reply);
}

View File

@ -2845,13 +2845,13 @@ int32_t DistributedSchedService::RegisterMissionListener(const std::u16string& d
}
int32_t DistributedSchedService::RegisterOnListener(const std::string& type,
const sptr<IRemoteObject>& obj)
const sptr<IRemoteObject>& obj, int32_t callingUid)
{
return DMSContinueRecvMgr::GetInstance().RegisterOnListener(type, obj);
}
int32_t DistributedSchedService::RegisterOffListener(const std::string& type,
const sptr<IRemoteObject>& obj)
const sptr<IRemoteObject>& obj, int32_t callingUid)
{
return DMSContinueRecvMgr::GetInstance().RegisterOffListener(type, obj);
}

View File

@ -1089,7 +1089,12 @@ int32_t DistributedSchedStub::RegisterOnListenerInner(MessageParcel& data, Messa
HILOGW("read IRemoteObject failed!");
return ERR_FLATTEN_OBJECT;
}
int32_t result = RegisterOnListener(type, onListener);
int32_t callingUid = data.ReadInt32();
if (callingUid < 0) {
HILOGW("read callingUid failed!");
return ERR_FLATTEN_OBJECT;
}
int32_t result = RegisterOnListener(type, onListener, callingUid);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}
@ -1109,7 +1114,12 @@ int32_t DistributedSchedStub::RegisterOffListenerInner(MessageParcel& data, Mess
HILOGW("read IRemoteObject failed!");
return ERR_FLATTEN_OBJECT;
}
int32_t result = RegisterOffListener(type, onListener);
int32_t callingUid = data.ReadInt32();
if (callingUid < 0) {
HILOGW("read callingUid failed!");
return ERR_FLATTEN_OBJECT;
}
int32_t result = RegisterOffListener(type, onListener, callingUid);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
}