• 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 * Defines the AppResponse info.
18 * @syscap SystemCapability.ArkUI.ArkUI.Lite
19 * @since 3
20 */
21export interface AppResponse {
22  /**
23   * Application bundleName.
24   * @syscap SystemCapability.ArkUI.ArkUI.Full
25   * @since 6
26   */
27  appID: string;
28
29  /**
30   * Application name.
31   * @syscap SystemCapability.ArkUI.ArkUI.Lite
32   * @since 3
33   */
34  appName: string;
35
36  /**
37   * Application version name.
38   * @syscap SystemCapability.ArkUI.ArkUI.Lite
39   * @since 3
40   */
41  versionName: string;
42
43  /**
44   * Application version.
45   * @syscap SystemCapability.ArkUI.ArkUI.Lite
46   * @since 3
47   */
48  versionCode: number;
49}
50
51/**
52 * Defines the option of screenOnVisible interface.
53 * @syscap SystemCapability.ArkUI.ArkUI.Full
54 * @since 3
55 */
56export interface ScreenOnVisibleOptions {
57  /**
58   * Whether to keep the application visible. The default value is false.
59   * @since 3
60   */
61  visible?: boolean;
62
63  /**
64   * Called when the application always keeps visible.
65   * @since 3
66   */
67  success?: () => void;
68
69  /**
70   * Called when the application fails to keep visible.
71   * @since 3
72   */
73  fail?: (data: string, code: number) => void;
74
75  /**
76   * Called when the execution is completed.
77   * @since 3
78   */
79  complete?: () => void;
80}
81
82/**
83 * Defines the option of RequestFullWindow interface.
84 * @syscap SystemCapability.ArkUI.ArkUI.Full
85 * @since 3
86 */
87export interface RequestFullWindowOptions {
88  /**
89   * Defines the number of animation options.
90   * @syscap SystemCapability.ArkUI.ArkUI.Full
91   * @since 3
92   */
93  duration: number;
94}
95
96/**
97 * Defines the app class info.
98 * @syscap SystemCapability.ArkUI.ArkUI.Lite
99 * @since 3
100 */
101export default class App {
102  /**
103   * Obtains the declared information in the config.json file of an application.
104   * @syscap SystemCapability.ArkUI.ArkUI.Lite
105   * @since 3
106   */
107  static getInfo(): AppResponse;
108
109  /**
110   * Destroys the current ability.
111   * @syscap SystemCapability.ArkUI.ArkUI.Lite
112   * @since 3
113   */
114  static terminate(): void;
115
116  /**
117   * Keeps the application visible after the screen is woken up.
118   * This method prevents the system from returning to the home screen when the screen is locked.
119   * @syscap SystemCapability.ArkUI.ArkUI.Full
120   * @since 3
121   * @deprecated since 8
122   */
123  static screenOnVisible(options?: ScreenOnVisibleOptions): void;
124
125  /**
126   * Requests the application to run in full window.
127   * In some scenarios, such as semi-modal FA, the FA runs in non-full window.
128   * In this case, you can call this API.
129   * This API is invalid for an application already in full-window mode.
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @param options Transition time from non-full window to full window, in milliseconds.
132   * By default, the value is in direct proportion to the distance between the non-full window and the full window.
133   * @since 3
134   * @deprecated since 8
135   * @useinstead startAbility
136   */
137  static requestFullWindow(options?: RequestFullWindowOptions): void;
138
139  /**
140   * Set image cache capacity of decoded image count.
141   * if not set, the application will not cache any decoded image.
142   * @syscap SystemCapability.ArkUI.ArkUI.Full
143   * @param value capacity of decoded image count.
144   * @since 7
145   */
146  static setImageCacheCount(value: number): void;
147
148  /**
149   * Set image cache capacity of raw image data size in bytes before decode.
150   * if not set, the application will not cache any raw image data.
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @param value capacity of raw image data size in bytes.
153   * @since 7
154   */
155  static setImageRawDataCacheSize(value: number): void;
156
157  /**
158   * Set image file cache size in bytes on disk before decode.
159   * if not set, the application will cache 100MB image files on disk.
160   * @syscap SystemCapability.ArkUI.ArkUI.Full
161   * @param value capacity of raw image data size in bytes.
162   * @since 7
163   */
164  static setImageFileCacheSize(value: number): void;
165}
166