From b5e65926c162e2fbef74decd68c7be86da37cb3f Mon Sep 17 00:00:00 2001 From: realice Date: Mon, 18 Jul 2022 17:23:19 +0800 Subject: [PATCH 1/2] 1. virtual screen intf 2. snapshot intf Signed-off-by: realice Change-Id: I25eabcc55dd6481c051d8baf3ea5ec2c5e1b8448 --- api/@ohos.screen.d.ts | 71 +++++++++++++++++++++++++++++++++++++++ api/@ohos.screenshot.d.ts | 27 ++++++++++++++- 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/api/@ohos.screen.d.ts b/api/@ohos.screen.d.ts index cb4b192512..0659f0f9d0 100644 --- a/api/@ohos.screen.d.ts +++ b/api/@ohos.screen.d.ts @@ -43,6 +43,20 @@ declare namespace screen { */ function off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback): void; + /** + * Register the callback for virtual screen operations. + * @param eventType: 'virtualScreenAction' + * @since 9 + */ + function on(eventType: 'virtualScreenAction', callback: Callback): void; + + /** + * Unregister the callback for virtual screen operations + * @param eventType: 'virtualScreenAction' + * @since 9 + */ + function off(eventType: 'virtualScreenAction', callback?: Callback): void; + /** * make screens as expand-screen * @since 9 @@ -66,6 +80,14 @@ declare namespace screen { function createVirtualScreen(options:VirtualScreenOption, callback: AsyncCallback): void; function createVirtualScreen(options:VirtualScreenOption): Promise; + /** + * Remove virtual screen + * @param screenId Indicates the screen id of the virtual screen. + * @since 9 + */ + function removeVirtualScreen(screenId:number, callback: AsyncCallback): void; + function removeVirtualScreen(screenId:number): Promise; + /** * Destroy virtual screen. * @param screenId Indicates the screen id of the virtual screen. @@ -230,6 +252,55 @@ declare namespace screen { height: number; refreshRate: number; } + + /** + * The virtual screen operations + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + enum VirtualScreenAction { + /** + * When createVirtualScreen called + */ + CREATE, + /** + * When makeExpand called + */ + EXPAND_MAKE, + /** + * When removeVirtualScreen called on the expand screen + */ + EXPAND_REMOVE, + /** + * When destroyVirtualScreen called on the expand screen + */ + EXPAND_DESTORY, + /** + * When makeMirror called + */ + MIRROR_MAKE, + /** + * When removeVirtualScreen called on the mirror screen + */ + MIRROR_REMOVE, + /** + * When destroyVirtualScreen called on the mirror screen + */ + MIRROR_DESTORY + } + + /** + * The callback paramters of virtual screen action + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + interface VirtualScreenActionCallbackParam { + action: VirtualScreenAction; + /** + * Package name of action trigger + */ + packageName: string; + } } export default screen; diff --git a/api/@ohos.screenshot.d.ts b/api/@ohos.screenshot.d.ts index 4928ee300f..021ccf226f 100644 --- a/api/@ohos.screenshot.d.ts +++ b/api/@ohos.screenshot.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { AsyncCallback, ErrorCallback } from './basic'; +import { AsyncCallback, Callback, ErrorCallback } from './basic'; import image from './@ohos.multimedia.image'; /** @@ -39,6 +39,20 @@ declare namespace screenshot { */ function save(options?: ScreenshotOptions): Promise; + /** + * Register the callback of save, can be used in a module different with 'save' + * @param type: 'screenshotEvent' + * @since 9 + */ + function on(type: 'screenshotEvent', callback: Callback): void; + + /** + * Unregister the callback of save, can be used in a module different with 'save' + * @param type: 'screenshotEvent' + * @since 9 + */ + function off(type: 'screenshotEvent', callback?: Callback): void; + /** * Describes the region of the screen to capture. * @since 7 @@ -82,6 +96,17 @@ declare namespace screenshot { */ displayId?: number; } + + /** + * Describes screenshot callback parameters. + * @since 9 + */ + interface ScreenshotCallbackParam { + /** + * Package name of the caller of 'save' + */ + packageName: string; + } } export default screenshot; -- Gitee From 98f169099c683345a50c8d7b63fee1dcb2705a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=86=B0?= Date: Wed, 27 Jul 2022 08:33:52 +0000 Subject: [PATCH 2/2] update api/@ohos.screenshot.d.ts. --- api/@ohos.screenshot.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.screenshot.d.ts b/api/@ohos.screenshot.d.ts index 021ccf226f..6d640bf4ac 100644 --- a/api/@ohos.screenshot.d.ts +++ b/api/@ohos.screenshot.d.ts @@ -41,17 +41,17 @@ declare namespace screenshot { /** * Register the callback of save, can be used in a module different with 'save' - * @param type: 'screenshotEvent' + * @param type: 'screenshot' * @since 9 */ - function on(type: 'screenshotEvent', callback: Callback): void; + function on(type: 'screenshot', callback: Callback): void; /** * Unregister the callback of save, can be used in a module different with 'save' - * @param type: 'screenshotEvent' + * @param type: 'screenshot' * @since 9 */ - function off(type: 'screenshotEvent', callback?: Callback): void; + function off(type: 'screenshot', callback?: Callback): void; /** * Describes the region of the screen to capture. -- Gitee