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 #ifndef WALLPAPER_SERVICES_WALLPAPER_COMMON_H 16 #define WALLPAPER_SERVICES_WALLPAPER_COMMON_H 17 18 #include <string> 19 20 #include "errors.h" 21 #include "wallpaper_manager_common_info.h" 22 23 namespace OHOS { 24 namespace WallpaperMgrService { 25 #define WALLPAPER_SERVICE_NAME "WallpaperMgrService" 26 static const std::string WALLPAPER_BUNDLE_NAME = "ohos"; 27 static const std::string WALLPAPER_PERMISSION_NAME_GET_WALLPAPER = "ohos.permission.GET_WALLPAPER"; 28 static const std::string WALLPAPER_PERMISSION_NAME_SET_WALLPAPER = "ohos.permission.SET_WALLPAPER"; 29 static const std::string WALLPAPER_PERMISSION_NAME_CAPTURE_SCREEN = "ohos.permission.CAPTURE_SCREEN"; 30 31 static const std::string TEST_LABEL = "test label"; 32 static const std::string TEST_DESCRIPTION = "test description"; 33 34 struct ApiInfo { 35 bool needException; 36 bool isSystemApi; 37 }; 38 39 enum WallpaperModule { 40 WALLPAPER_MODULE_SERVICE_ID = 0x07, 41 }; 42 // time error offset, used only in this file. 43 constexpr ErrCode WALLPAPER_ERR_OFFSET = ErrCodeOffset(SUBSYS_SMALLSERVICES, WALLPAPER_MODULE_SERVICE_ID); 44 45 enum ErrorCode : int32_t { 46 E_OK = WALLPAPER_ERR_OFFSET, 47 E_SA_DIED, 48 E_READ_PARCEL_ERROR, 49 E_WRITE_PARCEL_ERROR, 50 E_PUBLISH_FAIL, 51 E_TRANSACT_ERROR, 52 E_DEAL_FAILED, 53 E_PARAMETERS_INVALID, 54 E_SET_RTC_FAILED, 55 E_NOT_FOUND, 56 E_NO_PERMISSION, 57 E_FILE_ERROR, 58 E_IMAGE_ERRCODE, 59 E_NO_MEMORY, 60 E_NOT_SYSTEM_APP, 61 E_USER_IDENTITY_ERROR, 62 E_CHECK_DESCRIPTOR_ERROR, 63 E_UNKNOWN, 64 }; 65 using JsCallbackOffset = bool (*)(int32_t, int32_t); 66 67 struct WallpaperPictureInfo { 68 FoldState foldState; 69 RotateState rotateState; 70 int32_t fd; 71 long length; 72 std::string tempPath; 73 }; 74 75 } // namespace WallpaperMgrService 76 } // namespace OHOS 77 78 #endif // WALLPAPER_SERVICES_WALLPAPER_COMMON_H