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 "feature/feature_system.h"
17 namespace OHOS {
18 namespace DistributedData {
GetInstance()19 FeatureSystem &FeatureSystem::GetInstance()
20 {
21 static FeatureSystem instance;
22 return instance;
23 }
24
RegisterCreator(const std::string & name,Creator creator)25 int32_t FeatureSystem::RegisterCreator(const std::string &name, Creator creator)
26 {
27 creators_.InsertOrAssign(name, std::move(creator));
28 return STUB_SUCCESS;
29 }
30
GetCreator(const std::string & name)31 FeatureSystem::Creator FeatureSystem::GetCreator(const std::string &name)
32 {
33 auto it = creators_.Find(name);
34 if (it.first) {
35 return it.second;
36 }
37 return nullptr;
38 }
39
~Feature()40 FeatureSystem::Feature::~Feature()
41 {
42 }
43
OnInitialize()44 int32_t FeatureSystem::Feature::OnInitialize()
45 {
46 return STUB_SUCCESS;
47 }
48
OnAppExit(pid_t uid,pid_t pid,uint32_t tokenId,const std::string & bundleName)49 int32_t FeatureSystem::Feature::OnAppExit(pid_t uid, pid_t pid, uint32_t tokenId, const std::string &bundleName)
50 {
51 return STUB_SUCCESS;
52 }
53
OnAppUninstall(const std::string & bundleName,int32_t user,int32_t index,uint32_t tokenId)54 int32_t FeatureSystem::Feature::OnAppUninstall(const std::string &bundleName, int32_t user, int32_t index,
55 uint32_t tokenId)
56 {
57 return STUB_SUCCESS;
58 }
59
ResolveAutoLaunch(const std::string & identifier,DistributedDB::AutoLaunchParam & param)60 int32_t FeatureSystem::Feature::ResolveAutoLaunch(const std::string &identifier, DistributedDB::AutoLaunchParam ¶m)
61 {
62 return STUB_SUCCESS;
63 }
64
OnUserChange(uint32_t code,const std::string & user,const std::string & account)65 int32_t FeatureSystem::Feature::OnUserChange(uint32_t code, const std::string &user, const std::string &account)
66 {
67 return STUB_SUCCESS;
68 }
69
Online(const std::string & device)70 int32_t FeatureSystem::Feature::Online(const std::string &device)
71 {
72 return STUB_SUCCESS;
73 }
74
Offline(const std::string & device)75 int32_t FeatureSystem::Feature::Offline(const std::string &device)
76 {
77 return STUB_SUCCESS;
78 }
79
OnReady(const std::string & device)80 int32_t FeatureSystem::Feature::OnReady(const std::string &device)
81 {
82 return STUB_SUCCESS;
83 }
84 }
85 }