1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "accessibility_setting_provider.h"
17 #include "accessibility_datashare_helper.h"
18 #include <gtest/gtest.h>
19 
20 namespace OHOS {
21 namespace Accessibility {
22 std::shared_ptr<AccessibilitySettingProvider> AccessibilitySettingProvider::instance_ = nullptr;
23 ffrt::mutex AccessibilitySettingProvider::mutex_;
24 namespace {
25     constexpr int32_t DEFAULT_ACCOUNT_ID = 100;
26 } // namespace
27 
AccessibilitySettingProvider()28 AccessibilitySettingProvider::AccessibilitySettingProvider()
29     : AccessibilityDatashareHelper(DATASHARE_TYPE::GLOBAL, DEFAULT_ACCOUNT_ID)
30 {
31 }
32 
~AccessibilitySettingProvider()33 AccessibilitySettingProvider::~AccessibilitySettingProvider()
34 {
35     instance_ = nullptr;
36 }
37 
GetInstance(int32_t systemAbilityId)38 std::shared_ptr<AccessibilitySettingProvider> AccessibilitySettingProvider::GetInstance(int32_t systemAbilityId)
39 {
40     if (instance_ == nullptr) {
41         instance_ = std::make_shared<AccessibilitySettingProvider>();
42     }
43     return instance_;
44 }
45 
DeleteInstance()46 void AccessibilitySettingProvider::DeleteInstance()
47 {
48 }
49 
GetIntValue(const std::string & key,int32_t & value)50 RetError AccessibilitySettingProvider::GetIntValue(const std::string& key, int32_t& value)
51 {
52     (void)key;
53     (void)value;
54     return RET_OK;
55 }
56 
GetLongValue(const std::string & key,int64_t & value)57 RetError AccessibilitySettingProvider::GetLongValue(const std::string& key, int64_t& value)
58 {
59     (void)key;
60     (void)value;
61     return RET_OK;
62 }
63 
GetBoolValue(const std::string & key,bool & value)64 RetError AccessibilitySettingProvider::GetBoolValue(const std::string& key, bool& value)
65 {
66     (void)key;
67     (void)value;
68     return RET_OK;
69 }
70 
GetFloatValue(const std::string & key,float & value)71 RetError AccessibilitySettingProvider::GetFloatValue(const std::string& key, float& value)
72 {
73     (void)key;
74     (void)value;
75     return RET_OK;
76 }
77 
PutIntValue(const std::string & key,int32_t value,bool needNotify)78 RetError AccessibilitySettingProvider::PutIntValue(const std::string& key, int32_t value, bool needNotify)
79 {
80     (void)key;
81     (void)value;
82     (void)needNotify;
83     return RET_OK;
84 }
85 
PutLongValue(const std::string & key,int64_t value,bool needNotify)86 RetError AccessibilitySettingProvider::PutLongValue(const std::string& key, int64_t value, bool needNotify)
87 {
88     (void)key;
89     (void)value;
90     (void)needNotify;
91     return RET_OK;
92 }
93 
PutBoolValue(const std::string & key,bool value,bool needNotify)94 RetError AccessibilitySettingProvider::PutBoolValue(const std::string& key, bool value, bool needNotify)
95 {
96     (void)key;
97     (void)value;
98     (void)needNotify;
99     return RET_OK;
100 }
101 
CreateObserver(const std::string & key,AccessibilitySettingObserver::UpdateFunc & func)102 sptr<AccessibilitySettingObserver> AccessibilitySettingProvider::CreateObserver(const std::string& key,
103     AccessibilitySettingObserver::UpdateFunc& func)
104 {
105     (void)key;
106     (void)func;
107     return nullptr;
108 }
109 
RegisterObserver(const std::string & key,AccessibilitySettingObserver::UpdateFunc & func)110 RetError AccessibilitySettingProvider::RegisterObserver(const std::string& key,
111     AccessibilitySettingObserver::UpdateFunc& func)
112 {
113     (void)key;
114     (void)func;
115     return RET_OK;
116 }
117 
UnregisterObserver(const std::string & key)118 RetError AccessibilitySettingProvider::UnregisterObserver(const std::string& key)
119 {
120     (void)key;
121     return RET_OK;
122 }
123 
GetStringValue(const std::string & key,std::string & value)124 RetError AccessibilitySettingProvider::GetStringValue(const std::string& key, std::string& value)
125 {
126     (void)key;
127     (void)value;
128     return RET_OK;
129 }
130 
PutStringValue(const std::string & key,const std::string & value,bool needNotify)131 RetError AccessibilitySettingProvider::PutStringValue
132     (const std::string& key, const std::string& value, bool needNotify)
133 {
134     (void)key;
135     (void)value;
136     (void)needNotify;
137     return RET_OK;
138 }
139 } // namespace Accessibility
140 } // namespace OHOS