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