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_settings_config.h"
17 #include "hilog_wrapper.h"
18 #include "system_ability_definition.h"
19 #include "utils.h"
20 #include "accessibility_setting_provider.h"
21
22 namespace OHOS {
23 namespace Accessibility {
24 namespace {
25 constexpr uint32_t DEFAULT_COLOR = 0xff000000;
26 const int32_t DEFAULT_SCALE = 100;
27 const int32_t SHORT_KEY_TIMEOUT_AFTER_USE = 1000; // ms
28 const int32_t SHORT_KEY_TIMEOUT_BEFORE_USE = 3000; // ms
29 const std::string ACCESSIBILITY = "accessibility";
30 const std::string TOUCH_GUIDE_STATE = "touch_guide_state";
31 const std::string GESTURE_KEY = "gesture_state";
32 const std::string CAPTION_KEY = "caption_state";
33 const std::string KEYEVENT_OBSERVER = "keyevent_observer";
34 const std::string SCREEN_MAGNIFICATION_KEY = "accessibility_display_magnification_enabled";
35 const std::string SCREEN_MAGNIFICATION_TYPE = "accessibility_magnification_capability";
36 const std::string MOUSEKEY = "mousekey";
37 const std::string HIGH_CONTRAST_TEXT_KEY = "high_text_contrast_enabled";
38 const std::string DALTONIZATION_STATE = "accessibility_display_daltonizer_enabled";
39 const std::string INVERT_COLOR_KEY = "accessibility_display_inversion_enabled";
40 const std::string ANIMATION_OFF_KEY = "animation_off";
41 const std::string AUDIO_MONO_KEY = "master_mono";
42 const std::string IGNORE_REPEAT_CLICK_SWITCH = "ignore_repeat_click_switch";
43 const std::string SHORTCUT_ENABLED = "accessibility_shortcut_enabled";
44 const std::string SHORTCUT_SERVICE = "accessibility_shortcut_target_service";
45 const std::string CLICK_RESPONCE_TIME = "click_response_time";
46 const std::string IGNORE_REPEAT_CLICK_TIME = "ignore_repeat_click_time";
47 const std::string DALTONIZATION_COLOR_FILTER_KEY = "accessibility_display_daltonizer";
48 const std::string CONTENT_TIMEOUT_KEY = "accessibility_content_timeout";
49 const std::string BRIGHTNESS_DISCOUNT_KEY = "accessibility_brightness_discount";
50 const std::string AUDIO_BALANCE_KEY = "master_balance";
51 const std::string FONT_FAMILY = "accessibility_font_family";
52 const std::string FONT_COLOR = "accessibility_font_color";
53 const std::string FONT_EDGE_TYPE = "accessibility_font_edge_type";
54 const std::string BACKGROUND_COLOR = "accessibility_background_color";
55 const std::string WINDOW_COLOR = "accessibility_window_color";
56 const std::string FONT_SCALE = "accessibility_font_scale";
57 const std::string ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services";
58 const std::string SHORTCUT_ENABLED_ON_LOCK_SCREEN = "accessibility_shortcut_enabled_on_lock_screen"; // HMOS key
59 const std::string SHORTCUT_ON_LOCK_SCREEN = "accessibility_shortcut_on_lock_screen"; // AOS key
60 const std::string SHORTCUT_TIMEOUT = "accessibility_shortcut_timeout";
61 const std::string ACCESSIBILITY_CLONE_FLAG = "accessibility_config_clone";
62 const std::string SCREENREADER_TAG = "screenreader";
63 const std::string INVERT_COLOR_AOS_TAG = "ColorInversion";
64 const std::string INVERT_COLOR_HMOS_TAG = "INVERT_COLOR";
65 const std::string AUDIO_MONO_HMOS_TAG = "AUDIO_MONO";
66 const std::string HIGH_CONTRAST_TEXT_HMOS_TAG = "HIGH_CONTRAST_TEXT";
67 const std::string SCREEN_READER_BUNDLE_ABILITY_NAME = "com.huawei.hmos.screenreader/AccessibilityExtAbility";
68 const std::string ACCESSIBILITY_SCREENREADER_ENABLED = "accessibility_screenreader_enabled";
69 constexpr int DOUBLE_CLICK_RESPONSE_TIME_MEDIUM = 300;
70 constexpr int DOUBLE_IGNORE_REPEAT_CLICK_TIME_SHORT = 400;
71 constexpr int DOUBLE_IGNORE_REPEAT_CLICK_TIME_MEDIUM = 700;
72 constexpr int DOUBLE_IGNORE_REPEAT_CLICK_TIME_LONG = 1000;
73 constexpr int DISPLAY_DALTONIZER_GREEN = 12;
74 constexpr int DISPLAY_DALTONIZER_RED = 11;
75 constexpr int DISPLAY_DALTONIZER_BLUE = 13;
76 constexpr int INVALID_MASTER_MONO_VALUE = -1;
77 constexpr int AUDIO_BALANCE_STEP = 5;
78 constexpr float INVALID_MASTER_BALANCE_VALUE = 2.0;
79 constexpr int INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE = 2;
80 constexpr float EPS = 1e-6;
81 } // namespace
AccessibilitySettingsConfig(int32_t id)82 AccessibilitySettingsConfig::AccessibilitySettingsConfig(int32_t id)
83 {
84 HILOG_DEBUG("id = [%{public}d]", id);
85 accountId_ = id;
86 }
87
SetEnabled(const bool state)88 RetError AccessibilitySettingsConfig::SetEnabled(const bool state)
89 {
90 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
91 auto ret = SetConfigState(ACCESSIBILITY, state);
92 if (ret != RET_OK) {
93 HILOG_ERROR("set accessibility failed");
94 return ret;
95 }
96 enabled_ = state;
97 return ret;
98 }
99
SetTouchGuideState(const bool state)100 RetError AccessibilitySettingsConfig::SetTouchGuideState(const bool state)
101 {
102 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
103 auto ret = SetConfigState(TOUCH_GUIDE_STATE, state);
104 if (ret != RET_OK) {
105 HILOG_ERROR("set eventTouchGuideState_ failed");
106 return ret;
107 }
108 eventTouchGuideState_ = state;
109 return ret;
110 }
111
SetGestureState(const bool state)112 RetError AccessibilitySettingsConfig::SetGestureState(const bool state)
113 {
114 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
115 auto ret = SetConfigState(GESTURE_KEY, state);
116 if (ret != RET_OK) {
117 HILOG_ERROR("set gesturesSimulation_ failed");
118 return ret;
119 }
120 gesturesSimulation_ = state;
121 return ret;
122 }
123
SetKeyEventObserverState(const bool state)124 RetError AccessibilitySettingsConfig::SetKeyEventObserverState(const bool state)
125 {
126 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
127 auto ret = SetConfigState(KEYEVENT_OBSERVER, state);
128 if (ret != RET_OK) {
129 HILOG_ERROR("set filteringKeyEvents_ failed");
130 return ret;
131 }
132 filteringKeyEvents_ = state;
133 return ret;
134 }
135
SetCaptionState(const bool state)136 RetError AccessibilitySettingsConfig::SetCaptionState(const bool state)
137 {
138 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
139 auto ret = SetConfigState(CAPTION_KEY, state);
140 if (ret != RET_OK) {
141 HILOG_ERROR("set isCaptionState_ failed");
142 return ret;
143 }
144 isCaptionState_ = state;
145 return ret;
146 }
147
SetScreenMagnificationState(const bool state)148 RetError AccessibilitySettingsConfig::SetScreenMagnificationState(const bool state)
149 {
150 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
151 isScreenMagnificationState_ = state;
152 return RET_OK;
153 }
154
SetScreenMagnificationType(const uint32_t type)155 RetError AccessibilitySettingsConfig::SetScreenMagnificationType(const uint32_t type)
156 {
157 HILOG_DEBUG("screenMagnificationType = [%{public}u]", type);
158 screenMagnificationType_ = type;
159 return RET_OK;
160 }
161
SetShortKeyState(const bool state)162 RetError AccessibilitySettingsConfig::SetShortKeyState(const bool state)
163 {
164 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
165 auto ret = SetConfigState(SHORTCUT_ENABLED, state);
166 if (ret != RET_OK) {
167 HILOG_ERROR("set isShortKeyState_ failed");
168 return ret;
169 }
170 isShortKeyState_ = state;
171 return ret;
172 }
173
SetShortKeyOnLockScreenState(const bool state)174 RetError AccessibilitySettingsConfig::SetShortKeyOnLockScreenState(const bool state)
175 {
176 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
177 auto ret = SetConfigState(SHORTCUT_ENABLED_ON_LOCK_SCREEN, state);
178 if (ret != RET_OK) {
179 HILOG_ERROR("set isShortKeyEnabledOnLockScreen_ failed");
180 return ret;
181 }
182 isShortKeyEnabledOnLockScreen_ = state;
183 return ret;
184 }
185
SetShortKeyTimeout(const int32_t time)186 RetError AccessibilitySettingsConfig::SetShortKeyTimeout(const int32_t time)
187 {
188 HILOG_DEBUG("time = [%{public}u]", time);
189 if (!datashare_) {
190 HILOG_ERROR("helper is nullptr");
191 return RET_ERR_NULLPTR;
192 }
193
194 auto ret = datashare_->PutIntValue(SHORTCUT_TIMEOUT, static_cast<int32_t>(time));
195 if (ret != RET_OK) {
196 HILOG_ERROR("set shortKeyTimeout_ failed");
197 return ret;
198 }
199 shortKeyTimeout_ = time;
200 return ret;
201 }
202
SetStartFromAtoHosState(const bool state)203 RetError AccessibilitySettingsConfig::SetStartFromAtoHosState(const bool state)
204 {
205 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
206 if (!datashare_) {
207 HILOG_ERROR("helper is nullptr");
208 return RET_ERR_NULLPTR;
209 }
210 return datashare_->PutBoolValue("AccessibilityStartFromAtoHos", state);
211 }
212
SetMouseKeyState(const bool state)213 RetError AccessibilitySettingsConfig::SetMouseKeyState(const bool state)
214 {
215 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
216 auto ret = SetConfigState(MOUSEKEY, state);
217 if (ret != RET_OK) {
218 HILOG_ERROR("set isMouseKeyState_ failed");
219 return ret;
220 }
221 isMouseKeyState_ = state;
222 return ret;
223 }
224
SetMouseAutoClick(const int32_t time)225 RetError AccessibilitySettingsConfig::SetMouseAutoClick(const int32_t time)
226 {
227 HILOG_DEBUG("time = [%{public}d]", time);
228 if (!datashare_) {
229 HILOG_ERROR("helper is nullptr");
230 return RET_ERR_NULLPTR;
231 }
232
233 auto ret = datashare_->PutIntValue("MouseAutoClick", time);
234 if (ret != RET_OK) {
235 HILOG_ERROR("set mouseAutoClick_ failed");
236 return ret;
237 }
238 mouseAutoClick_ = time;
239 return ret;
240 }
241
SetShortkeyTarget(const std::string &name)242 RetError AccessibilitySettingsConfig::SetShortkeyTarget(const std::string &name)
243 {
244 HILOG_DEBUG("name = [%{public}s]", name.c_str());
245 if (!datashare_) {
246 HILOG_ERROR("helper is nullptr");
247 return RET_ERR_NULLPTR;
248 }
249
250 auto ret = datashare_->PutStringValue("ShortkeyTarget", name);
251 if (ret != RET_OK) {
252 HILOG_ERROR("set shortkeyTarget_ failed");
253 return ret;
254 }
255 shortkeyTarget_ = name;
256 return ret;
257 }
258
SetShortkeyMultiTarget(const std::vector<std::string> &name)259 RetError AccessibilitySettingsConfig::SetShortkeyMultiTarget(const std::vector<std::string> &name)
260 {
261 HILOG_DEBUG();
262 std::set<std::string> targets;
263 std::copy_if(name.begin(), name.end(), std::inserter(targets, targets.end()),
264 [&targets](const std::string &target) {
265 targets.insert(target);
266 return true;
267 });
268 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
269 if (!datashare_) {
270 HILOG_ERROR("helper is nullptr");
271 return RET_ERR_NULLPTR;
272 }
273
274 std::string stringOut = "";
275 Utils::VectorToString(std::vector<std::string>(targets.begin(), targets.end()), stringOut);
276 auto ret = datashare_->PutStringValue(SHORTCUT_SERVICE, stringOut);
277 if (ret != RET_OK) {
278 HILOG_ERROR("set shortkeyMultiTarget_ failed");
279 return ret;
280 }
281 shortkeyMultiTarget_ = std::vector<std::string>(targets.begin(), targets.end());
282 return ret;
283 }
284
SetShortkeyMultiTargetInPkgRemove(const std::string &name)285 RetError AccessibilitySettingsConfig::SetShortkeyMultiTargetInPkgRemove(const std::string &name)
286 {
287 HILOG_DEBUG();
288 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
289 if (!datashare_) {
290 HILOG_ERROR("helper is nullptr");
291 return RET_ERR_NULLPTR;
292 }
293 RetError rtn = RET_OK;
294
295 for (auto iter = shortkeyMultiTarget_.begin(); iter != shortkeyMultiTarget_.end(); ++iter) {
296 if (*iter == name) {
297 shortkeyMultiTarget_.erase(iter);
298 std::string stringOut = "";
299 Utils::VectorToString(shortkeyMultiTarget_, stringOut);
300 rtn = datashare_->PutStringValue(SHORTCUT_SERVICE, stringOut);
301 break;
302 }
303 }
304 if (rtn != RET_OK) {
305 HILOG_ERROR("set shortkeyMultiTarget_ failed");
306 shortkeyMultiTarget_.push_back(name);
307 }
308 return rtn;
309 }
310
SetHighContrastTextState(const bool state)311 RetError AccessibilitySettingsConfig::SetHighContrastTextState(const bool state)
312 {
313 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
314 auto ret = SetConfigState(HIGH_CONTRAST_TEXT_KEY, state);
315 if (ret != RET_OK) {
316 HILOG_ERROR("set highContrastTextState_ failed");
317 return ret;
318 }
319 highContrastTextState_ = state;
320 return ret;
321 }
322
SetInvertColorState(const bool state)323 RetError AccessibilitySettingsConfig::SetInvertColorState(const bool state)
324 {
325 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
326 auto ret = SetConfigState(INVERT_COLOR_KEY, state);
327 if (ret != RET_OK) {
328 HILOG_ERROR("set invertColorState_ failed");
329 return ret;
330 }
331 invertColorState_ = state;
332 return ret;
333 }
334
SetAnimationOffState(const bool state)335 RetError AccessibilitySettingsConfig::SetAnimationOffState(const bool state)
336 {
337 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
338 auto ret = SetConfigState(ANIMATION_OFF_KEY, state);
339 if (ret != RET_OK) {
340 HILOG_ERROR("set animationOffState_ failed");
341 return ret;
342 }
343 animationOffState_ = state;
344 return ret;
345 }
346
SetAudioMonoState(const bool state)347 RetError AccessibilitySettingsConfig::SetAudioMonoState(const bool state)
348 {
349 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
350 auto ret = SetConfigState(AUDIO_MONO_KEY, state);
351 if (ret != RET_OK) {
352 HILOG_ERROR("set audioMonoState_ failed");
353 return ret;
354 }
355 audioMonoState_ = state;
356 return ret;
357 }
358
SetDaltonizationState(const bool state)359 RetError AccessibilitySettingsConfig::SetDaltonizationState(const bool state)
360 {
361 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
362 auto ret = SetConfigState(DALTONIZATION_STATE, state);
363 if (ret != RET_OK) {
364 HILOG_ERROR("set daltonizationState_ failed");
365 return ret;
366 }
367 daltonizationState_ = state;
368 return ret;
369 }
370
SetDaltonizationColorFilter(const uint32_t filter)371 RetError AccessibilitySettingsConfig::SetDaltonizationColorFilter(const uint32_t filter)
372 {
373 HILOG_DEBUG("filter = [%{public}u]", filter);
374 if (!datashare_) {
375 HILOG_ERROR("helper is nullptr");
376 return RET_ERR_NULLPTR;
377 }
378
379 uint32_t daltonizationColorFilter = filter;
380 if (filter == DISPLAY_DALTONIZER_GREEN) {
381 daltonizationColorFilter = AccessibilityConfig::Deuteranomaly;
382 } else if (filter == DISPLAY_DALTONIZER_RED) {
383 daltonizationColorFilter = AccessibilityConfig::Protanomaly;
384 } else if (filter == DISPLAY_DALTONIZER_BLUE) {
385 daltonizationColorFilter = AccessibilityConfig::Tritanomaly;
386 }
387 auto ret = datashare_->PutIntValue(DALTONIZATION_COLOR_FILTER_KEY, static_cast<int32_t>(daltonizationColorFilter));
388 if (ret != RET_OK) {
389 HILOG_ERROR("set daltonizationColorFilter_ failed");
390 return ret;
391 }
392 daltonizationColorFilter_ = daltonizationColorFilter;
393 return ret;
394 }
395
396
SetContentTimeout(const uint32_t time)397 RetError AccessibilitySettingsConfig::SetContentTimeout(const uint32_t time)
398 {
399 HILOG_DEBUG("time = [%{public}u]", time);
400 if (!datashare_) {
401 HILOG_ERROR("helper is nullptr");
402 return RET_ERR_NULLPTR;
403 }
404
405 auto ret = datashare_->PutIntValue(CONTENT_TIMEOUT_KEY, static_cast<int32_t>(time));
406 if (ret != RET_OK) {
407 HILOG_ERROR("set contentTimeout_ failed");
408 return ret;
409 }
410 contentTimeout_ = time;
411 return ret;
412 }
413
SetBrightnessDiscount(const float discount)414 RetError AccessibilitySettingsConfig::SetBrightnessDiscount(const float discount)
415 {
416 HILOG_DEBUG("discount = [%{public}f]", discount);
417 if (!datashare_) {
418 HILOG_ERROR("helper is nullptr");
419 return RET_ERR_NULLPTR;
420 }
421
422 auto ret = datashare_->PutFloatValue(BRIGHTNESS_DISCOUNT_KEY, discount);
423 if (ret != RET_OK) {
424 HILOG_ERROR("set brightnessDiscount_ failed");
425 return ret;
426 }
427 brightnessDiscount_ = discount;
428 return ret;
429 }
430
SetAudioBalance(const float balance)431 RetError AccessibilitySettingsConfig::SetAudioBalance(const float balance)
432 {
433 HILOG_DEBUG("balance = [%{public}f]", balance);
434 if (!datashare_) {
435 HILOG_ERROR("helper is nullptr");
436 return RET_ERR_NULLPTR;
437 }
438
439 float audioBalance = round(balance * AUDIO_BALANCE_STEP) / AUDIO_BALANCE_STEP;
440 auto ret = datashare_->PutFloatValue(AUDIO_BALANCE_KEY, audioBalance);
441 if (ret != RET_OK) {
442 HILOG_ERROR("set audioBalance_ failed");
443 return ret;
444 }
445 audioBalance_ = audioBalance;
446 return ret;
447 }
448
SetClickResponseTime(const uint32_t time)449 RetError AccessibilitySettingsConfig::SetClickResponseTime(const uint32_t time)
450 {
451 HILOG_DEBUG("clickResponseTime = [%{public}u]", time);
452 if (!datashare_) {
453 HILOG_ERROR("helper is nullptr");
454 return RET_ERR_NULLPTR;
455 }
456
457 uint32_t clickResponseTime = time;
458 if (time == DOUBLE_CLICK_RESPONSE_TIME_MEDIUM) {
459 clickResponseTime = AccessibilityConfig::ResponseDelayMedium;
460 } else if (time > DOUBLE_CLICK_RESPONSE_TIME_MEDIUM) {
461 clickResponseTime = AccessibilityConfig::ResponseDelayLong;
462 }
463 auto ret = datashare_->PutIntValue(CLICK_RESPONCE_TIME, clickResponseTime);
464 if (ret != RET_OK) {
465 HILOG_ERROR("set clickResponseTime_ failed");
466 return ret;
467 }
468 clickResponseTime_ = clickResponseTime;
469 return ret;
470 }
471
SetIgnoreRepeatClickState(const bool state)472 RetError AccessibilitySettingsConfig::SetIgnoreRepeatClickState(const bool state)
473 {
474 HILOG_DEBUG("state = [%{public}s]", state ? "True" : "False");
475 auto ret = SetConfigState(IGNORE_REPEAT_CLICK_SWITCH, state);
476 if (ret != RET_OK) {
477 HILOG_ERROR("set ignoreRepeatClickState_ failed");
478 return ret;
479 }
480 ignoreRepeatClickState_ = state;
481 return ret;
482 }
483
SetIgnoreRepeatClickTime(const uint32_t time)484 RetError AccessibilitySettingsConfig::SetIgnoreRepeatClickTime(const uint32_t time)
485 {
486 HILOG_DEBUG("ignoreRepeatClickTime = [%{public}u]", time);
487 if (!datashare_) {
488 HILOG_ERROR("helper is nullptr");
489 return RET_ERR_NULLPTR;
490 }
491
492 uint32_t ignoreRepeatClickTime = time;
493 if (time == DOUBLE_IGNORE_REPEAT_CLICK_TIME_SHORT) {
494 ignoreRepeatClickTime = AccessibilityConfig::RepeatClickTimeoutShort;
495 } else if (time == DOUBLE_IGNORE_REPEAT_CLICK_TIME_MEDIUM) {
496 ignoreRepeatClickTime = AccessibilityConfig::RepeatClickTimeoutMedium;
497 } else if (time == DOUBLE_IGNORE_REPEAT_CLICK_TIME_LONG) {
498 ignoreRepeatClickTime = AccessibilityConfig::RepeatClickTimeoutLong;
499 } else if (time > DOUBLE_IGNORE_REPEAT_CLICK_TIME_LONG) {
500 ignoreRepeatClickTime = AccessibilityConfig::RepeatClickTimeoutLongest;
501 }
502 auto ret = datashare_->PutIntValue(IGNORE_REPEAT_CLICK_TIME, ignoreRepeatClickTime);
503 if (ret != RET_OK) {
504 HILOG_ERROR("set ignoreRepeatClickTime_ failed");
505 return ret;
506 }
507 ignoreRepeatClickTime_ = ignoreRepeatClickTime;
508 return ret;
509 }
510
SetCaptionProperty(const AccessibilityConfig::CaptionProperty& caption)511 RetError AccessibilitySettingsConfig::SetCaptionProperty(const AccessibilityConfig::CaptionProperty& caption)
512 {
513 HILOG_DEBUG();
514 captionProperty_ = caption;
515 if (!datashare_) {
516 return RET_ERR_NULLPTR;
517 }
518
519 datashare_->PutStringValue(FONT_FAMILY, captionProperty_.GetFontFamily());
520 datashare_->PutIntValue(FONT_COLOR, static_cast<int32_t>(captionProperty_.GetFontColor()));
521 datashare_->PutStringValue(FONT_EDGE_TYPE, captionProperty_.GetFontEdgeType());
522 datashare_->PutIntValue(BACKGROUND_COLOR, static_cast<int32_t>(captionProperty_.GetBackgroundColor()));
523 datashare_->PutIntValue(WINDOW_COLOR, static_cast<int32_t>(captionProperty_.GetWindowColor()));
524 datashare_->PutIntValue(FONT_SCALE, captionProperty_.GetFontScale());
525 return RET_OK;
526 }
527
GetCaptionState() const528 bool AccessibilitySettingsConfig::GetCaptionState() const
529 {
530 return isCaptionState_;
531 }
532
GetScreenMagnificationState() const533 bool AccessibilitySettingsConfig::GetScreenMagnificationState() const
534 {
535 return isScreenMagnificationState_;
536 }
537
GetShortKeyState() const538 bool AccessibilitySettingsConfig::GetShortKeyState() const
539 {
540 return isShortKeyState_;
541 }
542
GetShortKeyOnLockScreenState() const543 bool AccessibilitySettingsConfig::GetShortKeyOnLockScreenState() const
544 {
545 return isShortKeyEnabledOnLockScreen_;
546 }
547
GetShortKeyTimeout() const548 int32_t AccessibilitySettingsConfig::GetShortKeyTimeout() const
549 {
550 return shortKeyTimeout_;
551 }
552
GetMouseKeyState() const553 bool AccessibilitySettingsConfig::GetMouseKeyState() const
554 {
555 return isMouseKeyState_;
556 }
557
GetMouseAutoClick() const558 int32_t AccessibilitySettingsConfig::GetMouseAutoClick() const
559 {
560 return mouseAutoClick_;
561 }
562
GetShortkeyTarget() const563 const std::string &AccessibilitySettingsConfig::GetShortkeyTarget() const
564 {
565 return shortkeyTarget_;
566 }
567
GetShortkeyMultiTarget()568 const std::vector<std::string> AccessibilitySettingsConfig::GetShortkeyMultiTarget()
569 {
570 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
571 std::vector<std::string> rtnVec = shortkeyMultiTarget_;
572 return rtnVec;
573 }
574
GetHighContrastTextState() const575 bool AccessibilitySettingsConfig::GetHighContrastTextState() const
576 {
577 return highContrastTextState_;
578 }
579
GetInvertColorState() const580 bool AccessibilitySettingsConfig::GetInvertColorState() const
581 {
582 return invertColorState_;
583 }
584
GetAnimationOffState() const585 bool AccessibilitySettingsConfig::GetAnimationOffState() const
586 {
587 return animationOffState_;
588 }
589
GetAudioMonoState() const590 bool AccessibilitySettingsConfig::GetAudioMonoState() const
591 {
592 return audioMonoState_;
593 }
594
GetDaltonizationState() const595 bool AccessibilitySettingsConfig::GetDaltonizationState() const
596 {
597 return daltonizationState_;
598 }
599
GetDaltonizationColorFilter() const600 uint32_t AccessibilitySettingsConfig::GetDaltonizationColorFilter() const
601 {
602 return daltonizationColorFilter_;
603 }
604
GetContentTimeout() const605 uint32_t AccessibilitySettingsConfig::GetContentTimeout() const
606 {
607 return contentTimeout_;
608 }
609
GetBrightnessDiscount() const610 float AccessibilitySettingsConfig::GetBrightnessDiscount() const
611 {
612 return brightnessDiscount_;
613 }
614
GetAudioBalance() const615 float AccessibilitySettingsConfig::GetAudioBalance() const
616 {
617 return audioBalance_;
618 }
619
GetEnabledState() const620 bool AccessibilitySettingsConfig::GetEnabledState() const
621 {
622 return enabled_;
623 }
624
GetTouchGuideState() const625 bool AccessibilitySettingsConfig::GetTouchGuideState() const
626 {
627 return eventTouchGuideState_;
628 }
629
GetGestureState() const630 bool AccessibilitySettingsConfig::GetGestureState() const
631 {
632 return gesturesSimulation_;
633 }
634
GetKeyEventObserverState() const635 bool AccessibilitySettingsConfig::GetKeyEventObserverState() const
636 {
637 return filteringKeyEvents_;
638 }
639
GetCaptionProperty() const640 const AccessibilityConfig::CaptionProperty &AccessibilitySettingsConfig::GetCaptionProperty() const
641 {
642 return captionProperty_;
643 };
644
GetClickResponseTime() const645 uint32_t AccessibilitySettingsConfig::GetClickResponseTime() const
646 {
647 return clickResponseTime_;
648 }
649
GetScreenMagnificationType() const650 uint32_t AccessibilitySettingsConfig::GetScreenMagnificationType() const
651 {
652 return screenMagnificationType_;
653 }
654
GetIgnoreRepeatClickState() const655 bool AccessibilitySettingsConfig::GetIgnoreRepeatClickState() const
656 {
657 return ignoreRepeatClickState_;
658 }
659
GetIgnoreRepeatClickTime() const660 uint32_t AccessibilitySettingsConfig::GetIgnoreRepeatClickTime() const
661 {
662 return ignoreRepeatClickTime_;
663 }
664
SetEnabledAccessibilityServices(const std::vector<std::string> &services)665 RetError AccessibilitySettingsConfig::SetEnabledAccessibilityServices(const std::vector<std::string> &services)
666 {
667 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
668 enabledAccessibilityServices_ = services;
669 if (datashare_ == nullptr) {
670 HILOG_WARN("datashare_ is null.");
671 return RET_ERR_NULLPTR;
672 }
673 std::string stringOut = "";
674 Utils::VectorToString(enabledAccessibilityServices_, stringOut);
675 return datashare_->PutStringValue(ENABLED_ACCESSIBILITY_SERVICES, stringOut);
676 }
677
GetEnabledAccessibilityServices()678 const std::vector<std::string> AccessibilitySettingsConfig::GetEnabledAccessibilityServices()
679 {
680 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
681 std::vector<std::string> rtnVec = enabledAccessibilityServices_;
682 return rtnVec;
683 }
684
AddEnabledAccessibilityService(const std::string &serviceName)685 RetError AccessibilitySettingsConfig::AddEnabledAccessibilityService(const std::string &serviceName)
686 {
687 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
688 auto iter = std::find(enabledAccessibilityServices_.begin(), enabledAccessibilityServices_.end(), serviceName);
689 if (iter != enabledAccessibilityServices_.end()) {
690 return RET_OK;
691 }
692
693 if (!datashare_) {
694 return RET_ERR_NULLPTR;
695 }
696 enabledAccessibilityServices_.push_back(serviceName);
697 std::string stringOut = "";
698 Utils::VectorToString(enabledAccessibilityServices_, stringOut);
699 return datashare_->PutStringValue(ENABLED_ACCESSIBILITY_SERVICES, stringOut);
700 }
701
RemoveEnabledAccessibilityService(const std::string &serviceName)702 RetError AccessibilitySettingsConfig::RemoveEnabledAccessibilityService(const std::string &serviceName)
703 {
704 std::lock_guard<ffrt::mutex> lock(interfaceMutex_);
705 auto iter = std::find(enabledAccessibilityServices_.begin(), enabledAccessibilityServices_.end(), serviceName);
706 if (iter == enabledAccessibilityServices_.end()) {
707 return RET_OK;
708 }
709
710 if (!datashare_) {
711 return RET_ERR_NULLPTR;
712 }
713 enabledAccessibilityServices_.erase(iter);
714 std::string stringOut = "";
715 Utils::VectorToString(enabledAccessibilityServices_, stringOut);
716 return datashare_->PutStringValue(ENABLED_ACCESSIBILITY_SERVICES, stringOut);
717 }
718
GetStartFromAtoHosState()719 bool AccessibilitySettingsConfig::GetStartFromAtoHosState()
720 {
721 HILOG_DEBUG();
722 if (!datashare_) {
723 return RET_ERR_NULLPTR;
724 }
725
726 bool value = true;
727 value = datashare_->GetBoolValue("AccessibilityStartFromAtoHos", true);
728 return value;
729 }
730
GetConfigState()731 uint32_t AccessibilitySettingsConfig::GetConfigState()
732 {
733 HILOG_DEBUG();
734 uint32_t state = 0;
735 if (isCaptionState_) {
736 state |= STATE_CAPTION_ENABLED;
737 }
738
739 if (isScreenMagnificationState_) {
740 state |= STATE_SCREENMAGNIFIER_ENABLED;
741 }
742
743 if (isMouseKeyState_) {
744 state |= STATE_MOUSEKEY_ENABLED;
745 }
746
747 if (isShortKeyState_) {
748 state |= STATE_SHORTKEY_ENABLED;
749 }
750
751 if (highContrastTextState_) {
752 state |= STATE_HIGHCONTRAST_ENABLED;
753 }
754
755 if (daltonizationState_) {
756 state |= STATE_DALTONIZATION_STATE_ENABLED;
757 }
758
759 if (invertColorState_) {
760 state |= STATE_INVETRTCOLOR_ENABLED;
761 }
762
763 if (animationOffState_) {
764 state |= STATE_ANIMATIONOFF_ENABLED;
765 }
766
767 if (audioMonoState_) {
768 state |= STATE_AUDIOMONO_ENABLED;
769 }
770
771 if (ignoreRepeatClickState_) {
772 state |= STATE_IGNORE_REPEAT_CLICK_ENABLED;
773 }
774 return state;
775 }
776
InitCaption()777 void AccessibilitySettingsConfig::InitCaption()
778 {
779 HILOG_DEBUG();
780 if (datashare_ == nullptr) {
781 return;
782 }
783
784 std::string strValue = datashare_->GetStringValue(CAPTION_KEY, "");
785 HILOG_DEBUG(" pref_->GetString() = %{public}s.", strValue.c_str());
786 if (!std::strcmp(strValue.c_str(), "on")) {
787 isCaptionState_ = true;
788 } else {
789 isCaptionState_ = false;
790 }
791
792 std::string fontFamliy = datashare_->GetStringValue(FONT_FAMILY, "default");
793 HILOG_DEBUG("fontFamily = %{public}s.", fontFamliy.c_str());
794
795 int32_t fontScale = static_cast<int32_t>(datashare_->GetIntValue(FONT_SCALE, DEFAULT_SCALE));
796 HILOG_DEBUG("fontScale = %{public}d.", fontScale);
797
798 uint32_t fontColor = static_cast<uint32_t>(datashare_->GetIntValue(FONT_COLOR, DEFAULT_COLOR));
799 HILOG_DEBUG("fontColor = 0x%{public}x.", fontColor);
800
801 std::string fontEdgeType = datashare_->GetStringValue(FONT_EDGE_TYPE, "none");
802 HILOG_DEBUG("fontEdgeType = 0x%{public}s.", fontEdgeType.c_str());
803
804 uint32_t backgroundColor = static_cast<uint32_t>(datashare_->GetIntValue(BACKGROUND_COLOR, DEFAULT_COLOR));
805 HILOG_DEBUG("backgroundColor = 0x%{public}x.", backgroundColor);
806
807 uint32_t windowColor = static_cast<uint32_t>(datashare_->GetIntValue(WINDOW_COLOR, DEFAULT_COLOR));
808 HILOG_DEBUG("windowColor = 0x%{public}x.", windowColor);
809
810 captionProperty_.SetFontFamily(fontFamliy);
811 captionProperty_.SetFontScale(fontScale);
812 captionProperty_.SetFontColor(fontColor);
813 captionProperty_.SetFontEdgeType(fontEdgeType);
814 captionProperty_.SetBackgroundColor(backgroundColor);
815 captionProperty_.SetWindowColor(windowColor);
816 }
817
InitShortKeyConfig()818 void AccessibilitySettingsConfig::InitShortKeyConfig()
819 {
820 isShortKeyState_ = datashare_->GetBoolValue(SHORTCUT_ENABLED, true);
821 int isShortKeyEnabledOnLockScreen = datashare_->GetIntValue(SHORTCUT_ENABLED_ON_LOCK_SCREEN,
822 INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
823 int isShortKeyOnLockScreen = datashare_->GetIntValue(SHORTCUT_ON_LOCK_SCREEN,
824 INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
825 shortKeyTimeout_ = static_cast<int32_t>(datashare_->GetIntValue(SHORTCUT_TIMEOUT, SHORT_KEY_TIMEOUT_BEFORE_USE));
826 bool shortKeyOnLockScreenAutoOn = false;
827
828 if (shortKeyTimeout_ == 1) {
829 SetShortKeyTimeout(SHORT_KEY_TIMEOUT_AFTER_USE);
830 if (isShortKeyOnLockScreen == INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
831 shortKeyOnLockScreenAutoOn = true;
832 SetShortKeyOnLockScreenState(true);
833 }
834 } else if (shortKeyTimeout_ == 0) {
835 SetShortKeyTimeout(SHORT_KEY_TIMEOUT_BEFORE_USE);
836 }
837
838 if (isShortKeyOnLockScreen != INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE) {
839 SetShortKeyOnLockScreenState(isShortKeyOnLockScreen == 1);
840 } else if (!shortKeyOnLockScreenAutoOn) {
841 SetShortKeyOnLockScreenState(isShortKeyEnabledOnLockScreen == 1);
842 }
843
844 auto ret = datashare_->PutIntValue(SHORTCUT_ON_LOCK_SCREEN, INVALID_SHORTCUT_ON_LOCK_SCREEN_STATE);
845 if (ret != RET_OK) {
846 HILOG_ERROR("reset shortcut on lock screen failed");
847 }
848 }
849
InitSetting()850 void AccessibilitySettingsConfig::InitSetting()
851 {
852 HILOG_DEBUG();
853 if (datashare_ == nullptr) {
854 return;
855 }
856
857 InitShortKeyConfig();
858 CloneAudioState();
859 isScreenMagnificationState_ = datashare_->GetBoolValue(SCREEN_MAGNIFICATION_KEY, false);
860 isMouseKeyState_= datashare_->GetBoolValue(MOUSEKEY, false);
861 animationOffState_ = datashare_->GetBoolValue(ANIMATION_OFF_KEY, false);
862 invertColorState_ = datashare_->GetBoolValue(INVERT_COLOR_KEY, false);
863 highContrastTextState_ = datashare_->GetBoolValue(HIGH_CONTRAST_TEXT_KEY, false);
864 daltonizationState_ = datashare_->GetBoolValue(DALTONIZATION_STATE, false);
865 audioMonoState_ = datashare_->GetBoolValue(AUDIO_MONO_KEY, false);
866 ignoreRepeatClickState_ = datashare_->GetBoolValue(IGNORE_REPEAT_CLICK_SWITCH, false);
867
868 shortkeyTarget_ = datashare_->GetStringValue("ShortkeyTarget", "none");
869
870 std::string tmpString = datashare_->GetStringValue(SHORTCUT_SERVICE, SCREEN_READER_BUNDLE_ABILITY_NAME);
871 shortkeyMultiTarget_ = {};
872 Utils::StringToVector(tmpString, shortkeyMultiTarget_);
873
874 bool isScreenReaderEnabledOriginal =
875 (std::find(enabledAccessibilityServices_.begin(), enabledAccessibilityServices_.end(),
876 SCREEN_READER_BUNDLE_ABILITY_NAME) != enabledAccessibilityServices_.end());
877 tmpString = datashare_->GetStringValue(ENABLED_ACCESSIBILITY_SERVICES, "");
878 enabledAccessibilityServices_ = {};
879 Utils::StringToVector(tmpString, enabledAccessibilityServices_);
880 CloneShortkeyService(isScreenReaderEnabledOriginal);
881
882 mouseAutoClick_ = static_cast<int32_t>(datashare_->GetIntValue("MouseAutoClick", -1));
883 daltonizationColorFilter_ = static_cast<uint32_t>(datashare_->GetIntValue(DALTONIZATION_COLOR_FILTER_KEY, 0));
884 SetDaltonizationColorFilter(daltonizationColorFilter_);
885 contentTimeout_ = static_cast<uint32_t>(datashare_->GetIntValue(CONTENT_TIMEOUT_KEY, 0));
886 brightnessDiscount_ = static_cast<float>(datashare_->GetFloatValue(BRIGHTNESS_DISCOUNT_KEY, 1.0));
887 audioBalance_ = static_cast<float>(datashare_->GetFloatValue(AUDIO_BALANCE_KEY, 0));
888 SetAudioBalance(audioBalance_);
889 screenMagnificationType_ = static_cast<uint32_t>(datashare_->GetIntValue(SCREEN_MAGNIFICATION_TYPE, 0));
890 clickResponseTime_ = static_cast<uint32_t>(datashare_->GetIntValue(CLICK_RESPONCE_TIME, 0));
891 SetClickResponseTime(clickResponseTime_);
892 ignoreRepeatClickTime_ = static_cast<uint32_t>(datashare_->GetIntValue(IGNORE_REPEAT_CLICK_TIME, 0));
893 SetIgnoreRepeatClickTime(ignoreRepeatClickTime_);
894 }
895
InitCapability()896 void AccessibilitySettingsConfig::InitCapability()
897 {
898 HILOG_DEBUG();
899 if (datashare_ == nullptr) {
900 return;
901 }
902
903 enabled_ = datashare_->GetBoolValue(ACCESSIBILITY, false);
904 eventTouchGuideState_ = datashare_->GetBoolValue(TOUCH_GUIDE_STATE, false);
905 gesturesSimulation_ = datashare_->GetBoolValue(GESTURE_KEY, false);
906 filteringKeyEvents_ = datashare_->GetBoolValue(KEYEVENT_OBSERVER, false);
907 }
908
SetConfigState(const std::string& key, bool value)909 RetError AccessibilitySettingsConfig::SetConfigState(const std::string& key, bool value)
910 {
911 if (!datashare_) {
912 return RET_ERR_NULLPTR;
913 }
914 return datashare_->PutBoolValue(key, value);
915 }
916
Init()917 void AccessibilitySettingsConfig::Init()
918 {
919 HILOG_DEBUG();
920 datashare_ = std::make_shared<AccessibilityDatashareHelper>(DATASHARE_TYPE::SECURE, accountId_);
921 if (datashare_ == nullptr) {
922 return;
923 }
924 datashare_->Initialize(POWER_MANAGER_SERVICE_ID);
925 InitCaption();
926 InitSetting();
927
928 systemDatashare_ = std::make_shared<AccessibilityDatashareHelper>(DATASHARE_TYPE::SYSTEM, accountId_);
929 if (systemDatashare_ == nullptr) {
930 return;
931 }
932 systemDatashare_->Initialize(POWER_MANAGER_SERVICE_ID);
933 }
934
ClearData()935 void AccessibilitySettingsConfig::ClearData()
936 {
937 HILOG_DEBUG();
938 }
939
CloneAudioState()940 void AccessibilitySettingsConfig::CloneAudioState()
941 {
942 HILOG_DEBUG();
943 if (systemDatashare_ == nullptr) {
944 return;
945 }
946
947 RetError ret = RET_OK;
948 int32_t monoValue = static_cast<int32_t>(systemDatashare_->GetIntValue(AUDIO_MONO_KEY, INVALID_MASTER_MONO_VALUE));
949 if (monoValue != INVALID_MASTER_MONO_VALUE) {
950 SetAudioMonoState(monoValue == 1);
951 ret = systemDatashare_->PutIntValue(AUDIO_MONO_KEY, INVALID_MASTER_MONO_VALUE);
952 if (ret != RET_OK) {
953 HILOG_ERROR("reset monoValue in system table failed");
954 }
955 }
956
957 float audioBalance = static_cast<float>(systemDatashare_->GetFloatValue(AUDIO_BALANCE_KEY,
958 INVALID_MASTER_BALANCE_VALUE));
959 if (abs(audioBalance - INVALID_MASTER_BALANCE_VALUE) > EPS) {
960 SetAudioBalance(audioBalance);
961 ret = systemDatashare_->PutFloatValue(AUDIO_BALANCE_KEY, INVALID_MASTER_BALANCE_VALUE);
962 if (ret != RET_OK) {
963 HILOG_ERROR("reset audioBalance in system table failed");
964 }
965 }
966 }
967
GetShortKeyService(std::vector<std::string> &services)968 uint32_t AccessibilitySettingsConfig::GetShortKeyService(std::vector<std::string> &services)
969 {
970 uint32_t serviceFlag = 0;
971
972 auto screenReader = std::find_if(services.begin(), services.end(), [&](const std::string& service) {
973 return service.find(SCREENREADER_TAG) != std::string::npos;
974 });
975 serviceFlag = screenReader != services.end() ? STATE_EXPLORATION_ENABLED : serviceFlag;
976
977 auto invertColor = std::find_if(services.begin(), services.end(), [&](const std::string& service) {
978 return service.find(INVERT_COLOR_AOS_TAG) != std::string::npos ||
979 service.find(INVERT_COLOR_HMOS_TAG) != std::string::npos;
980 });
981 serviceFlag = invertColor != services.end() ? (serviceFlag | STATE_INVETRTCOLOR_ENABLED) : serviceFlag;
982
983 auto audioMono = std::find_if(services.begin(), services.end(), [&](const std::string& service) {
984 return service.find(AUDIO_MONO_HMOS_TAG) != std::string::npos;
985 });
986 serviceFlag = audioMono != services.end() ? (serviceFlag | STATE_AUDIOMONO_ENABLED) : serviceFlag;
987
988 auto highContrastText = std::find_if(services.begin(), services.end(), [&](const std::string& service) {
989 return service.find(HIGH_CONTRAST_TEXT_HMOS_TAG) != std::string::npos;
990 });
991 serviceFlag = highContrastText != services.end() ? (serviceFlag | STATE_HIGHCONTRAST_ENABLED) : serviceFlag;
992
993 return serviceFlag;
994 }
995
CloneShortkeyService(bool isScreenReaderEnabled)996 void AccessibilitySettingsConfig::CloneShortkeyService(bool isScreenReaderEnabled)
997 {
998 std::vector<std::string> tmpVec = GetShortkeyMultiTarget();
999 uint32_t shortkeyServiceFlag = GetShortKeyService(tmpVec);
1000 std::vector<std::string> shortkeyService;
1001 if (shortkeyServiceFlag & STATE_EXPLORATION_ENABLED) {
1002 shortkeyService.push_back(SCREEN_READER_BUNDLE_ABILITY_NAME);
1003 }
1004 if (shortkeyServiceFlag & STATE_INVETRTCOLOR_ENABLED) {
1005 shortkeyService.push_back(INVERT_COLOR_HMOS_TAG);
1006 }
1007 if (shortkeyServiceFlag & STATE_AUDIOMONO_ENABLED) {
1008 shortkeyService.push_back(AUDIO_MONO_HMOS_TAG);
1009 }
1010 if (shortkeyServiceFlag & STATE_HIGHCONTRAST_ENABLED) {
1011 shortkeyService.push_back(HIGH_CONTRAST_TEXT_HMOS_TAG);
1012 }
1013 SetShortkeyMultiTarget(shortkeyService);
1014
1015 tmpVec = GetEnabledAccessibilityServices();
1016 shortkeyServiceFlag = GetShortKeyService(tmpVec);
1017 std::vector<std::string> enabledShortkeyService;
1018 if ((shortkeyServiceFlag & STATE_EXPLORATION_ENABLED) || (isScreenReaderEnabled == true)) {
1019 enabledShortkeyService.push_back(SCREEN_READER_BUNDLE_ABILITY_NAME);
1020 }
1021 SetEnabledAccessibilityServices(enabledShortkeyService);
1022 }
1023
OnDataClone()1024 void AccessibilitySettingsConfig::OnDataClone()
1025 {
1026 HILOG_INFO();
1027 InitSetting();
1028
1029 std::shared_ptr<AccessibilitySettingProvider> service =
1030 AccessibilitySettingProvider::GetInstance(POWER_MANAGER_SERVICE_ID);
1031 if (service == nullptr) {
1032 HILOG_ERROR("service is nullptr");
1033 return;
1034 }
1035 bool isScreenReaderEnabled =
1036 (std::find(enabledAccessibilityServices_.begin(), enabledAccessibilityServices_.end(),
1037 SCREEN_READER_BUNDLE_ABILITY_NAME) != enabledAccessibilityServices_.end());
1038 if (isScreenReaderEnabled) {
1039 ErrCode ret = service->PutBoolValue(ACCESSIBILITY_SCREENREADER_ENABLED, true, true);
1040 HILOG_INFO("set screenReader state, ret = %{public}d", ret);
1041 }
1042 service->PutBoolValue(ACCESSIBILITY_CLONE_FLAG, false);
1043 }
1044 } // namespace Accessibility
1045 } // namespace OHOS