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#ifndef ACCESSIBILITY_CONFIG_IMPL_H
17885b47fbSopenharmony_ci#define ACCESSIBILITY_CONFIG_IMPL_H
18885b47fbSopenharmony_ci
19885b47fbSopenharmony_ci#include "accessibility_config.h"
20885b47fbSopenharmony_ci#include "accessibility_enable_ability_lists_observer_stub.h"
21885b47fbSopenharmony_ci#include "accessible_ability_manager_caption_observer_stub.h"
22885b47fbSopenharmony_ci#include "accessible_ability_manager_config_observer_stub.h"
23885b47fbSopenharmony_ci#include "accessible_ability_manager_service_proxy.h"
24885b47fbSopenharmony_ci#include "ffrt.h"
25885b47fbSopenharmony_ci#include "ffrt_inner.h"
26885b47fbSopenharmony_ci#include "event_handler.h"
27885b47fbSopenharmony_ci#include "refbase.h"
28885b47fbSopenharmony_ci#include "system_ability_load_callback_stub.h"
29885b47fbSopenharmony_ci#include "system_ability_status_change_stub.h"
30885b47fbSopenharmony_ci
31885b47fbSopenharmony_cinamespace OHOS {
32885b47fbSopenharmony_cinamespace AccessibilityConfig {
33885b47fbSopenharmony_ciclass AccessibilityConfig::Impl {
34885b47fbSopenharmony_cipublic:
35885b47fbSopenharmony_ci    Impl();
36885b47fbSopenharmony_ci    ~Impl() = default;
37885b47fbSopenharmony_ci
38885b47fbSopenharmony_ci    bool InitializeContext();
39885b47fbSopenharmony_ci
40885b47fbSopenharmony_ci    Accessibility::RetError SubscribeConfigObserver(const CONFIG_ID id,
41885b47fbSopenharmony_ci        const std::shared_ptr<AccessibilityConfigObserver> &observer, const bool retFlag);
42885b47fbSopenharmony_ci    Accessibility::RetError UnsubscribeConfigObserver(const CONFIG_ID id,
43885b47fbSopenharmony_ci        const std::shared_ptr<AccessibilityConfigObserver> &observer);
44885b47fbSopenharmony_ci
45885b47fbSopenharmony_ci    Accessibility::RetError SubscribeEnableAbilityListsObserver(
46885b47fbSopenharmony_ci        const std::shared_ptr<AccessibilityEnableAbilityListsObserver> &observer);
47885b47fbSopenharmony_ci    Accessibility::RetError UnsubscribeEnableAbilityListsObserver(
48885b47fbSopenharmony_ci        const std::shared_ptr<AccessibilityEnableAbilityListsObserver> &observer);
49885b47fbSopenharmony_ci
50885b47fbSopenharmony_ci    Accessibility::RetError EnableAbility(const std::string &name, const uint32_t capabilities);
51885b47fbSopenharmony_ci    Accessibility::RetError DisableAbility(const std::string &name);
52885b47fbSopenharmony_ci
53885b47fbSopenharmony_ci    Accessibility::RetError SetScreenMagnificationState(const bool state);
54885b47fbSopenharmony_ci    Accessibility::RetError SetShortKeyState(const bool state);
55885b47fbSopenharmony_ci    Accessibility::RetError SetMouseKeyState(const bool state);
56885b47fbSopenharmony_ci    Accessibility::RetError SetCaptionsState(const bool state);
57885b47fbSopenharmony_ci    Accessibility::RetError SetCaptionsProperty(const CaptionProperty &caption);
58885b47fbSopenharmony_ci    Accessibility::RetError SetMouseAutoClick(const int32_t time);
59885b47fbSopenharmony_ci    Accessibility::RetError SetShortkeyTarget(const std::string &name);
60885b47fbSopenharmony_ci    Accessibility::RetError SetShortkeyMultiTarget(const std::vector<std::string> &name);
61885b47fbSopenharmony_ci    Accessibility::RetError SetHighContrastTextState(bool state);
62885b47fbSopenharmony_ci    Accessibility::RetError SetInvertColorState(const bool state);
63885b47fbSopenharmony_ci    Accessibility::RetError SetDaltonizationState(bool state);
64885b47fbSopenharmony_ci    Accessibility::RetError SetDaltonizationColorFilter(const DALTONIZATION_TYPE type);
65885b47fbSopenharmony_ci    Accessibility::RetError SetContentTimeout(const uint32_t timer);
66885b47fbSopenharmony_ci    Accessibility::RetError SetAnimationOffState(const bool state);
67885b47fbSopenharmony_ci    Accessibility::RetError SetBrightnessDiscount(const float brightness);
68885b47fbSopenharmony_ci    Accessibility::RetError SetAudioMonoState(const bool state);
69885b47fbSopenharmony_ci    Accessibility::RetError SetAudioBalance(const float balance);
70885b47fbSopenharmony_ci    Accessibility::RetError SetClickResponseTime(const CLICK_RESPONSE_TIME time);
71885b47fbSopenharmony_ci    Accessibility::RetError SetIgnoreRepeatClickState(const bool state);
72885b47fbSopenharmony_ci    Accessibility::RetError SetIgnoreRepeatClickTime(const IGNORE_REPEAT_CLICK_TIME time);
73885b47fbSopenharmony_ci
74885b47fbSopenharmony_ci    Accessibility::RetError GetScreenMagnificationState(bool &state);
75885b47fbSopenharmony_ci    Accessibility::RetError GetShortKeyState(bool &state);
76885b47fbSopenharmony_ci    Accessibility::RetError GetMouseKeyState(bool &state);
77885b47fbSopenharmony_ci    Accessibility::RetError GetCaptionsState(bool &state);
78885b47fbSopenharmony_ci    Accessibility::RetError GetCaptionsProperty(CaptionProperty &caption);
79885b47fbSopenharmony_ci    Accessibility::RetError GetMouseAutoClick(int32_t &time);
80885b47fbSopenharmony_ci    Accessibility::RetError GetShortkeyTarget(std::string &name);
81885b47fbSopenharmony_ci    Accessibility::RetError GetShortkeyMultiTarget(std::vector<std::string> &name);
82885b47fbSopenharmony_ci    Accessibility::RetError GetInvertColorState(bool &state);
83885b47fbSopenharmony_ci    Accessibility::RetError GetHighContrastTextState(bool &state);
84885b47fbSopenharmony_ci    Accessibility::RetError GetDaltonizationState(bool &state);
85885b47fbSopenharmony_ci    Accessibility::RetError GetDaltonizationColorFilter(DALTONIZATION_TYPE &type);
86885b47fbSopenharmony_ci    Accessibility::RetError GetContentTimeout(uint32_t &timer);
87885b47fbSopenharmony_ci    Accessibility::RetError GetAnimationOffState(bool &state);
88885b47fbSopenharmony_ci    Accessibility::RetError GetBrightnessDiscount(float &brightness);
89885b47fbSopenharmony_ci    Accessibility::RetError GetAudioMonoState(bool &state);
90885b47fbSopenharmony_ci    Accessibility::RetError GetAudioBalance(float &balance);
91885b47fbSopenharmony_ci    Accessibility::RetError GetClickResponseTime(CLICK_RESPONSE_TIME &time);
92885b47fbSopenharmony_ci    Accessibility::RetError GetIgnoreRepeatClickState(bool &state);
93885b47fbSopenharmony_ci    Accessibility::RetError GetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_TIME &time);
94885b47fbSopenharmony_ci
95885b47fbSopenharmony_ci    void ResetService(const wptr<IRemoteObject> &remote);
96885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerCaptionPropertyChanged(const CaptionProperty &property);
97885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerConfigStateChanged(const uint32_t stateType);
98885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerAudioBalanceChanged(const float audioBalance);
99885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerBrightnessDiscountChanged(const float brightnessDiscount);
100885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerContentTimeoutChanged(const uint32_t contentTimeout);
101885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerDaltonizationColorFilterChanged(const uint32_t filterType);
102885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerMouseAutoClickChanged(const int32_t mouseAutoClick);
103885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerShortkeyTargetChanged(const std::string &shortkeyTarget);
104885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerShortkeyMultiTargetChanged(const std::vector<std::string> &shortkeyMultiTarget);
105885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerClickResponseTimeChanged(const uint32_t clickResponseTime);
106885b47fbSopenharmony_ci    void OnAccessibleAbilityManagerIgnoreRepeatClickTimeChanged(const uint32_t ignoreRepeatClickTime);
107885b47fbSopenharmony_ci    void OnAccessibilityEnableAbilityListsChanged();
108885b47fbSopenharmony_ci    void OnAccessibilityInstallAbilityListsChanged();
109885b47fbSopenharmony_ci
110885b47fbSopenharmony_ci    void SetInitializeFlag(bool flag)
111885b47fbSopenharmony_ci    {
112885b47fbSopenharmony_ci        isInitialized_ = flag;
113885b47fbSopenharmony_ci    }
114885b47fbSopenharmony_ciprivate:
115885b47fbSopenharmony_ci    class AccessibilityEnableAbilityListsObserverImpl :
116885b47fbSopenharmony_ci        public Accessibility::AccessibilityEnableAbilityListsObserverStub {
117885b47fbSopenharmony_ci    public:
118885b47fbSopenharmony_ci        explicit AccessibilityEnableAbilityListsObserverImpl(Impl &client)
119885b47fbSopenharmony_ci            : client_(client) {}
120885b47fbSopenharmony_ci        ~AccessibilityEnableAbilityListsObserverImpl() = default;
121885b47fbSopenharmony_ci
122885b47fbSopenharmony_ci        virtual void OnAccessibilityEnableAbilityListsChanged() override
123885b47fbSopenharmony_ci        {
124885b47fbSopenharmony_ci            client_.OnAccessibilityEnableAbilityListsChanged();
125885b47fbSopenharmony_ci        }
126885b47fbSopenharmony_ci
127885b47fbSopenharmony_ci        virtual void OnAccessibilityInstallAbilityListsChanged() override
128885b47fbSopenharmony_ci        {
129885b47fbSopenharmony_ci            client_.OnAccessibilityInstallAbilityListsChanged();
130885b47fbSopenharmony_ci        }
131885b47fbSopenharmony_ci    private:
132885b47fbSopenharmony_ci        Impl &client_;
133885b47fbSopenharmony_ci    };
134885b47fbSopenharmony_ci
135885b47fbSopenharmony_ci    class AccessibleAbilityManagerCaptionObserverImpl
136885b47fbSopenharmony_ci        : public Accessibility::AccessibleAbilityManagerCaptionObserverStub {
137885b47fbSopenharmony_ci    public:
138885b47fbSopenharmony_ci        explicit AccessibleAbilityManagerCaptionObserverImpl(Impl &config_)
139885b47fbSopenharmony_ci            : config_(config_) {}
140885b47fbSopenharmony_ci        ~AccessibleAbilityManagerCaptionObserverImpl() = default;
141885b47fbSopenharmony_ci
142885b47fbSopenharmony_ci        virtual void OnPropertyChanged(const CaptionProperty &property) override
143885b47fbSopenharmony_ci        {
144885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerCaptionPropertyChanged(property);
145885b47fbSopenharmony_ci        }
146885b47fbSopenharmony_ci    private:
147885b47fbSopenharmony_ci        Impl &config_;
148885b47fbSopenharmony_ci    };
149885b47fbSopenharmony_ci
150885b47fbSopenharmony_ci    class AccessibilityLoadCallback : public SystemAbilityLoadCallbackStub {
151885b47fbSopenharmony_ci    public:
152885b47fbSopenharmony_ci        explicit AccessibilityLoadCallback(Impl* config) : config_(config) {}
153885b47fbSopenharmony_ci        ~AccessibilityLoadCallback() = default;
154885b47fbSopenharmony_ci        void OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
155885b47fbSopenharmony_ci            const sptr<IRemoteObject> &remoteObject) override;
156885b47fbSopenharmony_ci        void OnLoadSystemAbilityFail(int32_t systemAbilityId) override;
157885b47fbSopenharmony_ci    private:
158885b47fbSopenharmony_ci        Impl* config_ = nullptr;
159885b47fbSopenharmony_ci    };
160885b47fbSopenharmony_ci
161885b47fbSopenharmony_ci    class AccessibleAbilityManagerConfigObserverImpl
162885b47fbSopenharmony_ci        : public Accessibility::AccessibleAbilityManagerConfigObserverStub {
163885b47fbSopenharmony_ci    public:
164885b47fbSopenharmony_ci        explicit AccessibleAbilityManagerConfigObserverImpl(Impl &config) : config_(config) {}
165885b47fbSopenharmony_ci        ~AccessibleAbilityManagerConfigObserverImpl() = default;
166885b47fbSopenharmony_ci
167885b47fbSopenharmony_ci        virtual void OnConfigStateChanged(const uint32_t stateType) override
168885b47fbSopenharmony_ci        {
169885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerConfigStateChanged(stateType);
170885b47fbSopenharmony_ci        }
171885b47fbSopenharmony_ci        virtual void OnAudioBalanceChanged(const float audioBalance) override
172885b47fbSopenharmony_ci        {
173885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerAudioBalanceChanged(audioBalance);
174885b47fbSopenharmony_ci        }
175885b47fbSopenharmony_ci        virtual void OnBrightnessDiscountChanged(const float brightnessDiscount) override
176885b47fbSopenharmony_ci        {
177885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerBrightnessDiscountChanged(brightnessDiscount);
178885b47fbSopenharmony_ci        }
179885b47fbSopenharmony_ci        virtual void OnContentTimeoutChanged(const uint32_t contentTimeout) override
180885b47fbSopenharmony_ci        {
181885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerContentTimeoutChanged(contentTimeout);
182885b47fbSopenharmony_ci        }
183885b47fbSopenharmony_ci        virtual void OnDaltonizationColorFilterChanged(const uint32_t filterType) override
184885b47fbSopenharmony_ci        {
185885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerDaltonizationColorFilterChanged(filterType);
186885b47fbSopenharmony_ci        }
187885b47fbSopenharmony_ci        virtual void OnMouseAutoClickChanged(const int32_t mouseAutoClick) override
188885b47fbSopenharmony_ci        {
189885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerMouseAutoClickChanged(mouseAutoClick);
190885b47fbSopenharmony_ci        }
191885b47fbSopenharmony_ci        virtual void OnShortkeyTargetChanged(const std::string &shortkeyTarget) override
192885b47fbSopenharmony_ci        {
193885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerShortkeyTargetChanged(shortkeyTarget);
194885b47fbSopenharmony_ci        }
195885b47fbSopenharmony_ci        virtual void OnShortkeyMultiTargetChanged(const std::vector<std::string> &shortkeyMultiTarget) override
196885b47fbSopenharmony_ci        {
197885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerShortkeyMultiTargetChanged(shortkeyMultiTarget);
198885b47fbSopenharmony_ci        }
199885b47fbSopenharmony_ci        virtual void OnClickResponseTimeChanged(const uint32_t clickResponseTime) override
200885b47fbSopenharmony_ci        {
201885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerClickResponseTimeChanged(clickResponseTime);
202885b47fbSopenharmony_ci        }
203885b47fbSopenharmony_ci        virtual void OnIgnoreRepeatClickTimeChanged(const uint32_t ignoreRepeatClickTime) override
204885b47fbSopenharmony_ci        {
205885b47fbSopenharmony_ci            config_.OnAccessibleAbilityManagerIgnoreRepeatClickTimeChanged(ignoreRepeatClickTime);
206885b47fbSopenharmony_ci        }
207885b47fbSopenharmony_ci
208885b47fbSopenharmony_ci    private:
209885b47fbSopenharmony_ci        Impl &config_;
210885b47fbSopenharmony_ci    };
211885b47fbSopenharmony_ci
212885b47fbSopenharmony_ci    class DeathRecipient : public IRemoteObject::DeathRecipient {
213885b47fbSopenharmony_ci    public:
214885b47fbSopenharmony_ci        explicit DeathRecipient(Impl &config_) : config_(config_) {}
215885b47fbSopenharmony_ci        ~DeathRecipient() = default;
216885b47fbSopenharmony_ci        DISALLOW_COPY_AND_MOVE(DeathRecipient);
217885b47fbSopenharmony_ci
218885b47fbSopenharmony_ci        void OnRemoteDied(const wptr<IRemoteObject> &remote)
219885b47fbSopenharmony_ci        {
220885b47fbSopenharmony_ci            config_.ResetService(remote);
221885b47fbSopenharmony_ci        }
222885b47fbSopenharmony_ci    private:
223885b47fbSopenharmony_ci        Impl &config_;
224885b47fbSopenharmony_ci    };
225885b47fbSopenharmony_ci
226885b47fbSopenharmony_ci    bool ConnectToService();
227885b47fbSopenharmony_ci    bool ConnectToServiceAsync();
228885b47fbSopenharmony_ci
229885b47fbSopenharmony_ci    bool RegisterToService();
230885b47fbSopenharmony_ci    bool InitAccessibilityServiceProxy();
231885b47fbSopenharmony_ci
232885b47fbSopenharmony_ci    bool LoadAccessibilityService();
233885b47fbSopenharmony_ci    void LoadSystemAbilitySuccess(const sptr<IRemoteObject> &remoteObject);
234885b47fbSopenharmony_ci    void LoadSystemAbilityFail();
235885b47fbSopenharmony_ci    sptr<Accessibility::IAccessibleAbilityManagerService> GetServiceProxy();
236885b47fbSopenharmony_ci
237885b47fbSopenharmony_ci    void NotifyCaptionStateChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
238885b47fbSopenharmony_ci        const bool state);
239885b47fbSopenharmony_ci    void NotifyCaptionChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
240885b47fbSopenharmony_ci        const CaptionProperty &captionProperty);
241885b47fbSopenharmony_ci    void NotifyScreenMagnificationChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
242885b47fbSopenharmony_ci        const bool state);
243885b47fbSopenharmony_ci    void NotifyShortKeyChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
244885b47fbSopenharmony_ci        const bool state);
245885b47fbSopenharmony_ci    void NotifyMouseKeyChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
246885b47fbSopenharmony_ci        const bool state);
247885b47fbSopenharmony_ci    void NotifyShortkeyTargetChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
248885b47fbSopenharmony_ci        const std::string &shortkey_target);
249885b47fbSopenharmony_ci    void NotifyShortkeyMultiTargetChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
250885b47fbSopenharmony_ci        const std::vector<std::string> &shortkeyMultiTarget);
251885b47fbSopenharmony_ci    void NotifyMouseAutoClickChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
252885b47fbSopenharmony_ci        const uint32_t mouseAutoClick);
253885b47fbSopenharmony_ci    void NotifyAudioBalanceChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
254885b47fbSopenharmony_ci        const float audioBalance);
255885b47fbSopenharmony_ci    void NotifyBrightnessDiscountChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
256885b47fbSopenharmony_ci        const float brightnessDiscount);
257885b47fbSopenharmony_ci    void NotifyContentTimeoutChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
258885b47fbSopenharmony_ci        const uint32_t contentTimeout);
259885b47fbSopenharmony_ci    void NotifyDaltonizationColorFilterChanged(
260885b47fbSopenharmony_ci        const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
261885b47fbSopenharmony_ci        const uint32_t daltonizationColorFilter);
262885b47fbSopenharmony_ci    void NotifyAudioMonoChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
263885b47fbSopenharmony_ci        const bool state);
264885b47fbSopenharmony_ci    void NotifyAnimationOffChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
265885b47fbSopenharmony_ci        const bool state);
266885b47fbSopenharmony_ci    void NotifyInvertColorChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
267885b47fbSopenharmony_ci        const bool state);
268885b47fbSopenharmony_ci    void NotifyHighContrastTextChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
269885b47fbSopenharmony_ci        const bool state);
270885b47fbSopenharmony_ci    void NotifyDaltonizationStateChanged(
271885b47fbSopenharmony_ci        const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
272885b47fbSopenharmony_ci        const bool state);
273885b47fbSopenharmony_ci    void NotifyClickResponseTimeChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
274885b47fbSopenharmony_ci        const uint32_t clickResponseTime);
275885b47fbSopenharmony_ci    void NotifyIgnoreRepeatClickTimeChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
276885b47fbSopenharmony_ci        const uint32_t time);
277885b47fbSopenharmony_ci    void NotifyIgnoreRepeatClickStateChanged(const std::vector<std::shared_ptr<AccessibilityConfigObserver>> &observers,
278885b47fbSopenharmony_ci        const bool state);
279885b47fbSopenharmony_ci
280885b47fbSopenharmony_ci    void UpdateScreenMagnificationEnabled(const bool enabled);
281885b47fbSopenharmony_ci    void UpdateShortKeyEnabled(const bool enabled);
282885b47fbSopenharmony_ci    void UpdateMouseKeyEnabled(const bool enabled);
283885b47fbSopenharmony_ci    void UpdateCaptionEnabled(const bool enabled);
284885b47fbSopenharmony_ci    void UpdateAudioMonoEnabled(const bool enabled);
285885b47fbSopenharmony_ci    void UpdateAnimationOffEnabled(const bool enabled);
286885b47fbSopenharmony_ci    void UpdateInvertColorEnabled(const bool enabled);
287885b47fbSopenharmony_ci    void UpdateHighContrastTextEnabled(const bool enabled);
288885b47fbSopenharmony_ci    void UpdateDaltonizationStateEnabled(const bool enabled);
289885b47fbSopenharmony_ci    void UpdateIgnoreRepeatClickStateEnabled(const bool enabled);
290885b47fbSopenharmony_ci    void NotifyDefaultConfigs();
291885b47fbSopenharmony_ci    void NotifyDefaultDaltonizationConfigs();
292885b47fbSopenharmony_ci    void NotifyDefaultScreenTouchConfigs();
293885b47fbSopenharmony_ci    void NotifyDefaultShortKeyConfigs();
294885b47fbSopenharmony_ci    void NotifyDefaultShortKeyMultiConfigs();
295885b47fbSopenharmony_ci    void NotifyImmediately(const CONFIG_ID id, const std::shared_ptr<AccessibilityConfigObserver> &observer);
296885b47fbSopenharmony_ci    void InitConfigValues();
297885b47fbSopenharmony_ci    uint32_t InvertDaltonizationColorInAtoHos(uint32_t filter);
298885b47fbSopenharmony_ci    static void OnParameterChanged(const char *key, const char *value, void *context);
299885b47fbSopenharmony_ci
300885b47fbSopenharmony_ci    void OnIgnoreRepeatClickStateChanged(const uint32_t stateType);
301885b47fbSopenharmony_ci    bool CheckSaStatus();
302885b47fbSopenharmony_ci
303885b47fbSopenharmony_ci    sptr<Accessibility::IAccessibleAbilityManagerService> serviceProxy_ = nullptr;
304885b47fbSopenharmony_ci    sptr<AccessibleAbilityManagerCaptionObserverImpl> captionObserver_ = nullptr;
305885b47fbSopenharmony_ci    sptr<AccessibleAbilityManagerConfigObserverImpl> configObserver_ = nullptr;
306885b47fbSopenharmony_ci    sptr<AccessibilityEnableAbilityListsObserverImpl> enableAbilityListsObserver_ = nullptr;
307885b47fbSopenharmony_ci
308885b47fbSopenharmony_ci    bool isInitialized_ = false;
309885b47fbSopenharmony_ci    bool shortkey_ = false;
310885b47fbSopenharmony_ci    bool highContrastText_ = false;
311885b47fbSopenharmony_ci    bool screenMagnifier_ = false;
312885b47fbSopenharmony_ci    bool invertColor_ = false;
313885b47fbSopenharmony_ci    bool captionState_ = false;
314885b47fbSopenharmony_ci    bool animationOff_ = false;
315885b47fbSopenharmony_ci    bool audioMono_ = false;
316885b47fbSopenharmony_ci    bool mouseKey_ = false;
317885b47fbSopenharmony_ci    bool daltonizationState_ = false;
318885b47fbSopenharmony_ci    int32_t mouseAutoClick_ = 0;
319885b47fbSopenharmony_ci    uint32_t contentTimeout_ = 0;
320885b47fbSopenharmony_ci    uint32_t daltonizationColorFilter_ = 0;
321885b47fbSopenharmony_ci    float audioBalance_ = 0.0;
322885b47fbSopenharmony_ci    float brightnessDiscount_ = 0.0;
323885b47fbSopenharmony_ci    std::string shortkeyTarget_ = "";
324885b47fbSopenharmony_ci    uint32_t clickResponseTime_ = 0;
325885b47fbSopenharmony_ci    uint32_t ignoreRepeatClickTime_ = 0;
326885b47fbSopenharmony_ci    bool ignoreRepeatClickState_ = false;
327885b47fbSopenharmony_ci    CaptionProperty captionProperty_ = {};
328885b47fbSopenharmony_ci
329885b47fbSopenharmony_ci    sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
330885b47fbSopenharmony_ci
331885b47fbSopenharmony_ci    std::vector<std::string> shortkeyMultiTarget_ {};
332885b47fbSopenharmony_ci    std::vector<std::shared_ptr<AccessibilityEnableAbilityListsObserver>> enableAbilityListsObservers_;
333885b47fbSopenharmony_ci    std::map<CONFIG_ID, std::vector<std::shared_ptr<AccessibilityConfigObserver>>> configObservers_;
334885b47fbSopenharmony_ci    ffrt::mutex mutex_;
335885b47fbSopenharmony_ci
336885b47fbSopenharmony_ci    std::shared_ptr<AppExecFwk::EventRunner> runner_;
337885b47fbSopenharmony_ci    std::shared_ptr<AppExecFwk::EventHandler> handler_;
338885b47fbSopenharmony_ci
339885b47fbSopenharmony_ci    ffrt::condition_variable proxyConVar_;
340885b47fbSopenharmony_ci    ffrt::mutex conVarMutex_; // mutex for proxyConVar
341885b47fbSopenharmony_ci};
342885b47fbSopenharmony_ci} // namespace AccessibilityConfig
343885b47fbSopenharmony_ci} // namespace OHOS
344885b47fbSopenharmony_ci#endif // ACCESSIBILITY_CONFIG_IMPL_H
345