Signed-off-by: pengyanggit yangpeng177@huawei.com

Signed-off-by: pengyanggit <yangpeng177@huawei.com>
Change-Id: I02a81c945bb24d95ecd283d70d51248b513578ba
This commit is contained in:
pengyanggit 2024-07-29 15:07:52 +08:00
parent ad8032a9f7
commit 6af679d137
3 changed files with 11 additions and 0 deletions

View File

@ -24,6 +24,7 @@
"ability_runtime",
"access_token",
"cJSON",
"hicollie",
"hilog",
"ipc",
"safwk",

View File

@ -60,6 +60,7 @@ ohos_shared_library("intention_service") {
external_deps = [
"access_token:libaccesstoken_sdk",
"graphic_2d:librender_service_client",
"hicollie:libhicollie",
"hilog:libhilog",
"image_framework:image_native",
"input:libmmi-client",

View File

@ -16,6 +16,8 @@
#include "intention_service.h"
#include "ipc_skeleton.h"
#include "xcollie/xcollie.h"
#include "xcollie/xcollie_define.h"
#include "devicestatus_define.h"
#include "i_plugin.h"
@ -26,6 +28,7 @@
namespace OHOS {
namespace Msdp {
namespace DeviceStatus {
constexpr int32_t SERVER_TIMEOUT { 5 };
IntentionService::IntentionService(IContext *context)
: context_(context), socketServer_(context), cooperate_(context), drag_(context)
@ -117,6 +120,8 @@ int32_t IntentionService::Stop(Intention intention, MessageParcel &data, Message
int32_t IntentionService::AddWatch(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply)
{
int32_t timerId = HiviewDFX::XCollie::GetInstance().SetTimer("DeviceStatusIntensionServerAddWatch", SERVER_TIMEOUT,
nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_LOG);
CallingContext context {
.intention = intention,
.fullTokenId = IPCSkeleton::GetCallingFullTokenID(),
@ -133,6 +138,7 @@ int32_t IntentionService::AddWatch(Intention intention, uint32_t id, MessageParc
if (ret != RET_OK) {
FI_HILOGE("AddWatch failed, ret:%{public}d", ret);
}
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
return ret;
}
@ -201,6 +207,8 @@ int32_t IntentionService::GetParam(Intention intention, uint32_t id, MessageParc
int32_t IntentionService::Control(Intention intention, uint32_t id, MessageParcel &data, MessageParcel &reply)
{
int32_t timerId = HiviewDFX::XCollie::GetInstance().SetTimer("DeviceStatusIntensionServerControl", SERVER_TIMEOUT,
nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_LOG);
CallingContext context {
.intention = intention,
.fullTokenId = IPCSkeleton::GetCallingFullTokenID(),
@ -217,6 +225,7 @@ int32_t IntentionService::Control(Intention intention, uint32_t id, MessageParce
if (ret != RET_OK) {
FI_HILOGE("Control failed, ret:%{public}d", ret);
}
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
return ret;
}