add input Signed-off-by:hellohyh001<huiyuehong@huawei.com>

Signed-off-by: hellohyh001 <huiyuehong@huawei.com>
This commit is contained in:
hellohyh001 2024-08-23 16:52:10 +08:00
parent 1a025eaef2
commit daf188db7b
4 changed files with 26 additions and 0 deletions

View File

@ -66,6 +66,7 @@ struct DragData {
int32_t sourceType { -1 }; int32_t sourceType { -1 };
int32_t dragNum { -1 }; int32_t dragNum { -1 };
int32_t pointerId { -1 }; int32_t pointerId { -1 };
int32_t toolType { 0 };
int32_t displayX { -1 }; int32_t displayX { -1 };
int32_t displayY { -1 }; int32_t displayY { -1 };
int32_t displayId { -1 }; int32_t displayId { -1 };

View File

@ -857,6 +857,7 @@ MMI::ExtraData DragManager::CreateExtraData(bool appended)
DragData dragData = DRAG_DATA_MGR.GetDragData(); DragData dragData = DRAG_DATA_MGR.GetDragData();
MMI::ExtraData extraData; MMI::ExtraData extraData;
extraData.buffer = dragData.buffer; extraData.buffer = dragData.buffer;
extraData.toolType = dragData.toolType;
extraData.sourceType = dragData.sourceType; extraData.sourceType = dragData.sourceType;
extraData.pointerId = dragData.pointerId; extraData.pointerId = dragData.pointerId;
extraData.appended = appended; extraData.appended = appended;

View File

@ -28,6 +28,20 @@ namespace OHOS {
namespace Msdp { namespace Msdp {
namespace DeviceStatus { namespace DeviceStatus {
enum SourceTool : int32_t {
UNKNOWN = 0,
FINGER = 1,
PEN = 2,
RUBBER = 3,
BRUSH = 4,
PENCIL = 5,
AIRBRUSH = 6,
MOUSE = 7,
LENS = 8,
TOUCHPAD = 9,
JOYSTICK = 10,
};
using SummaryMap = std::map<std::string, int64_t>; using SummaryMap = std::map<std::string, int64_t>;
class DragDataPacker { class DragDataPacker {
public: public:

View File

@ -33,6 +33,13 @@ int32_t DragDataPacker::Marshalling(const DragData &dragData, Parcel &data, bool
FI_HILOGE("Marshalling shadowInfos failed"); FI_HILOGE("Marshalling shadowInfos failed");
return RET_ERR; return RET_ERR;
} }
if (!isCross) {
if (dragData.toolType < SourceTool::UNKNOWN || dragData.toolType > SourceTool::JOYSTICK) {
FI_HILOGE("toolType error");
return RET_ERR;
}
WRITEINT32(data, dragData.toolType, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
}
WRITEUINT8VECTOR(data, dragData.buffer, E_DEVICESTATUS_WRITE_PARCEL_ERROR); WRITEUINT8VECTOR(data, dragData.buffer, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
WRITESTRING(data, dragData.udKey, E_DEVICESTATUS_WRITE_PARCEL_ERROR); WRITESTRING(data, dragData.udKey, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
WRITESTRING(data, dragData.extraInfo, E_DEVICESTATUS_WRITE_PARCEL_ERROR); WRITESTRING(data, dragData.extraInfo, E_DEVICESTATUS_WRITE_PARCEL_ERROR);
@ -60,6 +67,9 @@ int32_t DragDataPacker::UnMarshalling(Parcel &data, DragData &dragData, bool isC
FI_HILOGE("UnMarshalling shadowInfos failed"); FI_HILOGE("UnMarshalling shadowInfos failed");
return RET_ERR; return RET_ERR;
} }
if (!isCross) {
READINT32(data, dragData.toolType, E_DEVICESTATUS_READ_PARCEL_ERROR);
}
READUINT8VECTOR(data, dragData.buffer, E_DEVICESTATUS_READ_PARCEL_ERROR); READUINT8VECTOR(data, dragData.buffer, E_DEVICESTATUS_READ_PARCEL_ERROR);
READSTRING(data, dragData.udKey, E_DEVICESTATUS_READ_PARCEL_ERROR); READSTRING(data, dragData.udKey, E_DEVICESTATUS_READ_PARCEL_ERROR);
READSTRING(data, dragData.extraInfo, E_DEVICESTATUS_READ_PARCEL_ERROR); READSTRING(data, dragData.extraInfo, E_DEVICESTATUS_READ_PARCEL_ERROR);