1/* 2 * Copyright (c) 2021-2022 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 Ability from '@ohos.app.ability.UIAbility'; 17 18var TAG = "DeviceManagerUI_MainAbility:"; 19 20export default class MainAbility extends Ability { 21 onCreate(want, launchParam) { 22 console.log(TAG + "MainAbility onCreate, ability name is " + want.abilityName + "."); 23 globalThis.context = this.context; 24 globalThis.allBundleInfo = []; 25 globalThis.allUserPermissions = [] 26 globalThis.allGroups = [] 27 } 28 29 onWindowStageCreate(windowStage) { 30 // Main window is created, set main page for this ability 31 console.log(TAG + "MainAbility onWindowStageCreate."); 32 33 windowStage.setUIContent(this.context, "pages/authority-management", null); 34 } 35 36 onForeground() { 37 // Ability has brought to foreground 38 console.log(TAG + "MainAbility onForeground."); 39 } 40 41 onBackground() { 42 // Ability has back to background 43 console.log(TAG + "MainAbility onBackground."); 44 45// this.context.terminateSelf(); 46 } 47 48 onDestroy() { 49 console.log(TAG + "MainAbility onDestroy."); 50 } 51 52 onWindowStageDestroy() { 53 // Main window is destroyed, release UI related resources 54 console.log(TAG + "MainAbility onWindowStageDestroy."); 55 } 56}; 57