1 /*
2 * Copyright (c) 2021-2022 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 "mock_bundle_mgr_host.h"
17
18 using namespace OHOS::AAFwk;
19 namespace OHOS {
20 namespace AppExecFwk {
DumpInfos(const DumpFlag flag,const std::string & bundleName,int32_t userId,std::string & result)21 bool MockBundleMgrHost::DumpInfos(
22 const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result)
23 {
24 APP_LOGD("enter");
25 APP_LOGD("flag: %{public}d", flag);
26 APP_LOGD("bundleName: %{public}s", bundleName.c_str());
27 if (bundleName.size() > 0) {
28 result = bundleName + "\n";
29 } else {
30 result = "OK";
31 }
32 return true;
33 }
34
CleanBundleCacheFiles(const std::string & bundleName,const sptr<ICleanCacheCallback> & cleanCacheCallback,int32_t userId)35 bool MockBundleMgrHost::CleanBundleCacheFiles(const std::string &bundleName,
36 const sptr<ICleanCacheCallback> &cleanCacheCallback, int32_t userId)
37 {
38 APP_LOGD("enter");
39 APP_LOGD("bundleName: %{public}s", bundleName.c_str());
40 cleanCacheCallback->OnCleanCacheFinished(0);
41 return true;
42 }
43
CleanBundleDataFiles(const std::string & bundleName,const int userId)44 bool MockBundleMgrHost::CleanBundleDataFiles(const std::string &bundleName, const int userId)
45 {
46 APP_LOGD("enter");
47 APP_LOGD("bundleName: %{public}s", bundleName.c_str());
48 return true;
49 }
50
SetApplicationEnabled(const std::string & bundleName,bool isEnable,int32_t userId)51 bool MockBundleMgrHost::SetApplicationEnabled(const std::string &bundleName, bool isEnable, int32_t userId)
52 {
53 APP_LOGD("enter");
54 APP_LOGD("bundleName: %{public}s", bundleName.c_str());
55 APP_LOGD("isEnable: %{public}d", isEnable);
56 return true;
57 }
58
SetAbilityEnabled(const AbilityInfo & abilityInfo,bool isEnable,int32_t userId)59 bool MockBundleMgrHost::SetAbilityEnabled(const AbilityInfo &abilityInfo, bool isEnable, int32_t userId)
60 {
61 APP_LOGD("enter");
62 APP_LOGD("abilityName: %{public}s", abilityInfo.name.c_str());
63 APP_LOGD("isEnable: %{public}d", isEnable);
64 return true;
65 }
66 } // namespace AppExecFwk
67 } // namespace OHOS