1/* 2 * Copyright (c) 2020 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 18 * @kit ArkUI 19 */ 20 21/** 22 * Defines the AppResponse info. 23 * 24 * @interface AppResponse 25 * @syscap SystemCapability.ArkUI.ArkUI.Lite 26 * @since 3 27 */ 28/** 29 * Defines the AppResponse info. 30 * 31 * @interface AppResponse 32 * @syscap SystemCapability.ArkUI.ArkUI.Lite 33 * @atomicservice 34 * @since 12 35 */ 36export interface AppResponse { 37 /** 38 * Application bundleName. 39 * 40 * @type { string } 41 * @syscap SystemCapability.ArkUI.ArkUI.Full 42 * @since 6 43 */ 44 /** 45 * Application bundleName. 46 * 47 * @type { string } 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @atomicservice 50 * @since 12 51 */ 52 appID: string; 53 54 /** 55 * Application name. 56 * 57 * @type { string } 58 * @syscap SystemCapability.ArkUI.ArkUI.Lite 59 * @since 3 60 */ 61 /** 62 * Application name. 63 * 64 * @type { string } 65 * @syscap SystemCapability.ArkUI.ArkUI.Lite 66 * @atomicservice 67 * @since 12 68 */ 69 appName: string; 70 71 /** 72 * Application version name. 73 * 74 * @type { string } 75 * @syscap SystemCapability.ArkUI.ArkUI.Lite 76 * @since 3 77 */ 78 /** 79 * Application version name. 80 * 81 * @type { string } 82 * @syscap SystemCapability.ArkUI.ArkUI.Lite 83 * @atomicservice 84 * @since 12 85 */ 86 versionName: string; 87 88 /** 89 * Application version. 90 * 91 * @type { number } 92 * @syscap SystemCapability.ArkUI.ArkUI.Lite 93 * @since 3 94 */ 95 /** 96 * Application version. 97 * 98 * @type { number } 99 * @syscap SystemCapability.ArkUI.ArkUI.Lite 100 * @atomicservice 101 * @since 12 102 */ 103 versionCode: number; 104} 105 106/** 107 * Defines the option of screenOnVisible interface. 108 * 109 * @interface ScreenOnVisibleOptions 110 * @syscap SystemCapability.ArkUI.ArkUI.Full 111 * @since 3 112 */ 113/** 114 * Defines the option of screenOnVisible interface. 115 * 116 * @interface ScreenOnVisibleOptions 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @atomicservice 119 * @since 11 120 */ 121export interface ScreenOnVisibleOptions { 122 /** 123 * Whether to keep the application visible. The default value is false. 124 * 125 * @type { ?boolean } 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @since 3 128 */ 129 /** 130 * Whether to keep the application visible. The default value is false. 131 * 132 * @type { ?boolean } 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @atomicservice 135 * @since 11 136 */ 137 visible?: boolean; 138 139 /** 140 * Called when the application always keeps visible. 141 * 142 * @type { ?function } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @since 3 145 */ 146 /** 147 * Called when the application always keeps visible. 148 * 149 * @type { ?function } 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @atomicservice 152 * @since 11 153 */ 154 success?: () => void; 155 156 /** 157 * Called when the application fails to keep visible. 158 * 159 * @type { ?function } 160 * @syscap SystemCapability.ArkUI.ArkUI.Full 161 * @since 3 162 */ 163 /** 164 * Called when the application fails to keep visible. 165 * 166 * @type { ?function } 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @atomicservice 169 * @since 11 170 */ 171 fail?: (data: string, code: number) => void; 172 173 /** 174 * Called when the execution is completed. 175 * 176 * @type { ?function } 177 * @syscap SystemCapability.ArkUI.ArkUI.Full 178 * @since 3 179 */ 180 /** 181 * Called when the execution is completed. 182 * 183 * @type { ?function } 184 * @syscap SystemCapability.ArkUI.ArkUI.Full 185 * @atomicservice 186 * @since 11 187 */ 188 complete?: () => void; 189} 190 191/** 192 * Defines the option of RequestFullWindow interface. 193 * 194 * @interface RequestFullWindowOptions 195 * @syscap SystemCapability.ArkUI.ArkUI.Full 196 * @since 3 197 */ 198/** 199 * Defines the option of RequestFullWindow interface. 200 * 201 * @interface RequestFullWindowOptions 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @atomicservice 204 * @since 11 205 */ 206export interface RequestFullWindowOptions { 207 /** 208 * Defines the number of animation options. 209 * 210 * @type { number } 211 * @syscap SystemCapability.ArkUI.ArkUI.Full 212 * @since 3 213 */ 214 /** 215 * Defines the number of animation options. 216 * 217 * @type { number } 218 * @syscap SystemCapability.ArkUI.ArkUI.Full 219 * @atomicservice 220 * @since 11 221 */ 222 duration: number; 223} 224 225/** 226 * Defines the app class info. 227 * 228 * @syscap SystemCapability.ArkUI.ArkUI.Lite 229 * @since 3 230 */ 231/** 232 * Defines the app class info. 233 * 234 * @syscap SystemCapability.ArkUI.ArkUI.Lite 235 * @atomicservice 236 * @since 12 237 */ 238 declare class App { 239 /** 240 * Obtains the declared information in the config.json file of an application. 241 * 242 * @returns { AppResponse } 243 * @syscap SystemCapability.ArkUI.ArkUI.Lite 244 * @since 3 245 */ 246 /** 247 * Obtains the declared information in the config.json file of an application. It will return null when used in StageModel. 248 * 249 * @returns { AppResponse } 250 * @syscap SystemCapability.ArkUI.ArkUI.Lite 251 * @atomicservice 252 * @since 12 253 */ 254 static getInfo(): AppResponse; 255 256 /** 257 * Destroys the current ability. 258 * 259 * @syscap SystemCapability.ArkUI.ArkUI.Lite 260 * @since 3 261 */ 262 /** 263 * Destroys the current ability. It does not work in StageModel. 264 * 265 * @syscap SystemCapability.ArkUI.ArkUI.Lite 266 * @atomicservice 267 * @since 12 268 */ 269 static terminate(): void; 270 271 /** 272 * Keeps the application visible after the screen is waken up. 273 * This method prevents the system from returning to the home screen when the screen is locked. 274 * 275 * @param { ScreenOnVisibleOptions } options 276 * @syscap SystemCapability.ArkUI.ArkUI.Full 277 * @since 3 278 * @deprecated since 8 279 */ 280 static screenOnVisible(options?: ScreenOnVisibleOptions): void; 281 282 /** 283 * Requests the application to run in full window. 284 * In some scenarios, such as semi-modal FA, the FA runs in non-full window. 285 * In this case, you can call this API. 286 * This API is invalid for an application already in full-window mode. 287 * 288 * @param { RequestFullWindowOptions } options Transition time from non-full window to full window, in milliseconds. 289 * By default, the value is in direct proportion to the distance between the non-full window and the full window. 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @since 3 292 * @deprecated since 8 293 * @useinstead startAbility 294 */ 295 static requestFullWindow(options?: RequestFullWindowOptions): void; 296 297 /** 298 * Set image cache capacity of decoded image count. 299 * if not set, the application will not cache any decoded image. 300 * 301 * @param { number } value - capacity of decoded image count. 302 * @syscap SystemCapability.ArkUI.ArkUI.Full 303 * @since 7 304 */ 305 /** 306 * Set image cache capacity of decoded image count. 307 * if not set, the application will not cache any decoded image. 308 * 309 * @param { number } value - capacity of decoded image count. 310 * @syscap SystemCapability.ArkUI.ArkUI.Full 311 * @atomicservice 312 * @since 12 313 */ 314 static setImageCacheCount(value: number): void; 315 316 /** 317 * Set image cache capacity of raw image data size in bytes before decode. 318 * if not set, the application will not cache any raw image data. 319 * 320 * @param { number } value - capacity of raw image data size in bytes. 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @since 7 323 */ 324 /** 325 * Set image cache capacity of raw image data size in bytes before decode. 326 * if not set, the application will not cache any raw image data. 327 * 328 * @param { number } value - capacity of raw image data size in bytes. 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @atomicservice 331 * @since 12 332 */ 333 static setImageRawDataCacheSize(value: number): void; 334 335 /** 336 * Set image file cache size in bytes on disk before decode. 337 * if not set, the application will cache 100MB image files on disk. 338 * 339 * @param { number } value - capacity of raw image data size in bytes. 340 * @syscap SystemCapability.ArkUI.ArkUI.Full 341 * @since 7 342 */ 343 /** 344 * Set image file cache size in bytes on disk before decode. 345 * if not set, the application will cache 100MB image files on disk. 346 * 347 * @param { number } value - capacity of raw image data size in bytes. 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @atomicservice 350 * @since 12 351 */ 352 static setImageFileCacheSize(value: number): void; 353} 354export default App;