19b256929Sopenharmony_ci/*
29b256929Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
39b256929Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49b256929Sopenharmony_ci * you may not use this file except in compliance with the License.
59b256929Sopenharmony_ci * You may obtain a copy of the License at
69b256929Sopenharmony_ci *
79b256929Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89b256929Sopenharmony_ci *
99b256929Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109b256929Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119b256929Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129b256929Sopenharmony_ci * See the License for the specific language governing permissions and
139b256929Sopenharmony_ci * limitations under the License.
149b256929Sopenharmony_ci */
159b256929Sopenharmony_ci
169b256929Sopenharmony_ciimport Ability from '@ohos.app.ability.UIAbility'
179b256929Sopenharmony_ciimport {Log} from '../../../../../common/src/main/ets/default/Log';
189b256929Sopenharmony_ci
199b256929Sopenharmony_ciconst TAG = "Entry_MainAbility";
209b256929Sopenharmony_ci
219b256929Sopenharmony_ciexport default class MainAbility extends Ability {
229b256929Sopenharmony_ci    onCreate(want, launchParam) {
239b256929Sopenharmony_ci        Log.showInfo(TAG, "MainAbility onCreate")
249b256929Sopenharmony_ci        globalThis.abilityWant = want;
259b256929Sopenharmony_ci    }
269b256929Sopenharmony_ci
279b256929Sopenharmony_ci    onDestroy() {
289b256929Sopenharmony_ci        Log.showInfo(TAG, "MainAbility onDestroy")
299b256929Sopenharmony_ci    }
309b256929Sopenharmony_ci
319b256929Sopenharmony_ci    onWindowStageCreate(windowStage) {
329b256929Sopenharmony_ci        // Main window is created, set main page for this ability
339b256929Sopenharmony_ci        Log.showInfo(TAG, "MainAbility onWindowStageCreate")
349b256929Sopenharmony_ci
359b256929Sopenharmony_ci        windowStage.setUIContent(this.context, "pages/index", null)
369b256929Sopenharmony_ci    }
379b256929Sopenharmony_ci
389b256929Sopenharmony_ci    onWindowStageDestroy() {
399b256929Sopenharmony_ci        // Main window is destroyed, release UI related resources
409b256929Sopenharmony_ci        Log.showInfo(TAG, "MainAbility onWindowStageDestroy")
419b256929Sopenharmony_ci    }
429b256929Sopenharmony_ci
439b256929Sopenharmony_ci    onForeground() {
449b256929Sopenharmony_ci        // Ability has brought to foreground
459b256929Sopenharmony_ci        Log.showInfo(TAG, "MainAbility onForeground")
469b256929Sopenharmony_ci    }
479b256929Sopenharmony_ci
489b256929Sopenharmony_ci    onBackground() {
499b256929Sopenharmony_ci        // Ability has back to background
509b256929Sopenharmony_ci        Log.showInfo(TAG, "MainAbility onBackground")
519b256929Sopenharmony_ci    }
529b256929Sopenharmony_ci};
53