• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 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 AbilityKit
19 */
20
21import AbilityConstant from './@ohos.app.ability.AbilityConstant';
22import { Configuration } from './@ohos.app.ability.Configuration';
23
24/**
25 * The environment callback.
26 *
27 * @syscap SystemCapability.Ability.AbilityRuntime.Core
28 * @since 9
29 */
30/**
31 * The environment callback.
32 *
33 * @syscap SystemCapability.Ability.AbilityRuntime.Core
34 * @atomicservice
35 * @since 11
36 */
37export default class EnvironmentCallback {
38  /**
39   * Called when the system configuration is updated.
40   *
41   * @param { Configuration } config - Indicates the updated configuration.
42   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
43   * @StageModelOnly
44   * @since 9
45   */
46  /**
47   * Called when the system configuration is updated.
48   *
49   * @param { Configuration } config - Indicates the updated configuration.
50   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
51   * @StageModelOnly
52   * @atomicservice
53   * @since 11
54   */
55  onConfigurationUpdated(config: Configuration): void;
56
57  /**
58   * Called when the system has determined to trim the memory, for example, when the ability is running in the
59   * background and there is no enough memory for running as many background processes as possible.
60   *
61   * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status.
62   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
63   * @StageModelOnly
64   * @since 9
65   */
66  /**
67   * Called when the system has determined to trim the memory, for example, when the ability is running in the
68   * background and there is no enough memory for running as many background processes as possible.
69   *
70   * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status.
71   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
72   * @StageModelOnly
73   * @atomicservice
74   * @since 11
75   */
76  onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
77}
78