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 #include "napi_screenlock_ability.h"
16
17 #include <napi/native_api.h>
18 #include <pthread.h>
19 #include <unistd.h>
20 #include <uv.h>
21
22 #include "ipc_skeleton.h"
23
24 #include "event_listener.h"
25 #include "sclock_log.h"
26 #include "screenlock_app_manager.h"
27 #include "screenlock_bundlename.h"
28 #include "screenlock_common.h"
29 #include "screenlock_js_util.h"
30 #include "screenlock_manager.h"
31 #include "screenlock_system_ability_callback.h"
32 #include "screenlock_unlock_callback.h"
33
34 using namespace OHOS;
35 using namespace OHOS::ScreenLock;
36
37 namespace OHOS {
38 namespace ScreenLock {
39 static thread_local uint32_t g_eventMasks = 0;
40 static thread_local std::list<EventListener> g_eventListenerList;
41 static thread_local EventListener g_unlockListener;
42
AddEventListener(uint32_t eventType,const std::string & event)43 static bool AddEventListener(uint32_t eventType, const std::string &event)
44 {
45 if ((eventType & g_eventMasks) == 0) {
46 g_eventMasks += eventType;
47 sptr<ScreenLockSystemAbilityInterface> listener =
48 new ScreenlockSystemAbilityCallback(eventType, g_eventListenerList);
49 if (listener != nullptr) {
50 SCLOCK_HILOGD("Exec AddEventListener observer--------》%{public}p", listener.GetRefPtr());
51 return ScreenLockAppManager::GetInstance()->On(listener, event);
52 }
53 }
54 return true;
55 }
56
Init(napi_env env,napi_value exports)57 napi_status Init(napi_env env, napi_value exports)
58 {
59 napi_property_descriptor exportFuncs[] = {
60 DECLARE_NAPI_FUNCTION("isScreenLocked", OHOS::ScreenLock::NAPI_IsScreenLocked),
61 DECLARE_NAPI_FUNCTION("unlockScreen", OHOS::ScreenLock::NAPI_UnlockScreen),
62 DECLARE_NAPI_FUNCTION("isSecureMode", OHOS::ScreenLock::NAPI_IsSecureMode),
63 DECLARE_NAPI_FUNCTION("on", NAPI_On),
64 DECLARE_NAPI_FUNCTION("off", NAPI_Off),
65 DECLARE_NAPI_FUNCTION("sendScreenLockEvent", OHOS::ScreenLock::NAPI_ScreenLockSendEvent),
66 DECLARE_NAPI_FUNCTION("test_setScreenLocked", OHOS::ScreenLock::NAPI_TestSetScreenLocked),
67 DECLARE_NAPI_FUNCTION("test_runtimeNotify", OHOS::ScreenLock::NAPI_TestRuntimeNotify),
68 DECLARE_NAPI_FUNCTION("test_getRuntimeState", OHOS::ScreenLock::NAPI_TestGetRuntimeState),
69 };
70 napi_define_properties(env, exports, sizeof(exportFuncs) / sizeof(*exportFuncs), exportFuncs);
71 return napi_ok;
72 }
73
IsCheckedTypeRegisterMessage(const std::string & type)74 bool IsCheckedTypeRegisterMessage(const std::string &type)
75 {
76 if (type == BEGIN_WAKEUP || type == END_WAKEUP || type == BEGIN_SCREEN_ON || type == END_SCREEN_ON ||
77 type == BEGIN_SLEEP || type == END_SLEEP || type == BEGIN_SCREEN_OFF || type == END_SCREEN_OFF ||
78 type == CHANGE_USER || type == SCREENLOCK_ENABLED || type == EXIT_ANIMATION || type == UNLOCKSCREEN ||
79 type == SYSTEM_READY) {
80 return true;
81 }
82 return false;
83 }
84
IsCheckedTypeSendEventMessage(const std::string & type)85 bool IsCheckedTypeSendEventMessage(const std::string &type)
86 {
87 if (type == UNLOCK_SCREEN_RESULT || type == SCREEN_DRAWDONE) {
88 return true;
89 }
90 return false;
91 }
92
NAPI_IsScreenLocked(napi_env env,napi_callback_info info)93 napi_value NAPI_IsScreenLocked(napi_env env, napi_callback_info info)
94 {
95 SCLOCK_HILOGD("NAPI_IsScreenLocked begin");
96 auto context = std::make_shared<AsyncScreenLockInfo>();
97 auto input = [context](napi_env env, size_t argc, napi_value argv[], napi_value self) -> napi_status {
98 NAPI_ASSERT_BASE(
99 env, argc == ARGS_SIZE_ZERO || argc == ARGS_SIZE_ONE, " should 0 or 1 parameters!", napi_invalid_arg);
100 SCLOCK_HILOGD("input ---- argc : %{public}d", argc);
101 return napi_ok;
102 };
103 auto output = [context](napi_env env, napi_value *result) -> napi_status {
104 napi_status status = napi_get_boolean(env, context->allowed, result);
105 SCLOCK_HILOGD("output ---- napi_get_boolean[%{public}d]", status);
106 return napi_ok;
107 };
108 auto exec = [context](AsyncCall::Context *ctx) {
109 SCLOCK_HILOGD("exec ---- NAPI_IsScreenLocked begin");
110 context->allowed = ScreenLockManager::GetInstance()->IsScreenLocked();
111 SCLOCK_HILOGD("NAPI_IsScreenLocked exec allowed = %{public}d ", context->allowed);
112 context->status = napi_ok;
113 };
114 context->SetAction(std::move(input), std::move(output));
115 AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(context), ARGS_SIZE_ZERO);
116 return asyncCall.Call(env, exec);
117 }
118
NAPI_UnlockScreen(napi_env env,napi_callback_info info)119 napi_value NAPI_UnlockScreen(napi_env env, napi_callback_info info)
120 {
121 SCLOCK_HILOGD("NAPI_UnlockScreen begin");
122 napi_value ret = nullptr;
123 size_t argc = ARGS_SIZE_ONE;
124 napi_value argv[ARGS_SIZE_ONE] = {nullptr};
125 napi_value thisVar = nullptr;
126 void *data = nullptr;
127 NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, &data));
128 NAPI_ASSERT(env, argc == ARGS_SIZE_ZERO || argc == ARGS_SIZE_ONE, "Wrong number of arguments, requires one");
129 napi_ref callbackRef = nullptr;
130
131 napi_valuetype valueType = napi_undefined;
132 if (argc == ARGS_SIZE_ONE) {
133 napi_typeof(env, argv[ARGV_ZERO], &valueType);
134 SCLOCK_HILOGD("NAPI_UnlockScreen callback");
135 NAPI_ASSERT(env, valueType == napi_function, "callback is not a function");
136 if (valueType == napi_function) {
137 SCLOCK_HILOGD("NAPI_UnlockScreen create callback");
138 napi_create_reference(env, argv[ARGV_ZERO], 1, &callbackRef);
139 g_unlockListener = {env, RESULT_ZERO, thisVar, callbackRef};
140 }
141 }
142 if (callbackRef == nullptr) {
143 SCLOCK_HILOGD("NAPI_UnlockScreen create promise");
144 napi_deferred deferred;
145 napi_create_promise(env, &deferred, &ret);
146 g_unlockListener = {env, RESULT_ZERO, thisVar, nullptr, deferred};
147 } else {
148 SCLOCK_HILOGD("NAPI_UnlockScreen create callback");
149 napi_get_undefined(env, &ret);
150 }
151 sptr<ScreenLockSystemAbilityInterface> listener = new ScreenlockUnlockCallback(g_unlockListener);
152 if (listener == nullptr) {
153 SCLOCK_HILOGE("NAPI_UnlockScreen create callback object fail");
154 return ret;
155 }
156 ScreenLockManager::GetInstance()->RequestUnlock(listener);
157 return ret;
158 }
159
NAPI_IsSecureMode(napi_env env,napi_callback_info info)160 napi_value NAPI_IsSecureMode(napi_env env, napi_callback_info info)
161 {
162 SCLOCK_HILOGD("NAPI_IsSecureMode begin");
163 auto context = std::make_shared<AsyncScreenLockInfo>();
164 auto input = [context](napi_env env, size_t argc, napi_value argv[], napi_value self) -> napi_status {
165 NAPI_ASSERT_BASE(
166 env, argc == ARGS_SIZE_ZERO || argc == ARGS_SIZE_ONE, " should 0 or 1 parameters!", napi_invalid_arg);
167 SCLOCK_HILOGD("input ---- argc : %{public}d", argc);
168 return napi_ok;
169 };
170 auto output = [context](napi_env env, napi_value *result) -> napi_status {
171 napi_status status = napi_get_boolean(env, context->allowed, result);
172 SCLOCK_HILOGD("output ---- napi_get_boolean[%{public}d]", status);
173 return napi_ok;
174 };
175 auto exec = [context](AsyncCall::Context *ctx) {
176 SCLOCK_HILOGD("exec ---- NAPI_IsSecureMode begin");
177 context->allowed = ScreenLockManager::GetInstance()->GetSecure();
178 SCLOCK_HILOGD("NAPI_IsSecureMode exec allowed = %{public}d ", context->allowed);
179 context->status = napi_ok;
180 };
181 context->SetAction(std::move(input), std::move(output));
182 AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(context), ARGS_SIZE_ZERO);
183 return asyncCall.Call(env, exec);
184 }
185
NAPI_On(napi_env env,napi_callback_info info)186 napi_value NAPI_On(napi_env env, napi_callback_info info)
187 {
188 SCLOCK_HILOGD("NAPI_On in");
189 napi_value result = nullptr;
190 int callingUid = IPCSkeleton::GetCallingUid();
191 SCLOCK_HILOGD("NAPI_On callingUid=%{public}d", callingUid);
192 std::string bundleName = "";
193 if (!ScreenLockBundleName::GetBundleNameByUid(callingUid, bundleName)) {
194 return result;
195 }
196 if (bundleName.empty()) {
197 SCLOCK_HILOGI("NAPI_On calling app is null");
198 return result;
199 }
200 if (bundleName != BUNDLE_NAME) {
201 SCLOCK_HILOGI("NAPI_On calling app is not Screenlock APP");
202 return result;
203 }
204 size_t argc = ARGS_SIZE_TWO;
205 napi_value argv[ARGV_TWO] = {nullptr};
206 napi_value thisVar = nullptr;
207 void *data = nullptr;
208 NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, &data));
209 NAPI_ASSERT(env, argc == ARGS_SIZE_TWO, "Wrong number of arguments, requires 2");
210 napi_valuetype valuetype;
211 NAPI_CALL(env, napi_typeof(env, argv[ARGV_ZERO], &valuetype));
212 NAPI_ASSERT(env, valuetype == napi_string, "type is not a string");
213 char event[MAX_VALUE_LEN] = {0};
214 size_t len = 0;
215 napi_get_value_string_utf8(env, argv[ARGV_ZERO], event, MAX_VALUE_LEN, &len);
216 std::string type = event;
217 SCLOCK_HILOGD("NAPI_On type : %{public}s", type.c_str());
218 if (!IsCheckedTypeRegisterMessage(type)) {
219 SCLOCK_HILOGD("NAPI_On type : %{public}s not support", type.c_str());
220 return result;
221 }
222 valuetype = napi_undefined;
223 napi_typeof(env, argv[ARGV_ONE], &valuetype);
224 NAPI_ASSERT(env, valuetype == napi_function, "callback is not a function");
225 napi_ref callbackRef = nullptr;
226 napi_create_reference(env, argv[ARGV_ONE], 1, &callbackRef);
227 SCLOCK_HILOGD("NAPI_On callbackRef = %{public}p", callbackRef);
228 int32_t eventType = ScreenlockSystemAbilityCallback::GetEventType(type);
229 if (eventType != NONE_EVENT_TYPE) {
230 EventListener listener = {env, eventType, thisVar, callbackRef};
231 SCLOCK_HILOGD("env 5555 = %{public}p", (void*)(env));
232 SCLOCK_HILOGD("NAPI_On type=%{public}s,callbackRef=%{public}p", type.c_str(), callbackRef);
233 g_eventListenerList.push_back(listener);
234 }
235 bool status = AddEventListener(eventType, type);
236 SCLOCK_HILOGD("NAPI_On status=%{public}d", status);
237 return result;
238 }
239
NAPI_Off(napi_env env,napi_callback_info info)240 napi_value NAPI_Off(napi_env env, napi_callback_info info)
241 {
242 SCLOCK_HILOGD("NAPI_Off in");
243 napi_value result = nullptr;
244 int callingUid = IPCSkeleton::GetCallingUid();
245 std::string bundleName = "";
246 if (!ScreenLockBundleName::GetBundleNameByUid(callingUid, bundleName)) {
247 return result;
248 }
249 if (bundleName.empty()) {
250 SCLOCK_HILOGI("NAPI_Off calling app is null");
251 return result;
252 }
253 if (bundleName != BUNDLE_NAME) {
254 SCLOCK_HILOGI("NAPI_Off calling app is not Screenlock APP");
255 return result;
256 }
257 size_t argc = ARGS_SIZE_TWO;
258 napi_value argv[ARGV_TWO] = {nullptr};
259 napi_value thisVar = nullptr;
260 void *data = nullptr;
261 napi_get_cb_info(env, info, &argc, argv, &thisVar, &data);
262 NAPI_ASSERT(env, argc == ARGS_SIZE_TWO, "Wrong number of arguments, requires 1 or 2");
263 napi_valuetype valuetype;
264 NAPI_CALL(env, napi_typeof(env, argv[ARGV_ZERO], &valuetype));
265 NAPI_ASSERT(env, valuetype == napi_string, "type is not a string");
266 char event[MAX_VALUE_LEN] = {0};
267 size_t len;
268 napi_get_value_string_utf8(env, argv[ARGV_ZERO], event, MAX_VALUE_LEN, &len);
269 std::string type = event;
270 SCLOCK_HILOGD("type : %{public}s", type.c_str());
271 if (!IsCheckedTypeRegisterMessage(type)) {
272 SCLOCK_HILOGD("type : %{public}s not support", type.c_str());
273 return result;
274 }
275 int32_t eventType = ScreenlockSystemAbilityCallback::GetEventType(type);
276 if (eventType == NONE_EVENT_TYPE) {
277 return result;
278 }
279 for (std::list<EventListener>::iterator it = g_eventListenerList.begin(); it != g_eventListenerList.end(); ++it) {
280 if (it->eventType == eventType) {
281 ScreenLockAppManager::GetInstance()->Off(type);
282 SCLOCK_HILOGD("Exec ObserverOff after RemoveStateObserver eventType = %{public}d", it->eventType);
283 }
284 }
285 g_eventListenerList.remove_if(
286 [eventType](EventListener listener) -> bool { return listener.eventType == eventType; });
287 return result;
288 }
289
NAPI_ScreenLockSendEvent(napi_env env,napi_callback_info info)290 napi_value NAPI_ScreenLockSendEvent(napi_env env, napi_callback_info info)
291 {
292 SCLOCK_HILOGD("NAPI_ScreenLockSendEvent begin");
293 auto context = std::make_shared<SendEventInfo>();
294 auto input = [context](napi_env env, size_t argc, napi_value argv[], napi_value self) -> napi_status {
295 NAPI_ASSERT_BASE(
296 env, argc == ARGS_SIZE_TWO || argc == ARGS_SIZE_THREE, " should 2 or 3 parameters!", napi_invalid_arg);
297 SCLOCK_HILOGD("input ---- argc : %{public}d", argc);
298 napi_valuetype valueType = napi_undefined;
299 napi_typeof(env, argv[ARGV_ZERO], &valueType);
300 NAPI_ASSERT_BASE(env, valueType == napi_string, "type is not a string type", napi_invalid_arg);
301 char event[MAX_VALUE_LEN] = {0};
302 size_t len;
303 napi_get_value_string_utf8(env, argv[ARGV_ZERO], event, MAX_VALUE_LEN, &len);
304 context->eventInfo = event;
305 std::string type = event;
306 if (!IsCheckedTypeSendEventMessage(type)) {
307 SCLOCK_HILOGD("event : %{public}s not support", event);
308 return napi_generic_failure;
309 }
310 valueType = napi_undefined;
311 napi_typeof(env, argv[ARGV_ONE], &valueType);
312 NAPI_ASSERT_BASE(env, valueType == napi_number, "type is not a int type", napi_invalid_arg);
313 napi_get_value_int32(env, argv[ARGV_ONE], &context->param);
314 return napi_ok;
315 };
316 auto output = [context](napi_env env, napi_value *result) -> napi_status {
317 napi_status status = napi_get_boolean(env, context->allowed, result);
318 SCLOCK_HILOGD("output ---- napi_get_boolean[%{public}d]", status);
319 return napi_ok;
320 };
321 auto exec = [context](AsyncCall::Context *ctx) {
322 context->allowed = ScreenLockAppManager::GetInstance()->SendScreenLockEvent(context->eventInfo, context->param);
323 SCLOCK_HILOGD("NAPI_ScreenLockSendEvent exec allowed = %{public}d ", context->allowed);
324 context->status = napi_ok;
325 };
326 context->SetAction(std::move(input), std::move(output));
327 AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(context), ARGV_TWO);
328 return asyncCall.Call(env, exec);
329 }
330
NAPI_TestSetScreenLocked(napi_env env,napi_callback_info info)331 napi_value NAPI_TestSetScreenLocked(napi_env env, napi_callback_info info)
332 {
333 auto context = std::make_shared<SendEventInfo>();
334 auto input = [context](napi_env env, size_t argc, napi_value argv[], napi_value self) -> napi_status {
335 NAPI_ASSERT_BASE(
336 env, argc == ARGS_SIZE_ONE || argc == ARGS_SIZE_TWO, " should 1 or 2 parameters!", napi_invalid_arg);
337 SCLOCK_HILOGD("input ---- argc : %{public}d", argc);
338 napi_valuetype valueType = napi_undefined;
339 napi_typeof(env, argv[ARGV_ZERO], &valueType);
340 NAPI_ASSERT_BASE(env, valueType == napi_boolean, "type is not a boolean type", napi_invalid_arg);
341 napi_get_value_bool(env, argv[ARGV_ZERO], &context->flag);
342 return napi_ok;
343 };
344 auto output = [context](napi_env env, napi_value *result) -> napi_status {
345 napi_status status = napi_get_boolean(env, context->allowed, result);
346 SCLOCK_HILOGD("output ---- napi_get_boolean[%{public}d]", status);
347 return napi_ok;
348 };
349 auto exec = [context](AsyncCall::Context *ctx) {
350 context->allowed = ScreenLockManager::GetInstance()->Test_SetScreenLocked(context->flag);
351 SCLOCK_HILOGD("NAPI_TestSetScreenLocked exec allowed = %{public}d ", context->allowed);
352 context->status = napi_ok;
353 };
354 context->SetAction(std::move(input), std::move(output));
355 AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(context), ARGS_SIZE_ONE);
356 return asyncCall.Call(env, exec);
357 }
358
NAPI_TestRuntimeNotify(napi_env env,napi_callback_info info)359 napi_value NAPI_TestRuntimeNotify(napi_env env, napi_callback_info info)
360 {
361 auto context = std::make_shared<SendEventInfo>();
362 auto input = [context](napi_env env, size_t argc, napi_value argv[], napi_value self) -> napi_status {
363 NAPI_ASSERT_BASE(
364 env, argc == ARGS_SIZE_TWO || argc == ARGS_SIZE_THREE, " should 2 or 3 parameters!", napi_invalid_arg);
365 SCLOCK_HILOGD("input ---- argc : %{public}d", argc);
366 napi_valuetype valueType = napi_undefined;
367 napi_typeof(env, argv[ARGV_ZERO], &valueType);
368 NAPI_ASSERT_BASE(env, valueType == napi_string, "type is not a string type", napi_invalid_arg);
369 char event[MAX_VALUE_LEN] = {0};
370 size_t len;
371 napi_get_value_string_utf8(env, argv[ARGV_ZERO], event, MAX_VALUE_LEN, &len);
372 context->eventInfo = event;
373 valueType = napi_undefined;
374 napi_typeof(env, argv[ARGV_ONE], &valueType);
375 NAPI_ASSERT_BASE(env, valueType == napi_number, "type is not a int type", napi_invalid_arg);
376 napi_get_value_int32(env, argv[ARGV_ONE], &context->param);
377 return napi_ok;
378 };
379 auto output = [context](napi_env env, napi_value *result) -> napi_status {
380 napi_status status = napi_get_boolean(env, context->allowed, result);
381 SCLOCK_HILOGD("output ---- napi_get_boolean[%{public}d]", status);
382 return napi_ok;
383 };
384 auto exec = [context](AsyncCall::Context *ctx) {
385 context->allowed = ScreenLockManager::GetInstance()->Test_RuntimeNotify(context->eventInfo, context->param);
386 SCLOCK_HILOGD("NAPI_TestRuntimeNotify exec allowed = %{public}d ", context->allowed);
387 context->status = napi_ok;
388 };
389 context->SetAction(std::move(input), std::move(output));
390 AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(context), ARGS_SIZE_TWO);
391 return asyncCall.Call(env, exec);
392 }
393
NAPI_TestGetRuntimeState(napi_env env,napi_callback_info info)394 napi_value NAPI_TestGetRuntimeState(napi_env env, napi_callback_info info)
395 {
396 auto context = std::make_shared<SendEventInfo>();
397 auto input = [context](napi_env env, size_t argc, napi_value argv[], napi_value self) -> napi_status {
398 NAPI_ASSERT_BASE(
399 env, argc == ARGS_SIZE_ONE || argc == ARGS_SIZE_TWO, " should 1 or 2 parameters!", napi_invalid_arg);
400 SCLOCK_HILOGD("input ---- argc : %{public}d", argc);
401 napi_valuetype valueType = napi_undefined;
402 napi_typeof(env, argv[ARGV_ZERO], &valueType);
403 NAPI_ASSERT_BASE(env, valueType == napi_string, "type is not a string type", napi_invalid_arg);
404 char event[MAX_VALUE_LEN] = {0};
405 size_t len;
406 napi_get_value_string_utf8(env, argv[ARGV_ZERO], event, MAX_VALUE_LEN, &len);
407 context->eventInfo = event;
408 return napi_ok;
409 };
410 auto output = [context](napi_env env, napi_value *result) -> napi_status {
411 napi_status status = napi_get_boolean(env, context->allowed, result);
412 SCLOCK_HILOGD("output ---- napi_get_boolean[%{public}d]", status);
413 return napi_ok;
414 };
415 auto exec = [context](AsyncCall::Context *ctx) {
416 context->allowed = ScreenLockManager::GetInstance()->Test_GetRuntimeState(context->eventInfo);
417 SCLOCK_HILOGD("NAPI_TestGetRuntimeState exec allowed = %{public}d ", context->allowed);
418 context->status = napi_ok;
419 };
420 context->SetAction(std::move(input), std::move(output));
421 AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(context), ARGS_SIZE_ONE);
422 return asyncCall.Call(env, exec);
423 }
424
ScreenlockInit(napi_env env,napi_value exports)425 static napi_value ScreenlockInit(napi_env env, napi_value exports)
426 {
427 napi_status ret = Init(env, exports);
428 if (ret != napi_ok) {
429 SCLOCK_HILOGE("ModuleInit failed!");
430 }
431 return exports;
432 }
433
RegisterModule(void)434 extern "C" __attribute__((constructor)) void RegisterModule(void)
435 {
436 napi_module module = {.nm_version = 1, // NAPI v1
437 .nm_flags = 0, // normal
438 .nm_filename = nullptr,
439 .nm_register_func = ScreenlockInit,
440 .nm_modname = "screenlock",
441 .nm_priv = nullptr,
442 .reserved = {}};
443 napi_module_register(&module);
444 }
445 } // namespace ScreenLock
446 } // namespace OHOS
447