1 /* 2 * Copyright (c) 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 #ifndef MEDIALIBRARY_PERMISSION_FUZZER_H 17 #define MEDIALIBRARY_PERMISSION_FUZZER_H 18 19 #define FUZZ_PROJECT_NAME "medialibrarypermission_fuzzer" 20 21 #include <vector> 22 #include "medialibrary_business_code.h" 23 24 namespace OHOS { 25 namespace Media { 26 const int32_t GRANT_PERMISSION_CALLING_UID = 5523; 27 const int32_t ROOT_UID = 0; 28 const int32_t HDC_SHELL_UID = 2000; 29 const int32_t SANDBOX_UID = 3076; 30 31 const std::vector<MediaLibraryBusinessCode> BUSINESS_CODE_LIST = { 32 MediaLibraryBusinessCode::MEDIA_BUSINESS_CODE_START, 33 MediaLibraryBusinessCode::REMOVE_FORM_INFO, 34 MediaLibraryBusinessCode::REMOVE_GALLERY_FORM_INFO, 35 MediaLibraryBusinessCode::SAVE_FORM_INFO, 36 MediaLibraryBusinessCode::SAVE_GALLERY_FORM_INFO, 37 MediaLibraryBusinessCode::UPDATE_GALLERY_FORM_INFO, 38 MediaLibraryBusinessCode::SUBMIT_CLOUD_ENHANCEMENT_TASKS, 39 MediaLibraryBusinessCode::PRIORITIZE_CLOUD_ENHANCEMENT_TASK, 40 MediaLibraryBusinessCode::CANCEL_CLOUD_ENHANCEMENT_TASKS, 41 MediaLibraryBusinessCode::CANCEL_ALL_CLOUD_ENHANCEMENT_TASKS, 42 MediaLibraryBusinessCode::PAH_OPEN, 43 MediaLibraryBusinessCode::PAH_START_THUMBNAIL_CREATION_TASK, 44 MediaLibraryBusinessCode::PAH_STOP_THUMBNAIL_CREATION_TASK, 45 MediaLibraryBusinessCode::GET_CLOUD_ENHANCEMENT_PAIR, 46 MediaLibraryBusinessCode::QUERY_CLOUD_ENHANCEMENT_TASK_STATE, 47 MediaLibraryBusinessCode::SYNC_CLOUD_ENHANCEMENT_TASK_STATUS, 48 MediaLibraryBusinessCode::GET_ANALYSIS_PROCESS, 49 MediaLibraryBusinessCode::NOTIFY_FOR_RECHECK, 50 MediaLibraryBusinessCode::MEDIA_BUSINESS_CODE_END, 51 MediaLibraryBusinessCode::ASSETS_BUSINESS_CODE_START, 52 MediaLibraryBusinessCode::CLONE_ASSET, 53 MediaLibraryBusinessCode::REVERT_TO_ORIGINAL, 54 MediaLibraryBusinessCode::COMMIT_EDITED_ASSET, 55 MediaLibraryBusinessCode::PAH_PUBLIC_CREATE_ASSET, 56 MediaLibraryBusinessCode::PAH_SYSTEM_CREATE_ASSET, 57 MediaLibraryBusinessCode::PAH_PUBLIC_CREATE_ASSET_FOR_APP, 58 MediaLibraryBusinessCode::PAH_SYSTEM_CREATE_ASSET_FOR_APP, 59 MediaLibraryBusinessCode::PAH_SYSTEM_CREATE_ASSET_FOR_APP_WITH_MODE, 60 MediaLibraryBusinessCode::PAH_SYSTEM_CREATE_ASSET_FOR_APP_WITH_ALBUM, 61 MediaLibraryBusinessCode::PAH_PUBLIC_SET_TITLE, 62 MediaLibraryBusinessCode::PAH_SYSTEM_SET_PENDING, 63 MediaLibraryBusinessCode::PAH_SYSTEM_SET_FAVORITE, 64 MediaLibraryBusinessCode::PAH_SYSTEM_SET_USER_COMMENT, 65 MediaLibraryBusinessCode::PAH_SYSTEM_BATCH_SET_HIDDEN, 66 MediaLibraryBusinessCode::PAH_SYSTEM_BATCH_SET_FAVORITE, 67 MediaLibraryBusinessCode::PAH_SYSTEM_BATCH_SET_RECENT_SHOW, 68 MediaLibraryBusinessCode::PAH_SYSTEM_BATCH_SET_USER_COMMENT, 69 MediaLibraryBusinessCode::PAH_GET_ASSET_ANALYSIS_DATA, 70 MediaLibraryBusinessCode::PAH_SYS_TRASH_PHOTOS, 71 MediaLibraryBusinessCode::PAH_TRASH_PHOTOS, 72 MediaLibraryBusinessCode::PAH_DELETE_PHOTOS, 73 MediaLibraryBusinessCode::DELETE_PHOTOS_COMPLETED, 74 MediaLibraryBusinessCode::START_DOWNLOAD_CLOUDMEDIA, 75 MediaLibraryBusinessCode::PAUSE_DOWNLOAD_CLOUDMEDIA, 76 MediaLibraryBusinessCode::CANCEL_DOWNLOAD_CLOUDMEDIA, 77 MediaLibraryBusinessCode::RETAIN_CLOUDMEDIA_ASSET, 78 MediaLibraryBusinessCode::PAH_GRANT_PHOTO_URI_PERMISSION, 79 MediaLibraryBusinessCode::PAH_GRANT_PHOTO_URIS_PERMISSION, 80 MediaLibraryBusinessCode::PAH_CANCEL_PHOTO_URI_PERMISSION, 81 MediaLibraryBusinessCode::ASSET_CHANGE_SET_FAVORITE, 82 MediaLibraryBusinessCode::ASSET_CHANGE_SET_HIDDEN, 83 MediaLibraryBusinessCode::ASSET_CHANGE_SET_USER_COMMENT, 84 MediaLibraryBusinessCode::ASSET_CHANGE_SET_LOCATION, 85 MediaLibraryBusinessCode::ASSET_CHANGE_SET_TITLE, 86 MediaLibraryBusinessCode::ASSET_CHANGE_SET_EDIT_DATA, 87 MediaLibraryBusinessCode::ASSET_CHANGE_SUBMIT_CACHE, 88 MediaLibraryBusinessCode::ASSET_CHANGE_CREATE_ASSET, 89 MediaLibraryBusinessCode::ASSET_CHANGE_ADD_IMAGE, 90 MediaLibraryBusinessCode::SET_CAMERA_SHOT_KEY, 91 MediaLibraryBusinessCode::SAVE_CAMERA_PHOTO, 92 MediaLibraryBusinessCode::DISCARD_CAMERA_PHOTO, 93 MediaLibraryBusinessCode::SET_EFFECT_MODE, 94 MediaLibraryBusinessCode::SET_ORIENTATION, 95 MediaLibraryBusinessCode::SET_VIDEO_ENHANCEMENT_ATTR, 96 MediaLibraryBusinessCode::SET_SUPPORTED_WATERMARK_TYPE, 97 MediaLibraryBusinessCode::PAH_GET_ASSETS, 98 MediaLibraryBusinessCode::GET_BURST_ASSETS, 99 MediaLibraryBusinessCode::FIND_ALL_DUPLICATE_ASSETS, 100 MediaLibraryBusinessCode::FIND_DUPLICATE_ASSETS_TO_DELETE, 101 MediaLibraryBusinessCode::GET_INDEX_CONSTRUCT_PROGRESS, 102 MediaLibraryBusinessCode::QUERY_IS_EDITED, 103 MediaLibraryBusinessCode::QUERY_REQUEST_EDIT_DATA, 104 MediaLibraryBusinessCode::QUERY_GET_EDIT_DATA, 105 MediaLibraryBusinessCode::QUERY_GET_CLOUDMEDIA_ASSET_STATUS, 106 MediaLibraryBusinessCode::QUERY_START_ASSET_ANALYSIS, 107 MediaLibraryBusinessCode::PAH_REQUEST_CONTENT, 108 MediaLibraryBusinessCode::QUERY_PHOTO_STATUS, 109 MediaLibraryBusinessCode::LOG_MOVING_PHOTO, 110 MediaLibraryBusinessCode::CONVERT_FORMAT, 111 MediaLibraryBusinessCode::ASSETS_BUSINESS_CODE_END, 112 MediaLibraryBusinessCode::ALBUMS_BUSINESS_CODE_START, 113 MediaLibraryBusinessCode::DELETE_HIGH_LIGHT_ALBUMS, 114 MediaLibraryBusinessCode::PAH_SYSTEM_CREATE_ALBUM, 115 MediaLibraryBusinessCode::PAH_DELETE_PHOTO_ALBUMS, 116 MediaLibraryBusinessCode::ALBUM_SYS_GET_ASSETS, 117 MediaLibraryBusinessCode::ALBUM_GET_ASSETS, 118 MediaLibraryBusinessCode::CHANGE_REQUEST_SET_ALBUM_NAME, 119 MediaLibraryBusinessCode::CHANGE_REQUEST_SET_COVER_URI, 120 MediaLibraryBusinessCode::CHANGE_REQUEST_SET_IS_ME, 121 MediaLibraryBusinessCode::CHANGE_REQUEST_SET_DISPLAY_LEVEL, 122 MediaLibraryBusinessCode::CHANGE_REQUEST_DISMISS, 123 MediaLibraryBusinessCode::CHANGE_REQUEST_RESET_COVER_URI, 124 MediaLibraryBusinessCode::SET_HIGH_LIGHT_USER_ACTION_DATA, 125 MediaLibraryBusinessCode::SET_SUBTITLE, 126 MediaLibraryBusinessCode::CHANGE_REQUEST_ADD_ASSETS, 127 MediaLibraryBusinessCode::CHANGE_REQUEST_REMOVE_ASSETS, 128 MediaLibraryBusinessCode::CHANGE_REQUEST_MOVE_ASSETS, 129 MediaLibraryBusinessCode::CHANGE_REQUEST_RECOVER_ASSETS, 130 MediaLibraryBusinessCode::CHANGE_REQUEST_DELETE_ASSETS, 131 MediaLibraryBusinessCode::CHANGE_REQUEST_DISMISS_ASSETS, 132 MediaLibraryBusinessCode::CHANGE_REQUEST_MERGE_ALBUM, 133 MediaLibraryBusinessCode::CHANGE_REQUEST_PLACE_BEFORE, 134 MediaLibraryBusinessCode::CHANGE_REQUEST_SET_ORDER_POSITION, 135 MediaLibraryBusinessCode::PAH_COMMIT_MODIFY, 136 MediaLibraryBusinessCode::PAH_ADD_ASSETS, 137 MediaLibraryBusinessCode::PAH_REMOVE_ASSETS, 138 MediaLibraryBusinessCode::PAH_RECOVER_ASSETS, 139 MediaLibraryBusinessCode::PAH_SET_COVER_URI, 140 MediaLibraryBusinessCode::PAH_QUERY_PHOTO_ALBUMS, 141 MediaLibraryBusinessCode::PAH_QUERY_HIDDEN_ALBUMS, 142 MediaLibraryBusinessCode::PAH_GET_ORDER_POSITION, 143 MediaLibraryBusinessCode::PAH_QUERY_GET_ALBUMS_BY_IDS, 144 MediaLibraryBusinessCode::GET_FACE_ID, 145 MediaLibraryBusinessCode::GET_PHOTO_INDEX, 146 MediaLibraryBusinessCode::GET_HIGHLIGHT_ALBUM_INFO, 147 MediaLibraryBusinessCode::PAH_GET_PHOTO_ALBUMS, 148 MediaLibraryBusinessCode::PAH_GET_PHOTO_ALBUM_ORDER, 149 MediaLibraryBusinessCode::PAH_SET_PHOTO_ALBUM_ORDER, 150 MediaLibraryBusinessCode::ALBUMS_BUSINESS_CODE_END, 151 MediaLibraryBusinessCode::MEDIA_CLOUD_CODE_START, 152 MediaLibraryBusinessCode::MEDIA_CLOUD_CODE_END, 153 MediaLibraryBusinessCode::INNER_BUSINESS_CODE_START, 154 MediaLibraryBusinessCode::INNER_ADD_ASSET_VISIT_COUNT, 155 MediaLibraryBusinessCode::INNER_QUERY_PHOTO_STATUS, 156 MediaLibraryBusinessCode::INNER_CREATE_ASSET, 157 MediaLibraryBusinessCode::INNER_GET_RESULT_SET_FROM_DB, 158 MediaLibraryBusinessCode::INNER_GET_RESULT_SET_FROM_DB_EXTEND, 159 MediaLibraryBusinessCode::INNER_GET_RESULT_SET_FROM_PHOTOS_EXTEND, 160 MediaLibraryBusinessCode::INNER_GET_MOVING_PHOTO_DATE_MODIFIED, 161 MediaLibraryBusinessCode::INNER_GET_FILEPATH_FROM_URI, 162 MediaLibraryBusinessCode::INNER_GET_URI_FROM_FILEPATH, 163 MediaLibraryBusinessCode::INNER_CANCEL_PHOTO_URI_PERMISSION, 164 MediaLibraryBusinessCode::INNER_GRANT_PHOTO_URI_PERMISSION, 165 MediaLibraryBusinessCode::INNER_CLOSE_ASSET, 166 MediaLibraryBusinessCode::INNER_CHECK_PHOTO_URI_PERMISSION, 167 MediaLibraryBusinessCode::INNER_CHECK_AUDIO_URI_PERMISSION, 168 MediaLibraryBusinessCode::INNER_GET_URIS_BY_OLD_URIS, 169 MediaLibraryBusinessCode::INNER_CUSTOM_RESTORE, 170 MediaLibraryBusinessCode::INNER_CUSTOM_RESTORE_CANCEL, 171 MediaLibraryBusinessCode::INNER_GET_RESULT_SET_FROM_PHOTOS, 172 MediaLibraryBusinessCode::INNER_BUSINESS_CODE_END 173 }; 174 175 const std::vector<int32_t> CALLING_UID_LIST = { 176 GRANT_PERMISSION_CALLING_UID, 177 ROOT_UID, 178 HDC_SHELL_UID, 179 SANDBOX_UID 180 }; 181 } //namespace Media 182 } // namespace OHOS 183 #endif