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 class of an ability. 26 * 27 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 28 * @StageModelOnly 29 * @since 9 30 */ 31/** 32 * The class of an ability. 33 * 34 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 35 * @StageModelOnly 36 * @atomicservice 37 * @since 11 38 */ 39export default class Ability { 40 /** 41 * Called when the system configuration is updated. 42 * 43 * @param { Configuration } newConfig - Indicates the updated configuration. 44 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 45 * @StageModelOnly 46 * @since 9 47 */ 48 /** 49 * Called when the system configuration is updated. 50 * 51 * @param { Configuration } newConfig - Indicates the updated configuration. 52 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 53 * @StageModelOnly 54 * @atomicservice 55 * @since 11 56 */ 57 onConfigurationUpdate(newConfig: Configuration): void; 58 59 /** 60 * Called when the system has determined to trim the memory, for example, when the ability is running in the 61 * background and there is no enough memory for running as many background processes as possible. 62 * 63 * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory 64 * usage status. 65 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 66 * @StageModelOnly 67 * @since 9 68 */ 69 /** 70 * Called when the system has determined to trim the memory, for example, when the ability is running in the 71 * background and there is no enough memory for running as many background processes as possible. 72 * 73 * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory 74 * usage status. 75 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 76 * @StageModelOnly 77 * @atomicservice 78 * @since 11 79 */ 80 onMemoryLevel(level: AbilityConstant.MemoryLevel): void; 81} 82