1 /*
2  * Copyright (c) 2021-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 "installd_client.h"
17 
18 #include "bundle_constants.h"
19 #include "installd_death_recipient.h"
20 #include "system_ability_definition.h"
21 #include "system_ability_helper.h"
22 
23 namespace OHOS {
24 namespace AppExecFwk {
CreateBundleDir(const std::string &bundleDir)25 ErrCode InstalldClient::CreateBundleDir(const std::string &bundleDir)
26 {
27     if (bundleDir.empty()) {
28         APP_LOGE("bundle dir is empty");
29         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
30     }
31 
32     return CallService(&IInstalld::CreateBundleDir, bundleDir);
33 }
34 
ExtractModuleFiles(const std::string &srcModulePath, const std::string &targetPath, const std::string &targetSoPath, const std::string &cpuAbi)35 ErrCode InstalldClient::ExtractModuleFiles(const std::string &srcModulePath, const std::string &targetPath,
36     const std::string &targetSoPath, const std::string &cpuAbi)
37 {
38     if (srcModulePath.empty() || targetPath.empty()) {
39         APP_LOGE("src module path or target path is empty");
40         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
41     }
42 
43     return CallService(&IInstalld::ExtractModuleFiles, srcModulePath, targetPath, targetSoPath, cpuAbi);
44 }
45 
ExtractFiles(const ExtractParam &extractParam)46 ErrCode InstalldClient::ExtractFiles(const ExtractParam &extractParam)
47 {
48     if (extractParam.srcPath.empty() || extractParam.targetPath.empty()) {
49         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
50     }
51     return CallService(&IInstalld::ExtractFiles, extractParam);
52 }
53 
ExtractHnpFiles(const std::string &hnpPackageInfo, const ExtractParam &extractParam)54 ErrCode InstalldClient::ExtractHnpFiles(const std::string &hnpPackageInfo, const ExtractParam &extractParam)
55 {
56     if (extractParam.srcPath.empty() || extractParam.targetPath.empty() || hnpPackageInfo.empty()) {
57         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
58     }
59     return CallService(&IInstalld::ExtractHnpFiles, hnpPackageInfo, extractParam);
60 }
61 
ProcessBundleInstallNative(const std::string &userId, const std::string &hnpRootPath, const std::string &hapPath, const std::string &cpuAbi, const std::string &packageName)62 ErrCode InstalldClient::ProcessBundleInstallNative(const std::string &userId, const std::string &hnpRootPath,
63     const std::string &hapPath, const std::string &cpuAbi, const std::string &packageName)
64 {
65     return CallService(&IInstalld::ProcessBundleInstallNative, userId, hnpRootPath,
66         hapPath, cpuAbi, packageName);
67 }
68 
ProcessBundleUnInstallNative(const std::string &userId, const std::string &packageName)69 ErrCode InstalldClient::ProcessBundleUnInstallNative(const std::string &userId, const std::string &packageName)
70 {
71     return CallService(&IInstalld::ProcessBundleUnInstallNative, userId, packageName);
72 }
73 
ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)74 ErrCode InstalldClient::ExecuteAOT(const AOTArgs &aotArgs, std::vector<uint8_t> &pendSignData)
75 {
76     return CallService(&IInstalld::ExecuteAOT, aotArgs, pendSignData);
77 }
78 
PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)79 ErrCode InstalldClient::PendSignAOT(const std::string &anFileName, const std::vector<uint8_t> &signData)
80 {
81     return CallService(&IInstalld::PendSignAOT, anFileName, signData);
82 }
83 
StopAOT()84 ErrCode InstalldClient::StopAOT()
85 {
86     return CallService(&IInstalld::StopAOT);
87 }
88 
RenameModuleDir(const std::string &oldPath, const std::string &newPath)89 ErrCode InstalldClient::RenameModuleDir(const std::string &oldPath, const std::string &newPath)
90 {
91     if (oldPath.empty() || newPath.empty()) {
92         APP_LOGE("rename path is empty");
93         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
94     }
95 
96     return CallService(&IInstalld::RenameModuleDir, oldPath, newPath);
97 }
98 
CreateBundleDataDir(const CreateDirParam &createDirParam)99 ErrCode InstalldClient::CreateBundleDataDir(const CreateDirParam &createDirParam)
100 {
101     if (createDirParam.bundleName.empty() || createDirParam.userId < 0
102         || createDirParam.uid < 0 || createDirParam.gid < 0) {
103         APP_LOGE("params are invalid");
104         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
105     }
106 
107     return CallService(&IInstalld::CreateBundleDataDir, createDirParam);
108 }
109 
CreateBundleDataDirWithVector(const std::vector<CreateDirParam> &createDirParams)110 ErrCode InstalldClient::CreateBundleDataDirWithVector(const std::vector<CreateDirParam> &createDirParams)
111 {
112     return ERR_OK;
113 }
114 
RemoveBundleDataDir( const std::string &bundleName, const int userId, bool isAtomicService)115 ErrCode InstalldClient::RemoveBundleDataDir(
116     const std::string &bundleName, const int userId, bool isAtomicService)
117 {
118     if (bundleName.empty() || userId < 0) {
119         APP_LOGE("params are invalid");
120         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
121     }
122 
123     return CallService(&IInstalld::RemoveBundleDataDir, bundleName, userId, isAtomicService);
124 }
125 
RemoveModuleDataDir(const std::string &ModuleName, const int userid)126 ErrCode InstalldClient::RemoveModuleDataDir(const std::string &ModuleName, const int userid)
127 {
128     if (ModuleName.empty() || userid < 0) {
129         APP_LOGE("params are invalid");
130         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
131     }
132 
133     return CallService(&IInstalld::RemoveModuleDataDir, ModuleName, userid);
134 }
135 
RemoveDir(const std::string &dir)136 ErrCode InstalldClient::RemoveDir(const std::string &dir)
137 {
138     if (dir.empty()) {
139         APP_LOGE("dir removed is empty");
140         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
141     }
142 
143     return CallService(&IInstalld::RemoveDir, dir);
144 }
145 
CleanBundleDataDir(const std::string &bundleDir)146 ErrCode InstalldClient::CleanBundleDataDir(const std::string &bundleDir)
147 {
148     if (bundleDir.empty()) {
149         APP_LOGE("bundle dir is empty");
150         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
151     }
152 
153     return CallService(&IInstalld::CleanBundleDataDir, bundleDir);
154 }
155 
CleanBundleDataDirByName( const std::string &bundleName, const int userid, const int appIndex)156 ErrCode InstalldClient::CleanBundleDataDirByName(
157     const std::string &bundleName, const int userid, const int appIndex)
158 {
159     if (bundleName.empty() || userid < 0 || appIndex < 0 || appIndex > Constants::INITIAL_SANDBOX_APP_INDEX) {
160         APP_LOGE("params are invalid");
161         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
162     }
163 
164     return CallService(&IInstalld::CleanBundleDataDirByName, bundleName, userid, appIndex);
165 }
166 
GetBundleStats(const std::string &bundleName, const int32_t userId, std::vector<int64_t> &bundleStats, const int32_t uid, const int32_t appIndex)167 ErrCode InstalldClient::GetBundleStats(const std::string &bundleName, const int32_t userId,
168     std::vector<int64_t> &bundleStats, const int32_t uid, const int32_t appIndex)
169 {
170     if (bundleName.empty()) {
171         APP_LOGE("bundleName is empty");
172         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
173     }
174 
175     return CallService(&IInstalld::GetBundleStats, bundleName, userId, bundleStats, uid, appIndex);
176 }
177 
GetAllBundleStats(const int32_t userId, std::vector<int64_t> &bundleStats, const std::vector<int32_t> &uids)178 ErrCode InstalldClient::GetAllBundleStats(const int32_t userId,
179     std::vector<int64_t> &bundleStats, const std::vector<int32_t> &uids)
180 {
181     if (uids.empty()) {
182         APP_LOGE("uids is empty");
183         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
184     }
185 
186     return CallService(&IInstalld::GetAllBundleStats, userId, bundleStats, uids);
187 }
188 
SetDirApl(const std::string &dir, const std::string &bundleName, const std::string &apl, bool isPreInstallApp, bool debug)189 ErrCode InstalldClient::SetDirApl(const std::string &dir, const std::string &bundleName, const std::string &apl,
190     bool isPreInstallApp, bool debug)
191 {
192     if (dir.empty() || bundleName.empty() || apl.empty()) {
193         APP_LOGE("params are invalid");
194         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
195     }
196 
197     return CallService(&IInstalld::SetDirApl, dir, bundleName, apl, isPreInstallApp, debug);
198 }
199 
GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath)200 ErrCode InstalldClient::GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath)
201 {
202     if (dir.empty()) {
203         APP_LOGE("params are invalid");
204         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
205     }
206 
207     return CallService(&IInstalld::GetBundleCachePath, dir, cachePath);
208 }
209 
ResetInstalldProxy()210 void InstalldClient::ResetInstalldProxy()
211 {
212     std::lock_guard<std::mutex> lock(mutex_);
213     if ((installdProxy_ != nullptr) && (installdProxy_->AsObject() != nullptr)) {
214         installdProxy_->AsObject()->RemoveDeathRecipient(recipient_);
215     }
216     installdProxy_ = nullptr;
217 }
218 
GetInstalldProxy()219 sptr<IInstalld> InstalldClient::GetInstalldProxy()
220 {
221     std::lock_guard<std::mutex> lock(mutex_);
222     if (installdProxy_ == nullptr) {
223         sptr<IInstalld> tempProxy =
224             iface_cast<IInstalld>(SystemAbilityHelper::GetSystemAbility(INSTALLD_SERVICE_ID));
225         if ((tempProxy == nullptr) || (tempProxy->AsObject() == nullptr)) {
226             APP_LOGE("the installd proxy or remote object is null");
227             return nullptr;
228         }
229         recipient_ = new (std::nothrow) InstalldDeathRecipient();
230         if (recipient_ == nullptr) {
231             APP_LOGE("the death recipient is nullptr");
232             return nullptr;
233         }
234         tempProxy->AsObject()->AddDeathRecipient(recipient_);
235         installdProxy_ = tempProxy;
236     }
237     return installdProxy_;
238 }
239 
ScanDir( const std::string &dir, ScanMode scanMode, ResultMode resultMode, std::vector<std::string> &paths)240 ErrCode InstalldClient::ScanDir(
241     const std::string &dir, ScanMode scanMode, ResultMode resultMode, std::vector<std::string> &paths)
242 {
243     if (dir.empty()) {
244         APP_LOGE("params are invalid");
245         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
246     }
247 
248     return CallService(&IInstalld::ScanDir, dir, scanMode, resultMode, paths);
249 }
250 
MoveFile(const std::string &oldPath, const std::string &newPath)251 ErrCode InstalldClient::MoveFile(const std::string &oldPath, const std::string &newPath)
252 {
253     if (oldPath.empty() || newPath.empty()) {
254         APP_LOGE("params are invalid");
255         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
256     }
257 
258     return CallService(&IInstalld::MoveFile, oldPath, newPath);
259 }
260 
CopyFile(const std::string &oldPath, const std::string &newPath, const std::string &signatureFilePath)261 ErrCode InstalldClient::CopyFile(const std::string &oldPath, const std::string &newPath,
262     const std::string &signatureFilePath)
263 {
264     if (oldPath.empty() || newPath.empty()) {
265         APP_LOGE("params are invalid");
266         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
267     }
268 
269     return CallService(&IInstalld::CopyFile, oldPath, newPath, signatureFilePath);
270 }
271 
Mkdir( const std::string &dir, const int32_t mode, const int32_t uid, const int32_t gid)272 ErrCode InstalldClient::Mkdir(
273     const std::string &dir, const int32_t mode, const int32_t uid, const int32_t gid)
274 {
275     if (dir.empty()) {
276         APP_LOGE("params are invalid");
277         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
278     }
279 
280     return CallService(&IInstalld::Mkdir, dir, mode, uid, gid);
281 }
282 
GetFileStat(const std::string &file, FileStat &fileStat)283 ErrCode InstalldClient::GetFileStat(const std::string &file, FileStat &fileStat)
284 {
285     if (file.empty()) {
286         APP_LOGE("params are invalid");
287         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
288     }
289 
290     return CallService(&IInstalld::GetFileStat, file, fileStat);
291 }
292 
ExtractDiffFiles(const std::string &filePath, const std::string &targetPath, const std::string &cpuAbi)293 ErrCode InstalldClient::ExtractDiffFiles(const std::string &filePath, const std::string &targetPath,
294     const std::string &cpuAbi)
295 {
296     if (filePath.empty() || targetPath.empty() || cpuAbi.empty()) {
297         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
298     }
299     return CallService(&IInstalld::ExtractDiffFiles, filePath, targetPath, cpuAbi);
300 }
301 
ApplyDiffPatch(const std::string &oldSoPath, const std::string &diffFilePath, const std::string &newSoPath, int32_t uid)302 ErrCode InstalldClient::ApplyDiffPatch(const std::string &oldSoPath, const std::string &diffFilePath,
303     const std::string &newSoPath, int32_t uid)
304 {
305     if (oldSoPath.empty() || diffFilePath.empty() || newSoPath.empty()) {
306         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
307     }
308     return CallService(&IInstalld::ApplyDiffPatch, oldSoPath, diffFilePath, newSoPath, uid);
309 }
310 
IsExistDir(const std::string &dir, bool &isExist)311 ErrCode InstalldClient::IsExistDir(const std::string &dir, bool &isExist)
312 {
313     return CallService(&IInstalld::IsExistDir, dir, isExist);
314 }
315 
IsExistFile(const std::string &path, bool &isExist)316 ErrCode InstalldClient::IsExistFile(const std::string &path, bool &isExist)
317 {
318     return CallService(&IInstalld::IsExistFile, path, isExist);
319 }
320 
IsExistApFile(const std::string &path, bool &isExist)321 ErrCode InstalldClient::IsExistApFile(const std::string &path, bool &isExist)
322 {
323     return CallService(&IInstalld::IsExistApFile, path, isExist);
324 }
325 
IsDirEmpty(const std::string &dir, bool &isDirEmpty)326 ErrCode InstalldClient::IsDirEmpty(const std::string &dir, bool &isDirEmpty)
327 {
328     return CallService(&IInstalld::IsDirEmpty, dir, isDirEmpty);
329 }
330 
ObtainQuickFixFileDir(const std::string &dir, std::vector<std::string> &dirVec)331 ErrCode InstalldClient::ObtainQuickFixFileDir(const std::string &dir, std::vector<std::string> &dirVec)
332 {
333     return CallService(&IInstalld::ObtainQuickFixFileDir, dir, dirVec);
334 }
335 
CopyFiles(const std::string &sourceDir, const std::string &destinationDir)336 ErrCode InstalldClient::CopyFiles(const std::string &sourceDir, const std::string &destinationDir)
337 {
338     return CallService(&IInstalld::CopyFiles, sourceDir, destinationDir);
339 }
340 
GetNativeLibraryFileNames(const std::string &filePath, const std::string &cpuAbi, std::vector<std::string> &fileNames)341 ErrCode InstalldClient::GetNativeLibraryFileNames(const std::string &filePath, const std::string &cpuAbi,
342     std::vector<std::string> &fileNames)
343 {
344     return CallService(&IInstalld::GetNativeLibraryFileNames, filePath, cpuAbi, fileNames);
345 }
346 
VerifyCodeSignature(const CodeSignatureParam &codeSignatureParam)347 ErrCode InstalldClient::VerifyCodeSignature(const CodeSignatureParam &codeSignatureParam)
348 {
349     if (codeSignatureParam.modulePath.empty()) {
350         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
351     }
352     return CallService(&IInstalld::VerifyCodeSignature, codeSignatureParam);
353 }
354 
CheckEncryption(const CheckEncryptionParam &checkEncryptionParam, bool &isEncryption)355 ErrCode InstalldClient::CheckEncryption(const CheckEncryptionParam &checkEncryptionParam, bool &isEncryption)
356 {
357     if (checkEncryptionParam.modulePath.empty()) {
358         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
359     }
360     return CallService(&IInstalld::CheckEncryption, checkEncryptionParam, isEncryption);
361 }
362 
MoveFiles(const std::string &srcDir, const std::string &desDir)363 ErrCode InstalldClient::MoveFiles(const std::string &srcDir, const std::string &desDir)
364 {
365     if (srcDir.empty() || desDir.empty()) {
366         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
367     }
368     return CallService(&IInstalld::MoveFiles, srcDir, desDir);
369 }
370 
ExtractDriverSoFiles(const std::string &srcPath, const std::unordered_multimap<std::string, std::string> &dirMap)371 ErrCode InstalldClient::ExtractDriverSoFiles(const std::string &srcPath,
372     const std::unordered_multimap<std::string, std::string> &dirMap)
373 {
374     if (srcPath.empty() || dirMap.empty()) {
375         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
376     }
377     return CallService(&IInstalld::ExtractDriverSoFiles, srcPath, dirMap);
378 }
379 
ExtractEncryptedSoFiles(const std::string &hapPath, const std::string &realSoFilesPath, const std::string &cpuAbi, const std::string &tmpSoPath, int32_t uid)380 ErrCode InstalldClient::ExtractEncryptedSoFiles(const std::string &hapPath, const std::string &realSoFilesPath,
381     const std::string &cpuAbi, const std::string &tmpSoPath, int32_t uid)
382 {
383     if (hapPath.empty() || tmpSoPath.empty() || cpuAbi.empty()) {
384         APP_LOGE("params are invalid");
385         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
386     }
387     return CallService(&IInstalld::ExtractEncryptedSoFiles, hapPath, realSoFilesPath, cpuAbi, tmpSoPath, uid);
388 }
389 
VerifyCodeSignatureForHap(const CodeSignatureParam &codeSignatureParam)390 ErrCode InstalldClient::VerifyCodeSignatureForHap(const CodeSignatureParam &codeSignatureParam)
391 {
392     if (codeSignatureParam.modulePath.empty()) {
393         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
394     }
395     return CallService(&IInstalld::VerifyCodeSignatureForHap, codeSignatureParam);
396 }
397 
DeliverySignProfile(const std::string &bundleName, int32_t profileBlockLength, const unsigned char *profileBlock)398 ErrCode InstalldClient::DeliverySignProfile(const std::string &bundleName, int32_t profileBlockLength,
399     const unsigned char *profileBlock)
400 {
401     if (bundleName.empty() || profileBlock == nullptr) {
402         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
403     }
404     return CallService(&IInstalld::DeliverySignProfile, bundleName, profileBlockLength, profileBlock);
405 }
406 
RemoveSignProfile(const std::string &bundleName)407 ErrCode InstalldClient::RemoveSignProfile(const std::string &bundleName)
408 {
409     if (bundleName.empty()) {
410         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
411     }
412     return CallService(&IInstalld::RemoveSignProfile, bundleName);
413 }
414 
SetEncryptionPolicy(int32_t uid, const std::string &bundleName, const int32_t userId, std::string &keyId)415 ErrCode InstalldClient::SetEncryptionPolicy(int32_t uid, const std::string &bundleName,
416     const int32_t userId, std::string &keyId)
417 {
418     if (bundleName.empty()) {
419         APP_LOGE("bundleName is empty");
420         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
421     }
422     return CallService(&IInstalld::SetEncryptionPolicy, uid, bundleName, userId, keyId);
423 }
424 
RemoveExtensionDir(int32_t userId, const std::vector<std::string> &extensionBundleDirs)425 ErrCode InstalldClient::RemoveExtensionDir(int32_t userId, const std::vector<std::string> &extensionBundleDirs)
426 {
427     if (extensionBundleDirs.empty() || userId < 0) {
428         APP_LOGE("extensionBundleDirs is empty or userId is invalid");
429         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
430     }
431     return CallService(&IInstalld::RemoveExtensionDir, userId, extensionBundleDirs);
432 }
433 
IsExistExtensionDir(int32_t userId, const std::string &extensionBundleDir, bool &isExist)434 ErrCode InstalldClient::IsExistExtensionDir(int32_t userId, const std::string &extensionBundleDir, bool &isExist)
435 {
436     if (extensionBundleDir.empty() || userId < 0) {
437         APP_LOGE("extensionBundleDir is empty or userId is invalid");
438         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
439     }
440     return CallService(&IInstalld::IsExistExtensionDir, userId, extensionBundleDir, isExist);
441 }
442 
CreateExtensionDataDir(const CreateDirParam &createDirParam)443 ErrCode InstalldClient::CreateExtensionDataDir(const CreateDirParam &createDirParam)
444 {
445     if (createDirParam.bundleName.empty() || createDirParam.userId < 0
446         || createDirParam.uid < 0 || createDirParam.gid < 0 || createDirParam.extensionDirs.empty()) {
447         APP_LOGE("params are invalid");
448         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
449     }
450 
451     return CallService(&IInstalld::CreateExtensionDataDir, createDirParam);
452 }
453 
DeleteEncryptionKeyId(const std::string &bundleName, const int32_t userId)454 ErrCode InstalldClient::DeleteEncryptionKeyId(const std::string &bundleName, const int32_t userId)
455 {
456     if (bundleName.empty()) {
457         APP_LOGE("bundleName is empty");
458         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
459     }
460     return CallService(&IInstalld::DeleteEncryptionKeyId, bundleName, userId);
461 }
462 
StartInstalldService()463 bool InstalldClient::StartInstalldService()
464 {
465     return GetInstalldProxy() != nullptr;
466 }
467 
GetExtensionSandboxTypeList(std::vector<std::string> &typeList)468 ErrCode InstalldClient::GetExtensionSandboxTypeList(std::vector<std::string> &typeList)
469 {
470     return CallService(&IInstalld::GetExtensionSandboxTypeList, typeList);
471 }
472 
AddUserDirDeleteDfx(int32_t userId)473 ErrCode InstalldClient::AddUserDirDeleteDfx(int32_t userId)
474 {
475     return CallService(&IInstalld::AddUserDirDeleteDfx, userId);
476 }
477 
GetDiskUsage(const std::string& dir, bool isRealPath)478 int64_t InstalldClient::GetDiskUsage(const std::string& dir, bool isRealPath)
479 {
480     return 0;
481 }
482 
MoveHapToCodeDir(const std::string &originPath, const std::string &targetPath)483 ErrCode InstalldClient::MoveHapToCodeDir(const std::string &originPath, const std::string &targetPath)
484 {
485     if (originPath.empty() || targetPath.empty()) {
486         APP_LOGE("params are invalid");
487         return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
488     }
489 
490     return CallService(&IInstalld::MoveHapToCodeDir, originPath, targetPath);
491 }
492 }  // namespace AppExecFwk
493 }  // namespace OHOS
494