• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 "module_ipc/svc_session_manager.h"
17 
18 #include "b_error/b_error.h"
19 #include "svc_session_manager_mock.h"
20 
21 namespace OHOS::FileManagement::Backup {
22 using namespace std;
23 
VerifyCallerAndScenario(uint32_t,IServiceReverse::Scenario) const24 ErrCode SvcSessionManager::VerifyCallerAndScenario(uint32_t, IServiceReverse::Scenario) const
25 {
26     return BError(BError::Codes::OK);
27 }
28 
Active(Impl newImpl,bool force)29 ErrCode SvcSessionManager::Active(Impl newImpl, bool force)
30 {
31     return BSvcSessionManager::sessionManager->Active(newImpl, force);
32 }
33 
Deactive(const wptr<IRemoteObject> &,bool)34 ErrCode SvcSessionManager::Deactive(const wptr<IRemoteObject> &, bool)
35 {
36     return BError(BError::Codes::OK);
37 }
38 
VerifyBundleName(string & bundleName)39 ErrCode SvcSessionManager::VerifyBundleName(string &bundleName)
40 {
41     return BError(BError::Codes::OK);
42 }
43 
GetServiceReverseProxy()44 sptr<IServiceReverse> SvcSessionManager::GetServiceReverseProxy()
45 {
46     return BSvcSessionManager::sessionManager->GetServiceReverseProxy();
47 }
48 
GetScenario()49 IServiceReverse::Scenario SvcSessionManager::GetScenario()
50 {
51     return BSvcSessionManager::sessionManager->GetScenario();
52 }
53 
OnBundleFileReady(const string & bundleName,const string & fileName)54 bool SvcSessionManager::OnBundleFileReady(const string &bundleName, const string &fileName)
55 {
56     return BSvcSessionManager::sessionManager->OnBundleFileReady(bundleName, fileName);
57 }
58 
OnBundleExtManageInfo(const string & bundleName,UniqueFd fd)59 UniqueFd SvcSessionManager::OnBundleExtManageInfo(const string &bundleName, UniqueFd fd)
60 {
61     return BSvcSessionManager::sessionManager->OnBundleExtManageInfo(bundleName, std::move(fd));
62 }
63 
RemoveExtInfo(const string &)64 void SvcSessionManager::RemoveExtInfo(const string &) {}
65 
GetExtConnection(const BundleName & bundleName)66 wptr<SvcBackupConnection> SvcSessionManager::GetExtConnection(const BundleName &bundleName)
67 {
68     return BSvcSessionManager::sessionManager->GetExtConnection(bundleName);
69 }
70 
GetBackupAbilityExt(const string & bundleName)71 sptr<SvcBackupConnection> SvcSessionManager::GetBackupAbilityExt(const string &bundleName)
72 {
73     return nullptr;
74 }
75 
DumpInfo(const int,const std::vector<std::u16string> &)76 void SvcSessionManager::DumpInfo(const int, const std::vector<std::u16string> &) {}
77 
InitClient(Impl &)78 ErrCode SvcSessionManager::InitClient(Impl &)
79 {
80     return BError(BError::Codes::OK);
81 }
82 
SetExtFileNameRequest(const string & bundleName,const string &)83 void SvcSessionManager::SetExtFileNameRequest(const string &bundleName, const string &) {}
84 
GetExtFileNameRequest(const std::string & bundleName)85 std::set<std::string> SvcSessionManager::GetExtFileNameRequest(const std::string &bundleName)
86 {
87     return BSvcSessionManager::sessionManager->GetExtFileNameRequest(bundleName);
88 }
89 
GetBackupExtNameMap(const string &)90 std::tuple<bool, std::map<BundleName, BackupExtInfo>::iterator> SvcSessionManager::GetBackupExtNameMap(const string &)
91 {
92     return {};
93 }
94 
GetSchedBundleName(string & bundleName)95 bool SvcSessionManager::GetSchedBundleName(string &bundleName)
96 {
97     return BSvcSessionManager::sessionManager->GetSchedBundleName(bundleName);
98 }
99 
GetServiceSchedAction(const std::string & bundleName)100 BConstants::ServiceSchedAction SvcSessionManager::GetServiceSchedAction(const std::string &bundleName)
101 {
102     return BSvcSessionManager::sessionManager->GetServiceSchedAction(bundleName);
103 }
104 
SetServiceSchedAction(const string &,BConstants::ServiceSchedAction)105 void SvcSessionManager::SetServiceSchedAction(const string &, BConstants::ServiceSchedAction) {}
106 
GetBackupExtName(const string & bundleName)107 string SvcSessionManager::GetBackupExtName(const string &bundleName)
108 {
109     return BSvcSessionManager::sessionManager->GetBackupExtName(bundleName);
110 }
111 
SetBackupExtInfo(const string &,const string &)112 void SvcSessionManager::SetBackupExtInfo(const string &, const string &) {}
113 
GetBackupExtInfo(const string & bundleName)114 std::string SvcSessionManager::GetBackupExtInfo(const string &bundleName)
115 {
116     return BSvcSessionManager::sessionManager->GetBackupExtInfo(bundleName);
117 }
118 
SetBackupExtName(const string &,const string &)119 void SvcSessionManager::SetBackupExtName(const string &, const string &) {}
120 
GetSAExtConnection(const BundleName & bundleName)121 std::weak_ptr<SABackupConnection> SvcSessionManager::GetSAExtConnection(const BundleName &bundleName)
122 {
123     return BSvcSessionManager::sessionManager->GetSAExtConnection(bundleName);
124 }
125 
GetBundleUserId(const string & bundleName)126 int32_t SvcSessionManager::GetBundleUserId(const string &bundleName)
127 {
128     return 0;
129 }
130 
SetBundleUserId(const string & bundleName,const int32_t userId)131 void SvcSessionManager::SetBundleUserId(const string &bundleName, const int32_t userId) {}
132 
AppendBundles(const vector<BundleName> &,vector<BundleName> &)133 void SvcSessionManager::AppendBundles(const vector<BundleName> &, vector<BundleName> &) {}
134 
CreateBackupConnection(BundleName & bundleName)135 sptr<SvcBackupConnection> SvcSessionManager::CreateBackupConnection(BundleName &bundleName)
136 {
137     return BSvcSessionManager::sessionManager->CreateBackupConnection(bundleName);
138 }
139 
Start()140 ErrCode SvcSessionManager::Start()
141 {
142     return BError(BError::Codes::OK);
143 }
144 
Finish()145 ErrCode SvcSessionManager::Finish()
146 {
147     return BError(BError::Codes::OK);
148 }
149 
IsOnAllBundlesFinished()150 bool SvcSessionManager::IsOnAllBundlesFinished()
151 {
152     return BSvcSessionManager::sessionManager->IsOnAllBundlesFinished();
153 }
154 
IsOnOnStartSched()155 bool SvcSessionManager::IsOnOnStartSched()
156 {
157     return BSvcSessionManager::sessionManager->IsOnOnStartSched();
158 }
159 
NeedToUnloadService()160 bool SvcSessionManager::NeedToUnloadService()
161 {
162     return BSvcSessionManager::sessionManager->NeedToUnloadService();
163 }
164 
GetSessionUserId()165 int32_t SvcSessionManager::GetSessionUserId()
166 {
167     return BSvcSessionManager::sessionManager->GetSessionUserId();
168 }
169 
SetSessionUserId(int32_t)170 void SvcSessionManager::SetSessionUserId(int32_t) {}
171 
GetSessionCallerName()172 std::string SvcSessionManager::GetSessionCallerName()
173 {
174     return BSvcSessionManager::sessionManager->GetSessionCallerName();
175 }
176 
GetSessionActiveTime()177 std::string SvcSessionManager::GetSessionActiveTime()
178 {
179     return BSvcSessionManager::sessionManager->GetSessionActiveTime();
180 }
181 
182 
SetBundleRestoreType(const std::string &,RestoreTypeEnum)183 void SvcSessionManager::SetBundleRestoreType(const std::string &, RestoreTypeEnum) {}
184 
GetBundleRestoreType(const std::string & bundleName)185 RestoreTypeEnum SvcSessionManager::GetBundleRestoreType(const std::string &bundleName)
186 {
187     return BSvcSessionManager::sessionManager->GetBundleRestoreType(bundleName);
188 }
189 
SetBundleVersionCode(const std::string &,int64_t)190 void SvcSessionManager::SetBundleVersionCode(const std::string &, int64_t) {}
191 
GetBundleVersionCode(const std::string & bundleName)192 int64_t SvcSessionManager::GetBundleVersionCode(const std::string &bundleName)
193 {
194     return BSvcSessionManager::sessionManager->GetBundleVersionCode(bundleName);
195 }
196 
SetBundleVersionName(const std::string &,std::string)197 void SvcSessionManager::SetBundleVersionName(const std::string &, std::string) {}
198 
GetBundleVersionName(const std::string & bundleName)199 std::string SvcSessionManager::GetBundleVersionName(const std::string &bundleName)
200 {
201     return BSvcSessionManager::sessionManager->GetBundleVersionName(bundleName);
202 }
203 
SetBundleDataSize(const std::string &,int64_t)204 void SvcSessionManager::SetBundleDataSize(const std::string &, int64_t) {}
205 
StartFwkTimer(const std::string & bundleName,const Utils::Timer::TimerCallback & callback)206 bool SvcSessionManager::StartFwkTimer(const std::string &bundleName, const Utils::Timer::TimerCallback &callback)
207 {
208     return BSvcSessionManager::sessionManager->StartFwkTimer(bundleName, callback);
209 }
210 
StopFwkTimer(const std::string & bundleName)211 bool SvcSessionManager::StopFwkTimer(const std::string &bundleName)
212 {
213     return BSvcSessionManager::sessionManager->StopFwkTimer(bundleName);
214 }
215 
StartExtTimer(const std::string & bundleName,const Utils::Timer::TimerCallback & callback)216 bool SvcSessionManager::StartExtTimer(const std::string &bundleName, const Utils::Timer::TimerCallback &callback)
217 {
218     return BSvcSessionManager::sessionManager->StartExtTimer(bundleName, callback);
219 }
220 
StopExtTimer(const std::string & bundleName)221 bool SvcSessionManager::StopExtTimer(const std::string &bundleName)
222 {
223     return BSvcSessionManager::sessionManager->StopExtTimer(bundleName);
224 }
225 
UpdateTimer(const std::string & bundleName,uint32_t timeOut,const Utils::Timer::TimerCallback & callback)226 bool SvcSessionManager::UpdateTimer(const std::string &bundleName, uint32_t timeOut,
227     const Utils::Timer::TimerCallback &callback)
228 {
229     return BSvcSessionManager::sessionManager->UpdateTimer(bundleName, timeOut, callback);
230 }
231 
GetMemParaCurSize()232 int32_t SvcSessionManager::GetMemParaCurSize()
233 {
234     return BSvcSessionManager::sessionManager->GetMemParaCurSize();
235 }
236 
SetMemParaCurSize(int32_t)237 void SvcSessionManager::SetMemParaCurSize(int32_t) {}
238 
GetIsIncrementalBackup()239 bool SvcSessionManager::GetIsIncrementalBackup()
240 {
241     return BSvcSessionManager::sessionManager->GetIsIncrementalBackup();
242 }
243 
ValidRestoreDataType(RestoreTypeEnum restoreDataType)244 bool SvcSessionManager::ValidRestoreDataType(RestoreTypeEnum restoreDataType)
245 {
246     return BSvcSessionManager::sessionManager->ValidRestoreDataType(restoreDataType);
247 }
248 
GetTimeoutValue(const std::string & bundleName)249 uint32_t SvcSessionManager::GetTimeoutValue(const std::string &bundleName)
250 {
251     return BSvcSessionManager::sessionManager->GetTimeoutValue(bundleName);
252 }
253 
SetIncrementalData(const BIncrementalData &)254 void SvcSessionManager::SetIncrementalData(const BIncrementalData &) {}
255 
GetIncrementalManifestFd(const string & bundleName)256 int32_t SvcSessionManager::GetIncrementalManifestFd(const string &bundleName)
257 {
258     return BSvcSessionManager::sessionManager->GetIncrementalManifestFd(bundleName);
259 }
260 
GetLastIncrementalTime(const string & bundleName)261 int64_t SvcSessionManager::GetLastIncrementalTime(const string &bundleName)
262 {
263     return BSvcSessionManager::sessionManager->GetLastIncrementalTime(bundleName);
264 }
265 
SetClearDataFlag(const std::string &,bool)266 void SvcSessionManager::SetClearDataFlag(const std::string &, bool) {}
267 
GetClearDataFlag(const std::string & bundleName)268 bool SvcSessionManager::GetClearDataFlag(const std::string &bundleName)
269 {
270     return BSvcSessionManager::sessionManager->GetClearDataFlag(bundleName);
271 }
272 
IncreaseSessionCnt(const std::string)273 void SvcSessionManager::IncreaseSessionCnt(const std::string) {}
274 
DecreaseSessionCnt(const std::string)275 void SvcSessionManager::DecreaseSessionCnt(const std::string) {}
276 
SetPublishFlag(const std::string &)277 void SvcSessionManager::SetPublishFlag(const std::string&) {}
278 
CleanAndCheckIfNeedWait(ErrCode & ret,std::vector<std::string> & bundleNameList)279 bool SvcSessionManager::CleanAndCheckIfNeedWait(ErrCode &ret, std::vector<std::string> &bundleNameList)
280 {
281     return BSvcSessionManager::sessionManager->CleanAndCheckIfNeedWait(ret, bundleNameList);
282 }
283 
ClearSessionData()284 ErrCode SvcSessionManager::ClearSessionData()
285 {
286     return BSvcSessionManager::sessionManager->ClearSessionData();
287 }
288 
GetSessionCnt()289 int SvcSessionManager::GetSessionCnt()
290 {
291     return BSvcSessionManager::sessionManager->GetSessionCnt();
292 }
293 
GetImpl()294 SvcSessionManager::Impl SvcSessionManager::GetImpl()
295 {
296     return BSvcSessionManager::sessionManager->GetImpl();
297 }
298 
SetImplRestoreType(const RestoreTypeEnum restoreType)299 void SvcSessionManager::SetImplRestoreType(const RestoreTypeEnum restoreType) {}
300 
SetIsReadyLaunch(const std::string &)301 void SvcSessionManager::SetIsReadyLaunch(const std::string&) {}
302 
SetOldBackupVersion(const std::string & backupVersion)303 void SvcSessionManager::SetOldBackupVersion(const std::string &backupVersion) {}
304 
GetOldBackupVersion()305 std::string SvcSessionManager::GetOldBackupVersion()
306 {
307     return BSvcSessionManager::sessionManager->GetOldBackupVersion();
308 }
309 } // namespace OHOS::FileManagement::Backup
310