1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022-2024 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#include "accessibility_event_info.h" 17885b47fbSopenharmony_ci 18885b47fbSopenharmony_ci#include <cinttypes> 19885b47fbSopenharmony_ci 20885b47fbSopenharmony_ci#include "hilog_wrapper.h" 21885b47fbSopenharmony_ci 22885b47fbSopenharmony_cinamespace OHOS { 23885b47fbSopenharmony_cinamespace Accessibility { 24885b47fbSopenharmony_civoid AccessibilityMemo::SetSource(const int64_t componentId) 25885b47fbSopenharmony_ci{ 26885b47fbSopenharmony_ci HILOG_DEBUG("componentId[%{public}" PRId64 "]", componentId); 27885b47fbSopenharmony_ci componentId_ = componentId; 28885b47fbSopenharmony_ci elementId_ = componentId; 29885b47fbSopenharmony_ci} 30885b47fbSopenharmony_ci 31885b47fbSopenharmony_ciint64_t AccessibilityMemo::GetViewId() const 32885b47fbSopenharmony_ci{ 33885b47fbSopenharmony_ci HILOG_DEBUG("componentId_[%{public}" PRId64 "]", componentId_); 34885b47fbSopenharmony_ci return componentId_; 35885b47fbSopenharmony_ci} 36885b47fbSopenharmony_ci 37885b47fbSopenharmony_ciint64_t AccessibilityMemo::GetAccessibilityId() const 38885b47fbSopenharmony_ci{ 39885b47fbSopenharmony_ci HILOG_DEBUG("called] elementId_[%{public}" PRId64 "]", elementId_); 40885b47fbSopenharmony_ci return elementId_; 41885b47fbSopenharmony_ci} 42885b47fbSopenharmony_ci 43885b47fbSopenharmony_civoid AccessibilityMemo::SetWindowId(const int32_t windowId) 44885b47fbSopenharmony_ci{ 45885b47fbSopenharmony_ci HILOG_DEBUG("windowId[%{public}d]", windowId); 46885b47fbSopenharmony_ci windowId_ = windowId; 47885b47fbSopenharmony_ci} 48885b47fbSopenharmony_ci 49885b47fbSopenharmony_ciint32_t AccessibilityMemo::GetWindowId() const 50885b47fbSopenharmony_ci{ 51885b47fbSopenharmony_ci HILOG_DEBUG("windowId_[%{public}d]", windowId_); 52885b47fbSopenharmony_ci return windowId_; 53885b47fbSopenharmony_ci} 54885b47fbSopenharmony_ci 55885b47fbSopenharmony_ciint32_t AccessibilityMemo::GetCurrentIndex() const 56885b47fbSopenharmony_ci{ 57885b47fbSopenharmony_ci HILOG_DEBUG("currentIndex_[%{public}d]", currentIndex_); 58885b47fbSopenharmony_ci return currentIndex_; 59885b47fbSopenharmony_ci} 60885b47fbSopenharmony_ci 61885b47fbSopenharmony_civoid AccessibilityMemo::SetCurrentIndex(const int32_t index) 62885b47fbSopenharmony_ci{ 63885b47fbSopenharmony_ci currentIndex_ = index; 64885b47fbSopenharmony_ci HILOG_DEBUG("currentIndex_[%{public}d]", currentIndex_); 65885b47fbSopenharmony_ci} 66885b47fbSopenharmony_ci 67885b47fbSopenharmony_ciint32_t AccessibilityMemo::GetBeginIndex() const 68885b47fbSopenharmony_ci{ 69885b47fbSopenharmony_ci HILOG_DEBUG("beginIndex_[%{public}d]", beginIndex_); 70885b47fbSopenharmony_ci return beginIndex_; 71885b47fbSopenharmony_ci} 72885b47fbSopenharmony_ci 73885b47fbSopenharmony_civoid AccessibilityMemo::SetBeginIndex(const int32_t index) 74885b47fbSopenharmony_ci{ 75885b47fbSopenharmony_ci beginIndex_ = index; 76885b47fbSopenharmony_ci HILOG_DEBUG("beginIndex_[%{public}d]", beginIndex_); 77885b47fbSopenharmony_ci} 78885b47fbSopenharmony_ci 79885b47fbSopenharmony_ciint32_t AccessibilityMemo::GetEndIndex() const 80885b47fbSopenharmony_ci{ 81885b47fbSopenharmony_ci HILOG_DEBUG("endIndex_[%{public}d]", endIndex_); 82885b47fbSopenharmony_ci return endIndex_; 83885b47fbSopenharmony_ci} 84885b47fbSopenharmony_ci 85885b47fbSopenharmony_civoid AccessibilityMemo::SetEndIndex(const int32_t index) 86885b47fbSopenharmony_ci{ 87885b47fbSopenharmony_ci endIndex_ = index; 88885b47fbSopenharmony_ci HILOG_DEBUG("endIndex_[%{public}d]", endIndex_); 89885b47fbSopenharmony_ci} 90885b47fbSopenharmony_ci 91885b47fbSopenharmony_ciconst std::string &AccessibilityMemo::GetComponentType() const 92885b47fbSopenharmony_ci{ 93885b47fbSopenharmony_ci HILOG_DEBUG("componentType_[%{public}s]", componentType_.c_str()); 94885b47fbSopenharmony_ci return componentType_; 95885b47fbSopenharmony_ci} 96885b47fbSopenharmony_ci 97885b47fbSopenharmony_civoid AccessibilityMemo::SetComponentType(const std::string &className) 98885b47fbSopenharmony_ci{ 99885b47fbSopenharmony_ci componentType_ = className; 100885b47fbSopenharmony_ci HILOG_DEBUG("componentType_[%{public}s]", componentType_.c_str()); 101885b47fbSopenharmony_ci} 102885b47fbSopenharmony_ci 103885b47fbSopenharmony_ciconst std::string &AccessibilityMemo::GetBeforeText() const 104885b47fbSopenharmony_ci{ 105885b47fbSopenharmony_ci HILOG_DEBUG("beforeText_[%{private}s]", beforeText_.c_str()); 106885b47fbSopenharmony_ci return beforeText_; 107885b47fbSopenharmony_ci} 108885b47fbSopenharmony_ci 109885b47fbSopenharmony_civoid AccessibilityMemo::SetBeforeText(const std::string &beforeText) 110885b47fbSopenharmony_ci{ 111885b47fbSopenharmony_ci beforeText_ = beforeText; 112885b47fbSopenharmony_ci HILOG_DEBUG("beforeText_[%{private}s]", beforeText_.c_str()); 113885b47fbSopenharmony_ci} 114885b47fbSopenharmony_ci 115885b47fbSopenharmony_civoid AccessibilityMemo::AddContent(const std::string &content) 116885b47fbSopenharmony_ci{ 117885b47fbSopenharmony_ci contents_.push_back(content); 118885b47fbSopenharmony_ci HILOG_DEBUG("content[%{private}s]", content.c_str()); 119885b47fbSopenharmony_ci} 120885b47fbSopenharmony_ci 121885b47fbSopenharmony_ciconst std::vector<std::string> &AccessibilityMemo::GetContentList() const 122885b47fbSopenharmony_ci{ 123885b47fbSopenharmony_ci return contents_; 124885b47fbSopenharmony_ci} 125885b47fbSopenharmony_ci 126885b47fbSopenharmony_ciconst std::string &AccessibilityMemo::GetLatestContent() const 127885b47fbSopenharmony_ci{ 128885b47fbSopenharmony_ci HILOG_DEBUG("latestContent_[%{private}s]", latestContent_.c_str()); 129885b47fbSopenharmony_ci return latestContent_; 130885b47fbSopenharmony_ci} 131885b47fbSopenharmony_ci 132885b47fbSopenharmony_civoid AccessibilityMemo::SetLatestContent(const std::string &content) 133885b47fbSopenharmony_ci{ 134885b47fbSopenharmony_ci latestContent_ = content; 135885b47fbSopenharmony_ci HILOG_DEBUG("latestContent_[%{private}s]", latestContent_.c_str()); 136885b47fbSopenharmony_ci} 137885b47fbSopenharmony_ci 138885b47fbSopenharmony_ciconst std::string &AccessibilityMemo::GetDescription() const 139885b47fbSopenharmony_ci{ 140885b47fbSopenharmony_ci HILOG_DEBUG("description_[%{public}s]", description_.c_str()); 141885b47fbSopenharmony_ci return description_; 142885b47fbSopenharmony_ci} 143885b47fbSopenharmony_ci 144885b47fbSopenharmony_civoid AccessibilityMemo::SetDescription(const std::string &contentDescription) 145885b47fbSopenharmony_ci{ 146885b47fbSopenharmony_ci description_ = contentDescription; 147885b47fbSopenharmony_ci HILOG_DEBUG("description_[%{public}s]", description_.c_str()); 148885b47fbSopenharmony_ci} 149885b47fbSopenharmony_ci 150885b47fbSopenharmony_civoid AccessibilityMemo::SetItemCounts(const int32_t itemCounts) 151885b47fbSopenharmony_ci{ 152885b47fbSopenharmony_ci itemCounts_ = itemCounts; 153885b47fbSopenharmony_ci HILOG_DEBUG("itemCounts_[%{public}d]", itemCounts_); 154885b47fbSopenharmony_ci} 155885b47fbSopenharmony_ci 156885b47fbSopenharmony_ciint32_t AccessibilityMemo::GetItemCounts() const 157885b47fbSopenharmony_ci{ 158885b47fbSopenharmony_ci HILOG_DEBUG("itemCounts_[%{public}d]", itemCounts_); 159885b47fbSopenharmony_ci return itemCounts_; 160885b47fbSopenharmony_ci} 161885b47fbSopenharmony_ci 162885b47fbSopenharmony_ciEventType AccessibilityEventInfo::GetEventType() const 163885b47fbSopenharmony_ci{ 164885b47fbSopenharmony_ci HILOG_DEBUG("eventType_[%{public}d]", eventType_); 165885b47fbSopenharmony_ci return eventType_; 166885b47fbSopenharmony_ci} 167885b47fbSopenharmony_ci 168885b47fbSopenharmony_ciWindowsContentChangeTypes AccessibilityEventInfo::GetWindowContentChangeTypes() const 169885b47fbSopenharmony_ci{ 170885b47fbSopenharmony_ci HILOG_DEBUG("windowType_[%{public}d]", windowContentChangeTypes_); 171885b47fbSopenharmony_ci return windowContentChangeTypes_; 172885b47fbSopenharmony_ci} 173885b47fbSopenharmony_ci 174885b47fbSopenharmony_civoid AccessibilityEventInfo::SetWindowContentChangeTypes(const WindowsContentChangeTypes changeTypes) 175885b47fbSopenharmony_ci{ 176885b47fbSopenharmony_ci windowContentChangeTypes_ = changeTypes; 177885b47fbSopenharmony_ci HILOG_DEBUG("windowType_[%{public}d]", windowContentChangeTypes_); 178885b47fbSopenharmony_ci} 179885b47fbSopenharmony_ci 180885b47fbSopenharmony_ciWindowUpdateType AccessibilityEventInfo::GetWindowChangeTypes() const 181885b47fbSopenharmony_ci{ 182885b47fbSopenharmony_ci HILOG_DEBUG("windowType_[%{public}d]", windowChangeTypes_); 183885b47fbSopenharmony_ci return windowChangeTypes_; 184885b47fbSopenharmony_ci} 185885b47fbSopenharmony_ci 186885b47fbSopenharmony_civoid AccessibilityEventInfo::SetWindowChangeTypes(const WindowUpdateType changeTypes) 187885b47fbSopenharmony_ci{ 188885b47fbSopenharmony_ci windowChangeTypes_ = changeTypes; 189885b47fbSopenharmony_ci HILOG_DEBUG("windowType_[%{public}d]", windowChangeTypes_); 190885b47fbSopenharmony_ci} 191885b47fbSopenharmony_ci 192885b47fbSopenharmony_civoid AccessibilityEventInfo::SetEventType(const EventType eventType) 193885b47fbSopenharmony_ci{ 194885b47fbSopenharmony_ci eventType_ = EventType(eventType); 195885b47fbSopenharmony_ci HILOG_DEBUG("eventType_[%{public}d]", eventType_); 196885b47fbSopenharmony_ci} 197885b47fbSopenharmony_ci 198885b47fbSopenharmony_ciint64_t AccessibilityEventInfo::GetTimeStamp() const 199885b47fbSopenharmony_ci{ 200885b47fbSopenharmony_ci HILOG_DEBUG("timeStamp:%{public}" PRId64 "", timeStamp_); 201885b47fbSopenharmony_ci return timeStamp_; 202885b47fbSopenharmony_ci} 203885b47fbSopenharmony_ci 204885b47fbSopenharmony_civoid AccessibilityEventInfo::SetTimeStamp(int64_t timeStamp) 205885b47fbSopenharmony_ci{ 206885b47fbSopenharmony_ci timeStamp_ = timeStamp; 207885b47fbSopenharmony_ci HILOG_DEBUG("timeStamp:%{public}" PRId64 "", timeStamp_); 208885b47fbSopenharmony_ci} 209885b47fbSopenharmony_ci 210885b47fbSopenharmony_ciconst std::string &AccessibilityEventInfo::GetBundleName() const 211885b47fbSopenharmony_ci{ 212885b47fbSopenharmony_ci HILOG_DEBUG("bundleName_[%{public}s]", bundleName_.c_str()); 213885b47fbSopenharmony_ci return bundleName_; 214885b47fbSopenharmony_ci} 215885b47fbSopenharmony_ci 216885b47fbSopenharmony_civoid AccessibilityEventInfo::SetBundleName(const std::string &bundleName) 217885b47fbSopenharmony_ci{ 218885b47fbSopenharmony_ci HILOG_DEBUG("previous bundleName[%{public}s] new bundleName[%{public}s]", bundleName_.c_str(), bundleName.c_str()); 219885b47fbSopenharmony_ci bundleName_ = bundleName; 220885b47fbSopenharmony_ci} 221885b47fbSopenharmony_ci 222885b47fbSopenharmony_ciconst std::string &AccessibilityEventInfo::GetNotificationContent() const 223885b47fbSopenharmony_ci{ 224885b47fbSopenharmony_ci HILOG_DEBUG("notificationContent_[%{public}s]", notificationContent_.c_str()); 225885b47fbSopenharmony_ci return notificationContent_; 226885b47fbSopenharmony_ci} 227885b47fbSopenharmony_ci 228885b47fbSopenharmony_civoid AccessibilityEventInfo::SetNotificationContent(const std::string ¬ificationContent) 229885b47fbSopenharmony_ci{ 230885b47fbSopenharmony_ci notificationContent_ = notificationContent; 231885b47fbSopenharmony_ci HILOG_DEBUG("notificationContent_[%{public}s]", notificationContent_.c_str()); 232885b47fbSopenharmony_ci} 233885b47fbSopenharmony_ci 234885b47fbSopenharmony_ciconst std::string &AccessibilityEventInfo::GetTextAnnouncedForAccessibility() const 235885b47fbSopenharmony_ci{ 236885b47fbSopenharmony_ci HILOG_DEBUG("textAnnouncedForAccessibility_[%{public}s]", textAnnouncedForAccessibility_.c_str()); 237885b47fbSopenharmony_ci return textAnnouncedForAccessibility_; 238885b47fbSopenharmony_ci} 239885b47fbSopenharmony_ci 240885b47fbSopenharmony_civoid AccessibilityEventInfo::SetTextAnnouncedForAccessibility(const std::string &textAnnouncedForAccessibility) 241885b47fbSopenharmony_ci{ 242885b47fbSopenharmony_ci textAnnouncedForAccessibility_ = textAnnouncedForAccessibility; 243885b47fbSopenharmony_ci HILOG_DEBUG("textAnnouncedForAccessibility_[%{public}s]", textAnnouncedForAccessibility_.c_str()); 244885b47fbSopenharmony_ci} 245885b47fbSopenharmony_ci 246885b47fbSopenharmony_ciconst std::string &AccessibilityEventInfo::GetInspectorKey() const 247885b47fbSopenharmony_ci{ 248885b47fbSopenharmony_ci HILOG_DEBUG("inspectorKey_[%{public}s]", inspectorKey_.c_str()); 249885b47fbSopenharmony_ci return inspectorKey_; 250885b47fbSopenharmony_ci} 251885b47fbSopenharmony_ci 252885b47fbSopenharmony_civoid AccessibilityEventInfo::SetInspectorKey(const std::string &inspectorKey) 253885b47fbSopenharmony_ci{ 254885b47fbSopenharmony_ci inspectorKey_ = inspectorKey; 255885b47fbSopenharmony_ci HILOG_DEBUG("inspectorKey_[%{public}s]", inspectorKey_.c_str()); 256885b47fbSopenharmony_ci} 257885b47fbSopenharmony_ci 258885b47fbSopenharmony_civoid AccessibilityEventInfo::SetTextMovementStep(const TextMoveUnit granularity) 259885b47fbSopenharmony_ci{ 260885b47fbSopenharmony_ci textMoveStep_ = granularity; 261885b47fbSopenharmony_ci HILOG_DEBUG("textMoveStep_[%{public}d]", textMoveStep_); 262885b47fbSopenharmony_ci} 263885b47fbSopenharmony_ci 264885b47fbSopenharmony_ciTextMoveUnit AccessibilityEventInfo::GetTextMovementStep() const 265885b47fbSopenharmony_ci{ 266885b47fbSopenharmony_ci HILOG_DEBUG("textMoveStep_[%{public}d]", textMoveStep_); 267885b47fbSopenharmony_ci return textMoveStep_; 268885b47fbSopenharmony_ci} 269885b47fbSopenharmony_ci 270885b47fbSopenharmony_civoid AccessibilityEventInfo::SetTriggerAction(const ActionType action) 271885b47fbSopenharmony_ci{ 272885b47fbSopenharmony_ci triggerAction_ = action; 273885b47fbSopenharmony_ci HILOG_DEBUG("triggerAction_[%{public}d]", triggerAction_); 274885b47fbSopenharmony_ci} 275885b47fbSopenharmony_ci 276885b47fbSopenharmony_ciActionType AccessibilityEventInfo::GetTriggerAction() const 277885b47fbSopenharmony_ci{ 278885b47fbSopenharmony_ci HILOG_DEBUG("triggerAction_[%{public}d]", triggerAction_); 279885b47fbSopenharmony_ci return triggerAction_; 280885b47fbSopenharmony_ci} 281885b47fbSopenharmony_ci 282885b47fbSopenharmony_ciAccessibilityEventInfo::AccessibilityEventInfo(int32_t windowId, WindowUpdateType windowChangeTypes) 283885b47fbSopenharmony_ci : eventType_(TYPE_WINDOW_UPDATE), windowChangeTypes_(windowChangeTypes) 284885b47fbSopenharmony_ci{ 285885b47fbSopenharmony_ci HILOG_DEBUG(); 286885b47fbSopenharmony_ci SetWindowId(windowId); 287885b47fbSopenharmony_ci} 288885b47fbSopenharmony_ci 289885b47fbSopenharmony_ciAccessibilityEventInfo::AccessibilityEventInfo(EventType eventType) : eventType_(eventType) 290885b47fbSopenharmony_ci{ 291885b47fbSopenharmony_ci HILOG_DEBUG("eventType_[%{public}d]", eventType_); 292885b47fbSopenharmony_ci} 293885b47fbSopenharmony_ci 294885b47fbSopenharmony_civoid AccessibilityEventInfo::SetNotificationInfo(const NotificationCategory category) 295885b47fbSopenharmony_ci{ 296885b47fbSopenharmony_ci category_ = category; 297885b47fbSopenharmony_ci HILOG_DEBUG("category_[%{public}d]", category_); 298885b47fbSopenharmony_ci} 299885b47fbSopenharmony_ci 300885b47fbSopenharmony_civoid AccessibilityEventInfo::SetGestureType(const GestureType gestureType) 301885b47fbSopenharmony_ci{ 302885b47fbSopenharmony_ci gestureType_ = gestureType; 303885b47fbSopenharmony_ci HILOG_DEBUG("gestureType_[%{public}d]", gestureType_); 304885b47fbSopenharmony_ci} 305885b47fbSopenharmony_ci 306885b47fbSopenharmony_ciGestureType AccessibilityEventInfo::GetGestureType() const 307885b47fbSopenharmony_ci{ 308885b47fbSopenharmony_ci HILOG_DEBUG("gestureType_[%{public}d]", gestureType_); 309885b47fbSopenharmony_ci return gestureType_; 310885b47fbSopenharmony_ci} 311885b47fbSopenharmony_ci 312885b47fbSopenharmony_ciNotificationCategory AccessibilityEventInfo::GetNotificationInfo() const 313885b47fbSopenharmony_ci{ 314885b47fbSopenharmony_ci HILOG_DEBUG("category_[%{public}d]", category_); 315885b47fbSopenharmony_ci return category_; 316885b47fbSopenharmony_ci} 317885b47fbSopenharmony_ci 318885b47fbSopenharmony_civoid AccessibilityEventInfo::SetPageId(const int32_t pageId) 319885b47fbSopenharmony_ci{ 320885b47fbSopenharmony_ci HILOG_DEBUG("pageId[%{public}d]", pageId); 321885b47fbSopenharmony_ci pageId_ = pageId; 322885b47fbSopenharmony_ci} 323885b47fbSopenharmony_ci 324885b47fbSopenharmony_ciint32_t AccessibilityEventInfo::GetPageId() const 325885b47fbSopenharmony_ci{ 326885b47fbSopenharmony_ci HILOG_DEBUG("pageId_[%{public}d]", pageId_); 327885b47fbSopenharmony_ci return pageId_; 328885b47fbSopenharmony_ci} 329885b47fbSopenharmony_ci 330885b47fbSopenharmony_civoid AccessibilityEventInfo::SetElementInfo(const AccessibilityElementInfo &elementInfo) 331885b47fbSopenharmony_ci{ 332885b47fbSopenharmony_ci HILOG_DEBUG("set elementInfo"); 333885b47fbSopenharmony_ci elementInfo_ = elementInfo; 334885b47fbSopenharmony_ci} 335885b47fbSopenharmony_ci 336885b47fbSopenharmony_ciconst AccessibilityElementInfo &AccessibilityEventInfo::GetElementInfo() const 337885b47fbSopenharmony_ci{ 338885b47fbSopenharmony_ci HILOG_DEBUG("get elementInfo"); 339885b47fbSopenharmony_ci return elementInfo_; 340885b47fbSopenharmony_ci} 341885b47fbSopenharmony_ci 342885b47fbSopenharmony_civoid AccessibilityEventInfo::SetRequestFocusElementId(const int32_t requestFocusElementId) 343885b47fbSopenharmony_ci{ 344885b47fbSopenharmony_ci HILOG_DEBUG("requestFocusElementId[%{public}d]", requestFocusElementId); 345885b47fbSopenharmony_ci requestFocusElementId_ = requestFocusElementId; 346885b47fbSopenharmony_ci} 347885b47fbSopenharmony_ci 348885b47fbSopenharmony_ciint32_t AccessibilityEventInfo::GetRequestFocusElementId() const 349885b47fbSopenharmony_ci{ 350885b47fbSopenharmony_ci HILOG_DEBUG("requestFocusElementId_[%{public}d]", requestFocusElementId_); 351885b47fbSopenharmony_ci return requestFocusElementId_; 352885b47fbSopenharmony_ci} 353885b47fbSopenharmony_ci} // namespace Accessibility 354885b47fbSopenharmony_ci} // namespace OHOS