From 9426cd89390e138c7ca8f9764845ad06cc4f508a Mon Sep 17 00:00:00 2001 From: dy_study Date: Sat, 19 Mar 2022 15:15:11 +0800 Subject: [PATCH] IssueNo:add formHost.d.ts and formProvider.d.ts Description:add formHost.d.ts and formProvider.d.ts Sig:SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: dy_study Change-Id: Ifb54974b2f8bb713f1935d8c456b02419c814df4 --- api/@internal/ets/lifecycle.d.ts | 86 ++++-- api/@ohos.ability.wantConstant.d.ts | 6 +- api/@ohos.application.formError.d.ts | 225 ++++++++++++++ api/@ohos.application.formHost.d.ts | 277 +++++++++++++++++ api/@ohos.application.formInfo.d.ts | 390 ++++++++++++++++++++++++ api/@ohos.application.formProvider.d.ts | 53 ++++ api/@ohos.settings.d.ts | 2 +- api/@ohos.systemparameter.d.ts | 2 +- api/application/AbilityContext.d.ts | 4 +- api/application/Context.d.ts | 17 +- api/application/abilityDelegator.d.ts | 2 +- 11 files changed, 1032 insertions(+), 32 deletions(-) create mode 100644 api/@ohos.application.formError.d.ts create mode 100644 api/@ohos.application.formHost.d.ts create mode 100644 api/@ohos.application.formInfo.d.ts create mode 100644 api/@ohos.application.formProvider.d.ts diff --git a/api/@internal/ets/lifecycle.d.ts b/api/@internal/ets/lifecycle.d.ts index e493b6a62e1..a5d8811f1e0 100644 --- a/api/@internal/ets/lifecycle.d.ts +++ b/api/@internal/ets/lifecycle.d.ts @@ -19,8 +19,8 @@ import { AbilityInfo } from "../bundle/abilityInfo"; import { DataAbilityResult } from "../ability/dataAbilityResult"; import { DataAbilityOperation } from "../ability/dataAbilityOperation"; import dataAbility from "../@ohos.data.dataAbility"; -import formBindingData from "../@ohos.ability.formBindingData"; -import formManager from "../@ohos.ability.formManager"; +import formBindingData from "../@ohos.application.formBindingData"; +import formInfo from "../@ohos.application.formInfo"; import rdb from "../@ohos.data.rdb"; import rpc from "../@ohos.rpc"; import resourceManager from "../@ohos.resourceManager"; @@ -31,17 +31,19 @@ import { PacMap } from "../ability/dataAbilityHelper"; * * @name LifecycleForm * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @FAModelOnly */ export declare interface LifecycleForm { /** * Called to return a {@link formBindingData.FormBindingData} object. * - * @since 7 + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @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, - * which can be obtained from {@link formManager#FormParam#IDENTITY_KEY}, - * {@link formManager#FormParam#NAME_KEY}, and {@link formManager#FormParam#DIMENSION_KEY}, + * which can be obtained from {@link formInfo#FormParam#IDENTITY_KEY}, + * {@link formInfo#FormParam#NAME_KEY}, and {@link formInfo#FormParam#DIMENSION_KEY}, * respectively. Such form information must be managed as persistent data for further form * acquisition, update, and deletion. * @return Returns the created {@link formBindingData#FormBindingData} object. @@ -52,17 +54,19 @@ export declare interface LifecycleForm { /** * Called when the form provider is notified that a temporary form is successfully converted to a normal form. * - * @since 7 + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the form. * @return - * @FAModelOnly */ - onCastTempToNormal?(formId: string): void; + onCastToNormal?(formId: string): void; /** * Called to notify the form provider to update a specified form. * - * @since 7 + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the form to update. * @return - * @FAModelOnly @@ -72,22 +76,24 @@ export declare interface LifecycleForm { /** * Called when the form provider receives form events from the system. * - * @since 7 + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @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} - * means that the form becomes visible, and {@link formManager#VisibilityType#FORM_INVISIBLE} + * and the value indicates the event type, which can be either {@link formInfo#VisibilityType#FORM_VISIBLE} + * or {@link formInfo#VisibilityType#FORM_INVISIBLE}. {@link formInfo#VisibilityType#FORM_VISIBLE} + * means that the form becomes visible, and {@link formInfo#VisibilityType#FORM_INVISIBLE} * means that the form becomes invisible. * @return - * @FAModelOnly */ - onVisibilityChanged?(newStatus: { [key: string]: number }): void; + onVisibilityChange?(newStatus: { [key: string]: number }): void; /** * Called when a specified message event defined by the form provider is triggered. This method is valid only for * JS forms. * - * @since 7 + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @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 @@ -95,18 +101,19 @@ export declare interface LifecycleForm { * @return - * @FAModelOnly */ - onTriggerEvent?(formId: string, message: string): void; + onEvent?(formId: string, message: string): void; /** * Called to notify the form provider that a specified form has been deleted. Override this method if * you want your application, as the form provider, to be notified of form deletion. * - * @since 7 + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the deleted form. * @return - * @FAModelOnly */ - onDelete?(formId: string): void; + onDestroy?(formId: string): void; /** * Called to return a {@link FormState} object. @@ -114,13 +121,14 @@ export declare interface LifecycleForm { *

You must override this callback if you want this ability to return the actual form state. Otherwise, * this method returns {@link FormState#DEFAULT} by default.

* - * @since 7 - * @param want Indicates the description of the form for which the {@link formManager#FormState} is obtained. + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param want Indicates the description of the form for which the {@link formInfo#FormState} is obtained. * The description covers the bundle name, ability name, module name, form name, and form dimensions. - * @return Returns the {@link formManager#FormState} object. + * @return Returns the {@link formInfo#FormState} object. * @FAModelOnly */ - onAcquireFormState?(want: Want): formManager.FormState; + onAcquireFormState?(want: Want): formInfo.FormState; } /** @@ -128,6 +136,7 @@ export declare interface LifecycleForm { * * @name LifecycleApp * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @FAModelOnly */ export declare interface LifecycleApp { @@ -135,6 +144,7 @@ export declare interface LifecycleApp { * Called back when the state of an ability changes from BACKGROUND to INACTIVE. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -144,6 +154,7 @@ export declare interface LifecycleApp { * Called back when an ability enters the BACKGROUND state. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -153,6 +164,7 @@ export declare interface LifecycleApp { * Called back before an ability is destroyed. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -162,6 +174,7 @@ export declare interface LifecycleApp { * Called back when an ability is started for initialization. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -172,6 +185,7 @@ export declare interface LifecycleApp { * to multi-window mode or from multi-window mode to fullscreen mode. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param isShownInMultiWindow Specifies whether this ability is currently in multi-window mode. * The value {@code true} indicates the multi-window mode, and {@code false} indicates another mode. * @param newConfig Indicates the new configuration information about this Page ability. @@ -185,6 +199,7 @@ export declare interface LifecycleApp { * Asks a user whether to start the migration. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return Returns {@code true} if the user allows the migration; returns {@code false} otherwise. * @FAModelOnly */ @@ -196,6 +211,7 @@ export declare interface LifecycleApp { * Scheduler Service requests data from the local ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param data Indicates the user data to save. * @return Returns {@code true} if the data is successfully saved; returns {@code false} otherwise. * @FAModelOnly @@ -209,6 +225,7 @@ export declare interface LifecycleApp { * notify the user of the successful migration and then exit the local ability.

* * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param result Indicates the migration result code. The value {@code 0} indicates that the migration is * successful, and {@code -1} indicates that the migration fails. * @return - @@ -222,6 +239,7 @@ export declare interface LifecycleApp { * is restored. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param data Indicates the user data to restore. * @return - * @FAModelOnly @@ -233,6 +251,7 @@ export declare interface LifecycleApp { * migration is performed for the ability from the local device to the remote device. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -244,6 +263,7 @@ export declare interface LifecycleApp { * this method is used only to save temporary states. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param outState Indicates the {@code PacMap} object used for storing user data and states. This * parameter cannot be null. * @return - @@ -257,6 +277,7 @@ export declare interface LifecycleApp { * states. Generally, this method is called after the {@link #onStart(Want)} method. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param inState Indicates the {@code PacMap} object used for storing data and states. This * parameter can not be null. * @return - @@ -269,6 +290,7 @@ export declare interface LifecycleApp { * change to the BACKGROUND or ACTIVE state). * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -278,6 +300,7 @@ export declare interface LifecycleApp { * Called back when an ability enters the ACTIVE state. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -287,6 +310,7 @@ export declare interface LifecycleApp { * Called when the launch mode of an ability is set to singleton. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates the new {@code want} containing information about the ability. * @return - * @FAModelOnly @@ -298,6 +322,7 @@ export declare interface LifecycleApp { * background and there is no enough memory for running as many background processes as possible. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param level Indicates the memory trim level, which shows the current memory usage status. * @return - * @FAModelOnly @@ -310,6 +335,7 @@ export declare interface LifecycleApp { * * @name LifecycleService * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @FAModelOnly */ export declare interface LifecycleService { @@ -318,6 +344,7 @@ export declare interface LifecycleService { * an ability). * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -327,6 +354,7 @@ export declare interface LifecycleService { * Called back when Service is started. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates the want of Service to start. * @param startId Indicates the number of times the Service ability has been started. The {@code startId} is * incremented by 1 every time the ability is started. For example, if the ability has been started @@ -340,6 +368,7 @@ export declare interface LifecycleService { * Called back before an ability is destroyed. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @return - * @FAModelOnly */ @@ -349,6 +378,7 @@ export declare interface LifecycleService { * Called back when a Service ability is first connected to an ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates connection information about the Service ability. * @return Returns the proxy of the Service ability. * @FAModelOnly @@ -359,6 +389,7 @@ export declare interface LifecycleService { * Called back when all abilities connected to a Service ability are disconnected. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates disconnection information about the Service ability. * @return - * @FAModelOnly @@ -373,6 +404,7 @@ export declare interface LifecycleService { * called but {@link #terminateSelf} has not.

* * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates the want of the Service ability being connected. * @return - * @FAModelOnly @@ -385,6 +417,7 @@ export declare interface LifecycleService { * * @name LifecycleData * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @FAModelOnly */ export declare interface LifecycleData { @@ -392,6 +425,7 @@ export declare interface LifecycleData { * Updates one or more data records in the database. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the database table storing the data to update. * @param valueBucket Indicates the data to update. This parameter can be null. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be updated by @@ -407,6 +441,7 @@ export declare interface LifecycleData { * Queries one or more data records in the database. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the database table storing the data to query. * @param columns Indicates the columns to be queried, in array, for example, {"name","age"}. You should define * the processing logic when this parameter is null. @@ -423,6 +458,7 @@ export declare interface LifecycleData { * Deletes one or more data records. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the database table storing the data to delete. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be deleted by * default. @@ -439,6 +475,7 @@ export declare interface LifecycleData { * even if the context has changed. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the uri to normalize. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. @@ -451,6 +488,7 @@ export declare interface LifecycleData { * Inserts multiple data records into the database. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the position where the data is to insert. * @param valueBuckets Indicates the data to insert. * @param callback function specified by framework to receive the result, developer should call this function to @@ -465,6 +503,7 @@ export declare interface LifecycleData { * The default implementation of this method returns the original uri passed to it. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the uri to denormalize. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. @@ -477,6 +516,7 @@ export declare interface LifecycleData { * Inserts a data record into the database. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the position where the data is to insert. * @param valueBucket Indicates the data to insert. * @param callback function specified by framework to receive the result, developer should call this function to @@ -490,6 +530,7 @@ export declare interface LifecycleData { * Opens a file. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the path of the file to open. * @param mode Indicates the open mode, which can be "r" for read-only access, "w" for write-only access (erasing * whatever data is currently in the file), "wt" for write access that truncates any existing file, @@ -506,6 +547,7 @@ export declare interface LifecycleData { * Obtains the MIME type of files. This method should be implemented by a Data ability. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the path of the files to obtain. * @param mimeTypeFilter Indicates the MIME type of the files to obtain. This parameter cannot be set to {@code * null}. @@ -523,6 +565,7 @@ export declare interface LifecycleData { * Called to carry {@code AbilityInfo} to this ability after the ability is initialized. * * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param info Indicates the {@code AbilityInfo} object containing information about this ability. * @return - * @FAModelOnly @@ -536,6 +579,7 @@ export declare interface LifecycleData { *

Data abilities supports general data types, including text, HTML, and JPEG.

* * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the uri of the data. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. diff --git a/api/@ohos.ability.wantConstant.d.ts b/api/@ohos.ability.wantConstant.d.ts index 0b1933a1c4a..c571dbe255c 100644 --- a/api/@ohos.ability.wantConstant.d.ts +++ b/api/@ohos.ability.wantConstant.d.ts @@ -293,14 +293,14 @@ declare namespace wantConstant { /** * Indicates the grant for possible persisting on the URI. * - * @hide + * @systemapi Hide this for inner system use. */ FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040, /** * Returns the result to the source ability slice. * - * @hide + * @systemapi Hide this for inner system use. */ FLAG_AUTH_PREFIX_URI_PERMISSION = 0x00000080, @@ -318,7 +318,7 @@ declare namespace wantConstant { /** * Indicates the continuation is reversible. * - * @hide + * @systemapi Hide this for inner system use. */ FLAG_ABILITY_CONTINUATION_REVERSIBLE = 0x00000400, diff --git a/api/@ohos.application.formError.d.ts b/api/@ohos.application.formError.d.ts new file mode 100644 index 00000000000..df34a39ea97 --- /dev/null +++ b/api/@ohos.application.formError.d.ts @@ -0,0 +1,225 @@ +/* + * 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. + */ + +/** + * interface of formError. + * + * @name formError + * @since 8 + * @syscap SystemCapability.Ability.Form + */ +declare namespace formError { + /** + * Error of form. + * + * @name FormError + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + enum FormError { + /** + * A common internal error occurs during form processing. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_COMMON = 1, + + /** + * The application does not have permission to use forms. + * Ensure that the application is granted with the ohos.permission.REQUIRE_FORM + * and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permissions. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_PERMISSION_DENY = 2, + + /** + * Failed to obtain the configuration information about the form specified by the + * request parameters. Ensure that the parameters of the form to be added are + * consistent with those provided by the form provider. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_GET_INFO_FAILED = 4, + + /** + * Failed to obtain the bundle to which the form belongs based on the request parameters. + * Ensure that the bundle to which the form to be added belongs is available. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_GET_BUNDLE_FAILED = 5, + + /** + * Failed to initialize the form layout based on the request parameters. + * Ensure that the grid style of the form is supported by the form provider. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_GET_LAYOUT_FAILED = 6, + + /** + * Invalid input parameter during form operation. Ensure that all input + * parameters are valid. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_ADD_INVALID_PARAM = 7, + + /** + * The form configuration to be obtained using an existing form ID is + * different from that obtained for the first time. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_CFG_NOT_MATCH_ID = 8, + + /** + * The ID of the form to be operated does not exist in the Form Manager Service. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_NOT_EXIST_ID = 9, + + /** + * Failed to bind the Form Manager Service to the provider service. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_BIND_PROVIDER_FAILED = 10, + + /** + * The total number of added forms exceeds the maximum allowed by the system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_SYSTEM_FORMS = 11, + + /** + * The number of form instances generated using the same form configuration + * exceeds the maximum allowed by the system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_INSTANCES_PER_FORM = 12, + + /** + * The form being requested was added by other applications and cannot be + * operated by the current application. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_OPERATION_FORM_NOT_SELF = 13, + + /** + * The Form Manager Service failed to instruct the form provider to delete the form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_PROVIDER_DEL_FAIL = 14, + + /** + * The total number of added forms exceeds the maximum per client. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_FORMS_PER_CLIENT = 15, + + /** + * The total number of added temp forms exceeds the maximum in system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_MAX_SYSTEM_TEMP_FORMS = 16, + + /** + * The module can not be find in system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_NO_SUCH_MODULE = 17, + + /** + * The ability can not be find in system. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_NO_SUCH_ABILITY = 18, + + /** + * The dimension is not exist in the form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_NO_SUCH_DIMENSION = 19, + + /** + * The ability is not installed. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_FA_NOT_INSTALLED = 20, + + /** + * Failed to obtain the RPC object of the Form Manager Service because + * the service is not started.Please try again after the service is started. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_SYSTEM_RESPONSES_FAILED = 30, + + /** + * Failed to obtain the form requested by the client because another form + * with the same form ID is in use. Forms in use cannot have the same ID. + * To obtain and display a form that has the same configuration as an in-use + * form in the same application, you are advised to set the form ID to 0 in + * the request parameters. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_FORM_DUPLICATE_ADDED = 31, + + /** + * The form is being restored. Perform operations on the form only after + * the restoration is complete. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + ERR_IN_RECOVERY = 36 + } +} +export default formError; \ No newline at end of file diff --git a/api/@ohos.application.formHost.d.ts b/api/@ohos.application.formHost.d.ts new file mode 100644 index 00000000000..412c4b23a84 --- /dev/null +++ b/api/@ohos.application.formHost.d.ts @@ -0,0 +1,277 @@ +/* + * 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 { AsyncCallback } from "./basic"; +import { Callback } from "./basic"; +import Want from './@ohos.application.Want'; +import formInfo from './@ohos.application.formInfo' + +/** + * interface of formHost. + * + * @name formHost + * @since 8 + * @syscap SystemCapability.Ability.Form + * @systemapi hide for inner use. + */ +declare namespace formHost { + /** + * Deletes an obtained form by its ID. + * + *

After this method is called, the form won't be available for use by the application and the Form Manager + * Service no longer keeps the cache information about the form.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function deleteForm(formId: string, callback: AsyncCallback): void; + function deleteForm(formId: string): Promise; + + /** + * Releases an obtained form by its ID. + * + *

After this method is called, the form won't be available for use by the application, but the Form Manager + * Service still keeps the cache information about the form, so that the application can quickly obtain it based on + * the {@code formId}.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID + * @param isReleaseCache Indicates whether or not release cache + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function releaseForm(formId: string, callback: AsyncCallback): void; + function releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback): void; + function releaseForm(formId: string, isReleaseCache?: boolean): Promise; + + /** + * Requests for form update. + * + *

This method must be called when the application has detected that a system setting item (such as the language, + * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form + * provider automatically updates the form data (if there is any update) through the form framework, with the update + * process being unperceivable by the application.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the form to update. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function requestForm(formId: string, callback: AsyncCallback): void; + function requestForm(formId: string): Promise; + + /** + * Converts a specified temporary form that has been obtained by the application into a normal form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the temporary form to convert. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function castTempForm(formId: string, callback: AsyncCallback): void; + function castTempForm(formId: string): Promise; + + /** + * Sends a notification to the form framework to make the specified forms visible. + * + *

After this method is successfully called, onVisibilityChange will be called to notify the form provider of + * the form visibility change event.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made visible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function notifyVisibleForms(formIds: Array, callback: AsyncCallback): void; + function notifyVisibleForms(formIds: Array): Promise; + + /** + * Sends a notification to the form framework to make the specified forms invisible. + * + *

After this method is successfully called, onVisibilityChange will be called to notify the form provider of + * the form visibility change event.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made invisible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function notifyInvisibleForms(formIds: Array, callback: AsyncCallback): void; + function notifyInvisibleForms(formIds: Array): Promise; + + /** + * Notify the form framework to make the specified forms updatable. + * + *

You can use this method to set form refresh state to true, the form can receive new + * update from service.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made invisible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function enableFormsUpdate(formIds: Array, callback: AsyncCallback): void; + function enableFormsUpdate(formIds: Array): Promise; + + /** + * Notifys the form framework to make the specified forms non updatable. + * + *

You can use this method to set form refresh state to false, the form do not receive + * new update from service.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formIds Indicates the IDs of the forms to be made invisible. + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function disableFormsUpdate(formIds: Array, callback: AsyncCallback): void; + function disableFormsUpdate(formIds: Array): Promise; + + /** + * Checks whether the system is ready. + * + *

You can use this method to obtain the system is ready + * new update from service.

+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @return - + */ + function isSystemReady(callback: AsyncCallback): void; + function isSystemReady(): Promise; + + /** + * Obtains the FormInfo objects provided by all applications on the device. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @return Returns the {@link FormInfo} + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getAllFormsInfo(callback: AsyncCallback>): void; + function getAllFormsInfo(): Promise>; + + /** + * Obtains the FormInfo objects provided by a specified application on the device. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param bundleName Indicates the bundle name of the application. + * @param moduleName Indicates the module name of the application. + * @return Returns the {@link FormInfo} + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getFormsInfo(bundleName: string, callback: AsyncCallback>): void; + function getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback>): void; + function getFormsInfo(bundleName: string, moduleName?: string): Promise>; + + /** + * Deletes invalid forms of the application in the Form Manager Service based on the list of. + * + *

You can use this method to delete invalid forms of the application + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param formIds Indicates the specify form id. + * @return Returns the number of invalid forms deleted by the Form Manager Service + * @permission ohos.permission.REQUIRE_FORM. + */ + function deleteInvalidForms(formIds: Array, callback: AsyncCallback): void; + function deleteInvalidForms(formIds: Array): Promise; + + /** + * Obtains the Form state. + * + *

You can use this method to obtains the form state + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param want Indicates want of the form. + * @return Returns form state {@link FormStateInfo} + * @permission ohos.permission.GET_BUNDLE_INFO, ohos.permission.GET_BUNDLE_INFO_PRIVILEGED. + */ + function acquireFormState(want: Want, callback: AsyncCallback): void; + function acquireFormState(want: Want): Promise; + + /** + * Listens to the event of uninstall form. + * + *

You can use this method to listen to the event of uninstall form + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param type Indicates event type. + * @return - + */ + function on(type: "formUninstall", callback: Callback): void; + + /** + * Cancels listening to the event of uninstall form. + * + *

You can use this method to cancel listening to the event of uninstall form + * new update from service.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param type Indicates event type. + * @return - + */ + function off(type: "formUninstall", callback?: Callback): void; + + /** + * notify form is Visible + * + *

You can use this method to notify form visible state.

+ * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param formIds Indicates the specify form id. + * @param isVisible Indicates whether visible. + * @return - + * @permission ohos.permission.REQUIRE_FORM. + */ + function notifyFormsVisible(formIds: Array, isVisible: boolean, callback: AsyncCallback): void; + function notifyFormsVisible(formIds: Array, isVisible: boolean): Promise; + + /** + * notify form enable update state. + * + *

You can use this method to notify form enable update state.

+ * + * @devices phone, tablet, tv, wearable, car + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @param formIds Indicates the specify form id. + * @param isEnableUpdate Indicates whether enable update. + * @return - + * @permission ohos.permission.REQUIRE_FORM. + */ + function notifyFormsEnableUpdate(formIds: Array, isEnableUpdate: boolean, callback: AsyncCallback): void; + function notifyFormsEnableUpdate(formIds: Array, isEnableUpdate: boolean): Promise; +} +export default formHost; \ No newline at end of file diff --git a/api/@ohos.application.formInfo.d.ts b/api/@ohos.application.formInfo.d.ts new file mode 100644 index 00000000000..92d3fd28a8b --- /dev/null +++ b/api/@ohos.application.formInfo.d.ts @@ -0,0 +1,390 @@ +/* + * 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 Want from './@ohos.application.Want'; + +/** + * interface of formInfo. + * + * @name formInfo + * @since 8 + * @syscap SystemCapability.Ability.Form + */ +declare namespace formInfo { + /** + * Provides information about a form. + * + * @name FormInfo + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + interface FormInfo { + /** + * Obtains the bundle name of the application to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + bundleName: string; + + /** + * Obtains the name of the application module to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + moduleName: string; + + /** + * Obtains the class name of the ability to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + abilityName: string; + + /** + * Obtains the name of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + name: string; + + /** + * Obtains the name of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + description: string; + + /** + * Obtains the type of this form. Currently, JS forms are supported. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + type: FormType; + + /** + * Obtains the JS component name of this JS form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + jsComponentName: string; + + /** + * Obtains the color mode of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + colorMode: ColorMode; + + /** + * Checks whether this form is a default form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + isDefault: boolean; + + /** + * Obtains the updateEnabled. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + updateEnabled: boolean; + + /** + * Obtains whether notify visible of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + formVisibleNotify: boolean; + + /** + * Obtains the bundle relatedBundleName of the application to which this form belongs. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + relatedBundleName: string; + + /** + * Obtains the scheduledUpdateTime. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + scheduledUpdateTime: string; + + /** + * Obtains the form config ability about this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + formConfigAbility: string; + + /** + * Obtains the updateDuration. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + updateDuration: number; + + /** + * Obtains the default grid style of this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + defaultDimension: number; + + /** + * Obtains the grid styles supported by this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + supportDimensions: Array; + + /** + * Obtains the custom data defined in this form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + customizeData: {[key: string]: [value: string]}; + } + + /** + * Type of form. + * + * @name FormType + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + enum FormType { + /** + * JS form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + JS = 1 + } + + /** + * Color mode. + * + * @name ColorMode + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + enum ColorMode { + /** + * Automatic mode. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + MODE_AUTO = -1, + + /** + * Dark mode. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + MODE_DARK = 0, + + /** + * Light mode. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + */ + MODE_LIGHT = 1 + } + + /** + * Provides state information about a form. + * + * @name FormStateInfo + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + interface FormStateInfo { + /** + * Obtains the form state. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + formState: FormState; + + /** + * Obtains the want form . + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + want: Want; + } + + /** + * Provides state about a form. + * + * @name FormState + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + enum FormState { + /** + * Indicates that the form status is unknown due to an internal error. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + UNKNOWN = -1, + + /** + * Indicates that the form is in the default state. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + DEFAULT = 0, + + /** + * Indicates that the form is ready. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + READY = 1, + } + + /** + * Parameter of form. + * + * @name FormParam + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + enum FormParam { + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: 1L + * } + * }. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + * @systemapi hide for inner use. + */ + IDENTITY_KEY = "ohos.extra.param.key.form_identity", + + /** + * Indicates the key specifying the grid style of the form to be obtained, which is represented as + * want: { + * "parameters": { + * DIMENSION_KEY: 1 + * } + * }. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + DIMENSION_KEY = "ohos.extra.param.key.form_dimension", + + /** + * Indicates the key specifying the name of the form to be obtained, which is represented as + * want: { + * "parameters": { + * NAME_KEY: "formName" + * } + * }. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + NAME_KEY = "ohos.extra.param.key.form_name", + + /** + * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is + * represented as + * want: { + * "parameters": { + * MODULE_NAME_KEY: "formEntry" + * } + * } + * This constant is mandatory. + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + MODULE_NAME_KEY = "ohos.extra.param.key.module_name", + + /** + * Indicates the key specifying the width of the form to be obtained, which is represented as + * want: { + * "parameters": { + * WIDTH_KEY: 800 + * } + * } + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + WIDTH_KEY = "ohos.extra.param.key.form_width", + + /** + * Indicates the key specifying the height of the form to be obtained, which is represented as + * want: { + * "parameters": { + * HEIGHT_KEY: 400 + * } + * } + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + HEIGHT_KEY = "ohos.extra.param.key.form_height", + + /** + * Indicates the key specifying whether a form is temporary, which is represented as + * want: { + * "parameters": { + * TEMPORARY_KEY: true + * } + * } + * + * @since 8 + * @sysCap SystemCapability.Ability.Form + */ + TEMPORARY_KEY = "ohos.extra.param.key.form_temporary" + } +} +export default formInfo; \ No newline at end of file diff --git a/api/@ohos.application.formProvider.d.ts b/api/@ohos.application.formProvider.d.ts new file mode 100644 index 00000000000..6802a00aba6 --- /dev/null +++ b/api/@ohos.application.formProvider.d.ts @@ -0,0 +1,53 @@ +/* + * 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 { AsyncCallback } from "./basic"; +import formBindingData from "./@ohos.application.formBindingData"; + +/** + * interface of formProvider. + * + * @name formProvider + * @since 8 + * @syscap SystemCapability.Ability.Form + */ +declare namespace formProvider { + /** + * Set next update time for a specified form. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID. + * @param minute Indicates duration minute before next update. + * @return - + */ + function setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback): void; + function setFormNextRefreshTime(formId: string, minute: number): Promise; + + /** + * Update a specified form. + * + * Client to communication with FormManagerService. + * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the form ID + * @return - + */ + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData, + callback: AsyncCallback): void; + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise; +} +export default formProvider; \ No newline at end of file diff --git a/api/@ohos.settings.d.ts b/api/@ohos.settings.d.ts index 887936fc9a5..c2ffe4e43a0 100644 --- a/api/@ohos.settings.d.ts +++ b/api/@ohos.settings.d.ts @@ -805,7 +805,7 @@ declare namespace settings { * @param value Indicates the value of the character string. * @return Returns {@code true} if the operation is successful; returns {@code false} otherwise. * @since 7 - * @hide SystemApi + * @systemapi Hide this for inner system use. */ function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback): void; function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise; diff --git a/api/@ohos.systemparameter.d.ts b/api/@ohos.systemparameter.d.ts index 1e20358fa7f..c0d4adafa76 100644 --- a/api/@ohos.systemparameter.d.ts +++ b/api/@ohos.systemparameter.d.ts @@ -20,7 +20,7 @@ import { AsyncCallback, BusinessError } from './basic'; * * @since 6 * @syscap SystemCapability.Startup.SysInfo - * @hide + * @systemapi Hide this for inner system use. */ declare namespace systemParameter { /** diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 1e12eaa9590..000fc8b222e 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -166,7 +166,7 @@ export default class AbilityContext extends Context { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param want The element name of the service ability * @param options The remote object instance - * @hide hide for inner use. + * @systemapi Hide this for inner system use. * @return Returns the number code of the ability connected * @StageModelOnly */ @@ -193,7 +193,7 @@ export default class AbilityContext extends Context { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param connection The number code of the ability connected - * @hide hide for inner use. + * @systemapi Hide this for inner system use. * @StageModelOnly */ disconnectAbility(connection: number, callback:AsyncCallback): void; diff --git a/api/application/Context.d.ts b/api/application/Context.d.ts index 8f1add64df8..dbb2f4a4293 100755 --- a/api/application/Context.d.ts +++ b/api/application/Context.d.ts @@ -152,9 +152,20 @@ export default class Context extends BaseContext { switchArea(mode: AreaMode): void; } +/** + * File area mode + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ export enum AreaMode { + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ EL1 = 0, - EL2 = 1, - EL3 = 2, - EL4 = 3 + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL2 = 1 } \ No newline at end of file diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index 597b5a76f8a..ccd8607a7f0 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -142,7 +142,7 @@ export interface AbilityDelegator { * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @hide + * @systemapi Hide this for inner system use. * @param msg Log information * @param code Result code */ -- Gitee