• 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 */
15import { AsyncCallback } from './basic';
16import { Callback } from './basic';
17
18/**
19 * systemScreenLock
20 * @devices phone, tablet, tv, wearable, car
21 * @since 7
22 */
23declare namespace screenLock {
24
25  /**
26   * Checks whether the screen is currently locked.
27   *
28   * @return Returns {@code true} if the screen is currently locked; returns {@code false}
29   * otherwise.
30   * @since 7
31   */
32  function isScreenLocked(callback: AsyncCallback<boolean>): void;
33  function isScreenLocked(): Promise<boolean>;
34
35  /**
36   * Checks whether the screen lock of the current device is secure.
37   *
38   * @return Returns {@code true} if the screen lock of the current device is secure; returns {@code false}
39   * otherwise.
40   * @since 7
41   */
42  function isSecureMode(callback: AsyncCallback<boolean>): void;
43  function isSecureMode(): Promise<boolean>;
44
45  /**
46   * Unlocks the screen.
47   *
48   * @since 7
49   */
50  function unlockScreen(callback: AsyncCallback<void>): void;
51  function unlockScreen(): Promise<void>;
52
53  /**
54   * Receives {beginWakeUp|endWakeUp|beginScreenOn|endScreenOn|beginScreenOff|endScreenOff|unlockScreen|beginExitAnimation} called.
55   * This callback is invoked when {beginWakeUp|endWakeUp|beginScreenOn|endScreenOn|beginScreenOff|endScreenOff|unlockScreen|beginExitAnimation}
56   * is called by runtime
57   *
58   * @systemapi Hide this for inner system use.
59   * @since 8
60   */
61  function on(type: 'beginWakeUp' | 'endWakeUp' | 'beginScreenOn' | 'endScreenOn' | 'beginScreenOff' | 'endScreenOff' | 'unlockScreen' |
62  'beginExitAnimation' | 'systemReady', callback: Callback<void>): void;
63
64  /**
65    * Receives {beginSleep | endSleep | changeUser} called. This callback is invoked when {beginSleep | endSleep | changeUser} is called by runtime
66    *
67    * @systemapi Hide this for inner system use.
68    * @since 8
69    */
70  function on(type: 'beginSleep' | 'endSleep' | 'changeUser', callback: Callback<number>): void;
71
72  /**
73   * Receives screenlockEnabled change. This callback is invoked when screenlockEnabled is called by runtime
74   *
75   * @systemapi Hide this for inner system use.
76   * @since 8
77   */
78  function on(type: 'screenlockEnabled', callback: Callback<boolean>): void;
79
80  /**
81   * Remove the receives of {beginWakeUp | endWakeUp | beginScreenOn | endScreenOn | beginScreenOff | endScreenOff | unlockScreen
82   * | beginExitAnimation | screenlockEnabled | beginSleep | endSleep | changeUser | systemReady}.
83   *
84   * @systemapi Hide this for inner system use.
85   * @since 8
86   */
87  function off(type: 'beginWakeUp' | 'endWakeUp' | 'beginScreenOn' | 'endScreenOn' | 'beginScreenOff' | 'endScreenOff'
88      | 'unlockScreen' | 'beginExitAnimation' | 'screenlockEnabled' | 'beginSleep' | 'endSleep' | 'changeUser' | 'systemReady', callback: Callback<void>): void;
89
90  /**
91   * screenlockAPP send event to screenlockSA
92   *
93   * @systemapi Hide this for inner system use.
94   * @since 8
95   */
96  function sendScreenLockEvent(event: string, parameter: number, callback: AsyncCallback<boolean>): void;
97  function sendScreenLockEvent(event: string, parameter: number): Promise<boolean>;
98
99
100  /**
101   * api for unit test
102   * @since 7
103   */
104  function test_setScreenLocked(isScreenlocked: boolean, callback: AsyncCallback<boolean>): void;
105  function test_setScreenLocked(isScreenlocked: boolean): Promise<boolean>;
106
107  /**
108   * api for unit test
109   * @since 7
110   */
111  function test_runtimeNotify(event: string, parameter: number, callback: AsyncCallback<boolean>): void;
112  function test_runtimeNotify(event: string, parameter: number): Promise<boolean>;
113
114  /**
115   * api for unit test
116   * @since 7
117   */
118  function test_getRuntimeState(event: string, callback: AsyncCallback<number>): void;
119  function test_getRuntimeState(event: string): Promise<number>;
120}
121
122export default screenLock;
123
124
125
126