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 16 #ifndef SERVICES_INCLUDE_SCREENLOCK_COMMON_H 17 #define SERVICES_INCLUDE_SCREENLOCK_COMMON_H 18 19 #include <string> 20 21 #include "errors.h" 22 23 namespace OHOS { 24 namespace ScreenLock { 25 #define SCREENLOCK_SERVICE_NAME "ScreenLockService" 26 #define PARAM_ZERO 0 27 #define PARAM_ONE 1 28 #define PARAM_TWO 2 29 30 struct AppInfo { 31 std::string bundleName_; 32 int userId_; 33 }; 34 35 const std::string BEGIN_WAKEUP = "beginWakeUp"; 36 const std::string END_WAKEUP = "endWakeUp"; 37 const std::string BEGIN_SCREEN_ON = "beginScreenOn"; 38 const std::string END_SCREEN_ON = "endScreenOn"; 39 const std::string BEGIN_SLEEP = "beginSleep"; 40 const std::string END_SLEEP = "endSleep"; 41 const std::string BEGIN_SCREEN_OFF = "beginScreenOff"; 42 const std::string END_SCREEN_OFF = "endScreenOff"; 43 const std::string CHANGE_USER = "changeUser"; 44 const std::string SCREENLOCK_ENABLED = "screenlockEnabled"; 45 const std::string EXIT_ANIMATION = "beginExitAnimation"; 46 const std::string UNLOCKSCREEN = "unlockScreen"; 47 const std::string UNLOCK_SCREEN_RESULT = "unlockScreenResult"; 48 const std::string SCREEN_DRAWDONE = "screenDrawDone"; 49 const std::string SYSTEM_READY = "systemReady"; 50 const std::string BUNDLE_NAME = "com.ohos.screenlock"; 51 const int USER_NULL = -10000; 52 enum ScreenLockModule { 53 SCREENLOCK_MODULE_SERVICE_ID = 0x04, 54 }; 55 // time error offset, used only in this file. 56 constexpr ErrCode SCREENLOCK_ERR_OFFSET = ErrCodeOffset(SUBSYS_SMALLSERVICES, SCREENLOCK_MODULE_SERVICE_ID); 57 58 enum ScreenLockError { 59 E_SCREENLOCK_OK = SCREENLOCK_ERR_OFFSET, 60 E_SCREENLOCK_SA_DIED, 61 E_SCREENLOCK_READ_PARCEL_ERROR, 62 E_SCREENLOCK_WRITE_PARCEL_ERROR, 63 E_SCREENLOCK_PUBLISH_FAIL, 64 E_SCREENLOCK_TRANSACT_ERROR, 65 E_SCREENLOCK_DEAL_FAILED, 66 E_SCREENLOCK_PARAMETERS_INVALID, 67 E_SCREENLOCK_SET_RTC_FAILED, 68 E_SCREENLOCK_NOT_FOUND, 69 E_SCREENLOCK_NO_PERMISSION, 70 }; 71 72 constexpr int BEGIN_SLEEP_DEVICE_ADMIN_REASON = 1; 73 constexpr int BEGIN_SLEEP_USER_REASON = 2; 74 constexpr int BEGIN_SLEEP_LONG_TIME_UNOPERATOR = 3; 75 76 constexpr int END_SLEEP_DEVICE_ADMIN_REASON = 1; 77 constexpr int END_SLEEP_USER_REASON = 2; 78 constexpr int END_SLEEP_LONG_TIME_UNOPERATE = 3; 79 80 constexpr int UNLOCKSCREEN_SUCC = 0; 81 constexpr int UNLOCKSCREEN_FAIL = 1; 82 constexpr int UNLOCKSCREEN_CANCEL = 2; 83 84 constexpr int SCREENLOCK_APP_CAN_USE = 1; 85 constexpr int SCREENLOCK_APP_CAN_NOT_USE = 0; 86 87 constexpr std::int32_t DEFAULT_ERROR = -1; 88 constexpr int32_t NONE_EVENT_TYPE = 0; 89 constexpr int ARGV_ZERO = 0; 90 constexpr int ARGV_ONE = 1; 91 constexpr int ARGV_TWO = 2; 92 constexpr int ARGV_THREE = 3; 93 constexpr int ARGV_NORMAL = -100; 94 constexpr std::int32_t MAX_VALUE_LEN = 4096; 95 constexpr const std::int32_t STR_MAX_SIZE = 256; 96 constexpr int RESULT_COUNT = 2; 97 constexpr int PARAMTWO = 2; 98 constexpr std::int32_t ARGS_SIZE_ZERO = 0; 99 constexpr std::int32_t ARGS_SIZE_ONE = 1; 100 constexpr std::int32_t ARGS_SIZE_TWO = 2; 101 constexpr std::int32_t ARGS_SIZE_THREE = 3; 102 constexpr std::int32_t ARGS_SIZE_FOUR = 4; 103 constexpr std::int32_t RESULT_ZERO = 0; 104 static const uint32_t SCREENLOCK_BEGIN_WAKEUP = 0x00000001; 105 static const uint32_t SCREENLOCK_END_WAKEUP = 0x00000004; 106 static const uint32_t SCREENLOCK_BEGIN_SCREEN_ON = 0x00000008; 107 static const uint32_t SCREENLOCK_END_SCREEN_ON = 0x00000010; 108 static const uint32_t SCREENLOCK_BEGIN_SCREEN_OFF = 0x00000020; 109 static const uint32_t SCREENLOCK_END_SCREEN_OFF = 0x00000040; 110 static const uint32_t SCREENLOCK_UNLOCK_SCREEN = 0x00000080; 111 static const uint32_t SCREENLOCK_BEGIN_SLEEP = 0x00000100; 112 static const uint32_t SCREENLOCK_END_SLEEP = 0x00000200; 113 static const uint32_t SCREENLOCK_CHANGE_USER = 0x00000400; 114 static const uint32_t SCREENLOCK_SCREENLOCK_ENABLED = 0x00000800; 115 static const uint32_t SCREENLOCK_EXIT_ANIMATION = 0x00001000; 116 static const uint32_t SCREENLOCK_SYSTEM_READY = 0x00002000; 117 } // namespace ScreenLock 118 } // namespace OHOS 119 #endif // SERVICES_INCLUDE_SCREENLOCK_COMMON_H