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