161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"), 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit AbilityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport ExtensionAbility from './@ohos.app.ability.ExtensionAbility'; 2261847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want'; 2361847f8eSopenharmony_ciimport type UIServiceExtensionContext from './application/UIServiceExtensionContext'; 2461847f8eSopenharmony_ciimport type UIServiceHostProxy from './application/UIServiceHostProxy'; 2561847f8eSopenharmony_ciimport window from './@ohos.window'; 2661847f8eSopenharmony_ci 2761847f8eSopenharmony_ci/** 2861847f8eSopenharmony_ci * The class of UI service extension ability. 2961847f8eSopenharmony_ci * 3061847f8eSopenharmony_ci * @extends ExtensionAbility 3161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 3261847f8eSopenharmony_ci * @systemapi 3361847f8eSopenharmony_ci * @stagemodelonly 3461847f8eSopenharmony_ci * @since 14 3561847f8eSopenharmony_ci */ 3661847f8eSopenharmony_ciexport default class UIServiceExtensionAbility extends ExtensionAbility { 3761847f8eSopenharmony_ci /** 3861847f8eSopenharmony_ci * Indicates configuration information about an UI service extension ability context. 3961847f8eSopenharmony_ci * 4061847f8eSopenharmony_ci * @type { UIServiceExtensionContext } 4161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 4261847f8eSopenharmony_ci * @systemapi 4361847f8eSopenharmony_ci * @stagemodelonly 4461847f8eSopenharmony_ci * @since 14 4561847f8eSopenharmony_ci */ 4661847f8eSopenharmony_ci context: UIServiceExtensionContext; 4761847f8eSopenharmony_ci 4861847f8eSopenharmony_ci /** 4961847f8eSopenharmony_ci * Called back when an UI service extension is started for initialization. 5061847f8eSopenharmony_ci * 5161847f8eSopenharmony_ci * @param { Want } want - Indicates the want of created UI service extension. 5261847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 5361847f8eSopenharmony_ci * @systemapi 5461847f8eSopenharmony_ci * @stagemodelonly 5561847f8eSopenharmony_ci * @since 14 5661847f8eSopenharmony_ci */ 5761847f8eSopenharmony_ci onCreate(want: Want): void; 5861847f8eSopenharmony_ci 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * Called back when a UI service extension is started. 6161847f8eSopenharmony_ci * 6261847f8eSopenharmony_ci * @param { Want } want - Indicates the want of UI service extension to start. 6361847f8eSopenharmony_ci * @param { number } startId - Indicates the number of times the UI service extension has been started. 6461847f8eSopenharmony_ci * The {@code startId} is incremented by 1 every time the UI service extension is started. 6561847f8eSopenharmony_ci * For example, if the UI service extension has been started for six times. 6661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 6761847f8eSopenharmony_ci * @systemapi 6861847f8eSopenharmony_ci * @stagemodelonly 6961847f8eSopenharmony_ci * @since 14 7061847f8eSopenharmony_ci */ 7161847f8eSopenharmony_ci onRequest(want: Want, startId: number): void; 7261847f8eSopenharmony_ci 7361847f8eSopenharmony_ci /** 7461847f8eSopenharmony_ci * Called back when a UI service extension is connected to an ability. 7561847f8eSopenharmony_ci * 7661847f8eSopenharmony_ci * @param { Want } want - Indicates connection information about the UI service ability. 7761847f8eSopenharmony_ci * @param { UIServiceHostProxy } proxy - Indicates the UI service host proxy. 7861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 7961847f8eSopenharmony_ci * @systemapi 8061847f8eSopenharmony_ci * @stagemodelonly 8161847f8eSopenharmony_ci * @since 14 8261847f8eSopenharmony_ci */ 8361847f8eSopenharmony_ci onConnect(want: Want, proxy: UIServiceHostProxy): void; 8461847f8eSopenharmony_ci 8561847f8eSopenharmony_ci /** 8661847f8eSopenharmony_ci * Called back when ability connected to a UI service extension is disconnected. 8761847f8eSopenharmony_ci * 8861847f8eSopenharmony_ci * @param { Want } want - Indicates disconnection information about the UI service extension. 8961847f8eSopenharmony_ci * @param { UIServiceHostProxy } proxy - Indicates the UI service host proxy. 9061847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 9161847f8eSopenharmony_ci * @systemapi 9261847f8eSopenharmony_ci * @stagemodelonly 9361847f8eSopenharmony_ci * @since 14 9461847f8eSopenharmony_ci */ 9561847f8eSopenharmony_ci onDisconnect(want: Want, proxy: UIServiceHostProxy): void; 9661847f8eSopenharmony_ci 9761847f8eSopenharmony_ci /** 9861847f8eSopenharmony_ci * Called back when a window will create. 9961847f8eSopenharmony_ci * 10061847f8eSopenharmony_ci * @param { window.ExtensionWindowConfig } config - Indicates the extension window config. 10161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 10261847f8eSopenharmony_ci * @systemapi 10361847f8eSopenharmony_ci * @stagemodelonly 10461847f8eSopenharmony_ci * @since 14 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ci onWindowWillCreate(config: window.ExtensionWindowConfig): void; 10761847f8eSopenharmony_ci 10861847f8eSopenharmony_ci /** 10961847f8eSopenharmony_ci * Called back when a window is created. 11061847f8eSopenharmony_ci * 11161847f8eSopenharmony_ci * @param { window.Window } window - Indicates the created Window. 11261847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 11361847f8eSopenharmony_ci * @systemapi 11461847f8eSopenharmony_ci * @stagemodelonly 11561847f8eSopenharmony_ci * @since 14 11661847f8eSopenharmony_ci */ 11761847f8eSopenharmony_ci onWindowDidCreate(window: window.Window): void; 11861847f8eSopenharmony_ci 11961847f8eSopenharmony_ci /** 12061847f8eSopenharmony_ci * Called back when data is sent. 12161847f8eSopenharmony_ci * 12261847f8eSopenharmony_ci * @param { UIServiceHostProxy } proxy - Indicates the UI service host proxy. 12361847f8eSopenharmony_ci * @param { Record<string, Object> } data - Indicates the received data. 12461847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 12561847f8eSopenharmony_ci * @systemapi 12661847f8eSopenharmony_ci * @stagemodelonly 12761847f8eSopenharmony_ci * @since 14 12861847f8eSopenharmony_ci */ 12961847f8eSopenharmony_ci onData(proxy: UIServiceHostProxy, data: Record<string, Object>): void; 13061847f8eSopenharmony_ci 13161847f8eSopenharmony_ci /** 13261847f8eSopenharmony_ci * Called back before a UI service extension is destroyed. 13361847f8eSopenharmony_ci * 13461847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 13561847f8eSopenharmony_ci * @systemapi 13661847f8eSopenharmony_ci * @stagemodelonly 13761847f8eSopenharmony_ci * @since 14 13861847f8eSopenharmony_ci */ 13961847f8eSopenharmony_ci onDestroy(): void; 14061847f8eSopenharmony_ci} 141