• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
28export interface AppResponse {
29  /**
30   * Application bundleName.
31   *
32   * @type { string }
33   * @syscap SystemCapability.ArkUI.ArkUI.Full
34   * @since 6
35   */
36  appID: string;
37
38  /**
39   * Application name.
40   *
41   * @type { string }
42   * @syscap SystemCapability.ArkUI.ArkUI.Lite
43   * @since 3
44   */
45  appName: string;
46
47  /**
48   * Application version name.
49   *
50   * @type { string }
51   * @syscap SystemCapability.ArkUI.ArkUI.Lite
52   * @since 3
53   */
54  versionName: string;
55
56  /**
57   * Application version.
58   *
59   * @type { number }
60   * @syscap SystemCapability.ArkUI.ArkUI.Lite
61   * @since 3
62   */
63  versionCode: number;
64}
65
66/**
67 * Defines the option of screenOnVisible interface.
68 *
69 * @interface ScreenOnVisibleOptions
70 * @syscap SystemCapability.ArkUI.ArkUI.Full
71 * @since 3
72 */
73/**
74 * Defines the option of screenOnVisible interface.
75 *
76 * @interface ScreenOnVisibleOptions
77 * @syscap SystemCapability.ArkUI.ArkUI.Full
78 * @atomicservice
79 * @since 11
80 */
81export interface ScreenOnVisibleOptions {
82  /**
83   * Whether to keep the application visible. The default value is false.
84   *
85   * @type { ?boolean }
86   * @syscap SystemCapability.ArkUI.ArkUI.Full
87   * @since 3
88   */
89  /**
90   * Whether to keep the application visible. The default value is false.
91   *
92   * @type { ?boolean }
93   * @syscap SystemCapability.ArkUI.ArkUI.Full
94   * @atomicservice
95   * @since 11
96   */
97  visible?: boolean;
98
99  /**
100   * Called when the application always keeps visible.
101   *
102   * @type { ?function }
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @since 3
105   */
106  /**
107   * Called when the application always keeps visible.
108   *
109   * @type { ?function }
110   * @syscap SystemCapability.ArkUI.ArkUI.Full
111   * @atomicservice
112   * @since 11
113   */
114  success?: () => void;
115
116  /**
117   * Called when the application fails to keep visible.
118   *
119   * @type { ?function }
120   * @syscap SystemCapability.ArkUI.ArkUI.Full
121   * @since 3
122   */
123  /**
124   * Called when the application fails to keep visible.
125   *
126   * @type { ?function }
127   * @syscap SystemCapability.ArkUI.ArkUI.Full
128   * @atomicservice
129   * @since 11
130   */
131  fail?: (data: string, code: number) => void;
132
133  /**
134   * Called when the execution is completed.
135   *
136   * @type { ?function }
137   * @syscap SystemCapability.ArkUI.ArkUI.Full
138   * @since 3
139   */
140  /**
141   * Called when the execution is completed.
142   *
143   * @type { ?function }
144   * @syscap SystemCapability.ArkUI.ArkUI.Full
145   * @atomicservice
146   * @since 11
147   */
148  complete?: () => void;
149}
150
151/**
152 * Defines the option of RequestFullWindow interface.
153 *
154 * @interface RequestFullWindowOptions
155 * @syscap SystemCapability.ArkUI.ArkUI.Full
156 * @since 3
157 */
158/**
159 * Defines the option of RequestFullWindow interface.
160 *
161 * @interface RequestFullWindowOptions
162 * @syscap SystemCapability.ArkUI.ArkUI.Full
163 * @atomicservice
164 * @since 11
165 */
166export interface RequestFullWindowOptions {
167  /**
168   * Defines the number of animation options.
169   *
170   * @type { number }
171   * @syscap SystemCapability.ArkUI.ArkUI.Full
172   * @since 3
173   */
174  /**
175   * Defines the number of animation options.
176   *
177   * @type { number }
178   * @syscap SystemCapability.ArkUI.ArkUI.Full
179   * @atomicservice
180   * @since 11
181   */
182  duration: number;
183}
184
185/**
186 * Defines the app class info.
187 *
188 * @syscap SystemCapability.ArkUI.ArkUI.Lite
189 * @since 3
190 */
191export default class App {
192  /**
193   * Obtains the declared information in the config.json file of an application.
194   *
195   * @returns { AppResponse }
196   * @syscap SystemCapability.ArkUI.ArkUI.Lite
197   * @since 3
198   */
199  static getInfo(): AppResponse;
200
201  /**
202   * Destroys the current ability.
203   *
204   * @syscap SystemCapability.ArkUI.ArkUI.Lite
205   * @since 3
206   */
207  static terminate(): void;
208
209  /**
210   * Keeps the application visible after the screen is waken up.
211   * This method prevents the system from returning to the home screen when the screen is locked.
212   *
213   * @param { ScreenOnVisibleOptions } options
214   * @syscap SystemCapability.ArkUI.ArkUI.Full
215   * @since 3
216   * @deprecated since 8
217   */
218  static screenOnVisible(options?: ScreenOnVisibleOptions): void;
219
220  /**
221   * Requests the application to run in full window.
222   * In some scenarios, such as semi-modal FA, the FA runs in non-full window.
223   * In this case, you can call this API.
224   * This API is invalid for an application already in full-window mode.
225   *
226   * @param { RequestFullWindowOptions } options Transition time from non-full window to full window, in milliseconds.
227   * By default, the value is in direct proportion to the distance between the non-full window and the full window.
228   * @syscap SystemCapability.ArkUI.ArkUI.Full
229   * @since 3
230   * @deprecated since 8
231   * @useinstead startAbility
232   */
233  static requestFullWindow(options?: RequestFullWindowOptions): void;
234
235  /**
236   * Set image cache capacity of decoded image count.
237   * if not set, the application will not cache any decoded image.
238   *
239   * @param { number } value - capacity of decoded image count.
240   * @syscap SystemCapability.ArkUI.ArkUI.Full
241   * @since 7
242   */
243  static setImageCacheCount(value: number): void;
244
245  /**
246   * Set image cache capacity of raw image data size in bytes before decode.
247   * if not set, the application will not cache any raw image data.
248   *
249   * @param { number } value - capacity of raw image data size in bytes.
250   * @syscap SystemCapability.ArkUI.ArkUI.Full
251   * @since 7
252   */
253  static setImageRawDataCacheSize(value: number): void;
254
255  /**
256   * Set image file cache size in bytes on disk before decode.
257   * if not set, the application will cache 100MB image files on disk.
258   *
259   * @param { number } value - capacity of raw image data size in bytes.
260   * @syscap SystemCapability.ArkUI.ArkUI.Full
261   * @since 7
262   */
263  static setImageFileCacheSize(value: number): void;
264}
265