Feature: Add first calling report

Signed-off-by: z00838083 <zhuhuixuan@huawei.com>
This commit is contained in:
z00838083 2024-05-16 19:38:17 +08:00
parent 90b0847568
commit 902d2cf28a
5 changed files with 18 additions and 2 deletions

View File

@ -11,7 +11,7 @@
"name" : "distributedsched",
"path" : ["/system/bin/sa_main", "/system/profile/distributedsched.json"],
"uid" : "dms",
"gid" : ["dms", "shell"],
"gid" : ["dms", "shell", "access_token"],
"ondemand" : true,
"permission" : [
"ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",

View File

@ -153,6 +153,7 @@ ohos_shared_library("distributedschedsvr") {
"ability_runtime:dataobs_manager",
"ability_runtime:mission_info",
"access_token:libaccesstoken_sdk",
"access_token:libtoken_setproc",
"bundle_framework:appexecfwk_base",
"bundle_framework:appexecfwk_core",
"cJSON:cjson",

View File

@ -59,6 +59,7 @@ public:
void RegisterListener(int32_t serviceType, std::shared_ptr<IDataListener> listener);
void NotifyListenersSessionShutdown(int32_t sessionId, bool isSelfCalled);
void UnregisterListener(int32_t serviceType, std::shared_ptr<IDataListener> listener);
void SetCallingTokenId(int32_t callingTokenId);
private:
DSchedTransportSoftbusAdapter();
@ -76,6 +77,7 @@ private:
std::mutex listenerMutex_;
int32_t serverSocket_ = 0;
std::string localSessionName_;
int32_t callingTokenId_ = 0;
};
} // namespace DistributedSchedule
} // namespace OHOS

View File

@ -28,6 +28,7 @@
#include "distributed_sched_permission.h"
#include "dms_version_manager.h"
#include "dsched_continue_manager.h"
#include "dsched_transport_softbus_adapter.h"
#include "dtbschedmgr_log.h"
#include "dtbschedmgr_device_info_storage.h"
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
@ -420,6 +421,7 @@ int32_t DistributedSchedStub::ContinueMissionInner(MessageParcel& data, MessageP
if (isLocalCalling) {
std::string remoteDeviceId = (IPCSkeleton::GetCallingDeviceID() == srcDevId) ? dstDevId : srcDevId;
if (IsUsingQos(remoteDeviceId)) {
DSchedTransportSoftbusAdapter::GetInstance().SetCallingTokenId(IPCSkeleton::GetCallingTokenID());
result = DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, missionId, callback,
*wantParams);
HILOGI("result = %{public}d", result);
@ -469,6 +471,7 @@ int32_t DistributedSchedStub::ContinueMissionOfBundleNameInner(MessageParcel& da
if (isLocalCalling) {
std::string remoteDeviceId = (IPCSkeleton::GetCallingDeviceID() == srcDevId) ? dstDevId : srcDevId;
if (IsUsingQos(remoteDeviceId)) {
DSchedTransportSoftbusAdapter::GetInstance().SetCallingTokenId(IPCSkeleton::GetCallingTokenID());
result = DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, bundleName, continueType,
callback, *wantParams);
HILOGI("result = %{public}d", result);

View File

@ -21,6 +21,7 @@
#include "softbus_bus_center.h"
#include "softbus_common.h"
#include "softbus_error_code.h"
#include "token_setproc.h"
namespace OHOS {
namespace DistributedSchedule {
@ -122,7 +123,11 @@ int32_t DSchedTransportSoftbusAdapter::ConnectDevice(const std::string &peerDevi
return sessionId;
}
int32_t ret = Bind(sessionId, g_qosInfo, g_QosTV_Param_Index, &iSocketListener);
int32_t ret = SetFirstCallerTokenID(callingTokenId_);
HILOGD("SetFirstCallerTokenID callingTokenId: %d, ret: %d", callingTokenId_, ret);
callingTokenId_ = 0;
ret = Bind(sessionId, g_qosInfo, g_QosTV_Param_Index, &iSocketListener);
if (ret != ERR_OK) {
HILOGE("client bind failed, ret: %d", ret);
Shutdown(sessionId);
@ -375,5 +380,10 @@ void DSchedTransportSoftbusAdapter::UnregisterListener(int32_t serviceType, std:
HILOGI("listener unregister success");
return;
}
void DSchedTransportSoftbusAdapter::SetCallingTokenId(int32_t callingTokenId)
{
callingTokenId_ = callingTokenId;
}
} // namespace DistributedSchedule
} // namespace OHOS