• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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/service.h"
17 
18 #include <algorithm>
19 #include <cerrno>
20 #include <cstring>
21 #include <gtest/gtest.h>
22 
23 #include "b_error/b_error.h"
24 #include "b_resources/b_constants.h"
25 
26 namespace OHOS::FileManagement::Backup {
27 using namespace std;
28 
OnStart()29 void Service::OnStart() {}
30 
OnStop()31 void Service::OnStop() {}
32 
GetLocalCapabilities()33 UniqueFd Service::GetLocalCapabilities()
34 {
35     return UniqueFd(-1);
36 }
37 
StopAll(const wptr<IRemoteObject> & obj,bool force)38 void Service::StopAll(const wptr<IRemoteObject> &obj, bool force) {}
39 
VerifyCallerAndGetCallerName()40 string Service::VerifyCallerAndGetCallerName()
41 {
42     return "";
43 }
44 
InitRestoreSession(sptr<IServiceReverse> remote)45 ErrCode Service::InitRestoreSession(sptr<IServiceReverse> remote)
46 {
47     return BError(BError::Codes::OK);
48 }
49 
InitBackupSession(sptr<IServiceReverse> remote)50 ErrCode Service::InitBackupSession(sptr<IServiceReverse> remote)
51 {
52     return BError(BError::Codes::OK);
53 }
54 
Start()55 ErrCode Service::Start()
56 {
57     return BError(BError::Codes::OK);
58 }
59 
PublishFile(const BFileInfo & fileInfo)60 ErrCode Service::PublishFile(const BFileInfo &fileInfo)
61 {
62     return BError(BError::Codes::OK);
63 }
64 
AppFileReady(const string & fileName,UniqueFd fd)65 ErrCode Service::AppFileReady(const string &fileName, UniqueFd fd)
66 {
67     return BError(BError::Codes::OK);
68 }
69 
AppDone(ErrCode errCode)70 ErrCode Service::AppDone(ErrCode errCode)
71 {
72     return BError(BError::Codes::OK);
73 }
74 
AppendBundlesRestoreSession(UniqueFd fd,const std::vector<BundleName> & bundleNames,RestoreTypeEnum restoreType,int32_t userId)75 ErrCode Service::AppendBundlesRestoreSession(UniqueFd fd,
76                                              const std::vector<BundleName> &bundleNames,
77                                              RestoreTypeEnum restoreType,
78                                              int32_t userId)
79 {
80     return BError(BError::Codes::OK);
81 }
82 
AppendBundlesBackupSession(const std::vector<BundleName> & bundleNames)83 ErrCode Service::AppendBundlesBackupSession(const std::vector<BundleName> &bundleNames)
84 {
85     return BError(BError::Codes::OK);
86 }
87 
Finish()88 ErrCode Service::Finish()
89 {
90     return BError(BError::Codes::OK);
91 }
92 
LaunchBackupExtension(const BundleName & bundleName)93 ErrCode Service::LaunchBackupExtension(const BundleName &bundleName)
94 {
95     return BError(BError::Codes::OK);
96 }
97 
GetFileHandle(const string & bundleName,const string & fileName)98 ErrCode Service::GetFileHandle(const string &bundleName, const string &fileName)
99 {
100     return BError(BError::Codes::OK);
101 }
102 
OnBackupExtensionDied(const string && bundleName)103 void Service::OnBackupExtensionDied(const string &&bundleName) {}
104 
ExtConnectDied(const string & callName)105 void Service::ExtConnectDied(const string &callName) {}
106 
ExtStart(const string & bundleName)107 void Service::ExtStart(const string &bundleName) {}
108 
Dump(int fd,const vector<u16string> & args)109 int Service::Dump(int fd, const vector<u16string> &args)
110 {
111     return 0;
112 }
113 
ExtConnectFailed(const string & bundleName,ErrCode ret)114 void Service::ExtConnectFailed(const string &bundleName, ErrCode ret)
115 {
116     GTEST_LOG_(INFO) << "ExtConnectFailed is OK";
117 }
118 
ExtConnectDone(string bundleName)119 void Service::ExtConnectDone(string bundleName) {}
120 
ClearSessionAndSchedInfo(const string & bundleName)121 void Service::ClearSessionAndSchedInfo(const string &bundleName) {}
122 
VerifyCaller()123 void Service::VerifyCaller() {}
124 
VerifyCaller(IServiceReverse::Scenario scenario)125 void Service::VerifyCaller(IServiceReverse::Scenario scenario) {}
126 
OnAllBundlesFinished(ErrCode errCode)127 void Service::OnAllBundlesFinished(ErrCode errCode) {}
128 
OnStartSched()129 void Service::OnStartSched() {}
130 
SendAppGalleryNotify(const BundleName & bundleName)131 void Service::SendAppGalleryNotify(const BundleName &bundleName) {}
132 
SessionDeactive()133 void Service::SessionDeactive() {}
134 
Release()135 ErrCode Service::Release()
136 {
137     return BError(BError::Codes::OK);
138 }
139 
GetLocalCapabilitiesIncremental(const std::vector<BIncrementalData> & bundleNames)140 UniqueFd Service::GetLocalCapabilitiesIncremental(const std::vector<BIncrementalData> &bundleNames)
141 {
142     return UniqueFd(-1);
143 }
144 
InitIncrementalBackupSession(sptr<IServiceReverse> remote)145 ErrCode Service::InitIncrementalBackupSession(sptr<IServiceReverse> remote)
146 {
147     return BError(BError::Codes::OK);
148 }
149 
AppendBundlesIncrementalBackupSession(const std::vector<BIncrementalData> & bundlesToBackup)150 ErrCode Service::AppendBundlesIncrementalBackupSession(const std::vector<BIncrementalData> &bundlesToBackup)
151 {
152     return BError(BError::Codes::OK);
153 }
154 
PublishIncrementalFile(const BFileInfo & fileInfo)155 ErrCode Service::PublishIncrementalFile(const BFileInfo &fileInfo)
156 {
157     return BError(BError::Codes::OK);
158 }
159 
AppIncrementalFileReady(const string & fileName,UniqueFd fd,UniqueFd manifestFd)160 ErrCode Service::AppIncrementalFileReady(const string &fileName, UniqueFd fd, UniqueFd manifestFd)
161 {
162     return BError(BError::Codes::OK);
163 }
164 
AppIncrementalDone(ErrCode errCode)165 ErrCode Service::AppIncrementalDone(ErrCode errCode)
166 {
167     return BError(BError::Codes::OK);
168 }
169 
GetIncrementalFileHandle(const string & bundleName,const string & fileName)170 ErrCode Service::GetIncrementalFileHandle(const string &bundleName, const string &fileName)
171 {
172     return BError(BError::Codes::OK);
173 }
174 } // namespace OHOS::FileManagement::Backup
175