• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "hilog_wrapper.h"
18 
19 namespace OHOS {
20 namespace Accessibility {
21 AccessibilitySettingProvider* AccessibilitySettingProvider::instance_;
22 std::mutex AccessibilitySettingProvider::mutex_;
23 sptr<IRemoteObject> AccessibilitySettingProvider::remoteObj_;
24 namespace {
25 const std::string SETTING_URI_PROXY = "datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true";
26 } // namespace
27 
~AccessibilitySettingProvider()28 AccessibilitySettingProvider::~AccessibilitySettingProvider()
29 {
30     HILOG_DEBUG("start.");
31     instance_ = nullptr;
32     remoteObj_ = nullptr;
33 }
34 
GetInstance(int32_t systemAbilityId)35 AccessibilitySettingProvider& AccessibilitySettingProvider::GetInstance(int32_t systemAbilityId)
36 {
37     HILOG_DEBUG("start.");
38     if (instance_ == nullptr) {
39         instance_ = new AccessibilitySettingProvider();
40     }
41     return *instance_;
42 }
43 
DeleteInstance()44 void AccessibilitySettingProvider::DeleteInstance()
45 {
46     HILOG_DEBUG("start.");
47 }
48 
GetIntValue(const std::string & key,int32_t & value)49 ErrCode AccessibilitySettingProvider::GetIntValue(const std::string& key, int32_t& value)
50 {
51     HILOG_DEBUG("start.");
52     (void)key;
53     (void)value;
54     return ERR_OK;
55 }
56 
GetLongValue(const std::string & key,int64_t & value)57 ErrCode AccessibilitySettingProvider::GetLongValue(const std::string& key, int64_t& value)
58 {
59     HILOG_DEBUG("start.");
60     (void)key;
61     (void)value;
62     return ERR_OK;
63 }
64 
GetBoolValue(const std::string & key,bool & value)65 ErrCode AccessibilitySettingProvider::GetBoolValue(const std::string& key, bool& value)
66 {
67     HILOG_DEBUG("start.");
68     (void)key;
69     (void)value;
70     return ERR_OK;
71 }
72 
GetFloatValue(const std::string & key,float & value)73 ErrCode AccessibilitySettingProvider::GetFloatValue(const std::string& key, float& value)
74 {
75     HILOG_DEBUG("start.");
76     (void)key;
77     (void)value;
78     return ERR_OK;
79 }
80 
PutIntValue(const std::string & key,int32_t value,bool needNotify)81 ErrCode AccessibilitySettingProvider::PutIntValue(const std::string& key, int32_t value, bool needNotify)
82 {
83     HILOG_DEBUG("start.");
84     (void)key;
85     (void)value;
86     (void)needNotify;
87     return ERR_OK;
88 }
89 
PutLongValue(const std::string & key,int64_t value,bool needNotify)90 ErrCode AccessibilitySettingProvider::PutLongValue(const std::string& key, int64_t value, bool needNotify)
91 {
92     HILOG_DEBUG("start.");
93     (void)key;
94     (void)value;
95     (void)needNotify;
96     return ERR_OK;
97 }
98 
PutBoolValue(const std::string & key,bool value,bool needNotify)99 ErrCode AccessibilitySettingProvider::PutBoolValue(const std::string& key, bool value, bool needNotify)
100 {
101     HILOG_DEBUG("start.");
102     (void)key;
103     (void)value;
104     (void)needNotify;
105     return ERR_OK;
106 }
107 
IsValidKey(const std::string & key)108 bool AccessibilitySettingProvider::IsValidKey(const std::string& key)
109 {
110     HILOG_DEBUG("start.");
111     (void)key;
112     return true;
113 }
114 
CreateObserver(const std::string & key,AccessibilitySettingObserver::UpdateFunc & func)115 sptr<AccessibilitySettingObserver> AccessibilitySettingProvider::CreateObserver(const std::string& key,
116     AccessibilitySettingObserver::UpdateFunc& func)
117 {
118     HILOG_DEBUG("start.");
119     (void)key;
120     (void)func;
121     return nullptr;
122 }
123 
RegisterObserver(const sptr<AccessibilitySettingObserver> & observer)124 ErrCode AccessibilitySettingProvider::RegisterObserver(const sptr<AccessibilitySettingObserver>& observer)
125 {
126     HILOG_DEBUG("start.");
127     (void)observer;
128     return ERR_OK;
129 }
130 
UnregisterObserver(const sptr<AccessibilitySettingObserver> & observer)131 ErrCode AccessibilitySettingProvider::UnregisterObserver(const sptr<AccessibilitySettingObserver>& observer)
132 {
133     HILOG_DEBUG("start.");
134     (void)observer;
135     return ERR_OK;
136 }
137 
Initialize(int32_t systemAbilityId)138 void AccessibilitySettingProvider::Initialize(int32_t systemAbilityId)
139 {
140     HILOG_DEBUG("start.");
141     (void)systemAbilityId;
142 }
143 
GetStringValue(const std::string & key,std::string & value)144 ErrCode AccessibilitySettingProvider::GetStringValue(const std::string& key, std::string& value)
145 {
146     HILOG_DEBUG("start.");
147     (void)key;
148     (void)value;
149     return ERR_OK;
150 }
151 
PutStringValue(const std::string & key,const std::string & value,bool needNotify)152 ErrCode AccessibilitySettingProvider::PutStringValue
153     (const std::string& key, const std::string& value, bool needNotify)
154 {
155     HILOG_DEBUG("start.");
156     (void)key;
157     (void)value;
158     (void)needNotify;
159     return ERR_OK;
160 }
161 
CreateDataShareHelper()162 std::shared_ptr<DataShare::DataShareHelper> AccessibilitySettingProvider::CreateDataShareHelper()
163 {
164     HILOG_DEBUG("start.");
165     return nullptr;
166 }
167 
ReleaseDataShareHelper(std::shared_ptr<DataShare::DataShareHelper> & helper)168 bool AccessibilitySettingProvider::ReleaseDataShareHelper(std::shared_ptr<DataShare::DataShareHelper>& helper)
169 {
170     HILOG_DEBUG("start.");
171     (void)helper;
172     return true;
173 }
174 
AssembleUri(const std::string & key)175 Uri AccessibilitySettingProvider::AssembleUri(const std::string& key)
176 {
177     HILOG_DEBUG("start.");
178     (void)key;
179     Uri uri(SETTING_URI_PROXY + "&key=" + "ok");
180     return uri;
181 }
182 } // namespace Accessibility
183 } // namespace OHOS