1 /*
2 * Copyright (c) 2023-2025 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_app_utils.h"
17 #include "mock_my_status.h"
18
19
20 namespace OHOS {
21 namespace AAFwk {
22
~AppUtils()23 AppUtils::~AppUtils() {}
24
AppUtils()25 AppUtils::AppUtils() {}
26
GetInstance()27 AppUtils &AppUtils::GetInstance()
28 {
29 static AppUtils utils;
30 return utils;
31 }
32
IsLauncher(const std::string & bundleName) const33 bool AppUtils::IsLauncher(const std::string &bundleName) const
34 {
35 return true;
36 }
37
IsLauncherAbility(const std::string & abilityName) const38 bool AppUtils::IsLauncherAbility(const std::string &abilityName) const
39 {
40 return true;
41 }
42
IsInheritWindowSplitScreenMode()43 bool AppUtils::IsInheritWindowSplitScreenMode()
44 {
45 return true;
46 }
47
IsSupportAncoApp()48 bool AppUtils::IsSupportAncoApp()
49 {
50 return true;
51 }
52
GetTimeoutUnitTimeRatio()53 int32_t AppUtils::GetTimeoutUnitTimeRatio()
54 {
55 return 0;
56 }
57
IsSelectorDialogDefaultPossion()58 bool AppUtils::IsSelectorDialogDefaultPossion()
59 {
60 return true;
61 }
62
IsStartSpecifiedProcess()63 bool AppUtils::IsStartSpecifiedProcess()
64 {
65 return true;
66 }
67
IsUseMultiRenderProcess()68 bool AppUtils::IsUseMultiRenderProcess()
69 {
70 return true;
71 }
72
IsLimitMaximumOfRenderProcess()73 bool AppUtils::IsLimitMaximumOfRenderProcess()
74 {
75 return true;
76 }
77
IsGrantPersistUriPermission()78 bool AppUtils::IsGrantPersistUriPermission()
79 {
80 return true;
81 }
82
IsStartOptionsWithAnimation()83 bool AppUtils::IsStartOptionsWithAnimation()
84 {
85 return true;
86 }
87
IsMultiProcessModel()88 bool AppUtils::IsMultiProcessModel()
89 {
90 return true;
91 }
92
IsStartOptionsWithProcessOptions()93 bool AppUtils::IsStartOptionsWithProcessOptions()
94 {
95 return true;
96 }
97
EnableMoveUIAbilityToBackgroundApi()98 bool AppUtils::EnableMoveUIAbilityToBackgroundApi()
99 {
100 return true;
101 }
102
IsLaunchEmbededUIAbility()103 bool AppUtils::IsLaunchEmbededUIAbility()
104 {
105 return MyStatus::GetInstance().auIsLaunchEmbededUIAbility_;
106 }
107
IsSupportNativeChildProcess()108 bool AppUtils::IsSupportNativeChildProcess()
109 {
110 return true;
111 }
112
IsAllowResidentInExtremeMemory(const std::string & bundleName,const std::string & abilityName)113 bool AppUtils::IsAllowResidentInExtremeMemory(const std::string& bundleName, const std::string& abilityName)
114 {
115 return true;
116 }
117
IsBigMemoryUnrelatedKeepAliveProc(const std::string & bundleName)118 bool AppUtils::IsBigMemoryUnrelatedKeepAliveProc(const std::string &bundleName)
119 {
120 return true;
121 }
122
IsRequireBigMemoryProcess(const std::string & bundleName)123 bool AppUtils::IsRequireBigMemoryProcess(const std::string &bundleName)
124 {
125 return true;
126 }
127
LoadProcessProhibitedFromRestarting()128 void AppUtils::LoadProcessProhibitedFromRestarting()
129 {
130 }
131
LoadRequireBigMemoryApp()132 void AppUtils::LoadRequireBigMemoryApp()
133 {
134 }
135
LoadResidentProcessInExtremeMemory()136 void AppUtils::LoadResidentProcessInExtremeMemory()
137 {
138 }
139
IsAllowNativeChildProcess(const std::string & appIdentifier)140 bool AppUtils::IsAllowNativeChildProcess(const std::string &appIdentifier)
141 {
142 return true;
143 }
144
LoadAllowNativeChildProcessApps()145 void AppUtils::LoadAllowNativeChildProcessApps()
146 {
147 }
148
GetLimitMaximumExtensionsPerProc()149 int32_t AppUtils::GetLimitMaximumExtensionsPerProc()
150 {
151 return 0;
152 }
153
GetLimitMaximumExtensionsPerDevice()154 int32_t AppUtils::GetLimitMaximumExtensionsPerDevice()
155 {
156 return 0;
157 }
158
GetCacheExtensionTypeList()159 std::string AppUtils::GetCacheExtensionTypeList()
160 {
161 return "";
162 }
163
IsAllowStartAbilityWithoutCallerToken(const std::string & bundleName,const std::string & abilityName)164 bool AppUtils::IsAllowStartAbilityWithoutCallerToken(const std::string& bundleName, const std::string& abilityName)
165 {
166 return true;
167 }
168
LoadStartAbilityWithoutCallerToken()169 void AppUtils::LoadStartAbilityWithoutCallerToken()
170 {
171 }
172
GetBrokerDelegateBundleName()173 std::string AppUtils::GetBrokerDelegateBundleName()
174 {
175 return "";
176 }
177
GetCollaboratorBrokerUID()178 int32_t AppUtils::GetCollaboratorBrokerUID()
179 {
180 return 0;
181 }
182
GetCollaboratorBrokerReserveUID()183 int32_t AppUtils::GetCollaboratorBrokerReserveUID()
184 {
185 return 0;
186 }
187
MaxChildProcess()188 int32_t AppUtils::MaxChildProcess()
189 {
190 return 0;
191 }
192
IsSupportMultiInstance()193 bool AppUtils::IsSupportMultiInstance()
194 {
195 return MyStatus::GetInstance().isSupportMultiInstance_;
196 }
197
GetMigrateClientBundleName()198 std::string AppUtils::GetMigrateClientBundleName()
199 {
200 return "";
201 }
202
IsConnectSupportCrossUser()203 bool AppUtils::IsConnectSupportCrossUser()
204 {
205 return true;
206 }
207
IsPrepareTerminateEnabled()208 bool AppUtils::IsPrepareTerminateEnabled()
209 {
210 return true;
211 }
212
IsSystemReasonMessage(const std::string & reasonMessage)213 bool AppUtils::IsSystemReasonMessage(const std::string &reasonMessage)
214 {
215 return true;
216 }
217
IsCacheAbilityEnabled()218 bool AppUtils::IsCacheAbilityEnabled()
219 {
220 return true;
221 }
222
LoadCacheAbilityList()223 void AppUtils::LoadCacheAbilityList()
224 {
225 }
226
IsCacheExtensionAbilityByList(const std::string & bundleName,const std::string & abilityName)227 bool AppUtils::IsCacheExtensionAbilityByList(const std::string& bundleName, const std::string& abilityName)
228 {
229 return true;
230 }
231
LoadResidentWhiteList()232 void AppUtils::LoadResidentWhiteList()
233 {
234 }
235
GetResidentWhiteList()236 const std::vector<std::string>& AppUtils::GetResidentWhiteList()
237 {
238 return {};
239 }
240
InResidentWhiteList(const std::string & bundleName)241 bool AppUtils::InResidentWhiteList(const std::string &bundleName)
242 {
243 return true;
244 }
245
IsSupportAppServiceExtension()246 bool AppUtils::IsSupportAppServiceExtension()
247 {
248 return true;
249 }
250
IsSupportStartAbilities()251 bool AppUtils::IsSupportStartAbilities()
252 {
253 return MyStatus::GetInstance().isSupportStartAbilities_;
254 }
255
IsPreloadApplicationEnabled()256 bool AppUtils::IsPreloadApplicationEnabled()
257 {
258 return false;
259 }
260 } // namespace AAFwk
261 } // namespace OHOS
262