diff --git a/api/@internal/ets/lifecycle.d.ts b/api/@internal/ets/lifecycle.d.ts index 18cff8475eb22d59cca76a92c7ce6d10701ef7d7..cbd6cf61db20e3e6ecc0358820f9bf6a4c93c1c2 100644 --- a/api/@internal/ets/lifecycle.d.ts +++ b/api/@internal/ets/lifecycle.d.ts @@ -20,7 +20,7 @@ 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 formInfo from "../@ohos.application.formInfo"; import rdb from "../@ohos.data.rdb"; import rpc from "../@ohos.rpc"; import resourceManager from "../@ohos.resourceManager"; @@ -37,11 +37,11 @@ export declare interface LifecycleForm { /** * Called to return a {@link formBindingData.FormBindingData} object. * - * @since 7 + * @since 8 * @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 +52,17 @@ 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 * @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 * @param formId Indicates the ID of the form to update. * @return - * @FAModelOnly @@ -72,22 +72,22 @@ export declare interface LifecycleForm { /** * Called when the form provider receives form events from the system. * - * @since 7 + * @since 8 * @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 * @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 +95,18 @@ 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 * @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 +114,13 @@ 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 + * @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; } /** diff --git a/api/@ohos.application.formError.d.ts b/api/@ohos.application.formError.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..df34a39ea9755735e56420596301f5f32f395847 --- /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 0000000000000000000000000000000000000000..51a1e8f992e89a365fa115558a38827ecc172785 --- /dev/null +++ b/api/@ohos.application.formHost.d.ts @@ -0,0 +1,275 @@ +/* + * 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: AsyncCallbackAfter 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 + * @return - + * @permission ohos.permission.REQUIRE_FORM + */ + function releaseForm(formId: string, callback: AsyncCallbackThis 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: AsyncCallbackAfter 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: ArrayAfter 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: ArrayYou 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: ArrayYou 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: ArrayYou can use this method to obtain the system is ready + * new update from service.
+ * + * @since 8 + * @syscap SystemCapability.Ability.Form + * @return - + */ + function isSystemReady(callback: AsyncCallbackYou 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: ArrayYou 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: AsyncCallbackYou 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: CallbackYou 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?: CallbackYou 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: ArrayYou 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