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
DeleteUninstallTmpDirs(const std::vector<std::string> & dirs)89 ErrCode InstalldClient::DeleteUninstallTmpDirs(const std::vector<std::string> &dirs)
90 {
91 return CallService(&IInstalld::DeleteUninstallTmpDirs, dirs);
92 }
93
RenameModuleDir(const std::string & oldPath,const std::string & newPath)94 ErrCode InstalldClient::RenameModuleDir(const std::string &oldPath, const std::string &newPath)
95 {
96 if (oldPath.empty() || newPath.empty()) {
97 APP_LOGE("rename path is empty");
98 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
99 }
100
101 return CallService(&IInstalld::RenameModuleDir, oldPath, newPath);
102 }
103
CreateBundleDataDir(const CreateDirParam & createDirParam)104 ErrCode InstalldClient::CreateBundleDataDir(const CreateDirParam &createDirParam)
105 {
106 if (createDirParam.bundleName.empty() || createDirParam.userId < 0
107 || createDirParam.uid < 0 || createDirParam.gid < 0) {
108 APP_LOGE("params are invalid");
109 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
110 }
111
112 return CallService(&IInstalld::CreateBundleDataDir, createDirParam);
113 }
114
CreateBundleDataDirWithVector(const std::vector<CreateDirParam> & createDirParams)115 ErrCode InstalldClient::CreateBundleDataDirWithVector(const std::vector<CreateDirParam> &createDirParams)
116 {
117 return ERR_OK;
118 }
119
RemoveBundleDataDir(const std::string & bundleName,const int userId,bool isAtomicService,const bool async)120 ErrCode InstalldClient::RemoveBundleDataDir(
121 const std::string &bundleName, const int userId, bool isAtomicService, const bool async)
122 {
123 if (bundleName.empty() || userId < 0) {
124 APP_LOGE("params are invalid");
125 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
126 }
127
128 return CallService(&IInstalld::RemoveBundleDataDir, bundleName, userId, isAtomicService, async);
129 }
130
RemoveModuleDataDir(const std::string & ModuleName,const int userid)131 ErrCode InstalldClient::RemoveModuleDataDir(const std::string &ModuleName, const int userid)
132 {
133 if (ModuleName.empty() || userid < 0) {
134 APP_LOGE("params are invalid");
135 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
136 }
137
138 return CallService(&IInstalld::RemoveModuleDataDir, ModuleName, userid);
139 }
140
RemoveDir(const std::string & dir)141 ErrCode InstalldClient::RemoveDir(const std::string &dir)
142 {
143 if (dir.empty()) {
144 APP_LOGE("dir removed is empty");
145 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
146 }
147
148 return CallService(&IInstalld::RemoveDir, dir);
149 }
150
CleanBundleDataDir(const std::string & bundleDir)151 ErrCode InstalldClient::CleanBundleDataDir(const std::string &bundleDir)
152 {
153 if (bundleDir.empty()) {
154 APP_LOGE("bundle dir is empty");
155 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
156 }
157
158 return CallService(&IInstalld::CleanBundleDataDir, bundleDir);
159 }
160
CleanBundleDataDirByName(const std::string & bundleName,const int userid,const int appIndex)161 ErrCode InstalldClient::CleanBundleDataDirByName(
162 const std::string &bundleName, const int userid, const int appIndex)
163 {
164 if (bundleName.empty() || userid < 0 || appIndex < 0 || appIndex > Constants::INITIAL_SANDBOX_APP_INDEX) {
165 APP_LOGE("params are invalid");
166 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
167 }
168
169 return CallService(&IInstalld::CleanBundleDataDirByName, bundleName, userid, appIndex);
170 }
171
GetBundleStats(const std::string & bundleName,const int32_t userId,std::vector<int64_t> & bundleStats,const int32_t uid,const int32_t appIndex,const uint32_t statFlag,const std::vector<std::string> & moduleNameList)172 ErrCode InstalldClient::GetBundleStats(const std::string &bundleName, const int32_t userId,
173 std::vector<int64_t> &bundleStats, const int32_t uid, const int32_t appIndex,
174 const uint32_t statFlag, const std::vector<std::string> &moduleNameList)
175 {
176 if (bundleName.empty()) {
177 APP_LOGE("bundleName is empty");
178 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
179 }
180 return CallService(&IInstalld::GetBundleStats, bundleName, userId, bundleStats,
181 uid, appIndex, statFlag, moduleNameList);
182 }
183
GetAllBundleStats(const int32_t userId,std::vector<int64_t> & bundleStats,const std::vector<int32_t> & uids)184 ErrCode InstalldClient::GetAllBundleStats(const int32_t userId,
185 std::vector<int64_t> &bundleStats, const std::vector<int32_t> &uids)
186 {
187 if (uids.empty()) {
188 APP_LOGE("uids is empty");
189 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
190 }
191
192 return CallService(&IInstalld::GetAllBundleStats, userId, bundleStats, uids);
193 }
194
SetDirApl(const std::string & dir,const std::string & bundleName,const std::string & apl,bool isPreInstallApp,bool debug)195 ErrCode InstalldClient::SetDirApl(const std::string &dir, const std::string &bundleName, const std::string &apl,
196 bool isPreInstallApp, bool debug)
197 {
198 if (dir.empty() || bundleName.empty() || apl.empty()) {
199 APP_LOGE("params are invalid");
200 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
201 }
202
203 return CallService(&IInstalld::SetDirApl, dir, bundleName, apl, isPreInstallApp, debug);
204 }
205
GetBundleCachePath(const std::string & dir,std::vector<std::string> & cachePath)206 ErrCode InstalldClient::GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath)
207 {
208 if (dir.empty()) {
209 APP_LOGE("params are invalid");
210 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
211 }
212
213 return CallService(&IInstalld::GetBundleCachePath, dir, cachePath);
214 }
215
ResetInstalldProxy()216 void InstalldClient::ResetInstalldProxy()
217 {
218 if ((installdProxy_ != nullptr) && (installdProxy_->AsObject() != nullptr)) {
219 installdProxy_->AsObject()->RemoveDeathRecipient(recipient_);
220 }
221 installdProxy_ = nullptr;
222 }
223
GetInstalldProxy()224 sptr<IInstalld> InstalldClient::GetInstalldProxy()
225 {
226 std::lock_guard<std::mutex> lock(mutex_);
227 if (installdProxy_ == nullptr) {
228 sptr<IInstalld> tempProxy =
229 iface_cast<IInstalld>(SystemAbilityHelper::GetSystemAbility(INSTALLD_SERVICE_ID));
230 if ((tempProxy == nullptr) || (tempProxy->AsObject() == nullptr)) {
231 APP_LOGE("the installd proxy or remote object is null");
232 return nullptr;
233 }
234 recipient_ = new (std::nothrow) InstalldDeathRecipient();
235 if (recipient_ == nullptr) {
236 APP_LOGE("the death recipient is nullptr");
237 return nullptr;
238 }
239 tempProxy->AsObject()->AddDeathRecipient(recipient_);
240 installdProxy_ = tempProxy;
241 }
242 return installdProxy_;
243 }
244
ScanDir(const std::string & dir,ScanMode scanMode,ResultMode resultMode,std::vector<std::string> & paths)245 ErrCode InstalldClient::ScanDir(
246 const std::string &dir, ScanMode scanMode, ResultMode resultMode, std::vector<std::string> &paths)
247 {
248 if (dir.empty()) {
249 APP_LOGE("params are invalid");
250 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
251 }
252
253 return CallService(&IInstalld::ScanDir, dir, scanMode, resultMode, paths);
254 }
255
MoveFile(const std::string & oldPath,const std::string & newPath)256 ErrCode InstalldClient::MoveFile(const std::string &oldPath, const std::string &newPath)
257 {
258 if (oldPath.empty() || newPath.empty()) {
259 APP_LOGE("params are invalid");
260 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
261 }
262
263 return CallService(&IInstalld::MoveFile, oldPath, newPath);
264 }
265
CopyFile(const std::string & oldPath,const std::string & newPath,const std::string & signatureFilePath)266 ErrCode InstalldClient::CopyFile(const std::string &oldPath, const std::string &newPath,
267 const std::string &signatureFilePath)
268 {
269 if (oldPath.empty() || newPath.empty()) {
270 APP_LOGE("params are invalid");
271 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
272 }
273
274 return CallService(&IInstalld::CopyFile, oldPath, newPath, signatureFilePath);
275 }
276
Mkdir(const std::string & dir,const int32_t mode,const int32_t uid,const int32_t gid)277 ErrCode InstalldClient::Mkdir(
278 const std::string &dir, const int32_t mode, const int32_t uid, const int32_t gid)
279 {
280 if (dir.empty()) {
281 APP_LOGE("params are invalid");
282 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
283 }
284
285 return CallService(&IInstalld::Mkdir, dir, mode, uid, gid);
286 }
287
GetFileStat(const std::string & file,FileStat & fileStat)288 ErrCode InstalldClient::GetFileStat(const std::string &file, FileStat &fileStat)
289 {
290 if (file.empty()) {
291 APP_LOGE("params are invalid");
292 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
293 }
294
295 return CallService(&IInstalld::GetFileStat, file, fileStat);
296 }
297
ExtractDiffFiles(const std::string & filePath,const std::string & targetPath,const std::string & cpuAbi)298 ErrCode InstalldClient::ExtractDiffFiles(const std::string &filePath, const std::string &targetPath,
299 const std::string &cpuAbi)
300 {
301 if (filePath.empty() || targetPath.empty() || cpuAbi.empty()) {
302 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
303 }
304 return CallService(&IInstalld::ExtractDiffFiles, filePath, targetPath, cpuAbi);
305 }
306
ApplyDiffPatch(const std::string & oldSoPath,const std::string & diffFilePath,const std::string & newSoPath,int32_t uid)307 ErrCode InstalldClient::ApplyDiffPatch(const std::string &oldSoPath, const std::string &diffFilePath,
308 const std::string &newSoPath, int32_t uid)
309 {
310 if (oldSoPath.empty() || diffFilePath.empty() || newSoPath.empty()) {
311 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
312 }
313 return CallService(&IInstalld::ApplyDiffPatch, oldSoPath, diffFilePath, newSoPath, uid);
314 }
315
IsExistDir(const std::string & dir,bool & isExist)316 ErrCode InstalldClient::IsExistDir(const std::string &dir, bool &isExist)
317 {
318 return CallService(&IInstalld::IsExistDir, dir, isExist);
319 }
320
IsExistFile(const std::string & path,bool & isExist)321 ErrCode InstalldClient::IsExistFile(const std::string &path, bool &isExist)
322 {
323 return CallService(&IInstalld::IsExistFile, path, isExist);
324 }
325
IsExistApFile(const std::string & path,bool & isExist)326 ErrCode InstalldClient::IsExistApFile(const std::string &path, bool &isExist)
327 {
328 return CallService(&IInstalld::IsExistApFile, path, isExist);
329 }
330
IsDirEmpty(const std::string & dir,bool & isDirEmpty)331 ErrCode InstalldClient::IsDirEmpty(const std::string &dir, bool &isDirEmpty)
332 {
333 return CallService(&IInstalld::IsDirEmpty, dir, isDirEmpty);
334 }
335
ObtainQuickFixFileDir(const std::string & dir,std::vector<std::string> & dirVec)336 ErrCode InstalldClient::ObtainQuickFixFileDir(const std::string &dir, std::vector<std::string> &dirVec)
337 {
338 return CallService(&IInstalld::ObtainQuickFixFileDir, dir, dirVec);
339 }
340
CopyFiles(const std::string & sourceDir,const std::string & destinationDir)341 ErrCode InstalldClient::CopyFiles(const std::string &sourceDir, const std::string &destinationDir)
342 {
343 return CallService(&IInstalld::CopyFiles, sourceDir, destinationDir);
344 }
345
GetNativeLibraryFileNames(const std::string & filePath,const std::string & cpuAbi,std::vector<std::string> & fileNames)346 ErrCode InstalldClient::GetNativeLibraryFileNames(const std::string &filePath, const std::string &cpuAbi,
347 std::vector<std::string> &fileNames)
348 {
349 return CallService(&IInstalld::GetNativeLibraryFileNames, filePath, cpuAbi, fileNames);
350 }
351
VerifyCodeSignature(const CodeSignatureParam & codeSignatureParam)352 ErrCode InstalldClient::VerifyCodeSignature(const CodeSignatureParam &codeSignatureParam)
353 {
354 if (codeSignatureParam.modulePath.empty()) {
355 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
356 }
357 return CallService(&IInstalld::VerifyCodeSignature, codeSignatureParam);
358 }
359
CheckEncryption(const CheckEncryptionParam & checkEncryptionParam,bool & isEncryption)360 ErrCode InstalldClient::CheckEncryption(const CheckEncryptionParam &checkEncryptionParam, bool &isEncryption)
361 {
362 if (checkEncryptionParam.modulePath.empty()) {
363 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
364 }
365 return CallService(&IInstalld::CheckEncryption, checkEncryptionParam, isEncryption);
366 }
367
MoveFiles(const std::string & srcDir,const std::string & desDir)368 ErrCode InstalldClient::MoveFiles(const std::string &srcDir, const std::string &desDir)
369 {
370 if (srcDir.empty() || desDir.empty()) {
371 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
372 }
373 return CallService(&IInstalld::MoveFiles, srcDir, desDir);
374 }
375
ExtractDriverSoFiles(const std::string & srcPath,const std::unordered_multimap<std::string,std::string> & dirMap)376 ErrCode InstalldClient::ExtractDriverSoFiles(const std::string &srcPath,
377 const std::unordered_multimap<std::string, std::string> &dirMap)
378 {
379 if (srcPath.empty() || dirMap.empty()) {
380 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
381 }
382 return CallService(&IInstalld::ExtractDriverSoFiles, srcPath, dirMap);
383 }
384
ExtractEncryptedSoFiles(const std::string & hapPath,const std::string & realSoFilesPath,const std::string & cpuAbi,const std::string & tmpSoPath,int32_t uid)385 ErrCode InstalldClient::ExtractEncryptedSoFiles(const std::string &hapPath, const std::string &realSoFilesPath,
386 const std::string &cpuAbi, const std::string &tmpSoPath, int32_t uid)
387 {
388 if (hapPath.empty() || tmpSoPath.empty() || cpuAbi.empty()) {
389 APP_LOGE("params are invalid");
390 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
391 }
392 return CallService(&IInstalld::ExtractEncryptedSoFiles, hapPath, realSoFilesPath, cpuAbi, tmpSoPath, uid);
393 }
394
VerifyCodeSignatureForHap(const CodeSignatureParam & codeSignatureParam)395 ErrCode InstalldClient::VerifyCodeSignatureForHap(const CodeSignatureParam &codeSignatureParam)
396 {
397 if (codeSignatureParam.modulePath.empty()) {
398 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
399 }
400 return CallService(&IInstalld::VerifyCodeSignatureForHap, codeSignatureParam);
401 }
402
DeliverySignProfile(const std::string & bundleName,int32_t profileBlockLength,const unsigned char * profileBlock)403 ErrCode InstalldClient::DeliverySignProfile(const std::string &bundleName, int32_t profileBlockLength,
404 const unsigned char *profileBlock)
405 {
406 if (bundleName.empty() || profileBlock == nullptr) {
407 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
408 }
409 return CallService(&IInstalld::DeliverySignProfile, bundleName, profileBlockLength, profileBlock);
410 }
411
RemoveSignProfile(const std::string & bundleName)412 ErrCode InstalldClient::RemoveSignProfile(const std::string &bundleName)
413 {
414 if (bundleName.empty()) {
415 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
416 }
417 return CallService(&IInstalld::RemoveSignProfile, bundleName);
418 }
419
SetEncryptionPolicy(int32_t uid,const std::string & bundleName,const int32_t userId,std::string & keyId)420 ErrCode InstalldClient::SetEncryptionPolicy(int32_t uid, const std::string &bundleName,
421 const int32_t userId, std::string &keyId)
422 {
423 if (bundleName.empty()) {
424 APP_LOGE("bundleName is empty");
425 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
426 }
427 return CallService(&IInstalld::SetEncryptionPolicy, uid, bundleName, userId, keyId);
428 }
429
RemoveExtensionDir(int32_t userId,const std::vector<std::string> & extensionBundleDirs)430 ErrCode InstalldClient::RemoveExtensionDir(int32_t userId, const std::vector<std::string> &extensionBundleDirs)
431 {
432 if (extensionBundleDirs.empty() || userId < 0) {
433 APP_LOGE("extensionBundleDirs is empty or userId is invalid");
434 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
435 }
436 return CallService(&IInstalld::RemoveExtensionDir, userId, extensionBundleDirs);
437 }
438
IsExistExtensionDir(int32_t userId,const std::string & extensionBundleDir,bool & isExist)439 ErrCode InstalldClient::IsExistExtensionDir(int32_t userId, const std::string &extensionBundleDir, bool &isExist)
440 {
441 if (extensionBundleDir.empty() || userId < 0) {
442 APP_LOGE("extensionBundleDir is empty or userId is invalid");
443 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
444 }
445 return CallService(&IInstalld::IsExistExtensionDir, userId, extensionBundleDir, isExist);
446 }
447
CreateExtensionDataDir(const CreateDirParam & createDirParam)448 ErrCode InstalldClient::CreateExtensionDataDir(const CreateDirParam &createDirParam)
449 {
450 if (createDirParam.bundleName.empty() || createDirParam.userId < 0
451 || createDirParam.uid < 0 || createDirParam.gid < 0 || createDirParam.extensionDirs.empty()) {
452 APP_LOGE("params are invalid");
453 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
454 }
455
456 return CallService(&IInstalld::CreateExtensionDataDir, createDirParam);
457 }
458
DeleteEncryptionKeyId(const std::string & bundleName,const int32_t userId)459 ErrCode InstalldClient::DeleteEncryptionKeyId(const std::string &bundleName, const int32_t userId)
460 {
461 if (bundleName.empty()) {
462 APP_LOGE("bundleName is empty");
463 return ERR_APPEXECFWK_INSTALLD_PARAM_ERROR;
464 }
465 return CallService(&IInstalld::DeleteEncryptionKeyId, bundleName, userId);
466 }
467
StartInstalldService()468 bool InstalldClient::StartInstalldService()
469 {
470 return GetInstalldProxy() != nullptr;
471 }
472
GetExtensionSandboxTypeList(std::vector<std::string> & typeList)473 ErrCode InstalldClient::GetExtensionSandboxTypeList(std::vector<std::string> &typeList)
474 {
475 return CallService(&IInstalld::GetExtensionSandboxTypeList, typeList);
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