* Copyright (c) 2024-2025 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_ANCO_CONSUMER_H
#define I_ANCO_CONSUMER_H
#include "key_event.h"
#include "pointer_event.h"
#include "window_info.h"
namespace OHOS {
namespace MMI {
enum class ANCO_WINDOW_UPDATE_TYPE: uint32_t {
ALL = 0,
INCREMENT = 1,
};
struct AncoWindowInfo {
* Globally unique identifier of the window
*/
int32_t id;
* A 32-bit flag that represents the window status. If the 0th bitt is 1,
* the window is untouchable; if the 0th bit is 0, the window is touchable.
*/
uint32_t flags;
* Agent window ID
*/
WINDOW_UPDATE_ACTION action { WINDOW_UPDATE_ACTION::UNKNOWN };
* Window display ID
*/
int32_t displayId { DEFAULT_DISPLAY_ID };
* Window order in Z-index
*/
float zOrder { 0.0f };
* Window transform for changing display x,y to window x,y.
*/
std::vector<float> transform;
* Number of touch response areas (excluding the mouse response areas) in the window.
* The value cannot exceed the value of MAX_HOTAREA_COUNT.
*/
std::vector<Rect> defaultHotAreas;
* Number of excluded touch response areas in the window.
*/
std::vector<Rect> ancoExcludedAreas;
};
struct AncoWindows : public Parcelable {
ANCO_WINDOW_UPDATE_TYPE updateType;
int32_t focusWindowId;
std::vector<AncoWindowInfo> windows;
bool Marshalling(Parcel &out) const;
bool ReadFromParcel(Parcel &in);
static AncoWindows* Unmarshalling(Parcel &in);
};
struct AncoOneHandData : public Parcelable {
int32_t oneHandX;
int32_t oneHandY;
int32_t expandHeight;
int32_t scalePercent;
bool Marshalling(Parcel &parcel) const;
bool ReadFromParcel(Parcel &parcel);
static AncoOneHandData* Unmarshalling(Parcel &parcel);
};
struct AncoExcludedKeyEventWindow : public Parcelable {
std::vector<int32_t> windowIds;
bool Marshalling(Parcel &parcel) const;
bool ReadFromParcel(Parcel &parcel);
static AncoExcludedKeyEventWindow* Unmarshalling(Parcel &parcel);
};
struct AncoTripleFingerSnapshotState : public Parcelable {
bool enabled;
bool Marshalling(Parcel &parcel) const;
bool ReadFromParcel(Parcel &parcel);
static AncoTripleFingerSnapshotState* Unmarshalling(Parcel &parcel);
};
class IAncoConsumer {
public:
IAncoConsumer() = default;
virtual ~IAncoConsumer() = default;
virtual int32_t SyncInputEvent(std::shared_ptr<PointerEvent> pointerEvent) = 0;
virtual int32_t SyncInputEvent(std::shared_ptr<KeyEvent> keyEvent) = 0;
virtual int32_t UpdateWindowInfo(std::shared_ptr<AncoWindows> windows) = 0;
virtual int32_t SyncKnuckleStatus(bool isKnuckleEnable) = 0;
virtual int32_t UpdateOneHandData(const AncoOneHandData &oneHandData) = 0;
virtual int32_t UpdateExcludedKeyEventWindow(
const AncoExcludedKeyEventWindow &excludedKeyEventWindow) = 0;
virtual int32_t UpdateTripleFingerSnapshotState(
const AncoTripleFingerSnapshotState &snapshotState) = 0;
};
}
}
#endif