1 /*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "accessibility_event_info.h"
17 #include "accessibility_operator.h"
18 #include "hilog_wrapper.h"
19
20 namespace OHOS {
21 namespace Accessibility {
ReadFromParcel(Parcel & parcel)22 bool AccessibilityMemo::ReadFromParcel(Parcel &parcel)
23 {
24 HILOG_DEBUG("start");
25 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, channelId_);
26 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, componentId_);
27 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, windowId_);
28 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, currentIndex_);
29 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, beginIndex_);
30 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, endIndex_);
31 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(StringVector, parcel, &contents_);
32 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, componentType_);
33 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, description_);
34 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, beforeText_);
35 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, latestConent_);
36 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, elementId_);
37 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, itemCounts_);
38
39 return true;
40 }
41
Marshalling(Parcel & parcel) const42 bool AccessibilityMemo::Marshalling(Parcel &parcel) const
43 {
44 HILOG_DEBUG("start");
45 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, channelId_);
46 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, componentId_);
47 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, windowId_);
48 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, currentIndex_);
49 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, beginIndex_);
50 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, endIndex_);
51 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(StringVector, parcel, contents_);
52 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, componentType_);
53 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, description_);
54 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, beforeText_);
55 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, latestConent_);
56 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, elementId_);
57 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, itemCounts_);
58
59 return true;
60 }
61
Unmarshalling(Parcel & parcel)62 AccessibilityMemo* AccessibilityMemo::Unmarshalling(Parcel& parcel)
63 {
64 HILOG_DEBUG("start");
65 AccessibilityMemo* accessibilityRecord = new AccessibilityMemo();
66 if (!accessibilityRecord->ReadFromParcel(parcel)) {
67 HILOG_ERROR("read from parcel failed");
68 delete accessibilityRecord;
69 accessibilityRecord = nullptr;
70 }
71 return accessibilityRecord;
72 }
73
SetChannelId(const int channelId)74 void AccessibilityMemo::SetChannelId(const int channelId)
75 {
76 channelId_ = channelId;
77 HILOG_DEBUG("channelId_[%{public}d]", channelId_);
78 }
79
GetChannelId() const80 int AccessibilityMemo::GetChannelId() const
81 {
82 HILOG_DEBUG("channelId_[%{public}d]", channelId_);
83 return channelId_;
84 }
85
SetSource(const int componentId)86 void AccessibilityMemo::SetSource(const int componentId)
87 {
88 HILOG_DEBUG("componentId[%{public}d]", componentId);
89 componentId_ = componentId;
90 elementId_ = componentId;
91 }
92
GetSource(AccessibilityElementInfo & elementInfo) const93 bool AccessibilityMemo::GetSource(AccessibilityElementInfo &elementInfo) const
94 {
95 HILOG_INFO("called] channelId_[%{public}d], windowId_[%{public}d], elementId_[%{public}d]",
96 channelId_, windowId_, elementId_);
97 AccessibilityOperator *instance = &AccessibilityOperator::GetInstance();
98 AccessibilityElementInfo element {};
99 std::vector<AccessibilityElementInfo> elementInfos {};
100 bool result = false;
101 if (instance != nullptr) {
102 result = instance->SearchElementInfosByAccessibilityId(channelId_, windowId_, elementId_, 0, elementInfos);
103 for (auto& info : elementInfos) {
104 HILOG_INFO("called] GetSource OK");
105 result = true;
106 elementInfo = info;
107 break;
108 }
109 HILOG_INFO("called] GetSource is null");
110 } else {
111 HILOG_INFO("called] Can't get AccessibilityOperator instance");
112 }
113 return result;
114 }
115
GetViewId() const116 int AccessibilityMemo::GetViewId() const
117 {
118 HILOG_DEBUG("componentId_[%{public}d]", componentId_);
119 return componentId_;
120 }
121
GetAccessibilityId() const122 int AccessibilityMemo::GetAccessibilityId() const
123 {
124 HILOG_INFO("called] elementId_[%{public}d]", elementId_);
125 return elementId_;
126 }
127
SetWindowId(const int windowId)128 void AccessibilityMemo::SetWindowId(const int windowId)
129 {
130 HILOG_DEBUG("windowId[%{public}d]", windowId);
131 windowId_ = windowId;
132 }
133
GetWindowId() const134 int AccessibilityMemo::GetWindowId() const
135 {
136 HILOG_DEBUG("windowId_[%{public}d]", windowId_);
137 return windowId_;
138 }
139
GetCurrentIndex() const140 int AccessibilityMemo::GetCurrentIndex() const
141 {
142 HILOG_DEBUG("currentIndex_[%{public}d]", currentIndex_);
143 return currentIndex_;
144 }
145
SetCurrentIndex(const int index)146 void AccessibilityMemo::SetCurrentIndex(const int index)
147 {
148 currentIndex_ = index;
149 HILOG_DEBUG("currentIndex_[%{public}d]", currentIndex_);
150 }
151
GetBeginIndex() const152 int AccessibilityMemo::GetBeginIndex() const
153 {
154 HILOG_DEBUG("beginIndex_[%{public}d]", beginIndex_);
155 return beginIndex_;
156 }
157
SetBeginIndex(const int index)158 void AccessibilityMemo::SetBeginIndex(const int index)
159 {
160 beginIndex_ = index;
161 HILOG_DEBUG("beginIndex_[%{public}d]", beginIndex_);
162 }
163
GetEndIndex() const164 int AccessibilityMemo::GetEndIndex() const
165 {
166 HILOG_DEBUG("endIndex_[%{public}d]", endIndex_);
167 return endIndex_;
168 }
169
SetEndIndex(const int index)170 void AccessibilityMemo::SetEndIndex(const int index)
171 {
172 endIndex_ = index;
173 HILOG_DEBUG("endIndex_[%{public}d]", endIndex_);
174 }
175
GetComponentType() const176 std::string AccessibilityMemo::GetComponentType() const
177 {
178 HILOG_DEBUG("componentType_[%{public}s]", componentType_.c_str());
179 return componentType_;
180 }
181
SetComponentType(const std::string & className)182 void AccessibilityMemo::SetComponentType(const std::string &className)
183 {
184 componentType_ = className;
185 HILOG_DEBUG("componentType_[%{public}s]", componentType_.c_str());
186 }
187
GetBeforeText() const188 std::string AccessibilityMemo::GetBeforeText() const
189 {
190 HILOG_DEBUG("beforeText_[%{public}s]", beforeText_.c_str());
191 return beforeText_;
192 }
193
SetBeforeText(const std::string & beforeText)194 void AccessibilityMemo::SetBeforeText(const std::string &beforeText)
195 {
196 beforeText_ = beforeText;
197 HILOG_DEBUG("beforeText_[%{public}s]", beforeText_.c_str());
198 }
199
AddContent(const std::string & content)200 void AccessibilityMemo::AddContent(const std::string &content)
201 {
202 contents_.push_back(content);
203 HILOG_DEBUG("content[%{public}s]", content.c_str());
204 }
205
GetContentList() const206 std::vector<std::string> AccessibilityMemo::GetContentList() const
207 {
208 return contents_;
209 }
210
GetLatestContent() const211 std::string AccessibilityMemo::GetLatestContent() const
212 {
213 HILOG_DEBUG("latestConent_[%{public}s]", latestConent_.c_str());
214 return latestConent_;
215 }
216
SetLatestContent(const std::string & content)217 void AccessibilityMemo::SetLatestContent(const std::string &content)
218 {
219 latestConent_ = content;
220 HILOG_DEBUG("latestConent_[%{public}s]", latestConent_.c_str());
221 }
222
GetDescription() const223 std::string AccessibilityMemo::GetDescription() const
224 {
225 HILOG_DEBUG("description_[%{public}s]", description_.c_str());
226 return description_;
227 }
228
SetDescription(const std::string & contentDescription)229 void AccessibilityMemo::SetDescription(const std::string &contentDescription)
230 {
231 description_ = contentDescription;
232 HILOG_DEBUG("description_[%{public}s]", description_.c_str());
233 }
234
SetItemCounts(const int itemCounts)235 void AccessibilityMemo::SetItemCounts(const int itemCounts)
236 {
237 itemCounts_ = itemCounts;
238 HILOG_DEBUG("itemCounts_[%{public}d]", itemCounts_);
239 }
240
GetItemCounts() const241 int AccessibilityMemo::GetItemCounts() const
242 {
243 HILOG_DEBUG("itemCounts_[%{public}d]", itemCounts_);
244 return itemCounts_;
245 }
246
ReadFromParcel(Parcel & parcel)247 bool AccessibilityEventInfo::ReadFromParcel(Parcel &parcel)
248 {
249 HILOG_DEBUG("start");
250 int eventType = TYPE_VIEW_INVALID;
251 int gestureType = GESTURE_INVALID;
252 int triggerAction = ACCESSIBILITY_ACTION_INVALID;
253 int textMoveStep = STEP_CHARACTER;
254 int windowContentChangeTypes = CONTENT_CHANGE_TYPE_INVALID;
255 int windowChangeTypes = WINDOW_UPDATE_INVALID;
256 int category = CATEGORY_INVALID;
257 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, eventType);
258 eventType_ = static_cast<EventType>(eventType);
259 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, gestureType);
260 gestureType_ = static_cast<GestureType>(gestureType);
261 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, bundleName_);
262 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, triggerAction);
263 triggerAction_ = static_cast<ActionType>(triggerAction);
264 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int64, parcel, timeStamp_);
265 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, textMoveStep);
266 textMoveStep_ = static_cast<TextMoveUnit>(textMoveStep);
267 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, windowContentChangeTypes);
268 windowContentChangeTypes_ = static_cast<WindowsContentChangeTypes>(windowContentChangeTypes);
269 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, windowChangeTypes);
270 windowChangeTypes_ = static_cast<WindowUpdateType>(windowChangeTypes);
271 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, recordsCount_);
272 int32_t recordSize = 0;
273 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, recordSize);
274 for (auto i = 0; i < recordSize; i++) {
275 std::shared_ptr<AccessibilityEventInfo> accessibilityRecord(parcel.ReadParcelable<AccessibilityEventInfo>());
276 if (!accessibilityRecord) {
277 HILOG_ERROR("ReadParcelable<accessibilityInfo> failed");
278 return false;
279 }
280 records_.emplace_back(*accessibilityRecord);
281 }
282 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, category);
283 category_ = static_cast<NotificationCategory>(category);
284 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, pageId_);
285
286 int32_t channelId = 0;
287 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, channelId);
288 SetChannelId(channelId);
289 int32_t componentId = 0;
290 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, componentId);
291 SetSource(componentId);
292 int32_t windowId = 0;
293 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, windowId);
294 SetWindowId(windowId);
295 int32_t currentIndex = 0;
296 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, currentIndex);
297 SetCurrentIndex(currentIndex);
298 int32_t beginIndex = 0;
299 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, beginIndex);
300 SetBeginIndex(beginIndex);
301 int32_t endIndex = 0;
302 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, endIndex);
303 SetEndIndex(endIndex);
304 int32_t contentSize = 0;
305 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, contentSize);
306 std::string content;
307 for (auto i = 0 ; i < contentSize; i++) {
308 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, content);
309 AddContent(content);
310 }
311 std::string componentType;
312 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, componentType);
313 SetComponentType(componentType);
314 std::string description;
315 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, description);
316 SetDescription(description);
317 std::string beforeText;
318 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, beforeText);
319 SetBeforeText(beforeText);
320 std::string latestConent;
321 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, latestConent);
322 SetLatestContent(latestConent);
323 int32_t elementId = 0;
324 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, elementId);
325
326 int32_t itemCounts = 0;
327 READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, itemCounts);
328 SetItemCounts(itemCounts);
329 return true;
330 }
331
Marshalling(Parcel & parcel) const332 bool AccessibilityEventInfo::Marshalling(Parcel &parcel) const
333 {
334 HILOG_DEBUG("start");
335 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(eventType_));
336 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(gestureType_));
337 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, bundleName_);
338 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(triggerAction_));
339 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int64, parcel, timeStamp_);
340 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(textMoveStep_));
341 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(windowContentChangeTypes_));
342 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(windowChangeTypes_));
343 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, recordsCount_);
344 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, records_.size());
345 for (auto &record : records_) {
346 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Parcelable, parcel, &record);
347 }
348 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast<int>(category_));
349 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, pageId_);
350
351 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetChannelId());
352 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetViewId());
353 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetWindowId());
354 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetCurrentIndex());
355 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetBeginIndex());
356 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetEndIndex());
357 auto contentList = GetContentList();
358 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, contentList.size());
359 for (auto &content : contentList) {
360 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, content);
361 }
362 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, GetComponentType());
363 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, GetDescription());
364 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, GetBeforeText());
365 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, GetLatestContent());
366 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetAccessibilityId());
367 WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, GetItemCounts());
368 return true;
369 }
370
Unmarshalling(Parcel & parcel)371 AccessibilityEventInfo *AccessibilityEventInfo::Unmarshalling(Parcel& parcel)
372 {
373 HILOG_DEBUG("start");
374 AccessibilityEventInfo *accessibilityEventInfo = new AccessibilityEventInfo();
375 if (!accessibilityEventInfo->ReadFromParcel(parcel)) {
376 HILOG_ERROR("read from parcel failed");
377 delete accessibilityEventInfo;
378 accessibilityEventInfo = nullptr;
379 }
380 return accessibilityEventInfo;
381 }
382
GetRecordCount() const383 int AccessibilityEventInfo::GetRecordCount() const
384 {
385 HILOG_DEBUG("recordsCount_[%{public}d]", recordsCount_);
386 return recordsCount_;
387 }
388
SetRecordCount(const int recordCount)389 void AccessibilityEventInfo::SetRecordCount(const int recordCount)
390 {
391 recordsCount_ = recordCount;
392 HILOG_DEBUG("recordsCount_[%{public}d]", recordsCount_);
393 }
394
AddRecord(const AccessibilityEventInfo & record)395 void AccessibilityEventInfo::AddRecord(const AccessibilityEventInfo &record)
396 {
397 HILOG_DEBUG("start");
398 records_.push_back(record);
399 }
400
GetRecord(const int index)401 AccessibilityEventInfo AccessibilityEventInfo::GetRecord(const int index)
402 {
403 HILOG_DEBUG("start");
404 if (index >= recordsCount_ || index < 0) {
405 AccessibilityEventInfo record {};
406 HILOG_ERROR("[called] index[%{public}d] is invalid", index);
407 return record;
408 }
409 return records_[index];
410 }
411
GetRecords()412 std::vector<AccessibilityEventInfo> AccessibilityEventInfo::GetRecords()
413 {
414 HILOG_DEBUG("start");
415 return records_;
416 }
417
GetEventType() const418 EventType AccessibilityEventInfo::GetEventType() const
419 {
420 HILOG_DEBUG("eventType_[%{public}d]", eventType_);
421 return eventType_;
422 }
423
GetWindowContentChangeTypes() const424 WindowsContentChangeTypes AccessibilityEventInfo::GetWindowContentChangeTypes() const
425 {
426 HILOG_DEBUG("windowType_[%{public}d]", windowContentChangeTypes_);
427 return windowContentChangeTypes_;
428 }
429
SetWindowContentChangeTypes(const WindowsContentChangeTypes changeTypes)430 void AccessibilityEventInfo::SetWindowContentChangeTypes(const WindowsContentChangeTypes changeTypes)
431 {
432 windowContentChangeTypes_ = changeTypes;
433 HILOG_DEBUG("windowType_[%{public}d]", windowContentChangeTypes_);
434 }
435
GetWindowChangeTypes() const436 WindowUpdateType AccessibilityEventInfo::GetWindowChangeTypes() const
437 {
438 HILOG_DEBUG("windowType_[%{public}d]", windowChangeTypes_);
439 return windowChangeTypes_;
440 }
441
SetWindowChangeTypes(const WindowUpdateType changeTypes)442 void AccessibilityEventInfo::SetWindowChangeTypes(const WindowUpdateType changeTypes)
443 {
444 windowChangeTypes_ = changeTypes;
445 HILOG_DEBUG("windowType_[%{public}d]", windowChangeTypes_);
446 }
447
SetEventType(const EventType eventType)448 void AccessibilityEventInfo::SetEventType(const EventType eventType)
449 {
450 eventType_ = EventType(eventType);
451 HILOG_DEBUG("eventType_[%{public}d]", eventType_);
452 }
453
GetTimeStamp() const454 int64_t AccessibilityEventInfo::GetTimeStamp() const
455 {
456 HILOG_DEBUG("start");
457 return timeStamp_;
458 }
459
SetTimeStamp(const int64_t eventTime)460 void AccessibilityEventInfo::SetTimeStamp(const int64_t eventTime)
461 {
462 HILOG_DEBUG("start");
463 timeStamp_ = eventTime;
464 }
465
GetBundleName() const466 std::string AccessibilityEventInfo::GetBundleName() const
467 {
468 HILOG_DEBUG("bundleName_[%{public}s]", bundleName_.c_str());
469 return bundleName_;
470 }
471
SetBundleName(const std::string & bundleName)472 void AccessibilityEventInfo::SetBundleName(const std::string &bundleName)
473 {
474 bundleName_ = bundleName;
475 HILOG_DEBUG("bundleName_[%{public}s]", bundleName_.c_str());
476 }
477
SetTextMovementStep(const TextMoveUnit granularity)478 void AccessibilityEventInfo::SetTextMovementStep(const TextMoveUnit granularity)
479 {
480 textMoveStep_ = granularity;
481 HILOG_DEBUG("textMoveStep_[%{public}d]", textMoveStep_);
482 }
483
GetTextMovementStep() const484 TextMoveUnit AccessibilityEventInfo::GetTextMovementStep() const
485 {
486 HILOG_DEBUG("textMoveStep_[%{public}d]", textMoveStep_);
487 return textMoveStep_;
488 }
489
SetTriggerAction(const ActionType action)490 void AccessibilityEventInfo::SetTriggerAction(const ActionType action)
491 {
492 triggerAction_ = action;
493 HILOG_DEBUG("triggerAction_[%{public}d]", triggerAction_);
494 }
495
GetTriggerAction() const496 ActionType AccessibilityEventInfo::GetTriggerAction() const
497 {
498 HILOG_DEBUG("triggerAction_[%{public}d]", triggerAction_);
499 return triggerAction_;
500 }
501
AccessibilityEventInfo(int windowId,WindowUpdateType windowChangeTypes)502 AccessibilityEventInfo::AccessibilityEventInfo(int windowId, WindowUpdateType windowChangeTypes)
503 : eventType_(TYPE_WINDOW_UPDATE), windowChangeTypes_(windowChangeTypes)
504 {
505 HILOG_DEBUG("start");
506 SetWindowId(windowId);
507 }
508
AccessibilityEventInfo(EventType eventType)509 AccessibilityEventInfo::AccessibilityEventInfo(EventType eventType) : eventType_(eventType)
510 {
511 HILOG_DEBUG("eventType_[%{public}d]", eventType_);
512 }
513
SetNotificationInfo(const NotificationCategory category)514 void AccessibilityEventInfo::SetNotificationInfo(const NotificationCategory category)
515 {
516 category_ = category;
517 HILOG_DEBUG("category_[%{public}d]", category_);
518 }
519
SetGestureType(const GestureType gestureType)520 void AccessibilityEventInfo::SetGestureType(const GestureType gestureType)
521 {
522 gestureType_ = gestureType;
523 HILOG_DEBUG("gestureType_[%{public}d]", gestureType_);
524 }
525
GetGestureType() const526 GestureType AccessibilityEventInfo::GetGestureType() const
527 {
528 HILOG_DEBUG("gestureType_[%{public}d]", gestureType_);
529 return gestureType_;
530 }
531
GetNotificationInfo() const532 NotificationCategory AccessibilityEventInfo::GetNotificationInfo() const
533 {
534 HILOG_DEBUG("category_[%{public}d]", category_);
535 return category_;
536 }
537
SetPageId(const int pageId)538 void AccessibilityEventInfo::SetPageId(const int pageId)
539 {
540 HILOG_DEBUG("pageId[%{public}d]", pageId);
541 pageId_ = pageId;
542 }
543
GetPageId() const544 int AccessibilityEventInfo::GetPageId() const
545 {
546 HILOG_DEBUG("pageId_[%{public}d]", pageId_);
547 return pageId_;
548 }
549 } // namespace Accessibility
550 } // namespace OHOS