• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2024 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/**
17 * @file Provides the capability to access data under lock screen.
18 * @kit AbilityKit
19 */
20
21/**
22 * Provides the capability to access data under lock screen.
23 *
24 * @namespace screenLockFileManager
25 * @syscap SystemCapability.Security.ScreenLockFileManager
26 * @since 12
27 */
28declare namespace screenLockFileManager {
29  /**
30   * Enumerates the types of data under lock screen.
31   *
32   * @enum { number }
33   * @syscap SystemCapability.Security.ScreenLockFileManager
34   * @since 12
35   */
36  export enum DataType {
37    /**
38     * Media photo and video data.
39     *
40     * @syscap SystemCapability.Security.ScreenLockFileManager
41     * @since 12
42     */
43    MEDIA_DATA = 0x00000001,
44
45    /**
46     * All data type.
47     *
48     * @syscap SystemCapability.Security.ScreenLockFileManager
49     * @since 12
50     */
51    ALL_DATA = 0xffffffff
52  }
53
54  /**
55   * AccessStatus.
56   *
57   * @enum { number }
58   * @syscap SystemCapability.Security.ScreenLockFileManager
59   * @since 12
60   */
61  export enum AccessStatus {
62    /**
63     * Acquire the access of data failed.
64     *
65     * @syscap SystemCapability.Security.ScreenLockFileManager
66     * @since 12
67     */
68    ACCESS_DENIED = -1,
69
70    /**
71     * Acquire the access of data success.
72     *
73     * @syscap SystemCapability.Security.ScreenLockFileManager
74     * @since 12
75     */
76    ACCESS_GRANTED = 0
77  }
78
79  /**
80   * ReleaseStatus.
81   *
82   * @enum { number }
83   * @syscap SystemCapability.Security.ScreenLockFileManager
84   * @since 12
85   */
86  export enum ReleaseStatus {
87    /**
88     * Release the access of data failed.
89     *
90     * @syscap SystemCapability.Security.ScreenLockFileManager
91     * @since 12
92     */
93    RELEASE_DENIED = -1,
94
95    /**
96     * Release the access of data success.
97     *
98     * @syscap SystemCapability.Security.ScreenLockFileManager
99     * @since 12
100     */
101    RELEASE_GRANTED = 0
102  }
103
104  /**
105   * Acquire the access of the caller data under the lock screen.
106   *
107   * @returns { AccessStatus } Returns acquire the access result.
108   * @throws { BusinessError } 801 - The specified SystemCapability name was not found.
109   * @throws { BusinessError } 29300002 - The system ability work abnormally.
110   * @throws { BusinessError } 29300003 - The application is not enabled the data protection under lock screen.
111   * @throws { BusinessError } 29300004 - File access is denied.
112   * @syscap SystemCapability.Security.ScreenLockFileManager
113   * @since 12
114   */
115  function acquireAccess(): AccessStatus;
116
117  /**
118   * Acquire the access of the specified data under the lock screen.
119   *
120   * @permission ohos.permission.ACCESS_SCREEN_LOCK_MEDIA_DATA or ohos.permission.ACCESS_SCREEN_LOCK_ALL_DATA
121   * @param { DataType } dataType - Indicates the specified data to allow access under the lock screen.
122   * @returns { AccessStatus } Returns acquire the access result.
123   * @throws { BusinessError } 201 - Permission verification failed, usually returned by VerifyAccessToken.
124   * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
125   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameter is left unspecified. 2. Incorrect parameter types.
126   * @throws { BusinessError } 801 - The specified SystemCapability name was not found.
127   * @throws { BusinessError } 29300001 - Invalid parameter.
128   * @throws { BusinessError } 29300002 - The system ability work abnormally.
129   * @throws { BusinessError } 29300003 - The application is not enabled the data protection under lock screen.
130   * @throws { BusinessError } 29300004 - File access is denied.
131   * @syscap SystemCapability.Security.ScreenLockFileManager
132   * @systemapi
133   * @since 12
134   */
135  function acquireAccess(dataType: DataType): AccessStatus;
136
137  /**
138   * Release the access of the caller data and do not allow data access under the lock screen.
139   *
140   * @returns { ReleaseStatus } Returns release the access result.
141   * @throws { BusinessError } 801 - The specified SystemCapability name was not found.
142   * @throws { BusinessError } 29300002 - The system ability work abnormally.
143   * @throws { BusinessError } 29300003 - The application is not enabled the data protection under lock screen.
144   * @throws { BusinessError } 29300005 - File access was not acquired.
145   * @syscap SystemCapability.Security.ScreenLockFileManager
146   * @since 12
147   */
148  function releaseAccess(): ReleaseStatus;
149
150  /**
151   * Release the access of the specified data type and do not allow data access under the lock screen.
152   *
153   * @permission ohos.permission.ACCESS_SCREEN_LOCK_MEDIA_DATA or ohos.permission.ACCESS_SCREEN_LOCK_ALL_DATA
154   * @param { DataType } dataType - Indicates the specified data type and do not allow data access under the lock screen.
155   * @returns { ReleaseStatus } Returns release the access result.
156   * @throws { BusinessError } 201 - Permission verification failed, usually returned by VerifyAccessToken.
157   * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
158   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameter is left unspecified. 2. Incorrect parameter types.
159   * @throws { BusinessError } 801 - The specified SystemCapability name was not found.
160   * @throws { BusinessError } 29300001 - Invalid parameter.
161   * @throws { BusinessError } 29300002 - The system ability work abnormally.
162   * @throws { BusinessError } 29300003 - The application is not enabled the data protection under lock screen.
163   * @throws { BusinessError } 29300005 - File access was not acquired.
164   * @syscap SystemCapability.Security.ScreenLockFileManager
165   * @systemapi
166   * @since 12
167   */
168  function releaseAccess(dataType: DataType): ReleaseStatus;
169}
170export default screenLockFileManager;