1# 主题框架子系统-锁屏管理服务ChangeLog 2 3 4## cl.screenlock.1 isLocked、unlock接口使用权限变更 5从API9开始,变更为systemapi,停止对三方应用开放。 6 7开发者需要根据以下说明对应用进行适配。 8 9**变更影响** 10 11基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 12 13- 涉及接口 14 15```js 16 function isLocked(): boolean; 17 function unlock(callback: AsyncCallback<boolean>): void; 18 function unlock():Promise<boolean>; 19``` 20 21- 变更前: 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- 变更后: 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**适配指导** 96 97该接口变更为系统应用后,三方应用已无法使用。 98系统应用可正常使用。 99示例代码如下: 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 isSecure接口废弃变更 130从API9开始,废弃此接口。 131 132开发者需要根据以下说明对应用进行适配。 133 134**变更影响** 135 136该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 137 138- 涉及接口 139 140```js 141 function isSecure(): boolean; 142``` 143 144- 变更前: 145 146```js 147 function isSecure(): boolean; 148``` 149 150- 变更后:删除接口,停止对外开放。 151 152 153**适配指导** 154 155该接口删除后无法再使用,请适配更新。 156