1# Theme Framework Subsystem – Screenlock Management Service Changelog
2
3
4## cl.screenlock.1 Permission Change of isLocked and unlock
5Changed the **isLocked** and **unlock** APIs to system APIs since API version 9.
6
7You need to adapt your application based on the following information.
8
9**Change Impact**
10
11The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
12
13- Involved APIs:
14
15```js
16  function isLocked(): boolean;
17  function unlock(callback: AsyncCallback<boolean>): void;
18  function unlock():Promise<boolean>;
19```
20
21- Before change:
22
23```js
24   * Checks whether the screen is currently locked.
25   *
26   * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
27   * @syscap SystemCapability.MiscServices.ScreenLock
28   * @since 9
29   */
30  function isLocked(): boolean;
31
32  /**
33   * Unlock the screen.
34   *
35   * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
36   * @throws {BusinessError} 401 - parameter error.
37   * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
38   * @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
39   * @syscap SystemCapability.MiscServices.ScreenLock
40   * @systemapi Hide this for inner system use.
41   * @since 9
42   */
43  function unlock(callback: AsyncCallback<boolean>): void;
44
45  /**
46   * Unlock the screen.
47   *
48   * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
49   * @throws {BusinessError} 401 - parameter error.
50   * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
51   * @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
52   * @syscap SystemCapability.MiscServices.ScreenLock
53   * @systemapi Hide this for inner system use.
54   * @since 9
55   */
56  function unlock():Promise<boolean>;
57```
58
59- After change:
60
61```js
62   * Checks whether the screen is currently locked.
63   *
64   * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise.
65   * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API.
66   * @syscap SystemCapability.MiscServices.ScreenLock
67   * @systemapi Hide this for inner system use.
68   * @since 9
69   */
70  function isLocked(): boolean;
71
72  /**
73   * Unlock the screen.
74   *
75   * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
76   * @throws {BusinessError} 401 - parameter error.
77   * @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
78   * @syscap SystemCapability.MiscServices.ScreenLock
79   * @since 9
80   */
81  function unlock(callback: AsyncCallback<boolean>): void;
82
83  /**
84   * Unlock the screen.
85   *
86   * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise.
87   * @throws {BusinessError} 13200002 - the screenlock management service is abnormal.
88   * @syscap SystemCapability.MiscServices.ScreenLock
89   * @since 9
90   */
91  function unlock():Promise<boolean>;
92```
93
94
95**Adaptation Guide**
96
97Make sure the APIs are only invoked by system applications.
98
99The code snippet is as follows:
100
101```js
102    try {
103      let ret = screenLock.isLocked();
104      console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`);
105    } catch (error) {
106      console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`);
107    }
108```
109
110```js
111    screenlock.unlock((err, data) => {
112        if (err) {
113            console.error(`Failed to unlock the screen, because: ${err.message}`);
114            return;
115        }
116        console.info(`unlock the screen successfully. result: ${data}`);
117    });
118```
119
120```js
121    screenlock.unlock().then((data) => {
122        console.info(`unlock the screen successfully. result: ${data}`);
123    }).catch((err) => {
124        console.error(`Failed to unlock the screen, because: ${err.message}`);
125    });
126```
127
128
129## cl.screenlock.2 Deprecation of isSecure
130Deprecated the **isSecure** API since API version 9.
131
132You need to adapt your application based on the following information.
133
134**Change Impact**
135
136The API can no longer be used after being deleted.
137
138- Involved APIs:
139
140```js
141  function isSecure(): boolean;
142```
143
144- Before change:
145
146```js
147  function isSecure(): boolean;
148```
149
150- After change:
151
152  The API is deleted.
153
154
155**Adaptation Guide**
156
157Update the code so that the deprecated API is not used.
158