From 3718899f7fee25be95fd5a5caa5e6c9f192f9f70 Mon Sep 17 00:00:00 2001 From: "zhangyafei.echo" Date: Sat, 12 Feb 2022 20:19:12 +0800 Subject: [PATCH] IssueNo: SR000GP4TG SR000GP4TE SR000GP4TG SR000GP4TI Description: env update notify interface Sig:SIG_ApplicationFramework Feature or BugFix: Feature Binary Source: No Change-Id: I4c0d3208255e7f44a67b18e339c55ac85e4948dd Signed-off-by: zhangyafei.echo --- api/@ohos.application.AbilityStage.d.ts | 23 +++++-- api/@ohos.application.Configuration.d.ts | 41 ++++++++++-- ...hos.application.ConfigurationConstant.d.ts | 65 +++++++++++++++++++ api/@ohos.application.FormExtension.d.ts | 29 ++++++--- api/@ohos.application.ServiceExtension.d.ts | 29 ++++++--- api/application/AbilityStageContext.d.ts | 16 ++++- api/application/ExtensionContext.d.ts | 16 ++++- 7 files changed, 185 insertions(+), 34 deletions(-) create mode 100644 api/@ohos.application.ConfigurationConstant.d.ts diff --git a/api/@ohos.application.AbilityStage.d.ts b/api/@ohos.application.AbilityStage.d.ts index 9f6a4a8b56..7d1762c145 100644 --- a/api/@ohos.application.AbilityStage.d.ts +++ b/api/@ohos.application.AbilityStage.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -15,12 +15,13 @@ import AbilityStageContext from "./application/AbilityStageContext"; import Want from './@ohos.application.Want'; +import { Configuration } from './@ohos.application.Configuration'; /** * The class of an ability stage. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly */ @@ -29,7 +30,7 @@ export default class AbilityStage { * Indicates configuration information about context. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly */ context: AbilityStageContext; @@ -38,7 +39,7 @@ export default class AbilityStage { * Called back when an ability stage is started for initialization. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @return - * @StageModelOnly */ @@ -49,9 +50,19 @@ export default class AbilityStage { * * @devices phone, tablet, tv, wearable, car * @since 9 - * @sysCap AAFwk + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @return - * @StageModelOnly */ onAcceptWant(want: Want): string; -} \ No newline at end of file + + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; +} diff --git a/api/@ohos.application.Configuration.d.ts b/api/@ohos.application.Configuration.d.ts index 777ba6a5d0..9acbda4fa5 100644 --- a/api/@ohos.application.Configuration.d.ts +++ b/api/@ohos.application.Configuration.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -13,12 +13,14 @@ * limitations under the License. */ +import ConfigurationConstant from "./@ohos.application.ConfigurationConstant"; + /** * configuration item. * * @name Configuration * @since 8 - * @sysCap SystemCapability.Ability.AbilityBase + * @syscap SystemCapability.Ability.AbilityBase * @permission N/A */ export interface Configuration { @@ -26,8 +28,39 @@ export interface Configuration { * Indicates the current language of the application. * * @since 8 - * @sysCap SystemCapability.Ability.AbilityBase + * @syscap SystemCapability.Ability.AbilityBase */ language: string; -} + /** + * Indicates the current colorMode of the application. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + */ + colorMode: ConfigurationConstant.ColorMode; + + /** + * Indicates the screen direction of the current device. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + */ + direction: ConfigurationConstant.Direction; + + /** + * Indicates the screen density of the current device. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + */ + screenDensity: ConfigurationConstant.ScreenDensity; + + /** + * Indicates the displayId of the current device. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + */ + displayId: number; +} diff --git a/api/@ohos.application.ConfigurationConstant.d.ts b/api/@ohos.application.ConfigurationConstant.d.ts new file mode 100644 index 0000000000..b9ed5f3e19 --- /dev/null +++ b/api/@ohos.application.ConfigurationConstant.d.ts @@ -0,0 +1,65 @@ +/* + * 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. + */ + +/** + * The definition of ConfigurationConstant. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + * @permission N/A + */ + declare namespace ConfigurationConstant { + /** + * @name ColorMode + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + * @permission N/A + */ + export enum ColorMode { + COLOR_MODE_NOT_SET = -1, + COLOR_MODE_DARK = 0, + COLOR_MODE_LIGHT = 1, + } + + /** + * @name Direction + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + * @permission N/A + */ + export enum Direction { + DIRECTION_NOT_SET = -1, + DIRECTION_VERTICAL = 0, + DIRECTION_HORIZONTAL = 1, + } + + /** + * @name ScreenDensity + * @since 8 + * @syscap SystemCapability.Ability.AbilityBase + * @permission N/A + */ + export enum ScreenDensity { + SCREEN_DENSITY_NOT_SET = 0, + SCREEN_DENSITY_SDPI = 120, + SCREEN_DENSITY_MDPI = 160, + SCREEN_DENSITY_LDPI = 240, + SCREEN_DENSITY_XLDPI = 320, + SCREEN_DENSITY_XXLDPI = 480, + SCREEN_DENSITY_XXXLDPI = 640, + } +} + +export default ConfigurationConstant diff --git a/api/@ohos.application.FormExtension.d.ts b/api/@ohos.application.FormExtension.d.ts index a994f1aa60..63862c0c22 100644 --- a/api/@ohos.application.FormExtension.d.ts +++ b/api/@ohos.application.FormExtension.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -16,12 +16,13 @@ import formBindingData from './@ohos.application.formBindingData'; import FormExtensionContext from "./application/FormExtensionContext"; import Want from './@ohos.application.Want'; +import { Configuration } from './@ohos.application.Configuration'; /** * class of form extension. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @StageModelOnly */ export default class FormExtension { @@ -29,7 +30,7 @@ export default class FormExtension { * Indicates form extension context. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @StageModelOnly */ context: FormExtensionContext; @@ -38,7 +39,7 @@ export default class FormExtension { * Called to return a {@link formBindingData#FormBindingData} object. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @param want Indicates the detailed information for creating a {@link formBindingData#FormBindingData}. * The {@code Want} object must include the form ID, form name, and grid style of the form. * Such form information must be managed as persistent data for further form @@ -52,7 +53,7 @@ export default class FormExtension { * Called when the form provider is notified that a temporary form is successfully converted to a normal form. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @param formId Indicates the ID of the form. * @return - * @StageModelOnly @@ -63,7 +64,7 @@ export default class FormExtension { * Called to notify the form provider to update a specified form. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @param formId Indicates the ID of the form to update. * @return - * @StageModelOnly @@ -74,7 +75,7 @@ export default class FormExtension { * Called when the form provider receives form events from the system. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @param newStatus Indicates the form events occurred. The key in the {@code Map} object indicates the form ID, * and the value indicates the event type, which can be either {@link formManager#VisibilityType#FORM_VISIBLE} * or {@link formManager#VisibilityType#FORM_INVISIBLE}. {@link formManager#VisibilityType#FORM_VISIBLE} @@ -90,7 +91,7 @@ export default class FormExtension { * JS forms. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @param formId Indicates the ID of the form on which the message event is triggered, which is provided by * the client to the form provider. * @param message Indicates the value of the {@code params} field of the message event. This parameter is @@ -105,10 +106,20 @@ export default class FormExtension { * you want your application, as the form provider, to be notified of form deletion. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.Form * @param formId Indicates the ID of the destroyed form. * @return - * @StageModelOnly */ onDestroy(formId: string): void; + + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; } \ No newline at end of file diff --git a/api/@ohos.application.ServiceExtension.d.ts b/api/@ohos.application.ServiceExtension.d.ts index 10f89d545f..002684069a 100644 --- a/api/@ohos.application.ServiceExtension.d.ts +++ b/api/@ohos.application.ServiceExtension.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -16,12 +16,13 @@ import rpc from "./@ohos.rpc"; import ServiceExtensionContext from "./application/ServiceExtensionContext"; import Want from './@ohos.application.Want'; +import { Configuration } from './@ohos.application.Configuration'; /** * class of service extension. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide for inner use. * @StageModelOnly */ @@ -30,7 +31,7 @@ export default class ServiceExtension { * Indicates service extension context. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide for inner use. * @StageModelOnly */ @@ -40,7 +41,7 @@ export default class ServiceExtension { * Called back when a service extension is started for initialization. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide for inner use. * @return - * @StageModelOnly @@ -51,7 +52,7 @@ export default class ServiceExtension { * Called back before a service extension is destroyed. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide for inner use. * @return - * @StageModelOnly @@ -62,7 +63,7 @@ export default class ServiceExtension { * Called back when a service extension is started. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param want Indicates the want of service extension to start. * @param startId Indicates the number of times the service extension has been started. The {@code startId} is * incremented by 1 every time the service extension is started. For example, if the service extension @@ -77,7 +78,7 @@ export default class ServiceExtension { * Called back when a service extension is first connected to an ability. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param want Indicates connection information about the Service ability. * @systemapi hide for inner use. * @return Returns the proxy of the Service ability. @@ -89,7 +90,7 @@ export default class ServiceExtension { * Called back when all abilities connected to a service extension are disconnected. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param want Indicates disconnection information about the service extension. * @systemapi hide for inner use. * @return - @@ -102,12 +103,22 @@ export default class ServiceExtension { * are disconnected. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param want Indicates the want of the service extension being connected. * @systemapi hide for inner use. * @return - * @StageModelOnly */ onReconnect(want: Want): void; + + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; } diff --git a/api/application/AbilityStageContext.d.ts b/api/application/AbilityStageContext.d.ts index 2bd47e463c..4b2777b37d 100644 --- a/api/application/AbilityStageContext.d.ts +++ b/api/application/AbilityStageContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -14,13 +14,14 @@ */ import { HapModuleInfo } from "../bundle/hapModuleInfo"; +import { Configuration } from '../@ohos.application.Configuration'; import Context from "./Context"; /** * The context of an abilityStage. It allows access to abilityStage-specific resources. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly */ @@ -30,8 +31,17 @@ export default class AbilityStageContext extends Context { * Indicates configuration information about an module. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly */ currentHapModuleInfo: HapModuleInfo; + + /** + * Indicates configuration information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + config: Configuration; } \ No newline at end of file diff --git a/api/application/ExtensionContext.d.ts b/api/application/ExtensionContext.d.ts index cbe63e444a..b08fcc76a3 100644 --- a/api/application/ExtensionContext.d.ts +++ b/api/application/ExtensionContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -14,13 +14,14 @@ */ import { HapModuleInfo } from "../bundle/hapModuleInfo"; +import { Configuration } from '../@ohos.application.Configuration'; import Context from "./Context"; /** * The context of an extension. It allows access to extension-specific resources. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly */ @@ -30,8 +31,17 @@ export default class ExtensionContext extends Context { * Indicates configuration information about an module. * * @since 9 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly */ currentHapModuleInfo: HapModuleInfo; + + /** + * Indicates configuration information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + config: Configuration; } \ No newline at end of file -- Gitee