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 16import UIAbility from '@ohos.app.ability.UIAbility'; 17import logger from '../common/logger'; 18import type Want from '@ohos.app.ability.Want'; 19import type AbilityConstant from '@ohos.app.ability.AbilityConstant'; 20import type window from '@ohos.window'; 21 22const TAG = 'AutoManagerAbility'; 23 24export default class AutoManagerAbility extends UIAbility { 25 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 26 logger.info(TAG, 'onCreate'); 27 globalThis.autoManagerAbilityWant = want; 28 globalThis.autoManagerAbilityContext = this.context; 29 } 30 31 onDestroy(): void { 32 logger.info(TAG, 'onDestroy'); 33 } 34 35 onWindowStageCreate(windowStage: window.WindowStage): void { 36 // Main window is created, set main page for this ability 37 logger.info(TAG, 'onWindowStageCreate'); 38 windowStage.loadContent('pages/autoManager/managerStart', null); 39 } 40 41 onWindowStageDestroy(): void { 42 // Main window is destroyed, release UI related resources 43 logger.info(TAG, 'onWindowStageDestroy'); 44 } 45 46 onForeground(): void { 47 // Ability has brought to foreground 48 logger.info(TAG, 'onForeground'); 49 } 50 51 onBackground(): void { 52 // Ability has back to background 53 logger.info(TAG, 'onBackground'); 54 } 55}; 56