• 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 "accessibility_datashare_helper.h"
18 #include "hilog_wrapper.h"
19 
20 namespace OHOS {
21 namespace Accessibility {
22 AccessibilitySettingProvider* AccessibilitySettingProvider::instance_;
23 std::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     HILOG_DEBUG("start.");
36     instance_ = nullptr;
37 }
38 
GetInstance(int32_t systemAbilityId)39 AccessibilitySettingProvider& AccessibilitySettingProvider::GetInstance(int32_t systemAbilityId)
40 {
41     HILOG_DEBUG("start.");
42     if (instance_ == nullptr) {
43         instance_ = new AccessibilitySettingProvider();
44     }
45     return *instance_;
46 }
47 
DeleteInstance()48 void AccessibilitySettingProvider::DeleteInstance()
49 {
50     HILOG_DEBUG("start.");
51 }
52 
GetIntValue(const std::string & key,int32_t & value)53 RetError AccessibilitySettingProvider::GetIntValue(const std::string& key, int32_t& value)
54 {
55     HILOG_DEBUG("start.");
56     (void)key;
57     (void)value;
58     return RET_OK;
59 }
60 
GetLongValue(const std::string & key,int64_t & value)61 RetError AccessibilitySettingProvider::GetLongValue(const std::string& key, int64_t& value)
62 {
63     HILOG_DEBUG("start.");
64     (void)key;
65     (void)value;
66     return RET_OK;
67 }
68 
GetBoolValue(const std::string & key,bool & value)69 RetError AccessibilitySettingProvider::GetBoolValue(const std::string& key, bool& value)
70 {
71     HILOG_DEBUG("start.");
72     (void)key;
73     (void)value;
74     return RET_OK;
75 }
76 
GetFloatValue(const std::string & key,float & value)77 RetError AccessibilitySettingProvider::GetFloatValue(const std::string& key, float& value)
78 {
79     HILOG_DEBUG("start.");
80     (void)key;
81     (void)value;
82     return RET_OK;
83 }
84 
PutIntValue(const std::string & key,int32_t value,bool needNotify)85 RetError AccessibilitySettingProvider::PutIntValue(const std::string& key, int32_t value, bool needNotify)
86 {
87     HILOG_DEBUG("start.");
88     (void)key;
89     (void)value;
90     (void)needNotify;
91     return RET_OK;
92 }
93 
PutLongValue(const std::string & key,int64_t value,bool needNotify)94 RetError AccessibilitySettingProvider::PutLongValue(const std::string& key, int64_t value, bool needNotify)
95 {
96     HILOG_DEBUG("start.");
97     (void)key;
98     (void)value;
99     (void)needNotify;
100     return RET_OK;
101 }
102 
PutBoolValue(const std::string & key,bool value,bool needNotify)103 RetError AccessibilitySettingProvider::PutBoolValue(const std::string& key, bool value, bool needNotify)
104 {
105     HILOG_DEBUG("start.");
106     (void)key;
107     (void)value;
108     (void)needNotify;
109     return RET_OK;
110 }
111 
CreateObserver(const std::string & key,AccessibilitySettingObserver::UpdateFunc & func)112 sptr<AccessibilitySettingObserver> AccessibilitySettingProvider::CreateObserver(const std::string& key,
113     AccessibilitySettingObserver::UpdateFunc& func)
114 {
115     HILOG_DEBUG("start.");
116     (void)key;
117     (void)func;
118     return nullptr;
119 }
120 
RegisterObserver(const std::string & key,AccessibilitySettingObserver::UpdateFunc & func)121 RetError AccessibilitySettingProvider::RegisterObserver(const std::string& key,
122     AccessibilitySettingObserver::UpdateFunc& func)
123 {
124     (void)key;
125     (void)func;
126     return RET_OK;
127 }
128 
UnregisterObserver(const std::string & key)129 RetError AccessibilitySettingProvider::UnregisterObserver(const std::string& key)
130 {
131     (void)key;
132     return RET_OK;
133 }
134 
GetStringValue(const std::string & key,std::string & value)135 RetError AccessibilitySettingProvider::GetStringValue(const std::string& key, std::string& value)
136 {
137     HILOG_DEBUG("start.");
138     (void)key;
139     (void)value;
140     return RET_OK;
141 }
142 
PutStringValue(const std::string & key,const std::string & value,bool needNotify)143 RetError AccessibilitySettingProvider::PutStringValue
144     (const std::string& key, const std::string& value, bool needNotify)
145 {
146     HILOG_DEBUG("start.");
147     (void)key;
148     (void)value;
149     (void)needNotify;
150     return RET_OK;
151 }
152 } // namespace Accessibility
153 } // namespace OHOS