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