1885b47fbSopenharmony_ci/*
2885b47fbSopenharmony_ci * Copyright (C) 2022 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_config_impl.h"
17885b47fbSopenharmony_ci#include "hilog_wrapper.h"
18885b47fbSopenharmony_ci#include "if_system_ability_manager.h"
19885b47fbSopenharmony_ci#include "iservice_registry.h"
20885b47fbSopenharmony_ci#include "parameter.h"
21885b47fbSopenharmony_ci#include "system_ability_definition.h"
22885b47fbSopenharmony_ci
23885b47fbSopenharmony_cinamespace OHOS {
24885b47fbSopenharmony_cinamespace AccessibilityConfig {
25885b47fbSopenharmony_cinamespace {
26885b47fbSopenharmony_ci    const std::string SYSTEM_PARAMETER_AAMS_NAME = "accessibility.config.ready";
27885b47fbSopenharmony_ci    constexpr int32_t CONFIG_PARAMETER_VALUE_SIZE = 10;
28885b47fbSopenharmony_ci    constexpr int32_t SA_CONNECT_TIMEOUT = 500; // ms
29885b47fbSopenharmony_ci    constexpr uint32_t DISPLAY_DALTONIZER_GREEN = 12;
30885b47fbSopenharmony_ci    constexpr uint32_t DISPLAY_DALTONIZER_RED = 11;
31885b47fbSopenharmony_ci    constexpr uint32_t DISPLAY_DALTONIZER_BLUE = 13;
32885b47fbSopenharmony_ci}
33885b47fbSopenharmony_ci
34885b47fbSopenharmony_ciAccessibilityConfig::Impl::Impl()
35885b47fbSopenharmony_ci{}
36885b47fbSopenharmony_ci
37885b47fbSopenharmony_cibool AccessibilityConfig::Impl::InitializeContext()
38885b47fbSopenharmony_ci{
39885b47fbSopenharmony_ci    HILOG_DEBUG();
40885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
41885b47fbSopenharmony_ci    if (isInitialized_) {
42885b47fbSopenharmony_ci        HILOG_DEBUG("Context has initialized");
43885b47fbSopenharmony_ci        return true;
44885b47fbSopenharmony_ci    }
45885b47fbSopenharmony_ci    isInitialized_ = ConnectToService();
46885b47fbSopenharmony_ci    return isInitialized_;
47885b47fbSopenharmony_ci}
48885b47fbSopenharmony_ci
49885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnParameterChanged(const char *key, const char *value, void *context)
50885b47fbSopenharmony_ci{
51885b47fbSopenharmony_ci    if (key == nullptr || std::strcmp(key, SYSTEM_PARAMETER_AAMS_NAME.c_str())) {
52885b47fbSopenharmony_ci        return;
53885b47fbSopenharmony_ci    }
54885b47fbSopenharmony_ci    if (value == nullptr || std::strcmp(value, "true")) {
55885b47fbSopenharmony_ci        return;
56885b47fbSopenharmony_ci    }
57885b47fbSopenharmony_ci    if (context == nullptr) {
58885b47fbSopenharmony_ci        return;
59885b47fbSopenharmony_ci    }
60885b47fbSopenharmony_ci    Impl* implPtr = static_cast<Impl*>(context);
61885b47fbSopenharmony_ci    if (implPtr->ConnectToServiceAsync() == true) {
62885b47fbSopenharmony_ci        HILOG_INFO("ConnectToServiceAsync success.");
63885b47fbSopenharmony_ci    } else {
64885b47fbSopenharmony_ci        HILOG_ERROR("ConnectToServiceAsync failed.");
65885b47fbSopenharmony_ci    }
66885b47fbSopenharmony_ci}
67885b47fbSopenharmony_ci
68885b47fbSopenharmony_cibool AccessibilityConfig::Impl::ConnectToService()
69885b47fbSopenharmony_ci{
70885b47fbSopenharmony_ci    char value[CONFIG_PARAMETER_VALUE_SIZE] = "default";
71885b47fbSopenharmony_ci    int retSysParam = GetParameter(SYSTEM_PARAMETER_AAMS_NAME.c_str(), "false", value, CONFIG_PARAMETER_VALUE_SIZE);
72885b47fbSopenharmony_ci    if (retSysParam >= 0 && !std::strcmp(value, "true")) {
73885b47fbSopenharmony_ci        // Accessibility service is ready
74885b47fbSopenharmony_ci        if (!InitAccessibilityServiceProxy()) {
75885b47fbSopenharmony_ci            return false;
76885b47fbSopenharmony_ci        }
77885b47fbSopenharmony_ci
78885b47fbSopenharmony_ci        if (!RegisterToService()) {
79885b47fbSopenharmony_ci            return false;
80885b47fbSopenharmony_ci        }
81885b47fbSopenharmony_ci
82885b47fbSopenharmony_ci        InitConfigValues();
83885b47fbSopenharmony_ci    } else {
84885b47fbSopenharmony_ci        HILOG_DEBUG("Start watching accessibility service.");
85885b47fbSopenharmony_ci        retSysParam = WatchParameter(SYSTEM_PARAMETER_AAMS_NAME.c_str(), &OnParameterChanged, this);
86885b47fbSopenharmony_ci        if (retSysParam) {
87885b47fbSopenharmony_ci            HILOG_ERROR("Watch parameter failed, error = %{public}d", retSysParam);
88885b47fbSopenharmony_ci            return false;
89885b47fbSopenharmony_ci        }
90885b47fbSopenharmony_ci    }
91885b47fbSopenharmony_ci    return true;
92885b47fbSopenharmony_ci}
93885b47fbSopenharmony_ci
94885b47fbSopenharmony_cibool AccessibilityConfig::Impl::ConnectToServiceAsync()
95885b47fbSopenharmony_ci{
96885b47fbSopenharmony_ci    HILOG_DEBUG("ConnectToServiceAsync start.");
97885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
98885b47fbSopenharmony_ci    if (InitAccessibilityServiceProxy()) {
99885b47fbSopenharmony_ci        (void)RegisterToService();
100885b47fbSopenharmony_ci        InitConfigValues();
101885b47fbSopenharmony_ci        isInitialized_ = true;
102885b47fbSopenharmony_ci        return true;
103885b47fbSopenharmony_ci    } else {
104885b47fbSopenharmony_ci        HILOG_ERROR("ConnectToServiceAsync fail");
105885b47fbSopenharmony_ci        return false;
106885b47fbSopenharmony_ci    }
107885b47fbSopenharmony_ci}
108885b47fbSopenharmony_ci
109885b47fbSopenharmony_cibool AccessibilityConfig::Impl::InitAccessibilityServiceProxy()
110885b47fbSopenharmony_ci{
111885b47fbSopenharmony_ci    HILOG_DEBUG();
112885b47fbSopenharmony_ci    if (serviceProxy_ != nullptr) {
113885b47fbSopenharmony_ci        return true;
114885b47fbSopenharmony_ci    }
115885b47fbSopenharmony_ci    auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
116885b47fbSopenharmony_ci    if (samgr == nullptr) {
117885b47fbSopenharmony_ci        return false;
118885b47fbSopenharmony_ci    }
119885b47fbSopenharmony_ci    auto object = samgr->GetSystemAbility(ACCESSIBILITY_MANAGER_SERVICE_ID);
120885b47fbSopenharmony_ci    if (object != nullptr) {
121885b47fbSopenharmony_ci        if (deathRecipient_ == nullptr) {
122885b47fbSopenharmony_ci            deathRecipient_ = new(std::nothrow) DeathRecipient(*this);
123885b47fbSopenharmony_ci            if (deathRecipient_ == nullptr) {
124885b47fbSopenharmony_ci                HILOG_ERROR("create deathRecipient_ fail");
125885b47fbSopenharmony_ci                return false;
126885b47fbSopenharmony_ci            }
127885b47fbSopenharmony_ci        }
128885b47fbSopenharmony_ci
129885b47fbSopenharmony_ci        if (object->IsProxyObject() && !object->AddDeathRecipient(deathRecipient_)) {
130885b47fbSopenharmony_ci            HILOG_ERROR("Failed to add death recipient");
131885b47fbSopenharmony_ci            return false;
132885b47fbSopenharmony_ci        }
133885b47fbSopenharmony_ci
134885b47fbSopenharmony_ci        serviceProxy_ = iface_cast<Accessibility::IAccessibleAbilityManagerService>(object);
135885b47fbSopenharmony_ci        if (serviceProxy_ == nullptr) {
136885b47fbSopenharmony_ci            HILOG_ERROR("IAccessibleAbilityManagerService iface_cast failed");
137885b47fbSopenharmony_ci            return false;
138885b47fbSopenharmony_ci        }
139885b47fbSopenharmony_ci        HILOG_DEBUG("InitAccessibilityServiceProxy success");
140885b47fbSopenharmony_ci        return true;
141885b47fbSopenharmony_ci    }
142885b47fbSopenharmony_ci    return true;
143885b47fbSopenharmony_ci}
144885b47fbSopenharmony_ci
145885b47fbSopenharmony_cibool AccessibilityConfig::Impl::LoadAccessibilityService()
146885b47fbSopenharmony_ci{
147885b47fbSopenharmony_ci    std::unique_lock<ffrt::mutex> lock(conVarMutex_);
148885b47fbSopenharmony_ci    sptr<AccessibilityLoadCallback> loadCallback = new AccessibilityLoadCallback(this);
149885b47fbSopenharmony_ci    if (loadCallback == nullptr) {
150885b47fbSopenharmony_ci        return false;
151885b47fbSopenharmony_ci    }
152885b47fbSopenharmony_ci    auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
153885b47fbSopenharmony_ci    if (samgr == nullptr) {
154885b47fbSopenharmony_ci        return false;
155885b47fbSopenharmony_ci    }
156885b47fbSopenharmony_ci    int32_t ret = samgr->LoadSystemAbility(ACCESSIBILITY_MANAGER_SERVICE_ID, loadCallback);
157885b47fbSopenharmony_ci    if (ret != 0) {
158885b47fbSopenharmony_ci        return false;
159885b47fbSopenharmony_ci    }
160885b47fbSopenharmony_ci    auto waitStatus = proxyConVar_.wait_for(lock, std::chrono::milliseconds(SA_CONNECT_TIMEOUT),
161885b47fbSopenharmony_ci        [this]() { return serviceProxy_ != nullptr; });
162885b47fbSopenharmony_ci    if (!waitStatus) {
163885b47fbSopenharmony_ci        return false;
164885b47fbSopenharmony_ci    }
165885b47fbSopenharmony_ci    (void)RegisterToService();
166885b47fbSopenharmony_ci    InitConfigValues();
167885b47fbSopenharmony_ci    return true;
168885b47fbSopenharmony_ci}
169885b47fbSopenharmony_ci
170885b47fbSopenharmony_civoid AccessibilityConfig::Impl::LoadSystemAbilitySuccess(const sptr<IRemoteObject> &remoteObject)
171885b47fbSopenharmony_ci{
172885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(conVarMutex_);
173885b47fbSopenharmony_ci    char value[CONFIG_PARAMETER_VALUE_SIZE] = "default";
174885b47fbSopenharmony_ci    int retSysParam = GetParameter(SYSTEM_PARAMETER_AAMS_NAME.c_str(), "false", value, CONFIG_PARAMETER_VALUE_SIZE);
175885b47fbSopenharmony_ci    if (retSysParam >= 0 && !std::strcmp(value, "true")) {
176885b47fbSopenharmony_ci        do {
177885b47fbSopenharmony_ci            auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
178885b47fbSopenharmony_ci            if (samgr == nullptr) {
179885b47fbSopenharmony_ci                break;
180885b47fbSopenharmony_ci            }
181885b47fbSopenharmony_ci            auto object = samgr->GetSystemAbility(ACCESSIBILITY_MANAGER_SERVICE_ID);
182885b47fbSopenharmony_ci            if (object == nullptr) {
183885b47fbSopenharmony_ci                break;
184885b47fbSopenharmony_ci            }
185885b47fbSopenharmony_ci            deathRecipient_ = new(std::nothrow) DeathRecipient(*this);
186885b47fbSopenharmony_ci            if (deathRecipient_ == nullptr) {
187885b47fbSopenharmony_ci                break;
188885b47fbSopenharmony_ci            }
189885b47fbSopenharmony_ci            if (object->IsProxyObject()) {
190885b47fbSopenharmony_ci                object->AddDeathRecipient(deathRecipient_);
191885b47fbSopenharmony_ci            }
192885b47fbSopenharmony_ci            serviceProxy_ = iface_cast<Accessibility::IAccessibleAbilityManagerService>(object);
193885b47fbSopenharmony_ci        } while (0);
194885b47fbSopenharmony_ci    }
195885b47fbSopenharmony_ci    proxyConVar_.notify_one();
196885b47fbSopenharmony_ci}
197885b47fbSopenharmony_ci
198885b47fbSopenharmony_civoid AccessibilityConfig::Impl::LoadSystemAbilityFail()
199885b47fbSopenharmony_ci{
200885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(conVarMutex_);
201885b47fbSopenharmony_ci    HILOG_WARN("LoadSystemAbilityFail.");
202885b47fbSopenharmony_ci    proxyConVar_.notify_one();
203885b47fbSopenharmony_ci}
204885b47fbSopenharmony_ci
205885b47fbSopenharmony_cibool AccessibilityConfig::Impl::RegisterToService()
206885b47fbSopenharmony_ci{
207885b47fbSopenharmony_ci    if (serviceProxy_ == nullptr) {
208885b47fbSopenharmony_ci        HILOG_ERROR("Service is not connected");
209885b47fbSopenharmony_ci        return false;
210885b47fbSopenharmony_ci    }
211885b47fbSopenharmony_ci
212885b47fbSopenharmony_ci    if (captionObserver_ && enableAbilityListsObserver_ && configObserver_) {
213885b47fbSopenharmony_ci        HILOG_DEBUG("Observers is registered");
214885b47fbSopenharmony_ci        return true;
215885b47fbSopenharmony_ci    }
216885b47fbSopenharmony_ci
217885b47fbSopenharmony_ci    if (captionObserver_ == nullptr) {
218885b47fbSopenharmony_ci        captionObserver_ = new(std::nothrow) AccessibleAbilityManagerCaptionObserverImpl(*this);
219885b47fbSopenharmony_ci        if (captionObserver_ == nullptr) {
220885b47fbSopenharmony_ci            HILOG_ERROR("Create captionObserver_ failed.");
221885b47fbSopenharmony_ci            return false;
222885b47fbSopenharmony_ci        }
223885b47fbSopenharmony_ci        uint32_t ret = serviceProxy_->RegisterCaptionObserver(captionObserver_);
224885b47fbSopenharmony_ci        if (ret != 0) {
225885b47fbSopenharmony_ci            captionObserver_ = nullptr;
226885b47fbSopenharmony_ci            HILOG_ERROR("Register captionObserver failed.");
227885b47fbSopenharmony_ci            return false;
228885b47fbSopenharmony_ci        }
229885b47fbSopenharmony_ci    }
230885b47fbSopenharmony_ci
231885b47fbSopenharmony_ci    if (!enableAbilityListsObserver_) {
232885b47fbSopenharmony_ci        enableAbilityListsObserver_ = new(std::nothrow) AccessibilityEnableAbilityListsObserverImpl(*this);
233885b47fbSopenharmony_ci        if (enableAbilityListsObserver_ == nullptr) {
234885b47fbSopenharmony_ci            HILOG_ERROR("Create enableAbilityListsObserver_ failed.");
235885b47fbSopenharmony_ci            return false;
236885b47fbSopenharmony_ci        }
237885b47fbSopenharmony_ci        serviceProxy_->RegisterEnableAbilityListsObserver(enableAbilityListsObserver_);
238885b47fbSopenharmony_ci    }
239885b47fbSopenharmony_ci
240885b47fbSopenharmony_ci    if (!configObserver_) {
241885b47fbSopenharmony_ci        configObserver_ = new(std::nothrow) AccessibleAbilityManagerConfigObserverImpl(*this);
242885b47fbSopenharmony_ci        if (configObserver_ == nullptr) {
243885b47fbSopenharmony_ci            HILOG_ERROR("Create configObserver_ failed.");
244885b47fbSopenharmony_ci            return false;
245885b47fbSopenharmony_ci        }
246885b47fbSopenharmony_ci        uint32_t ret = serviceProxy_->RegisterConfigObserver(configObserver_);
247885b47fbSopenharmony_ci        if (ret != 0) {
248885b47fbSopenharmony_ci            configObserver_ = nullptr;
249885b47fbSopenharmony_ci            HILOG_ERROR("Register configObserver failed.");
250885b47fbSopenharmony_ci            return false;
251885b47fbSopenharmony_ci        }
252885b47fbSopenharmony_ci    }
253885b47fbSopenharmony_ci
254885b47fbSopenharmony_ci    HILOG_DEBUG("RegisterToService succeaddss");
255885b47fbSopenharmony_ci    return true;
256885b47fbSopenharmony_ci}
257885b47fbSopenharmony_ci
258885b47fbSopenharmony_cisptr<Accessibility::IAccessibleAbilityManagerService> AccessibilityConfig::Impl::GetServiceProxy()
259885b47fbSopenharmony_ci{
260885b47fbSopenharmony_ci    return serviceProxy_;
261885b47fbSopenharmony_ci}
262885b47fbSopenharmony_ci
263885b47fbSopenharmony_civoid AccessibilityConfig::Impl::ResetService(const wptr<IRemoteObject> &remote)
264885b47fbSopenharmony_ci{
265885b47fbSopenharmony_ci    HILOG_DEBUG();
266885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
267885b47fbSopenharmony_ci    if (serviceProxy_ != nullptr) {
268885b47fbSopenharmony_ci        sptr<IRemoteObject> object = serviceProxy_->AsObject();
269885b47fbSopenharmony_ci        if (object != nullptr && (remote == object)) {
270885b47fbSopenharmony_ci            object->RemoveDeathRecipient(deathRecipient_);
271885b47fbSopenharmony_ci            serviceProxy_ = nullptr;
272885b47fbSopenharmony_ci            captionObserver_ = nullptr;
273885b47fbSopenharmony_ci            enableAbilityListsObserver_ = nullptr;
274885b47fbSopenharmony_ci            configObserver_ = nullptr;
275885b47fbSopenharmony_ci            isInitialized_ = false;
276885b47fbSopenharmony_ci            HILOG_INFO("ResetService ok");
277885b47fbSopenharmony_ci        }
278885b47fbSopenharmony_ci    }
279885b47fbSopenharmony_ci}
280885b47fbSopenharmony_ci
281885b47fbSopenharmony_cibool AccessibilityConfig::Impl::CheckSaStatus()
282885b47fbSopenharmony_ci{
283885b47fbSopenharmony_ci    std::vector<int> dependentSa = {
284885b47fbSopenharmony_ci        ABILITY_MGR_SERVICE_ID,
285885b47fbSopenharmony_ci        BUNDLE_MGR_SERVICE_SYS_ABILITY_ID,
286885b47fbSopenharmony_ci        COMMON_EVENT_SERVICE_ID,
287885b47fbSopenharmony_ci        DISPLAY_MANAGER_SERVICE_SA_ID,
288885b47fbSopenharmony_ci        SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN,
289885b47fbSopenharmony_ci        WINDOW_MANAGER_SERVICE_ID
290885b47fbSopenharmony_ci    };
291885b47fbSopenharmony_ci    auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
292885b47fbSopenharmony_ci    if (samgr == nullptr) {
293885b47fbSopenharmony_ci        return false;
294885b47fbSopenharmony_ci    }
295885b47fbSopenharmony_ci
296885b47fbSopenharmony_ci    if (std::any_of(dependentSa.begin(), dependentSa.end(), [&](int saId) {
297885b47fbSopenharmony_ci        return samgr->CheckSystemAbility(saId) == nullptr;
298885b47fbSopenharmony_ci    })) {
299885b47fbSopenharmony_ci        return false;
300885b47fbSopenharmony_ci    }
301885b47fbSopenharmony_ci    return true;
302885b47fbSopenharmony_ci}
303885b47fbSopenharmony_ci
304885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::EnableAbility(const std::string &name, const uint32_t capabilities)
305885b47fbSopenharmony_ci{
306885b47fbSopenharmony_ci    HILOG_INFO("name = [%{private}s] capabilities = [%{private}u]", name.c_str(), capabilities);
307885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
308885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
309885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
310885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
311885b47fbSopenharmony_ci    }
312885b47fbSopenharmony_ci    return GetServiceProxy()->EnableAbility(name, capabilities);
313885b47fbSopenharmony_ci}
314885b47fbSopenharmony_ci
315885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::DisableAbility(const std::string &name)
316885b47fbSopenharmony_ci{
317885b47fbSopenharmony_ci    HILOG_INFO("name = [%{private}s]", name.c_str());
318885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
319885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
320885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
321885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
322885b47fbSopenharmony_ci    }
323885b47fbSopenharmony_ci    return GetServiceProxy()->DisableAbility(name);
324885b47fbSopenharmony_ci}
325885b47fbSopenharmony_ci
326885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetCaptionsState(bool &state)
327885b47fbSopenharmony_ci{
328885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
329885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
330885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
331885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
332885b47fbSopenharmony_ci    }
333885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetCaptionState(state);
334885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
335885b47fbSopenharmony_ci    return ret;
336885b47fbSopenharmony_ci}
337885b47fbSopenharmony_ci
338885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetCaptionsProperty(CaptionProperty &caption)
339885b47fbSopenharmony_ci{
340885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
341885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
342885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
343885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
344885b47fbSopenharmony_ci    }
345885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetCaptionProperty(caption);
346885b47fbSopenharmony_ci    HILOG_INFO();
347885b47fbSopenharmony_ci    return ret;
348885b47fbSopenharmony_ci}
349885b47fbSopenharmony_ci
350885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetCaptionsProperty(const CaptionProperty& caption)
351885b47fbSopenharmony_ci{
352885b47fbSopenharmony_ci    HILOG_INFO();
353885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
354885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
355885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
356885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
357885b47fbSopenharmony_ci    }
358885b47fbSopenharmony_ci    return GetServiceProxy()->SetCaptionProperty(caption);
359885b47fbSopenharmony_ci}
360885b47fbSopenharmony_ci
361885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetCaptionsState(const bool state)
362885b47fbSopenharmony_ci{
363885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
364885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
365885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
366885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
367885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
368885b47fbSopenharmony_ci    }
369885b47fbSopenharmony_ci    return GetServiceProxy()->SetCaptionState(state);
370885b47fbSopenharmony_ci}
371885b47fbSopenharmony_ci
372885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyCaptionStateChanged(
373885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
374885b47fbSopenharmony_ci{
375885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
376885b47fbSopenharmony_ci    for (auto &observer : observers) {
377885b47fbSopenharmony_ci        if (observer) {
378885b47fbSopenharmony_ci            ConfigValue configValue;
379885b47fbSopenharmony_ci            configValue.captionState = state;
380885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_CAPTION_STATE, configValue);
381885b47fbSopenharmony_ci        } else {
382885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
383885b47fbSopenharmony_ci        }
384885b47fbSopenharmony_ci    }
385885b47fbSopenharmony_ci}
386885b47fbSopenharmony_ci
387885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyCaptionChanged(
388885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const CaptionProperty &captionProperty)
389885b47fbSopenharmony_ci{
390885b47fbSopenharmony_ci    HILOG_INFO();
391885b47fbSopenharmony_ci    for (auto &observer : observers) {
392885b47fbSopenharmony_ci        if (observer) {
393885b47fbSopenharmony_ci            ConfigValue configValue;
394885b47fbSopenharmony_ci            configValue.captionStyle = captionProperty_;
395885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_CAPTION_STYLE, configValue);
396885b47fbSopenharmony_ci        } else {
397885b47fbSopenharmony_ci            HILOG_ERROR("end observers is null");
398885b47fbSopenharmony_ci        }
399885b47fbSopenharmony_ci    }
400885b47fbSopenharmony_ci}
401885b47fbSopenharmony_ci
402885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SubscribeConfigObserver(const CONFIG_ID id,
403885b47fbSopenharmony_ci    const std::shared_ptr<AccessibilityConfigObserver> &observer, const bool retFlag)
404885b47fbSopenharmony_ci{
405885b47fbSopenharmony_ci    HILOG_DEBUG("id = [%{public}d]", static_cast<int32_t>(id));
406885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
407885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
408885b47fbSopenharmony_ci        configObservers_.find(id);
409885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
410885b47fbSopenharmony_ci        it->second.push_back(observer);
411885b47fbSopenharmony_ci        HILOG_DEBUG("configObservers->second.size%{public}zu", it->second.size());
412885b47fbSopenharmony_ci    } else {
413885b47fbSopenharmony_ci        std::vector<std::shared_ptr<AccessibilityConfigObserver>> ob;
414885b47fbSopenharmony_ci        ob.push_back(observer);
415885b47fbSopenharmony_ci        configObservers_.insert(std::make_pair(id, ob));
416885b47fbSopenharmony_ci        HILOG_DEBUG("configObservers->second.size%{public}zu", ob.size());
417885b47fbSopenharmony_ci    }
418885b47fbSopenharmony_ci
419885b47fbSopenharmony_ci    if (retFlag && observer) {
420885b47fbSopenharmony_ci        NotifyImmediately(id, observer);
421885b47fbSopenharmony_ci    }
422885b47fbSopenharmony_ci    return Accessibility::RET_OK;
423885b47fbSopenharmony_ci}
424885b47fbSopenharmony_ci
425885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::UnsubscribeConfigObserver(const CONFIG_ID id,
426885b47fbSopenharmony_ci    const std::shared_ptr<AccessibilityConfigObserver> &observer)
427885b47fbSopenharmony_ci{
428885b47fbSopenharmony_ci    HILOG_INFO("id = [%{public}d]", static_cast<int32_t>(id));
429885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
430885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
431885b47fbSopenharmony_ci        configObservers_.find(id);
432885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
433885b47fbSopenharmony_ci        for (auto iter = it->second.begin(); iter != it->second.end(); iter++) {
434885b47fbSopenharmony_ci            if (*iter == observer) {
435885b47fbSopenharmony_ci                HILOG_DEBUG("erase observer");
436885b47fbSopenharmony_ci                it->second.erase(iter);
437885b47fbSopenharmony_ci                HILOG_DEBUG("observer's size is %{public}zu", it->second.size());
438885b47fbSopenharmony_ci                return Accessibility::RET_OK;
439885b47fbSopenharmony_ci            }
440885b47fbSopenharmony_ci        }
441885b47fbSopenharmony_ci    } else {
442885b47fbSopenharmony_ci        HILOG_DEBUG("%{public}d has not subscribed ", id);
443885b47fbSopenharmony_ci    }
444885b47fbSopenharmony_ci    return Accessibility::RET_OK;
445885b47fbSopenharmony_ci}
446885b47fbSopenharmony_ci
447885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerCaptionPropertyChanged(const CaptionProperty& property)
448885b47fbSopenharmony_ci{
449885b47fbSopenharmony_ci    HILOG_DEBUG();
450885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
451885b47fbSopenharmony_ci    {
452885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
453885b47fbSopenharmony_ci        if (captionProperty_.GetFontScale() == property.GetFontScale() &&
454885b47fbSopenharmony_ci            captionProperty_.GetFontColor() == property.GetFontColor() &&
455885b47fbSopenharmony_ci            !strcmp(captionProperty_.GetFontFamily().c_str(), property.GetFontFamily().c_str()) &&
456885b47fbSopenharmony_ci            !strcmp(captionProperty_.GetFontEdgeType().c_str(), property.GetFontEdgeType().c_str()) &&
457885b47fbSopenharmony_ci            captionProperty_.GetBackgroundColor() == property.GetBackgroundColor() &&
458885b47fbSopenharmony_ci            captionProperty_.GetWindowColor() == property.GetWindowColor()) {
459885b47fbSopenharmony_ci            return;
460885b47fbSopenharmony_ci        }
461885b47fbSopenharmony_ci        captionProperty_ = property;
462885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
463885b47fbSopenharmony_ci            configObservers_.find(CONFIG_CAPTION_STYLE);
464885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
465885b47fbSopenharmony_ci            return;
466885b47fbSopenharmony_ci        }
467885b47fbSopenharmony_ci        observers = it->second;
468885b47fbSopenharmony_ci    }
469885b47fbSopenharmony_ci
470885b47fbSopenharmony_ci    NotifyCaptionChanged(observers, property);
471885b47fbSopenharmony_ci}
472885b47fbSopenharmony_ci
473885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetScreenMagnificationState(const bool state)
474885b47fbSopenharmony_ci{
475885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
476885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
477885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
478885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
479885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
480885b47fbSopenharmony_ci    }
481885b47fbSopenharmony_ci    return GetServiceProxy()->SetScreenMagnificationState(state);
482885b47fbSopenharmony_ci}
483885b47fbSopenharmony_ci
484885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetShortKeyState(const bool state)
485885b47fbSopenharmony_ci{
486885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
487885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
488885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
489885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
490885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
491885b47fbSopenharmony_ci    }
492885b47fbSopenharmony_ci    return GetServiceProxy()->SetShortKeyState(state);
493885b47fbSopenharmony_ci}
494885b47fbSopenharmony_ci
495885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetMouseKeyState(const bool state)
496885b47fbSopenharmony_ci{
497885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
498885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
499885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
500885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
501885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
502885b47fbSopenharmony_ci    }
503885b47fbSopenharmony_ci    return GetServiceProxy()->SetMouseKeyState(state);
504885b47fbSopenharmony_ci}
505885b47fbSopenharmony_ci
506885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetScreenMagnificationState(bool &state)
507885b47fbSopenharmony_ci{
508885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
509885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
510885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
511885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
512885b47fbSopenharmony_ci    }
513885b47fbSopenharmony_ci
514885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetScreenMagnificationState(state);
515885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
516885b47fbSopenharmony_ci    return ret;
517885b47fbSopenharmony_ci}
518885b47fbSopenharmony_ci
519885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetShortKeyState(bool &state)
520885b47fbSopenharmony_ci{
521885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
522885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
523885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
524885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
525885b47fbSopenharmony_ci    }
526885b47fbSopenharmony_ci
527885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetShortKeyState(state);
528885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
529885b47fbSopenharmony_ci    return ret;
530885b47fbSopenharmony_ci}
531885b47fbSopenharmony_ci
532885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetMouseKeyState(bool &state)
533885b47fbSopenharmony_ci{
534885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
535885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
536885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
537885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
538885b47fbSopenharmony_ci    }
539885b47fbSopenharmony_ci
540885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetMouseKeyState(state);
541885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
542885b47fbSopenharmony_ci    return ret;
543885b47fbSopenharmony_ci}
544885b47fbSopenharmony_ci
545885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateCaptionEnabled(const bool enabled)
546885b47fbSopenharmony_ci{
547885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
548885b47fbSopenharmony_ci    {
549885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
550885b47fbSopenharmony_ci        if (captionState_ == enabled) {
551885b47fbSopenharmony_ci            return;
552885b47fbSopenharmony_ci        }
553885b47fbSopenharmony_ci        captionState_ = enabled;
554885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
555885b47fbSopenharmony_ci            configObservers_.find(CONFIG_CAPTION_STATE);
556885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
557885b47fbSopenharmony_ci            return;
558885b47fbSopenharmony_ci        }
559885b47fbSopenharmony_ci        observers = it->second;
560885b47fbSopenharmony_ci    }
561885b47fbSopenharmony_ci    NotifyCaptionStateChanged(observers, enabled);
562885b47fbSopenharmony_ci}
563885b47fbSopenharmony_ci
564885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateScreenMagnificationEnabled(const bool enabled)
565885b47fbSopenharmony_ci{
566885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
567885b47fbSopenharmony_ci    {
568885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
569885b47fbSopenharmony_ci        if (screenMagnifier_ == enabled) {
570885b47fbSopenharmony_ci            return;
571885b47fbSopenharmony_ci        }
572885b47fbSopenharmony_ci        screenMagnifier_ = enabled;
573885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
574885b47fbSopenharmony_ci            configObservers_.find(CONFIG_SCREEN_MAGNIFICATION);
575885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
576885b47fbSopenharmony_ci            return;
577885b47fbSopenharmony_ci        }
578885b47fbSopenharmony_ci        observers = it->second;
579885b47fbSopenharmony_ci    }
580885b47fbSopenharmony_ci    NotifyScreenMagnificationChanged(observers, enabled);
581885b47fbSopenharmony_ci}
582885b47fbSopenharmony_ci
583885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateShortKeyEnabled(const bool enabled)
584885b47fbSopenharmony_ci{
585885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
586885b47fbSopenharmony_ci    {
587885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
588885b47fbSopenharmony_ci        if (shortkey_ == enabled) {
589885b47fbSopenharmony_ci            return;
590885b47fbSopenharmony_ci        }
591885b47fbSopenharmony_ci        shortkey_ = enabled;
592885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
593885b47fbSopenharmony_ci            configObservers_.find(CONFIG_SHORT_KEY);
594885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
595885b47fbSopenharmony_ci            return;
596885b47fbSopenharmony_ci        }
597885b47fbSopenharmony_ci        observers = it->second;
598885b47fbSopenharmony_ci    }
599885b47fbSopenharmony_ci    NotifyShortKeyChanged(observers, enabled);
600885b47fbSopenharmony_ci}
601885b47fbSopenharmony_ci
602885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateMouseKeyEnabled(const bool enabled)
603885b47fbSopenharmony_ci{
604885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
605885b47fbSopenharmony_ci    {
606885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
607885b47fbSopenharmony_ci        if (mouseKey_ == enabled) {
608885b47fbSopenharmony_ci            return;
609885b47fbSopenharmony_ci        }
610885b47fbSopenharmony_ci        mouseKey_ = enabled;
611885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
612885b47fbSopenharmony_ci            configObservers_.find(CONFIG_MOUSE_KEY);
613885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
614885b47fbSopenharmony_ci            return;
615885b47fbSopenharmony_ci        }
616885b47fbSopenharmony_ci        observers = it->second;
617885b47fbSopenharmony_ci    }
618885b47fbSopenharmony_ci    NotifyMouseKeyChanged(observers, enabled);
619885b47fbSopenharmony_ci}
620885b47fbSopenharmony_ci
621885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateAudioMonoEnabled(const bool enabled)
622885b47fbSopenharmony_ci{
623885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
624885b47fbSopenharmony_ci    {
625885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
626885b47fbSopenharmony_ci        if (audioMono_ == enabled) {
627885b47fbSopenharmony_ci            return;
628885b47fbSopenharmony_ci        }
629885b47fbSopenharmony_ci        audioMono_ = enabled;
630885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
631885b47fbSopenharmony_ci            configObservers_.find(CONFIG_AUDIO_MONO);
632885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
633885b47fbSopenharmony_ci            return;
634885b47fbSopenharmony_ci        }
635885b47fbSopenharmony_ci        observers = it->second;
636885b47fbSopenharmony_ci    }
637885b47fbSopenharmony_ci    NotifyAudioMonoChanged(observers, enabled);
638885b47fbSopenharmony_ci}
639885b47fbSopenharmony_ci
640885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateAnimationOffEnabled(const bool enabled)
641885b47fbSopenharmony_ci{
642885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
643885b47fbSopenharmony_ci    {
644885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
645885b47fbSopenharmony_ci        if (animationOff_ == enabled) {
646885b47fbSopenharmony_ci            return;
647885b47fbSopenharmony_ci        }
648885b47fbSopenharmony_ci        animationOff_ = enabled;
649885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
650885b47fbSopenharmony_ci            configObservers_.find(CONFIG_ANIMATION_OFF);
651885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
652885b47fbSopenharmony_ci            return;
653885b47fbSopenharmony_ci        }
654885b47fbSopenharmony_ci        observers = it->second;
655885b47fbSopenharmony_ci    }
656885b47fbSopenharmony_ci
657885b47fbSopenharmony_ci    NotifyAnimationOffChanged(observers, enabled);
658885b47fbSopenharmony_ci}
659885b47fbSopenharmony_ci
660885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateInvertColorEnabled(const bool enabled)
661885b47fbSopenharmony_ci{
662885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
663885b47fbSopenharmony_ci    {
664885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
665885b47fbSopenharmony_ci        if (invertColor_ == enabled) {
666885b47fbSopenharmony_ci            return;
667885b47fbSopenharmony_ci        }
668885b47fbSopenharmony_ci        invertColor_ = enabled;
669885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
670885b47fbSopenharmony_ci            configObservers_.find(CONFIG_INVERT_COLOR);
671885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
672885b47fbSopenharmony_ci            return;
673885b47fbSopenharmony_ci        }
674885b47fbSopenharmony_ci        observers = it->second;
675885b47fbSopenharmony_ci    }
676885b47fbSopenharmony_ci    NotifyInvertColorChanged(observers, enabled);
677885b47fbSopenharmony_ci}
678885b47fbSopenharmony_ci
679885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateHighContrastTextEnabled(const bool enabled)
680885b47fbSopenharmony_ci{
681885b47fbSopenharmony_ci    HILOG_INFO("enabled = [%{public}s]", enabled ? "True" : "False");
682885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
683885b47fbSopenharmony_ci    {
684885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
685885b47fbSopenharmony_ci        if (highContrastText_ == enabled) {
686885b47fbSopenharmony_ci            return;
687885b47fbSopenharmony_ci        }
688885b47fbSopenharmony_ci        highContrastText_ = enabled;
689885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
690885b47fbSopenharmony_ci            configObservers_.find(CONFIG_HIGH_CONTRAST_TEXT);
691885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
692885b47fbSopenharmony_ci            return;
693885b47fbSopenharmony_ci        }
694885b47fbSopenharmony_ci        observers = it->second;
695885b47fbSopenharmony_ci    }
696885b47fbSopenharmony_ci    NotifyHighContrastTextChanged(observers, enabled);
697885b47fbSopenharmony_ci}
698885b47fbSopenharmony_ci
699885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateDaltonizationStateEnabled(const bool enabled)
700885b47fbSopenharmony_ci{
701885b47fbSopenharmony_ci    HILOG_INFO("enabled = [%{public}s]", enabled ? "True" : "False");
702885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
703885b47fbSopenharmony_ci    {
704885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
705885b47fbSopenharmony_ci        if (daltonizationState_ == enabled) {
706885b47fbSopenharmony_ci            return;
707885b47fbSopenharmony_ci        }
708885b47fbSopenharmony_ci        daltonizationState_ = enabled;
709885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
710885b47fbSopenharmony_ci            configObservers_.find(CONFIG_DALTONIZATION_COLOR_FILTER);
711885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
712885b47fbSopenharmony_ci            return;
713885b47fbSopenharmony_ci        }
714885b47fbSopenharmony_ci        observers = it->second;
715885b47fbSopenharmony_ci    }
716885b47fbSopenharmony_ci    NotifyDaltonizationStateChanged(observers, enabled);
717885b47fbSopenharmony_ci    if (!enabled) {
718885b47fbSopenharmony_ci        HILOG_DEBUG();
719885b47fbSopenharmony_ci        NotifyDaltonizationColorFilterChanged(observers, Normal);
720885b47fbSopenharmony_ci    } else {
721885b47fbSopenharmony_ci        HILOG_DEBUG();
722885b47fbSopenharmony_ci        NotifyDaltonizationColorFilterChanged(observers, daltonizationColorFilter_);
723885b47fbSopenharmony_ci    }
724885b47fbSopenharmony_ci}
725885b47fbSopenharmony_ci
726885b47fbSopenharmony_civoid AccessibilityConfig::Impl::UpdateIgnoreRepeatClickStateEnabled(const bool enabled)
727885b47fbSopenharmony_ci{
728885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
729885b47fbSopenharmony_ci    {
730885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
731885b47fbSopenharmony_ci        if (ignoreRepeatClickState_ == enabled) {
732885b47fbSopenharmony_ci            return;
733885b47fbSopenharmony_ci        }
734885b47fbSopenharmony_ci        ignoreRepeatClickState_ = enabled;
735885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
736885b47fbSopenharmony_ci            configObservers_.find(CONFIG_IGNORE_REPEAT_CLICK_STATE);
737885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
738885b47fbSopenharmony_ci            return;
739885b47fbSopenharmony_ci        }
740885b47fbSopenharmony_ci        observers = it->second;
741885b47fbSopenharmony_ci    }
742885b47fbSopenharmony_ci    NotifyIgnoreRepeatClickStateChanged(observers, enabled);
743885b47fbSopenharmony_ci}
744885b47fbSopenharmony_ci
745885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyScreenMagnificationChanged(
746885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
747885b47fbSopenharmony_ci{
748885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
749885b47fbSopenharmony_ci    for (auto &observer : observers) {
750885b47fbSopenharmony_ci        if (observer) {
751885b47fbSopenharmony_ci            ConfigValue configValue;
752885b47fbSopenharmony_ci            configValue.screenMagnifier = state;
753885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_SCREEN_MAGNIFICATION, configValue);
754885b47fbSopenharmony_ci        } else {
755885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
756885b47fbSopenharmony_ci        }
757885b47fbSopenharmony_ci    }
758885b47fbSopenharmony_ci}
759885b47fbSopenharmony_ci
760885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyShortKeyChanged(
761885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
762885b47fbSopenharmony_ci{
763885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
764885b47fbSopenharmony_ci    for (auto &observer : observers) {
765885b47fbSopenharmony_ci        if (observer) {
766885b47fbSopenharmony_ci            ConfigValue configValue;
767885b47fbSopenharmony_ci            configValue.shortkey = state;
768885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_SHORT_KEY, configValue);
769885b47fbSopenharmony_ci        } else {
770885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
771885b47fbSopenharmony_ci        }
772885b47fbSopenharmony_ci    }
773885b47fbSopenharmony_ci}
774885b47fbSopenharmony_ci
775885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyMouseKeyChanged(
776885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
777885b47fbSopenharmony_ci{
778885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
779885b47fbSopenharmony_ci    for (auto &observer : observers) {
780885b47fbSopenharmony_ci        if (observer) {
781885b47fbSopenharmony_ci            ConfigValue configValue;
782885b47fbSopenharmony_ci            configValue.mouseKey = state;
783885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_MOUSE_KEY, configValue);
784885b47fbSopenharmony_ci        } else {
785885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
786885b47fbSopenharmony_ci        }
787885b47fbSopenharmony_ci    }
788885b47fbSopenharmony_ci}
789885b47fbSopenharmony_ci
790885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyInvertColorChanged(
791885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
792885b47fbSopenharmony_ci{
793885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
794885b47fbSopenharmony_ci    for (auto &observer : observers) {
795885b47fbSopenharmony_ci        if (observer) {
796885b47fbSopenharmony_ci            ConfigValue configValue;
797885b47fbSopenharmony_ci            configValue.invertColor = state;
798885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_INVERT_COLOR, configValue);
799885b47fbSopenharmony_ci        } else {
800885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
801885b47fbSopenharmony_ci        }
802885b47fbSopenharmony_ci    }
803885b47fbSopenharmony_ci}
804885b47fbSopenharmony_ci
805885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyHighContrastTextChanged(
806885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
807885b47fbSopenharmony_ci{
808885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
809885b47fbSopenharmony_ci    for (auto &observer : observers) {
810885b47fbSopenharmony_ci        if (observer) {
811885b47fbSopenharmony_ci            ConfigValue configValue;
812885b47fbSopenharmony_ci            configValue.highContrastText = state;
813885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_HIGH_CONTRAST_TEXT, configValue);
814885b47fbSopenharmony_ci        } else {
815885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
816885b47fbSopenharmony_ci        }
817885b47fbSopenharmony_ci    }
818885b47fbSopenharmony_ci}
819885b47fbSopenharmony_ci
820885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDaltonizationStateChanged(
821885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
822885b47fbSopenharmony_ci{
823885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
824885b47fbSopenharmony_ci    for (auto &observer : observers) {
825885b47fbSopenharmony_ci        if (observer) {
826885b47fbSopenharmony_ci            ConfigValue configValue;
827885b47fbSopenharmony_ci            configValue.daltonizationState = state;
828885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_DALTONIZATION_STATE, configValue);
829885b47fbSopenharmony_ci        } else {
830885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
831885b47fbSopenharmony_ci        }
832885b47fbSopenharmony_ci    }
833885b47fbSopenharmony_ci}
834885b47fbSopenharmony_ci
835885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyAudioMonoChanged(
836885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
837885b47fbSopenharmony_ci{
838885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
839885b47fbSopenharmony_ci    for (auto &observer : observers) {
840885b47fbSopenharmony_ci        if (observer) {
841885b47fbSopenharmony_ci            ConfigValue configValue;
842885b47fbSopenharmony_ci            configValue.audioMono = state;
843885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_AUDIO_MONO, configValue);
844885b47fbSopenharmony_ci        } else {
845885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
846885b47fbSopenharmony_ci        }
847885b47fbSopenharmony_ci    }
848885b47fbSopenharmony_ci}
849885b47fbSopenharmony_ci
850885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyAnimationOffChanged(
851885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
852885b47fbSopenharmony_ci{
853885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
854885b47fbSopenharmony_ci    for (auto &observer : observers) {
855885b47fbSopenharmony_ci        if (observer) {
856885b47fbSopenharmony_ci            ConfigValue configValue;
857885b47fbSopenharmony_ci            configValue.animationOff = state;
858885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_ANIMATION_OFF, configValue);
859885b47fbSopenharmony_ci        } else {
860885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
861885b47fbSopenharmony_ci        }
862885b47fbSopenharmony_ci    }
863885b47fbSopenharmony_ci}
864885b47fbSopenharmony_ci
865885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetMouseAutoClick(const int32_t time)
866885b47fbSopenharmony_ci{
867885b47fbSopenharmony_ci    HILOG_INFO("time = [%{public}d]", time);
868885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
869885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
870885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
871885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
872885b47fbSopenharmony_ci    }
873885b47fbSopenharmony_ci    return GetServiceProxy()->SetMouseAutoClick(time);
874885b47fbSopenharmony_ci}
875885b47fbSopenharmony_ci
876885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetShortkeyTarget(const std::string& name)
877885b47fbSopenharmony_ci{
878885b47fbSopenharmony_ci    HILOG_INFO("name = [%{public}s]", name.c_str());
879885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
880885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
881885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
882885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
883885b47fbSopenharmony_ci    }
884885b47fbSopenharmony_ci    return GetServiceProxy()->SetShortkeyTarget(name);
885885b47fbSopenharmony_ci}
886885b47fbSopenharmony_ci
887885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetShortkeyMultiTarget(const std::vector<std::string>& name)
888885b47fbSopenharmony_ci{
889885b47fbSopenharmony_ci    HILOG_INFO("start");
890885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
891885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
892885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
893885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
894885b47fbSopenharmony_ci    }
895885b47fbSopenharmony_ci    return GetServiceProxy()->SetShortkeyMultiTarget(name);
896885b47fbSopenharmony_ci}
897885b47fbSopenharmony_ci
898885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetMouseAutoClick(int32_t &time)
899885b47fbSopenharmony_ci{
900885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
901885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
902885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
903885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
904885b47fbSopenharmony_ci    }
905885b47fbSopenharmony_ci
906885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetMouseAutoClick(time);
907885b47fbSopenharmony_ci    HILOG_INFO("time = [%{public}d]", time);
908885b47fbSopenharmony_ci    return ret;
909885b47fbSopenharmony_ci}
910885b47fbSopenharmony_ci
911885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetShortkeyTarget(std::string &name)
912885b47fbSopenharmony_ci{
913885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
914885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
915885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
916885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
917885b47fbSopenharmony_ci    }
918885b47fbSopenharmony_ci
919885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetShortkeyTarget(name);
920885b47fbSopenharmony_ci    HILOG_INFO("name = [%{public}s]", name.c_str());
921885b47fbSopenharmony_ci    return ret;
922885b47fbSopenharmony_ci}
923885b47fbSopenharmony_ci
924885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetShortkeyMultiTarget(std::vector<std::string> &name)
925885b47fbSopenharmony_ci{
926885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
927885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
928885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
929885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
930885b47fbSopenharmony_ci    }
931885b47fbSopenharmony_ci
932885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetShortkeyMultiTarget(name);
933885b47fbSopenharmony_ci    return ret;
934885b47fbSopenharmony_ci}
935885b47fbSopenharmony_ci
936885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyShortkeyTargetChanged(
937885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const std::string &shortkey_target)
938885b47fbSopenharmony_ci{
939885b47fbSopenharmony_ci    HILOG_INFO("shortkey_target = [%{public}s]", shortkey_target.c_str());
940885b47fbSopenharmony_ci    for (auto &observer : observers) {
941885b47fbSopenharmony_ci        if (observer) {
942885b47fbSopenharmony_ci            ConfigValue configValue;
943885b47fbSopenharmony_ci            configValue.shortkey_target = shortkeyTarget_;
944885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_SHORT_KEY_TARGET, configValue);
945885b47fbSopenharmony_ci        } else {
946885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
947885b47fbSopenharmony_ci        }
948885b47fbSopenharmony_ci    }
949885b47fbSopenharmony_ci}
950885b47fbSopenharmony_ci
951885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyShortkeyMultiTargetChanged(
952885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
953885b47fbSopenharmony_ci    const std::vector<std::string> &shortkeyMultiTarget)
954885b47fbSopenharmony_ci{
955885b47fbSopenharmony_ci    HILOG_DEBUG("start");
956885b47fbSopenharmony_ci    for (auto &observer : observers) {
957885b47fbSopenharmony_ci        if (observer) {
958885b47fbSopenharmony_ci            ConfigValue configValue;
959885b47fbSopenharmony_ci            configValue.shortkeyMultiTarget = shortkeyMultiTarget;
960885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_SHORT_KEY_MULTI_TARGET, configValue);
961885b47fbSopenharmony_ci        } else {
962885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
963885b47fbSopenharmony_ci        }
964885b47fbSopenharmony_ci    }
965885b47fbSopenharmony_ci}
966885b47fbSopenharmony_ci
967885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyMouseAutoClickChanged(
968885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const uint32_t mouseAutoClick)
969885b47fbSopenharmony_ci{
970885b47fbSopenharmony_ci    HILOG_INFO("mouseAutoClick = [%{public}u]", mouseAutoClick);
971885b47fbSopenharmony_ci    for (auto &observer : observers) {
972885b47fbSopenharmony_ci        if (observer) {
973885b47fbSopenharmony_ci            ConfigValue configValue;
974885b47fbSopenharmony_ci            configValue.mouseAutoClick = mouseAutoClick_;
975885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_MOUSE_AUTOCLICK, configValue);
976885b47fbSopenharmony_ci        } else {
977885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
978885b47fbSopenharmony_ci        }
979885b47fbSopenharmony_ci    }
980885b47fbSopenharmony_ci}
981885b47fbSopenharmony_ci
982885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyAudioBalanceChanged(
983885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const float audioBalance)
984885b47fbSopenharmony_ci{
985885b47fbSopenharmony_ci    HILOG_INFO("audioBalance = [%{public}f]", audioBalance);
986885b47fbSopenharmony_ci    for (auto &observer : observers) {
987885b47fbSopenharmony_ci        if (observer) {
988885b47fbSopenharmony_ci            ConfigValue configValue;
989885b47fbSopenharmony_ci            configValue.audioBalance = audioBalance;
990885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_AUDIO_BALANCE, configValue);
991885b47fbSopenharmony_ci        } else {
992885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
993885b47fbSopenharmony_ci        }
994885b47fbSopenharmony_ci    }
995885b47fbSopenharmony_ci}
996885b47fbSopenharmony_ci
997885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyBrightnessDiscountChanged(
998885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const float brightnessDiscount)
999885b47fbSopenharmony_ci{
1000885b47fbSopenharmony_ci    HILOG_INFO("brightnessDiscount = [%{public}f]", brightnessDiscount);
1001885b47fbSopenharmony_ci    for (auto &observer : observers) {
1002885b47fbSopenharmony_ci        if (observer) {
1003885b47fbSopenharmony_ci            ConfigValue configValue;
1004885b47fbSopenharmony_ci            configValue.brightnessDiscount = brightnessDiscount;
1005885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_BRIGHTNESS_DISCOUNT, configValue);
1006885b47fbSopenharmony_ci        } else {
1007885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
1008885b47fbSopenharmony_ci        }
1009885b47fbSopenharmony_ci    }
1010885b47fbSopenharmony_ci}
1011885b47fbSopenharmony_ci
1012885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyContentTimeoutChanged(
1013885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const uint32_t contentTimeout)
1014885b47fbSopenharmony_ci{
1015885b47fbSopenharmony_ci    HILOG_INFO("contentTimeout = [%{public}u]", contentTimeout);
1016885b47fbSopenharmony_ci    for (auto &observer : observers) {
1017885b47fbSopenharmony_ci        if (observer) {
1018885b47fbSopenharmony_ci            ConfigValue configValue;
1019885b47fbSopenharmony_ci            configValue.contentTimeout = contentTimeout;
1020885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_CONTENT_TIMEOUT, configValue);
1021885b47fbSopenharmony_ci        } else {
1022885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
1023885b47fbSopenharmony_ci        }
1024885b47fbSopenharmony_ci    }
1025885b47fbSopenharmony_ci}
1026885b47fbSopenharmony_ci
1027885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDaltonizationColorFilterChanged(
1028885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const uint32_t daltonizationColorFilter)
1029885b47fbSopenharmony_ci{
1030885b47fbSopenharmony_ci    HILOG_INFO("daltonizationColorFilter = [%{public}u], daltonizationState_ = [%{public}d]", daltonizationColorFilter,
1031885b47fbSopenharmony_ci        daltonizationState_);
1032885b47fbSopenharmony_ci    for (auto &observer : observers) {
1033885b47fbSopenharmony_ci        if (observer) {
1034885b47fbSopenharmony_ci            ConfigValue configValue;
1035885b47fbSopenharmony_ci            if (!daltonizationState_) {
1036885b47fbSopenharmony_ci                HILOG_DEBUG();
1037885b47fbSopenharmony_ci                configValue.daltonizationColorFilter = Normal;
1038885b47fbSopenharmony_ci                observer->OnConfigChanged(CONFIG_DALTONIZATION_COLOR_FILTER, configValue);
1039885b47fbSopenharmony_ci            } else {
1040885b47fbSopenharmony_ci                configValue.daltonizationColorFilter = static_cast<DALTONIZATION_TYPE>(daltonizationColorFilter);
1041885b47fbSopenharmony_ci                observer->OnConfigChanged(CONFIG_DALTONIZATION_COLOR_FILTER, configValue);
1042885b47fbSopenharmony_ci            }
1043885b47fbSopenharmony_ci        } else {
1044885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
1045885b47fbSopenharmony_ci        }
1046885b47fbSopenharmony_ci    }
1047885b47fbSopenharmony_ci}
1048885b47fbSopenharmony_ci
1049885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyClickResponseTimeChanged(
1050885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const uint32_t clickResponseTime)
1051885b47fbSopenharmony_ci{
1052885b47fbSopenharmony_ci    HILOG_INFO("daltonizationColorFilter = [%{public}u]", clickResponseTime);
1053885b47fbSopenharmony_ci    for (auto &observer : observers) {
1054885b47fbSopenharmony_ci        if (observer) {
1055885b47fbSopenharmony_ci            ConfigValue configValue;
1056885b47fbSopenharmony_ci            configValue.clickResponseTime = static_cast<CLICK_RESPONSE_TIME>(clickResponseTime);
1057885b47fbSopenharmony_ci            observer->OnConfigChanged(CONIFG_CLICK_RESPONSE_TIME, configValue);
1058885b47fbSopenharmony_ci        } else {
1059885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
1060885b47fbSopenharmony_ci        }
1061885b47fbSopenharmony_ci    }
1062885b47fbSopenharmony_ci}
1063885b47fbSopenharmony_ci
1064885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyIgnoreRepeatClickTimeChanged(
1065885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const uint32_t time)
1066885b47fbSopenharmony_ci{
1067885b47fbSopenharmony_ci    HILOG_INFO("daltonizationColorFilter = [%{public}u]", time);
1068885b47fbSopenharmony_ci    for (auto &observer : observers) {
1069885b47fbSopenharmony_ci        if (observer) {
1070885b47fbSopenharmony_ci            ConfigValue configValue;
1071885b47fbSopenharmony_ci            configValue.ignoreRepeatClickTime = static_cast<IGNORE_REPEAT_CLICK_TIME>(time);
1072885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_IGNORE_REPEAT_CLICK_TIME, configValue);
1073885b47fbSopenharmony_ci        } else {
1074885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
1075885b47fbSopenharmony_ci        }
1076885b47fbSopenharmony_ci    }
1077885b47fbSopenharmony_ci}
1078885b47fbSopenharmony_ci
1079885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyIgnoreRepeatClickStateChanged(
1080885b47fbSopenharmony_ci    const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers, const bool state)
1081885b47fbSopenharmony_ci{
1082885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1083885b47fbSopenharmony_ci    for (auto &observer : observers) {
1084885b47fbSopenharmony_ci        if (observer) {
1085885b47fbSopenharmony_ci            ConfigValue configValue;
1086885b47fbSopenharmony_ci            configValue.ignoreRepeatClickState = state;
1087885b47fbSopenharmony_ci            observer->OnConfigChanged(CONFIG_IGNORE_REPEAT_CLICK_STATE, configValue);
1088885b47fbSopenharmony_ci        } else {
1089885b47fbSopenharmony_ci            HILOG_ERROR("end configObservers_ is null");
1090885b47fbSopenharmony_ci        }
1091885b47fbSopenharmony_ci    }
1092885b47fbSopenharmony_ci}
1093885b47fbSopenharmony_ci
1094885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetHighContrastTextState(const bool state)
1095885b47fbSopenharmony_ci{
1096885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1097885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1098885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1099885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1100885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1101885b47fbSopenharmony_ci    }
1102885b47fbSopenharmony_ci    return GetServiceProxy()->SetHighContrastTextState(state);
1103885b47fbSopenharmony_ci}
1104885b47fbSopenharmony_ci
1105885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetInvertColorState(const bool state)
1106885b47fbSopenharmony_ci{
1107885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1108885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1109885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1110885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1111885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1112885b47fbSopenharmony_ci    }
1113885b47fbSopenharmony_ci    return GetServiceProxy()->SetInvertColorState(state);
1114885b47fbSopenharmony_ci}
1115885b47fbSopenharmony_ci
1116885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetDaltonizationState(const bool state)
1117885b47fbSopenharmony_ci{
1118885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1119885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1120885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1121885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1122885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1123885b47fbSopenharmony_ci    }
1124885b47fbSopenharmony_ci    return GetServiceProxy()->SetDaltonizationState(state);
1125885b47fbSopenharmony_ci}
1126885b47fbSopenharmony_ci
1127885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetDaltonizationColorFilter(const DALTONIZATION_TYPE type)
1128885b47fbSopenharmony_ci{
1129885b47fbSopenharmony_ci    HILOG_INFO("type = [%{public}u]", static_cast<uint32_t>(type));
1130885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1131885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1132885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1133885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1134885b47fbSopenharmony_ci    }
1135885b47fbSopenharmony_ci    return GetServiceProxy()->SetDaltonizationColorFilter(type);
1136885b47fbSopenharmony_ci}
1137885b47fbSopenharmony_ci
1138885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetContentTimeout(const uint32_t timer)
1139885b47fbSopenharmony_ci{
1140885b47fbSopenharmony_ci    HILOG_INFO("timer = [%{public}u]", timer);
1141885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1142885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1143885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1144885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1145885b47fbSopenharmony_ci    }
1146885b47fbSopenharmony_ci    return GetServiceProxy()->SetContentTimeout(timer);
1147885b47fbSopenharmony_ci}
1148885b47fbSopenharmony_ci
1149885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetAnimationOffState(const bool state)
1150885b47fbSopenharmony_ci{
1151885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1152885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1153885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1154885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1155885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1156885b47fbSopenharmony_ci    }
1157885b47fbSopenharmony_ci    return GetServiceProxy()->SetAnimationOffState(state);
1158885b47fbSopenharmony_ci}
1159885b47fbSopenharmony_ci
1160885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetBrightnessDiscount(const float brightness)
1161885b47fbSopenharmony_ci{
1162885b47fbSopenharmony_ci    HILOG_INFO("brightness = [%{public}f]", brightness);
1163885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1164885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1165885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1166885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1167885b47fbSopenharmony_ci    }
1168885b47fbSopenharmony_ci    return GetServiceProxy()->SetBrightnessDiscount(brightness);
1169885b47fbSopenharmony_ci}
1170885b47fbSopenharmony_ci
1171885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetAudioMonoState(const bool state)
1172885b47fbSopenharmony_ci{
1173885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1174885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1175885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1176885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1177885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1178885b47fbSopenharmony_ci    }
1179885b47fbSopenharmony_ci    return GetServiceProxy()->SetAudioMonoState(state);
1180885b47fbSopenharmony_ci}
1181885b47fbSopenharmony_ci
1182885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetAudioBalance(const float balance)
1183885b47fbSopenharmony_ci{
1184885b47fbSopenharmony_ci    HILOG_INFO("balance = [%{public}f]", balance);
1185885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1186885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1187885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1188885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1189885b47fbSopenharmony_ci    }
1190885b47fbSopenharmony_ci    return GetServiceProxy()->SetAudioBalance(balance);
1191885b47fbSopenharmony_ci}
1192885b47fbSopenharmony_ci
1193885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetClickResponseTime(const CLICK_RESPONSE_TIME time)
1194885b47fbSopenharmony_ci{
1195885b47fbSopenharmony_ci    HILOG_INFO("click response time = [%{public}u]", time);
1196885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1197885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1198885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1199885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1200885b47fbSopenharmony_ci    }
1201885b47fbSopenharmony_ci    return GetServiceProxy()->SetClickResponseTime(time);
1202885b47fbSopenharmony_ci}
1203885b47fbSopenharmony_ci
1204885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetIgnoreRepeatClickState(const bool state)
1205885b47fbSopenharmony_ci{
1206885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1207885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1208885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1209885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1210885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1211885b47fbSopenharmony_ci    }
1212885b47fbSopenharmony_ci    return GetServiceProxy()->SetIgnoreRepeatClickState(state);
1213885b47fbSopenharmony_ci}
1214885b47fbSopenharmony_ci
1215885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SetIgnoreRepeatClickTime(const IGNORE_REPEAT_CLICK_TIME time)
1216885b47fbSopenharmony_ci{
1217885b47fbSopenharmony_ci    HILOG_INFO("ignore repeat click time = [%{public}u]", time);
1218885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1219885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1220885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1221885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1222885b47fbSopenharmony_ci    }
1223885b47fbSopenharmony_ci    return GetServiceProxy()->SetIgnoreRepeatClickTime(time);
1224885b47fbSopenharmony_ci}
1225885b47fbSopenharmony_ci
1226885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetInvertColorState(bool &state)
1227885b47fbSopenharmony_ci{
1228885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1229885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1230885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1231885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1232885b47fbSopenharmony_ci    }
1233885b47fbSopenharmony_ci
1234885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetInvertColorState(state);
1235885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1236885b47fbSopenharmony_ci    return ret;
1237885b47fbSopenharmony_ci}
1238885b47fbSopenharmony_ci
1239885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetHighContrastTextState(bool &state)
1240885b47fbSopenharmony_ci{
1241885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1242885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1243885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1244885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1245885b47fbSopenharmony_ci    }
1246885b47fbSopenharmony_ci
1247885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetHighContrastTextState(state);
1248885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1249885b47fbSopenharmony_ci    return ret;
1250885b47fbSopenharmony_ci}
1251885b47fbSopenharmony_ci
1252885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetDaltonizationState(bool &state)
1253885b47fbSopenharmony_ci{
1254885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1255885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1256885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1257885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1258885b47fbSopenharmony_ci    }
1259885b47fbSopenharmony_ci
1260885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetDaltonizationState(state);
1261885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1262885b47fbSopenharmony_ci    return ret;
1263885b47fbSopenharmony_ci}
1264885b47fbSopenharmony_ci
1265885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetDaltonizationColorFilter(DALTONIZATION_TYPE &type)
1266885b47fbSopenharmony_ci{
1267885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1268885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1269885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1270885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1271885b47fbSopenharmony_ci    }
1272885b47fbSopenharmony_ci
1273885b47fbSopenharmony_ci    uint32_t filterType = 0;
1274885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetDaltonizationColorFilter(filterType);
1275885b47fbSopenharmony_ci    type = static_cast<DALTONIZATION_TYPE>(filterType);
1276885b47fbSopenharmony_ci    HILOG_INFO("type = [%{public}u]", static_cast<uint32_t>(type));
1277885b47fbSopenharmony_ci    return ret;
1278885b47fbSopenharmony_ci}
1279885b47fbSopenharmony_ci
1280885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetContentTimeout(uint32_t &timer)
1281885b47fbSopenharmony_ci{
1282885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1283885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1284885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1285885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1286885b47fbSopenharmony_ci    }
1287885b47fbSopenharmony_ci
1288885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetContentTimeout(timer);
1289885b47fbSopenharmony_ci    HILOG_INFO("timer = [%{public}u]", timer);
1290885b47fbSopenharmony_ci    return ret;
1291885b47fbSopenharmony_ci}
1292885b47fbSopenharmony_ci
1293885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetAnimationOffState(bool &state)
1294885b47fbSopenharmony_ci{
1295885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1296885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1297885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1298885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1299885b47fbSopenharmony_ci    }
1300885b47fbSopenharmony_ci
1301885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetAnimationOffState(state);
1302885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1303885b47fbSopenharmony_ci    return ret;
1304885b47fbSopenharmony_ci}
1305885b47fbSopenharmony_ci
1306885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetBrightnessDiscount(float &brightness)
1307885b47fbSopenharmony_ci{
1308885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1309885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1310885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1311885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1312885b47fbSopenharmony_ci    }
1313885b47fbSopenharmony_ci
1314885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetBrightnessDiscount(brightness);
1315885b47fbSopenharmony_ci    HILOG_INFO("brightness = [%{public}f]", brightness);
1316885b47fbSopenharmony_ci    return ret;
1317885b47fbSopenharmony_ci}
1318885b47fbSopenharmony_ci
1319885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetAudioMonoState(bool &state)
1320885b47fbSopenharmony_ci{
1321885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1322885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1323885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1324885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1325885b47fbSopenharmony_ci    }
1326885b47fbSopenharmony_ci
1327885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetAudioMonoState(state);
1328885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1329885b47fbSopenharmony_ci    return ret;
1330885b47fbSopenharmony_ci}
1331885b47fbSopenharmony_ci
1332885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetAudioBalance(float &balance)
1333885b47fbSopenharmony_ci{
1334885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1335885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1336885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1337885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1338885b47fbSopenharmony_ci    }
1339885b47fbSopenharmony_ci
1340885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetAudioBalance(balance);
1341885b47fbSopenharmony_ci    HILOG_INFO("balance = [%{public}f]", balance);
1342885b47fbSopenharmony_ci    return ret;
1343885b47fbSopenharmony_ci}
1344885b47fbSopenharmony_ci
1345885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetClickResponseTime(CLICK_RESPONSE_TIME &time)
1346885b47fbSopenharmony_ci{
1347885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1348885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1349885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1350885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1351885b47fbSopenharmony_ci    }
1352885b47fbSopenharmony_ci
1353885b47fbSopenharmony_ci    uint32_t responseTime = 0;
1354885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetClickResponseTime(responseTime);
1355885b47fbSopenharmony_ci    time = static_cast<CLICK_RESPONSE_TIME>(responseTime);
1356885b47fbSopenharmony_ci    HILOG_INFO("click response time = [%{public}u]", time);
1357885b47fbSopenharmony_ci    return ret;
1358885b47fbSopenharmony_ci}
1359885b47fbSopenharmony_ci
1360885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetIgnoreRepeatClickState(bool &state)
1361885b47fbSopenharmony_ci{
1362885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1363885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1364885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1365885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1366885b47fbSopenharmony_ci    }
1367885b47fbSopenharmony_ci
1368885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetIgnoreRepeatClickState(state);
1369885b47fbSopenharmony_ci    HILOG_INFO("state = [%{public}s]", state ? "True" : "False");
1370885b47fbSopenharmony_ci    return ret;
1371885b47fbSopenharmony_ci}
1372885b47fbSopenharmony_ci
1373885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::GetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_TIME &time)
1374885b47fbSopenharmony_ci{
1375885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1376885b47fbSopenharmony_ci    if (GetServiceProxy() == nullptr) {
1377885b47fbSopenharmony_ci        HILOG_ERROR("Failed to get accessibility service");
1378885b47fbSopenharmony_ci        return Accessibility::RET_ERR_SAMGR;
1379885b47fbSopenharmony_ci    }
1380885b47fbSopenharmony_ci
1381885b47fbSopenharmony_ci    uint32_t ignoreRepeatClickTime = 0;
1382885b47fbSopenharmony_ci    Accessibility::RetError ret = GetServiceProxy()->GetIgnoreRepeatClickTime(ignoreRepeatClickTime);
1383885b47fbSopenharmony_ci    time = static_cast<IGNORE_REPEAT_CLICK_TIME>(ignoreRepeatClickTime);
1384885b47fbSopenharmony_ci    HILOG_INFO("ignore repeat click time = [%{public}u]", time);
1385885b47fbSopenharmony_ci    return ret;
1386885b47fbSopenharmony_ci}
1387885b47fbSopenharmony_ci
1388885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::SubscribeEnableAbilityListsObserver(
1389885b47fbSopenharmony_ci    const std::shared_ptr<AccessibilityEnableAbilityListsObserver> &observer)
1390885b47fbSopenharmony_ci{
1391885b47fbSopenharmony_ci    HILOG_INFO();
1392885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1393885b47fbSopenharmony_ci    if (std::any_of(enableAbilityListsObservers_.begin(), enableAbilityListsObservers_.end(),
1394885b47fbSopenharmony_ci        [&observer](const std::shared_ptr<AccessibilityEnableAbilityListsObserver> &listObserver) {
1395885b47fbSopenharmony_ci            return listObserver == observer;
1396885b47fbSopenharmony_ci            })) {
1397885b47fbSopenharmony_ci        HILOG_ERROR("the observer is exist");
1398885b47fbSopenharmony_ci        return Accessibility::RET_OK;
1399885b47fbSopenharmony_ci    }
1400885b47fbSopenharmony_ci    enableAbilityListsObservers_.push_back(observer);
1401885b47fbSopenharmony_ci    HILOG_DEBUG("observer's size is %{public}zu", enableAbilityListsObservers_.size());
1402885b47fbSopenharmony_ci    return Accessibility::RET_OK;
1403885b47fbSopenharmony_ci}
1404885b47fbSopenharmony_ci
1405885b47fbSopenharmony_ciAccessibility::RetError AccessibilityConfig::Impl::UnsubscribeEnableAbilityListsObserver(
1406885b47fbSopenharmony_ci    const std::shared_ptr<AccessibilityEnableAbilityListsObserver> &observer)
1407885b47fbSopenharmony_ci{
1408885b47fbSopenharmony_ci    HILOG_INFO();
1409885b47fbSopenharmony_ci    std::lock_guard<ffrt::mutex> lock(mutex_);
1410885b47fbSopenharmony_ci    for (auto iter = enableAbilityListsObservers_.begin(); iter != enableAbilityListsObservers_.end(); iter++) {
1411885b47fbSopenharmony_ci        if (*iter == observer) {
1412885b47fbSopenharmony_ci            HILOG_DEBUG("erase observer");
1413885b47fbSopenharmony_ci            enableAbilityListsObservers_.erase(iter);
1414885b47fbSopenharmony_ci            HILOG_DEBUG("observer's size is %{public}zu", enableAbilityListsObservers_.size());
1415885b47fbSopenharmony_ci            return Accessibility::RET_OK;
1416885b47fbSopenharmony_ci        }
1417885b47fbSopenharmony_ci    }
1418885b47fbSopenharmony_ci    return Accessibility::RET_OK;
1419885b47fbSopenharmony_ci}
1420885b47fbSopenharmony_ci
1421885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibilityEnableAbilityListsChanged()
1422885b47fbSopenharmony_ci{
1423885b47fbSopenharmony_ci    HILOG_DEBUG("observer's size is %{public}zu", enableAbilityListsObservers_.size());
1424885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityEnableAbilityListsObserver>> observers;
1425885b47fbSopenharmony_ci    {
1426885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1427885b47fbSopenharmony_ci        observers = enableAbilityListsObservers_;
1428885b47fbSopenharmony_ci    }
1429885b47fbSopenharmony_ci    for (auto &enableAbilityListsObserver : observers) {
1430885b47fbSopenharmony_ci        enableAbilityListsObserver->OnEnableAbilityListsStateChanged();
1431885b47fbSopenharmony_ci    }
1432885b47fbSopenharmony_ci}
1433885b47fbSopenharmony_ci
1434885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibilityInstallAbilityListsChanged()
1435885b47fbSopenharmony_ci{
1436885b47fbSopenharmony_ci    HILOG_DEBUG("observer's size is %{public}zu", enableAbilityListsObservers_.size());
1437885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityEnableAbilityListsObserver>> observers;
1438885b47fbSopenharmony_ci    {
1439885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1440885b47fbSopenharmony_ci        observers = enableAbilityListsObservers_;
1441885b47fbSopenharmony_ci    }
1442885b47fbSopenharmony_ci    for (auto &enableAbilityListsObserver : observers) {
1443885b47fbSopenharmony_ci        if (enableAbilityListsObserver != nullptr) {
1444885b47fbSopenharmony_ci            enableAbilityListsObserver->OnInstallAbilityListsStateChanged();
1445885b47fbSopenharmony_ci        } else {
1446885b47fbSopenharmony_ci            HILOG_ERROR("enableAbilityListsObserver is null");
1447885b47fbSopenharmony_ci        }
1448885b47fbSopenharmony_ci    }
1449885b47fbSopenharmony_ci}
1450885b47fbSopenharmony_ci
1451885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnIgnoreRepeatClickStateChanged(const uint32_t stateType)
1452885b47fbSopenharmony_ci{
1453885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_IGNORE_REPEAT_CLICK_ENABLED) {
1454885b47fbSopenharmony_ci        UpdateIgnoreRepeatClickStateEnabled(true);
1455885b47fbSopenharmony_ci    } else {
1456885b47fbSopenharmony_ci        UpdateIgnoreRepeatClickStateEnabled(false);
1457885b47fbSopenharmony_ci    }
1458885b47fbSopenharmony_ci}
1459885b47fbSopenharmony_ci
1460885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerConfigStateChanged(const uint32_t stateType)
1461885b47fbSopenharmony_ci{
1462885b47fbSopenharmony_ci    HILOG_DEBUG("stateType = [%{public}u}", stateType);
1463885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_CAPTION_ENABLED) {
1464885b47fbSopenharmony_ci        UpdateCaptionEnabled(true);
1465885b47fbSopenharmony_ci    } else {
1466885b47fbSopenharmony_ci        UpdateCaptionEnabled(false);
1467885b47fbSopenharmony_ci    }
1468885b47fbSopenharmony_ci
1469885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_SCREENMAGNIFIER_ENABLED) {
1470885b47fbSopenharmony_ci        UpdateScreenMagnificationEnabled(true);
1471885b47fbSopenharmony_ci    } else {
1472885b47fbSopenharmony_ci        UpdateScreenMagnificationEnabled(false);
1473885b47fbSopenharmony_ci    }
1474885b47fbSopenharmony_ci
1475885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_SHORTKEY_ENABLED) {
1476885b47fbSopenharmony_ci        UpdateShortKeyEnabled(true);
1477885b47fbSopenharmony_ci    } else {
1478885b47fbSopenharmony_ci        UpdateShortKeyEnabled(false);
1479885b47fbSopenharmony_ci    }
1480885b47fbSopenharmony_ci
1481885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_AUDIOMONO_ENABLED) {
1482885b47fbSopenharmony_ci        UpdateAudioMonoEnabled(true);
1483885b47fbSopenharmony_ci    } else {
1484885b47fbSopenharmony_ci        UpdateAudioMonoEnabled(false);
1485885b47fbSopenharmony_ci    }
1486885b47fbSopenharmony_ci
1487885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_ANIMATIONOFF_ENABLED) {
1488885b47fbSopenharmony_ci        UpdateAnimationOffEnabled(true);
1489885b47fbSopenharmony_ci    } else {
1490885b47fbSopenharmony_ci        UpdateAnimationOffEnabled(false);
1491885b47fbSopenharmony_ci    }
1492885b47fbSopenharmony_ci
1493885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_INVETRTCOLOR_ENABLED) {
1494885b47fbSopenharmony_ci        UpdateInvertColorEnabled(true);
1495885b47fbSopenharmony_ci    } else {
1496885b47fbSopenharmony_ci        UpdateInvertColorEnabled(false);
1497885b47fbSopenharmony_ci    }
1498885b47fbSopenharmony_ci
1499885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_HIGHCONTRAST_ENABLED) {
1500885b47fbSopenharmony_ci        UpdateHighContrastTextEnabled(true);
1501885b47fbSopenharmony_ci    } else {
1502885b47fbSopenharmony_ci        UpdateHighContrastTextEnabled(false);
1503885b47fbSopenharmony_ci    }
1504885b47fbSopenharmony_ci
1505885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_DALTONIZATION_STATE_ENABLED) {
1506885b47fbSopenharmony_ci        UpdateDaltonizationStateEnabled(true);
1507885b47fbSopenharmony_ci    } else {
1508885b47fbSopenharmony_ci        UpdateDaltonizationStateEnabled(false);
1509885b47fbSopenharmony_ci    }
1510885b47fbSopenharmony_ci
1511885b47fbSopenharmony_ci    if (stateType & Accessibility::STATE_MOUSEKEY_ENABLED) {
1512885b47fbSopenharmony_ci        UpdateMouseKeyEnabled(true);
1513885b47fbSopenharmony_ci    } else {
1514885b47fbSopenharmony_ci        UpdateMouseKeyEnabled(false);
1515885b47fbSopenharmony_ci    }
1516885b47fbSopenharmony_ci
1517885b47fbSopenharmony_ci    OnIgnoreRepeatClickStateChanged(stateType);
1518885b47fbSopenharmony_ci}
1519885b47fbSopenharmony_ci
1520885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerAudioBalanceChanged(const float audioBalance)
1521885b47fbSopenharmony_ci{
1522885b47fbSopenharmony_ci    HILOG_DEBUG("audioBalance = [%{public}f}", audioBalance);
1523885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1524885b47fbSopenharmony_ci    {
1525885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1526885b47fbSopenharmony_ci        if (audioBalance_ == audioBalance) {
1527885b47fbSopenharmony_ci            return;
1528885b47fbSopenharmony_ci        }
1529885b47fbSopenharmony_ci        audioBalance_ = audioBalance;
1530885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1531885b47fbSopenharmony_ci            configObservers_.find(CONFIG_AUDIO_BALANCE);
1532885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1533885b47fbSopenharmony_ci            return;
1534885b47fbSopenharmony_ci        }
1535885b47fbSopenharmony_ci        observers = it->second;
1536885b47fbSopenharmony_ci    }
1537885b47fbSopenharmony_ci
1538885b47fbSopenharmony_ci    NotifyAudioBalanceChanged(observers, audioBalance);
1539885b47fbSopenharmony_ci}
1540885b47fbSopenharmony_ci
1541885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerBrightnessDiscountChanged(const float brightnessDiscount)
1542885b47fbSopenharmony_ci{
1543885b47fbSopenharmony_ci    HILOG_DEBUG("brightnessDiscount = [%{public}f}", brightnessDiscount);
1544885b47fbSopenharmony_ci
1545885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1546885b47fbSopenharmony_ci    {
1547885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1548885b47fbSopenharmony_ci        if (brightnessDiscount_ == brightnessDiscount) {
1549885b47fbSopenharmony_ci            return;
1550885b47fbSopenharmony_ci        }
1551885b47fbSopenharmony_ci        brightnessDiscount_ = brightnessDiscount;
1552885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1553885b47fbSopenharmony_ci            configObservers_.find(CONFIG_BRIGHTNESS_DISCOUNT);
1554885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1555885b47fbSopenharmony_ci            return;
1556885b47fbSopenharmony_ci        }
1557885b47fbSopenharmony_ci        observers = it->second;
1558885b47fbSopenharmony_ci    }
1559885b47fbSopenharmony_ci
1560885b47fbSopenharmony_ci    NotifyBrightnessDiscountChanged(observers, brightnessDiscount);
1561885b47fbSopenharmony_ci}
1562885b47fbSopenharmony_ci
1563885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerContentTimeoutChanged(const uint32_t contentTimeout)
1564885b47fbSopenharmony_ci{
1565885b47fbSopenharmony_ci    HILOG_DEBUG("contentTimeout = [%{public}u}", contentTimeout);
1566885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1567885b47fbSopenharmony_ci    {
1568885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1569885b47fbSopenharmony_ci        if (contentTimeout_ == contentTimeout) {
1570885b47fbSopenharmony_ci            return;
1571885b47fbSopenharmony_ci        }
1572885b47fbSopenharmony_ci        contentTimeout_ = contentTimeout;
1573885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1574885b47fbSopenharmony_ci            configObservers_.find(CONFIG_CONTENT_TIMEOUT);
1575885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1576885b47fbSopenharmony_ci            return;
1577885b47fbSopenharmony_ci        }
1578885b47fbSopenharmony_ci        observers = it->second;
1579885b47fbSopenharmony_ci    }
1580885b47fbSopenharmony_ci
1581885b47fbSopenharmony_ci    NotifyContentTimeoutChanged(observers, contentTimeout);
1582885b47fbSopenharmony_ci}
1583885b47fbSopenharmony_ci
1584885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerDaltonizationColorFilterChanged(const uint32_t filterType)
1585885b47fbSopenharmony_ci{
1586885b47fbSopenharmony_ci    HILOG_DEBUG("filterType = [%{public}u}", filterType);
1587885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1588885b47fbSopenharmony_ci    {
1589885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1590885b47fbSopenharmony_ci        if (daltonizationColorFilter_ == filterType) {
1591885b47fbSopenharmony_ci            HILOG_DEBUG("filterType[%{public}u]", daltonizationColorFilter_);
1592885b47fbSopenharmony_ci            return;
1593885b47fbSopenharmony_ci        }
1594885b47fbSopenharmony_ci        daltonizationColorFilter_ = InvertDaltonizationColorInAtoHos(filterType);
1595885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1596885b47fbSopenharmony_ci            configObservers_.find(CONFIG_DALTONIZATION_COLOR_FILTER);
1597885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1598885b47fbSopenharmony_ci            return;
1599885b47fbSopenharmony_ci        }
1600885b47fbSopenharmony_ci        observers = it->second;
1601885b47fbSopenharmony_ci    }
1602885b47fbSopenharmony_ci
1603885b47fbSopenharmony_ci    NotifyDaltonizationColorFilterChanged(observers, daltonizationColorFilter_);
1604885b47fbSopenharmony_ci}
1605885b47fbSopenharmony_ci
1606885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerMouseAutoClickChanged(const int32_t mouseAutoClick)
1607885b47fbSopenharmony_ci{
1608885b47fbSopenharmony_ci    HILOG_DEBUG("mouseAutoClick = [%{public}d}", mouseAutoClick);
1609885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1610885b47fbSopenharmony_ci    {
1611885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1612885b47fbSopenharmony_ci        if (mouseAutoClick_ == mouseAutoClick) {
1613885b47fbSopenharmony_ci            return;
1614885b47fbSopenharmony_ci        }
1615885b47fbSopenharmony_ci        mouseAutoClick_ = mouseAutoClick;
1616885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1617885b47fbSopenharmony_ci            configObservers_.find(CONFIG_MOUSE_AUTOCLICK);
1618885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1619885b47fbSopenharmony_ci            return;
1620885b47fbSopenharmony_ci        }
1621885b47fbSopenharmony_ci        observers = it->second;
1622885b47fbSopenharmony_ci    }
1623885b47fbSopenharmony_ci
1624885b47fbSopenharmony_ci    NotifyMouseAutoClickChanged(observers, mouseAutoClick);
1625885b47fbSopenharmony_ci}
1626885b47fbSopenharmony_ci
1627885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerShortkeyTargetChanged(const std::string &shortkeyTarget)
1628885b47fbSopenharmony_ci{
1629885b47fbSopenharmony_ci    HILOG_DEBUG("shortkeyTarget = [%{public}s}", shortkeyTarget.c_str());
1630885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1631885b47fbSopenharmony_ci    {
1632885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1633885b47fbSopenharmony_ci        if (shortkeyTarget_.length() > 0 && shortkeyTarget.length() > 0 &&
1634885b47fbSopenharmony_ci            !std::strcmp(shortkeyTarget_.c_str(), shortkeyTarget.c_str())) {
1635885b47fbSopenharmony_ci            return;
1636885b47fbSopenharmony_ci        }
1637885b47fbSopenharmony_ci        shortkeyTarget_ = shortkeyTarget;
1638885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1639885b47fbSopenharmony_ci            configObservers_.find(CONFIG_SHORT_KEY_TARGET);
1640885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1641885b47fbSopenharmony_ci            return;
1642885b47fbSopenharmony_ci        }
1643885b47fbSopenharmony_ci        observers = it->second;
1644885b47fbSopenharmony_ci    }
1645885b47fbSopenharmony_ci
1646885b47fbSopenharmony_ci    NotifyShortkeyTargetChanged(observers, shortkeyTarget);
1647885b47fbSopenharmony_ci}
1648885b47fbSopenharmony_ci
1649885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerShortkeyMultiTargetChanged(
1650885b47fbSopenharmony_ci    const std::vector<std::string> &shortkeyMultiTarget)
1651885b47fbSopenharmony_ci{
1652885b47fbSopenharmony_ci    HILOG_DEBUG("start");
1653885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1654885b47fbSopenharmony_ci    {
1655885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1656885b47fbSopenharmony_ci        // need to add, if no change, do not inform
1657885b47fbSopenharmony_ci        shortkeyMultiTarget_ = shortkeyMultiTarget;
1658885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1659885b47fbSopenharmony_ci            configObservers_.find(CONFIG_SHORT_KEY_MULTI_TARGET);
1660885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1661885b47fbSopenharmony_ci            HILOG_DEBUG("Cannot find CONFIG_SHORT_KEY_MULTI_TARGET configObserver.");
1662885b47fbSopenharmony_ci            return;
1663885b47fbSopenharmony_ci        }
1664885b47fbSopenharmony_ci        observers = it->second;
1665885b47fbSopenharmony_ci    }
1666885b47fbSopenharmony_ci
1667885b47fbSopenharmony_ci    NotifyShortkeyMultiTargetChanged(observers, shortkeyMultiTarget);
1668885b47fbSopenharmony_ci}
1669885b47fbSopenharmony_ci
1670885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerClickResponseTimeChanged(const uint32_t clickResponseTime)
1671885b47fbSopenharmony_ci{
1672885b47fbSopenharmony_ci    HILOG_DEBUG("clickResponseTime = [%{public}u}", clickResponseTime);
1673885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1674885b47fbSopenharmony_ci    {
1675885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1676885b47fbSopenharmony_ci        if (clickResponseTime_ == clickResponseTime) {
1677885b47fbSopenharmony_ci            return;
1678885b47fbSopenharmony_ci        }
1679885b47fbSopenharmony_ci        clickResponseTime_ = clickResponseTime;
1680885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1681885b47fbSopenharmony_ci            configObservers_.find(CONIFG_CLICK_RESPONSE_TIME);
1682885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1683885b47fbSopenharmony_ci            return;
1684885b47fbSopenharmony_ci        }
1685885b47fbSopenharmony_ci        observers = it->second;
1686885b47fbSopenharmony_ci    }
1687885b47fbSopenharmony_ci
1688885b47fbSopenharmony_ci    NotifyClickResponseTimeChanged(observers, clickResponseTime);
1689885b47fbSopenharmony_ci}
1690885b47fbSopenharmony_ci
1691885b47fbSopenharmony_civoid AccessibilityConfig::Impl::OnAccessibleAbilityManagerIgnoreRepeatClickTimeChanged(const uint32_t time)
1692885b47fbSopenharmony_ci{
1693885b47fbSopenharmony_ci    HILOG_DEBUG("ignoreRepeatClickTime = [%{public}u}", time);
1694885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityConfigObserver>> observers;
1695885b47fbSopenharmony_ci    {
1696885b47fbSopenharmony_ci        std::lock_guard<ffrt::mutex> lock(mutex_);
1697885b47fbSopenharmony_ci        if (ignoreRepeatClickTime_ == time) {
1698885b47fbSopenharmony_ci            return;
1699885b47fbSopenharmony_ci        }
1700885b47fbSopenharmony_ci        ignoreRepeatClickTime_ = time;
1701885b47fbSopenharmony_ci        std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1702885b47fbSopenharmony_ci            configObservers_.find(CONFIG_IGNORE_REPEAT_CLICK_TIME);
1703885b47fbSopenharmony_ci        if (it == configObservers_.end()) {
1704885b47fbSopenharmony_ci            return;
1705885b47fbSopenharmony_ci        }
1706885b47fbSopenharmony_ci        observers = it->second;
1707885b47fbSopenharmony_ci    }
1708885b47fbSopenharmony_ci
1709885b47fbSopenharmony_ci    NotifyIgnoreRepeatClickTimeChanged(observers, time);
1710885b47fbSopenharmony_ci}
1711885b47fbSopenharmony_ci
1712885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyImmediately(const CONFIG_ID id,
1713885b47fbSopenharmony_ci    const std::shared_ptr<AccessibilityConfigObserver> &observer)
1714885b47fbSopenharmony_ci{
1715885b47fbSopenharmony_ci    HILOG_DEBUG("NotifyImmediately start.");
1716885b47fbSopenharmony_ci    ConfigValue configValue;
1717885b47fbSopenharmony_ci    {
1718885b47fbSopenharmony_ci        configValue.highContrastText = highContrastText_;
1719885b47fbSopenharmony_ci        configValue.invertColor = invertColor_;
1720885b47fbSopenharmony_ci        configValue.animationOff = animationOff_;
1721885b47fbSopenharmony_ci        configValue.screenMagnifier = screenMagnifier_;
1722885b47fbSopenharmony_ci        configValue.audioMono = audioMono_;
1723885b47fbSopenharmony_ci        configValue.mouseKey = mouseKey_;
1724885b47fbSopenharmony_ci        configValue.shortkey = shortkey_;
1725885b47fbSopenharmony_ci        configValue.captionState = captionState_;
1726885b47fbSopenharmony_ci        configValue.contentTimeout = contentTimeout_;
1727885b47fbSopenharmony_ci        configValue.mouseAutoClick = mouseAutoClick_;
1728885b47fbSopenharmony_ci        configValue.audioBalance = audioBalance_;
1729885b47fbSopenharmony_ci        configValue.brightnessDiscount = brightnessDiscount_;
1730885b47fbSopenharmony_ci        configValue.daltonizationState = daltonizationState_;
1731885b47fbSopenharmony_ci        if (!configValue.daltonizationState) {
1732885b47fbSopenharmony_ci            configValue.daltonizationColorFilter = Normal;
1733885b47fbSopenharmony_ci        } else {
1734885b47fbSopenharmony_ci            configValue.daltonizationColorFilter = static_cast<DALTONIZATION_TYPE>(daltonizationColorFilter_);
1735885b47fbSopenharmony_ci        }
1736885b47fbSopenharmony_ci        configValue.shortkey_target = shortkeyTarget_;
1737885b47fbSopenharmony_ci        configValue.shortkeyMultiTarget = shortkeyMultiTarget_;
1738885b47fbSopenharmony_ci        configValue.captionStyle = captionProperty_;
1739885b47fbSopenharmony_ci        configValue.clickResponseTime = static_cast<CLICK_RESPONSE_TIME>(clickResponseTime_);
1740885b47fbSopenharmony_ci        configValue.ignoreRepeatClickState = ignoreRepeatClickState_;
1741885b47fbSopenharmony_ci        configValue.ignoreRepeatClickTime = static_cast<IGNORE_REPEAT_CLICK_TIME>(ignoreRepeatClickTime_);
1742885b47fbSopenharmony_ci    }
1743885b47fbSopenharmony_ci    observer->OnConfigChanged(id, configValue);
1744885b47fbSopenharmony_ci}
1745885b47fbSopenharmony_ci
1746885b47fbSopenharmony_ciuint32_t AccessibilityConfig::Impl::InvertDaltonizationColorInAtoHos(uint32_t filter)
1747885b47fbSopenharmony_ci{
1748885b47fbSopenharmony_ci    if (filter == DISPLAY_DALTONIZER_GREEN) {
1749885b47fbSopenharmony_ci        return Deuteranomaly;
1750885b47fbSopenharmony_ci    }
1751885b47fbSopenharmony_ci    if (filter == DISPLAY_DALTONIZER_RED) {
1752885b47fbSopenharmony_ci        return Protanomaly;
1753885b47fbSopenharmony_ci    }
1754885b47fbSopenharmony_ci    if (daltonizationColorFilter_ == DISPLAY_DALTONIZER_BLUE) {
1755885b47fbSopenharmony_ci        return Tritanomaly;
1756885b47fbSopenharmony_ci    }
1757885b47fbSopenharmony_ci    return filter;
1758885b47fbSopenharmony_ci}
1759885b47fbSopenharmony_ci
1760885b47fbSopenharmony_civoid AccessibilityConfig::Impl::InitConfigValues()
1761885b47fbSopenharmony_ci{
1762885b47fbSopenharmony_ci    Accessibility::AccessibilityConfigData configData;
1763885b47fbSopenharmony_ci    if (serviceProxy_ == nullptr) {
1764885b47fbSopenharmony_ci        return;
1765885b47fbSopenharmony_ci    }
1766885b47fbSopenharmony_ci    serviceProxy_->GetAllConfigs(configData);
1767885b47fbSopenharmony_ci    highContrastText_ = configData.highContrastText_;
1768885b47fbSopenharmony_ci    invertColor_ = configData.invertColor_;
1769885b47fbSopenharmony_ci    animationOff_ = configData.animationOff_;
1770885b47fbSopenharmony_ci    audioMono_ = configData.audioMono_;
1771885b47fbSopenharmony_ci    mouseKey_ = configData.mouseKey_;
1772885b47fbSopenharmony_ci    captionState_ = configData.captionState_;
1773885b47fbSopenharmony_ci    screenMagnifier_ = configData.screenMagnifier_;
1774885b47fbSopenharmony_ci    shortkey_ = configData.shortkey_;
1775885b47fbSopenharmony_ci    mouseAutoClick_ = configData.mouseAutoClick_;
1776885b47fbSopenharmony_ci    daltonizationState_ = configData.daltonizationState_;
1777885b47fbSopenharmony_ci    daltonizationColorFilter_ = InvertDaltonizationColorInAtoHos(configData.daltonizationColorFilter_);
1778885b47fbSopenharmony_ci    contentTimeout_ = configData.contentTimeout_;
1779885b47fbSopenharmony_ci    brightnessDiscount_ = configData.brightnessDiscount_;
1780885b47fbSopenharmony_ci    audioBalance_ = configData.audioBalance_;
1781885b47fbSopenharmony_ci    shortkeyTarget_ = configData.shortkeyTarget_;
1782885b47fbSopenharmony_ci    shortkeyMultiTarget_ = configData.shortkeyMultiTarget_;
1783885b47fbSopenharmony_ci    captionProperty_ = configData.captionProperty_;
1784885b47fbSopenharmony_ci    clickResponseTime_ = configData.clickResponseTime_;
1785885b47fbSopenharmony_ci    ignoreRepeatClickTime_ = configData.ignoreRepeatClickTime_;
1786885b47fbSopenharmony_ci    ignoreRepeatClickState_ = configData.ignoreRepeatClickState_;
1787885b47fbSopenharmony_ci    NotifyDefaultConfigs();
1788885b47fbSopenharmony_ci    HILOG_DEBUG("ConnectToService Success");
1789885b47fbSopenharmony_ci}
1790885b47fbSopenharmony_ci
1791885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDefaultDaltonizationConfigs()
1792885b47fbSopenharmony_ci{
1793885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1794885b47fbSopenharmony_ci        configObservers_.find(CONFIG_DALTONIZATION_STATE);
1795885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
1796885b47fbSopenharmony_ci        NotifyDaltonizationStateChanged(it->second, daltonizationState_);
1797885b47fbSopenharmony_ci    }
1798885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_DALTONIZATION_COLOR_FILTER)) != configObservers_.end()) {
1799885b47fbSopenharmony_ci        NotifyDaltonizationColorFilterChanged(it->second, daltonizationColorFilter_);
1800885b47fbSopenharmony_ci    }
1801885b47fbSopenharmony_ci}
1802885b47fbSopenharmony_ci
1803885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDefaultScreenTouchConfigs()
1804885b47fbSopenharmony_ci{
1805885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1806885b47fbSopenharmony_ci        configObservers_.find(CONIFG_CLICK_RESPONSE_TIME);
1807885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
1808885b47fbSopenharmony_ci        NotifyClickResponseTimeChanged(it->second, clickResponseTime_);
1809885b47fbSopenharmony_ci    }
1810885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_IGNORE_REPEAT_CLICK_STATE)) != configObservers_.end()) {
1811885b47fbSopenharmony_ci        NotifyIgnoreRepeatClickTimeChanged(it->second, ignoreRepeatClickState_);
1812885b47fbSopenharmony_ci    }
1813885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_IGNORE_REPEAT_CLICK_TIME)) != configObservers_.end()) {
1814885b47fbSopenharmony_ci        NotifyIgnoreRepeatClickStateChanged(it->second, ignoreRepeatClickTime_);
1815885b47fbSopenharmony_ci    }
1816885b47fbSopenharmony_ci}
1817885b47fbSopenharmony_ci
1818885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDefaultShortKeyConfigs()
1819885b47fbSopenharmony_ci{
1820885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1821885b47fbSopenharmony_ci        configObservers_.find(CONFIG_SHORT_KEY);
1822885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
1823885b47fbSopenharmony_ci        NotifyShortKeyChanged(it->second, shortkey_);
1824885b47fbSopenharmony_ci    }
1825885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_SHORT_KEY_TARGET)) != configObservers_.end()) {
1826885b47fbSopenharmony_ci        NotifyShortkeyTargetChanged(it->second, shortkeyTarget_);
1827885b47fbSopenharmony_ci    }
1828885b47fbSopenharmony_ci}
1829885b47fbSopenharmony_ci
1830885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDefaultShortKeyMultiConfigs()
1831885b47fbSopenharmony_ci{
1832885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1833885b47fbSopenharmony_ci        configObservers_.find(CONFIG_SHORT_KEY);
1834885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
1835885b47fbSopenharmony_ci        NotifyShortKeyChanged(it->second, shortkey_);
1836885b47fbSopenharmony_ci    }
1837885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_SHORT_KEY_MULTI_TARGET)) != configObservers_.end()) {
1838885b47fbSopenharmony_ci        NotifyShortkeyMultiTargetChanged(it->second, shortkeyMultiTarget_);
1839885b47fbSopenharmony_ci    }
1840885b47fbSopenharmony_ci}
1841885b47fbSopenharmony_ci
1842885b47fbSopenharmony_civoid AccessibilityConfig::Impl::NotifyDefaultConfigs()
1843885b47fbSopenharmony_ci{
1844885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>>::iterator it =
1845885b47fbSopenharmony_ci        configObservers_.find(CONFIG_HIGH_CONTRAST_TEXT);
1846885b47fbSopenharmony_ci    if (it != configObservers_.end()) {
1847885b47fbSopenharmony_ci        NotifyHighContrastTextChanged(it->second, highContrastText_);
1848885b47fbSopenharmony_ci    }
1849885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_INVERT_COLOR)) != configObservers_.end()) {
1850885b47fbSopenharmony_ci        NotifyInvertColorChanged(it->second, invertColor_);
1851885b47fbSopenharmony_ci    }
1852885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_CONTENT_TIMEOUT)) != configObservers_.end()) {
1853885b47fbSopenharmony_ci        NotifyContentTimeoutChanged(it->second, contentTimeout_);
1854885b47fbSopenharmony_ci    }
1855885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_ANIMATION_OFF)) != configObservers_.end()) {
1856885b47fbSopenharmony_ci        NotifyAnimationOffChanged(it->second, animationOff_);
1857885b47fbSopenharmony_ci    }
1858885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_BRIGHTNESS_DISCOUNT)) != configObservers_.end()) {
1859885b47fbSopenharmony_ci        NotifyBrightnessDiscountChanged(it->second, brightnessDiscount_);
1860885b47fbSopenharmony_ci    }
1861885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_AUDIO_MONO)) != configObservers_.end()) {
1862885b47fbSopenharmony_ci        NotifyAudioMonoChanged(it->second, audioMono_);
1863885b47fbSopenharmony_ci    }
1864885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_AUDIO_BALANCE)) != configObservers_.end()) {
1865885b47fbSopenharmony_ci        NotifyAudioBalanceChanged(it->second, audioBalance_);
1866885b47fbSopenharmony_ci    }
1867885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_MOUSE_KEY)) != configObservers_.end()) {
1868885b47fbSopenharmony_ci        NotifyMouseKeyChanged(it->second, mouseKey_);
1869885b47fbSopenharmony_ci    }
1870885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_CAPTION_STATE)) != configObservers_.end()) {
1871885b47fbSopenharmony_ci        NotifyCaptionStateChanged(it->second, captionState_);
1872885b47fbSopenharmony_ci    }
1873885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_CAPTION_STYLE)) != configObservers_.end()) {
1874885b47fbSopenharmony_ci        NotifyCaptionChanged(it->second, captionProperty_);
1875885b47fbSopenharmony_ci    }
1876885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_SCREEN_MAGNIFICATION)) != configObservers_.end()) {
1877885b47fbSopenharmony_ci        NotifyScreenMagnificationChanged(it->second, screenMagnifier_);
1878885b47fbSopenharmony_ci    }
1879885b47fbSopenharmony_ci    if ((it = configObservers_.find(CONFIG_MOUSE_AUTOCLICK)) != configObservers_.end()) {
1880885b47fbSopenharmony_ci        NotifyMouseAutoClickChanged(it->second, mouseAutoClick_);
1881885b47fbSopenharmony_ci    }
1882885b47fbSopenharmony_ci
1883885b47fbSopenharmony_ci    NotifyDefaultDaltonizationConfigs();
1884885b47fbSopenharmony_ci    NotifyDefaultScreenTouchConfigs();
1885885b47fbSopenharmony_ci    NotifyDefaultShortKeyConfigs();
1886885b47fbSopenharmony_ci    NotifyDefaultShortKeyMultiConfigs();
1887885b47fbSopenharmony_ci}
1888885b47fbSopenharmony_ci
1889885b47fbSopenharmony_civoid AccessibilityConfig::Impl::AccessibilityLoadCallback::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
1890885b47fbSopenharmony_ci    const sptr<IRemoteObject> &remoteObject)
1891885b47fbSopenharmony_ci{
1892885b47fbSopenharmony_ci    HILOG_DEBUG();
1893885b47fbSopenharmony_ci    if (config_) {
1894885b47fbSopenharmony_ci        config_->LoadSystemAbilitySuccess(remoteObject);
1895885b47fbSopenharmony_ci    }
1896885b47fbSopenharmony_ci}
1897885b47fbSopenharmony_ci
1898885b47fbSopenharmony_civoid AccessibilityConfig::Impl::AccessibilityLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
1899885b47fbSopenharmony_ci{
1900885b47fbSopenharmony_ci    HILOG_DEBUG();
1901885b47fbSopenharmony_ci    if (config_) {
1902885b47fbSopenharmony_ci        config_->LoadSystemAbilityFail();
1903885b47fbSopenharmony_ci    }
1904885b47fbSopenharmony_ci}
1905885b47fbSopenharmony_ci} // namespace AccessibilityConfig
1906885b47fbSopenharmony_ci} // namespace OHOS