From dd3df338cfcc3fffa0646218016ee23d73018230 Mon Sep 17 00:00:00 2001 From: leafly2021 Date: Wed, 17 Aug 2022 16:21:21 +0800 Subject: [PATCH 1/2] fixed 58b22cb from https://gitee.com/leafly2021/interface_sdk-js/pulls/2344 add setWindowMode Signed-off-by: leafly2021 Change-Id: Ibfe671243b17b427c879609c9319d00d2ede7df5 --- api/@ohos.display.d.ts | 33 +- api/@ohos.screen.d.ts | 65 ++- api/@ohos.screenshot.d.ts | 5 + api/@ohos.window.d.ts | 909 +++++++++++++++++++++++++++++++++----- 4 files changed, 882 insertions(+), 130 deletions(-) diff --git a/api/@ohos.display.d.ts b/api/@ohos.display.d.ts index f3e899897a..6b8458589a 100644 --- a/api/@ohos.display.d.ts +++ b/api/@ohos.display.d.ts @@ -24,17 +24,22 @@ declare namespace display { /** * Obtain the default display. * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getDefaultDisplaySync */ function getDefaultDisplay(callback: AsyncCallback): void; /** * Obtain the default display. * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getDefaultDisplaySync */ function getDefaultDisplay(): Promise; /** * Obtain the default display. + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ function getDefaultDisplaySync(): Display; @@ -42,18 +47,38 @@ declare namespace display { /** * Obtain all displays. * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getAllDisplays */ function getAllDisplay(callback: AsyncCallback>): void; /** * Obtain all displays. * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getAllDisplays */ function getAllDisplay(): Promise>; + /** + * Obtain all displays. + * @throws {BusinessError} 1400001 - If display or screen is invalid + * @since 9 + */ + function getAllDisplays(callback: AsyncCallback>): void; + + /** + * Obtain all displays. + * @throws {BusinessError} 1400001 - If display or screen is invalid + * @since 9 + */ + function getAllDisplays(): Promise>; + /** * Check whether there is a privacy window on the current display. * @param displayId Display id to query + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400003 - If system works abnormally * @systemapi Hide this for inner system use. * @since 9 */ @@ -63,6 +88,7 @@ declare namespace display { * Register the callback for display changes. * @param type: type of callback * @since 7 + * @throws {BusinessError} 401 - If param is invalid */ function on(type: 'add' | 'remove' | 'change', callback: Callback): void; @@ -70,6 +96,7 @@ declare namespace display { * Unregister the callback for display changes. * @param type: type of callback * @since 7 + * @throws {BusinessError} 401 - If param is invalid */ function off(type: 'add' | 'remove' | 'change', callback?: Callback): void; @@ -134,7 +161,7 @@ declare namespace display { } /** - * cutout information of the display. + * Cutout information of the display. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ @@ -223,16 +250,18 @@ declare namespace display { /** * Obtain the cutout info of the display. + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ getCutoutInfo(callback: AsyncCallback): void; /** * Obtain the cutout info of the display. + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ getCutoutInfo(): Promise; } } -export default display; +export default display; \ No newline at end of file diff --git a/api/@ohos.screen.d.ts b/api/@ohos.screen.d.ts index d58d00d1e5..a9da9f6452 100644 --- a/api/@ohos.screen.d.ts +++ b/api/@ohos.screen.d.ts @@ -16,14 +16,15 @@ import { AsyncCallback, Callback } from './basic'; /** - * interface of screen manager + * Interface of screen manager * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. * @since 9 */ declare namespace screen { /** - * get all screen + * Get all screen + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ function getAllScreens(callback: AsyncCallback>): void; @@ -32,6 +33,7 @@ declare namespace screen { /** * Register the callback for screen changes. * @param eventType: type of callback + * @throws {BusinessError} 401 - If param is invalid * @since 9 */ function on(eventType: 'connect' | 'disconnect' | 'change', callback: Callback): void; @@ -39,29 +41,36 @@ declare namespace screen { /** * Unregister the callback for screen changes. * @param eventType: type of callback + * @throws {BusinessError} 401 - If param is invalid * @since 9 */ function off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback): void; /** - * make screens as expand-screen + * Make screens as expand-screen + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ function makeExpand(options:Array, callback: AsyncCallback): void; function makeExpand(options:Array): Promise; /** - * make screens as mirror-screen + * Make screens as mirror-screen + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ function makeMirror(mainScreen:number, mirrorScreen:Array, callback: AsyncCallback): void; function makeMirror(mainScreen:number, mirrorScreen:Array): Promise; /** - * Create virtual screen. + * Create virtual screen. if surfaceId is valid, this permission is necessary. * @param options Indicates the options of the virtual screen. - * @permission ohos.permission.CAPTURE_SCREEN. if VirtualScreenOption.surfaceId is valid, - * this permission is necessary. + * @permission ohos.permission.CAPTURE_SCREEN + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ function createVirtualScreen(options:VirtualScreenOption, callback: AsyncCallback): void; @@ -70,6 +79,8 @@ declare namespace screen { /** * Destroy virtual screen. * @param screenId Indicates the screen id of the virtual screen. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400002 - If operation other screen * @since 9 */ function destroyVirtualScreen(screenId:number, callback: AsyncCallback): void; @@ -80,6 +91,9 @@ declare namespace screen { * @param screenId Indicates the screen id of the virtual screen. * @param surfaceId Indicates the surface id. * @permission ohos.permission.CAPTURE_SCREEN + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400001 - If display or screen is invalid * @since 9 */ function setVirtualScreenSurface(screenId:number, surfaceId: string, callback: AsyncCallback): void; @@ -95,29 +109,30 @@ declare namespace screen { /** * Set screen rotation lock status. * @param isLocked Indicates whether the screen rotation switch is locked. + * @throws {BusinessError} 401 - If param is invalid * @since 9 */ function setScreenRotationLocked(isLocked:boolean, callback: AsyncCallback): void; function setScreenRotationLocked(isLocked:boolean): Promise; /** - * the parameter of making expand screen + * The parameter of making expand screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ interface ExpandOption { /** - * screen id + * Screen id */ screenId: number; /** - * the start coordinate X of the screen origin + * The start coordinate X of the screen origin */ startX: number; /** - * the start coordinate Y of the screen origin + * The start coordinate Y of the screen origin */ startY: number; } @@ -155,58 +170,64 @@ declare namespace screen { } /** - * interface for screen + * Interface for screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ interface Screen { /** - * screen id + * Screen id */ readonly id: number; /** - * group id + * Group id */ readonly parent: number; /** - * mode supported by the screen + * Mode supported by the screen */ readonly supportedModeInfo: Array; /** - * currently active mode + * Currently active mode */ readonly activeModeIndex: number; /** - * orientation of the screen + * Orientation of the screen */ readonly orientation: Orientation; /** - * set the orientation of the screen + * Set the orientation of the screen + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400003 - If system state is abnormally * @since 9 */ setOrientation(orientation: Orientation, callback: AsyncCallback): void; setOrientation(orientation: Orientation): Promise; /** - * active the mode + * Active the mode + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400003 - If system state is abnormally */ setScreenActiveMode(modeIndex: number, callback: AsyncCallback): void; setScreenActiveMode(modeIndex: number): Promise; /** - * set display density of the screen + * Set display density of the screen + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1400003 - If system state is abnormally */ setDensityDpi(densityDpi: number, callback: AsyncCallback): void; setDensityDpi(densityDpi: number): Promise; } /** - * screen orientation + * Screen orientation * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ @@ -219,7 +240,7 @@ declare namespace screen { } /** - * the infomation of the screen + * The infomation of the screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ diff --git a/api/@ohos.screenshot.d.ts b/api/@ohos.screenshot.d.ts index 210ff03b84..2967f7cc1e 100644 --- a/api/@ohos.screenshot.d.ts +++ b/api/@ohos.screenshot.d.ts @@ -27,6 +27,8 @@ declare namespace screenshot { * Takes a screenshot and saves it as a PixelMap object. * @param options Screenshot options, which consist of screenRect, imageSize, and rotation. You need to set these parameters * @permission ohos.permission.CAPTURE_SCREEN + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid * @since 7 */ function save(options: ScreenshotOptions, callback: AsyncCallback): void; @@ -35,6 +37,7 @@ declare namespace screenshot { * Takes a screenshot and saves it as a PixelMap object. * @param options Screenshot options, which consist of screenRect, imageSize, and rotation. You need to set these parameters * @permission ohos.permission.CAPTURE_SCREEN + * @throws {BusinessError} 201 - If there is no permission * @since 7 */ function save(callback: AsyncCallback): void; @@ -43,6 +46,8 @@ declare namespace screenshot { * Takes a screenshot and saves it as a PixelMap object. * @param options Screenshot options, which consist of screenRect, imageSize, and rotation. You need to set these parameters * @permission ohos.permission.CAPTURE_SCREEN + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid * @since 7 */ function save(options?: ScreenshotOptions): Promise; diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 515bfbc8e5..1ea88ecd65 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -16,7 +16,7 @@ /// import { AsyncCallback, Callback } from './basic' ; -import Context from './application/BaseContext'; +import BaseContext from './application/BaseContext'; import { LocalStorage } from 'StateManagement'; import image from './@ohos.multimedia.image'; import rpc from './@ohos.rpc'; @@ -42,112 +42,112 @@ declare namespace window { */ TYPE_SYSTEM_ALERT, /** - * input method. + * Input method. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_INPUT_METHOD, /** - * status bar. + * Status bar. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_STATUS_BAR, /** - * panel. + * Panel. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_PANEL, /** - * keyguard. + * Keyguard. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_KEYGUARD, /** - * volume. + * Volume. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_VOLUME_OVERLAY, /** - * navigation bar. + * Navigation bar. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_NAVIGATION_BAR, /** - * float. + * Float. * @permission ohos.permission.SYSTEM_FLOAT_WINDOW * @since 9 * @StageModelOnly */ TYPE_FLOAT, /** - * wallpaper. + * Wallpaper. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_WALLPAPER, /** - * desktop. + * Desktop. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_DESKTOP, /** - * recent. + * Recent. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_LAUNCHER_RECENT, /** - * dock. + * Dock. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_LAUNCHER_DOCK, /** - * voice interaction. + * Voice interaction. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_VOICE_INTERACTION, /** - * pointer. + * Pointer. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_POINTER, /** - * float camera. + * Float camera. * @permission ohos.permission.SYSTEM_FLOAT_WINDOW * @since 9 * @StageModelOnly */ TYPE_FLOAT_CAMERA, /** - * dialog. + * Dialog. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly */ TYPE_DIALOG, /** - * screenshot. + * Screenshot. * @systemapi Hide this for inner system use. * @since 9 * @StageModelOnly @@ -172,13 +172,13 @@ declare namespace window { TYPE_CUTOUT, /** - * area for system gesture + * Area for system gesture * @since 9 */ TYPE_SYSTEM_GESTURE, /** - * area for keyboard + * Area for keyboard * @since 9 */ TYPE_KEYBOARD @@ -224,88 +224,88 @@ declare namespace window { */ interface SystemBarProperties { /** - * the color of the status bar. + * The color of the status bar. * @since 6 */ statusBarColor?: string; /** - * the light icon of the status bar. + * The light icon of the status bar. * @since 7 */ isStatusBarLightIcon?: boolean; /** - * the content color of the status bar + * The content color of the status bar * @since 8 */ statusBarContentColor?: string; /** - * the color of the navigation bar. + * The color of the navigation bar. * @since 6 */ navigationBarColor?: string; /** - * the light icon of the navigation bar. + * The light icon of the navigation bar. * @since 7 */ isNavigationBarLightIcon?: boolean; /** - * the content color of the navigation bar + * The content color of the navigation bar * @since 8 */ navigationBarContentColor?: string; } /** - * system bar tint of region + * System bar tint of region * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. * @since 8 */ interface SystemBarRegionTint { /** - * system bar type + * System bar type */ type: WindowType; /** - * the visibility of system bar + * The visibility of system bar */ isEnable?: boolean; /** - * the region of system bar + * The region of system bar */ region?: Rect; /** - * the background color of the system bar. + * The background color of the system bar. */ backgroundColor?: string; /** - * the content color of the system bar. + * The content color of the system bar. */ contentColor?: string } /** - * system bar tint state for systemui + * System bar tint state for systemui * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. * @since 8 */ interface SystemBarTintState { /** - * id of display + * Id of display */ displayId: number; /** - * region tint of systembar + * Region tint of systembar */ regionTint: Array; } @@ -326,7 +326,7 @@ declare namespace window { } /** - * avoid area + * Avoid area * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 */ @@ -359,18 +359,18 @@ declare namespace window { } /** - * window size + * Window size * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 */ interface Size { /** - * the width of the window. + * The width of the window. */ width: number; /** - * the height of the window. + * The height of the window. */ height: number; } @@ -382,13 +382,13 @@ declare namespace window { */ interface WindowProperties { /** - * the position and size of the window + * The position and size of the window * @since 7 */ windowRect: Rect; /** - * window type + * Window type * @since 7 */ type: WindowType; @@ -565,6 +565,7 @@ declare namespace window { /** * Set complete state of animation transition * @param isCompleted is Completed if true, or not if false. + * @throws {BusinessError} 401 - If param is invalid */ completeTransition(isCompleted: boolean): void; } @@ -579,20 +580,73 @@ declare namespace window { /** * Animation configuration when showing window * @param context transition Context. + * @throws {BusinessError} 401 - If param is invalid */ animationForShown(context: TransitionContext): void; /** * Animation configuration when hiding window * @param context transition context. + * @throws {BusinessError} 401 - If param is invalid */ animationForHidden(context: TransitionContext): void; } + /** + * Configuration parameters for window creation. + * @since 9 + */ + interface Configuration { + /** + * Indicates window id. + */ + name: string + /** + * Indicates window type + */ + windowType: WindowType + /** + * Indicates window context. + */ + ctx?: BaseContext + /** + * Indicates display ID. + */ + displayId?: number + /** + * Indicates Parent window id + */ + parentId?: string + } + + /** + * Create a window with a specific configuration + * @param Configuration Configuration parameters for window creation. + * @since 9 + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300001 - If window has created + * @throws {BusinessError} 1300006 - If window context is abnormally + */ + function createWindow({ name, windowType, ctx, displayId, parentId = "" }: Configuration, callback: AsyncCallback): void; + + /** + * Create a window with a specific configuration + * @param Configuration Configuration parameters for window creation. + * @since 9 + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300001 - If window has created + * @throws {BusinessError} 1300006 - If window context is abnormally + */ + function createWindow({ name, windowType, ctx, displayId, parentId = "" }: Configuration): Promise; + /** * Create a sub window with a specific id and type, only support 7. * @param id Indicates window id. * @param type Indicates window type. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window#createWindow * @FAModelOnly */ function create(id: string, type: WindowType, callback: AsyncCallback): void; @@ -602,6 +656,8 @@ declare namespace window { * @param id Indicates window id. * @param type Indicates window type. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window#createWindow * @FAModelOnly */ function create(id: string, type: WindowType): Promise; @@ -612,8 +668,10 @@ declare namespace window { * @param id Indicates window id. * @param type Indicates window type. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window#createWindow */ - function create(ctx: Context, id: string, type: WindowType): Promise; + function create(ctx: BaseContext, id: string, type: WindowType): Promise; /** * Create a system or float window with a specific id and type. @@ -621,13 +679,17 @@ declare namespace window { * @param id Indicates window id. * @param type Indicates window type. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window#createWindow */ - function create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback): void; + function create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback): void; /** * Find the window by id. * @param id Indicates window id. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window#findWindow */ function find(id: string, callback: AsyncCallback): void; @@ -635,13 +697,25 @@ declare namespace window { * Find the window by id. * @param id Indicates window id. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window#findWindow */ function find(id: string): Promise; + /** + * Find the window by name. + * @param name Indicates window name. + * @throws {BusinessError} 401 - If param is invalid + * @since 9 + */ + function findWindow(name: string): Window; + /** * Get the final show window. * @param id Indicates window id. * @since 6 + * @deprecated since 9 + * @useinstead ohos.window#getLastWindow * @FAModelOnly */ function getTopWindow(callback: AsyncCallback): void; @@ -649,6 +723,8 @@ declare namespace window { /** * Get the final show window. * @since 6 + * @deprecated since 9 + * @useinstead ohos.window#getLastWindow * @FAModelOnly */ function getTopWindow(): Promise; @@ -657,32 +733,60 @@ declare namespace window { * Get the final show window. * @param ctx Indicates the context on which the window depends * @since 8 + * @deprecated since 9 + * @useinstead ohos.window#getLastWindow */ - function getTopWindow(ctx: Context): Promise; + function getTopWindow(ctx: BaseContext): Promise; /** * Get the final show window. * @param ctx Indicates the context on which the window depends * @since 8 + * @deprecated since 9 + * @useinstead ohos.window#getLastWindow + */ + function getTopWindow(ctx: BaseContext, callback: AsyncCallback): void; + + /** + * Get the final show window. + * @param ctx Indicates the context on which the window depends. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300006 - If window context is abnormally + * @since 9 */ - function getTopWindow(ctx: Context, callback: AsyncCallback): void; + function getLastWindow(ctx: BaseContext, callback: AsyncCallback): void; + + /** + * Get the final show window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300006 - If window context is abnormally + * @since 9 + */ + function getLastWindow(ctx: BaseContext): Promise; /** - * minimize all app windows. + * Minimize all app windows. * @systemapi Hide this for inner system use. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300003 - If system state is abnormally * @since 9 */ function minimizeAll(id: number, callback: AsyncCallback): void; /** - * minimize all app windows. + * Minimize all app windows. * @systemapi Hide this for inner system use. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300003 - If system state is abnormally * @since 9 */ function minimizeAll(id: number): Promise; /** * Toggle shown state for all app windows. Minimize or restore all app windows. + * @throws {BusinessError} 1300003 - If system state is abnormally * @systemapi Hide this for inner system use. * @since 9 */ @@ -690,6 +794,7 @@ declare namespace window { /** * Toggle shown state for all app windows. Minimize or restore all app windows. + * @throws {BusinessError} 1300003 - If system state is abnormally * @systemapi Hide this for inner system use. * @since 9 */ @@ -699,6 +804,8 @@ declare namespace window { * Set the layout mode of a window. * @param mode the layout mode of a window. * @systemapi Hide this for inner system use. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300003 - If system state is abnormally * @since 9 */ function setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback): void; @@ -707,28 +814,32 @@ declare namespace window { * Set the layout mode of a window. * @param mode the layout mode of a window. * @systemapi Hide this for inner system use. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300003 - If system state is abnormally * @since 9 */ function setWindowLayoutMode(mode: WindowLayoutMode): Promise; /** - * register the callback of systemBarTintChange + * Register the callback of systemBarTintChange * @param type: 'systemBarTintChange' * @systemapi Hide this for inner system use. + * @throws {BusinessError} 401 - If param is invalid * @since 8 */ function on(type: 'systemBarTintChange', callback: Callback): void; /** - * unregister the callback of systemBarTintChange - * @param type: 'systemBarTintChange' - * @systemapi Hide this for inner system use. - * @since 8 - */ + * Unregister the callback of systemBarTintChange + * @param type: 'systemBarTintChange' + * @systemapi Hide this for inner system use. + * @throws {BusinessError} 401 - If param is invalid + * @since 8 + */ function off(type: 'systemBarTintChange', callback?: Callback): void; /** - * display orientation + * Display orientation * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ @@ -774,54 +885,86 @@ declare namespace window { interface Window { /** - * hide window. + * Hide window. + * @throws {BusinessError} 1300002 - If window state is abnormally * @systemapi Hide this for inner system use. * @since 7 */ hide (callback: AsyncCallback): void; /** - * hide window. + * Hide window. + * @throws {BusinessError} 1300002 - If window state is abnormally * @systemapi Hide this for inner system use. * @since 7 */ hide(): Promise; /** - * hide window with animation. + * Hide window with animation. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @throws {BusinessError} 1300004 - If this window can not showWithAnimation * @since 9 * @systemapi */ hideWithAnimation(callback: AsyncCallback): void; /** - * hide window with animation. + * Hide window with animation. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @throws {BusinessError} 1300004 - If this window can not showWithAnimation * @since 9 * @systemapi */ hideWithAnimation(): Promise; /** - * show window. + * Show window. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#showWindow */ show(callback: AsyncCallback): void; /** - * show window. + * Show window. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#showWindow */ show(): Promise; /** - * show window with animation. + * Show window. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + showWindow(callback: AsyncCallback): void; + + /** + * Show window. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + showWindow(): Promise; + + /** + * Show window with animation. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @throws {BusinessError} 1300004 - If this window can not showWithAnimation * @since 9 * @systemapi */ showWithAnimation(callback: AsyncCallback): void; /** - * show window with animation. + * Show window with animation. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @throws {BusinessError} 1300004 - If this window can not showWithAnimation * @since 9 * @systemapi */ @@ -830,21 +973,43 @@ declare namespace window { /** * Destroy the window. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#destroyWindow */ destroy(callback: AsyncCallback): void; /** * Destroy the window. * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#destroyWindow */ destroy(): Promise; + /** + * Destroy the window. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + destroyWindow(callback: AsyncCallback): void; + + /** + * Destroy the window. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + destroyWindow(): Promise; + /** * Set the position of a window. * @param x Indicate the X-coordinate of the window. * @param y Indicate the Y-coordinate of the window. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#moveWindowTo */ moveTo(x: number, y: number): Promise; @@ -854,15 +1019,43 @@ declare namespace window { * @param y Indicate the Y-coordinate of the window. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#moveWindowTo */ moveTo(x: number, y: number, callback: AsyncCallback): void; + /** + * Set the position of a window. + * @param x Indicate the X-coordinate of the window. + * @param y Indicate the Y-coordinate of the window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + moveWindowTo(x: number, y: number): Promise; + + /** + * Set the position of a window. + * @param x Indicate the X-coordinate of the window. + * @param y Indicate the Y-coordinate of the window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + moveWindowTo(x: number, y: number, callback: AsyncCallback): void; + /** * Set the size of a window . * @param width Indicates the width of the window. * @param height Indicates the height of the window. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#resize */ resetSize(width: number, height: number): Promise; @@ -872,9 +1065,35 @@ declare namespace window { * @param height Indicates the height of the window. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#resize */ resetSize(width: number, height: number, callback: AsyncCallback): void; + /** + * Set the size of a window . + * @param width Indicates the width of the window. + * @param height Indicates the height of the window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + resize(width: number, height: number): Promise; + + /** + * Set the size of a window . + * @param width Indicates the width of the window. + * @param height Indicates the height of the window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + resize(width: number, height: number, callback: AsyncCallback): void; + /** * Set the type of a window. * @param type Indicate the type of a window. @@ -896,101 +1115,234 @@ declare namespace window { setWindowType(type: WindowType, callback: AsyncCallback): void; /** - * get the properties of current window + * Set the mode of a window. + * @param mode Indicate the mode of a window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 9 + */ + setWindowMode(mode: WindowMode): Promise; + + /** + * Set the mode of a window. + * @param mode Indicate the mode of a window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 9 + */ + setWindowMode(mode: WindowMode, callback: AsyncCallback): void; + + /** + * Get the properties of current window * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#getWindowProperties */ getProperties(callback: AsyncCallback): void; /** - * get the properties of current window + * Get the properties of current window * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#getWindowProperties */ getProperties(): Promise; /** - * get the avoid area + * Get the properties of current window + * @throws {BusinessError} 1300002 - If window state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + getWindowProperties(): WindowProperties; + + /** + * Get the avoid area * @param type Type of the area * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#getWindowAvoidArea */ getAvoidArea(type: AvoidAreaType, callback: AsyncCallback): void; /** - * get the avoid area + * Get the avoid area * @param type Type of the area * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#getWindowAvoidArea */ getAvoidArea(type: AvoidAreaType): Promise; /** - * set the flag of the window is shown full screen + * Get the avoid area + * @param type Type of the area + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + getWindowAvoidArea(type: AvoidAreaType): AvoidArea; + + /** + * Set the flag of the window is shown full screen * @param isFullScreen the flag of the window is shown full screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowSystemBarEnable */ setFullScreen(isFullScreen: boolean, callback: AsyncCallback): void; /** - * set the flag of the window is shown full screen + * Set the flag of the window is shown full screen * @param isFullScreen the flag of the window is shown full screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowSystemBarEnable */ setFullScreen(isFullScreen: boolean): Promise; /** - * set the property of the window can layout in full screen + * Set the property of the window can layout in full screen * @param isLayoutFullScreen the window can layout in full screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowLayoutFullScreen */ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback): void; /** - * set the property of the window can layout in full screen + * Set the property of the window can layout in full screen * @param isLayoutFullScreen the window can layout in full screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowLayoutFullScreen */ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise; /** - * set the system bar to have visible. + * Set the property of the window can layout in full screen + * @param isLayoutFullScreen the window can layout in full screen + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback): void; + + /** + * Set the property of the window can layout in full screen + * @param isLayoutFullScreen the window can layout in full screen + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise; + + /** + * Set the system bar to have visible. * @param names the set of system bar * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowSystemBarEnable */ setSystemBarEnable(names: Array<'status'|'navigation'>, callback: AsyncCallback): void; /** - * set the system bar to have visible. + * Set the system bar to have visible. * @param names the set of system bar * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowSystemBarEnable */ setSystemBarEnable(names: Array<'status'|'navigation'>): Promise; /** - * set the properties of system bar + * Set the system bar to have visible. + * @param names the set of system bar + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowSystemBarEnable(names: Array<'status'|'navigation'>, callback: AsyncCallback): void; + + /** + * Set the system bar to have visible. + * @param names the set of system bar + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowSystemBarEnable(names: Array<'status'|'navigation'>): Promise; + + /** + * Set the properties of system bar * @param systemBarProperties the properties of system bar * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowSystemBarProperties */ setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback): void; /** - * set the properties of system bar + * Set the properties of system bar * @param systemBarProperties the properties of system bar * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowSystemBarProperties */ setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise; + /** + * Set the properties of system bar + * @param systemBarProperties the properties of system bar + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback): void; + + /** + * Set the properties of system bar + * @param systemBarProperties the properties of system bar + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties): Promise; + /** * Set the preferred orientation config of the window * @param orientation the orientation config of the window * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally * @since 9 */ setPreferredOrientation(orientation: Orientation): Promise; @@ -999,6 +1351,8 @@ declare namespace window { * Set the preferred orientation config of the window * @param orientation the orientation config of the window * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally * @since 9 */ setPreferredOrientation(orientation: Orientation, callback: AsyncCallback): void; @@ -1008,6 +1362,9 @@ declare namespace window { * @param path path Path of the page to which the content will be loaded * @param storage storage The data object shared within the content instance loaded by the window * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally * @since 9 * @StageModelOnly */ @@ -1018,6 +1375,9 @@ declare namespace window { * @param path path of the page to which the content will be loaded * @param storage storage The data object shared within the content instance loaded by the window * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally * @since 9 * @StageModelOnly */ @@ -1028,6 +1388,8 @@ declare namespace window { * @param path path of the page to which the content will be loaded * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setUIContent */ loadContent(path: string, callback: AsyncCallback): void; @@ -1036,13 +1398,39 @@ declare namespace window { * @param path path of the page to which the content will be loaded * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setUIContent */ loadContent(path: string): Promise; + /** + * Loads content + * @param path path of the page to which the content will be loaded + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setUIContent(path: string, callback: AsyncCallback): void; + + /** + * Loads content + * @param path path of the page to which the content will be loaded + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setUIContent(path: string): Promise; + /** * Checks whether the window is displayed * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#isWindowShowing */ isShowing(callback: AsyncCallback): void; @@ -1050,155 +1438,205 @@ declare namespace window { * Checks whether the window is displayed * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#isWindowShowing */ isShowing(): Promise; /** - * register the callback of windowSizeChange + * Checks whether the window is displayed + * @throws {BusinessError} 1300002 - If window state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + isWindowShowing(): boolean; + + /** + * Register the callback of windowSizeChange * @param type: 'windowSizeChange' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 */ on(type: 'windowSizeChange', callback: Callback): void; /** - * unregister the callback of windowSizeChange + * Unregister the callback of windowSizeChange * @param type: 'windowSizeChange' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 */ off(type: 'windowSizeChange', callback?: Callback): void; /** - * register the callback of systemAvoidAreaChange + * Register the callback of systemAvoidAreaChange * @param type: 'systemAvoidAreaChange' * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 - * @deprecated since 9, please use on_avoidAreaChange instead. + * @deprecated since 9 + * @useinstead ohos.window.Window#on_avoidAreaChange */ on(type: 'systemAvoidAreaChange', callback: Callback): void; /** - * unregister the callback of systemAvoidAreaChange + * Unregister the callback of systemAvoidAreaChange * @param type: 'systemAvoidAreaChange' * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 - * @deprecated since 9, please use off_avoidAreaChange instead. + * @deprecated since 9 + * @useinstead ohos.window.Window#off_avoidAreaChange */ off(type: 'systemAvoidAreaChange', callback?: Callback): void; /** - * register the callback of avoidAreaChange + * Register the callback of avoidAreaChange * @param type: 'avoidAreaChange' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ on(type: 'avoidAreaChange', callback: Callback<{ type: AvoidAreaType, area: AvoidArea }>): void; /** - * unregister the callback of avoidAreaChange + * Unregister the callback of avoidAreaChange * @param type: 'avoidAreaChange' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ off(type: 'avoidAreaChange', callback?: Callback<{ type: AvoidAreaType, area: AvoidArea }>): void; /** - * register the callback of keyboardHeightChange + * Register the callback of keyboardHeightChange * @param type: 'keyboardHeightChange' * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @throws {BusinessError} 401 - If param is invalid */ on(type: 'keyboardHeightChange', callback: Callback): void; /** - * unregister the callback of keyboardHeightChange + * Unregister the callback of keyboardHeightChange * @param type: 'keyboardHeightChange' * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @throws {BusinessError} 401 - If param is invalid */ off(type: 'keyboardHeightChange', callback?: Callback): void; /** - * touch outside callback on. + * Touch outside callback on. + * @throws {BusinessError} 401 - If param is invalid * @systemapi Hide this for inner system use. * @since 9 */ on(type: 'touchOutside', callback: Callback): void; /** - * touch outside callback off. + * Touch outside callback off. + * @throws {BusinessError} 401 - If param is invalid * @systemapi Hide this for inner system use. * @since 9 */ off(type: 'touchOutside', callback?: Callback): void; /** - * register the callback of screenshot, only the focused window called back + * Register the callback of screenshot, only the focused window called back * @param type: 'screenshot' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ on(type: 'screenshot', callback: Callback): void; /** - * unregister the callback of screenshot + * Unregister the callback of screenshot * @param type: 'screenshot' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ off(type: 'screenshot', callback?: Callback): void; /** - * register the callback of dialogTargetTouch + * Register the callback of dialogTargetTouch * @param type: 'dialogTargetTouch' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ on(type: 'dialogTargetTouch', callback: Callback): void; /** - * unregister the callback of dialogTargetTouch + * Unregister the callback of dialogTargetTouch * @param type: 'dialogTargetTouch' + * @throws {BusinessError} 401 - If param is invalid * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ off(type: 'dialogTargetTouch', callback?: Callback): void; /** - * bind dialog to the target window. + * Bind dialog to the target window. * @param token token of the target window. * @param deathCallback the callback of dialogDeath. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally * @systemapi Hide this for inner system use. * @since 9 */ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback): Promise; - /** - * bind dialog to the target window. - * @param token token of the target window. - * @param deathCallback the callback of dialogDeath. - * @systemapi Hide this for inner system use. - * @since 9 - */ + /** + * Bind dialog to the target window. + * @param token token of the target window. + * @param deathCallback the callback of dialogDeath. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @systemapi Hide this for inner system use. + * @since 9 + */ bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback, callback: AsyncCallback): void; /** * Whether the window supports thr wide gamut setting. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window.Window#isWindowSupportWideGamut */ isSupportWideGamut(): Promise; /** * Whether the window supports thr wide gamut setting. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window.Window#isWindowSupportWideGamut */ isSupportWideGamut(callback: AsyncCallback): void; + /** + * Whether the window supports thr wide gamut setting. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + isWindowSupportWideGamut(): Promise; + + /** + * Whether the window supports thr wide gamut setting. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + isWindowSupportWideGamut(callback: AsyncCallback): void; + /** * Sets the specified color space. * @param colorSpace the specified color space. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowColorSpace */ setColorSpace(colorSpace:ColorSpace): Promise; @@ -1206,26 +1644,59 @@ declare namespace window { * Sets the specified color space. * @param colorSpace the specified color space. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowColorSpace */ setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback): void; /** - * Obtains thr set color space. + * Sets the specified color space. + * @param colorSpace the specified color space. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + setWindowColorSpace(colorSpace:ColorSpace): Promise; + + /** + * Sets the specified color space. + * @param colorSpace the specified color space. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + setWindowColorSpace(colorSpace:ColorSpace, callback: AsyncCallback): void; + + /** + * Obtains the set color space. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window.Window#getWindowColorSpace */ getColorSpace(): Promise; /** - * Obtains thr set color space. + * Obtains the set color space. * @since 8 + * @deprecated since 9 + * @useinstead ohos.window.Window#getWindowColorSpace */ getColorSpace(callback: AsyncCallback): void; + /** + * Obtains the set color space. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @since 9 + */ + getWindowColorSpace(): ColorSpace; + /** * Sets the background color of window. * @param color the specified color. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowBackgroundColor */ setBackgroundColor(color: string): Promise; @@ -1234,14 +1705,28 @@ declare namespace window { * @param color the specified color. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowBackgroundColor */ setBackgroundColor(color: string, callback: AsyncCallback): void; + /** + * Sets the background color of window. + * @param color the specified color. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowBackgroundColor(color: string): void; + /** * Sets the brightness of window. * @param brightness the specified brightness value. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowBrightness */ setBrightness(brightness: number): Promise; @@ -1250,9 +1735,33 @@ declare namespace window { * @param brightness the specified brightness value. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowBrightness */ setBrightness(brightness: number, callback: AsyncCallback): void; + /** + * Sets the brightness of window. + * @param brightness the specified brightness value. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowBrightness(brightness: number): Promise; + + /** + * Sets the brightness of window. + * @param brightness the specified brightness value. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowBrightness(brightness: number, callback: AsyncCallback): void; + /** * Sets the dimBehind of window. * @param dimBehindValue the specified dimBehind. @@ -1276,6 +1785,8 @@ declare namespace window { * @param isFocusable can be focus if true, or can not be focus if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowFocusable */ setFocusable(isFocusable: boolean): Promise; @@ -1284,14 +1795,40 @@ declare namespace window { * @param isFocusable can be focus if true, or can not be focus if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowFocusable */ setFocusable(isFocusable: boolean, callback: AsyncCallback): void; + /** + * Sets whether focusable or not. + * @param isFocusable can be focus if true, or can not be focus if false. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowFocusable(isFocusable: boolean): Promise; + + /** + * Sets whether focusable or not. + * @param isFocusable can be focus if true, or can not be focus if false. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @since 9 + */ + setWindowFocusable(isFocusable: boolean, callback: AsyncCallback): void; + /** * Sets whether keep screen on or not. * @param isKeepScreenOn keep screen on if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowKeepScreenOn */ setKeepScreenOn(isKeepScreenOn: boolean): Promise; @@ -1300,12 +1837,39 @@ declare namespace window { * @param isKeepScreenOn keep screen on if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 6 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowKeepScreenOn */ setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback): void; + /** + * Sets whether keep screen on or not. + * @param isKeepScreenOn keep screen on if true, or not if false. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise; + + /** + * Sets whether keep screen on or not. + * @param isKeepScreenOn keep screen on if true, or not if false. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback): void; + /** * Sets whether to wake up the screen when this ability is restored. * @param wakeUp Specifies whether to wake up the screen. True means to wake it up, false means not. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. * @since 9 @@ -1335,6 +1899,8 @@ declare namespace window { * @param isPrivacyMode in private mode if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowPrivacyMode */ setPrivacyMode(isPrivacyMode: boolean): Promise; @@ -1343,12 +1909,40 @@ declare namespace window { * @param isPrivacyMode in private mode if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowPrivacyMode */ setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; + /** + * Sets whether is private mode or not. + * @param isPrivacyMode in private mode if true, or not if false. + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @permission ohos.permission.PRIVACE_WINDOW + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowPrivacyMode(isPrivacyMode: boolean): Promise; + + /** + * Sets whether is private mode or not. + * @param isPrivacyMode in private mode if true, or not if false. + * @throws {BusinessError} 201 - If there is no permission + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @permission ohos.permission.PRIVACE_WINDOW + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; + /** * Ignore this window during screenshot. * @param isSkip skip if true, or not if false. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. * @since 9 @@ -1360,6 +1954,8 @@ declare namespace window { * @param isTouchable is touchable if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowTouchable */ setTouchable(isTouchable: boolean): Promise; @@ -1368,12 +1964,39 @@ declare namespace window { * @param isTouchable is touchable if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.window.Window#setWindowTouchable */ setTouchable(isTouchable: boolean, callback: AsyncCallback): void; /** - * set the flag of the window is forbidden to move in split screen mode + * Sets whether is touchable or not. + * @param isTouchable is touchable if true, or not if false. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowTouchable(isTouchable: boolean): Promise; + + /** + * Sets whether is touchable or not. + * @param isTouchable is touchable if true, or not if false. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + setWindowTouchable(isTouchable: boolean, callback: AsyncCallback): void; + + /** + * Sets the flag of the window is forbidden to move in split screen mode * @param isForbidSplitMove the flag of the window is forbidden to move in split screen mode + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi * @since 9 @@ -1381,8 +2004,11 @@ declare namespace window { setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback): void; /** - * set the flag of the window is forbidden to move in split screen mode + * Sets the flag of the window is forbidden to move in split screen mode * @param isForbidSplitMove the flag of the window is forbidden to move in split screen mode + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300003 - If system state is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi * @since 9 @@ -1391,6 +2017,7 @@ declare namespace window { /** * Obtains snapshot of window + * @throws {BusinessError} 1300002 - If window state is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ @@ -1398,13 +2025,17 @@ declare namespace window { /** * Obtains snapshot of window + * @throws {BusinessError} 1300002 - If window state is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ snapshot(): Promise; - /* * Sets opacity of window + /** Sets opacity of window * @param opacity Interval is 0.f-1.f. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not opacity * @systemapi * @since 9 */ @@ -1413,6 +2044,9 @@ declare namespace window { /** * Sets scale options of window. * @param scaleOptions scale param of window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not scale * @systemapi * @since 9 */ @@ -1421,6 +2055,9 @@ declare namespace window { /** * Sets rotate options of window. * @param rotateOptions rotate param of window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not rotate * @systemapi * @since 9 */ @@ -1429,6 +2066,9 @@ declare namespace window { /** * Sets translate options of window. * @param translateOptions translate param of window. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not translate * @systemapi * @since 9 */ @@ -1436,6 +2076,8 @@ declare namespace window { /** * Get Transition Controller. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not getTransitionController * @systemapi * @since 9 */ @@ -1444,6 +2086,9 @@ declare namespace window { /** * Sets the window blur radius. * @param radius the blur radius. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not setBlur * @systemapi Hide this for inner system use. * @since 9 */ @@ -1452,6 +2097,9 @@ declare namespace window { /** * Sets the window backdrop blur radius. * @param radius the blur radius. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not setBackdropBlur * @systemapi Hide this for inner system use. * @since 9 */ @@ -1460,6 +2108,9 @@ declare namespace window { /** * Sets the window backdrop blur style. * @param blurStyle the specified blur style. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not setBackdropBlurStyle * @systemapi Hide this for inner system use. * @since 9 */ @@ -1471,6 +2122,9 @@ declare namespace window { * @param color the color of the shadow. * @param offsetX the offset of the shadow on the x-axis. * @param offsetY the offset of the shadow on the y-axis. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not setShadow * @systemapi Hide this for inner system use. * @since 9 */ @@ -1479,13 +2133,16 @@ declare namespace window { /** * Sets corner radius. * @param cornerRadius the corner radius. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300004 - If this window can not setCornerRadius * @systemapi Hide this for inner system use. * @since 9 */ setCornerRadius(cornerRadius: number): void; } /** - * window stage callback event type + * Window stage callback event type * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 * @StageModelOnly @@ -1504,19 +2161,34 @@ declare namespace window { interface WindowStage { /** * Get main window of the stage. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ getMainWindow(): Promise; /** * Get main window of the stage. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ getMainWindow(callback: AsyncCallback): void; + /** + * Get main window of the stage. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally + * @since 9 + * @StageModelOnly + */ + getMainWindowSync(): Window; /** * Create sub window of the stage. * @param name window name of sub window + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ @@ -1524,18 +2196,23 @@ declare namespace window { /** * Create sub window of the stage. * @param name window name of sub window + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ createSubWindow(name: string, callback: AsyncCallback): void; /** * Get sub window of the stage. + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ getSubWindow(): Promise>; /** * Get sub window of the stage. + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ @@ -1544,6 +2221,9 @@ declare namespace window { * Loads content * @param path path Path of the page to which the content will be loaded * @param storage storage The data object shared within the content instance loaded by the window + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 * @StageModelOnly @@ -1553,6 +2233,9 @@ declare namespace window { * Loads content * @param path path of the page to which the content will be loaded * @param storage storage The data object shared within the content instance loaded by the window + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 * @StageModelOnly @@ -1561,26 +2244,37 @@ declare namespace window { /** * Loads content * @param path path of the page to which the content will be loaded + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 * @StageModelOnly */ loadContent(path: string, callback: AsyncCallback): void; /** - * window stage event callback on. + * Window stage event callback on. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ on(eventType: 'windowStageEvent', callback: Callback): void; /** - * window stage event callback off. + * Window stage event callback off. + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @since 9 * @StageModelOnly */ off(eventType: 'windowStageEvent', callback?: Callback): void; /** - * disable window decoration. It must be called before loadContent. + * Disable window decoration. It must be called before loadContent. + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @systemapi * @since 9 * @StageModelOnly @@ -1590,6 +2284,9 @@ declare namespace window { /** * Sets whether can show on lock screen or not * @param showOnLockScreen can show on lock screen if true, or not if false + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 1300002 - If window state is abnormally + * @throws {BusinessError} 1300005 - If window stage is abnormally * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. * @since 9 -- Gitee From 4a65f28e3cd3987ef32189b55252a30d2484789d Mon Sep 17 00:00:00 2001 From: leafly2021 Date: Tue, 2 Aug 2022 20:09:16 +0800 Subject: [PATCH 2/2] fixed 2c3917a from https://gitee.com/leafly2021/interface_sdk-js/pulls/2344 add setDimBehind api throws Signed-off-by: leafly2021 Change-Id: Ieeae6014a706633edbda96a8a78e3cf62b1554b5 --- api/@ohos.window.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 1ea88ecd65..d1b53be561 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1766,6 +1766,7 @@ declare namespace window { * Sets the dimBehind of window. * @param dimBehindValue the specified dimBehind. * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws Throws an exception cause this device do not support * @since 7 * @deprecated since 9 */ @@ -1775,6 +1776,7 @@ declare namespace window { * Sets the dimBehind of window. * @param dimBehind the specified dimBehind. * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws Throws an exception cause this device do not support * @since 7 * @deprecated since 9 */ @@ -1880,6 +1882,7 @@ declare namespace window { * Sets whether outside can be touch or not. * @param touchable outside can be touch if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws Throws an exception cause this device do not support * @since 7 * @deprecated since 9 */ @@ -1889,6 +1892,7 @@ declare namespace window { * Sets whether outside can be touch or not. * @param touchable outside can be touch if true, or not if false. * @syscap SystemCapability.WindowManager.WindowManager.Core + * @throws Throws an exception cause this device do not support * @since 7 * @deprecated since 9 */ -- Gitee