1/* 2 * Copyright (c) 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 type Want from './@ohos.app.ability.Want'; 23import ExtensionAbility from './@ohos.app.ability.ExtensionAbility'; 24import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession'; 25import type UIExtensionContext from './application/UIExtensionContext'; 26 27/** 28 * The class of UI extension ability. 29 * 30 * @extends ExtensionAbility 31 * @syscap SystemCapability.Ability.AbilityRuntime.Core 32 * @StageModelOnly 33 * @since arkts {'1.1':'10', '1.2':'20'} 34 * @arkts 1.1&1.2 35 */ 36declare class UIExtensionAbility extends ExtensionAbility { 37 /** 38 * Indicates configuration information about an UI extension ability context. 39 * 40 * @type { UIExtensionContext } 41 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 42 * @StageModelOnly 43 * @since arkts {'1.1':'10', '1.2':'20'} 44 * @arkts 1.1&1.2 45 */ 46 context: UIExtensionContext; 47 48 /** 49 * Called back when an UI extension is started for initialization. 50 * 51 * @syscap SystemCapability.Ability.AbilityRuntime.Core 52 * @StageModelOnly 53 * @since 10 54 */ 55 /** 56 * Called back when an UI extension is started for initialization. 57 * 58 * @param { AbilityConstant.LaunchParam } launchParam - Indicates the LaunchParam information about UIExtensionAbility. 59 * @syscap SystemCapability.Ability.AbilityRuntime.Core 60 * @StageModelOnly 61 * @since arkts {'1.1':'12', '1.2':'20'} 62 * @arkts 1.1&1.2 63 */ 64 onCreate(launchParam: AbilityConstant.LaunchParam): void; 65 66 /** 67 * Called back when an UI extension session is created. 68 * 69 * @param { Want } want - Indicates the want info of the UI extension. 70 * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page. 71 * @syscap SystemCapability.Ability.AbilityRuntime.Core 72 * @StageModelOnly 73 * @since arkts {'1.1':'10', '1.2':'20'} 74 * @arkts 1.1&1.2 75 */ 76 onSessionCreate(want: Want, session: UIExtensionContentSession): void; 77 78 /** 79 * Called back when an UI extension session is destroyed. 80 * 81 * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page. 82 * @syscap SystemCapability.Ability.AbilityRuntime.Core 83 * @StageModelOnly 84 * @since arkts {'1.1':'10', '1.2':'20'} 85 * @arkts 1.1&1.2 86 */ 87 onSessionDestroy(session: UIExtensionContentSession): void; 88 89 /** 90 * Called back when the state of an UI extension changes to foreground. 91 * 92 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 93 * @StageModelOnly 94 * @since arkts {'1.1':'10', '1.2':'20'} 95 * @arkts 1.1&1.2 96 */ 97 onForeground(): void; 98 99 /** 100 * Called back when the state of an UI extension changes to background. 101 * 102 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 103 * @StageModelOnly 104 * @since arkts {'1.1':'10', '1.2':'20'} 105 * @arkts 1.1&1.2 106 */ 107 onBackground(): void; 108 109 /** 110 * Called back before an UI extension is destroyed. 111 * 112 * @returns { void | Promise<void> } the promise returned by the function. 113 * @syscap SystemCapability.Ability.AbilityRuntime.Core 114 * @StageModelOnly 115 * @since 10 116 */ 117 onDestroy(): void | Promise<void>; 118 119 /** 120 * Called back before an UI extension is destroyed. 121 * 122 * @returns { void } the promise returned by the function. 123 * @syscap SystemCapability.Ability.AbilityRuntime.Core 124 * @StageModelOnly 125 * @since 20 126 * @arkts 1.2 127 */ 128 onDestroy(): void; 129 130 /** 131 * Called back before an UI extension is destroyed. 132 * 133 * @returns { Promise<void> } the promise returned by the function. 134 * @syscap SystemCapability.Ability.AbilityRuntime.Core 135 * @StageModelOnly 136 * @since 20 137 * @arkts 1.2 138 */ 139 onDestroyAsync(): Promise<void>; 140} 141 142export default UIExtensionAbility;