From 59d267dd880d08983867730cee9695732acadc49 Mon Sep 17 00:00:00 2001 From: dy_study Date: Sat, 25 Jun 2022 10:28:42 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:#I5D36I=20Description:=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=BA=94=E7=94=A8=E4=B8=8A=E4=B8=8B=E6=96=87=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E7=9B=91=E5=90=AC=E6=8E=A5=E5=8F=A3=20Sig:SIG=5FAppli?= =?UTF-8?q?caitonFramework=20Feature=20or=20Bugfix:Bugfix=20Binary=20Sourc?= =?UTF-8?q?e:No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy_study Change-Id: I3dd8ee6a052f2d015388a69a77d64df580adaded --- ....application.AbilityLifecycleCallback.d.ts | 14 ++++---- ...@ohos.application.EnvironmentCallback.d.ts | 35 +++++++++++++++++++ api/application/ApplicationContext.d.ts | 24 +++++++++++++ 3 files changed, 66 insertions(+), 7 deletions(-) create mode 100755 api/@ohos.application.EnvironmentCallback.d.ts diff --git a/api/@ohos.application.AbilityLifecycleCallback.d.ts b/api/@ohos.application.AbilityLifecycleCallback.d.ts index 13ec3ef6bb..77e747eb78 100644 --- a/api/@ohos.application.AbilityLifecycleCallback.d.ts +++ b/api/@ohos.application.AbilityLifecycleCallback.d.ts @@ -24,7 +24,7 @@ import Ability from "./@ohos.application.Ability"; */ export default class AbilityLifecycleCallback { /** - * Called back when the ability is started for initialization. + * Called back when an ability is started for initialization. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -34,7 +34,7 @@ export default class AbilityLifecycleCallback { onAbilityCreate(ability: Ability): void; /** - * Called back when the ability window stage is created. + * Called back when an ability window stage is created. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -44,7 +44,7 @@ export default class AbilityLifecycleCallback { onAbilityWindowStageCreate(ability: Ability): void; /** - * Called back when the ability window stage is created. + * Called back when an ability window stage is destroyed. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -54,7 +54,7 @@ export default class AbilityLifecycleCallback { onAbilityWindowStageDestroy(ability: Ability): void; /** - * Called back when the ability window stage is created. + * Called back when an ability is destroyed. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -64,7 +64,7 @@ export default class AbilityLifecycleCallback { onAbilityDestroy(ability: Ability): void; /** - * Called back when the ability window stage is created. + * Called back when the state of an ability changes to foreground. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -74,7 +74,7 @@ export default class AbilityLifecycleCallback { onAbilityForeground(ability: Ability): void; /** - * Called back when the ability window stage is created. + * Called back when the state of an ability changes to background. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore @@ -84,7 +84,7 @@ export default class AbilityLifecycleCallback { onAbilityBackground(ability: Ability): void; /** - * Called back when the ability window stage is created. + * Called back when an ability prepares to continue. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore diff --git a/api/@ohos.application.EnvironmentCallback.d.ts b/api/@ohos.application.EnvironmentCallback.d.ts new file mode 100755 index 0000000000..b19bd5792e --- /dev/null +++ b/api/@ohos.application.EnvironmentCallback.d.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Configuration } from './@ohos.application.Configuration'; + +/** + * The environment callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + */ +export default class EnvironmentCallback { + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param config: Indicates the updated configuration. + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; +} diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index eb6b30bf9a..2f605c61cf 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -16,6 +16,7 @@ import { AsyncCallback } from "../basic"; import Context from "./Context"; import AbilityLifecycleCallback from "../@ohos.application.AbilityLifecycleCallback"; +import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; /** * The context of an application. It allows access to application-specific resources. @@ -48,4 +49,27 @@ export default class ApplicationContext extends Context { */ unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; unregisterAbilityLifecycleCallback(callbackId: number): Promise; + + /** + * Register environment callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param callback The environment callback. + * @return Returns the number code of the callback. + * @StageModelOnly + */ + registerEnvironmentCallback(callback: EnvironmentCallback): number; + + /** + * Unregister environment callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param callbackId Indicates the number code of the callback. + * @return - + * @StageModelOnly + */ + unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; + unregisterEnvironmentCallback(callbackId: number): Promise; } -- Gitee