• 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 <gtest/gtest.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     instance_ = nullptr;
31     remoteObj_ = nullptr;
32 }
33 
GetInstance(int32_t systemAbilityId)34 AccessibilitySettingProvider& AccessibilitySettingProvider::GetInstance(int32_t systemAbilityId)
35 {
36     if (instance_ == nullptr) {
37         instance_ = new AccessibilitySettingProvider();
38     }
39     return *instance_;
40 }
41 
DeleteInstance()42 void AccessibilitySettingProvider::DeleteInstance()
43 {
44 }
45 
GetIntValue(const std::string & key,int32_t & value)46 ErrCode AccessibilitySettingProvider::GetIntValue(const std::string& key, int32_t& value)
47 {
48     (void)key;
49     (void)value;
50     return ERR_OK;
51 }
52 
GetLongValue(const std::string & key,int64_t & value)53 ErrCode AccessibilitySettingProvider::GetLongValue(const std::string& key, int64_t& value)
54 {
55     (void)key;
56     (void)value;
57     return ERR_OK;
58 }
59 
GetBoolValue(const std::string & key,bool & value)60 ErrCode AccessibilitySettingProvider::GetBoolValue(const std::string& key, bool& value)
61 {
62     (void)key;
63     (void)value;
64     return ERR_OK;
65 }
66 
GetFloatValue(const std::string & key,float & value)67 ErrCode AccessibilitySettingProvider::GetFloatValue(const std::string& key, float& value)
68 {
69     (void)key;
70     (void)value;
71     return ERR_OK;
72 }
73 
PutIntValue(const std::string & key,int32_t value,bool needNotify)74 ErrCode AccessibilitySettingProvider::PutIntValue(const std::string& key, int32_t value, bool needNotify)
75 {
76     (void)key;
77     (void)value;
78     (void)needNotify;
79     return ERR_OK;
80 }
81 
PutLongValue(const std::string & key,int64_t value,bool needNotify)82 ErrCode AccessibilitySettingProvider::PutLongValue(const std::string& key, int64_t value, bool needNotify)
83 {
84     (void)key;
85     (void)value;
86     (void)needNotify;
87     return ERR_OK;
88 }
89 
PutBoolValue(const std::string & key,bool value,bool needNotify)90 ErrCode AccessibilitySettingProvider::PutBoolValue(const std::string& key, bool value, bool needNotify)
91 {
92     (void)key;
93     (void)value;
94     (void)needNotify;
95     return ERR_OK;
96 }
97 
IsValidKey(const std::string & key)98 bool AccessibilitySettingProvider::IsValidKey(const std::string& key)
99 {
100     (void)key;
101     return true;
102 }
103 
CreateObserver(const std::string & key,AccessibilitySettingObserver::UpdateFunc & func)104 sptr<AccessibilitySettingObserver> AccessibilitySettingProvider::CreateObserver(const std::string& key,
105     AccessibilitySettingObserver::UpdateFunc& func)
106 {
107     (void)key;
108     (void)func;
109     return nullptr;
110 }
111 
RegisterObserver(const sptr<AccessibilitySettingObserver> & observer)112 ErrCode AccessibilitySettingProvider::RegisterObserver(const sptr<AccessibilitySettingObserver>& observer)
113 {
114     (void)observer;
115     return ERR_OK;
116 }
117 
UnregisterObserver(const sptr<AccessibilitySettingObserver> & observer)118 ErrCode AccessibilitySettingProvider::UnregisterObserver(const sptr<AccessibilitySettingObserver>& observer)
119 {
120     (void)observer;
121     return ERR_OK;
122 }
123 
Initialize(int32_t systemAbilityId)124 void AccessibilitySettingProvider::Initialize(int32_t systemAbilityId)
125 {
126     (void)systemAbilityId;
127 }
128 
GetStringValue(const std::string & key,std::string & value)129 ErrCode AccessibilitySettingProvider::GetStringValue(const std::string& key, std::string& value)
130 {
131     (void)key;
132     (void)value;
133     return ERR_OK;
134 }
135 
PutStringValue(const std::string & key,const std::string & value,bool needNotify)136 ErrCode AccessibilitySettingProvider::PutStringValue
137     (const std::string& key, const std::string& value, bool needNotify)
138 {
139     (void)key;
140     (void)value;
141     (void)needNotify;
142     return ERR_OK;
143 }
144 
CreateDataShareHelper()145 std::shared_ptr<DataShare::DataShareHelper> AccessibilitySettingProvider::CreateDataShareHelper()
146 {
147     return nullptr;
148 }
149 
ReleaseDataShareHelper(std::shared_ptr<DataShare::DataShareHelper> & helper)150 bool AccessibilitySettingProvider::ReleaseDataShareHelper(std::shared_ptr<DataShare::DataShareHelper>& helper)
151 {
152     (void)helper;
153     return true;
154 }
155 
AssembleUri(const std::string & key)156 Uri AccessibilitySettingProvider::AssembleUri(const std::string& key)
157 {
158     (void)key;
159     Uri uri(SETTING_URI_PROXY + "&key=" + "ok");
160     return uri;
161 }
162 } // namespace Accessibility
163 } // namespace OHOS