1365d9939Sopenharmony_ci/*
2365d9939Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3365d9939Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4365d9939Sopenharmony_ci * you may not use this file except in compliance with the License.
5365d9939Sopenharmony_ci * You may obtain a copy of the License at
6365d9939Sopenharmony_ci *
7365d9939Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8365d9939Sopenharmony_ci *
9365d9939Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10365d9939Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11365d9939Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12365d9939Sopenharmony_ci * See the License for the specific language governing permissions and
13365d9939Sopenharmony_ci * limitations under the License.
14365d9939Sopenharmony_ci */
15365d9939Sopenharmony_ci
16365d9939Sopenharmony_ci#ifndef SERVICES_INCLUDE_SCREENLOCK_COMMON_H
17365d9939Sopenharmony_ci#define SERVICES_INCLUDE_SCREENLOCK_COMMON_H
18365d9939Sopenharmony_ci
19365d9939Sopenharmony_ci#include <string>
20365d9939Sopenharmony_ci
21365d9939Sopenharmony_ci#include "errors.h"
22365d9939Sopenharmony_ci
23365d9939Sopenharmony_cinamespace OHOS {
24365d9939Sopenharmony_cinamespace ScreenLock {
25365d9939Sopenharmony_ci#define SCREENLOCK_SERVICE_NAME "ScreenLockService"
26365d9939Sopenharmony_ci#define PARAM_ZERO 0
27365d9939Sopenharmony_ci#define PARAM_ONE 1
28365d9939Sopenharmony_ci#define PARAM_TWO 2
29365d9939Sopenharmony_ci
30365d9939Sopenharmony_ciconst std::string BEGIN_WAKEUP = "beginWakeUp";
31365d9939Sopenharmony_ciconst std::string END_WAKEUP = "endWakeUp";
32365d9939Sopenharmony_ciconst std::string BEGIN_SCREEN_ON = "beginScreenOn";
33365d9939Sopenharmony_ciconst std::string END_SCREEN_ON = "endScreenOn";
34365d9939Sopenharmony_ciconst std::string BEGIN_SLEEP = "beginSleep";
35365d9939Sopenharmony_ciconst std::string END_SLEEP = "endSleep";
36365d9939Sopenharmony_ciconst std::string BEGIN_SCREEN_OFF = "beginScreenOff";
37365d9939Sopenharmony_ciconst std::string END_SCREEN_OFF = "endScreenOff";
38365d9939Sopenharmony_ciconst std::string STRONG_AUTH_CHANGED = "strongAuthChanged";
39365d9939Sopenharmony_ciconst std::string CHANGE_USER = "changeUser";
40365d9939Sopenharmony_ciconst std::string SCREENLOCK_ENABLED = "screenlockEnabled";
41365d9939Sopenharmony_ciconst std::string EXIT_ANIMATION = "beginExitAnimation";
42365d9939Sopenharmony_ciconst std::string UNLOCKSCREEN = "unlockScreen";
43365d9939Sopenharmony_ciconst std::string UNLOCK_SCREEN_RESULT = "unlockScreenResult";
44365d9939Sopenharmony_ciconst std::string LOCKSCREEN = "lockScreen";
45365d9939Sopenharmony_ciconst std::string LOCK_SCREEN_RESULT = "lockScreenResult";
46365d9939Sopenharmony_ciconst std::string SCREEN_DRAWDONE = "screenDrawDone";
47365d9939Sopenharmony_ciconst std::string SYSTEM_READY = "systemReady";
48365d9939Sopenharmony_ciconst std::string SERVICE_RESTART = "serviceRestart";
49365d9939Sopenharmony_ciconst int USER_NULL = -10000;
50365d9939Sopenharmony_cienum ScreenLockModule {
51365d9939Sopenharmony_ci    SCREENLOCK_MODULE_SERVICE_ID = 0x04,
52365d9939Sopenharmony_ci};
53365d9939Sopenharmony_ci// time error offset, used only in this file.
54365d9939Sopenharmony_ciconstexpr ErrCode SCREENLOCK_ERR_OFFSET = ErrCodeOffset(SUBSYS_SMALLSERVICES, SCREENLOCK_MODULE_SERVICE_ID);
55365d9939Sopenharmony_ci
56365d9939Sopenharmony_cienum ScreenLockError {
57365d9939Sopenharmony_ci    E_SCREENLOCK_OK = SCREENLOCK_ERR_OFFSET,
58365d9939Sopenharmony_ci    E_SCREENLOCK_SA_DIED,
59365d9939Sopenharmony_ci    E_SCREENLOCK_READ_PARCEL_ERROR,
60365d9939Sopenharmony_ci    E_SCREENLOCK_WRITE_PARCEL_ERROR,
61365d9939Sopenharmony_ci    E_SCREENLOCK_PUBLISH_FAIL,
62365d9939Sopenharmony_ci    E_SCREENLOCK_TRANSACT_ERROR,
63365d9939Sopenharmony_ci    E_SCREENLOCK_DEAL_FAILED,
64365d9939Sopenharmony_ci    E_SCREENLOCK_PARAMETERS_INVALID,
65365d9939Sopenharmony_ci    E_SCREENLOCK_SET_RTC_FAILED,
66365d9939Sopenharmony_ci    E_SCREENLOCK_NOT_FOUND,
67365d9939Sopenharmony_ci    E_SCREENLOCK_NO_PERMISSION,
68365d9939Sopenharmony_ci    E_SCREENLOCK_NULLPTR,
69365d9939Sopenharmony_ci    E_SCREENLOCK_SENDREQUEST_FAILED,
70365d9939Sopenharmony_ci    E_SCREENLOCK_NOT_SYSTEM_APP,
71365d9939Sopenharmony_ci    E_SCREENLOCK_NOT_FOCUS_APP,
72365d9939Sopenharmony_ci};
73365d9939Sopenharmony_ci
74365d9939Sopenharmony_cienum TraceTaskId : int32_t {
75365d9939Sopenharmony_ci    HITRACE_UNLOCKSCREEN,
76365d9939Sopenharmony_ci    HITRACE_LOCKSCREEN,
77365d9939Sopenharmony_ci    HITRACE_BUTT,
78365d9939Sopenharmony_ci};
79365d9939Sopenharmony_ci
80365d9939Sopenharmony_cienum ScreenChange {
81365d9939Sopenharmony_ci    SCREEN_SUCC = 0,
82365d9939Sopenharmony_ci    SCREEN_FAIL,
83365d9939Sopenharmony_ci    SCREEN_CANCEL,
84365d9939Sopenharmony_ci};
85365d9939Sopenharmony_ci
86365d9939Sopenharmony_cienum JsErrorCode : uint32_t {
87365d9939Sopenharmony_ci    ERR_NO_PERMISSION = 201,
88365d9939Sopenharmony_ci    ERR_NOT_SYSTEM_APP = 202,
89365d9939Sopenharmony_ci    ERR_INVALID_PARAMS = 401,
90365d9939Sopenharmony_ci    ERR_CANCEL_UNLOCK = 13200001,
91365d9939Sopenharmony_ci    ERR_SERVICE_ABNORMAL = 13200002,
92365d9939Sopenharmony_ci    ERR_ILLEGAL_USE = 13200003,
93365d9939Sopenharmony_ci};
94365d9939Sopenharmony_ci
95365d9939Sopenharmony_cienum class Action : uint8_t {
96365d9939Sopenharmony_ci    LOCK = 0,
97365d9939Sopenharmony_ci    UNLOCK,
98365d9939Sopenharmony_ci    UNLOCKSCREEN,
99365d9939Sopenharmony_ci};
100365d9939Sopenharmony_ci
101365d9939Sopenharmony_cienum class StrongAuthReasonFlags : int32_t {
102365d9939Sopenharmony_ci    NONE = 0x00000000,
103365d9939Sopenharmony_ci    AFTER_BOOT = 0x00000001,
104365d9939Sopenharmony_ci    AFTER_TIMEOUT = 0x00000002,
105365d9939Sopenharmony_ci    ACTIVE_REQUEST = 0x00000004,
106365d9939Sopenharmony_ci    DPM_RESTRICT = 0x00000008,
107365d9939Sopenharmony_ci};
108365d9939Sopenharmony_ci
109365d9939Sopenharmony_ciconstexpr int BEGIN_SLEEP_DEVICE_ADMIN_REASON = 1;
110365d9939Sopenharmony_ciconstexpr int BEGIN_SLEEP_USER_REASON = 2;
111365d9939Sopenharmony_ciconstexpr int BEGIN_SLEEP_LONG_TIME_UNOPERATOR = 3;
112365d9939Sopenharmony_ci
113365d9939Sopenharmony_ciconstexpr int END_SLEEP_DEVICE_ADMIN_REASON = 1;
114365d9939Sopenharmony_ciconstexpr int END_SLEEP_USER_REASON = 2;
115365d9939Sopenharmony_ciconstexpr int END_SLEEP_LONG_TIME_UNOPERATE = 3;
116365d9939Sopenharmony_ci
117365d9939Sopenharmony_ciconstexpr int SCREENLOCK_APP_CAN_USE = 1;
118365d9939Sopenharmony_ciconstexpr int SCREENLOCK_APP_CAN_NOT_USE = 0;
119365d9939Sopenharmony_ci
120365d9939Sopenharmony_ciconstexpr std::int32_t DEFAULT_ERROR = -1;
121365d9939Sopenharmony_ciconstexpr int32_t NONE_EVENT_TYPE = 0;
122365d9939Sopenharmony_ciconstexpr int ARGV_ZERO = 0;
123365d9939Sopenharmony_ciconstexpr int ARGV_ONE = 1;
124365d9939Sopenharmony_ciconstexpr int ARGV_TWO = 2;
125365d9939Sopenharmony_ciconstexpr int ARGV_THREE = 3;
126365d9939Sopenharmony_ciconstexpr int ARGV_NORMAL = -100;
127365d9939Sopenharmony_ciconstexpr std::int32_t MAX_VALUE_LEN = 4096;
128365d9939Sopenharmony_ciconstexpr const std::int32_t STR_MAX_SIZE = 256;
129365d9939Sopenharmony_ciconstexpr int RESULT_COUNT = 2;
130365d9939Sopenharmony_ciconstexpr int PARAMTWO = 2;
131365d9939Sopenharmony_ciconstexpr std::int32_t ARGS_SIZE_ZERO = 0;
132365d9939Sopenharmony_ciconstexpr std::int32_t ARGS_SIZE_ONE = 1;
133365d9939Sopenharmony_ciconstexpr std::int32_t ARGS_SIZE_TWO = 2;
134365d9939Sopenharmony_ciconstexpr std::int32_t ARGS_SIZE_THREE = 3;
135365d9939Sopenharmony_ciconstexpr std::int32_t ARGS_SIZE_FOUR = 4;
136365d9939Sopenharmony_ciconstexpr std::int32_t RESULT_ZERO = 0;
137365d9939Sopenharmony_ci} // namespace ScreenLock
138365d9939Sopenharmony_ci} // namespace OHOS
139365d9939Sopenharmony_ci#endif // SERVICES_INCLUDE_SCREENLOCK_COMMON_H