diff --git a/api/@ohos.screen.d.ts b/api/@ohos.screen.d.ts index cb4b192512a11228181ca86b4bb771c4f3056852..0659f0f9d080e15caaefc2c9d31350993f4efe1c 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 4928ee300f4532989b7680ed5f546d9cff8e3743..6d640bf4ac4de34ae212df16d03c8dd53a2f68d2 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: 'screenshot' + * @since 9 + */ + function on(type: 'screenshot', callback: Callback): void; + + /** + * Unregister the callback of save, can be used in a module different with 'save' + * @param type: 'screenshot' + * @since 9 + */ + function off(type: 'screenshot', 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;