mirror of
https://gitee.com/openharmony/msdp_device_status
synced 2025-02-21 08:14:07 +00:00
modify review opinion
Signed-off-by: wuliangdong <wuliangdong1@huawei.com> Change-Id: I475c9b3aa4de28177a8936713fd6aaf63dcd74c2
This commit is contained in:
parent
05c842592e
commit
ab924210f7
@ -32,9 +32,7 @@ public:
|
||||
int32_t UpdateDragMessage(const std::u16string &message);
|
||||
int32_t GetDragTargetPid();
|
||||
int32_t StartDrag(const DragData &dragData, std::function<void(int32_t&)> callback);
|
||||
int32_t StopDrag(int32_t &dragResult);
|
||||
private:
|
||||
void SetCallback(std::function<void(int32_t&)> callback);
|
||||
int32_t StopDrag(int32_t dragResult);
|
||||
private:
|
||||
std::mutex mtx_;
|
||||
std::function<void(int32_t&)> stopCallback_;
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <mutex>
|
||||
|
||||
#include "client.h"
|
||||
#include "drag_manager_impl.h"
|
||||
#include "drag_data.h"
|
||||
#include "drag_manager_impl.h"
|
||||
#include "interaction_manager.h"
|
||||
#include "singleton.h"
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
int32_t UpdateDragStyle(int32_t style);
|
||||
int32_t UpdateDragMessage(const std::u16string &message);
|
||||
int32_t StartDrag(const DragData &dragData, std::function<void(int32_t&)> callback);
|
||||
int32_t StopDrag(int32_t &dragResult);
|
||||
int32_t StopDrag(int32_t dragResult);
|
||||
int32_t GetDragTargetPid();
|
||||
private:
|
||||
std::mutex mutex_;
|
||||
|
@ -41,24 +41,30 @@ int32_t DragManagerImpl::UpdateDragMessage(const std::u16string &message)
|
||||
int32_t DragManagerImpl::StartDrag(const DragData &dragData, std::function<void(int32_t&)> callback)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
SetCallback(callback);
|
||||
if (dragData.buffer.size() != VerifyBound::BUFFER_SIZE) {
|
||||
FI_HILOGE("Invalid bufferSize");
|
||||
return RET_ERR;
|
||||
}
|
||||
if (dragData.pixelMap->GetWidth() > VerifyBound::MAX_PIXEL_MAP_WIDTH ||
|
||||
dragData.pixelMap->GetHeight() > VerifyBound::MAX_PIXEL_MAP_HEIGHT) {
|
||||
FI_HILOGE("Too big pixelMap");
|
||||
return RET_ERR;
|
||||
}
|
||||
if (callback == nullptr) {
|
||||
FI_HILOGE("callback is null");
|
||||
return RET_ERR;
|
||||
}
|
||||
std::lock_guard<std::mutex> guard(mtx_);
|
||||
stopCallback_ = callback;
|
||||
return DeviceStatusClient::GetInstance().StartDrag(dragData);
|
||||
}
|
||||
|
||||
int32_t DragManagerImpl::StopDrag(int32_t &dragResult)
|
||||
int32_t DragManagerImpl::StopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
return DeviceStatusClient::GetInstance().StopDrag(dragResult);
|
||||
}
|
||||
|
||||
void DragManagerImpl::SetCallback(std::function<void(int32_t&)> callback)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
std::lock_guard<std::mutex> guard(mtx_);
|
||||
CHKPV(callback);
|
||||
stopCallback_ = callback;
|
||||
}
|
||||
|
||||
int32_t DragManagerImpl::GetDragTargetPid()
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "drag_data.h"
|
||||
#include "devicestatus_define.h"
|
||||
#include "drag_data.h"
|
||||
#include "interaction_manager_impl.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -80,7 +80,7 @@ int32_t InteractionManager::StartDrag(const DragData &dragData, std::function<vo
|
||||
return InteractionMgrImpl.StartDrag(dragData, callback);
|
||||
}
|
||||
|
||||
int32_t InteractionManager::StopDrag(int32_t &dragResult)
|
||||
int32_t InteractionManager::StopDrag(int32_t dragResult)
|
||||
{
|
||||
return InteractionMgrImpl.StopDrag(dragResult);
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include "coordination_manager_impl.h"
|
||||
#include "devicestatus_define.h"
|
||||
#include "drag_manager_impl.h"
|
||||
#include "drag_data.h"
|
||||
#include "drag_manager_impl.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
@ -170,10 +170,15 @@ int32_t InteractionManagerImpl::UpdateDragMessage(const std::u16string &message)
|
||||
int32_t InteractionManagerImpl::StartDrag(const DragData &dragData, std::function<void(int32_t&)> callback)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
if (!InitClient()) {
|
||||
FI_HILOGE("Get client is nullptr");
|
||||
return RET_ERR;
|
||||
}
|
||||
return dragManagerImpl_.StartDrag(dragData, callback);
|
||||
}
|
||||
|
||||
int32_t InteractionManagerImpl::StopDrag(int32_t &dragResult)
|
||||
int32_t InteractionManagerImpl::StopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
return dragManagerImpl_.StopDrag(dragResult);
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "coordination_message.h"
|
||||
#include "devicestatus_define.h"
|
||||
@ -27,7 +28,6 @@ using namespace testing::ext;
|
||||
namespace {
|
||||
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, MSDP_DOMAIN_ID, "InteractionManagerTest" };
|
||||
constexpr int32_t TIME_WAIT_FOR_OP = 100;
|
||||
const std::vector<uint8_t> DEFAULT_BUFFER = std::vector<uint8_t>(512, 100);
|
||||
} // namespace
|
||||
class InteractionManagerTest : public testing::Test {
|
||||
public:
|
||||
@ -50,10 +50,8 @@ void InteractionManagerTest::TearDown()
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<OHOS::Media::PixelMap> ConstructPixmap(int32_t width, int32_t height)
|
||||
std::unique_ptr<OHOS::Media::PixelMap> ConstructPixmap(int32_t pixelMapWidth, int32_t pixelMapHeight)
|
||||
{
|
||||
int32_t pixelMapWidth = width;
|
||||
int32_t pixelMapHeight = height;
|
||||
std::unique_ptr<OHOS::Media::PixelMap> pixelMap = std::make_unique<OHOS::Media::PixelMap>();
|
||||
OHOS::Media::ImageInfo info;
|
||||
info.size.width = pixelMapWidth;
|
||||
@ -61,9 +59,11 @@ std::unique_ptr<OHOS::Media::PixelMap> ConstructPixmap(int32_t width, int32_t he
|
||||
info.pixelFormat = OHOS::Media::PixelFormat::RGB_888;
|
||||
info.colorSpace = OHOS::Media::ColorSpace::SRGB;
|
||||
pixelMap->SetImageInfo(info);
|
||||
|
||||
int32_t rowDataSize = pixelMapWidth;
|
||||
uint32_t bufferSize = rowDataSize * pixelMapHeight;
|
||||
if (INT32_MAX / pixelMapWidth < pixelMapHeight) {
|
||||
std::cout << "Invalid pixelMapWidth or pixelMapHeight" << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
int32_t bufferSize = pixelMapWidth * pixelMapHeight;
|
||||
if (bufferSize <= 0) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -71,9 +71,9 @@ std::unique_ptr<OHOS::Media::PixelMap> ConstructPixmap(int32_t width, int32_t he
|
||||
if (buffer == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
char *ch = reinterpret_cast<char *>(buffer);
|
||||
char *character = reinterpret_cast<char *>(buffer);
|
||||
for (unsigned int i = 0; i < bufferSize; i++) {
|
||||
*(ch++) = (char)i;
|
||||
*(character++) = static_cast<char> (i);
|
||||
}
|
||||
|
||||
pixelMap->SetPixelsAddr(buffer, nullptr, bufferSize, OHOS::Media::AllocatorType::HEAP_ALLOC, nullptr);
|
||||
@ -81,12 +81,12 @@ std::unique_ptr<OHOS::Media::PixelMap> ConstructPixmap(int32_t width, int32_t he
|
||||
return pixelMap;
|
||||
}
|
||||
|
||||
void SetParam(int32_t width, int32_t height, DragData& dragData)
|
||||
void SetParam(int32_t width, int32_t height, DragData& dragData)
|
||||
{
|
||||
dragData.pixelMap = ConstructPixmap(width, height);
|
||||
dragData.x = INT32_MAX;
|
||||
dragData.y = INT32_MAX;
|
||||
dragData.buffer = DEFAULT_BUFFER;
|
||||
dragData.buffer = std::vector<uint8_t>(VerifyBound::BUFFER_SIZE, 0);
|
||||
dragData.sourceType = -1;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ int32_t DeviceStatusClient::StartDrag(const DragData &dragData)
|
||||
return devicestatusProxy_->StartDrag(dragData);
|
||||
}
|
||||
|
||||
int32_t DeviceStatusClient::StopDrag(int32_t &dragResult)
|
||||
int32_t DeviceStatusClient::StopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
DEV_RET_IF_NULL_WITH_RET((Connect() != RET_OK), RET_ERR);
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "hitrace_meter.h"
|
||||
#include "idevicestatus_callback.h"
|
||||
#include "iremote_object.h"
|
||||
#include "pixel_map_parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
@ -329,7 +328,7 @@ int32_t DeviceStatusSrvProxy::StartDrag(const DragData &dragData)
|
||||
}
|
||||
WRITEINT32(data, dragData.x, ERR_INVALID_VALUE);
|
||||
WRITEINT32(data, dragData.y, ERR_INVALID_VALUE);
|
||||
WRITEUInt8Vector(data, dragData.buffer, ERR_INVALID_VALUE);
|
||||
WRITEUINT8VECTOR(data, dragData.buffer, ERR_INVALID_VALUE);
|
||||
WRITEINT32(data, dragData.sourceType, ERR_INVALID_VALUE);
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
@ -342,7 +341,7 @@ int32_t DeviceStatusSrvProxy::StartDrag(const DragData &dragData)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DeviceStatusSrvProxy::StopDrag(int32_t &dragResult)
|
||||
int32_t DeviceStatusSrvProxy::StopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
MessageParcel data;
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include <map>
|
||||
#include <singleton.h>
|
||||
|
||||
#include "devicestatus_data_utils.h"
|
||||
#include "devicestatus_common.h"
|
||||
#include "devicestatus_data_utils.h"
|
||||
#include "drag_data.h"
|
||||
#include "i_coordination_listener.h"
|
||||
#include "idevicestatus.h"
|
||||
@ -54,7 +54,7 @@ public:
|
||||
int32_t GetCoordinationState(int32_t userData, const std::string &deviceId);
|
||||
|
||||
int32_t StartDrag(const DragData &dragData);
|
||||
int32_t StopDrag(int32_t &dragResult);
|
||||
int32_t StopDrag(int32_t dragResult);
|
||||
int32_t UpdateDragStyle(int32_t style);
|
||||
int32_t UpdateDragMessage(const std::u16string &message);
|
||||
int32_t GetDragTargetPid();
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
virtual int32_t GetCoordinationState(int32_t userData, const std::string &deviceId) override;
|
||||
|
||||
virtual int32_t StartDrag(const DragData &dragData) override;
|
||||
virtual int32_t StopDrag(int32_t &dragResult) override;
|
||||
virtual int32_t StopDrag(int32_t dragResult) override;
|
||||
virtual int32_t UpdateDragStyle(int32_t style) override;
|
||||
virtual int32_t UpdateDragMessage(const std::u16string &message) override;
|
||||
virtual int32_t GetDragTargetPid() override;
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
virtual int32_t StopCoordination(int32_t userData) = 0;
|
||||
virtual int32_t GetCoordinationState(int32_t userData, const std::string &deviceId) = 0;
|
||||
virtual int32_t StartDrag(const DragData &dragData) = 0;
|
||||
virtual int32_t StopDrag(int32_t &dragResult) = 0;
|
||||
virtual int32_t StopDrag(int32_t dragResult) = 0;
|
||||
virtual int32_t UpdateDragStyle(int32_t style) = 0;
|
||||
virtual int32_t UpdateDragMessage(const std::u16string &message) = 0;
|
||||
virtual int32_t GetDragTargetPid() = 0;
|
||||
|
@ -33,6 +33,12 @@ struct DragData {
|
||||
int32_t sourceType { -1 };
|
||||
};
|
||||
|
||||
struct VerifyBound {
|
||||
static const int32_t MAX_PIXEL_MAP_WIDTH = 200;
|
||||
static const int32_t MAX_PIXEL_MAP_HEIGHT = 200;
|
||||
static const int32_t BUFFER_SIZE = 512;
|
||||
};
|
||||
|
||||
enum class DragState {
|
||||
FREE = 0,
|
||||
DRAGGING = 1,
|
||||
|
@ -19,10 +19,11 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "nocopyable.h"
|
||||
|
||||
#include "coordination_message.h"
|
||||
#include "drag_data.h"
|
||||
#include "i_coordination_listener.h"
|
||||
#include "nocopyable.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
@ -101,7 +102,7 @@ public:
|
||||
* @return 返回值如果是0表示接口调用成功,返回其他值表示接口调用失败。
|
||||
* @since 9
|
||||
*/
|
||||
int32_t StopDrag(int32_t &dragResult);
|
||||
int32_t StopDrag(int32_t dragResult);
|
||||
|
||||
/**
|
||||
* @brief 更新拖拽中的光标样式。
|
||||
|
@ -77,7 +77,7 @@ ohos_shared_library("devicestatus_service") {
|
||||
"${device_status_interfaces_path}/innerkits:devicestatus_client",
|
||||
"${device_status_root_path}/utils/ipc:devicestatus_ipc",
|
||||
"${device_status_utils_path}:devicestatus_util",
|
||||
"interaction/drag:drag_part",
|
||||
"interaction/drag:interaction_drag",
|
||||
"//drivers/peripheral/sensor/hal:hdi_sensor",
|
||||
"//third_party/openssl:libcrypto_shared",
|
||||
]
|
||||
|
@ -17,7 +17,7 @@ config("drag_public_config") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
ohos_shared_library("drag_part") {
|
||||
ohos_shared_library("interaction_drag") {
|
||||
include_dirs = [
|
||||
"${device_status_interfaces_path}/innerkits/interaction/include",
|
||||
"${device_status_utils_path}/include",
|
||||
|
@ -17,11 +17,12 @@
|
||||
#define DRAG_DATA_ADAPTER_H
|
||||
#include <string>
|
||||
|
||||
#include "drag_data.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "pointer_style.h"
|
||||
#include "singleton.h"
|
||||
|
||||
#include "drag_data.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
namespace DeviceStatus {
|
||||
|
@ -20,13 +20,14 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "drag_data.h"
|
||||
#include "drag_drawing.h"
|
||||
#include "devicestatus_define.h"
|
||||
#include "input_manager.h"
|
||||
#include "i_input_event_consumer.h"
|
||||
#include "pixel_map.h"
|
||||
|
||||
#include "devicestatus_define.h"
|
||||
#include "drag_data.h"
|
||||
#include "drag_drawing.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
namespace DeviceStatus {
|
||||
@ -50,13 +51,10 @@ public:
|
||||
~DragManager() = default;
|
||||
|
||||
int32_t StartDrag(const DragData &dragData, int32_t pid);
|
||||
int32_t StopDrag(int32_t &dragResult);
|
||||
int32_t StopDrag(int32_t dragResult);
|
||||
int32_t GetDragTargetPid();
|
||||
int32_t AddMonitor(int32_t pid);
|
||||
int32_t RemoveMonitor(int32_t monitorId);
|
||||
|
||||
private:
|
||||
int32_t NotifyMonitor(DragState dragState);
|
||||
MMI::ExtraData ConstructExtraData(const DragData &dragData, bool appended);
|
||||
|
||||
private:
|
||||
@ -64,7 +62,6 @@ private:
|
||||
int32_t monitorId_ { -1 };
|
||||
int32_t dragOutPid_ { -1 };
|
||||
int32_t dragTargetPid_ { -1 };
|
||||
std::vector<int32_t> monitors_;
|
||||
std::shared_ptr<MonitorConsumer> monitorConsumer_;
|
||||
DragDrawing dragDrawing_;
|
||||
};
|
||||
|
@ -15,11 +15,12 @@
|
||||
|
||||
#include "drag_data_adapter.h"
|
||||
|
||||
#include "hitrace_meter.h"
|
||||
#include "pointer_style.h"
|
||||
|
||||
#include "drag_data.h"
|
||||
#include "devicestatus_define.h"
|
||||
#include "fi_log.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "pointer_style.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
|
@ -15,9 +15,10 @@
|
||||
|
||||
#include "drag_drawing.h"
|
||||
|
||||
#include "fi_log.h"
|
||||
#include "hitrace_meter.h"
|
||||
|
||||
#include "fi_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
namespace DeviceStatus {
|
||||
|
@ -18,17 +18,18 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "drag_data_adapter.h"
|
||||
#include "devicestatus_define.h"
|
||||
#include "drag_data.h"
|
||||
#include "extra_data.h"
|
||||
#include "fi_log.h"
|
||||
#include "hitrace_meter.h"
|
||||
#include "input_manager.h"
|
||||
#include "proto.h"
|
||||
#include "pixel_map.h"
|
||||
#include "pointer_style.h"
|
||||
|
||||
#include "devicestatus_define.h"
|
||||
#include "drag_data_adapter.h"
|
||||
#include "drag_data.h"
|
||||
#include "fi_log.h"
|
||||
#include "proto.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Msdp {
|
||||
namespace DeviceStatus {
|
||||
@ -53,7 +54,7 @@ int32_t DragManager::StartDrag(const DragData &dragData, int32_t pid)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int32_t DragManager::StopDrag(int32_t &dragResult)
|
||||
int32_t DragManager::StopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
auto inputMgr = OHOS::MMI::InputManager::GetInstance();
|
||||
@ -69,21 +70,6 @@ int32_t DragManager::GetDragTargetPid()
|
||||
return dragTargetPid_;
|
||||
}
|
||||
|
||||
int32_t DragManager::AddMonitor(int32_t pid)
|
||||
{
|
||||
return RET_ERR;
|
||||
}
|
||||
|
||||
int32_t DragManager::RemoveMonitor(int32_t monitorId)
|
||||
{
|
||||
return RET_ERR;
|
||||
}
|
||||
|
||||
int32_t DragManager::NotifyMonitor(DragState dragState)
|
||||
{
|
||||
return RET_ERR;
|
||||
}
|
||||
|
||||
MMI::ExtraData DragManager::ConstructExtraData(const DragData &dragData, bool appended)
|
||||
{
|
||||
OHOS::MMI::ExtraData extraData;
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
int32_t GetCoordinationState(int32_t userData, const std::string &deviceId) override;
|
||||
|
||||
int32_t StartDrag(const DragData &dragData) override;
|
||||
int32_t StopDrag(int32_t &dragResult) override;
|
||||
int32_t StopDrag(int32_t dragResult) override;
|
||||
int32_t UpdateDragStyle(int32_t style) override;
|
||||
int32_t UpdateDragMessage(const std::u16string &message) override;
|
||||
int32_t GetDragTargetPid() override;
|
||||
@ -127,7 +127,7 @@ private:
|
||||
void DisableDevMgr();
|
||||
|
||||
int32_t OnStartDrag(const DragData &dragData, int32_t pid);
|
||||
int32_t OnStopDrag(int32_t &dragResult);
|
||||
int32_t OnStopDrag(int32_t dragResult);
|
||||
|
||||
#ifdef OHOS_BUILD_ENABLE_COORDINATION
|
||||
int32_t OnRegisterCoordinationListener(int32_t pid);
|
||||
|
@ -661,7 +661,7 @@ int32_t DeviceStatusService::StartDrag(const DragData &dragData)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceStatusService::StopDrag(int32_t &dragResult)
|
||||
int32_t DeviceStatusService::StopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
int32_t ret = delegateTasks_.PostSyncTask(
|
||||
@ -822,7 +822,7 @@ int32_t DeviceStatusService::OnStartDrag(const DragData &dragData, int32_t pid)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int32_t DeviceStatusService::OnStopDrag(int32_t &dragResult)
|
||||
int32_t DeviceStatusService::OnStopDrag(int32_t dragResult)
|
||||
{
|
||||
CALL_DEBUG_ENTER;
|
||||
dragManager_.StopDrag(dragResult);
|
||||
|
@ -15,6 +15,9 @@
|
||||
|
||||
#include "devicestatus_srv_stub.h"
|
||||
|
||||
#include "message_parcel.h"
|
||||
#include "pixel_map.h"
|
||||
|
||||
#include "devicestatus_common.h"
|
||||
#include "devicestatus_data_utils.h"
|
||||
#include "devicestatus_define.h"
|
||||
@ -22,8 +25,6 @@
|
||||
#include "devicestatus_srv_proxy.h"
|
||||
#include "fi_log.h"
|
||||
#include "idevicestatus_callback.h"
|
||||
#include "message_parcel.h"
|
||||
#include "pixel_map.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -299,9 +300,18 @@ int32_t DeviceStatusSrvStub::StubStartDrag(MessageParcel& data, MessageParcel& r
|
||||
CALL_DEBUG_ENTER;
|
||||
DragData dragData;
|
||||
dragData.pixelMap = std::unique_ptr<OHOS::Media::PixelMap> (OHOS::Media::PixelMap::Unmarshalling(data));
|
||||
if (dragData.pixelMap->GetWidth() > VerifyBound::MAX_PIXEL_MAP_WIDTH ||
|
||||
dragData.pixelMap->GetHeight() > VerifyBound::MAX_PIXEL_MAP_HEIGHT) {
|
||||
FI_HILOGE("Too big pixelMap");
|
||||
return RET_ERR;
|
||||
}
|
||||
READINT32(data, dragData.x, E_DEVICESTATUS_READ_PARCEL_ERROR);
|
||||
READINT32(data, dragData.y, E_DEVICESTATUS_READ_PARCEL_ERROR);
|
||||
READUInt8Vector(data, dragData.buffer, E_DEVICESTATUS_READ_PARCEL_ERROR);
|
||||
READUINT8VECTOR(data, dragData.buffer, E_DEVICESTATUS_READ_PARCEL_ERROR);
|
||||
if (dragData.buffer.size() != VerifyBound::BUFFER_SIZE) {
|
||||
FI_HILOGE("Invalid buffer");
|
||||
return RET_ERR;
|
||||
}
|
||||
READINT32(data, dragData.sourceType, E_DEVICESTATUS_READ_PARCEL_ERROR);
|
||||
|
||||
int32_t ret = StartDrag(dragData);
|
||||
|
@ -98,7 +98,7 @@ namespace DeviceStatus {
|
||||
return __VA_ARGS__; \
|
||||
} \
|
||||
} while (0)
|
||||
#define WRITEUInt8Vector(parcel, data, ...) \
|
||||
#define WRITEUINT8VECTOR(parcel, data, ...) \
|
||||
do { \
|
||||
if (!(parcel).WriteUInt8Vector(data)) { \
|
||||
DEV_HILOGE(COMMON, "WriteUInt8Vector "#data" failed"); \
|
||||
@ -153,7 +153,7 @@ namespace DeviceStatus {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define READUInt8Vector(parcel, data, ...) \
|
||||
#define READUINT8VECTOR(parcel, data, ...) \
|
||||
do { \
|
||||
if (!(parcel).ReadUInt8Vector(&data)) { \
|
||||
DEV_HILOGE(COMMON, "ReadUInt8Vector "#data" failed"); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user