1 /*
2 * Copyright (c) 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 <cstddef>
17 #include <cstdint>
18 #include <set>
19
20 #include "bundle_mgr_proxy.h"
21
22 #include "bundlemgrproxy_fuzzer.h"
23
24 using Want = OHOS::AAFwk::Want;
25
26 using namespace OHOS::AppExecFwk;
27 namespace OHOS {
28 constexpr size_t THRESHOLD = 2;
DoSomethingInterestingWithMyAPI(const uint8_t * data,size_t size)29 bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
30 {
31 sptr<IRemoteObject> object;
32 BundleMgrProxy bundleMgrProxy(object);
33 std::string bundleName (reinterpret_cast<const char*>(data), size);
34 BundleInfo bundleInfo;
35 bundleInfo.name = bundleName;
36 std::vector<BundleInfo> bundleInfos;
37 bundleInfos.push_back(bundleInfo);
38 bundleMgrProxy.QueryKeepAliveBundleInfos(bundleInfos);
39
40 sptr<IBundleStatusCallback> bundleStatusCallback;
41 bundleMgrProxy.RegisterBundleStatusCallback(bundleStatusCallback);
42 bundleMgrProxy.ClearBundleStatusCallback(bundleStatusCallback);
43
44 DumpFlag flag = DumpFlag::DUMP_BUNDLE_LIST;
45 std::string result (reinterpret_cast<const char*>(data), size);
46 bundleMgrProxy.DumpInfos(flag, bundleName, reinterpret_cast<uintptr_t>(data), result);
47
48 bool isEnable = false;
49 if (size % THRESHOLD) {
50 isEnable = true;
51 }
52 bundleMgrProxy.IsApplicationEnabled(bundleName, isEnable);
53 bundleMgrProxy.SetApplicationEnabled(bundleName, isEnable, reinterpret_cast<uintptr_t>(data));
54
55 AbilityInfo abilityInfo;
56 bundleMgrProxy.IsAbilityEnabled(abilityInfo, isEnable);
57 bundleMgrProxy.SetAbilityEnabled(abilityInfo, isEnable, reinterpret_cast<uintptr_t>(data));
58
59 FormInfo formInfo;
60 formInfo.bundleName = bundleName;
61 std::vector<FormInfo> formInfos;
62 formInfos.push_back(formInfo);
63 bundleMgrProxy.GetAllFormsInfo(formInfos);
64 bundleMgrProxy.GetFormsInfoByApp(bundleName, formInfos);
65 std::string moduleName (reinterpret_cast<const char*>(data), size);
66 bundleMgrProxy.GetFormsInfoByModule(bundleName, moduleName, formInfos);
67
68 ShortcutInfo shortcutInfo;
69 shortcutInfo.bundleName = bundleName;
70 std::vector<ShortcutInfo> shortcutInfos;
71 shortcutInfos.push_back(shortcutInfo);
72 bundleMgrProxy.GetShortcutInfos(bundleName, shortcutInfos);
73 bundleMgrProxy.GetShortcutInfoV9(bundleName, shortcutInfos);
74
75 std::string eventKey (reinterpret_cast<const char*>(data), size);
76 CommonEventInfo commonEventInfo;
77 commonEventInfo.bundleName = bundleName;
78 std::vector<CommonEventInfo> commonEventInfos;
79 commonEventInfos.push_back(commonEventInfo);
80 bundleMgrProxy.GetAllCommonEventInfo(eventKey, commonEventInfos);
81
82 std::string networkId (reinterpret_cast<const char*>(data), size);
83 DistributedBundleInfo distributedBundleInfo;
84 bundleMgrProxy.GetDistributedBundleInfo(networkId, bundleName, distributedBundleInfo);
85 bundleMgrProxy.GetAppPrivilegeLevel(bundleName, reinterpret_cast<uintptr_t>(data));
86
87 Want want;
88 want.SetAction(bundleName);
89 ExtensionAbilityInfo extensionInfo;
90 extensionInfo.bundleName = bundleName;
91 std::vector<ExtensionAbilityInfo> extensionInfos;
92 extensionInfos.push_back(extensionInfo);
93 bundleMgrProxy.QueryExtensionAbilityInfos(want, reinterpret_cast<uintptr_t>(data),
94 reinterpret_cast<uintptr_t>(data), extensionInfos);
95 bundleMgrProxy.QueryExtensionAbilityInfosV9(want, reinterpret_cast<uintptr_t>(data),
96 reinterpret_cast<uintptr_t>(data), extensionInfos);
97 ExtensionAbilityType extensionType = ExtensionAbilityType::WORK_SCHEDULER;
98 bundleMgrProxy.QueryExtensionAbilityInfos(want, extensionType,
99 reinterpret_cast<uintptr_t>(data), reinterpret_cast<uintptr_t>(data), extensionInfos);
100 bundleMgrProxy.QueryExtensionAbilityInfosV9(want, extensionType,
101 reinterpret_cast<uintptr_t>(data), reinterpret_cast<uintptr_t>(data), extensionInfos);
102 bundleMgrProxy.QueryExtensionAbilityInfos(extensionType,
103 reinterpret_cast<uintptr_t>(data), extensionInfos);
104
105 std::string permission (reinterpret_cast<const char*>(data), size);
106 bundleMgrProxy.VerifyCallingPermission(permission);
107 std::string uri (reinterpret_cast<const char*>(data), size);
108 bundleMgrProxy.QueryExtensionAbilityInfoByUri(uri, reinterpret_cast<uintptr_t>(data), extensionInfo);
109 bundleMgrProxy.ImplicitQueryInfoByPriority(want, reinterpret_cast<uintptr_t>(data),
110 reinterpret_cast<uintptr_t>(data), abilityInfo, extensionInfo);
111
112 abilityInfo.name = bundleName;
113 std::vector<AbilityInfo> abilityInfos;
114 abilityInfos.push_back(abilityInfo);
115 bool findDafaultApp = false;
116 bundleMgrProxy.ImplicitQueryInfos(want, reinterpret_cast<uintptr_t>(data),
117 reinterpret_cast<uintptr_t>(data), true, abilityInfos, extensionInfos, findDafaultApp);
118
119 std::string abilityName (reinterpret_cast<const char*>(data), size);
120 bundleMgrProxy.GetAbilityInfo(bundleName, abilityName, abilityInfo);
121 bundleMgrProxy.GetAbilityInfo(bundleName, moduleName, abilityName, abilityInfo);
122 BundleInfo info;
123 bundleMgrProxy.GetSandboxBundleInfo(bundleName, reinterpret_cast<uintptr_t>(data),
124 reinterpret_cast<uintptr_t>(data), info);
125 bundleMgrProxy.IsModuleRemovable(bundleName, moduleName, isEnable);
126 bundleMgrProxy.SetModuleRemovable(bundleName, moduleName, isEnable);
127 std::vector<std::string> dependentModuleNames;
128 dependentModuleNames.push_back(bundleName);
129 bundleMgrProxy.GetAllDependentModuleNames(bundleName, moduleName, dependentModuleNames);
130 bundleMgrProxy.GetModuleUpgradeFlag(bundleName, moduleName);
131 bundleMgrProxy.SetModuleUpgradeFlag(bundleName, moduleName, reinterpret_cast<uintptr_t>(data));
132 bundleMgrProxy.ObtainCallingBundleName(bundleName);
133 std::vector<int64_t> bundleStats;
134 bundleStats.push_back(reinterpret_cast<intptr_t>(data));
135 bundleMgrProxy.GetBundleStats(bundleName, reinterpret_cast<uintptr_t>(data), bundleStats);
136 sptr<IRemoteObject> callback;
137 bundleMgrProxy.CheckAbilityEnableInstall(want, reinterpret_cast<uintptr_t>(data),
138 reinterpret_cast<uintptr_t>(data), callback);
139 std::unique_ptr<uint8_t[]> mediaDataPtr;
140 bundleMgrProxy.GetMediaData(bundleName, moduleName, abilityName, mediaDataPtr,
141 size, reinterpret_cast<uintptr_t>(data));
142 bundleMgrProxy.GetStringById(bundleName, moduleName, reinterpret_cast<uintptr_t>(data),
143 reinterpret_cast<uintptr_t>(data));
144 bundleMgrProxy.GetIconById(bundleName, moduleName, reinterpret_cast<uintptr_t>(data),
145 reinterpret_cast<uintptr_t>(data), reinterpret_cast<uintptr_t>(data));
146 bundleMgrProxy.GetSandboxAbilityInfo(want, reinterpret_cast<uintptr_t>(data),
147 reinterpret_cast<uintptr_t>(data), reinterpret_cast<uintptr_t>(data), abilityInfo);
148 bundleMgrProxy.GetSandboxExtAbilityInfos(want, reinterpret_cast<uintptr_t>(data),
149 reinterpret_cast<uintptr_t>(data), reinterpret_cast<uintptr_t>(data), extensionInfos);
150 HapModuleInfo hapModuleInfo;
151 bundleMgrProxy.GetSandboxHapModuleInfo(abilityInfo, reinterpret_cast<uintptr_t>(data),
152 reinterpret_cast<uintptr_t>(data), hapModuleInfo);
153 bundleMgrProxy.UnregisterBundleStatusCallback();
154 bundleMgrProxy.GetBundleInstaller();
155 bundleMgrProxy.GetBundleUserMgr();
156 bundleMgrProxy.GetQuickFixManagerProxy();
157 bundleMgrProxy.GetAppControlProxy();
158
159 ApplicationInfo appInfo;
160 bundleMgrProxy.GetApplicationInfo(bundleName + "1", ApplicationFlag::GET_APPLICATION_INFO_WITH_PERMISSION,
161 reinterpret_cast<uintptr_t>(data), appInfo);
162 bundleMgrProxy.GetApplicationInfo(bundleName + "1", 0, reinterpret_cast<uintptr_t>(data), appInfo);
163 bundleMgrProxy.GetApplicationInfoV9(bundleName + "1", 0, reinterpret_cast<uintptr_t>(data), appInfo);
164 std::vector<ApplicationInfo> appInfos;
165 bundleMgrProxy.GetApplicationInfos(
166 ApplicationFlag::GET_APPLICATION_INFO_WITH_PERMISSION, reinterpret_cast<uintptr_t>(data), appInfos);
167 bundleMgrProxy.GetApplicationInfos(0, reinterpret_cast<uintptr_t>(data), appInfos);
168 bundleMgrProxy.GetApplicationInfosV9(0, reinterpret_cast<uintptr_t>(data), appInfos);
169 bundleMgrProxy.GetBundleInfo(
170 bundleName + "1", BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, reinterpret_cast<uintptr_t>(data));
171 bundleMgrProxy.GetBundleInfo(bundleName + "1", 0, bundleInfo, reinterpret_cast<uintptr_t>(data));
172 bundleMgrProxy.GetBundleInfoV9(bundleName + "1", 0, bundleInfo, reinterpret_cast<uintptr_t>(data));
173
174 ElementName name;
175 name.SetBundleName(bundleName + "1");
176 want.SetElement(name);
177 std::vector<Want> wants;
178 wants.push_back(want);
179 auto flags = static_cast<int32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION) |
180 static_cast<int32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION);
181 bundleMgrProxy.BatchGetBundleInfo(wants, flags, bundleInfos, reinterpret_cast<uintptr_t>(data));
182 std::vector<std::string> bundleNames;
183 bundleMgrProxy.BatchGetBundleInfo(bundleNames, flags, bundleInfos, reinterpret_cast<uintptr_t>(data));
184 bundleMgrProxy.GetBundleInfoForSelf(BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo);
185 BundlePackInfo bundlePackInfo;
186 bundleMgrProxy.GetBundlePackInfo(bundleName + "1", 0, bundlePackInfo, reinterpret_cast<uintptr_t>(data));
187 bundleMgrProxy.GetBundlePackInfo(
188 bundleName + "1", BundleFlag::GET_BUNDLE_DEFAULT, bundlePackInfo, reinterpret_cast<uintptr_t>(data));
189 bundleMgrProxy.GetBundleInfos(BundleFlag::GET_BUNDLE_DEFAULT, bundleInfos, reinterpret_cast<uintptr_t>(data));
190 bundleMgrProxy.GetBundleInfos(0, bundleInfos, reinterpret_cast<uintptr_t>(data));
191 bundleMgrProxy.GetBundleInfosV9(0, bundleInfos, reinterpret_cast<uintptr_t>(data));
192 int uid = bundleMgrProxy.GetUidByBundleName(bundleName, reinterpret_cast<uintptr_t>(data));
193 bundleMgrProxy.GetUidByBundleName(bundleName, reinterpret_cast<uintptr_t>(data), 0);
194 bundleMgrProxy.GetUidByDebugBundleName(bundleName, reinterpret_cast<uintptr_t>(data));
195 std::string appId = bundleMgrProxy.GetAppIdByBundleName(bundleName, reinterpret_cast<uintptr_t>(data));
196 bundleMgrProxy.GetBundleNameForUid(uid, bundleName);
197 bundleMgrProxy.GetBundlesForUid(uid, bundleNames);
198 int32_t appIndex = -1;
199 bundleMgrProxy.GetNameAndIndexForUid(uid, bundleName, appIndex);
200 std::vector<int> gids;
201 bundleMgrProxy.GetBundleGids(bundleName, gids);
202 bundleMgrProxy.GetBundleGidsByUid(bundleName, uid, gids);
203 bundleMgrProxy.GetAppType(bundleName);
204 bundleMgrProxy.CheckIsSystemAppByUid(uid);
205 bundleMgrProxy.GetBundleInfosByMetaData("string", bundleInfos);
206 bundleMgrProxy.QueryAbilityInfo(want, abilityInfo);
207 bundleMgrProxy.QueryAbilityInfo(
208 want, GET_ABILITY_INFO_WITH_APPLICATION, reinterpret_cast<uintptr_t>(data), abilityInfo, nullptr);
209 bundleMgrProxy.UpgradeAtomicService(want, reinterpret_cast<uintptr_t>(data));
210 bundleMgrProxy.QueryAbilityInfo(
211 want, GET_ABILITY_INFO_WITH_APPLICATION, reinterpret_cast<uintptr_t>(data), abilityInfo);
212 bundleMgrProxy.QueryAbilityInfos(want, abilityInfos);
213 bundleMgrProxy.QueryAbilityInfos(
214 want, GET_ABILITY_INFO_DEFAULT, reinterpret_cast<uintptr_t>(data), abilityInfos);
215 bundleMgrProxy.QueryAbilityInfosV9(
216 want, GET_ABILITY_INFO_DEFAULT, reinterpret_cast<uintptr_t>(data), abilityInfos);
217 bundleMgrProxy.QueryAbilityInfos(
218 want, GET_ABILITY_INFO_DEFAULT, reinterpret_cast<uintptr_t>(data), abilityInfos);
219 bundleMgrProxy.QueryLauncherAbilityInfos(want, reinterpret_cast<uintptr_t>(data), abilityInfos);
220 bundleMgrProxy.QueryAllAbilityInfos(want, reinterpret_cast<uintptr_t>(data), abilityInfos);
221 bundleMgrProxy.QueryAbilityInfoByUri(std::string(reinterpret_cast<const char*>(data), size), abilityInfo);
222 bundleMgrProxy.QueryAbilityInfosByUri(std::string(reinterpret_cast<const char*>(data), size), abilityInfos);
223 bundleMgrProxy.QueryAbilityInfoByUri(
224 std::string(reinterpret_cast<const char*>(data), size), reinterpret_cast<uintptr_t>(data), abilityInfo);
225 bundleMgrProxy.QueryKeepAliveBundleInfos(bundleInfos);
226 bundleMgrProxy.GetAbilityLabel(bundleName, std::string(reinterpret_cast<const char*>(data), size));
227 bundleMgrProxy.GetBundleArchiveInfo(
228 std::string(reinterpret_cast<const char*>(data), size), BundleFlag::GET_BUNDLE_WITH_ABILITIES, bundleInfo);
229 bundleMgrProxy.GetBundleArchiveInfo(std::string(reinterpret_cast<const char*>(data), size), 0, bundleInfo);
230 bundleMgrProxy.GetBundleArchiveInfoV9(std::string(reinterpret_cast<const char*>(data), size), 0, bundleInfo);
231 bundleMgrProxy.GetHapModuleInfo(abilityInfo, hapModuleInfo);
232 bundleMgrProxy.GetHapModuleInfo(abilityInfo, reinterpret_cast<uintptr_t>(data), hapModuleInfo);
233 bundleMgrProxy.GetLaunchWantForBundle(bundleName, want, reinterpret_cast<uintptr_t>(data));
234 PermissionDef permissionDef;
235 std::string permissionName = "ohos.permission.READ_CALENDAR";
236 bundleMgrProxy.GetPermissionDef(permissionName, permissionDef);
237 bundleMgrProxy.CleanBundleCacheFilesAutomatic(reinterpret_cast<uintptr_t>(data));
238 sptr<ICleanCacheCallback> cleanCacheCallback;
239 bundleMgrProxy.CleanBundleCacheFiles(bundleName, cleanCacheCallback, reinterpret_cast<uintptr_t>(data), 0);
240 bundleMgrProxy.CleanBundleDataFiles(bundleName, reinterpret_cast<uintptr_t>(data), 0);
241
242 bundleMgrProxy.GetDependentBundleInfo(bundleName, bundleInfo);
243 bundleMgrProxy.GetNameForUid(uid, bundleName);
244 bundleMgrProxy.BatchQueryAbilityInfos(wants, 0, reinterpret_cast<uintptr_t>(data), abilityInfos);
245 bundleMgrProxy.IsCloneApplicationEnabled(bundleName, 0, isEnable);
246 bundleMgrProxy.SetCloneApplicationEnabled(bundleName, 0, true);
247 bundleMgrProxy.IsCloneAbilityEnabled(abilityInfo, 0, isEnable);
248 bundleMgrProxy.SetCloneAbilityEnabled(abilityInfo, 0, true);
249 bundleMgrProxy.GetVerifyManager();
250 bundleMgrProxy.GetExtendResourceManager();
251 bundleMgrProxy.GetAllBundleStats(reinterpret_cast<uintptr_t>(data), bundleStats);
252 bundleMgrProxy.GetDefaultAppProxy();
253 bundleMgrProxy.GetAppControlProxy();
254 bundleMgrProxy.SetDebugMode(false);
255 bundleMgrProxy.VerifySystemApi();
256 bundleMgrProxy.ProcessPreload(want);
257 bundleMgrProxy.GetOverlayManagerProxy();
258 AppProvisionInfo appProvisionInfo;
259 bundleMgrProxy.GetAppProvisionInfo(bundleName, reinterpret_cast<uintptr_t>(data), appProvisionInfo);
260 std::vector<BaseSharedBundleInfo> baseSharedBundleInfos;
261 bundleMgrProxy.GetBaseSharedBundleInfos(bundleName, baseSharedBundleInfos);
262 std::vector<SharedBundleInfo> sharedBundles;
263 bundleMgrProxy.GetAllSharedBundleInfo(sharedBundles);
264 bundleMgrProxy.GetSharedBundleInfo(bundleName, moduleName, sharedBundles);
265 SharedBundleInfo sharedBundleInfo;
266 bundleMgrProxy.GetSharedBundleInfoBySelf(bundleName, sharedBundleInfo);
267 std::vector<Dependency> dependencies;
268 bundleMgrProxy.GetSharedDependencies(bundleName, moduleName, dependencies);
269 std::vector<ProxyData> proxyDatas;
270 bundleMgrProxy.GetProxyDataInfos(bundleName, moduleName, proxyDatas);
271 bundleMgrProxy.GetAllProxyDataInfos(proxyDatas);
272 std::string specifiedDistributionType;
273 bundleMgrProxy.GetSpecifiedDistributionType(bundleName, specifiedDistributionType);
274 std::string additionalInfo;
275 bundleMgrProxy.GetAdditionalInfo(bundleName, additionalInfo);
276 bundleMgrProxy.SetExtNameOrMIMEToApp(bundleName, moduleName,
277 std::string(reinterpret_cast<const char*>(data), size),
278 std::string(reinterpret_cast<const char*>(data), size),
279 std::string(reinterpret_cast<const char*>(data), size));
280 bundleMgrProxy.DelExtNameOrMIMEToApp(bundleName, moduleName,
281 std::string(reinterpret_cast<const char*>(data), size),
282 std::string(reinterpret_cast<const char*>(data), size),
283 std::string(reinterpret_cast<const char*>(data), size));
284 std::vector<DataGroupInfo> infos;
285 bundleMgrProxy.QueryDataGroupInfos(bundleName, reinterpret_cast<uintptr_t>(data), infos);
286 std::string dir;
287 bundleMgrProxy.GetGroupDir(std::string(reinterpret_cast<const char*>(data), size), dir);
288 bundleMgrProxy.QueryAppGalleryBundleName(bundleName);
289 bundleMgrProxy.QueryExtensionAbilityInfosWithTypeName(
290 want, std::string(reinterpret_cast<const char*>(data), size),
291 0, reinterpret_cast<uintptr_t>(data), extensionInfos);
292 bundleMgrProxy.QueryExtensionAbilityInfosOnlyWithTypeName(
293 std::string(reinterpret_cast<const char*>(data), size),
294 0, reinterpret_cast<uintptr_t>(data), extensionInfos);
295 bundleMgrProxy.ResetAOTCompileStatus(bundleName, moduleName, reinterpret_cast<uintptr_t>(data));
296 std::string profile;
297 bundleMgrProxy.GetJsonProfile(ProfileType::ADDITION_PROFILE, bundleName, moduleName, profile);
298 bundleMgrProxy.GetBundleResourceProxy();
299 std::vector<RecoverableApplicationInfo> recoverableApplications;
300 bundleMgrProxy.GetRecoverableApplicationInfo(recoverableApplications);
301 bundleMgrProxy.GetUninstalledBundleInfo(bundleName, bundleInfo);
302 bundleMgrProxy.SetAdditionalInfo(bundleName, std::string(reinterpret_cast<const char*>(data), size));
303 bundleMgrProxy.CreateBundleDataDir(reinterpret_cast<uintptr_t>(data));
304 std::string odid;
305 bundleMgrProxy.GetOdid(odid);
306 bundleMgrProxy.GetAllBundleInfoByDeveloperId(
307 std::string(reinterpret_cast<const char*>(data), size), bundleInfos);
308 std::string appDistributionType = "invalidType";
309 std::vector<std::string> developerIdList;
310 bundleMgrProxy.GetDeveloperIds(appDistributionType, developerIdList);
311 std::vector<std::string> results;
312 bundleMgrProxy.CompileProcessAOT(bundleName, "none", false, results);
313 bundleMgrProxy.ResetAOTCompileStatus(bundleName, moduleName, 0);
314 bundleMgrProxy.CopyAp(bundleName, false, results);
315 std::string link = "http://";
316 bool canOpen = false;
317 bundleMgrProxy.CanOpenLink(link, canOpen);
318 std::vector<PreinstalledApplicationInfo> preinstalledApplicationInfos;
319 bundleMgrProxy.GetAllPreinstalledApplicationInfos(preinstalledApplicationInfos);
320 bundleMgrProxy.SwitchUninstallState(bundleName, false);
321 bundleMgrProxy.QueryAbilityInfoByContinueType(bundleName, "BROWSER", abilityInfo);
322 ElementName element;
323 bundleMgrProxy.QueryCloneAbilityInfo(element, 0, 0, abilityInfo, reinterpret_cast<uintptr_t>(data));
324 bundleMgrProxy.GetCloneBundleInfo(bundleName, 0, 0, bundleInfo);
325 element.SetAbilityName(abilityName);
326 element.SetBundleName(bundleName);
327 SignatureInfo sinfo;
328 bundleMgrProxy.GetSignatureInfoByBundleName(bundleName, sinfo);
329 bundleMgrProxy.AddDesktopShortcutInfo(shortcutInfo, reinterpret_cast<uintptr_t>(data));
330 bundleMgrProxy.DeleteDesktopShortcutInfo(shortcutInfo, reinterpret_cast<uintptr_t>(data));
331 bundleMgrProxy.GetAllDesktopShortcutInfo(reinterpret_cast<uintptr_t>(data), shortcutInfos);
332 bundleMgrProxy.GetOdidByBundleName(bundleName, odid);
333 bundleMgrProxy.GetBundleInfosForContinuation(0, bundleInfos, reinterpret_cast<uintptr_t>(data));
334 std::string deviceType;
335 bundleMgrProxy.GetCompatibleDeviceType(bundleName, deviceType);
336 std::string queryBundleName;
337 bundleMgrProxy.GetBundleNameByAppId(appId, queryBundleName);
338 std::string dataDir;
339 bundleMgrProxy.GetDirByBundleNameAndAppIndex(bundleName, 0, dataDir);
340 std::vector<BundleDir> bundleDirs;
341 bundleMgrProxy.GetAllBundleDirs(reinterpret_cast<uintptr_t>(data), bundleDirs);
342 std::set<AppDistributionTypeEnum> appDistributionTypeEnums{
343 AppDistributionTypeEnum::APP_DISTRIBUTION_TYPE_APP_GALLERY};
344 bundleMgrProxy.SetAppDistributionTypes(appDistributionTypeEnums);
345 return true;
346 }
347 }
348
349 // Fuzzer entry point.
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)350 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
351 {
352 // Run your code on data.
353 OHOS::DoSomethingInterestingWithMyAPI(data, size);
354 return 0;
355 }