sync diff

Signed-off-by: lwx1285820 <lishaoxiong10@huawei.com>
This commit is contained in:
lwx1285820 2024-11-08 08:04:14 +00:00
parent b7ed244001
commit b590cd30ef
27 changed files with 121 additions and 152 deletions

View File

@ -70,9 +70,9 @@ device_status_root_path = "//base/msdp/device_status"
device_status_interfaces_path = "${device_status_root_path}/interfaces"
device_status_libs_path = "${device_status_root_path}/libs"
device_status_frameworks_path = "${device_status_root_path}/frameworks"
device_status_intention_path = "${device_status_root_path}/intention"
device_status_service_path = "${device_status_root_path}/services"
device_status_utils_path = "${device_status_root_path}/utils/common"
device_status_intention_path = "${device_status_root_path}/intention"
device_status_fuzz_output_path = "${device_status_part_name}/device_status"
intention_root_path = "//base/msdp/device_status/intention"
file_dfs_service_path = "//foundation/filemanagement/dfs_service"

View File

@ -437,7 +437,7 @@ void DSoftbusAdapterImpl::ShutdownServer()
int32_t DSoftbusAdapterImpl::OpenSessionLocked(const std::string &networkId)
{
CALL_INFO_TRACE;
CALL_DEBUG_ENTER;
if (sessions_.find(networkId) != sessions_.end()) {
FI_HILOGD("InputSoftbus session has already opened");
return RET_OK;

View File

@ -47,8 +47,8 @@ private:
void OnProgress(Context &context, const CooperateEvent &event) override;
void OnReset(Context &context, const CooperateEvent &event) override;
static void BuildChains(std::shared_ptr<Initial> initial, CooperateFree &parent);
static void RemoveChains(std::shared_ptr<Initial> initial);
static void BuildChains(std::shared_ptr<Initial> self, CooperateFree &parent);
static void RemoveChains(std::shared_ptr<Initial> self);
private:
void OnStart(Context &context, const CooperateEvent &event);

View File

@ -105,7 +105,6 @@ private:
std::array<std::shared_ptr<ICooperateState>, N_COOPERATE_STATES> states_;
std::set<std::string> onlineBoards_;
int32_t monitorId_ { -1 };
int32_t screenEventTimer_ { -1 };
std::vector<std::string> clientBundleNames_;
sptr<AppStateObserver> appStateObserver_ { nullptr };
std::shared_ptr<ICommonEventObserver> observer_ { nullptr };

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -18,6 +18,7 @@
#include <algorithm>
#include "display_manager.h"
#include "ddm_adapter.h"
#include "devicestatus_define.h"
#include "dsoftbus_handler.h"

View File

@ -204,7 +204,7 @@ void CooperateFree::Initial::OnRemoteStart(Context &context, const CooperateEven
void CooperateFree::Initial::OnPointerEvent(Context &context, const CooperateEvent &event)
{
CALL_DEBUG_ENTER;
if (context.NeedHideCursor()) {
if (context.NeedHideCursor() && context.IsCooperateWithCrossDrag()) {
FI_HILOGD("Hide cursor before dragData rcvd when come back");
return;
}

View File

@ -37,12 +37,12 @@ constexpr double MIN_DAMPLING_COEFFICENT { 0.05 };
constexpr double MAX_DAMPLING_COEFFICENT { 1.5 };
constexpr double DEFAULT_DAMPLING_COEFFICIENT { 1.0 };
const std::string WIFI_INTERFACE_NAME { "chba0" };
const unsigned int RESTORE_SCENE { 0 };
const unsigned int FORBIDDEN_SCENE { 1 };
const int UPPER_SCENE_FPS { 0 };
const unsigned int UPPER_SCENE_BW { 0 };
const double MIN_POSITIVE_RAW { 1.0 };
const double MIN_NEGATIVE_RAW { -1.0 };
const int32_t RESTORE_SCENE { 0 };
const int32_t FORBIDDEN_SCENE { 1 };
const int32_t UPPER_SCENE_FPS { 0 };
const int32_t UPPER_SCENE_BW { 0 };
constexpr double MIN_POSITIVE_RAW { 1.0 };
constexpr double MIN_NEGATIVE_RAW { -1.0 };
constexpr float EPSILON { 1E-6 };
}
@ -89,7 +89,7 @@ void InputEventBuilder::Disable()
TurnOnChannelScan();
ResetPressedEvents();
}
if ((pointerEventTimer_ > 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
if ((pointerEventTimer_ >= 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
env_->GetTimerManager().RemoveTimer(pointerEventTimer_);
pointerEventTimer_ = -1;
}
@ -188,7 +188,7 @@ void InputEventBuilder::OnPointerEvent(Msdp::NetPacket &packet)
if (scanState_) {
TurnOffChannelScan();
}
if ((pointerEventTimer_ > 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
if ((pointerEventTimer_ >= 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
env_->GetTimerManager().RemoveTimer(pointerEventTimer_);
pointerEventTimer_ = -1;
}
@ -249,7 +249,7 @@ void InputEventBuilder::TurnOffChannelScan()
scanState_ = false;
if (SetWifiScene(FORBIDDEN_SCENE) != RET_OK) {
scanState_ = true;
FI_HILOGE("forbidden scene failed");
FI_HILOGE("Forbidden scene failed");
}
}
@ -258,7 +258,7 @@ void InputEventBuilder::TurnOnChannelScan()
scanState_ = true;
if (SetWifiScene(RESTORE_SCENE) != RET_OK) {
scanState_ = false;
FI_HILOGE("restore scene failed");
FI_HILOGE("Restore scene failed");
}
}
@ -270,7 +270,7 @@ int32_t InputEventBuilder::SetWifiScene(unsigned int scene)
upperScene.fps = UPPER_SCENE_FPS;
upperScene.bw = UPPER_SCENE_BW;
if (Hid2dSetUpperScene(WIFI_INTERFACE_NAME.c_str(), &upperScene) != RET_OK) {
FI_HILOGE("set wifi scene failed");
FI_HILOGE("Set wifi scene failed");
return RET_ERR;
}
return RET_OK;
@ -311,14 +311,14 @@ bool InputEventBuilder::DampPointerMotion(std::shared_ptr<MMI::PointerEvent> poi
if (rawDxRight - MIN_POSITIVE_RAW >= EPSILON) {
item.SetRawDx(static_cast<int32_t>(rawDxRight));
} else {
item.SetRawDx(MIN_POSITIVE_RAW);
item.SetRawDx(static_cast<int32_t>(MIN_POSITIVE_RAW));
}
} else {
double rawDxLeft = item.GetRawDx() * GetDamplingCoefficient(DamplingDirection::DAMPLING_DIRECTION_LEFT);
if (rawDxLeft - MIN_NEGATIVE_RAW < EPSILON) {
item.SetRawDx(static_cast<int32_t>(rawDxLeft));
} else {
item.SetRawDx(MIN_NEGATIVE_RAW);
item.SetRawDx(static_cast<int32_t>(MIN_NEGATIVE_RAW));
}
}
if (item.GetRawDy() >= 0) {

View File

@ -32,10 +32,10 @@ namespace Cooperate {
namespace {
const std::string WIFI_INTERFACE_NAME { "chba0" };
const unsigned int RESTORE_SCENE { 0 };
const unsigned int FORBIDDEN_SCENE { 1 };
const int UPPER_SCENE_FPS { 0 };
const unsigned int UPPER_SCENE_BW { 0 };
const int32_t RESTORE_SCENE { 0 };
const int32_t FORBIDDEN_SCENE { 1 };
const int32_t UPPER_SCENE_FPS { 0 };
const int32_t UPPER_SCENE_BW { 0 };
}
std::set<int32_t> InputEventInterceptor::filterKeys_ {
@ -82,7 +82,7 @@ void InputEventInterceptor::Disable()
env_->GetInput().RemoveInterceptor(interceptorId_);
interceptorId_ = -1;
}
if ((pointerEventTimer_ > 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
if ((pointerEventTimer_ >= 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
env_->GetTimerManager().RemoveTimer(pointerEventTimer_);
pointerEventTimer_ = -1;
}
@ -100,7 +100,7 @@ void InputEventInterceptor::OnPointerEvent(std::shared_ptr<MMI::PointerEvent> po
if (scanState_) {
TurnOffChannelScan();
}
if ((pointerEventTimer_ > 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
if ((pointerEventTimer_ >= 0) && (env_->GetTimerManager().IsExist(pointerEventTimer_))) {
env_->GetTimerManager().RemoveTimer(pointerEventTimer_);
pointerEventTimer_ = -1;
}
@ -173,7 +173,7 @@ void InputEventInterceptor::TurnOffChannelScan()
scanState_ = false;
if (SetWifiScene(FORBIDDEN_SCENE) != RET_OK) {
scanState_ = true;
FI_HILOGE("forbidden scene failed");
FI_HILOGE("Forbidden scene failed");
}
}
@ -182,7 +182,7 @@ void InputEventInterceptor::TurnOnChannelScan()
scanState_ = true;
if (SetWifiScene(RESTORE_SCENE) != RET_OK) {
scanState_ = false;
FI_HILOGE("restore scene failed");
FI_HILOGE("Restore scene failed");
}
}
@ -194,7 +194,7 @@ int32_t InputEventInterceptor::SetWifiScene(unsigned int scene)
upperScene.fps = UPPER_SCENE_FPS;
upperScene.bw = UPPER_SCENE_BW;
if (Hid2dSetUpperScene(WIFI_INTERFACE_NAME.c_str(), &upperScene) != RET_OK) {
FI_HILOGE("set wifi scene failed");
FI_HILOGE("Set wifi scene failed");
return RET_ERR;
}
return RET_OK;

View File

@ -476,7 +476,7 @@ void StateMachine::OnRemoteStart(Context &context, const CooperateEvent &event)
FI_HILOGE("CheckSameAccountToLocal failed, switch is : %{public}d, unchain", isCooperateEnable_);
CooperateEvent stopEvent(
CooperateEventType::STOP,
StopCooperateEvent{
StopCooperateEvent {
.isUnchained = true
}
);

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef I_DINPUT_ADAPTER_H
#define I_DINPUT_ADAPTER_H
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
namespace OHOS {
namespace Msdp {
namespace DeviceStatus {
class IDInputAdapter {
public:
struct BusinessEvent {
int32_t keyCode;
int32_t keyAction;
std::vector<int32_t> pressedKeys;
};
using DInputCallback = std::function<void(bool)>;
IDInputAdapter() = default;
virtual ~IDInputAdapter() = default;
virtual bool IsNeedFilterOut(const std::string &networkId, BusinessEvent &&event) = 0;
virtual int32_t StartRemoteInput(const std::string &remoteNetworkId, const std::string &originNetworkId,
const std::vector<std::string> &inputDeviceDhids, DInputCallback callback) = 0;
virtual int32_t StopRemoteInput(const std::string &remoteNetworkId, const std::string &originNetworkId,
const std::vector<std::string> &inputDeviceDhids, DInputCallback callback) = 0;
virtual int32_t StopRemoteInput(const std::string &originNetworkId,
const std::vector<std::string> &inputDeviceDhids, DInputCallback callback) = 0;
virtual int32_t PrepareRemoteInput(const std::string &remoteNetworkId,
const std::string &originNetworkId, DInputCallback callback) = 0;
virtual int32_t UnPrepareRemoteInput(const std::string &remoteNetworkId,
const std::string &originNetworkId, DInputCallback callback) = 0;
virtual int32_t PrepareRemoteInput(const std::string &networkId, DInputCallback callback) = 0;
virtual int32_t UnPrepareRemoteInput(const std::string &networkId, DInputCallback callback) = 0;
virtual int32_t RegisterSessionStateCb(std::function<void(uint32_t)> callback) = 0;
virtual int32_t UnregisterSessionStateCb() = 0;
};
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS
#endif // I_DINPUT_ADAPTER_H

View File

@ -35,7 +35,7 @@ public:
~IntentionService() = default;
DISALLOW_COPY_AND_MOVE(IntentionService);
int32_t Dump(int fd, const std::vector<std::u16string> &args) override;
int32_t Dump(int32_t fd, const std::vector<std::u16string> &args) override;
private:
int32_t Enable(Intention intention, MessageParcel &data, MessageParcel &reply) override;

View File

@ -28,8 +28,8 @@ namespace Msdp {
namespace DeviceStatus {
void IntentionDumper::Dump(int32_t fd, const std::vector<std::string> &args)
{
constexpr size_t BUFSIZE { 1024 };
char buf[BUFSIZE] { "hidumper" };
constexpr size_t bufSize { 1024 };
char buf[bufSize] { "hidumper" };
std::vector<char *> argv(args.size() + 1);
argv[0] = buf;

View File

@ -37,7 +37,7 @@ IntentionService::IntentionService(IContext *context)
: context_(context), socketServer_(context), cooperate_(context), drag_(context), dumper_(context, stationary_)
{}
int32_t IntentionService::Dump(int fd, const std::vector<std::u16string> &args)
int32_t IntentionService::Dump(int32_t fd, const std::vector<std::u16string> &args)
{
std::vector<std::string> argList;
std::transform(args.begin(), args.end(), std::back_inserter(argList),

View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//! Fusion drag-IPC binding
use fusion_data_rust::CDragData;
/// type alias OnStartDrag
pub type OnStartDrag = unsafe extern "C" fn (
dragData: *const CDragData
) -> i32;
/// struct FusionDragOperations
#[derive(Clone)]
#[repr(C)]
pub struct FusionDragOperations {
pub on_start_drag: Option<OnStartDrag>,
}

View File

@ -135,8 +135,8 @@ constexpr int32_t TWICE_SIZE { 2 };
constexpr int32_t NUM_ONE { 1 };
constexpr int32_t NUM_TWO { 2 };
constexpr int32_t NUM_FOUR { 4 };
constexpr int32_t HEX_FF { 0xFF };
const Rosen::RSAnimationTimingCurve SPRING = Rosen::RSAnimationTimingCurve::CreateSpring(0.347f, 0.99f, 0.0f);
constexpr int32_t HEX_FF { 0xFF };
const std::string RENDER_THREAD_NAME { "os_dargRenderRunner" };
constexpr float BEZIER_000 { 0.00f };
constexpr float BEZIER_020 { 0.20f };
@ -973,6 +973,7 @@ void DragDrawing::OnDragStyleAnimation()
#endif // OHOS_BUILD_ENABLE_ARKUI_X
CheckStyleNodeModifier(dragStyleNode);
#ifndef OHOS_BUILD_ENABLE_ARKUI_X
CHKPV(handler_);
handler_->PostTask(std::bind(&DragDrawing::ChangeStyleAnimation, this));
#else
ChangeStyleAnimation();
@ -996,6 +997,7 @@ void DragDrawing::OnDragStyle(std::shared_ptr<Rosen::RSCanvasNode> dragStyleNode
dragStyleNode->RemoveModifier(drawSVGModifier_);
drawSVGModifier_ = nullptr;
}
CHKPV(handler_);
if (!handler_->PostTask([this] { this->OnDragStyleAnimation(); })) {
FI_HILOGE("Drag style animation failed");
DrawStyle(dragStyleNode, stylePixelMap);
@ -1051,7 +1053,7 @@ void DragDrawing::OnStopAnimationSuccess()
drawDragStopModifier_->SetStyleAlpha(END_STYLE_ALPHA);
drawDragStopModifier_->SetStyleScale(START_STYLE_SCALE);
});
}, []() { FI_HILOGD("OnStopAnimationSuccess end"); });
}, []() { FI_HILOGD("OnStopAnimationSuccess end"); });
DoEndAnimation();
FI_HILOGI("leave");
}
@ -1066,6 +1068,7 @@ void DragDrawing::OnStopDragSuccess(std::shared_ptr<Rosen::RSCanvasNode> shadowN
auto runner = AppExecFwk::EventRunner::Create(THREAD_NAME);
CHKPV(runner);
handler_ = std::make_shared<AppExecFwk::EventHandler>(std::move(runner));
CHKPV(handler_);
if (!handler_->PostTask([this] { return this->OnStopAnimationSuccess(); })) {
FI_HILOGE("Failed to stop style animation");
RunAnimation(animateCb);
@ -1130,6 +1133,7 @@ void DragDrawing::OnStopDragFail(std::shared_ptr<Rosen::RSSurfaceNode> surfaceNo
auto runner = AppExecFwk::EventRunner::Create(THREAD_NAME);
CHKPV(runner);
handler_ = std::make_shared<AppExecFwk::EventHandler>(std::move(runner));
CHKPV(handler_);
if (!handler_->PostTask([this] { this->OnStopAnimationFail(); })) {
FI_HILOGE("Failed to stop style animation");
RunAnimation(animateCb);
@ -1298,7 +1302,7 @@ int32_t DragDrawing::InitVSync(float endAlpha, float endScale)
Rosen::RSNode::Animate(protocol, Rosen::RSAnimationTimingCurve::EASE_IN_OUT, [&]() {
drawDynamicEffectModifier_->SetAlpha(endAlpha);
drawDynamicEffectModifier_->SetScale(endScale);
}, []() { FI_HILOGD("InitVSync end"); });
}, []() { FI_HILOGD("InitVSync end"); });
Rosen::RSTransaction::FlushImplicitTransaction();
DoEndAnimation();
FI_HILOGD("leave");
@ -1444,7 +1448,7 @@ int32_t DragDrawing::InitLayer()
rsUiDirector_ = Rosen::RSUIDirector::Create();
CHKPR(rsUiDirector_, RET_ERR);
rsUiDirector_->Init();
rsUiDirector_->SetUITaskRunner([this](const std::function<void()> &task, uint32_t delay = 0) {
rsUiDirector_->SetUITaskRunner([this](const std::function<void()>& task, uint32_t delay = 0) {
CHKPV(this->handler_);
this->handler_->PostTask(task, delay);
});
@ -2407,7 +2411,7 @@ int32_t DragDrawing::UpdatePreviewStyleWithAnimation(const PreviewStyle &preview
if (ModifyMultiPreviewStyle(std::vector<PreviewStyle>(multiSelectedNodesSize, previewStyle)) != RET_OK) {
FI_HILOGE("ModifyMultiPreviewStyle failed");
}
}, []() { FI_HILOGD("UpdatePreviewStyleWithAnimation end"); });
}, []() { FI_HILOGD("UpdatePreviewStyleWithAnimation end"); });
FI_HILOGD("leave");
return RET_OK;
}
@ -2653,7 +2657,7 @@ void DragDrawing::MultiSelectedAnimation(int32_t positionX, int32_t positionY, i
multiSelectedPixelMap->GetWidth(), multiSelectedPixelMap->GetHeight());
multiSelectedNode->SetFrame(multiSelectedPositionX, multiSelectedPositionY,
multiSelectedPixelMap->GetWidth(), multiSelectedPixelMap->GetHeight());
}, []() { FI_HILOGD("MultiSelectedAnimation end"); });
}, []() { FI_HILOGD("MultiSelectedAnimation end"); });
} else {
multiSelectedNode->SetBounds(multiSelectedPositionX, multiSelectedPositionY,
multiSelectedPixelMap->GetWidth(), multiSelectedPixelMap->GetHeight());
@ -3081,7 +3085,7 @@ int32_t DragDrawing::DoRotateDragWindowAnimation(float rotation, float pivotX, f
DragWindowRotateInfo_.pivotX = pivotX;
DragWindowRotateInfo_.pivotY = pivotY;
return RET_OK;
}, []() { FI_HILOGD("DoRotateDragWindowAnimation end"); });
}, []() { FI_HILOGD("DoRotateDragWindowAnimation end"); });
if (rsTransaction != nullptr) {
rsTransaction->Commit();
} else {
@ -3631,6 +3635,36 @@ float DragDrawing::GetMaxWidthScale(int32_t width)
return widthScale;
}
#ifdef OHOS_BUILD_ENABLE_ARKUI_X
void DragDrawing::SetDragWindow(std::shared_ptr<OHOS::Rosen::Window> window)
{
CALL_INFO_TRACE;
window_ = window;
}
void DragDrawing::AddDragDestroy(std::function<void()> cb)
{
CALL_INFO_TRACE;
callback_ = cb;
}
void DragDrawing::SetSVGFilePath(const std::string &filePath)
{
CALL_INFO_TRACE;
svgFilePath_ = filePath;
}
#endif
void DragDrawing::LoadDragDropLib()
{
FI_HILOGI("Begin to open drag drop extension library");
if (dragExtHandler_ == nullptr) {
dragExtHandler_ = dlopen(DRAG_DROP_EXTENSION_SO_PATH.c_str(), RTLD_LAZY);
}
CHKPL(dragExtHandler_);
FI_HILOGI("End to open drag drop extension library");
}
void DragDrawing::DetachToDisplay(int32_t displayId)
{
#ifndef OHOS_BUILD_ENABLE_ARKUI_X
@ -3668,36 +3702,6 @@ void DragDrawing::UpdateDragWindowDisplay(int32_t displayId)
Rosen::RSTransaction::FlushImplicitTransaction();
#endif // OHOS_BUILD_ENABLE_ARKUI_X
}
#ifdef OHOS_BUILD_ENABLE_ARKUI_X
void DragDrawing::SetDragWindow(std::shared_ptr<OHOS::Rosen::Window> window)
{
CALL_INFO_TRACE;
window_ = window;
}
void DragDrawing::AddDragDestroy(std::function<void()> cb)
{
CALL_INFO_TRACE;
callback_ = cb;
}
void DragDrawing::SetSVGFilePath(const std::string &filePath)
{
CALL_INFO_TRACE;
svgFilePath_ = filePath;
}
#endif
void DragDrawing::LoadDragDropLib()
{
FI_HILOGI("Begin to open drag drop extension library");
if (dragExtHandler_ == nullptr) {
dragExtHandler_ = dlopen(DRAG_DROP_EXTENSION_SO_PATH.c_str(), RTLD_LAZY);
}
CHKPL(dragExtHandler_);
FI_HILOGI("End to open drag drop extension library");
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -51,7 +51,7 @@ std::map<DragType, std::pair<std::string, std::string>> DragDFX::serialStr_ = {
{ DragType::STA_DRAG_FAIL, { "START_DRAG_FAILED", "Start drag failed" } },
{ DragType::SET_DRAG_WINDOW_SUCC, { "SET_DRAG_WINDOW_VISIBLE_SUCCESS", "Set drag window visible successfully" } },
{ DragType::SET_DRAG_WINDOW_FAIL, { "SET_DRAG_WINDOW_VISIBLE_FAILED", "Set drag window visible failed" } },
{ DragType::UPDATE_DRAG_STYLE_SUCC, { "UPDATE_DRAG_STYLE_SUCCESS", "Update Drag Style Successfully" } },
{ DragType::UPDATE_DRAG_STYLE_SUCC, { "UPDATE_DRAG_STYLE_SUCCESS", "Update drag style successfully" } },
{ DragType::UPDATE_DRAG_STYLE_FAIL, { "UPDATE_DRAG_STYLE_FAILED", "Update drag style failed"} },
{ DragType::SEND_TOKENID, { "SEND_TOKENID", "Send token id failed" } },
{ DragType::STOP_DRAG_SUCC, { "STOP_DRAG_SUCCESS", "Stop drag successfully" } },
@ -68,7 +68,7 @@ int32_t DragDFX::WriteModel(const DragType &dragType, Types... paras)
return RET_ERR;
}
auto &[label, dec] = serialStr_[dragType];
OHOS::HiviewDFX::HiSysEvent::EventType eventType = (static_cast<uint32_t>(dragType) & 1) ?
OHOS::HiviewDFX::HiSysEvent::EventType eventType = (static_cast<uint32_t>(dragType) & 1) != 0 ?
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT : OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR;
int32_t ret = HiSysEventWrite(
OHOS::HiviewDFX::HiSysEvent::Domain::MSDP,

View File

@ -50,4 +50,3 @@ void WriteUnSubscribeHiSysEvent(int32_t uid, const std::string &packageName, int
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -132,6 +132,7 @@ ErrCode DeviceStatusMsdpClientImpl::StartAlgo(Type type)
FI_HILOGE("Load algo Library failed");
return RET_ERR;
}
std::unique_lock lock(mutex_);
iAlgo_ = GetAlgoInst(type);
CHKPR(iAlgo_, RET_ERR);
return RET_OK;
@ -143,6 +144,7 @@ ErrCode DeviceStatusMsdpClientImpl::StartMock(Type type)
FI_HILOGE("Load mock Library failed");
return RET_ERR;
}
std::unique_lock lock(mutex_);
iMock_ = GetMockInst(type);
if (iMock_ == nullptr) {
FI_HILOGE("Get mock module failed");
@ -216,8 +218,8 @@ ErrCode DeviceStatusMsdpClientImpl::AlgoDisable(Type type)
ErrCode DeviceStatusMsdpClientImpl::MockDisable(Type type)
{
CALL_DEBUG_ENTER;
CHKPR(iMock_, RET_ERR);
std::unique_lock lock(mutex_);
CHKPR(iMock_, RET_ERR);
auto iter = mockCallCounts_.find(type);
if (iter == mockCallCounts_.end()) {
FI_HILOGE("Failed to find record type");
@ -398,7 +400,6 @@ ErrCode DeviceStatusMsdpClientImpl::UnloadMockLibrary()
IMsdp* DeviceStatusMsdpClientImpl::GetMockInst(Type type)
{
CALL_DEBUG_ENTER;
std::unique_lock lock(mutex_);
CHKPP(mock_.handle);
if (mock_.pAlgorithm == nullptr) {
mock_.pAlgorithm = mock_.create();

View File

@ -472,7 +472,6 @@ bool MsdpDeviceManagerFuzzTest(const uint8_t* data, size_t size)
env->devMgr_.AddDevice(devStr);
env->devMgr_.FindDevice(devStr);
env->devMgr_.ParseDeviceId(devStr);
env->GetDeviceManager().GetDevice(id);
env->GetDeviceManager().RetriggerHotplug(weakObserver);
env->GetDeviceManager().AddDeviceObserver(weakObserver);

View File

@ -1625,7 +1625,7 @@ HWTEST_F(InteractionManagerTest, TouchEventDispatch, TestSize.Level1)
[&promiseEventFlag]{promiseEventFlag.set_value(true);});
int32_t monitorId = TestAddMonitor(callbackPtr);
SimulateMovePointerEvent({ DRAG_SRC_X, DRAG_SRC_Y }, { DRAG_DST_X, DRAG_DST_Y },
MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, TOUCH_POINTER_ID_INJECT, true);
MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN, TOUCH_POINTER_ID, true);
ASSERT_TRUE(futureEventFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) !=
std::future_status::timeout);
SetPermission(SYSTEM_CORE, g_cores, sizeof(g_cores) / sizeof(g_cores[0]));
@ -1675,7 +1675,7 @@ HWTEST_F(InteractionManagerTest, MouseEventDispatch, TestSize.Level1)
[&promiseEventFlag]{promiseEventFlag.set_value(true);});
int32_t monitorId = TestAddMonitor(callbackPtr);
SimulateMovePointerEvent({ DRAG_SRC_X, DRAG_SRC_Y }, { DRAG_DST_X, DRAG_DST_Y },
MMI::PointerEvent::SOURCE_TYPE_MOUSE, MOUSE_POINTER_ID_INJECT, true);
MMI::PointerEvent::SOURCE_TYPE_MOUSE, TOUCH_POINTER_ID, true);
ASSERT_TRUE(futureEventFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) !=
std::future_status::timeout);
SetPermission(SYSTEM_CORE, g_cores, sizeof(g_cores) / sizeof(g_cores[0]));

View File

@ -105,6 +105,7 @@ ohos_unittest("DDMAdapterTest") {
deps = [ "${device_status_root_path}/intention/adapters/ddm_adapter:intention_ddm_adapter" ]
external_deps = [
"ability_base:want",
"access_token:libaccesstoken_sdk",
"access_token:libnativetoken_shared",
"access_token:libtokensetproc_shared",

View File

@ -412,7 +412,7 @@ HWTEST_F(DeviceStatusAlgorithmTest, DeviceStatusAlgorithmTest017, TestSize.Level
g_manager->GetSensorTypeId(Type::TYPE_ABSOLUTE_STILL);
int32_t sensorTypeId = SENSOR_TYPE_ID_NONE;
int32_t ret = g_manager->CheckSensorTypeId(sensorTypeId);
ASSERT_TRUE(ret);
ASSERT_FALSE(ret);
ret = g_manager->UnregisterSensor(Type::TYPE_ABSOLUTE_STILL);
ASSERT_TRUE(ret);
}

View File

@ -19,7 +19,6 @@
#include <map>
#include <memory>
#include <vector>
#include <memory>
#include <linux/input.h>

View File

@ -36,7 +36,7 @@ constexpr int32_t MINIMUM_INTERVAL { 8 };
} // namespace
std::shared_ptr<VirtualKeyboard> VirtualKeyboard::device_ { nullptr };
std::shared_ptr<VirtualKeyboard>VirtualKeyboard::GetDevice()
{
if (device_ == nullptr) {

View File

@ -93,7 +93,7 @@ void PointerPositionMonitor::OnInputEvent(std::shared_ptr<MMI::PointerEvent> poi
}
std::shared_ptr<VirtualMouse> VirtualMouse::device_ = nullptr;
std::shared_ptr<VirtualMouse> VirtualMouse::GetDevice()
{
if (device_ == nullptr) {

View File

@ -35,7 +35,7 @@ constexpr int32_t TWICE_STEP_LENGTH { 2 * STEP_LENGTH };
} // namespaces
std::shared_ptr<VirtualTouchScreen> VirtualTouchScreen::device_ = nullptr;
std::shared_ptr<VirtualTouchScreen> VirtualTouchScreen::GetDevice()
{
if (device_ == nullptr) {

View File

@ -30,21 +30,21 @@ enum class BizState {
STATE_BEGIN = 1,
STATE_END = 2
};
enum class BizStage {
STAGE_START_DRAG = 1,
STAGE_STOP_DRAG,
STAGE_MOTION_DRAGGING,
STAGE_DRAGGING
};
enum class StageRes {
RES_IDLE = 0,
RES_SUCCESS,
RES_FAIL,
RES_CANCEL
};
enum class DragRadarErrCode {
DRAG_SUCCESS = 0,
FAILED_INIT_DRAWING = 61210623,
@ -58,7 +58,7 @@ enum class DragRadarErrCode {
REPEATE_STOP_DRAG_EXCEPTION,
FAILED_SYNC_DATA_FROM_UDMF
};
struct DragRadarInfo {
std::string funcName;
int32_t bizState { -1 };