diff --git a/api/@ohos.display.d.ts b/api/@ohos.display.d.ts index 4bca98243713d01435f1554786247e4480a71cf1..b54e08405df347cd146652008cf84d21b33e6290 100644 --- a/api/@ohos.display.d.ts +++ b/api/@ohos.display.d.ts @@ -251,9 +251,42 @@ declare namespace display { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function on(type: 'add' | 'remove' | 'change', callback: Callback): void; + + /** + * Register the callback for display changes. + * + * @param { Callback } callback the display id of changed + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 22 static + */ + function onAdd(callback: Callback): void; + + /** + * Register the callback for display changes. + * + * @param { Callback } callback the display id of changed + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 22 static + */ + function onRemove(callback: Callback): void; + + /** + * Register the callback for display changes. + * + * @param { Callback } callback the display id of changed + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 22 static + */ + function onChange(callback: Callback): void; /** * Unregister the callback for display changes. @@ -286,9 +319,43 @@ declare namespace display { * @syscap SystemCapability.WindowManager.WindowManager.Core * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function off(type: 'add' | 'remove' | 'change', callback?: Callback): void; + + /** + * Unregister the callback for display changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 22 static + */ + function offAdd(callback?: Callback): void; + + /** + * Unregister the callback for display changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @crossplatform + * @atomicservice + * @since 22 static + */ + function offRemove(callback?: Callback): void; + + /** + * Unregister the callback for display changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @crossplatform + * @atomicservice + * @since 22 static + */ + function offChange(callback?: Callback): void; /** * Register the callback for private mode changes. @@ -300,10 +367,20 @@ declare namespace display { *
2. Incorrect parameter types. * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. - * @since 10 dynamic - * @since 20 static + * @since 10 dynamic */ function on(type: 'privateModeChange', callback: Callback): void; + + /** + * Register the callback for private mode changes. + * + * @param { Callback } callback Callback used to return the result whether display is on private mode or not + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function onPrivateModeChange(callback: Callback): void; /** * Unregister the callback for private mode changes. @@ -315,11 +392,22 @@ declare namespace display { *
2. Incorrect parameter types. * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. - * @since 10 dynamic - * @since 20 static + * @since 10 dynamic */ function off(type: 'privateModeChange', callback?: Callback): void; + /** + * Unregister the callback for private mode changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function offPrivateModeChange(callback?: Callback): void; + /** * Check whether the device is foldable. * @@ -412,9 +500,21 @@ declare namespace display { * @syscap SystemCapability.Window.SessionManager * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function on(type: 'foldStatusChange', callback: Callback): void; + + /** + * Register the callback for fold status changes. + * + * @param { Callback } callback Callback used to return the current fold status of device + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @crossplatform + * @atomicservice + * @since 22 static + */ + function onFoldStatusChange(callback: Callback): void; /** * Unregister the callback for fold status changes. @@ -450,9 +550,22 @@ declare namespace display { * @syscap SystemCapability.Window.SessionManager * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function off(type: 'foldStatusChange', callback?: Callback): void; + + /** + * Unregister the callback for fold status changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @crossplatform + * @atomicservice + * @since 22 static + */ + function offFoldStatusChange(callback?: Callback): void; /** * Register the callback for fold angle changes. @@ -477,10 +590,22 @@ declare namespace display { * @syscap SystemCapability.Window.SessionManager * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function on(type: 'foldAngleChange', callback: Callback>): void; + /** + * Register the callback for fold angle changes. + * + * @param { Callback> } callback Callback used to return the current fold angle of device. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @crossplatform + * @atomicservice + * @since 22 static + */ + function onFoldAngleChange(callback: Callback>): void; + /** * Unregister the callback for fold angle changes. * @@ -504,10 +629,23 @@ declare namespace display { * @syscap SystemCapability.Window.SessionManager * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function off(type: 'foldAngleChange', callback?: Callback>): void; + /** + * Unregister the callback for fold angle changes. + * + * @param { Callback> } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @crossplatform + * @atomicservice + * @since 22 static + */ + function offFoldAngleChange(callback?: Callback>): void; + /** * Register the callback for device capture, casting, or recording status changes. * @@ -518,10 +656,20 @@ declare namespace display { * @throws { BusinessError } 1400003 - This display manager service works abnormally. * @syscap SystemCapability.Window.SessionManager * @atomicservice - * @since 12 dynamic - * @since 20 static + * @since 12 dynamic */ function on(type: 'captureStatusChange', callback: Callback): void; + + /** + * Register the callback for device capture, casting, or recording status changes. + * + * @param { Callback } callback Callback used to return the device capture, casting, or recording status. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + function onCaptureStatusChange(callback: Callback): void; /** * Unregister the callback for device capture, casting, or recording status changes. @@ -533,11 +681,21 @@ declare namespace display { * @throws { BusinessError } 1400003 - This display manager service works abnormally. * @syscap SystemCapability.Window.SessionManager * @atomicservice - * @since 12 dynamic - * @since 20 static + * @since 12 dynamic */ function off(type: 'captureStatusChange', callback?: Callback): void; + /** + * Unregister the callback for device capture, casting, or recording status changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + function offCaptureStatusChange(callback?: Callback): void; /** * Check whether the device is captured, projected, or recorded. @@ -643,10 +801,22 @@ declare namespace display { * @syscap SystemCapability.Window.SessionManager * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function on(type: 'foldDisplayModeChange', callback: Callback): void; + /** + * Register the callback for fold display mode changes. + * + * @param { Callback } callback Callback used to return the current fold display mode + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @crossplatform + * @atomicservice + * @since 22 static + */ + function onFoldDisplayModeChange(callback: Callback): void; + /** * Unregister the callback for fold display mode changes. * @@ -681,9 +851,22 @@ declare namespace display { * @syscap SystemCapability.Window.SessionManager * @crossplatform * @atomicservice - * @since 20 dynamic&static + * @since 20 dynamic */ function off(type: 'foldDisplayModeChange', callback?: Callback): void; + + /** + * Unregister the callback for fold display mode changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @crossplatform + * @atomicservice + * @since 22 static + */ + function offFoldDisplayModeChange(callback?: Callback): void; /** * Get the fold crease region in the current display mode. @@ -2388,10 +2571,21 @@ declare namespace display { * @throws { BusinessError } 1400003 - This display manager service works abnormally. * @syscap SystemCapability.Window.SessionManager * @atomicservice - * @since 12 dynamic - * @since 20 static + * @since 12 dynamic */ on(type: 'availableAreaChange', callback: Callback): void; + + /** + * Register the callback for available area changes. + * + * @param { Callback } callback - Callback used to return the available area + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + onAvailableAreaChange(callback: Callback): void; /** * Unregister the callback for available area changes. @@ -2404,10 +2598,22 @@ declare namespace display { * @throws { BusinessError } 1400003 - This display manager service works abnormally. * @syscap SystemCapability.Window.SessionManager * @atomicservice - * @since 12 dynamic - * @since 20 static + * @since 12 dynamic */ off(type: 'availableAreaChange', callback?: Callback): void; + + /** + * Unregister the callback for available area changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * 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 } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 22 static + */ + offAvailableAreaChange(callback?: Callback): void; /** * Get current display capability, including foldstatus, displaymode, rotation, and orientation information. diff --git a/api/@ohos.screen.d.ts b/api/@ohos.screen.d.ts index b641d78c0fb4b3a93a4dc5b20ca32ba615351cd6..6ea179bec7660a70534c4d0e42e4fedd54fca0d7 100644 --- a/api/@ohos.screen.d.ts +++ b/api/@ohos.screen.d.ts @@ -68,11 +68,43 @@ declare namespace screen { *
2. Incorrect parameter types. * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. - * @since 9 dynamic - * @since 20 static + * @since 9 dynamic */ function on(eventType: 'connect' | 'disconnect' | 'change', callback: Callback): void; + /** + * Register the callback for screen changes. + * + * @param { Callback } callback Callback used to return the screen ID. This parameter is callable. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function onConnect(callback: Callback): void; + + /** + * Register the callback for screen changes. + * + * @param { Callback } callback Callback used to return the screen ID. This parameter is callable. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function onDisconnect(callback: Callback): void; + + /** + * Register the callback for screen changes. + * + * @param { Callback } callback Callback used to return the screen ID. This parameter is callable. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function onChange(callback: Callback): void; + /** * Unregister the callback for screen changes. * @@ -85,11 +117,46 @@ declare namespace screen { *
2. Incorrect parameter types. * @syscap SystemCapability.WindowManager.WindowManager.Core * @systemapi Hide this for inner system use. - * @since 9 dynamic - * @since 20 static + * @since 9 dynamic */ function off(eventType: 'connect' | 'disconnect' | 'change', callback?: Callback): void; + /** + * Unregister the callback for screen changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function offConnect(callback?: Callback): void; + + /** + * Unregister the callback for screen changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function offDisconnect(callback?: Callback): void; + + /** + * Unregister the callback for screen changes. + * + * @param { Callback } [callback] - Unregister the callback function. + * If not provided, all callbacks for the given event type will be removed. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 static + */ + function offChange(callback?: Callback): void; + /** * Make screens as expand-screen *