• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     NO_ERROR = 0,
47     E_OK = WALLPAPER_ERR_OFFSET,
48     E_SA_DIED,
49     E_READ_PARCEL_ERROR,
50     E_WRITE_PARCEL_ERROR,
51     E_PUBLISH_FAIL,
52     E_TRANSACT_ERROR,
53     E_DEAL_FAILED,
54     E_PARAMETERS_INVALID,
55     E_SET_RTC_FAILED,
56     E_NOT_FOUND,
57     E_NO_PERMISSION,
58     E_FILE_ERROR,
59     E_IMAGE_ERRCODE,
60     E_NO_MEMORY,
61     E_NOT_SYSTEM_APP,
62     E_USER_IDENTITY_ERROR,
63     E_CHECK_DESCRIPTOR_ERROR,
64     E_PICTURE_OVERSIZED,
65     E_UNKNOWN,
66 };
67 using JsCallbackOffset = bool (*)(int32_t, int32_t);
68 
69 struct WallpaperPictureInfo {
70     FoldState foldState;
71     RotateState rotateState;
72     int32_t fd;
73     long length;
74     std::string tempPath;
75 };
76 
77 } // namespace WallpaperMgrService
78 } // namespace OHOS
79 
80 #endif // WALLPAPER_SERVICES_WALLPAPER_COMMON_H