diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 6dc429c950a5b0585cf8a3b7b7261cdb4a5f0115..8b204d8a5a38133b5d524974f1b0d2bbdc7c88a7 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1110,6 +1110,51 @@ declare namespace window { regionTint: Array; } + /** + * Frame metrics + * + * @interface FrameMetrics + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + interface FrameMetrics { + /** + * Indicates whether the first frame of the window. + * + * @type { boolean } + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + firstDrawFrame: boolean; + + /** + * Indicates the number of nanoseconds elapsed in the input handling stage of a frame. + * + * @type { long } + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + inputHandlingDuration: long; + + /** + * Indicates the number of nanoseconds elapsed in the layout measure stage of a frame. + * + * @type { long } + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + layoutMeasureDuration: long; + + /** + * Indicates the timestamp of the actual vsync for this frame. The value is expressed in nanoseconds. + * + * @type { long } + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + vsyncTimestamp: long; + } + /** * Rectangle * @@ -2978,6 +3023,41 @@ declare namespace window { DRAG_END = 6, } + /** + * Window occlusion state. + * Note: The alpha channel value is included in visibility computation. When a window is covered by another window + * with alpha < 1, it is not considered occluded, and its occlusion state is reported as fully visible. + * + * @enum { number } + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + enum OcclusionState { + /** + * The window is fully visible. + * + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + NO_OCCLUSION = 0, + + /** + * The window is partially occluded. + * + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + PARTIAL_OCCLUSION = 1, + + /** + * The window is fully occluded. + * + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic&static + */ + FULL_OCCLUSION = 2 + } + /** * Main window info * @@ -10701,7 +10781,106 @@ declare namespace window { * @since 20 */ off(eventType: 'uiExtensionSecureLimitChange', callback?: Callback): void; - + + /** + * Register the callback for frame metrics measured. + * + * @param { 'frameMetricsMeasured' } type - The event of frame metrics measured. + * @param { Callback } callback - Callback used to return the result of frame metrics. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic + */ + on(type: 'frameMetricsMeasured', callback: Callback): void; + + /** + * Register the callback for frame metrics measured. + * + * @param { Callback } callback - Callback used to return the result of frame metrics. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @since 22 static + */ + onFrameMetricsMeasured(callback: Callback): void; + + /** + * Unregister the callback for frame metrics measured. + * + * @param { 'frameMetricsMeasured' } type - The event of frame metrics measured. + * @param { Callback } [callback] - Callback used to return the result of frame metrics. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic + */ + off(type: 'frameMetricsMeasured', callback?: Callback): void; + + /** + * Unregister the callback for frame metrics measured. + * + * @param { Callback } [callback] - Callback used to return the result of frame metrics. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @syscap SystemCapability.Window.SessionManager + * @since 22 static + */ + offFrameMetricsMeasured(callback?: Callback): void; + + /** + * Register the callback for occlusion state changed. + * + * @param { 'occlusionStateChanged' } type - The event of occlusion state changed. + * @param { Callback } callback - Callback used to return the result of occlusion state. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic + */ + on(type: 'occlusionStateChanged', callback: Callback): void; + + /** + * Register the callback for occlusion state changed. + * + * @param { Callback } callback - Callback used to return the result of occlusion state. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 22 static + */ + onOcclusionStateChanged(callback: Callback): void; + + /** + * Unregister the callback for occlusion state changed. + * + * @param { 'occlusionStateChanged' } type - The event of occlusion state changed. + * @param { Callback } [callback] - Callback used to return the result of occlusion state. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 22 dynamic + */ + off(type: 'occlusionStateChanged', callback?: Callback): void; + + /** + * Unregister the callback for occlusion state changed. + * + * @param { Callback } [callback] - Callback used to return the result of occlusion state. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 22 static + */ + offOcclusionStateChanged(callback?: Callback): void; /** * Set gray scale of window.