Function:1、using Preference for user setting; 2、read capbility from BMS

Signed-off-by: yichengzhao <yichengzhao1@huawei.com>
This commit is contained in:
yichengzhao 2022-03-02 19:23:11 +08:00
parent 3330661b7f
commit 97d6fda7ea
3 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AAMS_MOCK_PATH = "//base/accessibility/services/test/mock"
aams_mock_distributeddatamgr_src = [
"$AAMS_MOCK_PATH/distributeddatamgr/src/mock_preferences_helper.cpp",
]

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MOCK_PREFERENCES_HELPER_H
#define MOCK_PREFERENCES_HELPER_H
#include "preferences_helper.h"
namespace OHOS {
namespace NativePreferences {
class MockPreferencesHelper : public PreferencesHelper {
public:
};
} // NativePreferences
} // OHOS
#endif // MOCK_PREFERENCES_HELPER_H

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mock_preferences_helper.h"
namespace OHOS {
namespace NativePreferences {
std::map<std::string, std::shared_ptr<Preferences>> PreferencesHelper::prefsCache_;
std::mutex PreferencesHelper::prefsCacheMutex_;
std::string PreferencesHelper::GetRealPath(const std::string &path, int &errorCode)
{
return "";
}
std::shared_ptr<Preferences> PreferencesHelper::GetPreferences(const std::string &path, int &errCode)
{
return nullptr;
}
int PreferencesHelper::DeletePreferences(const std::string &path)
{
return 0;
}
int PreferencesHelper::RemovePreferencesFromCache(const std::string &path)
{
return 0;
}
} // namespace NativePreferences
} // namespace OHOS