2023-12-11 11:28:57 +00:00
|
|
|
/*
|
2024-03-11 06:09:35 +00:00
|
|
|
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
2023-12-11 11:28:57 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2024-01-06 07:49:59 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @kit ArkUI
|
|
|
|
*/
|
|
|
|
|
2023-12-11 11:28:57 +00:00
|
|
|
|
|
|
|
import { Callback } from './@ohos.base';
|
|
|
|
import window from './@ohos.window';
|
|
|
|
/**
|
|
|
|
* uiExtensionHost.
|
|
|
|
*
|
|
|
|
* @namespace uiExtensionHost
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
declare namespace uiExtensionHost {
|
|
|
|
/**
|
|
|
|
* Transition Controller
|
|
|
|
*
|
|
|
|
* @interface UIExtensionHostWindowProxy
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
interface UIExtensionHostWindowProxy {
|
|
|
|
/**
|
|
|
|
* Get the avoid area
|
|
|
|
*
|
2023-12-23 11:24:48 +00:00
|
|
|
* @param { window.AvoidAreaType } type - Type of the area
|
|
|
|
* @returns { window.AvoidArea } Area where the window cannot be displayed.
|
2023-12-11 11:28:57 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
getWindowAvoidArea(type: window.AvoidAreaType): window.AvoidArea;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the callback of avoidAreaChange
|
|
|
|
*
|
|
|
|
* @param { 'avoidAreaChange' } type - The value is fixed at 'avoidAreaChange', indicating the event of changes to the avoid area.
|
|
|
|
* @param { Callback<{ type: window.AvoidAreaType, area: window.AvoidArea }> } callback - Callback used to return the area.
|
2024-04-26 04:20:39 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-04-29 07:26:17 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2023-12-11 11:28:57 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
on(type: 'avoidAreaChange', callback: Callback<{ type: window.AvoidAreaType, area: window.AvoidArea }>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregister the callback of avoidAreaChange
|
|
|
|
*
|
|
|
|
* @param { 'avoidAreaChange' } type - The value is fixed at 'avoidAreaChange', indicating the event of changes to the avoid area.
|
|
|
|
* @param { Callback<{ type: window.AvoidAreaType, area: window.AvoidArea }> } callback - Callback used to return the area.
|
2024-04-26 04:20:39 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-04-29 07:26:17 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2023-12-11 11:28:57 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
off(type: 'avoidAreaChange', callback?: Callback<{ type: window.AvoidAreaType, area: window.AvoidArea }>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the callback of windowSizeChange
|
|
|
|
*
|
|
|
|
* @param { 'windowSizeChange' } type - The value is fixed at 'windowSizeChange', indicating the window size change event.
|
|
|
|
* @param { Callback<window.Size> } callback - Callback used to return the window size.
|
2024-04-26 04:20:39 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-04-29 07:26:17 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2023-12-11 11:28:57 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
on(type: 'windowSizeChange', callback: Callback<window.Size>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregister the callback of windowSizeChange
|
|
|
|
*
|
|
|
|
* @param { 'windowSizeChange' } type - The value is fixed at 'windowSizeChange', indicating the window size change event.
|
|
|
|
* @param { Callback<window.Size> } callback - Callback used to return the window size.
|
2024-04-26 04:20:39 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-04-29 07:26:17 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2023-12-11 11:28:57 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
off(type: 'windowSizeChange', callback?: Callback<window.Size>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The properties of the UIExtension window
|
|
|
|
*
|
|
|
|
* @type { UIExtensionHostWindowProxyProperties }
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
properties: UIExtensionHostWindowProxyProperties;
|
2024-01-05 03:46:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide the non-secure windows
|
|
|
|
*
|
|
|
|
* @param { boolean } shouldHide - Hide the non-secure windows if true, otherwise means the opposite.
|
|
|
|
* @returns { Promise<void> } - The promise returned by the function.
|
2024-04-26 04:20:39 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-04-29 07:26:17 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2024-01-05 03:46:05 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
2024-08-21 07:27:55 +00:00
|
|
|
/**
|
|
|
|
* Hide the non-secure windows.
|
|
|
|
* When called by modal UIExtension and shouldHide == false, the "ohos.permission.ALLOW_SHOW_NON_SECURE_WINDOWS" permission is required.
|
|
|
|
*
|
|
|
|
* @permission ohos.permission.ALLOW_SHOW_NON_SECURE_WINDOWS
|
|
|
|
* @param { boolean } shouldHide - Hide the non-secure windows if true, otherwise means the opposite.
|
|
|
|
* @returns { Promise<void> } - The promise returned by the function.
|
2024-08-27 02:15:46 +00:00
|
|
|
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-08-21 07:27:55 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2024-08-27 02:15:46 +00:00
|
|
|
* @throws { BusinessError } 1300002 - Abnormal state. Possible causes:
|
|
|
|
* <br> 1. Permission denied. Interface caller does not have permission "ohos.permission.ALLOW_SHOW_NON_SECURE_WINDOWS".
|
|
|
|
* <br> 2. The UIExtension window proxy is abnormal.
|
|
|
|
* @throws { BusinessError } 1300003 - This window manager service works abnormally.
|
2024-08-21 07:27:55 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
2024-08-23 11:54:08 +00:00
|
|
|
* @since 12
|
2024-08-21 07:27:55 +00:00
|
|
|
*/
|
2024-01-05 03:46:05 +00:00
|
|
|
hideNonSecureWindows(shouldHide: boolean): Promise<void>;
|
2024-03-11 06:09:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create sub window.
|
|
|
|
*
|
|
|
|
* @param { string } name - window name of sub window
|
|
|
|
* @param { window.SubWindowOptions } subWindowOptions - options of sub window creation
|
|
|
|
* @returns { Promise<window.Window> } Promise used to return the subwindow.
|
2024-04-26 04:20:39 +00:00
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
2024-04-29 07:26:17 +00:00
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
2024-05-09 03:58:42 +00:00
|
|
|
* @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
|
2024-03-11 06:09:35 +00:00
|
|
|
* @throws { BusinessError } 1300002 - This window state is abnormal.
|
|
|
|
* @throws { BusinessError } 1300005 - This window proxy is abnormal.
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @StageModelOnly
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
createSubWindowWithOptions(name: string, subWindowOptions: window.SubWindowOptions): Promise<window.Window>;
|
2024-03-23 10:49:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the watermark flag on the UIExtension window
|
|
|
|
*
|
|
|
|
* @param { boolean } enable - Add water mark flag to the UIExtension window if true, or remove flag if false
|
|
|
|
* @returns { Promise<void> } - The promise returned by the function
|
|
|
|
* @throws { BusinessError } 1300002 - The UIExtension window proxy is abnormal.
|
|
|
|
* @throws { BusinessError } 1300003 - This window manager service works abnormally.
|
2024-05-09 03:58:42 +00:00
|
|
|
* @throws { BusinessError } 1300008 - The display device is abnormal.
|
2024-03-23 10:49:32 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 12
|
|
|
|
*/
|
|
|
|
setWaterMarkFlag(enable: boolean): Promise<void>;
|
2024-10-16 06:58:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide the display content when snapshot.
|
|
|
|
*
|
2024-10-23 04:59:30 +00:00
|
|
|
* @param { boolean } shouldHide - Hide the display content of UIExtensionAbility when the host application takes snapshots if true,
|
|
|
|
* otherwise means the opposite.
|
2024-10-16 06:58:53 +00:00
|
|
|
* @returns { Promise<void> } - The promise returned by the function.
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
|
|
|
|
* @throws { BusinessError } 401 - Parameter error. Possible causes:
|
|
|
|
* <br> 1. Mandatory parameters are left unspecified.
|
|
|
|
* <br> 2. Incorrect parameters types.
|
|
|
|
* <br> 3. Parameter verification failed.
|
|
|
|
* @throws { BusinessError } 1300002 - Abnormal state. Possible causes:
|
|
|
|
* <br> 1. The UIExtension window proxy is abnormal.
|
|
|
|
* <br> 2. Not the UIExtensionAbility process calling.
|
2024-10-23 04:59:30 +00:00
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
2024-10-16 06:58:53 +00:00
|
|
|
* @systemapi
|
|
|
|
* @since 13
|
|
|
|
*/
|
|
|
|
hidePrivacyContentForHost(shouldHide: boolean): Promise<void>;
|
2023-12-11 11:28:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2023-12-23 11:24:48 +00:00
|
|
|
* Properties of UIExtension window
|
2023-12-11 11:28:57 +00:00
|
|
|
*
|
|
|
|
* @interface UIExtensionHostWindowProxyProperties
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
interface UIExtensionHostWindowProxyProperties {
|
|
|
|
/**
|
|
|
|
* The position and size of the UIExtension window
|
|
|
|
*
|
|
|
|
* @type { window.Rect }
|
|
|
|
* @syscap SystemCapability.ArkUI.ArkUI.Full
|
|
|
|
* @systemapi
|
|
|
|
* @since 11
|
|
|
|
*/
|
|
|
|
uiExtensionHostWindowProxyRect: window.Rect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default uiExtensionHost;
|