!1113 8dp required interface

Merge pull request !1113 from yangjintao/1108
This commit is contained in:
openharmony_ci 2023-11-14 11:52:35 +00:00 committed by Gitee
commit 1a779a63a5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
22 changed files with 122 additions and 1 deletions

View File

@ -56,6 +56,7 @@ public:
int32_t GetDragSummary(std::map<std::string, int64_t> &summarys);
int32_t GetDragState(DragState &dragState);
int32_t GetDropType(DropType& dropType);
int32_t EnterTextEditorArea(bool enable);
private:
std::mutex mtx_;

View File

@ -59,6 +59,7 @@ public:
int32_t RemoveHotAreaListener(std::shared_ptr<IHotAreaListener> listener = nullptr);
int32_t GetDragSummary(std::map<std::string, int64_t> &summarys);
int32_t GetDropType(DropType &dropType);
int32_t EnterTextEditorArea(bool enable);
private:
void InitMsgHandler();

View File

@ -275,6 +275,11 @@ int32_t DragManagerImpl::GetDropType(DropType& dropType)
{
return DeviceStatusClient::GetInstance().GetDropType(dropType);
}
int32_t DragManagerImpl::EnterTextEditorArea(bool enable)
{
return DeviceStatusClient::GetInstance().EnterTextEditorArea(enable);
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -157,6 +157,11 @@ int32_t InteractionManager::GetDropType(DropType &dropType)
{
return INTER_MGR_IMPL.GetDropType(dropType);
}
int32_t InteractionManager::EnterTextEditorArea(bool enable)
{
return INTER_MGR_IMPL.EnterTextEditorArea(enable);
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -340,6 +340,12 @@ int32_t InteractionManagerImpl::GetDragSummary(std::map<std::string, int64_t> &s
CALL_DEBUG_ENTER;
return dragManagerImpl_.GetDragSummary(summarys);
}
int32_t InteractionManagerImpl::EnterTextEditorArea(bool enable)
{
CALL_DEBUG_ENTER;
return dragManagerImpl_.EnterTextEditorArea(enable);
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -1652,6 +1652,23 @@ HWTEST_F(InteractionManagerTest, InteractionManagerTest_GetDragSummary, TestSize
ASSERT_TRUE(futureFlag.wait_for(std::chrono::milliseconds(PROMISE_WAIT_SPAN_MS)) !=
std::future_status::timeout);
}
/*
* @tc.name: InteractionManagerTest_EnterTextEditorArea
* @tc.desc: pixelMap 8dp bit movement effect
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(InteractionManagerTest, EnterTextEditorArea, TestSize.Level1)
{
CALL_TEST_DEBUG;
int32_t ret = InteractionManager::GetInstance()->EnterTextEditorArea(true);
FI_HILOGD("ret:%{public}d", ret);
ASSERT_EQ(ret, RET_OK);
ret = InteractionManager::GetInstance()->EnterTextEditorArea(false);
FI_HILOGD("ret:%{public}d", ret);
ASSERT_EQ(ret, RET_ERR);
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -464,6 +464,13 @@ int32_t DeviceStatusClient::GetDragSummary(std::map<std::string, int64_t> &summa
DEV_RET_IF_NULL_WITH_RET((Connect() != RET_OK), RET_ERR);
return devicestatusProxy_->GetDragSummary(summarys);
}
int32_t DeviceStatusClient::EnterTextEditorArea(bool enable)
{
CALL_DEBUG_ENTER;
DEV_RET_IF_NULL_WITH_RET((Connect() != RET_OK), RET_ERR);
return devicestatusProxy_->EnterTextEditorArea(enable);
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -73,6 +73,7 @@ public:
int32_t AddHotAreaListener();
int32_t RemoveHotAreaListener();
int32_t GetDragSummary(std::map<std::string, int64_t> &summarys);
int32_t EnterTextEditorArea(bool enable);
private:
class DeviceStatusDeathRecipient : public IRemoteObject::DeathRecipient {

View File

@ -255,6 +255,15 @@ public:
*/
int32_t GetDragSummary(std::map<std::string, int64_t> &summarys);
/**
* @brief Specifies whether to implement 8dp movement in the text editor area.
* @param enable Indicates whether to enable 8dp movement.
* The value <b>true</b> means to enable 8dp movement, and the value <b>false</b> means the opposite.
* @return Returns <b>0</b> if the operation is successful; returns a non-zero value otherwise.
* @since 11
*/
int32_t EnterTextEditorArea(bool enable);
private:
InteractionManager() = default;
DISALLOW_COPY_AND_MOVE(InteractionManager);

View File

@ -55,6 +55,7 @@
"OHOS::Msdp::DeviceStatus::InteractionManager::GetDragSummary(std::__h::map<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, long long, std::__h::less<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>>, std::__h::allocator<std::__h::pair<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const, long long>>>&)";
"OHOS::Msdp::DeviceStatus::InteractionManager::GetDragSummary(std::__h::map<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, long, std::__h::less<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>>, std::__h::allocator<std::__h::pair<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const, long>>>&)";
"OHOS::Msdp::DeviceStatus::InteractionManager::GetDropType(OHOS::Msdp::DeviceStatus::DropType&)";
"OHOS::Msdp::DeviceStatus::InteractionManager::EnterTextEditorArea(bool)";
};
local:
*;

View File

@ -63,6 +63,7 @@ public:
virtual int32_t GetDragState(DragState &dragState) = 0;
virtual int32_t GetDragSummary(std::map<std::string, int64_t> &summarys) = 0;
virtual int32_t GetDropType(DropType &dropType) = 0;
virtual int32_t EnterTextEditorArea(bool enable) = 0;
virtual bool IsRunning() const
{
return true;

View File

@ -46,6 +46,7 @@ enum class DeviceInterfaceCode {
GET_DRAG_STATE,
GET_DRAG_SUMMARY,
GET_DROP_TYPE,
ENTER_TEXT_EDITOR_AREA,
ALLOC_SOCKET_FD = 40,
ADD_HOT_AREA_MONITOR = 50,
REMOVE_HOT_AREA_MONITOR

View File

@ -65,6 +65,7 @@ public:
virtual int32_t RemoveHotAreaListener() override;
virtual int32_t GetDragSummary(std::map<std::string, int64_t> &summarys) override;
virtual int32_t GetDropType(DropType& dropType) override;
virtual int32_t EnterTextEditorArea(bool enable) override;
private:
static inline BrokerDelegator<DeviceStatusSrvProxy> delegator_;

View File

@ -756,6 +756,27 @@ int32_t DeviceStatusSrvProxy::GetDropType(DropType& dropType)
dropType = static_cast<DropType>(type);
return ret;
}
int32_t DeviceStatusSrvProxy::EnterTextEditorArea(bool enable)
{
CALL_DEBUG_ENTER;
MessageParcel data;
if (!data.WriteInterfaceToken(DeviceStatusSrvProxy::GetDescriptor())) {
FI_HILOGE("Failed to write descriptor");
return ERR_INVALID_VALUE;
}
WRITEBOOL(data, enable, ERR_INVALID_VALUE);
MessageParcel reply;
MessageOption option;
sptr<IRemoteObject> remote = Remote();
CHKPR(remote, RET_ERR);
int32_t ret = remote->SendRequest(static_cast<uint32_t>(DeviceInterfaceCode::ENTER_TEXT_EDITOR_AREA),
data, reply, option);
if (ret != RET_OK) {
FI_HILOGE("Send request failed, ret:%{public}d", ret);
}
return ret;
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -71,6 +71,7 @@ private:
bool CheckCooperatePermission();
void InitCoordination();
void InitDrag();
int32_t EnterTextEditorAreaStub(MessageParcel& data, MessageParcel& reply);
private:
std::map<uint32_t, ConnFunc> connFuncs_;

View File

@ -112,7 +112,9 @@ void DeviceStatusSrvStub::InitDrag()
{ static_cast<uint32_t>(DeviceInterfaceCode::GET_DRAG_SUMMARY),
&DeviceStatusSrvStub::GetDragSummaryStub },
{static_cast<uint32_t>(DeviceInterfaceCode::GET_DROP_TYPE),
&DeviceStatusSrvStub::GetDropTypeStub }
&DeviceStatusSrvStub::GetDropTypeStub },
{ static_cast<uint32_t>(DeviceInterfaceCode::ENTER_TEXT_EDITOR_AREA),
&DeviceStatusSrvStub::EnterTextEditorAreaStub }
};
connFuncs_.insert(dragFuncs.begin(), dragFuncs.end());
}
@ -613,6 +615,18 @@ int32_t DeviceStatusSrvStub::GetDropTypeStub(MessageParcel &data, MessageParcel
WRITEINT32(reply, static_cast<int32_t>(dropType), IPC_STUB_WRITE_PARCEL_ERR);
return RET_OK;
}
int32_t DeviceStatusSrvStub::EnterTextEditorAreaStub(MessageParcel& data, MessageParcel& reply)
{
CALL_DEBUG_ENTER;
bool enable = false;
READBOOL(data, enable, E_DEVICESTATUS_READ_PARCEL_ERROR);
int32_t ret = EnterTextEditorArea(enable);
if (ret != RET_OK) {
FI_HILOGE("Call EnterTextEditorArea failed, ret:%{public}d", ret);
}
return ret;
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -137,6 +137,7 @@ public:
void OnStopDragFail(std::shared_ptr<Rosen::RSSurfaceNode> surfaceNode,
std::shared_ptr<Rosen::RSNode> rootNode) override;
void OnStopAnimation() override;
int32_t EnterTextEditorArea(bool enable);
private:
int32_t CheckDragData(const DragData &dragData);

View File

@ -72,6 +72,7 @@ public:
int32_t GetDragSummary(std::map<std::string, int64_t> &summarys);
void DragKeyEventCallback(std::shared_ptr<MMI::KeyEvent> keyEvent);
int32_t GetDropType(DropType& dropType) const;
int32_t EnterTextEditorArea(bool enable);
#ifdef OHOS_DRAG_ENABLE_INTERCEPTOR
class InterceptorConsumer : public MMI::IInputEventConsumer {
public:

View File

@ -1185,6 +1185,15 @@ void DragDrawing::ProcessFilter()
}
}
int32_t DragDrawing::EnterTextEditorArea(bool enable)
{
CALL_DEBUG_ENTER;
if (enable) {
return RET_OK;
}
return RET_ERR;
}
float DragDrawing::RadiusVp2Sigma(float radiusVp, float dipScale)
{
float radiusPx = radiusVp * dipScale;

View File

@ -822,6 +822,12 @@ int32_t DragManager::GetDropType(DropType& dropType) const
dropType = dropType_.load();
return RET_OK;
}
int32_t DragManager::EnterTextEditorArea(bool enable)
{
CALL_DEBUG_ENTER;
return dragDrawing_.EnterTextEditorArea(enable);
}
} // namespace DeviceStatus
} // namespace Msdp
} // namespace OHOS

View File

@ -81,6 +81,7 @@ public:
int32_t AddSubscriptListener() override;
int32_t RemoveSubscriptListener() override;
int32_t SetDragWindowVisible(bool visible) override;
int32_t EnterTextEditorArea(bool enable) override;
int32_t GetShadowOffset(int32_t& offsetX, int32_t& offsetY, int32_t& width, int32_t& height) override;
int32_t UpdateShadowPic(const ShadowInfo &shadowInfo) override;
int32_t GetDragData(DragData &dragData) override;

View File

@ -747,6 +747,17 @@ int32_t DeviceStatusService::SetDragWindowVisible(bool visible)
return ret;
}
int32_t DeviceStatusService::EnterTextEditorArea(bool enable)
{
CALL_DEBUG_ENTER;
int32_t ret = delegateTasks_.PostSyncTask(
std::bind(&DragManager::EnterTextEditorArea, &dragMgr_, enable));
if (ret != RET_OK) {
FI_HILOGE("Enter Text Editor Area failed, ret:%{public}d", ret);
}
return ret;
}
int32_t DeviceStatusService::GetShadowOffset(int32_t& offsetX, int32_t& offsetY, int32_t& width, int32_t& height)
{
CALL_DEBUG_ENTER;