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