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#ifndef ACCESSIBILITY_SETTINGS_CONFIG_H
16885b47fbSopenharmony_ci#define ACCESSIBILITY_SETTINGS_CONFIG_H
17885b47fbSopenharmony_ci
18885b47fbSopenharmony_ci#include <map>
19885b47fbSopenharmony_ci#include <set>
20885b47fbSopenharmony_ci#include <string>
21885b47fbSopenharmony_ci#include <vector>
22885b47fbSopenharmony_ci
23885b47fbSopenharmony_ci#include "accessibility_caption.h"
24885b47fbSopenharmony_ci#include "accessibility_datashare_helper.h"
25885b47fbSopenharmony_ci
26885b47fbSopenharmony_cinamespace OHOS {
27885b47fbSopenharmony_cinamespace Accessibility {
28885b47fbSopenharmony_ci
29885b47fbSopenharmony_ciclass AccessibilitySettingsConfig final {
30885b47fbSopenharmony_cipublic:
31885b47fbSopenharmony_ci    explicit AccessibilitySettingsConfig(int id);
32885b47fbSopenharmony_ci    ~AccessibilitySettingsConfig() = default;
33885b47fbSopenharmony_ci
34885b47fbSopenharmony_ci    RetError SetEnabled(const bool state);
35885b47fbSopenharmony_ci    RetError SetTouchGuideState(const bool state);
36885b47fbSopenharmony_ci    RetError SetGestureState(const bool state);
37885b47fbSopenharmony_ci    RetError SetKeyEventObserverState(const bool state);
38885b47fbSopenharmony_ci    RetError SetCaptionProperty(const AccessibilityConfig::CaptionProperty &caption);
39885b47fbSopenharmony_ci    RetError SetCaptionState(const bool state);
40885b47fbSopenharmony_ci    RetError SetScreenMagnificationState(const bool state);
41885b47fbSopenharmony_ci    RetError SetScreenMagnificationType(const uint32_t type);
42885b47fbSopenharmony_ci    RetError SetShortKeyState(const bool state);
43885b47fbSopenharmony_ci    RetError SetShortKeyOnLockScreenState(const bool state);
44885b47fbSopenharmony_ci    RetError SetShortKeyTimeout(const int32_t time);
45885b47fbSopenharmony_ci    RetError SetMouseKeyState(const bool state);
46885b47fbSopenharmony_ci    RetError SetMouseAutoClick(const int32_t time);
47885b47fbSopenharmony_ci    RetError SetShortkeyTarget(const std::string &name);
48885b47fbSopenharmony_ci    RetError SetShortkeyMultiTarget(const std::vector<std::string> &name);
49885b47fbSopenharmony_ci    RetError SetShortkeyMultiTargetInPkgRemove(const std::string &name);
50885b47fbSopenharmony_ci    RetError SetHighContrastTextState(const bool state);
51885b47fbSopenharmony_ci    RetError SetInvertColorState(const bool state);
52885b47fbSopenharmony_ci    RetError SetAnimationOffState(const bool state);
53885b47fbSopenharmony_ci    RetError SetAudioMonoState(const bool state);
54885b47fbSopenharmony_ci    RetError SetDaltonizationState(const bool state);
55885b47fbSopenharmony_ci    RetError SetDaltonizationColorFilter(const uint32_t filter);
56885b47fbSopenharmony_ci    RetError SetContentTimeout(const uint32_t time);
57885b47fbSopenharmony_ci    RetError SetBrightnessDiscount(const float discount);
58885b47fbSopenharmony_ci    RetError SetAudioBalance(const float balance);
59885b47fbSopenharmony_ci    RetError SetClickResponseTime(const uint32_t time);
60885b47fbSopenharmony_ci    RetError SetIgnoreRepeatClickState(const bool state);
61885b47fbSopenharmony_ci    RetError SetIgnoreRepeatClickTime(const uint32_t time);
62885b47fbSopenharmony_ci    RetError SetStartFromAtoHosState(const bool state);
63885b47fbSopenharmony_ci
64885b47fbSopenharmony_ci    bool GetEnabledState() const;
65885b47fbSopenharmony_ci    bool GetTouchGuideState() const;
66885b47fbSopenharmony_ci    bool GetGestureState() const;
67885b47fbSopenharmony_ci    bool GetKeyEventObserverState() const;
68885b47fbSopenharmony_ci    bool GetCaptionState() const;
69885b47fbSopenharmony_ci    bool GetScreenMagnificationState() const;
70885b47fbSopenharmony_ci    bool GetShortKeyState() const;
71885b47fbSopenharmony_ci    bool GetShortKeyOnLockScreenState() const;
72885b47fbSopenharmony_ci    int32_t GetShortKeyTimeout() const;
73885b47fbSopenharmony_ci    bool GetMouseKeyState() const;
74885b47fbSopenharmony_ci    int32_t GetMouseAutoClick() const;
75885b47fbSopenharmony_ci    const std::string &GetShortkeyTarget() const;
76885b47fbSopenharmony_ci    const std::vector<std::string> GetShortkeyMultiTarget();
77885b47fbSopenharmony_ci    bool GetHighContrastTextState() const;
78885b47fbSopenharmony_ci    bool GetInvertColorState() const;
79885b47fbSopenharmony_ci    bool GetAnimationOffState() const;
80885b47fbSopenharmony_ci    bool GetAudioMonoState() const;
81885b47fbSopenharmony_ci    bool GetDaltonizationState() const;
82885b47fbSopenharmony_ci    uint32_t GetDaltonizationColorFilter() const;
83885b47fbSopenharmony_ci    uint32_t GetContentTimeout() const;
84885b47fbSopenharmony_ci    float GetBrightnessDiscount() const;
85885b47fbSopenharmony_ci    float GetAudioBalance() const;
86885b47fbSopenharmony_ci    const AccessibilityConfig::CaptionProperty &GetCaptionProperty() const;
87885b47fbSopenharmony_ci    uint32_t GetClickResponseTime() const;
88885b47fbSopenharmony_ci    bool GetIgnoreRepeatClickState() const;
89885b47fbSopenharmony_ci    uint32_t GetIgnoreRepeatClickTime() const;
90885b47fbSopenharmony_ci    uint32_t GetScreenMagnificationType() const;
91885b47fbSopenharmony_ci
92885b47fbSopenharmony_ci    RetError SetEnabledAccessibilityServices(const std::vector<std::string> &services);
93885b47fbSopenharmony_ci    const std::vector<std::string> GetEnabledAccessibilityServices();
94885b47fbSopenharmony_ci    RetError AddEnabledAccessibilityService(const std::string &serviceName);
95885b47fbSopenharmony_ci    RetError RemoveEnabledAccessibilityService(const std::string &serviceName);
96885b47fbSopenharmony_ci    uint32_t GetConfigState();
97885b47fbSopenharmony_ci    bool GetStartFromAtoHosState();
98885b47fbSopenharmony_ci    void CloneShortkeyService(bool isScreenReaderEnabled);
99885b47fbSopenharmony_ci    void OnDataClone();
100885b47fbSopenharmony_ci    void CloneAudioState();
101885b47fbSopenharmony_ci    void InitShortKeyConfig();
102885b47fbSopenharmony_ci    uint32_t GetShortKeyService(std::vector<std::string> &services);
103885b47fbSopenharmony_ci    std::shared_ptr<AccessibilityDatashareHelper> GetDbHandle()
104885b47fbSopenharmony_ci    {
105885b47fbSopenharmony_ci        return datashare_;
106885b47fbSopenharmony_ci    }
107885b47fbSopenharmony_ci
108885b47fbSopenharmony_ci    void Init();
109885b47fbSopenharmony_ci    void ClearData();
110885b47fbSopenharmony_ciprivate:
111885b47fbSopenharmony_ci    void InitCaption();
112885b47fbSopenharmony_ci    void InitSetting();
113885b47fbSopenharmony_ci    void InitCapability();
114885b47fbSopenharmony_ci    RetError SetConfigState(const std::string& key, bool value);
115885b47fbSopenharmony_ci
116885b47fbSopenharmony_ci    int32_t accountId_;
117885b47fbSopenharmony_ci    bool enabled_ = false;
118885b47fbSopenharmony_ci    bool eventTouchGuideState_ = false;
119885b47fbSopenharmony_ci    bool gesturesSimulation_ = false;
120885b47fbSopenharmony_ci    bool filteringKeyEvents_ = false;
121885b47fbSopenharmony_ci    bool isScreenMagnificationState_ = false;
122885b47fbSopenharmony_ci    uint32_t screenMagnificationType_ = 0;
123885b47fbSopenharmony_ci    bool isCaptionState_ = false;
124885b47fbSopenharmony_ci    AccessibilityConfig::CaptionProperty captionProperty_;
125885b47fbSopenharmony_ci    bool isMouseKeyState_ = false;
126885b47fbSopenharmony_ci    bool isShortKeyState_ = false;
127885b47fbSopenharmony_ci    int32_t mouseAutoClick_ = -1;
128885b47fbSopenharmony_ci    std::string shortkeyTarget_ = "";
129885b47fbSopenharmony_ci    bool highContrastTextState_ = false;
130885b47fbSopenharmony_ci    bool invertColorState_ = false;
131885b47fbSopenharmony_ci    bool animationOffState_ = false;
132885b47fbSopenharmony_ci    bool audioMonoState_ = false;
133885b47fbSopenharmony_ci    bool daltonizationState_ = false;
134885b47fbSopenharmony_ci    uint32_t daltonizationColorFilter_ = 0;
135885b47fbSopenharmony_ci    uint32_t contentTimeout_ = 0;
136885b47fbSopenharmony_ci    float brightnessDiscount_ = 0.0;
137885b47fbSopenharmony_ci    float audioBalance_ = 0.0;
138885b47fbSopenharmony_ci    uint32_t clickResponseTime_ = 0;
139885b47fbSopenharmony_ci    bool ignoreRepeatClickState_ = false;
140885b47fbSopenharmony_ci    uint32_t ignoreRepeatClickTime_ = 0;
141885b47fbSopenharmony_ci    bool isShortKeyEnabledOnLockScreen_ = false;
142885b47fbSopenharmony_ci    int32_t shortKeyTimeout_ = 3;
143885b47fbSopenharmony_ci
144885b47fbSopenharmony_ci    std::vector<std::string> shortkeyMultiTarget_ {};
145885b47fbSopenharmony_ci    std::vector<std::string> enabledAccessibilityServices_ {}; // bundleName/abilityName
146885b47fbSopenharmony_ci
147885b47fbSopenharmony_ci    std::shared_ptr<AccessibilityDatashareHelper> datashare_ = nullptr;
148885b47fbSopenharmony_ci    std::shared_ptr<AccessibilityDatashareHelper> systemDatashare_ = nullptr;
149885b47fbSopenharmony_ci    ffrt::mutex interfaceMutex_;
150885b47fbSopenharmony_ci};
151885b47fbSopenharmony_ci} // namespace Accessibility
152885b47fbSopenharmony_ci} // namespace OHOS
153885b47fbSopenharmony_ci#endif // ACCESSIBILITY_SETTINGS_CONFIG_H