From e660de91c504fb64997bb11853894f6a0310f3f2 Mon Sep 17 00:00:00 2001 From: hfwang0318 Date: Wed, 10 Sep 2025 11:53:32 +0800 Subject: [PATCH 1/8] add api Signed-off-by: hfwang0318 --- api/@ohos.window.d.ts | 128 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 6dc429c950..cd5217b282 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 + */ + interface FrameMetrics { + /** + * Indicates whether the first frame of the window. + * + * @type { boolean } + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + firstDrawFrame: boolean; + + /** + * Indicates the number of nanoseconds elapsed in the input handling stage of a frame. + * + * @type { boolean } + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + inputHandlingDuration: number; + + /** + * Indicates the number of nanoseconds elapsed in the layout measure stage of a frame. + * + * @type { boolean } + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + layoutMeasureDuration: number; + + /** + * Indicates the timestamp of the actual vsync for this frame. + * + * @type { boolean } + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + vsyncTimestamp: number; + } + /** * Rectangle * @@ -2978,6 +3023,39 @@ declare namespace window { DRAG_END = 6, } + /** + * Window occlusion state. + * + * @enum { number } + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + enum OcclusionState { + /** + * Window totally occlusion. + * + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + TOTALLY_OCCLUSION = 0, + + /** + * Window partically occlusion. + * + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + PARTICALLY_OCCLUSION = 1, + + /** + * Window no occlusion. + * + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + NO_OCCLUSION = 2 + } + /** * Main window info * @@ -3948,6 +4026,56 @@ declare namespace window { */ function off(type: 'waterMarkFlagChange', 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 + */ + function on(type: 'frameMetricsMeasured', 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. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + function on(type: 'occlusionStateChanged', 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. + * @throws { BusinessError } 1300003 - This window manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + function off(type: 'occlusionStateChanged', callback?: Callback): void; + + /** + * Register the callback for occlusion state changed. + * + * @param { 'frameMetricsMeasured' } 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. + * @syscap SystemCapability.Window.SessionManager + * @since 22 + */ + function on(type: 'frameMetricsMeasured', callback: Callback): void; + /** * Sets starting window background color * -- Gitee From 71ae09260e727c1fa286d0e6b342f01d5ae7d3d1 Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Thu, 11 Sep 2025 15:41:25 +0800 Subject: [PATCH 2/8] add api Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index cd5217b282..c89db0ee31 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -4039,42 +4039,42 @@ declare namespace window { function on(type: 'frameMetricsMeasured', callback: Callback): void; /** - * Register the callback for frame metrics measured. + * Unregister the callback for frame metrics measured. * - * @param { 'frameMetricsMeasured' } type - The event of frame metrics measured. + * @param { 'frameMetricsMeasured' } type - The event of occlusion state changed. * @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. - * @throws { BusinessError } 1300003 - This window manager service works abnormally. * @syscap SystemCapability.Window.SessionManager * @since 22 */ - function on(type: 'occlusionStateChanged', callback: Callback): void; + function off(type: 'frameMetricsMeasured', callback?: Callback): void; /** - * Register the callback for frame metrics measured. + * Register the callback for occlusion state changed. * - * @param { 'frameMetricsMeasured' } type - The event of frame metrics measured. - * @param { Callback } [callback] - Callback used to return the result of frame metrics. + * @param { 'occlusionStateChanged' } type - The event of frame metrics measured. + * @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 */ - function off(type: 'occlusionStateChanged', callback?: Callback): void; + function on(type: 'occlusionStateChanged', callback: Callback): void; /** - * Register the callback for occlusion state changed. + * Unregister the callback for occlusion state changed. * - * @param { 'frameMetricsMeasured' } type - The event of occlusion state changed. - * @param { Callback } callback - Callback used to return the result of occlusion state. + * @param { 'occlusionStateChanged' } type - The event of frame metrics measured. + * @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 */ - function on(type: 'frameMetricsMeasured', callback: Callback): void; + function off(type: 'occlusionStateChanged', callback?: Callback): void; /** * Sets starting window background color -- Gitee From 8631ace2ec293b9b5aee4bc6094ccac1be17f099 Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Thu, 11 Sep 2025 16:30:28 +0800 Subject: [PATCH 3/8] add api Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index c89db0ee31..525c26f72e 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1130,7 +1130,7 @@ declare namespace window { /** * Indicates the number of nanoseconds elapsed in the input handling stage of a frame. * - * @type { boolean } + * @type { number } * @syscap SystemCapability.Window.SessionManager * @since 22 */ @@ -1139,7 +1139,7 @@ declare namespace window { /** * Indicates the number of nanoseconds elapsed in the layout measure stage of a frame. * - * @type { boolean } + * @type { number } * @syscap SystemCapability.Window.SessionManager * @since 22 */ @@ -1148,7 +1148,7 @@ declare namespace window { /** * Indicates the timestamp of the actual vsync for this frame. * - * @type { boolean } + * @type { number } * @syscap SystemCapability.Window.SessionManager * @since 22 */ -- Gitee From 29b8701638148ba3ef5913853b63f8517b7612c4 Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Mon, 22 Sep 2025 17:22:51 +0800 Subject: [PATCH 4/8] add api Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 90 +++++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 20 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 525c26f72e..8d548b7427 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1115,7 +1115,7 @@ declare namespace window { * * @interface FrameMetrics * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ interface FrameMetrics { /** @@ -1123,7 +1123,7 @@ declare namespace window { * * @type { boolean } * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ firstDrawFrame: boolean; @@ -1132,7 +1132,7 @@ declare namespace window { * * @type { number } * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ inputHandlingDuration: number; @@ -1141,7 +1141,7 @@ declare namespace window { * * @type { number } * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ layoutMeasureDuration: number; @@ -1150,7 +1150,7 @@ declare namespace window { * * @type { number } * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ vsyncTimestamp: number; } @@ -3028,32 +3028,32 @@ declare namespace window { * * @enum { number } * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ enum OcclusionState { /** - * Window totally occlusion. + * Window no occlusion. * * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ - TOTALLY_OCCLUSION = 0, + NO_OCCLUSION = 0, /** * Window partically occlusion. * * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ PARTICALLY_OCCLUSION = 1, /** - * Window no occlusion. + * Window totally occlusion. * * @syscap SystemCapability.Window.SessionManager - * @since 22 + * @since 22 dynamic&static */ - NO_OCCLUSION = 2 + TOTALLY_OCCLUSION = 2 } /** @@ -4034,48 +4034,98 @@ declare namespace window { * @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 + * @since 22 dynamic */ function 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 + */ + function onFrameMetricsMeasured(callback: Callback): void; + /** * Unregister the callback for frame metrics measured. * - * @param { 'frameMetricsMeasured' } type - The event of occlusion state changed. + * @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 + * @since 22 dynamic */ function 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 + */ + function offFrameMetricsMeasured(callback?: Callback): void; + /** * Register the callback for occlusion state changed. * - * @param { 'occlusionStateChanged' } type - The event of frame metrics measured. + * @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 + * @since 22 dynamic */ function 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 + */ + function onOcclusionStateChanged(callback: Callback): void; + /** * Unregister the callback for occlusion state changed. * - * @param { 'occlusionStateChanged' } type - The event of frame metrics measured. + * @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 + * @since 22 dynamic */ function 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 + */ + function offOcclusionStateChanged(callback?: Callback): void; + /** * Sets starting window background color * -- Gitee From 4220c43d2ce594a8bc141fdaa720fc56f26caae9 Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Mon, 22 Sep 2025 19:25:59 +0800 Subject: [PATCH 5/8] modify number type Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 8d548b7427..734264c91a 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1130,29 +1130,29 @@ declare namespace window { /** * Indicates the number of nanoseconds elapsed in the input handling stage of a frame. * - * @type { number } + * @type { long } * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - inputHandlingDuration: number; + inputHandlingDuration: long; /** * Indicates the number of nanoseconds elapsed in the layout measure stage of a frame. * - * @type { number } + * @type { long } * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - layoutMeasureDuration: number; + layoutMeasureDuration: long; /** * Indicates the timestamp of the actual vsync for this frame. * - * @type { number } + * @type { long } * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - vsyncTimestamp: number; + vsyncTimestamp: long; } /** -- Gitee From cffd96e64e07010312e6c11546e0ef9902eaeae3 Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Tue, 23 Sep 2025 17:36:25 +0800 Subject: [PATCH 6/8] modify api Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 205 +++++++++++++++++++++--------------------- 1 file changed, 102 insertions(+), 103 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 734264c91a..e66ddc1700 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -3040,12 +3040,12 @@ declare namespace window { NO_OCCLUSION = 0, /** - * Window partically occlusion. + * Window partially occlusion. * * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - PARTICALLY_OCCLUSION = 1, + PARTIALLY_OCCLUSION = 1, /** * Window totally occlusion. @@ -4026,106 +4026,6 @@ declare namespace window { */ function off(type: 'waterMarkFlagChange', 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 - */ - function 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 - */ - function 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 - */ - function 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 - */ - function 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 - */ - function 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 - */ - function 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 - */ - function 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 - */ - function offOcclusionStateChanged(callback?: Callback): void; - /** * Sets starting window background color * @@ -10879,7 +10779,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. -- Gitee From baf9b79051607b977232dbe6e1b28ebccf74772f Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Fri, 26 Sep 2025 14:41:37 +0800 Subject: [PATCH 7/8] modify api Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index e66ddc1700..498b5fdd72 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -3040,20 +3040,20 @@ declare namespace window { NO_OCCLUSION = 0, /** - * Window partially occlusion. + * Window partial occlusion. * * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - PARTIALLY_OCCLUSION = 1, + PARTIAL_OCCLUSION = 1, /** - * Window totally occlusion. + * Window total occlusion. * * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - TOTALLY_OCCLUSION = 2 + TOTAL_OCCLUSION = 2 } /** -- Gitee From 3059f3ff685579c8cd7a8db15299db536effd633 Mon Sep 17 00:00:00 2001 From: nyankomiya Date: Sun, 28 Sep 2025 19:41:18 +0800 Subject: [PATCH 8/8] modify desc Signed-off-by: nyankomiya --- api/@ohos.window.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 498b5fdd72..8b204d8a5a 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -1146,7 +1146,7 @@ declare namespace window { layoutMeasureDuration: long; /** - * Indicates the timestamp of the actual vsync for this frame. + * Indicates the timestamp of the actual vsync for this frame. The value is expressed in nanoseconds. * * @type { long } * @syscap SystemCapability.Window.SessionManager @@ -3025,6 +3025,8 @@ declare namespace window { /** * 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 @@ -3032,7 +3034,7 @@ declare namespace window { */ enum OcclusionState { /** - * Window no occlusion. + * The window is fully visible. * * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static @@ -3040,7 +3042,7 @@ declare namespace window { NO_OCCLUSION = 0, /** - * Window partial occlusion. + * The window is partially occluded. * * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static @@ -3048,12 +3050,12 @@ declare namespace window { PARTIAL_OCCLUSION = 1, /** - * Window total occlusion. + * The window is fully occluded. * * @syscap SystemCapability.Window.SessionManager * @since 22 dynamic&static */ - TOTAL_OCCLUSION = 2 + FULL_OCCLUSION = 2 } /** -- Gitee