1 /*
2 * Copyright (c) 2024-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 "screensessionmgrstubwakeup_fuzzer.h"
17
18 #include <iremote_stub.h>
19 #include <parcel.h>
20
21 #include "message_option.h"
22 #include "message_parcel.h"
23 #include "screen_session_manager_stub.h"
24
25 using namespace OHOS::Rosen;
26
27 namespace OHOS {
28 namespace {
29 constexpr size_t DATA_MIN_SIZE = 2;
30 }
31
DoSomethingInterestingWithMyAPI(const uint8_t * data,size_t size)32 bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
33 {
34 if (data == nullptr || size < DATA_MIN_SIZE) {
35 return false;
36 }
37
38 MessageParcel parcel;
39 MessageParcel reply;
40 MessageOption option;
41
42 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
43 parcel.WriteBuffer(data, size);
44
45 parcel.RewindRead(0);
46 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
47 screenStub->OnRemoteRequest(
48 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_WAKE_UP_BEGIN),
49 parcel, reply, option);
50 parcel.RewindRead(0);
51 screenStub->OnRemoteRequest(
52 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_WAKE_UP_END),
53 parcel, reply, option);
54 return true;
55 }
DoSomethingInterestingWithMyAPI1(const uint8_t * data,size_t size)56 bool DoSomethingInterestingWithMyAPI1(const uint8_t* data, size_t size)
57 {
58 if (data == nullptr || size < DATA_MIN_SIZE) {
59 return false;
60 }
61
62 MessageParcel parcel;
63 MessageParcel reply;
64 MessageOption option;
65
66 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
67 parcel.WriteBuffer(data, size);
68
69 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
70
71 parcel.RewindRead(0);
72 screenStub->OnRemoteRequest(
73 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_VISIBLE_AREA_DISPLAY_INFO_BY_ID),
74 parcel, reply, option);
75 parcel.RewindRead(0);
76 screenStub->OnRemoteRequest(
77 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_INTERNAL_SCREEN_ID),
78 parcel, reply, option);
79 parcel.RewindRead(0);
80 screenStub->OnRemoteRequest(
81 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_POWER_BY_ID),
82 parcel, reply, option);
83 parcel.RewindRead(0);
84 screenStub->OnRemoteRequest(
85 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SPECIFIED_SCREEN_POWER),
86 parcel, reply, option);
87 parcel.RewindRead(0);
88 screenStub->OnRemoteRequest(
89 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_TRY_TO_CANCEL_SCREEN_OFF),
90 parcel, reply, option);
91 parcel.RewindRead(0);
92 screenStub->OnRemoteRequest(
93 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_BRIGHTNESS),
94 parcel, reply, option);
95 parcel.RewindRead(0);
96 screenStub->OnRemoteRequest(
97 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_BRIGHTNESS),
98 parcel, reply, option);
99 parcel.RewindRead(0);
100 screenStub->OnRemoteRequest(
101 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_FREEZE_EVENT),
102 parcel, reply, option);
103 parcel.RewindRead(0);
104 screenStub->OnRemoteRequest(
105 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_ADD_VIRTUAL_SCREEN_BLOCK_LIST),
106 parcel, reply, option);
107 parcel.RewindRead(0);
108 screenStub->OnRemoteRequest(
109 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_REMOVE_VIRTUAL_SCREEN_BLOCK_LIST),
110 parcel, reply, option);
111 return true;
112 }
DoSomethingInterestingWithMyAPI2(const uint8_t * data,size_t size)113 bool DoSomethingInterestingWithMyAPI2(const uint8_t* data, size_t size)
114 {
115 if (data == nullptr || size < DATA_MIN_SIZE) {
116 return false;
117 }
118
119 MessageParcel parcel;
120 MessageParcel reply;
121 MessageOption option;
122
123 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
124 parcel.WriteBuffer(data, size);
125
126 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
127
128 parcel.RewindRead(0);
129 screenStub->OnRemoteRequest(
130 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_CANVAS_ROTATION),
131 parcel, reply, option);
132 parcel.RewindRead(0);
133 screenStub->OnRemoteRequest(
134 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_PHYSICAL_SCREEN_IDS),
135 parcel, reply, option);
136 parcel.RewindRead(0);
137 screenStub->OnRemoteRequest(
138 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_DEFAULT_DENSITY_DPI),
139 parcel, reply, option);
140 parcel.RewindRead(0);
141 screenStub->OnRemoteRequest(
142 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_RESOLUTION),
143 parcel, reply, option);
144 parcel.RewindRead(0);
145 screenStub->OnRemoteRequest(
146 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DENSITY_IN_CURRENT_RESOLUTION),
147 parcel, reply, option);
148 parcel.RewindRead(0);
149 screenStub->OnRemoteRequest(
150 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_PRIVACY_MASKIMAGE),
151 parcel, reply, option);
152 parcel.RewindRead(0);
153 screenStub->OnRemoteRequest(
154 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_MIRROR_FOR_RECORD),
155 parcel, reply, option);
156 parcel.RewindRead(0);
157 screenStub->OnRemoteRequest(
158 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_MAKE_MIRROR_WITH_REGION),
159 parcel, reply, option);
160 parcel.RewindRead(0);
161 screenStub->OnRemoteRequest(
162 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_PIXEL_FORMAT),
163 parcel, reply, option);
164 parcel.RewindRead(0);
165 screenStub->OnRemoteRequest(
166 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_SET_PIXEL_FORMAT),
167 parcel, reply, option);
168 return true;
169 }
DoSomethingInterestingWithMyAPI3(const uint8_t * data,size_t size)170 bool DoSomethingInterestingWithMyAPI3(const uint8_t* data, size_t size)
171 {
172 if (data == nullptr || size < DATA_MIN_SIZE) {
173 return false;
174 }
175
176 MessageParcel parcel;
177 MessageParcel reply;
178 MessageOption option;
179
180 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
181 parcel.WriteBuffer(data, size);
182
183 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
184
185 parcel.RewindRead(0);
186 screenStub->OnRemoteRequest(
187 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_SUPPORTED_HDR_FORMAT),
188 parcel, reply, option);
189 parcel.RewindRead(0);
190 screenStub->OnRemoteRequest(
191 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_HDR_FORMAT),
192 parcel, reply, option);
193 parcel.RewindRead(0);
194 screenStub->OnRemoteRequest(
195 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_SET_HDR_FORMAT),
196 parcel, reply, option);
197 parcel.RewindRead(0);
198 screenStub->OnRemoteRequest(
199 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_SUPPORTED_COLOR_SPACE),
200 parcel, reply, option);
201 parcel.RewindRead(0);
202 screenStub->OnRemoteRequest(
203 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_GET_COLOR_SPACE),
204 parcel, reply, option);
205 parcel.RewindRead(0);
206 screenStub->OnRemoteRequest(
207 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_SET_COLOR_SPACE),
208 parcel, reply, option);
209 parcel.RewindRead(0);
210 screenStub->OnRemoteRequest(
211 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_ROTATION_LOCKED_FROM_JS),
212 parcel, reply, option);
213 parcel.RewindRead(0);
214 screenStub->OnRemoteRequest(
215 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_HAS_IMMERSIVE_WINDOW),
216 parcel, reply, option);
217 parcel.RewindRead(0);
218 screenStub->OnRemoteRequest(
219 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_ADD_SURFACE_NODE),
220 parcel, reply, option);
221 parcel.RewindRead(0);
222 screenStub->OnRemoteRequest(
223 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_REMOVE_SURFACE_NODE),
224 parcel, reply, option);
225 return true;
226 }
DoSomethingInterestingWithMyAPI4(const uint8_t * data,size_t size)227 bool DoSomethingInterestingWithMyAPI4(const uint8_t* data, size_t size)
228 {
229 if (data == nullptr || size < DATA_MIN_SIZE) {
230 return false;
231 }
232
233 MessageParcel parcel;
234 MessageParcel reply;
235 MessageOption option;
236
237 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
238 parcel.WriteBuffer(data, size);
239
240 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
241
242 parcel.RewindRead(0);
243 screenStub->OnRemoteRequest(
244 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCREEN_DISABLE_MIRROR),
245 parcel, reply, option);
246 parcel.RewindRead(0);
247 screenStub->OnRemoteRequest(
248 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_CUTOUT_INFO_WITH_ROTATION),
249 parcel, reply, option);
250 parcel.RewindRead(0);
251 screenStub->OnRemoteRequest(
252 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_SCREEN_BASE),
253 parcel, reply, option);
254 parcel.RewindRead(0);
255 screenStub->OnRemoteRequest(
256 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_FOLD_DISPLAY_MODE_FROM_JS),
257 parcel, reply, option);
258 parcel.RewindRead(0);
259 screenStub->OnRemoteRequest(
260 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_SET_DISPLAY_SCALE),
261 parcel, reply, option);
262 parcel.RewindRead(0);
263 screenStub->OnRemoteRequest(
264 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_GET_SUPER_FOLD_STATUS),
265 parcel, reply, option);
266 parcel.RewindRead(0);
267 screenStub->OnRemoteRequest(
268 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_LANDSCAPE_LOCK_STATUS),
269 parcel, reply, option);
270 parcel.RewindRead(0);
271 screenStub->OnRemoteRequest(
272 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_MAKE_UNIQUE_SCREEN),
273 parcel, reply, option);
274 parcel.RewindRead(0);
275 screenStub->OnRemoteRequest(
276 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_LOCK_FOLD_DISPLAY_STATUS),
277 parcel, reply, option);
278 parcel.RewindRead(0);
279 screenStub->OnRemoteRequest(
280 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_LOCK_FOLD_DISPLAY_STATUS_FROM_JS),
281 parcel, reply, option);
282 return true;
283 }
DoSomethingInterestingWithMyAPI5(const uint8_t * data,size_t size)284 bool DoSomethingInterestingWithMyAPI5(const uint8_t* data, size_t size)
285 {
286 if (data == nullptr || size < DATA_MIN_SIZE) {
287 return false;
288 }
289
290 MessageParcel parcel;
291 MessageParcel reply;
292 MessageOption option;
293
294 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
295 parcel.WriteBuffer(data, size);
296
297 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
298
299 parcel.RewindRead(0);
300 screenStub->OnRemoteRequest(
301 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_FORCE_CLOSE_HDR),
302 parcel, reply, option);
303 parcel.RewindRead(0);
304 screenStub->OnRemoteRequest(
305 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SCENE_BOARD_GET_SUPER_ROTATION),
306 parcel, reply, option);
307 parcel.RewindRead(0);
308 screenStub->OnRemoteRequest(
309 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_CLIENT),
310 parcel, reply, option);
311 parcel.RewindRead(0);
312 screenStub->OnRemoteRequest(
313 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_PROPERTY),
314 parcel, reply, option);
315 parcel.RewindRead(0);
316 screenStub->OnRemoteRequest(
317 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_NODE),
318 parcel, reply, option);
319 parcel.RewindRead(0);
320 screenStub->OnRemoteRequest(
321 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UPDATE_SCREEN_DIRECTION_INFO),
322 parcel, reply, option);
323 parcel.RewindRead(0);
324 screenStub->OnRemoteRequest(
325 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UPDATE_SCREEN_ROTATION_PROPERTY),
326 parcel, reply, option);
327 parcel.RewindRead(0);
328 screenStub->OnRemoteRequest(
329 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UPDATE_AVAILABLE_AREA),
330 parcel, reply, option);
331 parcel.RewindRead(0);
332 screenStub->OnRemoteRequest(
333 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UPDATE_SUPER_FOLD_AVAILABLE_AREA),
334 parcel, reply, option);
335 parcel.RewindRead(0);
336 screenStub->OnRemoteRequest(
337 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_OFF_DELAY_TIME),
338 parcel, reply, option);
339 return true;
340 }
DoSomethingInterestingWithMyAPI6(const uint8_t * data,size_t size)341 bool DoSomethingInterestingWithMyAPI6(const uint8_t* data, size_t size)
342 {
343 if (data == nullptr || size < DATA_MIN_SIZE) {
344 return false;
345 }
346
347 MessageParcel parcel;
348 MessageParcel reply;
349 MessageOption option;
350
351 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
352 parcel.WriteBuffer(data, size);
353
354 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
355
356 parcel.RewindRead(0);
357 screenStub->OnRemoteRequest(
358 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_CURVED_SCREEN_COMPRESSION_AREA),
359 parcel, reply, option);
360 parcel.RewindRead(0);
361 screenStub->OnRemoteRequest(
362 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_PHY_SCREEN_PROPERTY),
363 parcel, reply, option);
364 parcel.RewindRead(0);
365 screenStub->OnRemoteRequest(
366 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_DISPLAY_CHANGE_INFO),
367 parcel, reply, option);
368 parcel.RewindRead(0);
369 screenStub->OnRemoteRequest(
370 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_PRIVACY_STATE),
371 parcel, reply, option);
372 parcel.RewindRead(0);
373 screenStub->OnRemoteRequest(
374 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_PRIVACY_WINDOW_LIST),
375 parcel, reply, option);
376 parcel.RewindRead(0);
377 screenStub->OnRemoteRequest(
378 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_RESIZE_VIRTUAL_SCREEN),
379 parcel, reply, option);
380 parcel.RewindRead(0);
381 screenStub->OnRemoteRequest(
382 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_AVAILABLE_AREA),
383 parcel, reply, option);
384 parcel.RewindRead(0);
385 screenStub->OnRemoteRequest(
386 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_FOLD_TO_EXPAND_COMPLETION),
387 parcel, reply, option);
388 parcel.RewindRead(0);
389 screenStub->OnRemoteRequest(
390 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_CONVERT_SCREENID_TO_RSSCREENID),
391 parcel, reply, option);
392 parcel.RewindRead(0);
393 screenStub->OnRemoteRequest(
394 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_VIRTUAL_SCREEN_FLAG),
395 parcel, reply, option);
396 return true;
397 }
DoSomethingInterestingWithMyAPI7(const uint8_t * data,size_t size)398 bool DoSomethingInterestingWithMyAPI7(const uint8_t* data, size_t size)
399 {
400 if (data == nullptr || size < DATA_MIN_SIZE) {
401 return false;
402 }
403
404 MessageParcel parcel;
405 MessageParcel reply;
406 MessageOption option;
407
408 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
409 parcel.WriteBuffer(data, size);
410
411 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
412
413 parcel.RewindRead(0);
414 screenStub->OnRemoteRequest(
415 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_FLAG),
416 parcel, reply, option);
417 parcel.RewindRead(0);
418 screenStub->OnRemoteRequest(
419 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_SCALE_MODE),
420 parcel, reply, option);
421 parcel.RewindRead(0);
422 screenStub->OnRemoteRequest(
423 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DEVICE_SCREEN_CONFIG),
424 parcel, reply, option);
425 parcel.RewindRead(0);
426 screenStub->OnRemoteRequest(
427 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_REFRESH_RATE),
428 parcel, reply, option);
429 parcel.RewindRead(0);
430 screenStub->OnRemoteRequest(
431 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_DEVICE_IS_CAPTURE),
432 parcel, reply, option);
433 parcel.RewindRead(0);
434 screenStub->OnRemoteRequest(
435 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SNAPSHOT_BY_PICKER),
436 parcel, reply, option);
437 parcel.RewindRead(0);
438 screenStub->OnRemoteRequest(
439 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SWITCH_USER),
440 parcel, reply, option);
441 parcel.RewindRead(0);
442 screenStub->OnRemoteRequest(
443 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_BLACK_LIST),
444 parcel, reply, option);
445 parcel.RewindRead(0);
446 screenStub->OnRemoteRequest(
447 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_DISABLE_POWEROFF_RENDER_CONTROL),
448 parcel, reply, option);
449 return true;
450 }
DoSomethingInterestingWithMyAPI8(const uint8_t * data,size_t size)451 bool DoSomethingInterestingWithMyAPI8(const uint8_t* data, size_t size)
452 {
453 if (data == nullptr || size < DATA_MIN_SIZE) {
454 return false;
455 }
456
457 MessageParcel parcel;
458 MessageParcel reply;
459 MessageOption option;
460
461 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
462 parcel.WriteBuffer(data, size);
463
464 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
465
466 parcel.RewindRead(0);
467 screenStub->OnRemoteRequest(
468 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_PROXY_FOR_FREEZE),
469 parcel, reply, option);
470 parcel.RewindRead(0);
471 screenStub->OnRemoteRequest(
472 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_RESET_ALL_FREEZE_STATUS),
473 parcel, reply, option);
474 parcel.RewindRead(0);
475 screenStub->OnRemoteRequest(
476 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_DISPLAY_HOOK_INFO),
477 parcel, reply, option);
478 parcel.RewindRead(0);
479 screenStub->OnRemoteRequest(
480 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_HOOK_INFO),
481 parcel, reply, option);
482 parcel.RewindRead(0);
483 screenStub->OnRemoteRequest(
484 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_ALL_PHYSICAL_DISPLAY_RESOLUTION),
485 parcel, reply, option);
486 parcel.RewindRead(0);
487 screenStub->OnRemoteRequest(
488 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_STATUS),
489 parcel, reply, option);
490 parcel.RewindRead(0);
491 screenStub->OnRemoteRequest(
492 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_SECURITY_EXEMPTION),
493 parcel, reply, option);
494 parcel.RewindRead(0);
495 screenStub->OnRemoteRequest(
496 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_MAX_REFRESHRATE),
497 parcel, reply, option);
498 parcel.RewindRead(0);
499 screenStub->OnRemoteRequest(
500 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_CAPTURE),
501 parcel, reply, option);
502 parcel.RewindRead(0);
503 screenStub->OnRemoteRequest(
504 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_PRIMARY_DISPLAY_INFO),
505 parcel, reply, option);
506 return true;
507 }
508
DoSomethingInterestingWithMyAPI9(const uint8_t * data,size_t size)509 bool DoSomethingInterestingWithMyAPI9(const uint8_t* data, size_t size)
510 {
511 if (data == nullptr || size < DATA_MIN_SIZE) {
512 return false;
513 }
514
515 MessageParcel parcel;
516 MessageParcel reply;
517 MessageOption option;
518
519 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
520 parcel.WriteBuffer(data, size);
521
522 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
523
524 parcel.RewindRead(0);
525 screenStub->OnRemoteRequest(
526 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_SNAPSHOT_WITH_OPTION),
527 parcel, reply, option);
528 parcel.RewindRead(0);
529 screenStub->OnRemoteRequest(
530 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_CAMERA_STATUS),
531 parcel, reply, option);
532 parcel.RewindRead(0);
533 screenStub->OnRemoteRequest(
534 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_ON_DELAY_TIME),
535 parcel, reply, option);
536 parcel.RewindRead(0);
537 screenStub->OnRemoteRequest(
538 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_COMBINATION),
539 parcel, reply, option);
540 parcel.RewindRead(0);
541 screenStub->OnRemoteRequest(
542 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_POWER_AUTO),
543 parcel, reply, option);
544 parcel.RewindRead(0);
545 screenStub->OnRemoteRequest(
546 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SCREEN_SKIP_PROTECTED_WINDOW),
547 parcel, reply, option);
548 parcel.RewindRead(0);
549 screenStub->OnRemoteRequest(
550 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_RECORD_EVENT_FROM_SCB),
551 parcel, reply, option);
552 parcel.RewindRead(0);
553 screenStub->OnRemoteRequest(
554 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_UPDATE_SUPER_FOLD_EXPAND_AVAILABLE_AREA),
555 parcel, reply, option);
556 parcel.RewindRead(0);
557 screenStub->OnRemoteRequest(
558 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_EXPAND_AVAILABLE_AREA),
559 parcel, reply, option);
560 return true;
561 }
562
DoSomethingInterestingWithMyAPI10(const uint8_t * data,size_t size)563 bool DoSomethingInterestingWithMyAPI10(const uint8_t* data, size_t size)
564 {
565 if (data == nullptr || size < DATA_MIN_SIZE) {
566 return false;
567 }
568
569 MessageParcel parcel;
570 MessageParcel reply;
571 MessageOption option;
572
573 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
574 parcel.WriteBuffer(data, size);
575
576 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
577
578 parcel.RewindRead(0);
579 screenStub->OnRemoteRequest(
580 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_IS_REAL_SCREEN),
581 parcel, reply, option);
582 parcel.RewindRead(0);
583 screenStub->OnRemoteRequest(
584 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_EXTEND_SCREEN_CONNECT_STATUS),
585 parcel, reply, option);
586 parcel.RewindRead(0);
587 screenStub->OnRemoteRequest(
588 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_DISPLAY_CAPABILITY),
589 parcel, reply, option);
590 parcel.RewindRead(0);
591 screenStub->OnRemoteRequest(
592 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_SYSTEM_KEYBOARD_STATUS),
593 parcel, reply, option);
594 parcel.RewindRead(0);
595 screenStub->OnRemoteRequest(
596 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_DISPLAY_MUTE_FLAG),
597 parcel, reply, option);
598 parcel.RewindRead(0);
599 screenStub->OnRemoteRequest(
600 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_DEFAULT_MODE_WHEN_SWITCH_USER),
601 parcel, reply, option);
602 parcel.RewindRead(0);
603 screenStub->OnRemoteRequest(
604 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_EXTEND_SCREEN_CREATE_FINISH),
605 parcel, reply, option);
606 parcel.RewindRead(0);
607 screenStub->OnRemoteRequest(
608 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_EXTEND_SCREEN_DESTROY_FINISH),
609 parcel, reply, option);
610 parcel.RewindRead(0);
611 screenStub->OnRemoteRequest(
612 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_FOLD_STATUS_EXPAND_AND_LOCKED),
613 parcel, reply, option);
614 parcel.RewindRead(0);
615 screenStub->OnRemoteRequest(
616 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_NOTIFY_SCREEN_MASK_APPEAR),
617 parcel, reply, option);
618 return true;
619 }
620
DoSomethingInterestingWithMyAPI11(const uint8_t * data,size_t size)621 bool DoSomethingInterestingWithMyAPI11(const uint8_t* data, size_t size)
622 {
623 if (data == nullptr || size < DATA_MIN_SIZE) {
624 return false;
625 }
626
627 MessageParcel parcel;
628 MessageParcel reply;
629 MessageOption option;
630
631 parcel.WriteInterfaceToken(ScreenSessionManagerStub::GetDescriptor());
632 parcel.WriteBuffer(data, size);
633
634 std::shared_ptr<ScreenSessionManagerStub> screenStub = std::make_shared<ScreenSessionManagerStub>();
635
636 parcel.RewindRead(0);
637 screenStub->OnRemoteRequest(
638 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_KEYBOARD_STATE),
639 parcel, reply, option);
640 parcel.RewindRead(0);
641 screenStub->OnRemoteRequest(
642 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_GET_SCREEN_AREA_OF_DISPLAY_AREA),
643 parcel, reply, option);
644 parcel.RewindRead(0);
645 screenStub->OnRemoteRequest(
646 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_PRIMARY_DISPLAY_SYSTEM_DPI),
647 parcel, reply, option);
648 parcel.RewindRead(0);
649 screenStub->OnRemoteRequest(
650 static_cast<uint32_t>(DisplayManagerMessage::TRANS_ID_SET_VIRTUAL_SCREEN_AUTO_ROTATION),
651 parcel, reply, option);
652 return true;
653 }
654
655 } // namespace.OHOS
656
657 /* Fuzzer entry point */
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)658 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
659 {
660 /* Run your code on data */
661 OHOS::DoSomethingInterestingWithMyAPI(data, size);
662 OHOS::DoSomethingInterestingWithMyAPI1(data, size);
663 OHOS::DoSomethingInterestingWithMyAPI2(data, size);
664 OHOS::DoSomethingInterestingWithMyAPI3(data, size);
665 OHOS::DoSomethingInterestingWithMyAPI4(data, size);
666 OHOS::DoSomethingInterestingWithMyAPI5(data, size);
667 OHOS::DoSomethingInterestingWithMyAPI6(data, size);
668 OHOS::DoSomethingInterestingWithMyAPI7(data, size);
669 OHOS::DoSomethingInterestingWithMyAPI8(data, size);
670 OHOS::DoSomethingInterestingWithMyAPI9(data, size);
671 OHOS::DoSomethingInterestingWithMyAPI10(data, size);
672 OHOS::DoSomethingInterestingWithMyAPI11(data, size);
673 return 0;
674 }
675