diff --git a/api/@ohos.app.ability.UIAbility.d.ts b/api/@ohos.app.ability.UIAbility.d.ts
index 65ac6d62c743127f88d714779572f932cabaeccb..ee06c1fe16e3da78adc84d93cab6f7a362ca6b25 100644
--- a/api/@ohos.app.ability.UIAbility.d.ts
+++ b/api/@ohos.app.ability.UIAbility.d.ts
@@ -137,7 +137,7 @@ export interface Caller {
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9 dynamic
- * @since 20 static
+ * @since 22 static
*/
onRelease(callback: OnReleaseCallback): void;
@@ -168,7 +168,6 @@ export interface Caller {
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9 dynamic
- * @since 20 static
*/
on(type: 'release', callback: OnReleaseCallback): void;
@@ -183,10 +182,19 @@ export interface Caller {
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9 dynamic
- * @since 20 static
*/
off(type: 'release', callback: OnReleaseCallback): void;
+ /**
+ * Unregisters all death listener notification callback.
+ *
+ * @param { OnReleaseCallback } callback - Callback used to return the result.
+ * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offRelease(callback: OnReleaseCallback): void;
+
/**
* Unregisters a callback that is invoked when the stub on the target UIAbility is disconnected.
* This capability is reserved.
@@ -197,9 +205,17 @@ export interface Caller {
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9 dynamic
- * @since 20 static
*/
off(type: 'release'): void;
+
+ /**
+ * Unregisters all death listener notification callback.
+ *
+ * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offRelease(): void;
}
/**
diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts
index 801ee279390fa6e8507113bbd51e01f4d5ab9d16..83d8af0c2bde2619942a93fd040d5e0965208759 100644
--- a/api/@ohos.app.ability.abilityManager.d.ts
+++ b/api/@ohos.app.ability.abilityManager.d.ts
@@ -207,10 +207,23 @@ declare namespace abilityManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 11 dynamic
- * @since 20 static
*/
function on(type: 'abilityForegroundState', observer: AbilityForegroundStateObserver): void;
+ /**
+ * Register Ability foreground or background state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { AbilityForegroundStateObserver } observer - The ability foreground state observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 16000050 - Connect to system server failed.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 22 static
+ */
+ function onAbilityForegroundState(observer: AbilityForegroundStateObserver): void;
+
/**
* Unregister Ability foreground or background state observer.
*
@@ -225,10 +238,23 @@ declare namespace abilityManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 11 dynamic
- * @since 20 static
*/
function off(type: 'abilityForegroundState', observer?: AbilityForegroundStateObserver): void;
+ /**
+ * Unregister Ability foreground or background state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { AbilityForegroundStateObserver } [observer] - The ability foreground state observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 16000050 - Connect to system server failed.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 20 static
+ */
+ function offAbilityForegroundState(observer?: AbilityForegroundStateObserver): void;
+
/**
* Updates the configuration by modifying the configuration.
*
diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts
index 2001a09d7aa4ccc2f2fde0bd3c0b47162726a036..acd6b7009f8ab00d12bd8819a46f19f6e25a14dd 100644
--- a/api/@ohos.app.ability.appManager.d.ts
+++ b/api/@ohos.app.ability.appManager.d.ts
@@ -387,10 +387,22 @@ declare namespace appManager {
* @throws { BusinessError } 16000050 - Internal error.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 14 dynamic
- * @since 20 static
*/
function on(type: 'applicationState', observer: ApplicationStateObserver): int;
+ /**
+ * Register application state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { ApplicationStateObserver } observer - The application state observer.
+ * @returns { int } Returns the number code of the observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @since 22 static
+ */
+ function onApplicationStateChange(observer: ApplicationStateObserver): int;
+
/**
* Register application state observer.
*
@@ -405,10 +417,23 @@ declare namespace appManager {
* @throws { BusinessError } 16000050 - Internal error.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 14 dynamic
- * @since 20 static
*/
function on(type: 'applicationState', observer: ApplicationStateObserver, bundleNameList: Array): int;
+ /**
+ * Register application state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { ApplicationStateObserver } observer - The application state observer.
+ * @param { Array } bundleNameList - The list of bundleName. The max length is 128.
+ * @returns { int } Returns the number code of the observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @since 22 static
+ */
+ function onApplicationStateChange(observer: ApplicationStateObserver, bundleNameList: Array): int;
+
/**
* Register app foreground or background state observer.
*
@@ -423,10 +448,23 @@ declare namespace appManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 11 dynamic
- * @since 20 static
*/
function on(type: 'appForegroundState', observer: AppForegroundStateObserver): void;
+ /**
+ * Register app foreground or background state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { AppForegroundStateObserver } observer - The app foreground state observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 22 static
+ */
+ function onAppForegroundStateChange(observer: AppForegroundStateObserver): void;
+
/**
* Register ability first frame state observe.
*
@@ -442,10 +480,24 @@ declare namespace appManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 12 dynamic
- * @since 20 static
*/
function on(type: 'abilityFirstFrameState', observer: AbilityFirstFrameStateObserver, bundleName?: string): void;
+ /**
+ * Register ability first frame state observe.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { AbilityFirstFrameStateObserver } observer - The ability first frame state observer.
+ * @param { string } [bundleName] - The target bundle name.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 22 static
+ */
+ function onAbilityFirstFrameStateChange(observer: AbilityFirstFrameStateObserver, bundleName?: string): void;
+
/**
* Unregister application state observer.
*
@@ -459,10 +511,22 @@ declare namespace appManager {
* @throws { BusinessError } 16000050 - Internal error.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 15 dynamic
- * @since 20 static
*/
function off(type: 'applicationState', observerId: int, callback: AsyncCallback): void;
+ /**
+ * Unregister application state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { int } observerId - Indicates the number code of the observer.
+ * @param { AsyncCallback } callback - The callback of off.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @since 22 static
+ */
+ function offApplicationStateChange(observerId: int, callback: AsyncCallback): void;
+
/**
* Unregister application state observer.
*
@@ -476,10 +540,24 @@ declare namespace appManager {
* @throws { BusinessError } 16000050 - Internal error.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 14 dynamic
- * @since 20 static
*/
function off(type: 'applicationState', observerId: int): Promise;
+ /**
+ * Unregister application state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { int } observerId - Indicates the number code of the observer.
+ * @returns { Promise } The promise returned by the function.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
+ * 2. Incorrect parameter types; 3. Parameter verification failed.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @since 22 static
+ */
+ function offApplicationStateChange(observerId: int): Promise;
+
/**
* Unregister app foreground or background state observer.
*
@@ -494,10 +572,25 @@ declare namespace appManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 11 dynamic
- * @since 20 static
*/
function off(type: 'appForegroundState', observer?: AppForegroundStateObserver): void;
+ /**
+ * Unregister app foreground or background state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { AppForegroundStateObserver } [observer] - The app foreground state observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
+ * 2. Incorrect parameter types; 3. Parameter verification failed.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 22 static
+ */
+ function offAppForegroundStateChange(observer?: AppForegroundStateObserver): void;
+
/**
* Unregister ability first frame state observer.
*
@@ -512,10 +605,25 @@ declare namespace appManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 12 dynamic
- * @since 20 static
*/
function off(type: 'abilityFirstFrameState', observer?: AbilityFirstFrameStateObserver): void;
+ /**
+ * Unregister ability first frame state observer.
+ *
+ * @permission ohos.permission.RUNNING_STATE_OBSERVER
+ * @param { AbilityFirstFrameStateObserver } [observer] - The ability first frame state observer.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
+ * 2. Incorrect parameter types; 3. Parameter verification failed.
+ * @throws { BusinessError } 16000050 - Internal error.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 22 static
+ */
+ function offAbilityFirstFrameStateChange(observer?: AbilityFirstFrameStateObserver): void;
+
/**
* getForegroundApplications.
*
diff --git a/api/@ohos.app.ability.autoStartupManager.d.ts b/api/@ohos.app.ability.autoStartupManager.d.ts
index 8eb94547a9c3a24edb3e236ca91f2a00d7cbcb68..a6d37164a45f7b6feb7d4e608b7af0fb63f0e5ad 100644
--- a/api/@ohos.app.ability.autoStartupManager.d.ts
+++ b/api/@ohos.app.ability.autoStartupManager.d.ts
@@ -55,10 +55,25 @@ declare namespace autoStartupManager {
* @systemapi
* @StageModelOnly
* @since 11 dynamic
- * @since 20 static
*/
function on(type: 'systemAutoStartup', callback: AutoStartupCallback): void;
+ /**
+ * Register the listener that watches for all applications auto startup state.
+ *
+ * @permission ohos.permission.MANAGE_APP_BOOT
+ * @param { AutoStartupCallback } callback - Auto startup callback.
+ * @throws { BusinessError } 201 - Permission denied, interface caller does not have permission
+ * "ohos.permission.MANAGE_APP_BOOT".
+ * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
+ * @throws { BusinessError } 16000050 - Connect to system server failed.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @stagemodelonly
+ * @since 22 static
+ */
+ function onSystemAutoStartup(callback: AutoStartupCallback): void;
+
/**
* Unregister listener that watches for all applications auto startup state.
*
@@ -75,10 +90,24 @@ declare namespace autoStartupManager {
* @systemapi
* @StageModelOnly
* @since 11 dynamic
- * @since 20 static
*/
function off(type: 'systemAutoStartup', callback?: AutoStartupCallback): void;
+ /**
+ * Unregister listener that watches for all applications auto startup state.
+ *
+ * @permission ohos.permission.MANAGE_APP_BOOT
+ * @param { AutoStartupCallback } [callback] - Auto startup callback.
+ * @throws { BusinessError } 201 - Permission denied, interface caller does not have permission
+ * "ohos.permission.MANAGE_APP_BOOT".
+ * @throws { BusinessError } 202 - Permission denied, non-system app called system api.
+ * @throws { BusinessError } 16000050 - Connect to system server failed.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @systemapi
+ * @since 22 static
+ */
+ function offSystemAutoStartup(callback?: AutoStartupCallback): void;
+
/**
* Set application auto startup state.
*
diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts
index 69d73922c0397078efde704ba69d91ce573af077..1b34b3a4b384cf31a22d35eb4cfd0e0c47e82950 100644
--- a/api/@ohos.app.ability.missionManager.d.ts
+++ b/api/@ohos.app.ability.missionManager.d.ts
@@ -48,10 +48,25 @@ declare namespace missionManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
* @systemapi
* @since 9 dynamic
- * @since 20 static
*/
function on(type: 'mission', listener: MissionListener): long;
+ /**
+ * Register the missionListener to ams.
+ *
+ * @permission ohos.permission.MANAGE_MISSIONS
+ * @param { MissionListener } listener - Indicates the MissionListener to be registered.
+ * @returns { long } Returns the index number of the MissionListener.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
+ * 2. Incorrect parameter types; 3. Parameter verification failed.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Mission
+ * @systemapi
+ * @since 20 static
+ */
+ function onMission(listener: MissionListener): long;
+
/**
* Unregister the missionListener to ams.
*
@@ -67,10 +82,24 @@ declare namespace missionManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
* @systemapi
* @since 9 dynamic
- * @since 20 static
*/
function off(type: 'mission', listenerId: long, callback: AsyncCallback): void;
+ /**
+ * Unregister the missionListener to ams.
+ *
+ * @permission ohos.permission.MANAGE_MISSIONS
+ * @param { long } listenerId - Indicates the listener id to be unregistered.
+ * @param { AsyncCallback } callback - The callback of off.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 16300002 - The specified mission listener does not exist.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Mission
+ * @systemapi
+ * @since 22 static
+ */
+ function offMission(listenerId: long, callback: AsyncCallback): void;
+
/**
* Unregister the missionListener to ams.
*
@@ -86,10 +115,24 @@ declare namespace missionManager {
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
* @systemapi
* @since 9 dynamic
- * @since 20 static
*/
function off(type: 'mission', listenerId: long): Promise;
+ /**
+ * Unregister the missionListener to ams.
+ *
+ * @permission ohos.permission.MANAGE_MISSIONS
+ * @param { long } listenerId - Indicates the listener id to be unregistered.
+ * @returns { Promise } The promise returned by the function.
+ * @throws { BusinessError } 201 - Permission denied.
+ * @throws { BusinessError } 202 - Not system application.
+ * @throws { BusinessError } 16300002 - The specified mission listener does not exist.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Mission
+ * @systemapi
+ * @since 22 static
+ */
+ function offMission(listenerId: long): Promise;
+
/**
* Get the missionInfo with the given missionId.
*
diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts
index fdc9b1991062b044dd424146d73f255f432a2319..84e43dfb57ab3fd86f5cff5db369621001c6de4c 100644
--- a/api/application/ApplicationContext.d.ts
+++ b/api/application/ApplicationContext.d.ts
@@ -104,10 +104,23 @@ declare class ApplicationContext extends Context {
* @crossplatform
* @atomicservice
* @since 11 dynamic
- * @since 20 static
*/
on(type: 'abilityLifecycle', callback: AbilityLifecycleCallback): int;
+ /**
+ * Registers a listener to monitor the ability lifecycle of the application.
+ * This API uses an asynchronous callback to return the result.
+ *
+ * @param { AbilityLifecycleCallback } callback - Callback used to return the ID of the registered listener.
+ * @returns { int } Returns the number code of the callback.
+ * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
+ * 2.Incorrect parameter types.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ onAbilityLifecycle(callback: AbilityLifecycleCallback): int;
+
/**
* Registers a listener to monitor the ability lifecycle of the application for interoperability.
*
@@ -115,13 +128,12 @@ declare class ApplicationContext extends Context {
*
It can be called only by the main thread.
*
*
- * @param { 'interopAbilityLifecycle' } type - Event type.
- * @param { InteropAbilityLifecycleCallback } callback - Callback used to be registered as the listener.
+ * @param { InteropAbilityLifecycleCallback } [callback] - Callback used to be registered.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
- * @since 21 dynamic&static
+ * @since 22 static
*/
- on(type: 'interopAbilityLifecycle', callback: InteropAbilityLifecycleCallback): void;
+ onInteropAbilityLifecycle(callback?: InteropAbilityLifecycleCallback): void;
/**
* Unregister ability lifecycle callback.
@@ -155,7 +167,7 @@ declare class ApplicationContext extends Context {
*
*
* @param { 'abilityLifecycle' } type - Event type.
- * @param { int } callbackId - ID of the listener to unregister.
+ * @param { number } callbackId - ID of the listener to unregister.
* @param { AsyncCallback } callback - Callback used to return the result. If the deregistration is successful,
* err is undefined. Otherwise, err is an error object.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
@@ -165,9 +177,19 @@ declare class ApplicationContext extends Context {
* @crossplatform
* @atomicservice
* @since 11 dynamic
- * @since 20 static
*/
- off(type: 'abilityLifecycle', callbackId: int, callback: AsyncCallback): void;
+ off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback): void;
+
+ /**
+ * Unregisters ability lifecycle callback.
+ *
+ * @param { int } callbackId - ID of the listener to unregister.
+ * @param { AsyncCallback } callback - Callback used to return the result. If the deregistration is successful,
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offAbilityLifecycle(callbackId: int, callback: AsyncCallback): void;
/**
* Unregister ability lifecycle callback.
@@ -201,7 +223,7 @@ declare class ApplicationContext extends Context {
*
*
* @param { 'abilityLifecycle' } type - Event type.
- * @param { int } callbackId - ID of the listener to unregister.
+ * @param { number } callbackId - ID of the listener to unregister.
* @returns { Promise } Promise that returns no value.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified.
* 2.Incorrect parameter types.
@@ -210,10 +232,25 @@ declare class ApplicationContext extends Context {
* @crossplatform
* @atomicservice
* @since 12 dynamic
- * @since 20 static
*/
- off(type: 'abilityLifecycle', callbackId: int): Promise;
+ off(type: 'abilityLifecycle', callbackId: number): Promise;
+ /**
+ * Unregisters the listener that monitors the ability lifecycle of the application.
+ * This API uses a promise to return the result.
+ *
+ * **NOTE**:
+ *
It can be called only by the main thread.
+ *
+ *
+ * @param { int } callbackId - Indicates the number code of the callback.
+ * @returns { Promise } ThePromise returned by the function.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offAbilityLifecycle(callbackId: int): Promise;
+
/**
* Unregisters the listener that monitors the ability lifecycle of the application for interoperability.
*
@@ -221,13 +258,12 @@ declare class ApplicationContext extends Context {
*
It can be called only by the main thread.
*
*
- * @param { 'interopAbilityLifecycle' } type - Event type.
* @param { InteropAbilityLifecycleCallback } [callback] - Callback used to be unregistered.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
- * @since 21 dynamic&static
+ * @since 22 static
*/
- off(type: 'interopAbilityLifecycle', callback?: InteropAbilityLifecycleCallback): void;
+ offInteropAbilityLifecycle(callback?: InteropAbilityLifecycleCallback): void;
/**
* Register environment callback.
@@ -245,15 +281,25 @@ declare class ApplicationContext extends Context {
*
* @param { 'environment' } type - environment.
* @param { EnvironmentCallback } callback - The environment callback.
- * @returns { int } Returns the number code of the callback.
+ * @returns { number } Returns the number code of the callback.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
* @atomicservice
* @since 11 dynamic
- * @since 20 static
*/
- on(type: 'environment', callback: EnvironmentCallback): int;
+ on(type: 'environment', callback: EnvironmentCallback): number;
+
+ /**
+ * Register environment callback.
+ *
+ * @param { EnvironmentCallback } callback - The environment callback.
+ * @returns { int } Returns the number code of the callback.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ onEnvironment(callback: EnvironmentCallback): int;
/**
* Unregister environment callback.
@@ -277,10 +323,20 @@ declare class ApplicationContext extends Context {
* @stagemodelonly
* @atomicservice
* @since 11 dynamic
- * @since 20 static
*/
off(type: 'environment', callbackId: int, callback: AsyncCallback): void;
+ /**
+ * Unregister environment callback.
+ *
+ * @param { int } callbackId - Indicates the number code of the callback.
+ * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offEnvironment(callbackId: int, callback: AsyncCallback): void;
+
/**
* Unregister environment callback.
*
@@ -296,16 +352,26 @@ declare class ApplicationContext extends Context {
* Unregister environment callback.
*
* @param { 'environment' } type - environment.
- * @param { int } callbackId - Indicates the number code of the callback.
+ * @param { number } callbackId - Indicates the number code of the callback.
* @returns { Promise } The promise returned by the function.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
* @atomicservice
* @since 11 dynamic
- * @since 20 static
*/
- off(type: 'environment', callbackId: int): Promise;
+ off(type: 'environment', callbackId: number): Promise;
+
+ /**
+ * Unregister environment callback.
+ *
+ * @param { int } callbackId - Indicates the number code of the callback.
+ * @returns { Promise } The promise returned by the function.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offEnvironment(callbackId: int): Promise;
/**
* Register applicationStateChange callback.
@@ -347,10 +413,19 @@ declare class ApplicationContext extends Context {
* @crossplatform
* @atomicservice
* @since 18 dynamic
- * @since 20 static
*/
on(type: 'applicationStateChange', callback: ApplicationStateChangeCallback): void;
+ /**
+ * Register applicationStateChange callback.
+ *
+ * @param { ApplicationStateChangeCallback } callback - The applicationStateChange callback.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ onApplicationStateChange(callback: ApplicationStateChangeCallback): void;
+
/**
* Unregister applicationStateChange callback.
*
@@ -393,10 +468,19 @@ declare class ApplicationContext extends Context {
* @crossplatform
* @atomicservice
* @since 18 dynamic
- * @since 20 static
*/
off(type: 'applicationStateChange', callback?: ApplicationStateChangeCallback): void;
+ /**
+ * Unregister applicationStateChange callback.
+ *
+ * @param { ApplicationStateChangeCallback } [callback] - The applicationStateChange callback.
+ * @syscap SystemCapability.Ability.AbilityRuntime.Core
+ * @stagemodelonly
+ * @since 22 static
+ */
+ offApplicationStateChange(callback?: ApplicationStateChangeCallback): void;
+
/**
* Get information about running processes
*