From 6e7014d46807e958051e285991932c4ef0f36a09 Mon Sep 17 00:00:00 2001 From: yangzk Date: Thu, 15 Sep 2022 22:08:46 +0800 Subject: [PATCH 01/34] IssueNo: #I5RT32 Description: add dataAbilityUtils <- dataAbilityHelper Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: I1817fa445ac89ec299b4e98cf946505b4a29f99d --- api/ability/dataAbilityUtils.d.ts | 258 ++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 api/ability/dataAbilityUtils.d.ts diff --git a/api/ability/dataAbilityUtils.d.ts b/api/ability/dataAbilityUtils.d.ts new file mode 100644 index 0000000000..b31170e647 --- /dev/null +++ b/api/ability/dataAbilityUtils.d.ts @@ -0,0 +1,258 @@ +/* +* Copyright (c) 2021 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 ResultSet from '../data/rdb/resultSet'; +import { DataAbilityOperation } from './dataAbilityOperation'; +import { DataAbilityResult } from './dataAbilityResult'; +import dataAbility from '../@ohos.data.dataAbility'; +import rdb from '../@ohos.data.rdb'; + +/** + * DataAbilityHelper + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * + * @since 7 + * @FAModelOnly + */ +export interface DataAbilityHelper { + /** + * Opens a file in a specified remote path. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the file to open. + * @param mode Indicates the file 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, "wa" for write-only access to append to any existing data, "rw" for read and write access on + * any existing data, or "rwt" for read and write access that truncates any existing file. + * @param callback Indicates the callback when openfile success + * @return Returns the file descriptor. + * @FAModelOnly + */ + openFile(uri: string, mode: string, callback: AsyncCallback): void; + openFile(uri: string, mode: string): Promise; + + /** + * Registers an observer to observe data specified by the given uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type dataChange. + * @param uri Indicates the path of the data to operate. + * @param callback Indicates the callback when dataChange. + * @return - + * @FAModelOnly + */ + on(type: 'dataChange', uri: string, callback: AsyncCallback): void; + + /** + * Deregisters all observers used for monitoring data specified by the given uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type dataChange. + * @param uri Indicates the path of the data to operate. + * @param callback Indicates the registered callback. + * @return - + * @FAModelOnly + */ + off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; + + /** + * Obtains the MIME type of the date specified by the given URI. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the data to operate. + * @return Returns the MIME type that matches the data specified by uri. + * @FAModelOnly + */ + getType(uri: string, callback: AsyncCallback): void; + getType(uri: string): Promise; + + /** + * Obtains the MIME types of files supported. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the files to obtain. + * @param mimeTypeFilter Indicates the MIME types of the files to obtain. + * @return Returns the matched MIME types Array. + * @FAModelOnly + */ + getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; + getFileTypes(uri: string, mimeTypeFilter: string): Promise>; + + /** + * Converts the given uri that refers to the Data ability into a normalized uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the uri object to normalize. + * @return Returns the normalized uri object if the Data ability supports URI normalization or null. + * @FAModelOnly + */ + normalizeUri(uri: string, callback: AsyncCallback): void; + normalizeUri(uri: string): Promise; + + /** + * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the uri object to normalize. + * @return Returns the denormalized uri object if the denormalization is successful. + * @FAModelOnly + */ + denormalizeUri(uri: string, callback: AsyncCallback): void; + denormalizeUri(uri: string): Promise; + + /** + * Notifies the registered observers of a change to the data resource specified by uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the data to operate. + * @return - + * @FAModelOnly + */ + notifyChange(uri: string, callback: AsyncCallback): void; + notifyChange(uri: string): Promise; + + /** + * Inserts a single data record into the database. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the data to insert. + * @param valuesBucket Indicates the data record to insert. If this parameter is null, a blank row will be inserted. + * @return Returns the index of the inserted data record. + * @FAModelOnly + */ + insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; + insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise; + + /** + * Inserts multiple data records into the database. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the data to batchInsert. + * @param valuesBuckets Indicates the data records to insert. + * @return Returns the number of data records inserted. + * @FAModelOnly + */ + batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback): void; + batchInsert(uri: string, valuesBuckets: Array): Promise; + + /** + * Deletes one or more data records from the database. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the data to delete. + * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. + * @return Returns the number of data records deleted. + * @FAModelOnly + */ + delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise; + delete(uri: string, callback: AsyncCallback): void; + + /** + * Updates data records in the database. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of data to update. + * @param valuesBucket Indicates the data to update. + * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. + * @return Returns the number of data records updated. + * @FAModelOnly + */ + update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise; + update(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; + + /** + * Queries data in the database. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of data to query. + * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. + * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. + * @return Returns the query result {@link ResultSet}. + * @FAModelOnly + */ + query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + query(uri: string, callback: AsyncCallback): void; + query(uri: string, columns: Array, callback: AsyncCallback): void; + query(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + query(uri: string, columns?: Array, predicates?: dataAbility.DataAbilityPredicates): Promise; + + /** + * Calls the extended API of the DataAbility. This method uses a promise to return the result. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx" + * @param method Indicates the method to call. + * @param arg Indicates the parameter of the String type. + * @param extras Indicates the parameter of the PacMap type. + * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, + * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. + * If the PacMap object is to be transferred to a non-OHOS process, + * values of primitive types are supported, but not custom Sequenceable objects. + * @return Returns the query result {@link PacMap}. + * @FAModelOnly + */ + call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; + call(uri: string, method: string, arg: string, extras: PacMap): Promise; + + /** + * Queries data in the database. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of data to query. + * @param operations Indicates the data operation list, which can contain multiple operations on the database. + * @return Returns the result of each operation, in array {@link DataAbilityResult}. + */ + executeBatch(uri: string, operations: Array, callback: AsyncCallback>): void; + executeBatch(uri: string, operations: Array): Promise>; +} + +/** + * Defines a PacMap object for storing a series of values. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ +export interface PacMap { + + /** + * Indicates the parameter of the PacMap type. + * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, + * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. + * If the PacMap object is to be transferred to a non-OHOS process, + * values of primitive types are supported, but not custom Sequenceable objects. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ + [key: string]: number | string | boolean | Array | null; +} -- Gitee From 0539bf7b27f3350adaf07085214758cb1309a921 Mon Sep 17 00:00:00 2001 From: yangzk Date: Fri, 16 Sep 2022 16:12:31 +0800 Subject: [PATCH 02/34] IssueNo: #I5RT32 Description: add jsdoc for dataAbilityUtils Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: I8fadeac9ad8f2ccc3d1338c2d3e5a09e6eb04bcc --- api/ability/dataAbilityHelper.d.ts | 32 +++ api/ability/dataAbilityUtils.d.ts | 436 +++++++++++++++++++++-------- 2 files changed, 348 insertions(+), 120 deletions(-) diff --git a/api/ability/dataAbilityHelper.d.ts b/api/ability/dataAbilityHelper.d.ts index bb5cba6122..870fe0c763 100644 --- a/api/ability/dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityHelper.d.ts @@ -26,6 +26,8 @@ import rdb from '../@ohos.data.rdb'; * * @since 7 * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils */ export interface DataAbilityHelper { /** @@ -41,6 +43,8 @@ export interface DataAbilityHelper { * @param callback Indicates the callback when openfile success * @return Returns the file descriptor. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.openFile */ openFile(uri: string, mode: string, callback: AsyncCallback): void; openFile(uri: string, mode: string): Promise; @@ -55,6 +59,8 @@ export interface DataAbilityHelper { * @param callback Indicates the callback when dataChange. * @return - * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.on */ on(type: 'dataChange', uri: string, callback: AsyncCallback): void; @@ -68,6 +74,8 @@ export interface DataAbilityHelper { * @param callback Indicates the registered callback. * @return - * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.off */ off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; @@ -79,6 +87,8 @@ export interface DataAbilityHelper { * @param uri Indicates the path of the data to operate. * @return Returns the MIME type that matches the data specified by uri. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.getType */ getType(uri: string, callback: AsyncCallback): void; getType(uri: string): Promise; @@ -92,6 +102,8 @@ export interface DataAbilityHelper { * @param mimeTypeFilter Indicates the MIME types of the files to obtain. * @return Returns the matched MIME types Array. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.getFileTypes */ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; getFileTypes(uri: string, mimeTypeFilter: string): Promise>; @@ -104,6 +116,8 @@ export interface DataAbilityHelper { * @param uri Indicates the uri object to normalize. * @return Returns the normalized uri object if the Data ability supports URI normalization or null. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.normalizeUri */ normalizeUri(uri: string, callback: AsyncCallback): void; normalizeUri(uri: string): Promise; @@ -116,6 +130,8 @@ export interface DataAbilityHelper { * @param uri Indicates the uri object to normalize. * @return Returns the denormalized uri object if the denormalization is successful. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.denormalizeUri */ denormalizeUri(uri: string, callback: AsyncCallback): void; denormalizeUri(uri: string): Promise; @@ -128,6 +144,8 @@ export interface DataAbilityHelper { * @param uri Indicates the path of the data to operate. * @return - * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.notifyChange */ notifyChange(uri: string, callback: AsyncCallback): void; notifyChange(uri: string): Promise; @@ -141,6 +159,8 @@ export interface DataAbilityHelper { * @param valuesBucket Indicates the data record to insert. If this parameter is null, a blank row will be inserted. * @return Returns the index of the inserted data record. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.insert */ insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise; @@ -154,6 +174,8 @@ export interface DataAbilityHelper { * @param valuesBuckets Indicates the data records to insert. * @return Returns the number of data records inserted. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.batchInsert */ batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback): void; batchInsert(uri: string, valuesBuckets: Array): Promise; @@ -167,6 +189,8 @@ export interface DataAbilityHelper { * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. * @return Returns the number of data records deleted. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.delete */ delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise; @@ -182,6 +206,8 @@ export interface DataAbilityHelper { * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. * @return Returns the number of data records updated. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.update */ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise; @@ -197,6 +223,8 @@ export interface DataAbilityHelper { * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. * @return Returns the query result {@link ResultSet}. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.query */ query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; query(uri: string, callback: AsyncCallback): void; @@ -219,6 +247,8 @@ export interface DataAbilityHelper { * values of primitive types are supported, but not custom Sequenceable objects. * @return Returns the query result {@link PacMap}. * @FAModelOnly + * @deprecated since 9 + * @useinstead DataAbilityUtils.call */ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; call(uri: string, method: string, arg: string, extras: PacMap): Promise; @@ -231,6 +261,8 @@ export interface DataAbilityHelper { * @param uri Indicates the path of data to query. * @param operations Indicates the data operation list, which can contain multiple operations on the database. * @return Returns the result of each operation, in array {@link DataAbilityResult}. + * @deprecated since 9 + * @useinstead DataAbilityUtils.executeBatch */ executeBatch(uri: string, operations: Array, callback: AsyncCallback>): void; executeBatch(uri: string, operations: Array): Promise>; diff --git a/api/ability/dataAbilityUtils.d.ts b/api/ability/dataAbilityUtils.d.ts index b31170e647..48f49c99ea 100644 --- a/api/ability/dataAbilityUtils.d.ts +++ b/api/ability/dataAbilityUtils.d.ts @@ -15,244 +15,440 @@ import { AsyncCallback } from '../basic'; import ResultSet from '../data/rdb/resultSet'; +import { PacMap } from './dataAbilityHelper'; import { DataAbilityOperation } from './dataAbilityOperation'; import { DataAbilityResult } from './dataAbilityResult'; import dataAbility from '../@ohos.data.dataAbility'; import rdb from '../@ohos.data.rdb'; /** - * DataAbilityHelper + * DataAbilityUtils + * @interface * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * - * @since 7 - * @FAModelOnly + * @famodelonly + * @since 9 */ -export interface DataAbilityHelper { +export interface DataAbilityUtils { /** * Opens a file in a specified remote path. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the file to open. - * @param mode Indicates the file 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, "wa" for write-only access to append to any existing data, "rw" for read and write access on - * any existing data, or "rwt" for read and write access that truncates any existing file. - * @param callback Indicates the callback when openfile success - * @return Returns the file descriptor. - * @FAModelOnly + * @param { string } uri - Indicates the path of the file to open. + * @param { string } mode - Indicates the file 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, "wa" for write-only access to append to any existing data, + * "rw" for read and write access on any existing data, or "rwt" for read and write access + * that truncates any existing file. + * @param { AsyncCallback } callback - The callback is used to return the file descriptor. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 */ openFile(uri: string, mode: string, callback: AsyncCallback): void; + + /** + * Opens a file in a specified remote path. + * @param { string } uri - Indicates the path of the file to open. + * @param { string } mode - Indicates the file 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, "wa" for write-only access to append to any existing data, + * "rw" for read and write access on any existing data, or "rwt" for read and write access + * that truncates any existing file. + * @returns { Promise } Returns the promise of file descriptor. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ openFile(uri: string, mode: string): Promise; /** * Registers an observer to observe data specified by the given uri. - * - * @since 7 + * @param { string } type - dataChange. + * @param { string } uri - Indicates the path of the data to operate. + * @param { AsyncCallback } callback - The callback when dataChange. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the callback when dataChange. - * @return - - * @FAModelOnly + * @famodelonly + * @since 9 */ on(type: 'dataChange', uri: string, callback: AsyncCallback): void; /** * Deregisters all observers used for monitoring data specified by the given uri. - * - * @since 7 + * @param { string } type - dataChange. + * @param { string } uri - Indicates the path of the data to operate. + * @param { AsyncCallback } callback - The callback when dataChange. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the registered callback. - * @return - - * @FAModelOnly + * @famodelonly + * @since 9 */ off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; /** * Obtains the MIME type of the date specified by the given URI. - * - * @since 7 + * @param { string } uri - Indicates the path of the data to operate. + * @param { AsyncCallback } callback - The callback is used to return the MIME type. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the data to operate. - * @return Returns the MIME type that matches the data specified by uri. - * @FAModelOnly + * @famodelonly + * @since 9 */ getType(uri: string, callback: AsyncCallback): void; + + /** + * Obtains the MIME type of the date specified by the given URI. + * @param { string } uri - Indicates the path of the data to operate. + * @returns { Promise } Returns the promise of MIME type that matches the data specified by uri. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ getType(uri: string): Promise; /** * Obtains the MIME types of files supported. - * - * @since 7 + * @param { string } uri - Indicates the path of the files to obtain. + * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain. + * @param { AsyncCallback> } callback - The callback is used to return the matched MIME types Array. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME types of the files to obtain. - * @return Returns the matched MIME types Array. - * @FAModelOnly + * @famodelonly + * @since 9 */ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; + + /** + * Obtains the MIME types of files supported. + * @param { string } uri - Indicates the path of the files to obtain. + * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain. + * @returns { Promise> } Returns the promise of matched MIME types Array. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ getFileTypes(uri: string, mimeTypeFilter: string): Promise>; /** * Converts the given uri that refers to the Data ability into a normalized uri. - * - * @since 7 + * @param { string } uri - Indicates the uri object to normalize. + * @param { AsyncCallback } callback - The callback is used to return the normalized uri object. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the uri object to normalize. - * @return Returns the normalized uri object if the Data ability supports URI normalization or null. - * @FAModelOnly + * @famodelonly + * @since 9 */ normalizeUri(uri: string, callback: AsyncCallback): void; + + /** + * Converts the given uri that refers to the Data ability into a normalized uri. + * @param { string } uri - Indicates the uri object to normalize. + * @returns { Promise } Returns the promise of normalized uri object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ normalizeUri(uri: string): Promise; /** * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. - * - * @since 7 + * @param { string } uri - Indicates the uri object to normalize. + * @param { AsyncCallback } callback - The callback is used to return the denormalized uri object. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the uri object to normalize. - * @return Returns the denormalized uri object if the denormalization is successful. - * @FAModelOnly + * @famodelonly + * @since 9 */ denormalizeUri(uri: string, callback: AsyncCallback): void; + + /** + * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. + * @param { string } uri - Indicates the uri object to normalize. + * @returns { Promise } Returns the denormalized uri object. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ denormalizeUri(uri: string): Promise; /** * Notifies the registered observers of a change to the data resource specified by uri. - * - * @since 7 + * @param { string } uri - Indicates the path of the data to operate. + * @param { AsyncCallback } callback - The callback of notifyChange. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the data to operate. - * @return - - * @FAModelOnly + * @famodelonly + * @since 9 */ notifyChange(uri: string, callback: AsyncCallback): void; + + /** + * Notifies the registered observers of a change to the data resource specified by uri. + * @param { string } uri - Indicates the path of the data to operate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ notifyChange(uri: string): Promise; /** * Inserts a single data record into the database. - * - * @since 7 + * @param { string } uri - Indicates the path of the data to insert. + * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, + * a blank row will be inserted. + * @param { AsyncCallback } callback - The callback is used to return the index of the inserted data record. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the data to insert. - * @param valuesBucket Indicates the data record to insert. If this parameter is null, a blank row will be inserted. - * @return Returns the index of the inserted data record. - * @FAModelOnly + * @famodelonly + * @since 9 */ insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; + + /** + * Inserts a single data record into the database. + * @param { string } uri - Indicates the path of the data to insert. + * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, + * a blank row will be inserted. + * @returns { Promise } Returns the index of the inserted data record. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise; /** * Inserts multiple data records into the database. - * - * @since 7 + * @param { string } uri - Indicates the path of the data to batchInsert. + * @param { Array } valuesBuckets - Indicates the data records to insert. + * @param { AsyncCallback } callback - The callback is used to return the number of data records inserted. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the data to batchInsert. - * @param valuesBuckets Indicates the data records to insert. - * @return Returns the number of data records inserted. - * @FAModelOnly + * @famodelonly + * @since 9 */ batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback): void; + + /** + * Inserts multiple data records into the database. + * @param { string } uri - Indicates the path of the data to batchInsert. + * @param { Array } valuesBuckets - Indicates the data records to insert. + * @returns { Promise } Returns the number of data records inserted. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ batchInsert(uri: string, valuesBuckets: Array): Promise; /** * Deletes one or more data records from the database. - * - * @since 7 + * @param { string } uri - Indicates the path of the data to delete. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the + * processing logic when this parameter is null. + * @param { AsyncCallback } callback - The callback is used to return the number of data records deleted. + * @returns { Promise } Returns the number of data records deleted. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the data to delete. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records deleted. - * @FAModelOnly + * @famodelonly + * @since 9 */ delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + + /** + * Deletes one or more data records from the database. + * @param { string } uri - Indicates the path of the data to delete. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the + * processing logic when this parameter is null. + * @returns { Promise } Returns the number of data records deleted. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise; + + /** + * Deletes one or more data records from the database. + * @param { string } uri - Indicates the path of the data to delete. + * @param { AsyncCallback } callback - The callback is used to return the number of data records deleted. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ delete(uri: string, callback: AsyncCallback): void; /** * Updates data records in the database. - * - * @since 7 + * @param { string } uri - Indicates the path of data to update. + * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define + * the processing logic when this parameter is null. + * @param { AsyncCallback } callback - The callback is used to return the number of data records updated. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of data to update. - * @param valuesBucket Indicates the data to update. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records updated. - * @FAModelOnly + * @famodelonly + * @since 9 */ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + + /** + * Updates data records in the database. + * @param { string } uri - Indicates the path of data to update. + * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define + * the processing logic when this parameter is null. + * @returns { Promise } Returns the number of data records updated. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise; + + /** + * Updates data records in the database. + * @param { string } uri - Indicates the path of data to update. + * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. + * @param { AsyncCallback } callback - The callback is used to return the number of data records updated. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ update(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; /** * Queries data in the database. - * - * @since 7 + * @param { string } uri - Indicates the path of data to query. + * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define + * the processing logic when this parameter is null. + * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of data to query. - * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the query result {@link ResultSet}. - * @FAModelOnly + * @famodelonly + * @since 9 */ query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + + /** + * Queries data in the database. + * @param { string } uri - Indicates the path of data to query. + * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ query(uri: string, callback: AsyncCallback): void; + + /** + * Queries data in the database. + * @param { string } uri - Indicates the path of data to query. + * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. + * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ query(uri: string, columns: Array, callback: AsyncCallback): void; + + /** + * Queries data in the database. + * @param { string } uri - Indicates the path of data to query. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define + * the processing logic when this parameter is null. + * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ query(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + + /** + * Queries data in the database. + * @param { string } uri - Indicates the path of data to query. + * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define + * the processing logic when this parameter is null. + * @returns { Promise } Returns the query result {@link ResultSet}. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ query(uri: string, columns?: Array, predicates?: dataAbility.DataAbilityPredicates): Promise; /** * Calls the extended API of the DataAbility. This method uses a promise to return the result. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx" - * @param method Indicates the method to call. - * @param arg Indicates the parameter of the String type. - * @param extras Indicates the parameter of the PacMap type. + * @param { string } uri - URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx" + * @param { string } method - Indicates the method to call. + * @param { string } arg - Indicates the parameter of the String type. + * @param { PacMap } extras - Indicates the parameter of the PacMap type. * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. * If the PacMap object is to be transferred to a non-OHOS process, * values of primitive types are supported, but not custom Sequenceable objects. - * @return Returns the query result {@link PacMap}. - * @FAModelOnly + * @param { AsyncCallback } callback - The callback is used to return the query result {@link PacMap}. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 */ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; + + /** + * Calls the extended API of the DataAbility. This method uses a promise to return the result. + * @param { string } uri - URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx" + * @param { string } method - Indicates the method to call. + * @param { string } arg - Indicates the parameter of the String type. + * @param { PacMap } extras - Indicates the parameter of the PacMap type. + * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, + * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. + * If the PacMap object is to be transferred to a non-OHOS process, + * values of primitive types are supported, but not custom Sequenceable objects. + * @returns { Promise } Returns the query result {@link PacMap}. + * @throws { BusinessError } If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ call(uri: string, method: string, arg: string, extras: PacMap): Promise; /** * Queries data in the database. - * - * @since 7 + * @param { string } uri - Indicates the path of data to query. + * @param { Array } operations - Indicates the data operation list, which can contain + * multiple operations on the database. + * @param { AsyncCallback> } callback - The callback is used to return the result of each + * operation, in array {@link DataAbilityResult}. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of data to query. - * @param operations Indicates the data operation list, which can contain multiple operations on the database. - * @return Returns the result of each operation, in array {@link DataAbilityResult}. + * @famodelonly + * @since 9 */ executeBatch(uri: string, operations: Array, callback: AsyncCallback>): void; - executeBatch(uri: string, operations: Array): Promise>; -} - -/** - * Defines a PacMap object for storing a series of values. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly - */ -export interface PacMap { /** - * Indicates the parameter of the PacMap type. - * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, - * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. - * If the PacMap object is to be transferred to a non-OHOS process, - * values of primitive types are supported, but not custom Sequenceable objects. - * @since 7 + * Queries data in the database. + * @param { string } uri - Indicates the path of data to query. + * @param { Array } operations - Indicates the data operation list, which can contain + * multiple operations on the database. + * @returns { Promise> } Returns the result of each operation, in array {@link DataAbilityResult}. + * @throws { BusinessError } If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly + * @famodelonly + * @since 9 */ - [key: string]: number | string | boolean | Array | null; + executeBatch(uri: string, operations: Array): Promise>; } -- Gitee From 6d354c0e7396f8b071deddcf3deffad5def13fd4 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 19 Sep 2022 11:53:52 +0800 Subject: [PATCH 03/34] IssueNo: #I5RT32 Description: add Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: I9233372b40e917c757a811af0d0331ba047ac9aa --- api/@ohos.app.ability.Ability.d.ts | 317 +++++++++++++++++ api/@ohos.app.ability.AbilityContext.d.ts | 316 +++++++++++++++++ api/@ohos.app.ability.ApplicationContext.d.ts | 75 ++++ api/@ohos.app.ability.Context.d.ts | 195 +++++++++++ api/@ohos.app.ability.EventHub.d.ts | 60 ++++ ...s.app.ability.ServiceExtensionContext.d.ts | 192 ++++++++++ api/@ohos.app.ability.abilityDelegator.d.ts | 209 +++++++++++ api/@ohos.app.ability.abilityManager.d.ts | 114 ++++++ ... @ohos.app.ability.dataAbilityHelper.d.ts} | 0 api/@ohos.app.ability.dataUriUtils.d.ts | 67 ++++ api/@ohos.app.ability.errorManager.d.ts | 59 ++++ api/@ohos.app.ability.missionManager.d.ts | 186 ++++++++++ api/@ohos.app.ability.quickFixManager.d.ts | 153 ++++++++ api/@ohos.app.featureAbility.context.d.ts | 328 ++++++++++++++++++ api/@ohos.app.featureAbility.d.ts | 246 +++++++++++++ api/@ohos.app.form.FormExtensionContext.d.ts | 43 +++ api/@ohos.app.particleAbility.d.ts | 124 +++++++ api/@ohos.app.wantAgent.d.ts | 267 ++++++++++++++ 18 files changed, 2951 insertions(+) create mode 100755 api/@ohos.app.ability.Ability.d.ts create mode 100644 api/@ohos.app.ability.AbilityContext.d.ts create mode 100644 api/@ohos.app.ability.ApplicationContext.d.ts create mode 100644 api/@ohos.app.ability.Context.d.ts create mode 100644 api/@ohos.app.ability.EventHub.d.ts create mode 100644 api/@ohos.app.ability.ServiceExtensionContext.d.ts create mode 100644 api/@ohos.app.ability.abilityDelegator.d.ts create mode 100644 api/@ohos.app.ability.abilityManager.d.ts rename api/{ability/dataAbilityUtils.d.ts => @ohos.app.ability.dataAbilityHelper.d.ts} (100%) create mode 100644 api/@ohos.app.ability.dataUriUtils.d.ts create mode 100644 api/@ohos.app.ability.errorManager.d.ts create mode 100644 api/@ohos.app.ability.missionManager.d.ts create mode 100644 api/@ohos.app.ability.quickFixManager.d.ts create mode 100644 api/@ohos.app.featureAbility.context.d.ts create mode 100644 api/@ohos.app.featureAbility.d.ts create mode 100644 api/@ohos.app.form.FormExtensionContext.d.ts create mode 100644 api/@ohos.app.particleAbility.d.ts create mode 100644 api/@ohos.app.wantAgent.d.ts diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts new file mode 100755 index 0000000000..99cfd35561 --- /dev/null +++ b/api/@ohos.app.ability.Ability.d.ts @@ -0,0 +1,317 @@ +/* + * 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 + * + * 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 AbilityConstant from "./@ohos.application.AbilityConstant"; +import AbilityContext from "./application/AbilityContext"; +import Want from './@ohos.application.Want'; +import window from './@ohos.window'; +import { Configuration } from './@ohos.application.Configuration'; +import rpc from './@ohos.rpc'; + +/** + * The prototype of the listener function interface registered by the Caller. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @param msg Monitor status notification information. + * @return - + * @StageModelOnly + */ +export interface OnReleaseCallBack { + (msg: string): void; +} + +/** + * The prototype of the message listener function interface registered by the Callee. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @param indata Notification data notified from the caller. + * @return rpc.Sequenceable + * @StageModelOnly + */ +export interface CalleeCallBack { + (indata: rpc.MessageParcel): rpc.Sequenceable; +} + +/** + * The interface of a Caller. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @StageModelOnly + */ +export interface Caller { + /** + * Notify the server of Sequenceable type data. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method The notification event string listened to by the callee. + * @param data Notification data to the callee. + * @return - + * @StageModelOnly + */ + call(method: string, data: rpc.Sequenceable): Promise; + + /** + * Notify the server of Sequenceable type data and return the notification result. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method The notification event string listened to by the callee. + * @param data Notification data to the callee. + * @return Returns the callee's notification result data on success, and returns undefined on failure. + * @StageModelOnly + */ + callWithResult(method: string, data: rpc.Sequenceable): Promise; + + /** + * Clear service records. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + release(): void; + + /** + * Register death listener notification callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param callback Register a callback function for listening for notifications. + * @return - + * @StageModelOnly + */ + onRelease(callback: OnReleaseCallBack): void; + } + + /** + * The interface of a Callee. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @StageModelOnly + */ +export interface Callee { + + /** + * Register data listener callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method A string registered to listen for notification events. + * @param callback Register a callback function that listens for notification events. + * @return - + * @StageModelOnly + */ + on(method: string, callback: CalleeCallBack): void; + + /** + * Unregister data listener callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method A string registered to listen for notification events. + * @return - + * @StageModelOnly + */ + off(method: string): void; + } + +/** + * The class of an ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @StageModelOnly + */ +export default class Ability { + /** + * Indicates configuration information about an ability context. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + context: AbilityContext; + + /** + * Indicates ability launch want. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + launchWant: Want; + + /** + * Indicates ability last request want. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + lastRequestWant: Want; + + /** + * Call Service Stub Object. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + callee: Callee; + + /** + * Called back when an ability is started for initialization. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param want Indicates the want info of the created ability. + * @param param Indicates the launch param. + * @return - + * @StageModelOnly + */ + onCreate(want: Want, param: AbilityConstant.LaunchParam): void; + + /** + * Called back when an ability window stage is created. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param windowStage Indicates the created WindowStage. + * @return - + * @StageModelOnly + */ + onWindowStageCreate(windowStage: window.WindowStage): void; + + /** + * Called back when an ability window stage is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onWindowStageDestroy(): void; + + /** + * Called back when an ability window stage is restored. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param windowStage window stage to restore + * @return - + * @StageModelOnly + */ + onWindowStageRestore(windowStage: window.WindowStage): void; + + /** + * Called back before an ability is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onDestroy(): void; + + /** + * Called back when the state of an ability changes to foreground. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onForeground(): void; + + /** + * Called back when the state of an ability changes to background. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onBackground(): void; + + /** + * Called back when an ability prepares to continue. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param wantParam Indicates the want parameter. + * @return 0 if ability agrees to continue and saves data successfully, otherwise errcode. + * @StageModelOnly + */ + onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; + + /** + * Called when the launch mode of an ability is set to singleton. + * This happens when you re-launch an ability that has been at the top of the ability stack. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param want Indicates the want info of ability. + * @param launchParams Indicates the launch parameters. + * @return - + * @StageModelOnly + */ + onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; + + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param config Indicates the updated configuration. + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; + + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param params Indicates the params from command. + * @return The dump info array. + * @StageModelOnly + */ + dump(params: Array): Array; + + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param level Indicates the memory trim level, which shows the current memory usage status. + * @return - + * @StageModelOnly + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; +} diff --git a/api/@ohos.app.ability.AbilityContext.d.ts b/api/@ohos.app.ability.AbilityContext.d.ts new file mode 100644 index 0000000000..4febfbf618 --- /dev/null +++ b/api/@ohos.app.ability.AbilityContext.d.ts @@ -0,0 +1,316 @@ +/* + * 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 + * + * 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 { AbilityInfo } from "../bundle/abilityInfo"; +import { AbilityResult } from "../ability/abilityResult"; +import { AsyncCallback } from "../basic"; +import { ConnectOptions } from "../ability/connectOptions"; +import { HapModuleInfo } from "../bundle/hapModuleInfo"; +import Context from "./Context"; +import Want from "../@ohos.application.Want"; +import StartOptions from "../@ohos.application.StartOptions"; +import PermissionRequestResult from "./PermissionRequestResult"; +import { Configuration } from '../@ohos.application.Configuration'; +import Caller from '../@ohos.application.Ability'; +import { LocalStorage } from 'StateManagement'; +import image from '../@ohos.multimedia.image'; + +/** + * The context of an ability. It allows access to ability-specific resources. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @StageModelOnly + */ +export default class AbilityContext extends Context { + /** + * Indicates configuration information about an ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + abilityInfo: AbilityInfo; + + /** + * Indicates configuration information about an module. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + currentHapModuleInfo: HapModuleInfo; + + /** + * Indicates configuration information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + config: Configuration; + + /** + * Starts a new ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @param options Indicates the start options. + * @return - + * @StageModelOnly + */ + startAbility(want: Want, callback: AsyncCallback): void; + startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + startAbility(want: Want, options?: StartOptions): Promise; + + /** + * Get the caller object of the startup capability + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @return Returns to the Caller interface on success Returns empty or undefined on failure + * @StageModelOnly + */ + startAbilityByCall(want: Want): Promise; + + /** + * Starts a new ability with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @param accountId Indicates the account to start. + * @param options Indicates the start options. + * @systemapi hide for inner use. + * @return - + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @StageModelOnly + */ + startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @param options Indicates the start options. + * @return Returns the {@link AbilityResult}. + * @StageModelOnly + */ + startAbilityForResult(want: Want, callback: AsyncCallback): void; + startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + startAbilityForResult(want: Want, options?: StartOptions): Promise; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @param accountId Indicates the account to start. + * @param options Indicates the start options. + * @systemapi hide for inner use. + * @return Returns the {@link AbilityResult}. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @StageModelOnly + */ + startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + + /** + * Starts a new service extension ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + startServiceExtensionAbility(want: Want): Promise; + + /** + * Starts a new service extension ability with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @param accountId Indicates the account to start. + * @systemapi hide for inner use. + * @return - + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @StageModelOnly + */ + startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + + /** + * Stops a service within the same application. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + stopServiceExtensionAbility(want: Want): Promise; + + /** + * Stops a service within the same application with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @param accountId Indicates the accountId to start. + * @systemapi hide for inner use. + * @return - + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @StageModelOnly + */ + stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + + /** + * Destroys this Page ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return - + * @StageModelOnly + */ + terminateSelf(callback: AsyncCallback): void; + terminateSelf(): Promise; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param parameter Indicates the result to return. + * @return - + * @StageModelOnly + */ + terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + terminateSelfWithResult(parameter: AbilityResult): Promise; + + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want The element name of the service ability + * @param options The remote object instance + * @systemapi Hide this for inner system use. + * @return Returns the number code of the ability connected + * @StageModelOnly + */ + connectAbility(want: Want, options: ConnectOptions): number; + + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want The element name of the service ability + * @param accountId The account to connect + * @param options The remote object instance + * @systemapi hide for inner use. + * @return Returns the number code of the ability connected + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @StageModelOnly + */ + connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * The callback interface was connect successfully. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param connection The number code of the ability connected + * @systemapi Hide this for inner system use. + * @StageModelOnly + */ + disconnectAbility(connection: number, callback:AsyncCallback): void; + disconnectAbility(connection: number): Promise; + + /** + * Set mission label of current ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param label The label of ability that showed in recent missions. + * @StageModelOnly + */ + setMissionLabel(label: string, callback:AsyncCallback): void; + setMissionLabel(label: string): Promise; + + /** + * Set mission icon of current ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param icon The icon of ability that showed in recent missions. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + setMissionIcon(icon: image.PixelMap, callback:AsyncCallback): void; + setMissionIcon(icon: image.PixelMap): Promise; + + /** + * Requests certain permissions from the system. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @return Returns the {@link PermissionRequestResult}. + * @StageModelOnly + */ + requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback) : void; + requestPermissionsFromUser(permissions: Array) : Promise; + + /** + * Restore window stage data in ability continuation + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param LocalStorage the storage data used to restore window stage + * @StageModelOnly + */ + restoreWindowStage(localStorage: LocalStorage) : void; + + /** + * check to see ability is in terminating state. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return Returns true when ability is in terminating state, else returns false. + * @StageModelOnly + */ + isTerminating(): boolean; +} diff --git a/api/@ohos.app.ability.ApplicationContext.d.ts b/api/@ohos.app.ability.ApplicationContext.d.ts new file mode 100644 index 0000000000..2f605c61cf --- /dev/null +++ b/api/@ohos.app.ability.ApplicationContext.d.ts @@ -0,0 +1,75 @@ +/* + * 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 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. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @StageModelOnly + */ +export default class ApplicationContext extends Context { + /** + * Register ability lifecycle callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param callback The ability lifecycle callback. + * @return Returns the number code of the callback. + * @StageModelOnly + */ + registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; + + /** + * Unregister ability lifecycle callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param callbackId Indicates the number code of the callback. + * @return - + * @StageModelOnly + */ + 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; +} diff --git a/api/@ohos.app.ability.Context.d.ts b/api/@ohos.app.ability.Context.d.ts new file mode 100644 index 0000000000..26c6eadcad --- /dev/null +++ b/api/@ohos.app.ability.Context.d.ts @@ -0,0 +1,195 @@ +/* + * 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 + * + * 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 { ApplicationInfo } from "../bundle/applicationInfo"; +import resmgr from "../@ohos.resourceManager"; +import BaseContext from "./BaseContext"; +import EventHub from "./EventHub"; +import ApplicationContext from "./ApplicationContext"; + +/** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @StageModelOnly + */ +export default class Context extends BaseContext { + /** + * Indicates the capability of accessing application resources. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + resourceManager: resmgr.ResourceManager; + + /** + * Indicates configuration information about an application. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + applicationInfo: ApplicationInfo; + + /** + * Indicates app cache dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + cacheDir: string; + + /** + * Indicates app temp dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + tempDir: string; + + /** + * Indicates app files dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + filesDir : string; + + /** + * Indicates app database dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + databaseDir : string; + + /** + * Indicates app preferences dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + preferencesDir : string; + + /** + * Indicates app bundle code dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + bundleCodeDir : string; + + /** + * Indicates app distributed files dir. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + distributedFilesDir: string; + + /** + * Indicates event hub. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + eventHub: EventHub; + + /** + * Indicates file area. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + area: AreaMode; + + /** + * Create a bundle context + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @param bundleName Indicates the bundle name. + * @return application context + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @StageModelOnly + */ + createBundleContext(bundleName: string): Context; + + /** + * Create a module context + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param moduleName Indicates the module name. + * @return application context + * @StageModelOnly + */ + createModuleContext(moduleName: string): Context; + + /** + * Create a module context + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @param bundleName Indicates the bundle name. + * @param moduleName Indicates the module name. + * @return application context + * @StageModelOnly + */ + createModuleContext(bundleName: string, moduleName: string): Context; + + /** + * Get application context + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return application context + * @StageModelOnly + */ + getApplicationContext(): ApplicationContext; +} + +/** + * File area mode + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ +export enum AreaMode { + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL1 = 0, + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL2 = 1 +} diff --git a/api/@ohos.app.ability.EventHub.d.ts b/api/@ohos.app.ability.EventHub.d.ts new file mode 100644 index 0000000000..7fe3d203ca --- /dev/null +++ b/api/@ohos.app.ability.EventHub.d.ts @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2021 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 event center of a context, support the subscription and publication of events. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @StageModelOnly + */ +export default class EventHub { + /** + * Subscribe to an event. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param event Indicates the event. + * @param callback Indicates the callback. + * @return - + * @StageModelOnly + */ + on(event: string, callback: Function): void + + /** + * Unsubscribe from an event. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param event Indicates the event. + * @param callback Indicates the callback. + * @return - + * @StageModelOnly + */ + off(event: string, callback?: Function): void + + /** + * Trigger the event callbacks. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param event Indicates the event. + * @param args Indicates the callback arguments. + * @return - + * @StageModelOnly + */ + emit(event: string, ...args: Object[]): void +} \ No newline at end of file diff --git a/api/@ohos.app.ability.ServiceExtensionContext.d.ts b/api/@ohos.app.ability.ServiceExtensionContext.d.ts new file mode 100644 index 0000000000..dd21ca7d0a --- /dev/null +++ b/api/@ohos.app.ability.ServiceExtensionContext.d.ts @@ -0,0 +1,192 @@ +/* + * 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 + * + * 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 { ConnectOptions } from "../ability/connectOptions"; +import Caller from '../@ohos.application.Ability'; +import ExtensionContext from "./ExtensionContext"; +import Want from "../@ohos.application.Want"; +import StartOptions from "../@ohos.application.StartOptions"; + +/** + * The context of service extension. It allows access to + * serviceExtension-specific resources. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @permission N/A + * @StageModelOnly + */ +export default class ServiceExtensionContext extends ExtensionContext { + /** + * Service extension uses this method to start a specific ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @param options Indicates the start options. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + startAbility(want: Want, callback: AsyncCallback): void; + startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + startAbility(want: Want, options?: StartOptions): Promise; + + /** + * Service extension uses this method to start a specific ability with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @param accountId Indicates the accountId to start. + * @param options Indicates the start options. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; + + /** + * Starts a new service extension ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + startServiceExtensionAbility(want: Want): Promise; + + /** + * Starts a new service extension ability with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @param accountId Indicates the account to start. + * @systemapi hide for inner use. + * @return - + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @StageModelOnly + */ + startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + + /** + * Stops a service within the same application. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + stopServiceExtensionAbility(want: Want): Promise; + + /** + * Stops a service within the same application with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info to start. + * @param accountId Indicates the accountId to start. + * @systemapi hide for inner use. + * @return - + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @StageModelOnly + */ + stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; + + /** + * Destroys this service extension. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + terminateSelf(callback: AsyncCallback): void; + terminateSelf(): Promise; + + /** + * Connects an ability to a Service extension. + * + *

This method can be called by an ability or service extension, but the destination of the connection must be a + * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target + * service extension when the Service extension is connected.

+ * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the service extension to connect. + * @param options Indicates the callback of connection. + * @systemapi hide for inner use. + * @return connection id, int value. + * @StageModelOnly + */ + connectAbility(want: Want, options: ConnectOptions): number; + + /** + * Connects an ability to a Service extension with account. + * + *

This method can be called by an ability or service extension, but the destination of the connection must be a + * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target + * service extension when the Service extension is connected.

+ * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the service extension to connect. + * @param accountId Indicates the account to connect. + * @param options Indicates the callback of connection. + * @systemapi hide for inner use. + * @return connection id, int value. + * @StageModelOnly + */ + connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * Disconnects an ability to a service extension, in contrast to + * {@link connectAbility}. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param connection the connection id returned from connectAbility api. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + disconnectAbility(connection: number, callback:AsyncCallback): void; + disconnectAbility(connection: number): Promise; + + /** + * Get the caller object of the startup capability + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start. + * @return Returns to the Caller interface on success Returns empty or undefined on failure + * @StageModelOnly + */ + startAbilityByCall(want: Want): Promise; +} \ No newline at end of file diff --git a/api/@ohos.app.ability.abilityDelegator.d.ts b/api/@ohos.app.ability.abilityDelegator.d.ts new file mode 100644 index 0000000000..d6e08d73b2 --- /dev/null +++ b/api/@ohos.app.ability.abilityDelegator.d.ts @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2021 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 Ability from '../@ohos.application.Ability'; +import AbilityStage from '../@ohos.application.AbilityStage'; +import { AbilityMonitor } from './abilityMonitor'; +import { AbilityStageMonitor } from './abilityStageMonitor'; +import Context from './Context'; +import Want from "../@ohos.application.Want"; +import { ShellCmdResult } from './shellCmdResult'; + +/** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import AbilityDelegator from 'application/abilityDelegator.d' + * @permission N/A + */ +export interface AbilityDelegator { + /** + * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param monitor AbilityMonitor object + */ + addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + addAbilityMonitor(monitor: AbilityMonitor): Promise; + + /** + * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param monitor AbilityStageMonitor object + */ + addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + + /** + * Remove a specified AbilityMonitor object from the application memory. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param monitor AbilityMonitor object + */ + removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + removeAbilityMonitor(monitor: AbilityMonitor): Promise; + + /** + * Remove a specified AbilityStageMonitor object from the application memory. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param monitor AbilityStageMonitor object + */ + removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param monitor AbilityMonitor object + * @param timeout Maximum wait time, in milliseconds + * @return success: return the Ability object, failure: return null + */ + waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback): void; + waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param monitor AbilityStageMonitor object + * @param timeout Maximum wait time, in milliseconds + * @return success: return the AbilityStage object, failure: return null + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; + + /** + * Obtain the application context. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return App Context + */ + getAppContext(): Context; + + /** + * Obtain the lifecycle state of a specified ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param ability The Ability object + * @return The state of the Ability object. enum AbilityLifecycleState + */ + getAbilityState(ability: Ability): number; + + /** + * Obtain the ability that is currently being displayed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return The top ability of the current application + */ + getCurrentTopAbility(callback: AsyncCallback): void; + getCurrentTopAbility(): Promise + + /** + * Start a new ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the ability to start + * @return - + */ + startAbility(want: Want, callback: AsyncCallback): void; + startAbility(want: Want): Promise; + + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param ability The ability object + * @return true: success false: failure + */ + doAbilityForeground(ability: Ability, callback: AsyncCallback): void; + doAbilityForeground(ability: Ability): Promise; + + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param ability The ability object + * @return true: success false: failure + */ + doAbilityBackground(ability: Ability, callback: AsyncCallback): void; + doAbilityBackground(ability: Ability): Promise; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param msg Log information + */ + print(msg: string, callback: AsyncCallback): void; + print(msg: string): Promise; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param msg Log information + */ + printSync(msg: string): void; + + /** + * Execute the given command in the aa tools side. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param cmd Shell command + * @param timeoutSecs Timeout, in seconds + * @return ShellCmdResult object + */ + executeShellCommand(cmd: string, callback: AsyncCallback): void; + executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; + executeShellCommand(cmd: string, timeoutSecs?: number): Promise; + + /** + * Finish the test and print log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param msg Log information + * @param code Result code + */ + finishTest(msg: string, code: number, callback: AsyncCallback): void; + finishTest(msg: string, code: number): Promise; +} + +export default AbilityDelegator; diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts new file mode 100644 index 0000000000..298aae74f4 --- /dev/null +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -0,0 +1,114 @@ +/* + * 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 + * + * 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 { Configuration } from './@ohos.application.Configuration'; +import { AbilityRunningInfo as _AbilityRunningInfo } from './application/AbilityRunningInfo'; +import { ExtensionRunningInfo as _ExtensionRunningInfo } from './application/ExtensionRunningInfo'; +import { ElementName } from './bundle/elementName'; + +/** + * The class of an ability manager. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi Hide this for inner system use + * @permission N/A + */ +declare namespace abilityManager { + /** + * @name AbilityState + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi Hide this for inner system use. + * @permission N/A + */ + export enum AbilityState { + INITIAL = 0, + FOREGROUND = 9, + BACKGROUND = 10, + FOREGROUNDING = 11, + BACKGROUNDING = 12 + } + + /** + * Updates the configuration by modifying the configuration. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param config Indicates the new configuration. + * @systemapi Hide this for inner system use. + * @return - + * @permission ohos.permission.UPDATE_CONFIGURATION + */ + function updateConfiguration(config: Configuration, callback: AsyncCallback): void; + function updateConfiguration(config: Configuration): Promise; + + /** + * Get information about running abilitys + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi Hide this for inner system use. + * @return Returns the array of {@link AbilityRunningInfo}. + * @permission ohos.permission.GET_RUNNING_INFO + */ + function getAbilityRunningInfos(): Promise>; + function getAbilityRunningInfos(callback: AsyncCallback>): void; + + /** + * Get information about running extensions + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param upperLimit Get the maximum limit of the number of messages + * @systemapi Hide this for inner system use. + * @return Returns the array of {@link ExtensionRunningInfo}. + * @permission ohos.permission.GET_RUNNING_INFO + */ + function getExtensionRunningInfos(upperLimit: number): Promise>; + function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback>): void; + + /** + * Get the top ability information of the display. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi Hide this for inner system use. + * @return Returns the {@link ElementName} info of the top ability. + */ + function getTopAbility(): Promise; + function getTopAbility(callback: AsyncCallback): void; + + /** + * The class of an ability running information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + */ + export type AbilityRunningInfo = _AbilityRunningInfo + + /** + * The class of an extension running information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + */ + export type ExtensionRunningInfo = _ExtensionRunningInfo +} + +export default abilityManager; \ No newline at end of file diff --git a/api/ability/dataAbilityUtils.d.ts b/api/@ohos.app.ability.dataAbilityHelper.d.ts similarity index 100% rename from api/ability/dataAbilityUtils.d.ts rename to api/@ohos.app.ability.dataAbilityHelper.d.ts diff --git a/api/@ohos.app.ability.dataUriUtils.d.ts b/api/@ohos.app.ability.dataUriUtils.d.ts new file mode 100644 index 0000000000..0d8dafaee4 --- /dev/null +++ b/api/@ohos.app.ability.dataUriUtils.d.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2021 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. + */ + +/** + * A utility class used for handling objects that use the DataAbilityHelper scheme. + * @name dataUriUtils + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + */ +declare namespace dataUriUtils { + /** + * Obtains the ID attached to the end of the path component of the given uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param uri Indicates the uri object from which the ID is to be obtained. + * @return Returns the ID attached to the end of the path component; + */ + function getId(uri: string): number + + /** + * Attaches the given ID to the end of the path component of the given uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param uri Indicates the uri string from which the ID is to be obtained. + * @param id Indicates the ID to attach. + * @return Returns the uri object with the given ID attached. + */ + function attachId(uri: string, id: number): string + + /** + * Deletes the ID from the end of the path component of the given uri. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param uri Indicates the uri object from which the ID is to be deleted. + * @return Returns the uri object with the ID deleted. + */ + function deleteId(uri: string): string + + /** + * Updates the ID in the specified uri + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param uri Indicates the uri object to be updated. + * @param id Indicates the new ID. + * @return Returns the updated uri object. + */ + function updateId(uri: string, id: number): string + +} +export default dataUriUtils; \ No newline at end of file diff --git a/api/@ohos.app.ability.errorManager.d.ts b/api/@ohos.app.ability.errorManager.d.ts new file mode 100644 index 0000000000..dda4361c79 --- /dev/null +++ b/api/@ohos.app.ability.errorManager.d.ts @@ -0,0 +1,59 @@ +/* + * 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 * as _ErrorObserver from './application/ErrorObserver'; + +/** + * This module provides the function of error manager. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import errorManager from '@ohos.application.errorManager' + * @permission N/A + */ +declare namespace errorManager { + /** + * Register error observer. + * + * @default - + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observer The error observer. + * @return Returns the number code of the observer. + */ + function registerErrorObserver(observer: ErrorObserver): number; + + /** + * Unregister error observer. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observerId Indicates the number code of the observer. + * @return - + */ + function unregisterErrorObserver(observerId: number, callback: AsyncCallback): void; + function unregisterErrorObserver(observerId: number): Promise; + + /** + * The observer will be called by system when an error occurs. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export type ErrorObserver = _ErrorObserver.default +} + +export default errorManager; diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts new file mode 100644 index 0000000000..4147a91829 --- /dev/null +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -0,0 +1,186 @@ +/* + * 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 + * + * 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 { MissionInfo as _MissionInfo } from './application/MissionInfo'; +import { MissionListener as _MissionListener } from './application/MissionListener'; +import { MissionSnapshot as _MissionSnapshot } from './application/MissionSnapshot'; +import StartOptions from "./@ohos.application.StartOptions"; + +/** + * This module provides the capability to manage abilities and obtaining system task information. + * + * @name missionManager + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @permission ohos.permission.MANAGE_MISSIONS + * @systemapi hide for inner use. + */ +declare namespace missionManager { + /** + * Register the missionListener to ams. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param listener Indicates the MissionListener to be registered. + * @return The index number of the MissionListener. + */ + function registerMissionListener(listener: MissionListener): number; + + /** + * Unrgister the missionListener to ams. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param listenerId Indicates the listener id to be unregistered. + * @return - + */ + function unregisterMissionListener(listenerId: number, callback: AsyncCallback): void; + function unregisterMissionListener(listenerId: number): Promise; + + /** + * Get the missionInfo with the given missionId. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param deviceId Indicates the device to be queried. + * @param missionId Indicates mission id to be queried. + * @return the {@link MissionInfo} of the given id. + */ + function getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback): void; + function getMissionInfo(deviceId: string, missionId: number): Promise; + + /** + * Get the missionInfo with the given missionId. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param deviceId Indicates the device to be queried. + * @param numMax Indicates the maximum number of returned missions. + * @return The array of the {@link MissionInfo}. + */ + function getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback>): void; + function getMissionInfos(deviceId: string, numMax: number): Promise>; + + /** + * Get the mission snapshot with the given missionId. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param deviceId Indicates the device to be queried. + * @param missionId Indicates mission id to be queried. + * @return The {@link MissionSnapshot} of the given id. + */ + function getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; + function getMissionSnapShot(deviceId: string, missionId: number): Promise; + + /** + * Get the mission low resolution snapshot with the given missionId. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param deviceId Indicates the device to be queried. + * @param missionId Indicates mission id to be queried. + * @return The {@link MissionSnapshot} of the given id. + */ + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise; + + /** + * Lock the mission. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param missionId Indicates mission id to be locked. + * @return - + */ + function lockMission(missionId: number, callback: AsyncCallback): void; + function lockMission(missionId: number): Promise; + + /** + * Unlock the mission. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param missionId Indicates mission id to be unlocked. + * @return - + */ + function unlockMission(missionId: number, callback: AsyncCallback): void; + function unlockMission(missionId: number): Promise; + + /** + * Clear the given mission in the ability manager service. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param missionId Indicates mission id to be cleared. + * @return - + */ + function clearMission(missionId: number, callback: AsyncCallback): void; + function clearMission(missionId: number): Promise; + + /** + * Clear all missions in the ability manager service. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @return - + */ + function clearAllMissions(callback: AsyncCallback): void; + function clearAllMissions(): Promise; + + /** + * Schedule the given mission to foreground. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @param missionId Indicates mission id to be moved to foreground. + * @param options Indicates the start options. + * @return - + */ + function moveMissionToFront(missionId: number, callback: AsyncCallback): void; + function moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCallback): void; + function moveMissionToFront(missionId: number, options?: StartOptions): Promise; + + /** + * Mission information corresponding to ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi hide for inner use. + */ + export type MissionInfo = _MissionInfo + + /** + * MissionListener registered by app. + * + * @name MissionListener + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi hide for inner use. + */ + export type MissionListener = _MissionListener + + /** + * Mission snapshot corresponding to mission. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi hide for inner use. + */ + export type MissionSnapshot = _MissionSnapshot +} + +export default missionManager; \ No newline at end of file diff --git a/api/@ohos.app.ability.quickFixManager.d.ts b/api/@ohos.app.ability.quickFixManager.d.ts new file mode 100644 index 0000000000..d30e16fe03 --- /dev/null +++ b/api/@ohos.app.ability.quickFixManager.d.ts @@ -0,0 +1,153 @@ +/* + * 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"; + +/** + * Interface of quickFixManager. + * + * @name quickFixManager + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ +declare namespace quickFixManager { + /** + * Quick fix info of hap module. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + export interface HapModuleQuickFixInfo { + /** + * Indicates hap module name. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly moduleName: string; + + /** + * Indicates hash value of a hap. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly originHapHash: string; + + /** + * Indicates installed path of quick fix file. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly quickFixFilePath: string; + } + + /** + * Quick fix info of application. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + export interface ApplicationQuickFixInfo { + /** + * Bundle name. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly bundleName: string; + + /** + * The version number of the bundle. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly bundleVersionCode: number; + + /** + * The version name of the bundle. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly bundleVersionName: string; + + /** + * The version number of the quick fix. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly quickFixVersionCode: number; + + /** + * The version name of the quick fix. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly quickFixVersionName: string; + + /** + * Hap module quick fix info. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi Hide this for inner system use. + */ + readonly hapModuleQuickFixInfo: Array; + } + + /** + * Apply quick fix files. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @param hapModuleQuickFixFiles Quick fix files need to apply, this value should include file path and file name. + * @systemapi Hide this for inner system use. + * @return - + * @permission ohos.permission.INSTALL_BUNDLE + */ + function applyQuickFix(hapModuleQuickFixFiles: Array, callback: AsyncCallback): void; + function applyQuickFix(hapModuleQuickFixFiles: Array): Promise; + + /** + * Get application quick fix info by bundle name. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @param bundleName Bundle name wish to query. + * @systemapi Hide this for inner system use. + * @return Returns the {@link ApplicationQuickFixInfo}. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback): void; + function getApplicationQuickFixInfo(bundleName: string): Promise; +} + +export default quickFixManager; \ No newline at end of file diff --git a/api/@ohos.app.featureAbility.context.d.ts b/api/@ohos.app.featureAbility.context.d.ts new file mode 100644 index 0000000000..b3aa7ea60a --- /dev/null +++ b/api/@ohos.app.featureAbility.context.d.ts @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2021 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 { ApplicationInfo } from '../bundle/applicationInfo'; +import { ProcessInfo } from './processInfo'; +import { ElementName } from '../bundle/elementName'; +import BaseContext from '../application/BaseContext'; +import { HapModuleInfo } from '../bundle/hapModuleInfo'; +import { AppVersionInfo } from './appVersionInfo'; +import { AbilityInfo } from '../bundle/abilityInfo'; +import bundle from '../@ohos.bundle'; + + +/** + * The context of an ability or an application. It allows access to + * application-specific resources, request and verification permissions. + * Can only be obtained through the ability. + * + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import abilityManager from 'app/context' + * @permission N/A + * @FAModelOnly + */ +export interface Context extends BaseContext { + + /** + * Get the local root dir of an app. If it is the first call, the dir + * will be created. + * @note If in the context of the ability, return the root dir of + * the ability; if in the context of the application, return the + * root dir of the application. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return the root dir + * @FAModelOnly + */ + getOrCreateLocalDir(): Promise; + getOrCreateLocalDir(callback: AsyncCallback): void; + /** + * Verify whether the specified permission is allowed for a particular + * pid and uid running in the system. + * @param permission The name of the specified permission + * @param pid process id + * @param uid user id + * @note Pid and uid are optional. If you do not pass in pid and uid, + * it will check your own permission. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return asynchronous callback with {@code 0} if the PID + * and UID have the permission; callback with {@code -1} otherwise. + * @FAModelOnly + */ + verifyPermission(permission: string, options?: PermissionOptions): Promise; + verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback): void; + verifyPermission(permission: string, callback: AsyncCallback): void; + + /** + * Requests certain permissions from the system. + * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null. + * @param requestCode Indicates the request code to be passed to the PermissionRequestResult + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + requestPermissionsFromUser(permissions: Array, requestCode: number, resultCallback: AsyncCallback): void; + requestPermissionsFromUser(permissions: Array, requestCode: number): Promise; + + /** + * Obtains information about the current application. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getApplicationInfo(callback: AsyncCallback): void + getApplicationInfo(): Promise; + + /** + * Obtains the bundle name of the current ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getBundleName(callback: AsyncCallback): void + getBundleName(): Promise; + + /** + * Obtains the current display orientation of this ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + getDisplayOrientation(callback: AsyncCallback): void + getDisplayOrientation(): Promise; + + /** + * Obtains the absolute path to the application-specific cache directory + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @deprecated since 7 + */ + getExternalCacheDir(callback: AsyncCallback): void + getExternalCacheDir(): Promise; + + /** + * Sets the display orientation of the current ability. + * @param orientation Indicates the new orientation for the current ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback): void + setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise; + + /** + * Sets whether to show this ability on top of the lock screen whenever the lock screen is displayed, keeping the ability in the ACTIVE state. + * @param show Specifies whether to show this ability on top of the lock screen. The value true means to show it on the lock screen, and the value false means not. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + setShowOnLockScreen(show: boolean, callback: AsyncCallback): void + setShowOnLockScreen(show: boolean): Promise; + + /** + * Sets whether to wake up the screen when this ability is restored. + * @param wakeUp Specifies whether to wake up the screen. The value true means to wake it up, and the value false means not. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback): void + setWakeUpScreen(wakeUp: boolean): Promise; + + /** + * Obtains information about the current process, including the process ID and name. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getProcessInfo(callback: AsyncCallback): void + getProcessInfo(): Promise; + + /** + * Obtains the ohos.bundle.ElementName object of the current ability. This method is available only to Page abilities. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getElementName(callback: AsyncCallback): void + getElementName(): Promise; + + /** + * Obtains the name of the current process. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getProcessName(callback: AsyncCallback): void + getProcessName(): Promise; + + /** + * Obtains the bundle name of the ability that called the current ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getCallingBundle(callback: AsyncCallback): void + getCallingBundle(): Promise; + + /** + * Obtains the file directory of this application on the internal storage. + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getFilesDir(callback: AsyncCallback): void; + getFilesDir(): Promise; + + /** + * Obtains the cache directory of this application on the internal storage. + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getCacheDir(callback: AsyncCallback): void; + getCacheDir(): Promise; + + /** + * Obtains the distributed file path for storing ability or application data files. + * If the distributed file path does not exist, the system will create a path and return the created path. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getOrCreateDistributedDir(): Promise; + getOrCreateDistributedDir(callback: AsyncCallback): void; + + /** + * Obtains the application type. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getAppType(callback: AsyncCallback): void + getAppType(): Promise; + + /** + * Obtains the ModuleInfo object for this application. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getHapModuleInfo(callback: AsyncCallback): void + getHapModuleInfo(): Promise; + + /** + * Obtains the application version information. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getAppVersionInfo(callback: AsyncCallback): void + getAppVersionInfo(): Promise; + + /** + * Obtains the context of this application. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getApplicationContext(): Context; + + /** + * Checks the detailed information of this ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getAbilityInfo(callback: AsyncCallback): void + getAbilityInfo(): Promise; + + /** + * Checks whether the configuration of this ability is changing. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return true if the configuration of this ability is changing and false otherwise. + * @FAModelOnly + */ + isUpdatingConfigurations(callback: AsyncCallback): void; + isUpdatingConfigurations(): Promise; + + /** + * Informs the system of the time required for drawing this Page ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + printDrawnCompleted(callback: AsyncCallback): void; + printDrawnCompleted(): Promise; +} + +/** + * @name the result of requestPermissionsFromUser with asynchronous callback + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @FAModelOnly + */ +interface PermissionRequestResult { + /** + * @default The request code passed in by the user + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + requestCode: number; + + /** + * @default The permissions passed in by the user + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + permissions: Array; + + /** + * @default The results for the corresponding request permissions + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + authResults: Array; +} + +/** + * @name PermissionOptions + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @FAModelOnly + */ +interface PermissionOptions { + /** + * @default The process id + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + pid?: number; + + /** + * @default The user id + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + uid?: number; +} diff --git a/api/@ohos.app.featureAbility.d.ts b/api/@ohos.app.featureAbility.d.ts new file mode 100644 index 0000000000..090d1321b2 --- /dev/null +++ b/api/@ohos.app.featureAbility.d.ts @@ -0,0 +1,246 @@ +/* + * 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 + * + * 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 { StartAbilityParameter } from './ability/startAbilityParameter'; +import { AbilityResult } from './ability/abilityResult'; +import { AppVersionInfo as _AppVersionInfo } from './app/appVersionInfo'; +import { Context as _Context } from './app/context'; +import { DataAbilityHelper } from './ability/dataAbilityHelper'; +import { ConnectOptions } from './ability/connectOptions'; +import { ProcessInfo as _ProcessInfo } from './app/processInfo'; +import window from './@ohos.window'; + +/** + * A Feature Ability represents an ability with a UI and is designed to interact with users. + * @name featureAbility + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @permission N/A + * @FAModelOnly + */ +declare namespace featureAbility { + /** + * Obtain the want sended from the source ability. + * + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param parameter Indicates the ability to start. + * @return - + * @FAModelOnly + */ + function getWant(callback: AsyncCallback): void; + function getWant(): Promise; + + /** + * Starts a new ability. + * + * @since 6 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param parameter Indicates the ability to start. + * @return - + * @FAModelOnly + */ + function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + function startAbility(parameter: StartAbilityParameter): Promise; + + /** + * Obtains the application context. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @return Returns the application context. + * @since 6 + * @FAModelOnly + */ + function getContext(): Context; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param parameter Indicates the ability to start. + * @return Returns the {@link AbilityResult}. + * @FAModelOnly + */ + function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + function startAbilityForResult(parameter: StartAbilityParameter): Promise; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param parameter Indicates the result to return. + * @return - + * @FAModelOnly + */ + function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + function terminateSelfWithResult(parameter: AbilityResult): Promise; + + /** + * Destroys this Page ability. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @return - + * @FAModelOnly + */ + function terminateSelf(callback: AsyncCallback): void; + function terminateSelf(): Promise; + + /** + * Obtains the dataAbilityHelper. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the file to open. + * @return Returns the dataAbilityHelper. + * @FAModelOnly + */ + function acquireDataAbilityHelper(uri: string): DataAbilityHelper; + + /** + * Checks whether the main window of this ability has window focus. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @return Returns {@code true} if this ability currently has window focus; returns {@code false} otherwise. + * @FAModelOnly + */ + function hasWindowFocus(callback: AsyncCallback): void; + function hasWindowFocus(): Promise; + + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * @default - + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param request The element name of the service ability + * @param options The remote object instance + * @return Returns the number code of the ability connected + * @FAModelOnly + */ + function connectAbility(request: Want, options:ConnectOptions ): number; + + /** + * The callback interface was connect successfully. + * @default - + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param connection The number code of the ability connected + * @FAModelOnly + */ + function disconnectAbility(connection: number, callback:AsyncCallback): void; + function disconnectAbility(connection: number): Promise; + + /** + * Obtains the window corresponding to the current ability. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @return Returns the window corresponding to the current ability. + * @FAModelOnly + */ + function getWindow(callback: AsyncCallback): void; + function getWindow(): Promise; + + /** + * Obtain the window configuration. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ + export enum AbilityWindowConfiguration { + WINDOW_MODE_UNDEFINED = 0, + WINDOW_MODE_FULLSCREEN = 1, + WINDOW_MODE_SPLIT_PRIMARY = 100, + WINDOW_MODE_SPLIT_SECONDARY = 101, + WINDOW_MODE_FLOATING = 102 + } + + /** + * Obtain the window properties. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ + export enum AbilityStartSetting { + BOUNDS_KEY = "abilityBounds", + WINDOW_MODE_KEY = "windowMode", + DISPLAY_ID_KEY = "displayId" + } + + /** + * Obtain the errorCode. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ + export enum ErrorCode { + NO_ERROR = 0, + INVALID_PARAMETER = -1, + ABILITY_NOT_FOUND = -2, + PERMISSION_DENY = -3 + } + + /** + * Indicates the operation type of data. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ + export enum DataAbilityOperationType { + TYPE_INSERT = 1, + TYPE_UPDATE = 2, + TYPE_DELETE = 3, + TYPE_ASSERT = 4, + } + + /** + * The context of an ability or an application. It allows access to + * application-specific resources, request and verification permissions. + * Can only be obtained through the ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import abilityManager from 'app/context' + * @FAModelOnly + */ + export type Context = _Context + + /** + * Defines an AppVersionInfo object. + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export type AppVersionInfo = _AppVersionInfo + + /** + * @name This class saves process information about an application + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import ProcessInfo from 'app/processInfo' + */ + export type ProcessInfo = _ProcessInfo +} +export default featureAbility; diff --git a/api/@ohos.app.form.FormExtensionContext.d.ts b/api/@ohos.app.form.FormExtensionContext.d.ts new file mode 100644 index 0000000000..2f43e55ca8 --- /dev/null +++ b/api/@ohos.app.form.FormExtensionContext.d.ts @@ -0,0 +1,43 @@ +/* + * 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 + * + * 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 ExtensionContext from "./ExtensionContext"; +import formBindingData from '../@ohos.application.formBindingData'; +import Want from '../@ohos.application.Want'; + +/** + * The context of form extension. It allows access to + * formExtension-specific resources. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @permission N/A + * @StageModelOnly + */ +export default class FormExtensionContext extends ExtensionContext { + /** + * start an ability within the same bundle. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @systemapi hide for inner use + * @param want includes ability name, parameters and relative info sending to an ability. + * @return - + * @StageModelOnly + */ + startAbility(want: Want, callback: AsyncCallback): void; + startAbility(want: Want): Promise; +} diff --git a/api/@ohos.app.particleAbility.d.ts b/api/@ohos.app.particleAbility.d.ts new file mode 100644 index 0000000000..0f9f7689b2 --- /dev/null +++ b/api/@ohos.app.particleAbility.d.ts @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2021 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 { StartAbilityParameter } from './ability/startAbilityParameter'; +import { DataAbilityHelper } from './ability/dataAbilityHelper'; +import { NotificationRequest } from './notification/notificationRequest'; +import { ConnectOptions } from './ability/connectOptions'; +import Want from './@ohos.application.Want'; + +/** + * A Particle Ability represents an ability with service. + * @name particleAbility + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @permission N/A + * @FAModelOnly + */ +declare namespace particleAbility { + /** + * Service ability uses this method to start a specific ability. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param parameter Indicates the ability to start. + * @return - + * @FAModelOnly + */ + function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + function startAbility(parameter: StartAbilityParameter): Promise; + + /** + * Destroys this service ability. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @return - + * @FAModelOnly + */ + function terminateSelf(callback: AsyncCallback): void; + function terminateSelf(): Promise; + + /** + * Obtains the dataAbilityHelper. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the path of the file to open. + * @return Returns the dataAbilityHelper. + * @FAModelOnly + */ + function acquireDataAbilityHelper(uri: string): DataAbilityHelper; + + /** + * Keep this Service ability in the background and display a notification bar. + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @permission ohos.permission.KEEP_BACKGROUND_RUNNING + * @param id Identifies the notification bar information. + * @param request Indicates the notificationRequest instance containing information for displaying a notification bar. + * @FAModelOnly + * @deprecated + */ + function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback): void; + function startBackgroundRunning(id: number, request: NotificationRequest): Promise; + + /** + * Cancel background running of this ability to free up system memory. + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @FAModelOnly + * @deprecated + */ + function cancelBackgroundRunning(callback: AsyncCallback): void; + function cancelBackgroundRunning(): Promise; + + /** + * Connects an ability to a Service ability. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param request Indicates the Service ability to connect. + * @param options Callback object for the client. If this parameter is null, an exception is thrown. + * @return unique identifier of the connection between the client and the service side. + * @FAModelOnly + */ + function connectAbility(request: Want, options:ConnectOptions): number; + + /** + * Disconnects ability to a Service ability. + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @param connection the connection id returned from connectAbility api. + * @FAModelOnly + */ + function disconnectAbility(connection: number, callback:AsyncCallback): void; + function disconnectAbility(connection: number): Promise; + + /** + * Obtain the errorCode. + * + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + */ + export enum ErrorCode { + INVALID_PARAMETER = -1 + } +} +export default particleAbility; diff --git a/api/@ohos.app.wantAgent.d.ts b/api/@ohos.app.wantAgent.d.ts new file mode 100644 index 0000000000..48a996a481 --- /dev/null +++ b/api/@ohos.app.wantAgent.d.ts @@ -0,0 +1,267 @@ +/* + * 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 + * + * 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 , Callback} from './basic'; +import Want from './@ohos.application.Want'; +import { WantAgentInfo as _WantAgentInfo } from './wantAgent/wantAgentInfo'; +import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; + +/** + * Provide the method obtain trigger, cancel, and compare and to obtain + * the bundle name, UID of an {@link WantAgent} object. + * + * @name wantAgent + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import wantAgent from '@ohos.wantAgent'; + * @permission N/A + */ +declare namespace wantAgent { + /** + * Obtains the bundle name of a WantAgent. + * + * @param WantAgent whose bundle name to obtain. + * @return Returns the bundle name of the {@link WantAgent} if any. + */ + function getBundleName(agent: WantAgent, callback: AsyncCallback): void; + function getBundleName(agent: WantAgent): Promise; + + /** + * Obtains the UID of a WantAgent. + * + * @param WantAgent whose UID to obtain. + * @return Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise. + */ + function getUid(agent: WantAgent, callback: AsyncCallback): void; + function getUid(agent: WantAgent): Promise; + + /** + * Obtains the {@link Want} of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. + * @return Returns the {@link Want} of the {@link WantAgent}. + * @systemapi Hide this for inner system use. + */ + function getWant(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the {@link Want} of an {@link WantAgent}. + * + * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. + * @return Returns the {@link Want} of the {@link WantAgent}. + * @systemapi Hide this for inner system use. + */ + function getWant(agent: WantAgent): Promise; + + /** + * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. + * + * @param WantAgent to cancel. + */ + function cancel(agent: WantAgent, callback: AsyncCallback): void; + function cancel(agent: WantAgent): Promise; + + /** + * Triggers a WantAgent. + * + * @param WantAgent to trigger. + * @param Trigger parameters. + * @param callback Indicates the callback method to be called after the {@link WantAgent} is triggered. + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void; + + /** + * Triggers a WantAgent. + * + * @since 9 + * @param WantAgent to trigger. + * @param Trigger parameters. + * @param callback Indicates the AsyncCallback method to be called after the {@link WantAgent} is triggered. + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void; + + /** + * Checks whether two WantAgent objects are equal. + * + * @param WantAgent to compare. + * @param WantAgent to compare. + * @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise. + */ + function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + function equal(agent: WantAgent, otherAgent: WantAgent): Promise; + + /** + * Obtains a WantAgent object. + * + * @param Information about the WantAgent object to obtain. + * @return Returns the created {@link WantAgent} object. + */ + function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; + function getWantAgent(info: WantAgentInfo): Promise; + + /** + * Obtains the {@link OperationType} of a {@link WantAgent}. + * + * @since 9 + * @param agent Indicates the {@link WantAgent} whose {@link OperationType} is to be obtained. + * @return Returns the {@link OperationType} of the {@link WantAgent}. + */ + function getOperationType(agent: WantAgent, callback: AsyncCallback): void; + function getOperationType(agent: WantAgent): Promise; + + /** + * Enumerates flags for using a WantAgent. + */ + export enum WantAgentFlags { + /** + * Indicates that the WantAgent can be used only once. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + ONE_TIME_FLAG = 0, + + /** + * Indicates that null is returned if the WantAgent does not exist. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + NO_BUILD_FLAG, + + /** + * Indicates that the existing WantAgent should be canceled before a new object is generated. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + CANCEL_PRESENT_FLAG, + + /** + * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + UPDATE_PRESENT_FLAG, + + /** + * Indicates that the created WantAgent should be immutable. + */ + CONSTANT_FLAG, + + /** + * Indicates that the current value of element can be replaced when the WantAgent is triggered. + */ + REPLACE_ELEMENT, + + /** + * Indicates that the current value of action can be replaced when the WantAgent is triggered. + */ + REPLACE_ACTION, + + /** + * Indicates that the current value of uri can be replaced when the WantAgent is triggered. + */ + REPLACE_URI, + + /** + * Indicates that the current value of entities can be replaced when the WantAgent is triggered. + */ + REPLACE_ENTITIES, + + /** + * Indicates that the current value of packageName can be replaced when the WantAgent is triggered. + */ + REPLACE_BUNDLE + } + + /** + * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event. + */ + export enum OperationType { + /** + * Unknown operation. + */ + UNKNOWN_TYPE = 0, + + /** + * Starts an ability with a UI. + */ + START_ABILITY, + + /** + * Starts multiple abilities with a UI. + */ + START_ABILITIES, + + /** + * Starts an ability without a UI. + */ + START_SERVICE, + + /** + * Sends a common event. + */ + SEND_COMMON_EVENT + } + + /** + * Describes the data returned by after wantAgent.trigger is called. + */ + export interface CompleteData { + /** + * Triggered WantAgent. + */ + info: WantAgent; + + /** + * Existing Want that is triggered. + */ + want: Want; + + /** + * Request code used to trigger the WantAgent. + */ + finalCode: number; + + /** + * Final data collected by the common event. + */ + finalData: string; + + /** + * Extra data collected by the common event. + */ + extraInfo?: {[key: string]: any}; + } + + /** + * Provides the information required for triggering a WantAgent. + * + * @name TriggerInfo + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export type TriggerInfo = _TriggerInfo + + /** + * Provides the information required for triggering a WantAgent. + * + * @name WantAgentInfo + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export type WantAgentInfo = _WantAgentInfo +} + +/** + * WantAgent object. + */ +export type WantAgent = object; + +export default wantAgent; -- Gitee From 0b00a0bf3add5dfb0ff940df7ca40b304f539b07 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 19 Sep 2022 16:22:54 +0800 Subject: [PATCH 04/34] IssueNo: #I5RT32 Description: fix import Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: I149180f21e9df71a846b4d9c6b02fed9d8014633 --- api/@ohos.ability.dataUriUtils.d.ts | 2 + api/@ohos.ability.featureAbility.d.ts | 2 + api/@ohos.ability.particleAbility.d.ts | 2 + api/@ohos.app.ability.Ability.d.ts | 251 +++---- api/@ohos.app.ability.AbilityContext.d.ts | 512 ++++++++++---- api/@ohos.app.ability.ApplicationContext.d.ts | 74 +- api/@ohos.app.ability.Context.d.ts | 145 ++-- api/@ohos.app.ability.EventHub.d.ts | 73 +- ...s.app.ability.ServiceExtensionContext.d.ts | 295 +++++--- api/@ohos.app.ability.abilityDelegator.d.ts | 309 ++++++--- api/@ohos.app.ability.abilityManager.d.ts | 112 ++- api/@ohos.app.ability.dataAbilityHelper.d.ts | 106 +-- api/@ohos.app.ability.dataUriUtils.d.ts | 85 +-- api/@ohos.app.ability.errorManager.d.ts | 35 +- api/@ohos.app.ability.missionManager.d.ts | 228 ++++-- api/@ohos.app.ability.quickFixManager.d.ts | 123 ++-- api/@ohos.app.featureAbility.context.d.ts | 653 ++++++++++++------ api/@ohos.app.featureAbility.d.ts | 482 +++++++------ api/@ohos.app.form.FormExtensionContext.d.ts | 28 +- api/@ohos.app.particleAbility.d.ts | 130 ++-- api/@ohos.app.wantAgent.d.ts | 177 +++-- api/@ohos.application.Ability.d.ts | 10 + api/@ohos.application.abilityManager.d.ts | 2 + api/@ohos.application.errorManager.d.ts | 2 + api/@ohos.application.missionManager.d.ts | 2 + api/@ohos.application.quickFixManager.d.ts | 2 + api/@ohos.wantAgent.d.ts | 2 + api/ability/dataAbilityHelper.d.ts | 34 +- api/app/context.d.ts | 6 + api/application/AbilityContext.d.ts | 2 + api/application/ApplicationContext.d.ts | 2 + api/application/Context.d.ts | 2 + api/application/EventHub.d.ts | 2 + api/application/ServiceExtensionContext.d.ts | 2 + api/application/abilityDelegator.d.ts | 2 + 35 files changed, 2470 insertions(+), 1426 deletions(-) diff --git a/api/@ohos.ability.dataUriUtils.d.ts b/api/@ohos.ability.dataUriUtils.d.ts index af7b680500..f10e53a20d 100644 --- a/api/@ohos.ability.dataUriUtils.d.ts +++ b/api/@ohos.ability.dataUriUtils.d.ts @@ -19,6 +19,8 @@ * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A + * @deprecated since 9 + * @useinstead @ohos.app.ability.dataUriUtils */ declare namespace dataUriUtils { /** diff --git a/api/@ohos.ability.featureAbility.d.ts b/api/@ohos.ability.featureAbility.d.ts index 944d6d321b..fee1526470 100644 --- a/api/@ohos.ability.featureAbility.d.ts +++ b/api/@ohos.ability.featureAbility.d.ts @@ -32,6 +32,8 @@ import window from './@ohos.window'; * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @permission N/A * @FAModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.featureAbility */ declare namespace featureAbility { /** diff --git a/api/@ohos.ability.particleAbility.d.ts b/api/@ohos.ability.particleAbility.d.ts index 04321ffcd7..f822ef4578 100644 --- a/api/@ohos.ability.particleAbility.d.ts +++ b/api/@ohos.ability.particleAbility.d.ts @@ -27,6 +27,8 @@ import Want from './@ohos.application.Want'; * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @permission N/A * @FAModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.particleAbility */ declare namespace particleAbility { /** diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts index 99cfd35561..340c4e952a 100755 --- a/api/@ohos.app.ability.Ability.d.ts +++ b/api/@ohos.app.ability.Ability.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -14,7 +14,7 @@ */ import AbilityConstant from "./@ohos.application.AbilityConstant"; -import AbilityContext from "./application/AbilityContext"; +import AbilityContext from "./@ohos.app.ability.AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; import { Configuration } from './@ohos.application.Configuration'; @@ -22,13 +22,10 @@ import rpc from './@ohos.rpc'; /** * The prototype of the listener function interface registered by the Caller. - * - * @since 9 + * @typedef OnReleaseCallBack * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @param msg Monitor status notification information. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export interface OnReleaseCallBack { (msg: string): void; @@ -36,13 +33,10 @@ export interface OnReleaseCallBack { /** * The prototype of the message listener function interface registered by the Callee. - * - * @since 9 + * @typedef CalleeCallBack * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @param indata Notification data notified from the caller. - * @return rpc.Sequenceable - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export interface CalleeCallBack { (indata: rpc.MessageParcel): rpc.Sequenceable; @@ -50,268 +44,237 @@ export interface CalleeCallBack { /** * The interface of a Caller. - * - * @since 9 + * @interface * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export interface Caller { - /** + /** * Notify the server of Sequenceable type data. - * - * @since 9 + * @param { string } method - The notification event string listened to by the callee. + * @param { rpc.Sequenceable } data - Notification data to the callee. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method The notification event string listened to by the callee. - * @param data Notification data to the callee. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - call(method: string, data: rpc.Sequenceable): Promise; + call(method: string, data: rpc.Sequenceable): Promise; /** * Notify the server of Sequenceable type data and return the notification result. - * - * @since 9 + * @param { string } method - The notification event string listened to by the callee. + * @param { rpc.Sequenceable } data - Notification data to the callee. + * @returns { Promise } Returns the callee's notification result data. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method The notification event string listened to by the callee. - * @param data Notification data to the callee. - * @return Returns the callee's notification result data on success, and returns undefined on failure. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - callWithResult(method: string, data: rpc.Sequenceable): Promise; + callWithResult(method: string, data: rpc.Sequenceable): Promise; /** * Clear service records. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - release(): void; + release(): void; /** * Register death listener notification callback. - * - * @since 9 + * @param { OnReleaseCallBack } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param callback Register a callback function for listening for notifications. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - onRelease(callback: OnReleaseCallBack): void; - } + onRelease(callback: OnReleaseCallBack): void; +} - /** +/** * The interface of a Callee. - * - * @since 9 + * @interface * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export interface Callee { - - /** + /** * Register data listener callback. - * - * @since 9 + * @param { string } method - A string registered to listen for notification events. + * @param { CalleeCallBack } callback - Register a callback function that listens for notification events. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method A string registered to listen for notification events. - * @param callback Register a callback function that listens for notification events. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - on(method: string, callback: CalleeCallBack): void; + on(method: string, callback: CalleeCallBack): void; - /** + /** * Unregister data listener callback. - * - * @since 9 + * @param { string } method - A string registered to listen for notification events. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method A string registered to listen for notification events. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - off(method: string): void; - } + off(method: string): void; +} /** * The class of an ability. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class Ability { /** * Indicates configuration information about an ability context. - * - * @since 9 + * @type { AbilityContext } * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly + * @stagemodelonly + * @since 9 */ context: AbilityContext; /** * Indicates ability launch want. - * - * @since 9 + * @type { Want } * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly + * @stagemodelonly + * @since 9 */ launchWant: Want; /** * Indicates ability last request want. - * - * @since 9 + * @type { Want } * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly + * @stagemodelonly + * @since 9 */ lastRequestWant: Want; /** * Call Service Stub Object. - * - * @since 9 + * @type { Callee } * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - callee: Callee; + callee: Callee; /** * Called back when an ability is started for initialization. - * - * @since 9 + * @param { Want } want - Indicates the want info of the created ability. + * @param { AbilityConstant.LaunchParam } param - Indicates the launch param. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param want Indicates the want info of the created ability. - * @param param Indicates the launch param. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onCreate(want: Want, param: AbilityConstant.LaunchParam): void; /** * Called back when an ability window stage is created. - * - * @since 9 + * @param { window.WindowStage } windowStage - Indicates the created WindowStage. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param windowStage Indicates the created WindowStage. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageCreate(windowStage: window.WindowStage): void; /** * Called back when an ability window stage is destroyed. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageDestroy(): void; /** * Called back when an ability window stage is restored. - * - * @since 9 + * @param { window.WindowStage } windowStage - window stage to restore * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param windowStage window stage to restore - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageRestore(windowStage: window.WindowStage): void; /** * Called back before an ability is destroyed. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onDestroy(): void; /** * Called back when the state of an ability changes to foreground. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onForeground(): void; /** * Called back when the state of an ability changes to background. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onBackground(): void; /** * Called back when an ability prepares to continue. - * - * @since 9 + * @param { {[key: string]: any} } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnContinueResult } Return the result of onContinue. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param wantParam Indicates the want parameter. - * @return 0 if ability agrees to continue and saves data successfully, otherwise errcode. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; + onContinue(wantParam: { [key: string]: any }): AbilityConstant.OnContinueResult; /** * Called when the launch mode of an ability is set to singleton. * This happens when you re-launch an ability that has been at the top of the ability stack. - * - * @since 9 + * @param { Want } want - Indicates the want info of ability. + * @param { AbilityConstant.LaunchParam } launchParams - Indicates the launch parameters. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param want Indicates the want info of ability. - * @param launchParams Indicates the launch parameters. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; /** * Called when the system configuration is updated. - * - * @since 9 + * @param { Configuration } config - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param config Indicates the updated configuration. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onConfigurationUpdated(config: Configuration): void; /** * Called when dump client information is required. * It is recommended that developers don't DUMP sensitive information. - * - * @since 9 + * @param { Array } params - Indicates the params from command. + * @returns { Array } Return the dump info array. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param params Indicates the params from command. - * @return The dump info array. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ dump(params: Array): Array; /** * Called when the system has determined to trim the memory, for example, when the ability is running in the * background and there is no enough memory for running as many background processes as possible. - * - * @since 9 + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory + * usage status. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param level Indicates the memory trim level, which shows the current memory usage status. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; } diff --git a/api/@ohos.app.ability.AbilityContext.d.ts b/api/@ohos.app.ability.AbilityContext.d.ts index 4febfbf618..9549de949e 100644 --- a/api/@ohos.app.ability.AbilityContext.d.ts +++ b/api/@ohos.app.ability.AbilityContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -13,304 +13,516 @@ * limitations under the License. */ -/// - -import { AbilityInfo } from "../bundle/abilityInfo"; -import { AbilityResult } from "../ability/abilityResult"; -import { AsyncCallback } from "../basic"; -import { ConnectOptions } from "../ability/connectOptions"; -import { HapModuleInfo } from "../bundle/hapModuleInfo"; -import Context from "./Context"; -import Want from "../@ohos.application.Want"; -import StartOptions from "../@ohos.application.StartOptions"; -import PermissionRequestResult from "./PermissionRequestResult"; -import { Configuration } from '../@ohos.application.Configuration'; -import Caller from '../@ohos.application.Ability'; +/// + +import { AbilityInfo } from "./bundle/abilityInfo"; +import { AbilityResult } from "./ability/abilityResult"; +import { AsyncCallback } from "./basic"; +import { ConnectOptions } from "./ability/connectOptions"; +import { HapModuleInfo } from "./bundle/hapModuleInfo"; +import Context from "./@ohos.app.ability.Context"; +import Want from "./@ohos.application.Want"; +import StartOptions from "./@ohos.application.StartOptions"; +import PermissionRequestResult from "./application/PermissionRequestResult"; +import { Configuration } from './@ohos.application.Configuration'; +import { Caller } from './@ohos.app.ability.Ability'; import { LocalStorage } from 'StateManagement'; -import image from '../@ohos.multimedia.image'; +import image from './@ohos.multimedia.image'; /** * The context of an ability. It allows access to ability-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class AbilityContext extends Context { /** * Indicates configuration information about an ability. - * - * @since 9 + * @type { AbilityInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ abilityInfo: AbilityInfo; /** - * Indicates configuration information about an module. - * - * @since 9 + * Indicates configuration information about the module. + * @type { HapModuleInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ currentHapModuleInfo: HapModuleInfo; /** * Indicates configuration information. - * - * @since 9 + * @type { Configuration } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ config: Configuration; /** * Starts a new ability. - * - * @since 9 + * @param want { Want } - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options?: StartOptions): Promise; /** * Get the caller object of the startup capability - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } Returns the Caller interface. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbilityByCall(want: Want): Promise; /** * Starts a new ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts a new ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @return Returns the {@link AbilityResult}. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbilityForResult(want: Want, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbilityForResult(want: Want, options?: StartOptions): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return Returns the {@link AbilityResult}. * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts a new service extension ability. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Stops a service within the same application. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Stops a service within the same application. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbility(want: Want): Promise; /** * Stops a service within the same application with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the accountId to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Stops a service within the same application with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Destroys this Page ability. - * - * @since 9 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this Page ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ terminateSelf(): Promise; /** * Sets the result code and data to be returned by this Page ability to the caller * and destroys this Page ability. - * - * @since 9 + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param parameter Indicates the result to return. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ terminateSelfWithResult(parameter: AbilityResult): Promise; /** * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * - * @since 9 + * @param { Want } want - The element name of the service ability + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want The element name of the service ability - * @param options The remote object instance - * @systemapi Hide this for inner system use. - * @return Returns the number code of the ability connected - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbility(want: Want, options: ConnectOptions): number; /** * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want The element name of the service ability - * @param accountId The account to connect - * @param options The remote object instance - * @systemapi hide for inner use. - * @return Returns the number code of the ability connected * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - The element name of the service ability + * @param { number } accountId - The account to connect + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; /** * The callback interface was connect successfully. - * + * @param { number } connection - The number code of the ability connected + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + disconnectAbility(connection: number, callback: AsyncCallback): void; + + /** + * The callback interface was connect successfully. + * @param { number } connection - The number code of the ability connected + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param connection The number code of the ability connected - * @systemapi Hide this for inner system use. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; /** * Set mission label of current ability. - * + * @param { string } label - The label of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionLabel. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + setMissionLabel(label: string, callback: AsyncCallback): void; + + /** + * Set mission label of current ability. + * @param { string } label - The label of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param label The label of ability that showed in recent missions. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - setMissionLabel(label: string, callback:AsyncCallback): void; - setMissionLabel(label: string): Promise; + setMissionLabel(label: string): Promise; /** * Set mission icon of current ability. - * + * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionIcon. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + setMissionIcon(icon: image.PixelMap, callback: AsyncCallback): void; + + /** + * Set mission icon of current ability. + * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param icon The icon of ability that showed in recent missions. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - setMissionIcon(icon: image.PixelMap, callback:AsyncCallback): void; - setMissionIcon(icon: image.PixelMap): Promise; + setMissionIcon(icon: image.PixelMap): Promise; - /** + /** * Requests certain permissions from the system. - * + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter + * cannot be null or empty. + * @param { AsyncCallback } requestCallback - The callback is used to return the permission + * request result. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void; + + /** + * Requests certain permissions from the system. + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter + * cannot be null or empty. + * @returns { Promise } Returns the permission request result. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null or empty. - * @return Returns the {@link PermissionRequestResult}. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback) : void; - requestPermissionsFromUser(permissions: Array) : Promise; + requestPermissionsFromUser(permissions: Array): Promise; /** * Restore window stage data in ability continuation - * - * @since 9 + * @param { LocalStorage } localStorage - the storage data used to restore window stage + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param LocalStorage the storage data used to restore window stage - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - restoreWindowStage(localStorage: LocalStorage) : void; + restoreWindowStage(localStorage: LocalStorage): void; /** * check to see ability is in terminating state. - * - * @since 9 + * @returns { boolean } Returns true when ability is in terminating state, else returns false. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns true when ability is in terminating state, else returns false. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ isTerminating(): boolean; } diff --git a/api/@ohos.app.ability.ApplicationContext.d.ts b/api/@ohos.app.ability.ApplicationContext.d.ts index 2f605c61cf..065247fca6 100644 --- a/api/@ohos.app.ability.ApplicationContext.d.ts +++ b/api/@ohos.app.ability.ApplicationContext.d.ts @@ -13,63 +13,81 @@ * limitations under the License. */ -import { AsyncCallback } from "../basic"; -import Context from "./Context"; -import AbilityLifecycleCallback from "../@ohos.application.AbilityLifecycleCallback"; -import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; +import { AsyncCallback } from "./basic"; +import Context from "./@ohos.app.ability.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. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class ApplicationContext extends Context { /** * Register ability lifecycle callback. - * - * @since 9 + * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. + * @returns { number } Returns the number code of the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callback The ability lifecycle callback. - * @return Returns the number code of the callback. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; /** * Unregister ability lifecycle callback. - * + * @param { number } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of unregisterAbilityLifecycleCallback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; + + /** + * Unregister ability lifecycle callback. + * @param { number } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callbackId Indicates the number code of the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; unregisterAbilityLifecycleCallback(callbackId: number): Promise; /** * Register environment callback. - * - * @since 9 + * @param { EnvironmentCallback } callback - The environment callback. + * @returns { number } Returns the number code of the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callback The environment callback. - * @return Returns the number code of the callback. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ registerEnvironmentCallback(callback: EnvironmentCallback): number; /** * Unregister environment callback. - * + * @param { number } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; + + /** + * Unregister environment callback. + * @param { number } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callbackId Indicates the number code of the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; unregisterEnvironmentCallback(callbackId: number): Promise; } diff --git a/api/@ohos.app.ability.Context.d.ts b/api/@ohos.app.ability.Context.d.ts index 26c6eadcad..674cefb9e1 100644 --- a/api/@ohos.app.ability.Context.d.ts +++ b/api/@ohos.app.ability.Context.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -13,175 +13,172 @@ * limitations under the License. */ -import { ApplicationInfo } from "../bundle/applicationInfo"; -import resmgr from "../@ohos.resourceManager"; -import BaseContext from "./BaseContext"; -import EventHub from "./EventHub"; -import ApplicationContext from "./ApplicationContext"; +import { ApplicationInfo } from "./bundle/applicationInfo"; +import resmgr from "./@ohos.resourceManager"; +import BaseContext from "./application/BaseContext"; +import EventHub from "./@ohos.app.ability.EventHub"; +import ApplicationContext from "./@ohos.app.ability.ApplicationContext"; /** * The base context of an ability or an application. It allows access to * application-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class Context extends BaseContext { /** * Indicates the capability of accessing application resources. - * - * @since 9 + * @type { resmgr.ResourceManager } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ resourceManager: resmgr.ResourceManager; /** * Indicates configuration information about an application. - * - * @since 9 + * @type { ApplicationInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ applicationInfo: ApplicationInfo; /** * Indicates app cache dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ cacheDir: string; /** * Indicates app temp dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ tempDir: string; /** * Indicates app files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - filesDir : string; + filesDir: string; /** * Indicates app database dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - databaseDir : string; + databaseDir: string; /** * Indicates app preferences dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - preferencesDir : string; + preferencesDir: string; /** * Indicates app bundle code dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - bundleCodeDir : string; + bundleCodeDir: string; /** * Indicates app distributed files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ distributedFilesDir: string; /** * Indicates event hub. - * - * @since 9 + * @type { EventHub } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ eventHub: EventHub; /** * Indicates file area. - * - * @since 9 + * @type { AreaMode } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ area: AreaMode; /** * Create a bundle context - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @param bundleName Indicates the bundle name. - * @return application context * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - * @StageModelOnly + * @param { string } bundleName - Indicates the bundle name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ createBundleContext(bundleName: string): Context; /** * Create a module context - * - * @since 9 + * @param { string } moduleName - Indicates the module name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param moduleName Indicates the module name. - * @return application context - * @StageModelOnly + * @stagemodelonly + * @since 9 */ createModuleContext(moduleName: string): Context; /** * Create a module context - * - * @since 9 + * @param { string } bundleName - Indicates the bundle name. + * @param { string } moduleName - Indicates the module name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @param bundleName Indicates the bundle name. - * @param moduleName Indicates the module name. - * @return application context - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ createModuleContext(bundleName: string, moduleName: string): Context; /** * Get application context - * - * @since 9 + * @returns { ApplicationContext } Returns the application context. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return application context - * @StageModelOnly + * @stagemodelonly + * @since 9 */ getApplicationContext(): ApplicationContext; } /** - * File area mode - * - * @since 9 + * Enum for the file area mode + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum AreaMode { /** diff --git a/api/@ohos.app.ability.EventHub.d.ts b/api/@ohos.app.ability.EventHub.d.ts index 7fe3d203ca..708e937969 100644 --- a/api/@ohos.app.ability.EventHub.d.ts +++ b/api/@ohos.app.ability.EventHub.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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 @@ -13,48 +13,45 @@ * limitations under the License. */ +import { BusinessError } from './basic'; + /** * The event center of a context, support the subscription and publication of events. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class EventHub { - /** - * Subscribe to an event. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param callback Indicates the callback. - * @return - - * @StageModelOnly - */ - on(event: string, callback: Function): void + /** + * Subscribe to an event. + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + on(event: string, callback: Function): void - /** - * Unsubscribe from an event. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param callback Indicates the callback. - * @return - - * @StageModelOnly - */ - off(event: string, callback?: Function): void + /** + * Unsubscribe from an event. + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + off(event: string, callback?: Function): void - /** - * Trigger the event callbacks. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param args Indicates the callback arguments. - * @return - - * @StageModelOnly - */ - emit(event: string, ...args: Object[]): void + /** + * Trigger the event callbacks. + * @param { string } event - Indicates the event. + * @param { Object[] } args - Indicates the callback arguments. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + emit(event: string, ...args: Object[]): void } \ No newline at end of file diff --git a/api/@ohos.app.ability.ServiceExtensionContext.d.ts b/api/@ohos.app.ability.ServiceExtensionContext.d.ts index dd21ca7d0a..9b9b3afa18 100644 --- a/api/@ohos.app.ability.ServiceExtensionContext.d.ts +++ b/api/@ohos.app.ability.ServiceExtensionContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -13,180 +13,293 @@ * limitations under the License. */ -import { AsyncCallback } from "../basic"; -import { ConnectOptions } from "../ability/connectOptions"; -import Caller from '../@ohos.application.Ability'; -import ExtensionContext from "./ExtensionContext"; -import Want from "../@ohos.application.Want"; -import StartOptions from "../@ohos.application.StartOptions"; +import { AsyncCallback } from "./basic"; +import { ConnectOptions } from "./ability/connectOptions"; +import { Caller } from './@ohos.app.ability.Ability'; +import ExtensionContext from "./application/ExtensionContext"; +import Want from "./@ohos.application.Want"; +import StartOptions from "./@ohos.application.StartOptions"; /** * The context of service extension. It allows access to * serviceExtension-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @permission N/A - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ export default class ServiceExtensionContext extends ExtensionContext { /** * Service extension uses this method to start a specific ability. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options?: StartOptions): Promise; /** * Service extension uses this method to start a specific ability with account. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param accountId Indicates the accountId to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability with account. + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability with account. + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts a new service extension ability. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Stops a service within the same application. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Stops a service within the same application. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbility(want: Want): Promise; /** * Stops a service within the same application with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the accountId to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Stops a service within the same application with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Destroys this service extension. - * - * @since 9 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this service extension. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ terminateSelf(): Promise; /** * Connects an ability to a Service extension. - * *

This method can be called by an ability or service extension, but the destination of the connection must be a * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target * service extension when the Service extension is connected.

- * - * @since 9 + * @param { Want } want - Indicates the service extension to connect. + * @param { ConnectOptions } options - Indicates the callback of connection. + * @returns { number } Returns the connection id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the service extension to connect. - * @param options Indicates the callback of connection. - * @systemapi hide for inner use. - * @return connection id, int value. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbility(want: Want, options: ConnectOptions): number; /** * Connects an ability to a Service extension with account. - * *

This method can be called by an ability or service extension, but the destination of the connection must be a * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target * service extension when the Service extension is connected.

- * - * @since 9 + * @param { Want } want - Indicates the service extension to connect. + * @param { number } accountId - Indicates the account to connect. + * @param { ConnectOptions } options - Indicates the callback of connection. + * @returns { number } Returns the connection id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the service extension to connect. - * @param accountId Indicates the account to connect. - * @param options Indicates the callback of connection. - * @systemapi hide for inner use. - * @return connection id, int value. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; /** - * Disconnects an ability to a service extension, in contrast to - * {@link connectAbility}. - * + * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. + * @param { number } connection - the connection id returned from connectAbility api. + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + disconnectAbility(connection: number, callback: AsyncCallback): void; + + /** + * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. + * @param { number } connection - the connection id returned from connectAbility api. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param connection the connection id returned from connectAbility api. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; /** * Get the caller object of the startup capability - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } Returns the Caller interface. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - startAbilityByCall(want: Want): Promise; + startAbilityByCall(want: Want): Promise; } \ No newline at end of file diff --git a/api/@ohos.app.ability.abilityDelegator.d.ts b/api/@ohos.app.ability.abilityDelegator.d.ts index d6e08d73b2..0e9bde748c 100644 --- a/api/@ohos.app.ability.abilityDelegator.d.ts +++ b/api/@ohos.app.ability.abilityDelegator.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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 @@ -13,196 +13,347 @@ * limitations under the License. */ -import { AsyncCallback } from '../basic'; -import Ability from '../@ohos.application.Ability'; -import AbilityStage from '../@ohos.application.AbilityStage'; -import { AbilityMonitor } from './abilityMonitor'; -import { AbilityStageMonitor } from './abilityStageMonitor'; -import Context from './Context'; -import Want from "../@ohos.application.Want"; -import { ShellCmdResult } from './shellCmdResult'; +import { AsyncCallback } from './basic'; +import Ability from './@ohos.app.ability.Ability'; +import AbilityStage from './@ohos.application.AbilityStage'; +import { AbilityMonitor } from './application/abilityMonitor'; +import { AbilityStageMonitor } from './application/abilityStageMonitor'; +import Context from './@ohos.app.ability.Context'; +import Want from "./@ohos.application.Want"; +import { ShellCmdResult } from './application/shellCmdResult'; /** * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. - * - * @since 8 + * @interface * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegator from 'application/abilityDelegator.d' - * @permission N/A + * @since 9 */ export interface AbilityDelegator { /** * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @param { AsyncCallback } callback - The callback of addAbilityMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object + * @since 9 */ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ addAbilityMonitor(monitor: AbilityMonitor): Promise; /** * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of addAbilityStageMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object + * @since 9 */ - addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; /** * Remove a specified AbilityMonitor object from the application memory. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object + * @since 9 */ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Remove a specified AbilityMonitor object from the application memory. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ removeAbilityMonitor(monitor: AbilityMonitor): Promise; /** * Remove a specified AbilityStageMonitor object from the application memory. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityStageMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Remove a specified AbilityStageMonitor object from the application memory. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object + * @since 9 */ - removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; /** * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object - * @param timeout Maximum wait time, in milliseconds - * @return success: return the Ability object, failure: return null + * @since 9 */ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback): void; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise; /** * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object - * @param timeout Maximum wait time, in milliseconds - * @return success: return the AbilityStage object, failure: return null + * @since 9 */ - waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; /** * Obtain the application context. - * - * @since 9 + * @returns { Context } Returns the app Context. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return App Context + * @since 9 */ getAppContext(): Context; /** * Obtain the lifecycle state of a specified ability. - * - * @since 9 + * @param { Ability } ability - The Ability object. + * @returns { number } Returns the state of the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The Ability object - * @return The state of the Ability object. enum AbilityLifecycleState + * @since 9 */ getAbilityState(ability: Ability): number; /** * Obtain the ability that is currently being displayed. - * - * @since 9 + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return The top ability of the current application + * @since 9 */ getCurrentTopAbility(callback: AsyncCallback): void; + + /** + * Obtain the ability that is currently being displayed. + * @returns { Promise } Returns the Ability object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ getCurrentTopAbility(): Promise /** * Start a new ability. - * - * @since 9 + * @param { Want } want - Indicates the ability to start + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start - * @return - + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Start a new ability. + * @param { Want } want - Indicates the ability to start + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ startAbility(want: Want): Promise; /** * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. - * + * @param { Ability } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityForeground. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + doAbilityForeground(ability: Ability, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * @param { Ability } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The ability object - * @return true: success false: failure + * @since 9 */ - doAbilityForeground(ability: Ability, callback: AsyncCallback): void; - doAbilityForeground(ability: Ability): Promise; + doAbilityForeground(ability: Ability): Promise; /** * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. - * + * @param { Ability } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityBackground. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + doAbilityBackground(ability: Ability, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * @param { Ability } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The ability object - * @return true: success false: failure + * @since 9 */ - doAbilityBackground(ability: Ability, callback: AsyncCallback): void; - doAbilityBackground(ability: Ability): Promise; + doAbilityBackground(ability: Ability): Promise; /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * - * @since 8 + * @param { string } msg - Log information. + * @param { AsyncCallback } callback - The callback of print. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information + * @since 9 */ print(msg: string, callback: AsyncCallback): void; - print(msg: string): Promise; /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * + * @param { string } msg - Log information. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + print(msg: string): Promise; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information + * @since 9 */ - printSync(msg: string): void; + printSync(msg: string): void; /** * Execute the given command in the aa tools side. - * - * @since 8 + * @param { string } cmd - The shell command. + * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param cmd Shell command - * @param timeoutSecs Timeout, in seconds - * @return ShellCmdResult object + * @since 9 */ executeShellCommand(cmd: string, callback: AsyncCallback): void; + + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - Shell command. + * @param { number } timeoutSecs - Timeout, in seconds. + * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; + + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - Shell command. + * @param { number } timeoutSecs - Timeout, in seconds. + * @returns { Promise } Returns the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ executeShellCommand(cmd: string, timeoutSecs?: number): Promise; /** * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * - * @since 9 + * @param { string } msg - Log information. + * @param { number } code - Result code. + * @param { AsyncCallback } callback - The callback of finishTest. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information - * @param code Result code + * @since 9 */ finishTest(msg: string, code: number, callback: AsyncCallback): void; + + /** + * Finish the test and print log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @param { number } code - Result code. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ finishTest(msg: string, code: number): Promise; } diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts index 298aae74f4..a904da0cb8 100644 --- a/api/@ohos.app.ability.abilityManager.d.ts +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -21,19 +21,18 @@ import { ElementName } from './bundle/elementName'; /** * The class of an ability manager. - * - * @since 8 + * @namespace abilityManager * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use - * @permission N/A + * @systemapi + * @since 9 */ declare namespace abilityManager { /** - * @name AbilityState - * @since 8 + * Enum for the ability state + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use. - * @permission N/A + * @systemapi + * @since 9 */ export enum AbilityState { INITIAL = 0, @@ -45,68 +44,107 @@ declare namespace abilityManager { /** * Updates the configuration by modifying the configuration. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param config Indicates the new configuration. - * @systemapi Hide this for inner system use. - * @return - * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { Configuration } config - Indicates the new configuration. + * @param { AsyncCallback } callback - The callback of updateConfiguration. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function updateConfiguration(config: Configuration, callback: AsyncCallback): void; - function updateConfiguration(config: Configuration): Promise; /** - * Get information about running abilitys - * - * @since 8 + * Updates the configuration by modifying the configuration. + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { Configuration } config - Indicates the new configuration. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use. - * @return Returns the array of {@link AbilityRunningInfo}. + * @systemapi + * @since 9 + */ + function updateConfiguration(config: Configuration): Promise; + + /** + * Get information about running abilities * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of AbilityRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function getAbilityRunningInfos(): Promise>; + + /** + * Get information about running abilities + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the array of AbilityRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ function getAbilityRunningInfos(callback: AsyncCallback>): void; /** * Get information about running extensions - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param upperLimit Get the maximum limit of the number of messages - * @systemapi Hide this for inner system use. - * @return Returns the array of {@link ExtensionRunningInfo}. * @permission ohos.permission.GET_RUNNING_INFO + * @param { number } upperLimit - Get the maximum limit of the number of messages. + * @returns { Promise> } Returns the array of ExtensionRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function getExtensionRunningInfos(upperLimit: number): Promise>; + + /** + * Get information about running extensions + * @permission ohos.permission.GET_RUNNING_INFO + * @param { number } upperLimit - Get the maximum limit of the number of messages. + * @param { AsyncCallback> } callback - The callback is used to return the array of ExtensionRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback>): void; /** * Get the top ability information of the display. - * - * @since 9 + * @returns { Promise } Returns the elementName info of the top ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use. - * @return Returns the {@link ElementName} info of the top ability. + * @systemapi + * @since 9 */ function getTopAbility(): Promise; + + /** + * Get the top ability information of the display. + * @param { AsyncCallback } callback - The callback is used to return the elementName info of the top ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ function getTopAbility(callback: AsyncCallback): void; /** * The class of an ability running information. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide this for inner system use + * @systemapi + * @since 9 */ export type AbilityRunningInfo = _AbilityRunningInfo /** * The class of an extension running information. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide this for inner system use + * @systemapi + * @since 9 */ export type ExtensionRunningInfo = _ExtensionRunningInfo } diff --git a/api/@ohos.app.ability.dataAbilityHelper.d.ts b/api/@ohos.app.ability.dataAbilityHelper.d.ts index 48f49c99ea..d1defbdf63 100644 --- a/api/@ohos.app.ability.dataAbilityHelper.d.ts +++ b/api/@ohos.app.ability.dataAbilityHelper.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* 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 @@ -13,22 +13,21 @@ * limitations under the License. */ -import { AsyncCallback } from '../basic'; -import ResultSet from '../data/rdb/resultSet'; -import { PacMap } from './dataAbilityHelper'; -import { DataAbilityOperation } from './dataAbilityOperation'; -import { DataAbilityResult } from './dataAbilityResult'; -import dataAbility from '../@ohos.data.dataAbility'; -import rdb from '../@ohos.data.rdb'; +import { AsyncCallback } from './basic'; +import { ResultSet } from './data/rdb/resultSet'; +import { DataAbilityOperation } from './ability/dataAbilityOperation'; +import { DataAbilityResult } from './ability/dataAbilityResult'; +import dataAbility from './@ohos.data.dataAbility'; +import rdb from './@ohos.data.rdb'; /** - * DataAbilityUtils + * DataAbilityHelper * @interface * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 */ -export interface DataAbilityUtils { +export interface DataAbilityHelper { /** * Opens a file in a specified remote path. * @param { string } uri - Indicates the path of the file to open. @@ -38,7 +37,7 @@ export interface DataAbilityUtils { * "rw" for read and write access on any existing data, or "rwt" for read and write access * that truncates any existing file. * @param { AsyncCallback } callback - The callback is used to return the file descriptor. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -54,7 +53,7 @@ export interface DataAbilityUtils { * "rw" for read and write access on any existing data, or "rwt" for read and write access * that truncates any existing file. * @returns { Promise } Returns the promise of file descriptor. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -66,7 +65,7 @@ export interface DataAbilityUtils { * @param { string } type - dataChange. * @param { string } uri - Indicates the path of the data to operate. * @param { AsyncCallback } callback - The callback when dataChange. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -78,7 +77,7 @@ export interface DataAbilityUtils { * @param { string } type - dataChange. * @param { string } uri - Indicates the path of the data to operate. * @param { AsyncCallback } callback - The callback when dataChange. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -89,7 +88,7 @@ export interface DataAbilityUtils { * Obtains the MIME type of the date specified by the given URI. * @param { string } uri - Indicates the path of the data to operate. * @param { AsyncCallback } callback - The callback is used to return the MIME type. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -100,7 +99,7 @@ export interface DataAbilityUtils { * Obtains the MIME type of the date specified by the given URI. * @param { string } uri - Indicates the path of the data to operate. * @returns { Promise } Returns the promise of MIME type that matches the data specified by uri. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -112,7 +111,7 @@ export interface DataAbilityUtils { * @param { string } uri - Indicates the path of the files to obtain. * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain. * @param { AsyncCallback> } callback - The callback is used to return the matched MIME types Array. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -124,7 +123,7 @@ export interface DataAbilityUtils { * @param { string } uri - Indicates the path of the files to obtain. * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain. * @returns { Promise> } Returns the promise of matched MIME types Array. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -135,7 +134,7 @@ export interface DataAbilityUtils { * Converts the given uri that refers to the Data ability into a normalized uri. * @param { string } uri - Indicates the uri object to normalize. * @param { AsyncCallback } callback - The callback is used to return the normalized uri object. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -146,7 +145,7 @@ export interface DataAbilityUtils { * Converts the given uri that refers to the Data ability into a normalized uri. * @param { string } uri - Indicates the uri object to normalize. * @returns { Promise } Returns the promise of normalized uri object. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -157,7 +156,7 @@ export interface DataAbilityUtils { * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. * @param { string } uri - Indicates the uri object to normalize. * @param { AsyncCallback } callback - The callback is used to return the denormalized uri object. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -168,7 +167,7 @@ export interface DataAbilityUtils { * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. * @param { string } uri - Indicates the uri object to normalize. * @returns { Promise } Returns the denormalized uri object. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -179,7 +178,7 @@ export interface DataAbilityUtils { * Notifies the registered observers of a change to the data resource specified by uri. * @param { string } uri - Indicates the path of the data to operate. * @param { AsyncCallback } callback - The callback of notifyChange. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -190,7 +189,7 @@ export interface DataAbilityUtils { * Notifies the registered observers of a change to the data resource specified by uri. * @param { string } uri - Indicates the path of the data to operate. * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -203,7 +202,7 @@ export interface DataAbilityUtils { * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, * a blank row will be inserted. * @param { AsyncCallback } callback - The callback is used to return the index of the inserted data record. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -216,7 +215,7 @@ export interface DataAbilityUtils { * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, * a blank row will be inserted. * @returns { Promise } Returns the index of the inserted data record. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -228,7 +227,7 @@ export interface DataAbilityUtils { * @param { string } uri - Indicates the path of the data to batchInsert. * @param { Array } valuesBuckets - Indicates the data records to insert. * @param { AsyncCallback } callback - The callback is used to return the number of data records inserted. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -240,7 +239,7 @@ export interface DataAbilityUtils { * @param { string } uri - Indicates the path of the data to batchInsert. * @param { Array } valuesBuckets - Indicates the data records to insert. * @returns { Promise } Returns the number of data records inserted. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -254,7 +253,7 @@ export interface DataAbilityUtils { * processing logic when this parameter is null. * @param { AsyncCallback } callback - The callback is used to return the number of data records deleted. * @returns { Promise } Returns the number of data records deleted. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -267,7 +266,7 @@ export interface DataAbilityUtils { * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the * processing logic when this parameter is null. * @returns { Promise } Returns the number of data records deleted. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -278,7 +277,7 @@ export interface DataAbilityUtils { * Deletes one or more data records from the database. * @param { string } uri - Indicates the path of the data to delete. * @param { AsyncCallback } callback - The callback is used to return the number of data records deleted. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -292,7 +291,7 @@ export interface DataAbilityUtils { * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define * the processing logic when this parameter is null. * @param { AsyncCallback } callback - The callback is used to return the number of data records updated. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -306,7 +305,7 @@ export interface DataAbilityUtils { * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define * the processing logic when this parameter is null. * @returns { Promise } Returns the number of data records updated. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -318,7 +317,7 @@ export interface DataAbilityUtils { * @param { string } uri - Indicates the path of data to update. * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. * @param { AsyncCallback } callback - The callback is used to return the number of data records updated. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -332,7 +331,7 @@ export interface DataAbilityUtils { * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define * the processing logic when this parameter is null. * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -343,7 +342,7 @@ export interface DataAbilityUtils { * Queries data in the database. * @param { string } uri - Indicates the path of data to query. * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -355,7 +354,7 @@ export interface DataAbilityUtils { * @param { string } uri - Indicates the path of data to query. * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -368,7 +367,7 @@ export interface DataAbilityUtils { * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define * the processing logic when this parameter is null. * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -382,7 +381,7 @@ export interface DataAbilityUtils { * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define * the processing logic when this parameter is null. * @returns { Promise } Returns the query result {@link ResultSet}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -400,7 +399,7 @@ export interface DataAbilityUtils { * If the PacMap object is to be transferred to a non-OHOS process, * values of primitive types are supported, but not custom Sequenceable objects. * @param { AsyncCallback } callback - The callback is used to return the query result {@link PacMap}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -418,7 +417,7 @@ export interface DataAbilityUtils { * If the PacMap object is to be transferred to a non-OHOS process, * values of primitive types are supported, but not custom Sequenceable objects. * @returns { Promise } Returns the query result {@link PacMap}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -432,7 +431,7 @@ export interface DataAbilityUtils { * multiple operations on the database. * @param { AsyncCallback> } callback - The callback is used to return the result of each * operation, in array {@link DataAbilityResult}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 @@ -445,10 +444,31 @@ export interface DataAbilityUtils { * @param { Array } operations - Indicates the data operation list, which can contain * multiple operations on the database. * @returns { Promise> } Returns the result of each operation, in array {@link DataAbilityResult}. - * @throws { BusinessError } If the input parameter is not valid parameter. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @famodelonly * @since 9 */ executeBatch(uri: string, operations: Array): Promise>; } + +/** + * Defines a PacMap object for storing a series of values. + * @typedef PacMap + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ +export interface PacMap { + /** + * Indicates the parameter of the PacMap type. + * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, + * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. + * If the PacMap object is to be transferred to a non-OHOS process, + * values of primitive types are supported, but not custom Sequenceable objects. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + [key: string]: number | string | boolean | Array | null; +} diff --git a/api/@ohos.app.ability.dataUriUtils.d.ts b/api/@ohos.app.ability.dataUriUtils.d.ts index 0d8dafaee4..e3f47a7138 100644 --- a/api/@ohos.app.ability.dataUriUtils.d.ts +++ b/api/@ohos.app.ability.dataUriUtils.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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 @@ -13,55 +13,56 @@ * limitations under the License. */ +import { BusinessError } from './basic'; + /** * A utility class used for handling objects that use the DataAbilityHelper scheme. - * @name dataUriUtils - * @since 7 + * @namespace dataUriUtils * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A + * @since 9 */ declare namespace dataUriUtils { - /** - * Obtains the ID attached to the end of the path component of the given uri. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param uri Indicates the uri object from which the ID is to be obtained. - * @return Returns the ID attached to the end of the path component; - */ - function getId(uri: string): number + /** + * Obtains the ID attached to the end of the path component of the given uri. + * @param { string } uri - Indicates the uri object from which the ID is to be obtained. + * @returns { number } Returns the ID attached to the end of the path component. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getId(uri: string): number - /** - * Attaches the given ID to the end of the path component of the given uri. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param uri Indicates the uri string from which the ID is to be obtained. - * @param id Indicates the ID to attach. - * @return Returns the uri object with the given ID attached. - */ - function attachId(uri: string, id: number): string + /** + * Attaches the given ID to the end of the path component of the given uri. + * @param { string } uri - Indicates the uri string from which the ID is to be obtained. + * @param { number } id - Indicates the ID to attach. + * @returns { number } Returns the uri object with the given ID attached. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function attachId(uri: string, id: number): string - /** - * Deletes the ID from the end of the path component of the given uri. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param uri Indicates the uri object from which the ID is to be deleted. - * @return Returns the uri object with the ID deleted. - */ - function deleteId(uri: string): string + /** + * Deletes the ID from the end of the path component of the given uri. + * @param { string } uri - Indicates the uri object from which the ID is to be deleted. + * @returns { string } Returns the uri object with the ID deleted. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function deleteId(uri: string): string - /** - * Updates the ID in the specified uri - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param uri Indicates the uri object to be updated. - * @param id Indicates the new ID. - * @return Returns the updated uri object. - */ - function updateId(uri: string, id: number): string + /** + * Updates the ID in the specified uri. + * @param { string } uri - Indicates the uri object to be updated. + * @param { number } id - Indicates the new ID. + * @returns { string } Returns the updated uri object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function updateId(uri: string, id: number): string } export default dataUriUtils; \ No newline at end of file diff --git a/api/@ohos.app.ability.errorManager.d.ts b/api/@ohos.app.ability.errorManager.d.ts index dda4361c79..903e9d89f5 100644 --- a/api/@ohos.app.ability.errorManager.d.ts +++ b/api/@ohos.app.ability.errorManager.d.ts @@ -18,40 +18,45 @@ import * as _ErrorObserver from './application/ErrorObserver'; /** * This module provides the function of error manager. - * - * @since 9 + * @namespace errorManager * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import errorManager from '@ohos.application.errorManager' - * @permission N/A + * @since 9 */ declare namespace errorManager { /** * Register error observer. - * - * @default - - * @since 9 + * @param { ErrorObserver } observer - The error observer. + * @returns { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param observer The error observer. - * @return Returns the number code of the observer. + * @since 9 */ function registerErrorObserver(observer: ErrorObserver): number; /** * Unregister error observer. - * + * @param { number } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of unregisterErrorObserver. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + function unregisterErrorObserver(observerId: number, callback: AsyncCallback): void; + + /** + * Unregister error observer. + * @param { number } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param observerId Indicates the number code of the observer. - * @return - + * @since 9 */ - function unregisterErrorObserver(observerId: number, callback: AsyncCallback): void; function unregisterErrorObserver(observerId: number): Promise; /** * The observer will be called by system when an error occurs. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export type ErrorObserver = _ErrorObserver.default } diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts index 4147a91829..7a0eac2e0d 100644 --- a/api/@ohos.app.ability.missionManager.d.ts +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -21,164 +21,262 @@ import StartOptions from "./@ohos.application.StartOptions"; /** * This module provides the capability to manage abilities and obtaining system task information. - * - * @name missionManager - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @permission ohos.permission.MANAGE_MISSIONS - * @systemapi hide for inner use. + * @namespace missionManager + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 */ declare namespace missionManager { /** * Register the missionListener to ams. - * - * @since 8 + * @param { MissionListener } listener - Indicates the MissionListener to be registered. + * @returns { number } Returns the index number of the MissionListener. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param listener Indicates the MissionListener to be registered. - * @return The index number of the MissionListener. + * @since 9 */ function registerMissionListener(listener: MissionListener): number; /** * Unrgister the missionListener to ams. - * - * @since 8 + * @param { number } listenerId - Indicates the listener id to be unregistered. + * @param { AsyncCallback } callback - The callback of unregisterMissionListener. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param listenerId Indicates the listener id to be unregistered. - * @return - + * @since 9 */ function unregisterMissionListener(listenerId: number, callback: AsyncCallback): void; + + /** + * Unrgister the missionListener to ams. + * @param { number } listenerId - Indicates the listener id to be unregistered. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function unregisterMissionListener(listenerId: number): Promise; /** * Get the missionInfo with the given missionId. - * - * @since 8 + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionInfo of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param deviceId Indicates the device to be queried. - * @param missionId Indicates mission id to be queried. - * @return the {@link MissionInfo} of the given id. + * @since 9 */ function getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback): void; + + /** + * Get the missionInfo with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionInfo of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function getMissionInfo(deviceId: string, missionId: number): Promise; /** * Get the missionInfo with the given missionId. - * - * @since 8 + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } numMax - Indicates the maximum number of returned missions. + * @param { AsyncCallback> } callback - The callback is used to return the array of the MissionInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param deviceId Indicates the device to be queried. - * @param numMax Indicates the maximum number of returned missions. - * @return The array of the {@link MissionInfo}. + * @since 9 */ function getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback>): void; + + /** + * Get the missionInfo with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } numMax - Indicates the maximum number of returned missions. + * @returns { Promise> } Returns the array of the MissionInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function getMissionInfos(deviceId: string, numMax: number): Promise>; /** * Get the mission snapshot with the given missionId. - * - * @since 8 + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param deviceId Indicates the device to be queried. - * @param missionId Indicates mission id to be queried. - * @return The {@link MissionSnapshot} of the given id. + * @since 9 */ function getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; + + /** + * Get the mission snapshot with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function getMissionSnapShot(deviceId: string, missionId: number): Promise; /** * Get the mission low resolution snapshot with the given missionId. - * + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @since 9 + */ + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; + + /** + * Get the mission low resolution snapshot with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param deviceId Indicates the device to be queried. - * @param missionId Indicates mission id to be queried. - * @return The {@link MissionSnapshot} of the given id. + * @since 9 */ - function getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; - function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise; + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise; /** * Lock the mission. - * - * @since 8 + * @param { number } missionId - Indicates mission id to be locked. + * @param { AsyncCallback } callback - The callback of lockMission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param missionId Indicates mission id to be locked. - * @return - + * @since 9 */ function lockMission(missionId: number, callback: AsyncCallback): void; + + /** + * Lock the mission. + * @param { number } missionId - Indicates mission id to be locked. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function lockMission(missionId: number): Promise; /** * Unlock the mission. - * - * @since 8 + * @param { number } missionId - Indicates mission id to be unlocked. + * @param { AsyncCallback } callback - The callback of unlockMission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param missionId Indicates mission id to be unlocked. - * @return - + * @since 9 */ function unlockMission(missionId: number, callback: AsyncCallback): void; + + /** + * Unlock the mission. + * @param { number } missionId - Indicates mission id to be unlocked. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function unlockMission(missionId: number): Promise; /** * Clear the given mission in the ability manager service. - * - * @since 8 + * @param { number } missionId - Indicates mission id to be cleared. + * @param { AsyncCallback } callback - The callback of clearMission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param missionId Indicates mission id to be cleared. - * @return - + * @since 9 */ function clearMission(missionId: number, callback: AsyncCallback): void; + + /** + * Clear the given mission in the ability manager service. + * @param { number } missionId - Indicates mission id to be cleared. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function clearMission(missionId: number): Promise; /** * Clear all missions in the ability manager service. - * - * @since 8 + * @param { AsyncCallback } callback - The callback of clearAllMissions. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @return - + * @since 9 */ function clearAllMissions(callback: AsyncCallback): void; + + /** + * Clear all missions in the ability manager service. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function clearAllMissions(): Promise; /** * Schedule the given mission to foreground. - * - * @since 8 + * @param { number } missionId - Indicates mission id to be moved to foreground. + * @param { AsyncCallback } callback - The callback of moveMissionToFront. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @param missionId Indicates mission id to be moved to foreground. - * @param options Indicates the start options. - * @return - + * @since 9 */ function moveMissionToFront(missionId: number, callback: AsyncCallback): void; + + /** + * Schedule the given mission to foreground. + * @param { number } missionId - Indicates mission id to be moved to foreground. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of moveMissionToFront. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Schedule the given mission to foreground. + * @param { number } missionId - Indicates mission id to be moved to foreground. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ function moveMissionToFront(missionId: number, options?: StartOptions): Promise; /** * Mission information corresponding to ability. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @systemapi hide for inner use. + * @systemapi + * @since 9 */ export type MissionInfo = _MissionInfo /** * MissionListener registered by app. - * - * @name MissionListener - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @systemapi hide for inner use. + * @systemapi + * @since 9 */ export type MissionListener = _MissionListener /** * Mission snapshot corresponding to mission. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @systemapi hide for inner use. + * @systemapi + * @since 9 */ export type MissionSnapshot = _MissionSnapshot } diff --git a/api/@ohos.app.ability.quickFixManager.d.ts b/api/@ohos.app.ability.quickFixManager.d.ts index d30e16fe03..89cf51bc87 100644 --- a/api/@ohos.app.ability.quickFixManager.d.ts +++ b/api/@ohos.app.ability.quickFixManager.d.ts @@ -17,137 +17,160 @@ import { AsyncCallback } from "./basic"; /** * Interface of quickFixManager. - * - * @name quickFixManager - * @since 9 + * @namespace quickFixManager * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ declare namespace quickFixManager { /** * Quick fix info of hap module. - * - * @since 9 + * @typedef HapModuleQuickFixInfo * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ export interface HapModuleQuickFixInfo { /** * Indicates hap module name. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly moduleName: string; /** * Indicates hash value of a hap. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly originHapHash: string; /** * Indicates installed path of quick fix file. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly quickFixFilePath: string; } /** * Quick fix info of application. - * - * @since 9 + * @typedef ApplicationQuickFixInfo * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ export interface ApplicationQuickFixInfo { /** * Bundle name. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly bundleName: string; /** * The version number of the bundle. - * - * @since 9 + * @type { number } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly bundleVersionCode: number; /** * The version name of the bundle. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly bundleVersionName: string; /** * The version number of the quick fix. - * - * @since 9 + * @type { number } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly quickFixVersionCode: number; /** * The version name of the quick fix. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly quickFixVersionName: string; /** * Hap module quick fix info. - * - * @since 9 + * @type { Array } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly hapModuleQuickFixInfo: Array; } /** * Apply quick fix files. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @param hapModuleQuickFixFiles Quick fix files need to apply, this value should include file path and file name. - * @systemapi Hide this for inner system use. - * @return - * @permission ohos.permission.INSTALL_BUNDLE + * @param { Array } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file + * path and file name. + * @param { AsyncCallback } callback - The callback of applyQuickFix. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi + * @since 9 */ function applyQuickFix(hapModuleQuickFixFiles: Array, callback: AsyncCallback): void; + + /** + * Apply quick fix files. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { Array } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file + * path and file name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi + * @since 9 + */ function applyQuickFix(hapModuleQuickFixFiles: Array): Promise; /** * Get application quick fix info by bundle name. - * - * @since 9 + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Bundle name wish to query. + * @param { AsyncCallback } callback - The callback is used to return the ApplicationQuickFixInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @param bundleName Bundle name wish to query. - * @systemapi Hide this for inner system use. - * @return Returns the {@link ApplicationQuickFixInfo}. + * @systemapi + * @since 9 + */ + function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback): void; + + /** + * Get application quick fix info by bundle name. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Bundle name wish to query. + * @returns { Promise } Returns the ApplicationQuickFixInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi + * @since 9 */ - function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback): void; - function getApplicationQuickFixInfo(bundleName: string): Promise; + function getApplicationQuickFixInfo(bundleName: string): Promise; } export default quickFixManager; \ No newline at end of file diff --git a/api/@ohos.app.featureAbility.context.d.ts b/api/@ohos.app.featureAbility.context.d.ts index b3aa7ea60a..4bfd481abd 100644 --- a/api/@ohos.app.featureAbility.context.d.ts +++ b/api/@ohos.app.featureAbility.context.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* 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 @@ -13,316 +13,581 @@ * limitations under the License. */ -import { AsyncCallback } from '../basic'; -import { ApplicationInfo } from '../bundle/applicationInfo'; -import { ProcessInfo } from './processInfo'; -import { ElementName } from '../bundle/elementName'; -import BaseContext from '../application/BaseContext'; -import { HapModuleInfo } from '../bundle/hapModuleInfo'; -import { AppVersionInfo } from './appVersionInfo'; -import { AbilityInfo } from '../bundle/abilityInfo'; -import bundle from '../@ohos.bundle'; - +import { AsyncCallback } from './basic'; +import { ApplicationInfo } from './bundle/applicationInfo'; +import { ProcessInfo } from './app/processInfo'; +import { ElementName } from './bundle/elementName'; +import BaseContext from './application/BaseContext'; +import { HapModuleInfo } from './bundle/hapModuleInfo'; +import { AppVersionInfo } from './app/appVersionInfo'; +import { AbilityInfo } from './bundle/abilityInfo'; +import bundle from './@ohos.bundle'; /** * The context of an ability or an application. It allows access to * application-specific resources, request and verification permissions. * Can only be obtained through the ability. - * - * @since 6 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import abilityManager from 'app/context' - * @permission N/A - * @FAModelOnly + * @famodelonly + * @since 9 */ export interface Context extends BaseContext { - /** - * Get the local root dir of an app. If it is the first call, the dir - * will be created. - * @note If in the context of the ability, return the root dir of - * the ability; if in the context of the application, return the - * root dir of the application. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return the root dir - * @FAModelOnly - */ + * Get the local root dir of an app. If it is the first call, the dir + * will be created. + * @note If in the context of the ability, return the root dir of + * the ability; if in the context of the application, return the + * root dir of the application. + * @returns { Promise } Returns the root dir. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getOrCreateLocalDir(): Promise; + + /** + * Get the local root dir of an app. If it is the first call, the dir + * will be created. + * @note If in the context of the ability, return the root dir of + * the ability; if in the context of the application, return the + * root dir of the application. + * @param { AsyncCallback } callback - The callback is used to return the root dir. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getOrCreateLocalDir(callback: AsyncCallback): void; + /** - * Verify whether the specified permission is allowed for a particular - * pid and uid running in the system. - * @param permission The name of the specified permission - * @param pid process id - * @param uid user id - * @note Pid and uid are optional. If you do not pass in pid and uid, - * it will check your own permission. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return asynchronous callback with {@code 0} if the PID - * and UID have the permission; callback with {@code -1} otherwise. - * @FAModelOnly - */ + * Verify whether the specified permission is allowed for a particular + * pid and uid running in the system. + * @note Pid and uid are optional. If you do not pass in pid and uid, it will check your own permission. + * @param { string } permission - The name of the specified permission. + * @param { PermissionOptions } options - Indicates the permission options. + * @returns { Promise } Returns {@code 0} if the PID and UID have the permission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ verifyPermission(permission: string, options?: PermissionOptions): Promise; + + /** + * Verify whether the specified permission is allowed for a particular + * pid and uid running in the system. + * @note Pid and uid are optional. If you do not pass in pid and uid, it will check your own permission. + * @param { string } permission - The name of the specified permission. + * @param { PermissionOptions } options - Indicates the permission options. + * @param { AsyncCallback } callback - Returns {@code 0} if the PID and UID have the permission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback): void; + + /** + * Verify whether the specified permission is allowed for a particular + * pid and uid running in the system. + * @note Pid and uid are optional. If you do not pass in pid and uid, it will check your own permission. + * @param { string } permission - The name of the specified permission. + * @param { AsyncCallback } callback - Returns {@code 0} if the PID and UID have the permission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ verifyPermission(permission: string, callback: AsyncCallback): void; /** - * Requests certain permissions from the system. - * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null. - * @param requestCode Indicates the request code to be passed to the PermissionRequestResult - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Requests certain permissions from the system. + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter cannot be null. + * @param { number } requestCode - Indicates the request code to be passed to the PermissionRequestResult. + * @param { AsyncCallback } resultCallback - The callback is used to return the PermissionRequestResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ requestPermissionsFromUser(permissions: Array, requestCode: number, resultCallback: AsyncCallback): void; + + /** + * Requests certain permissions from the system. + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter cannot be null. + * @param { number } requestCode - Indicates the request code to be passed to the PermissionRequestResult. + * @returns { Promise } Returns the PermissionRequestResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ requestPermissionsFromUser(permissions: Array, requestCode: number): Promise; /** - * Obtains information about the current application. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains information about the current application. + * @param { AsyncCallback } callback - The callback is used to return the ApplicationInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getApplicationInfo(callback: AsyncCallback): void + + /** + * Obtains information about the current application. + * @returns { Promise } Returns the ApplicationInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getApplicationInfo(): Promise; /** - * Obtains the bundle name of the current ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the bundle name of the current ability. + * @param { AsyncCallback } callback - The callback is used to return the bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getBundleName(callback: AsyncCallback): void + + /** + * Obtains the bundle name of the current ability. + * @returns { Promise } Returns the bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getBundleName(): Promise; /** - * Obtains the current display orientation of this ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ + * Obtains the current display orientation of this ability. + * @param { AsyncCallback } callback - The callback is used to return the display orientation. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getDisplayOrientation(callback: AsyncCallback): void - getDisplayOrientation(): Promise; /** - * Obtains the absolute path to the application-specific cache directory - * @since 6 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @deprecated since 7 - */ - getExternalCacheDir(callback: AsyncCallback): void - getExternalCacheDir(): Promise; + * Obtains the current display orientation of this ability. + * @returns { Promise } Returns the display orientation. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ + getDisplayOrientation(): Promise; /** - * Sets the display orientation of the current ability. - * @param orientation Indicates the new orientation for the current ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ + * Sets the display orientation of the current ability. + * @param { bundle.DisplayOrientation } orientation - Indicates the new orientation for the current ability. + * @param { AsyncCallback } callback - The callback of setDisplayOrientation. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback): void + + /** + * Sets the display orientation of the current ability. + * @param { bundle.DisplayOrientation } orientation - Indicates the new orientation for the current ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise; /** - * Sets whether to show this ability on top of the lock screen whenever the lock screen is displayed, keeping the ability in the ACTIVE state. - * @param show Specifies whether to show this ability on top of the lock screen. The value true means to show it on the lock screen, and the value false means not. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ + * Sets whether to show this ability on top of the lock screen whenever the lock screen is displayed, + * keeping the ability in the ACTIVE state. + * @param { boolean } show - Specifies whether to show this ability on top of the lock screen. The value true + * means to show it on the lock screen, and the value false means not. + * @param { AsyncCallback } callback - The callback of setShowOnLockScreen. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ setShowOnLockScreen(show: boolean, callback: AsyncCallback): void + + /** + * Sets whether to show this ability on top of the lock screen whenever the lock screen is displayed, + * keeping the ability in the ACTIVE state. + * @param { boolean } show - Specifies whether to show this ability on top of the lock screen. The value true + * means to show it on the lock screen, and the value false means not. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ setShowOnLockScreen(show: boolean): Promise; /** - * Sets whether to wake up the screen when this ability is restored. - * @param wakeUp Specifies whether to wake up the screen. The value true means to wake it up, and the value false means not. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ + * Sets whether to wake up the screen when this ability is restored. + * @param { boolean } wakeUp - Specifies whether to wake up the screen. The value true means to wake it up, + * and the value false means not. + * @param { AsyncCallback } callback - The callback of setWakeUpScreen. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback): void + + /** + * Sets whether to wake up the screen when this ability is restored. + * @param { boolean } wakeUp - Specifies whether to wake up the screen. The value true means to wake it up, + * and the value false means not. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ setWakeUpScreen(wakeUp: boolean): Promise; /** - * Obtains information about the current process, including the process ID and name. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains information about the current process, including the process ID and name. + * @param { AsyncCallback } callback - The callback is used to return the ProcessInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getProcessInfo(callback: AsyncCallback): void + + /** + * Obtains information about the current process, including the process ID and name. + * @returns { Promise } Returns the ProcessInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getProcessInfo(): Promise; /** - * Obtains the ohos.bundle.ElementName object of the current ability. This method is available only to Page abilities. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the ohos.bundle.ElementName object of the current ability. This method is available only to Page abilities. + * @param { AsyncCallback } callback - The callback is used to return the ElementName. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getElementName(callback: AsyncCallback): void + + /** + * Obtains the ohos.bundle.ElementName object of the current ability. This method is available only to Page abilities. + * @returns { Promise } Returns the ElementName. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getElementName(): Promise; /** - * Obtains the name of the current process. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the name of the current process. + * @param { AsyncCallback } callback - The callback is used to return the process name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getProcessName(callback: AsyncCallback): void + + /** + * Obtains the name of the current process. + * @returns { Promise } Returns the process name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getProcessName(): Promise; /** - * Obtains the bundle name of the ability that called the current ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the bundle name of the ability that called the current ability. + * @param { AsyncCallback } callback - The callback is used to return the calling bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getCallingBundle(callback: AsyncCallback): void + + /** + * Obtains the bundle name of the ability that called the current ability. + * @returns { Promise } Returns the calling bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getCallingBundle(): Promise; /** - * Obtains the file directory of this application on the internal storage. - * @since 6 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the file directory of this application on the internal storage. + * @param { AsyncCallback } callback - The callback is used to return the file directory. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getFilesDir(callback: AsyncCallback): void; + + /** + * Obtains the file directory of this application on the internal storage. + * @returns { Promise } Returns the file directory. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getFilesDir(): Promise; /** - * Obtains the cache directory of this application on the internal storage. - * @since 6 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the cache directory of this application on the internal storage. + * @param { AsyncCallback } callback - The callback is used to return the cache directory. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getCacheDir(callback: AsyncCallback): void; + + /** + * Obtains the cache directory of this application on the internal storage. + * @returns { Promise } Returns the cache directory. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getCacheDir(): Promise; /** - * Obtains the distributed file path for storing ability or application data files. - * If the distributed file path does not exist, the system will create a path and return the created path. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the distributed file path for storing ability or application data files. + * If the distributed file path does not exist, the system will create a path and return the created path. + * @returns { Promise } Returns the distributed file path. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getOrCreateDistributedDir(): Promise; + + /** + * Obtains the distributed file path for storing ability or application data files. + * If the distributed file path does not exist, the system will create a path and return the created path. + * @param { AsyncCallback } callback - The callback is used to return the distributed file path. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getOrCreateDistributedDir(callback: AsyncCallback): void; /** - * Obtains the application type. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the application type. + * @param { AsyncCallback } callback - The callback is used to return the application type. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getAppType(callback: AsyncCallback): void + + /** + * Obtains the application type. + * @returns { Promise } Returns the application type. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getAppType(): Promise; /** - * Obtains the ModuleInfo object for this application. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the ModuleInfo object for this application. + * @param { AsyncCallback } callback - The callback is used to return the HapModuleInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getHapModuleInfo(callback: AsyncCallback): void + + /** + * Obtains the ModuleInfo object for this application. + * @returns { Promise } Returns the HapModuleInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getHapModuleInfo(): Promise; /** - * Obtains the application version information. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the application version information. + * @param { AsyncCallback } callback - The callback is used to return the application version info. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getAppVersionInfo(callback: AsyncCallback): void + + /** + * Obtains the application version information. + * @returns { Promise } Returns the application version info. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getAppVersionInfo(): Promise; /** - * Obtains the context of this application. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Obtains the context of this application. + * @returns { Context } Returns the context of this application. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getApplicationContext(): Context; /** - * Checks the detailed information of this ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Checks the detailed information of this ability. + * @param { AsyncCallback } callback - The callback is used to return the AbilityInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getAbilityInfo(callback: AsyncCallback): void + + /** + * Checks the detailed information of this ability. + * @returns { Promise } Returns the AbilityInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ getAbilityInfo(): Promise; /** - * Checks whether the configuration of this ability is changing. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return true if the configuration of this ability is changing and false otherwise. - * @FAModelOnly - */ + * Checks whether the configuration of this ability is changing. + * @param { AsyncCallback } callback - Returns true if the configuration of this ability is changing and false otherwise. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ isUpdatingConfigurations(callback: AsyncCallback): void; + + /** + * Checks whether the configuration of this ability is changing. + * @returns { Promise } Returns true if the configuration of this ability is changing and false otherwise. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ isUpdatingConfigurations(): Promise; /** - * Informs the system of the time required for drawing this Page ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * Informs the system of the time required for drawing this Page ability. + * @param { AsyncCallback } callback - The callback of printDrawnCompleted. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ printDrawnCompleted(callback: AsyncCallback): void; + + /** + * Informs the system of the time required for drawing this Page ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ printDrawnCompleted(): Promise; } /** - * @name the result of requestPermissionsFromUser with asynchronous callback - * @since 7 + * the result of requestPermissionsFromUser with asynchronous callback + * @typedef PermissionRequestResult * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @FAModelOnly + * @famodelonly + * @since 9 */ interface PermissionRequestResult { /** - * @default The request code passed in by the user - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * The request code passed in by the user + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ requestCode: number; /** - * @default The permissions passed in by the user - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * The permissions passed in by the user + * @type { Array } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ permissions: Array; /** - * @default The results for the corresponding request permissions - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ + * The results for the corresponding request permissions + * @type { Array } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ authResults: Array; } /** - * @name PermissionOptions - * @since 7 + * @typedef PermissionOptions * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @FAModelOnly + * @famodelonly + * @since 9 */ interface PermissionOptions { - /** - * @default The process id - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ - pid?: number; - - /** - * @default The user id - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ - uid?: number; + /** + * The process id + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ + pid?: number; + + /** + * The user id + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ + uid?: number; } diff --git a/api/@ohos.app.featureAbility.d.ts b/api/@ohos.app.featureAbility.d.ts index 090d1321b2..4662f9b078 100644 --- a/api/@ohos.app.featureAbility.d.ts +++ b/api/@ohos.app.featureAbility.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -19,228 +19,280 @@ import Want from './@ohos.application.Want'; import { StartAbilityParameter } from './ability/startAbilityParameter'; import { AbilityResult } from './ability/abilityResult'; import { AppVersionInfo as _AppVersionInfo } from './app/appVersionInfo'; -import { Context as _Context } from './app/context'; -import { DataAbilityHelper } from './ability/dataAbilityHelper'; +import { Context } from './@ohos.app.featureAbility.context'; +import { DataAbilityHelper } from './@ohos.app.ability.dataAbilityHelper'; import { ConnectOptions } from './ability/connectOptions'; import { ProcessInfo as _ProcessInfo } from './app/processInfo'; import window from './@ohos.window'; /** * A Feature Ability represents an ability with a UI and is designed to interact with users. - * @name featureAbility - * @since 6 + * @namespace featureAbility * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @permission N/A - * @FAModelOnly + * @famodelonly + * @since 9 */ declare namespace featureAbility { - /** - * Obtain the want sended from the source ability. - * - * @since 6 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param parameter Indicates the ability to start. - * @return - - * @FAModelOnly - */ - function getWant(callback: AsyncCallback): void; - function getWant(): Promise; - - /** - * Starts a new ability. - * - * @since 6 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param parameter Indicates the ability to start. - * @return - - * @FAModelOnly - */ - function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - function startAbility(parameter: StartAbilityParameter): Promise; - - /** - * Obtains the application context. - * - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns the application context. - * @since 6 - * @FAModelOnly - */ - function getContext(): Context; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param parameter Indicates the ability to start. - * @return Returns the {@link AbilityResult}. - * @FAModelOnly - */ - function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; - function startAbilityForResult(parameter: StartAbilityParameter): Promise; - - /** - * Sets the result code and data to be returned by this Page ability to the caller - * and destroys this Page ability. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param parameter Indicates the result to return. - * @return - - * @FAModelOnly - */ - function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; - function terminateSelfWithResult(parameter: AbilityResult): Promise; - - /** - * Destroys this Page ability. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - - * @FAModelOnly - */ - function terminateSelf(callback: AsyncCallback): void; - function terminateSelf(): Promise; - - /** - * Obtains the dataAbilityHelper. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the file to open. - * @return Returns the dataAbilityHelper. - * @FAModelOnly - */ - function acquireDataAbilityHelper(uri: string): DataAbilityHelper; - - /** - * Checks whether the main window of this ability has window focus. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns {@code true} if this ability currently has window focus; returns {@code false} otherwise. - * @FAModelOnly - */ - function hasWindowFocus(callback: AsyncCallback): void; - function hasWindowFocus(): Promise; - - /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * @default - - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param request The element name of the service ability - * @param options The remote object instance - * @return Returns the number code of the ability connected - * @FAModelOnly - */ - function connectAbility(request: Want, options:ConnectOptions ): number; - - /** - * The callback interface was connect successfully. - * @default - - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param connection The number code of the ability connected - * @FAModelOnly - */ - function disconnectAbility(connection: number, callback:AsyncCallback): void; - function disconnectAbility(connection: number): Promise; - - /** - * Obtains the window corresponding to the current ability. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns the window corresponding to the current ability. - * @FAModelOnly - */ - function getWindow(callback: AsyncCallback): void; - function getWindow(): Promise; - - /** - * Obtain the window configuration. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly - */ - export enum AbilityWindowConfiguration { - WINDOW_MODE_UNDEFINED = 0, - WINDOW_MODE_FULLSCREEN = 1, - WINDOW_MODE_SPLIT_PRIMARY = 100, - WINDOW_MODE_SPLIT_SECONDARY = 101, - WINDOW_MODE_FLOATING = 102 - } - - /** - * Obtain the window properties. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly - */ - export enum AbilityStartSetting { - BOUNDS_KEY = "abilityBounds", - WINDOW_MODE_KEY = "windowMode", - DISPLAY_ID_KEY = "displayId" - } - - /** - * Obtain the errorCode. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly - */ - export enum ErrorCode { - NO_ERROR = 0, - INVALID_PARAMETER = -1, - ABILITY_NOT_FOUND = -2, - PERMISSION_DENY = -3 - } - - /** - * Indicates the operation type of data. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly - */ - export enum DataAbilityOperationType { - TYPE_INSERT = 1, - TYPE_UPDATE = 2, - TYPE_DELETE = 3, - TYPE_ASSERT = 4, - } - - /** - * The context of an ability or an application. It allows access to - * application-specific resources, request and verification permissions. - * Can only be obtained through the ability. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import abilityManager from 'app/context' - * @FAModelOnly - */ - export type Context = _Context - - /** - * Defines an AppVersionInfo object. - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ - export type AppVersionInfo = _AppVersionInfo - - /** - * @name This class saves process information about an application - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import ProcessInfo from 'app/processInfo' - */ - export type ProcessInfo = _ProcessInfo + /** + * Obtain the want sent from the source ability. + * @param { AsyncCallback } callback - The callback is used to return the want sent from the source ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function getWant(callback: AsyncCallback): void; + + /** + * Obtain the want sent from the source ability. + * @returns { Promise } Returns the want sent from the source ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function getWant(): Promise; + + /** + * Starts a new ability. + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function startAbility(parameter: StartAbilityParameter): Promise; + + /** + * Obtains the application context. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function getContext(): Context; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback is used to return the AbilityResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @returns { Promise } Returns the AbilityResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function startAbilityForResult(parameter: StartAbilityParameter): Promise; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function terminateSelfWithResult(parameter: AbilityResult): Promise; + + /** + * Destroys this Page ability. + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this Page ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function terminateSelf(): Promise; + + /** + * Obtains the dataAbilityHelper. + * @param uri Indicates the path of the file to open. + * @returns { DataAbilityHelper } Returns the DataAbilityHelper. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function acquireDataAbilityHelper(uri: string): DataAbilityHelper; + + /** + * Checks whether the main window of this ability has window focus. + * @param { AsyncCallback } callback - The callback is used to return {@code true} if this ability currently has window focus. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function hasWindowFocus(callback: AsyncCallback): void; + + /** + * Checks whether the main window of this ability has window focus. + * @returns { Promise } Returns {@code true} if this ability currently has window focus. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function hasWindowFocus(): Promise; + + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * @param { Want } request - The element name of the service ability + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function connectAbility(request: Want, options: ConnectOptions): number; + + /** + * The callback interface was connect successfully. + * @param { number } connection - The number code of the ability connected + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function disconnectAbility(connection: number, callback: AsyncCallback): void; + + /** + * The callback interface was connect successfully. + * @param { number } connection - The number code of the ability connected + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function disconnectAbility(connection: number): Promise; + + /** + * Obtains the window corresponding to the current ability. + * @param { AsyncCallback } callback - The callback is used to return the window corresponding to the current ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function getWindow(callback: AsyncCallback): void; + + /** + * Obtains the window corresponding to the current ability. + * @returns { Promise } Returns the window corresponding to the current ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + function getWindow(): Promise; + + /** + * Obtain the window configuration + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + export enum AbilityWindowConfiguration { + WINDOW_MODE_UNDEFINED = 0, + WINDOW_MODE_FULLSCREEN = 1, + WINDOW_MODE_SPLIT_PRIMARY = 100, + WINDOW_MODE_SPLIT_SECONDARY = 101, + WINDOW_MODE_FLOATING = 102 + } + + /** + * Obtain the window properties. + * @enum { string } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + export enum AbilityStartSetting { + BOUNDS_KEY = "abilityBounds", + WINDOW_MODE_KEY = "windowMode", + DISPLAY_ID_KEY = "displayId" + } + + /** + * Indicates the operation type of data. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ + export enum DataAbilityOperationType { + TYPE_INSERT = 1, + TYPE_UPDATE = 2, + TYPE_DELETE = 3, + TYPE_ASSERT = 4, + } + + /** + * Defines an AppVersionInfo object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ + export type AppVersionInfo = _AppVersionInfo + + /** + * This class saves process information about an application + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @famodelonly + * @since 9 + */ + export type ProcessInfo = _ProcessInfo } export default featureAbility; diff --git a/api/@ohos.app.form.FormExtensionContext.d.ts b/api/@ohos.app.form.FormExtensionContext.d.ts index 2f43e55ca8..36d2b54ebb 100644 --- a/api/@ohos.app.form.FormExtensionContext.d.ts +++ b/api/@ohos.app.form.FormExtensionContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -13,30 +13,28 @@ * limitations under the License. */ -import { AsyncCallback } from "../basic"; -import ExtensionContext from "./ExtensionContext"; -import formBindingData from '../@ohos.application.formBindingData'; -import Want from '../@ohos.application.Want'; +import { AsyncCallback } from "./basic"; +import ExtensionContext from "./application/ExtensionContext"; +import formBindingData from './@ohos.app.form.formBindingData'; +import Want from './@ohos.application.Want'; /** * The context of form extension. It allows access to * formExtension-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.Form - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class FormExtensionContext extends ExtensionContext { /** * start an ability within the same bundle. - * - * @since 9 + * @param { Want } want - includes ability name, parameters and relative info sending to an ability. + * @param { AsyncCallback } callback - The callback of startAbility. + * @returns { Promise } The promise returned by the function. * @syscap SystemCapability.Ability.Form - * @systemapi hide for inner use - * @param want includes ability name, parameters and relative info sending to an ability. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; startAbility(want: Want): Promise; diff --git a/api/@ohos.app.particleAbility.d.ts b/api/@ohos.app.particleAbility.d.ts index 0f9f7689b2..720bd45ed8 100644 --- a/api/@ohos.app.particleAbility.d.ts +++ b/api/@ohos.app.particleAbility.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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 @@ -15,110 +15,104 @@ import { AsyncCallback } from './basic'; import { StartAbilityParameter } from './ability/startAbilityParameter'; -import { DataAbilityHelper } from './ability/dataAbilityHelper'; +import { DataAbilityHelper } from './@ohos.app.ability.dataAbilityHelper'; import { NotificationRequest } from './notification/notificationRequest'; import { ConnectOptions } from './ability/connectOptions'; import Want from './@ohos.application.Want'; /** * A Particle Ability represents an ability with service. - * @name particleAbility - * @since 7 + * @namespace particleAbility * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @permission N/A - * @FAModelOnly + * @famodelonly + * @since 9 */ declare namespace particleAbility { /** * Service ability uses this method to start a specific ability. - * - * @since 7 + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param parameter Indicates the ability to start. - * @return - - * @FAModelOnly + * @famodelonly + * @since 9 */ function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + + /** + * Service ability uses this method to start a specific ability. + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ function startAbility(parameter: StartAbilityParameter): Promise; /** * Destroys this service ability. - * - * @since 7 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - - * @FAModelOnly + * @famodelonly + * @since 9 */ function terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this service ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 + */ function terminateSelf(): Promise; /** * Obtains the dataAbilityHelper. - * - * @since 7 + * @param { string } uri - Indicates the path of the file to open. + * @returns { DataAbilityHelper } Returns the dataAbilityHelper. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param uri Indicates the path of the file to open. - * @return Returns the dataAbilityHelper. - * @FAModelOnly + * @famodelonly + * @since 9 */ function acquireDataAbilityHelper(uri: string): DataAbilityHelper; /** - * Keep this Service ability in the background and display a notification bar. - * - * @since 7 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask - * @permission ohos.permission.KEEP_BACKGROUND_RUNNING - * @param id Identifies the notification bar information. - * @param request Indicates the notificationRequest instance containing information for displaying a notification bar. - * @FAModelOnly - * @deprecated + * Connects an ability to a Service ability. + * @param { Want } request - Indicates the Service ability to connect. + * @param { ConnectOptions } options - Callback object for the client. If this parameter is null, an exception is thrown. + * @returns { number } Returns the unique identifier of the connection between the client and the service side. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 */ - function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback): void; - function startBackgroundRunning(id: number, request: NotificationRequest): Promise; + function connectAbility(request: Want, options: ConnectOptions): number; /** - * Cancel background running of this ability to free up system memory. - * - * @since 7 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask - * @FAModelOnly - * @deprecated + * Disconnects ability to a Service ability. + * @param { number } connection - the connection id returned from connectAbility api. + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @famodelonly + * @since 9 */ - function cancelBackgroundRunning(callback: AsyncCallback): void; - function cancelBackgroundRunning(): Promise; + function disconnectAbility(connection: number, callback: AsyncCallback): void; /** - * Connects an ability to a Service ability. - * - * @since 7 + * Disconnects ability to a Service ability. + * @param { number } connection - the connection id returned from connectAbility api. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param request Indicates the Service ability to connect. - * @param options Callback object for the client. If this parameter is null, an exception is thrown. - * @return unique identifier of the connection between the client and the service side. - * @FAModelOnly + * @famodelonly + * @since 9 */ - function connectAbility(request: Want, options:ConnectOptions): number; - - /** - * Disconnects ability to a Service ability. - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @param connection the connection id returned from connectAbility api. - * @FAModelOnly - */ - function disconnectAbility(connection: number, callback:AsyncCallback): void; - function disconnectAbility(connection: number): Promise; - - /** - * Obtain the errorCode. - * - * @since 7 - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @FAModelOnly - */ - export enum ErrorCode { - INVALID_PARAMETER = -1 - } + function disconnectAbility(connection: number): Promise; } export default particleAbility; diff --git a/api/@ohos.app.wantAgent.d.ts b/api/@ohos.app.wantAgent.d.ts index 48a996a481..0dd77890e8 100644 --- a/api/@ohos.app.wantAgent.d.ts +++ b/api/@ohos.app.wantAgent.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -21,108 +21,174 @@ import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; /** * Provide the method obtain trigger, cancel, and compare and to obtain * the bundle name, UID of an {@link WantAgent} object. - * - * @name wantAgent - * @since 7 + * @namespace wantAgent * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import wantAgent from '@ohos.wantAgent'; - * @permission N/A + * @since 9 */ declare namespace wantAgent { /** * Obtains the bundle name of a WantAgent. - * - * @param WantAgent whose bundle name to obtain. - * @return Returns the bundle name of the {@link WantAgent} if any. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ function getBundleName(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the bundle name of a WantAgent. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function getBundleName(agent: WantAgent): Promise; /** * Obtains the UID of a WantAgent. - * - * @param WantAgent whose UID to obtain. - * @return Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the UID. + * @returns { Promise } Returns the UID. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ function getUid(agent: WantAgent, callback: AsyncCallback): void; function getUid(agent: WantAgent): Promise; /** * Obtains the {@link Want} of an {@link WantAgent}. - * - * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. - * @return Returns the {@link Want} of the {@link WantAgent}. - * @systemapi Hide this for inner system use. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the Want. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function getWant(agent: WantAgent, callback: AsyncCallback): void; /** * Obtains the {@link Want} of an {@link WantAgent}. - * - * @param agent Indicates the {@link WantAgent} whose UID is to be obtained. - * @return Returns the {@link Want} of the {@link WantAgent}. - * @systemapi Hide this for inner system use. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the Want. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function getWant(agent: WantAgent): Promise; /** * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. - * - * @param WantAgent to cancel. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback of cancel. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ function cancel(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function cancel(agent: WantAgent): Promise; /** * Triggers a WantAgent. - * - * @param WantAgent to trigger. - * @param Trigger parameters. - * @param callback Indicates the callback method to be called after the {@link WantAgent} is triggered. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent. + * @param { Callback } callback - The callback is used to return the CompleteData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void; /** * Triggers a WantAgent. - * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the CompleteData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 - * @param WantAgent to trigger. - * @param Trigger parameters. - * @param callback Indicates the AsyncCallback method to be called after the {@link WantAgent} is triggered. */ function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void; /** * Checks whether two WantAgent objects are equal. - * - * @param WantAgent to compare. - * @param WantAgent to compare. - * @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { WantAgent } otherAgent - Indicates the other WantAgent. + * @param { AsyncCallback } callback - Returns true if the two WantAgents are the same. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + + /** + * Checks whether two WantAgent objects are equal. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { WantAgent } otherAgent - Indicates the other WantAgent. + * @returns { Promise } Returns true if the two WantAgents are the same. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function equal(agent: WantAgent, otherAgent: WantAgent): Promise; /** * Obtains a WantAgent object. - * - * @param Information about the WantAgent object to obtain. - * @return Returns the created {@link WantAgent} object. + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @param { AsyncCallback } callback - The callback is used to return the created WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; + + /** + * Obtains a WantAgent object. + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @returns { Promise } Returns the created WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function getWantAgent(info: WantAgentInfo): Promise; /** * Obtains the {@link OperationType} of a {@link WantAgent}. - * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the OperationType of the WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 - * @param agent Indicates the {@link WantAgent} whose {@link OperationType} is to be obtained. - * @return Returns the {@link OperationType} of the {@link WantAgent}. */ function getOperationType(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the {@link OperationType} of a {@link WantAgent}. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the OperationType of the WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function getOperationType(agent: WantAgent): Promise; /** * Enumerates flags for using a WantAgent. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export enum WantAgentFlags { /** @@ -182,6 +248,9 @@ declare namespace wantAgent { /** * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export enum OperationType { /** @@ -212,49 +281,63 @@ declare namespace wantAgent { /** * Describes the data returned by after wantAgent.trigger is called. + * @typedef CompleteData + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export interface CompleteData { /** * Triggered WantAgent. + * @type { WantAgent } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ info: WantAgent; /** * Existing Want that is triggered. + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ want: Want; /** * Request code used to trigger the WantAgent. + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ finalCode: number; /** * Final data collected by the common event. + * @type { string } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ finalData: string; /** * Extra data collected by the common event. + * @type { { [key: string]: any } } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ - extraInfo?: {[key: string]: any}; + extraInfo?: { [key: string]: any }; } /** * Provides the information required for triggering a WantAgent. - * - * @name TriggerInfo - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export type TriggerInfo = _TriggerInfo /** * Provides the information required for triggering a WantAgent. - * - * @name WantAgentInfo - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export type WantAgentInfo = _WantAgentInfo } diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 99cfd35561..1d74c2371f 100755 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -29,6 +29,8 @@ import rpc from './@ohos.rpc'; * @param msg Monitor status notification information. * @return - * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.Ability */ export interface OnReleaseCallBack { (msg: string): void; @@ -43,6 +45,8 @@ export interface OnReleaseCallBack { * @param indata Notification data notified from the caller. * @return rpc.Sequenceable * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.Ability */ export interface CalleeCallBack { (indata: rpc.MessageParcel): rpc.Sequenceable; @@ -55,6 +59,8 @@ export interface CalleeCallBack { * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.Ability */ export interface Caller { /** @@ -110,6 +116,8 @@ export interface Caller { * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.Ability */ export interface Callee { @@ -144,6 +152,8 @@ export interface Callee { * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.Ability */ export default class Ability { /** diff --git a/api/@ohos.application.abilityManager.d.ts b/api/@ohos.application.abilityManager.d.ts index a35eebd583..a161cc8290 100644 --- a/api/@ohos.application.abilityManager.d.ts +++ b/api/@ohos.application.abilityManager.d.ts @@ -26,6 +26,8 @@ import { ElementName } from './bundle/elementName'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi Hide this for inner system use * @permission N/A + * @deprecated since 9 + * @useinstead @ohos.app.ability.abilityManager */ declare namespace abilityManager { /** diff --git a/api/@ohos.application.errorManager.d.ts b/api/@ohos.application.errorManager.d.ts index dda4361c79..912f35efd4 100644 --- a/api/@ohos.application.errorManager.d.ts +++ b/api/@ohos.application.errorManager.d.ts @@ -23,6 +23,8 @@ import * as _ErrorObserver from './application/ErrorObserver'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import errorManager from '@ohos.application.errorManager' * @permission N/A + * @deprecated since 9 + * @useinstead @ohos.app.ability.errorManager */ declare namespace errorManager { /** diff --git a/api/@ohos.application.missionManager.d.ts b/api/@ohos.application.missionManager.d.ts index 3f43e85ddc..3398ce0a51 100644 --- a/api/@ohos.application.missionManager.d.ts +++ b/api/@ohos.application.missionManager.d.ts @@ -27,6 +27,8 @@ import StartOptions from "./@ohos.application.StartOptions"; * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @permission ohos.permission.MANAGE_MISSIONS * @systemapi hide for inner use. + * @deprecated since 9 + * @useinstead @ohos.app.ability.missionManager */ declare namespace missionManager { /** diff --git a/api/@ohos.application.quickFixManager.d.ts b/api/@ohos.application.quickFixManager.d.ts index d30e16fe03..4db4e87d7c 100644 --- a/api/@ohos.application.quickFixManager.d.ts +++ b/api/@ohos.application.quickFixManager.d.ts @@ -22,6 +22,8 @@ import { AsyncCallback } from "./basic"; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead @ohos.app.ability.quickFixManager */ declare namespace quickFixManager { /** diff --git a/api/@ohos.wantAgent.d.ts b/api/@ohos.wantAgent.d.ts index 48a996a481..a6344ef34f 100644 --- a/api/@ohos.wantAgent.d.ts +++ b/api/@ohos.wantAgent.d.ts @@ -27,6 +27,8 @@ import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import wantAgent from '@ohos.wantAgent'; * @permission N/A + * @deprecated since 9 + * @useinstead @ohos.app.wantAgent */ declare namespace wantAgent { /** diff --git a/api/ability/dataAbilityHelper.d.ts b/api/ability/dataAbilityHelper.d.ts index 870fe0c763..2ffbfefded 100644 --- a/api/ability/dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityHelper.d.ts @@ -27,7 +27,7 @@ import rdb from '../@ohos.data.rdb'; * @since 7 * @FAModelOnly * @deprecated since 9 - * @useinstead DataAbilityUtils + * @useinstead @ohos.app.ability.dataAbilityHelper */ export interface DataAbilityHelper { /** @@ -43,8 +43,6 @@ export interface DataAbilityHelper { * @param callback Indicates the callback when openfile success * @return Returns the file descriptor. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.openFile */ openFile(uri: string, mode: string, callback: AsyncCallback): void; openFile(uri: string, mode: string): Promise; @@ -59,8 +57,6 @@ export interface DataAbilityHelper { * @param callback Indicates the callback when dataChange. * @return - * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.on */ on(type: 'dataChange', uri: string, callback: AsyncCallback): void; @@ -74,8 +70,6 @@ export interface DataAbilityHelper { * @param callback Indicates the registered callback. * @return - * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.off */ off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; @@ -87,8 +81,6 @@ export interface DataAbilityHelper { * @param uri Indicates the path of the data to operate. * @return Returns the MIME type that matches the data specified by uri. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.getType */ getType(uri: string, callback: AsyncCallback): void; getType(uri: string): Promise; @@ -102,8 +94,6 @@ export interface DataAbilityHelper { * @param mimeTypeFilter Indicates the MIME types of the files to obtain. * @return Returns the matched MIME types Array. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.getFileTypes */ getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; getFileTypes(uri: string, mimeTypeFilter: string): Promise>; @@ -116,8 +106,6 @@ export interface DataAbilityHelper { * @param uri Indicates the uri object to normalize. * @return Returns the normalized uri object if the Data ability supports URI normalization or null. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.normalizeUri */ normalizeUri(uri: string, callback: AsyncCallback): void; normalizeUri(uri: string): Promise; @@ -130,8 +118,6 @@ export interface DataAbilityHelper { * @param uri Indicates the uri object to normalize. * @return Returns the denormalized uri object if the denormalization is successful. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.denormalizeUri */ denormalizeUri(uri: string, callback: AsyncCallback): void; denormalizeUri(uri: string): Promise; @@ -144,8 +130,6 @@ export interface DataAbilityHelper { * @param uri Indicates the path of the data to operate. * @return - * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.notifyChange */ notifyChange(uri: string, callback: AsyncCallback): void; notifyChange(uri: string): Promise; @@ -159,8 +143,6 @@ export interface DataAbilityHelper { * @param valuesBucket Indicates the data record to insert. If this parameter is null, a blank row will be inserted. * @return Returns the index of the inserted data record. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.insert */ insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise; @@ -174,8 +156,6 @@ export interface DataAbilityHelper { * @param valuesBuckets Indicates the data records to insert. * @return Returns the number of data records inserted. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.batchInsert */ batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback): void; batchInsert(uri: string, valuesBuckets: Array): Promise; @@ -189,8 +169,6 @@ export interface DataAbilityHelper { * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. * @return Returns the number of data records deleted. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.delete */ delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise; @@ -206,8 +184,6 @@ export interface DataAbilityHelper { * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. * @return Returns the number of data records updated. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.update */ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise; @@ -223,8 +199,6 @@ export interface DataAbilityHelper { * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. * @return Returns the query result {@link ResultSet}. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.query */ query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; query(uri: string, callback: AsyncCallback): void; @@ -247,8 +221,6 @@ export interface DataAbilityHelper { * values of primitive types are supported, but not custom Sequenceable objects. * @return Returns the query result {@link PacMap}. * @FAModelOnly - * @deprecated since 9 - * @useinstead DataAbilityUtils.call */ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; call(uri: string, method: string, arg: string, extras: PacMap): Promise; @@ -261,8 +233,6 @@ export interface DataAbilityHelper { * @param uri Indicates the path of data to query. * @param operations Indicates the data operation list, which can contain multiple operations on the database. * @return Returns the result of each operation, in array {@link DataAbilityResult}. - * @deprecated since 9 - * @useinstead DataAbilityUtils.executeBatch */ executeBatch(uri: string, operations: Array, callback: AsyncCallback>): void; executeBatch(uri: string, operations: Array): Promise>; @@ -273,6 +243,8 @@ export interface DataAbilityHelper { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @FAModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.dataAbilityHelper */ export interface PacMap { diff --git a/api/app/context.d.ts b/api/app/context.d.ts index e24a3dd24b..570a4802e0 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -34,6 +34,8 @@ import bundle from '../@ohos.bundle'; * @import import abilityManager from 'app/context' * @permission N/A * @FAModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.featureAbility.context */ export interface Context extends BaseContext { @@ -275,6 +277,8 @@ export interface Context extends BaseContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @FAModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.featureAbility.context */ interface PermissionRequestResult { /** @@ -308,6 +312,8 @@ interface PermissionRequestResult { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @FAModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.featureAbility.context */ interface PermissionOptions { /** diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index c42a2a2981..7c774d9812 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -36,6 +36,8 @@ import image from '../@ohos.multimedia.image'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.AbilityContext */ export default class AbilityContext extends Context { /** diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 2f605c61cf..6191bcdd48 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -25,6 +25,8 @@ import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.ApplicationContext */ export default class ApplicationContext extends Context { /** diff --git a/api/application/Context.d.ts b/api/application/Context.d.ts index 26c6eadcad..8563121f3a 100755 --- a/api/application/Context.d.ts +++ b/api/application/Context.d.ts @@ -27,6 +27,8 @@ import ApplicationContext from "./ApplicationContext"; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.Context */ export default class Context extends BaseContext { /** diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 7fe3d203ca..ed61b12efc 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -20,6 +20,8 @@ * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.EventHub */ export default class EventHub { /** diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index dd21ca7d0a..757cea7ffc 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -29,6 +29,8 @@ import StartOptions from "../@ohos.application.StartOptions"; * @systemapi hide for inner use. * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead @ohos.app.ability.ServiceExtensionContext */ export default class ServiceExtensionContext extends ExtensionContext { /** diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index d6e08d73b2..46cb8dcfb4 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -29,6 +29,8 @@ import { ShellCmdResult } from './shellCmdResult'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import AbilityDelegator from 'application/abilityDelegator.d' * @permission N/A + * @deprecated since 9 + * @useinstead @ohos.app.ability.abilityDelegator */ export interface AbilityDelegator { /** -- Gitee From 4ec67965ca259fd2ab083efcc2713515631bf9b2 Mon Sep 17 00:00:00 2001 From: yangzk Date: Fri, 14 Oct 2022 20:22:24 +0800 Subject: [PATCH 05/34] IssueNo: #I5RT32 Description: move back Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.Ability.d.ts | 2 +- api/@ohos.app.ability.AbilityContext.d.ts | 528 ------------------ api/@ohos.app.ability.ApplicationContext.d.ts | 93 --- api/@ohos.app.ability.Context.d.ts | 192 ------- api/@ohos.app.ability.EventHub.d.ts | 57 -- ...s.app.ability.ServiceExtensionContext.d.ts | 305 ---------- api/@ohos.app.ability.abilityDelegator.d.ts | 360 ------------ api/@ohos.app.featureAbility.d.ts | 4 +- api/@ohos.app.form.FormExtensionContext.d.ts | 41 -- api/@ohos.app.particleAbility.d.ts | 2 +- .../dataAbilityUtils.d.ts} | 12 +- .../featureAbilityContext.d.ts} | 18 +- api/application/AbilityContext.d.ts | 486 +++++++++++----- api/application/ApplicationContext.d.ts | 68 ++- api/application/Context.d.ts | 135 +++-- api/application/EventHub.d.ts | 45 +- api/application/ServiceExtensionContext.d.ts | 287 +++++++--- api/application/abilityDelegator.d.ts | 303 +++++++--- 18 files changed, 931 insertions(+), 2007 deletions(-) delete mode 100644 api/@ohos.app.ability.AbilityContext.d.ts delete mode 100644 api/@ohos.app.ability.ApplicationContext.d.ts delete mode 100644 api/@ohos.app.ability.Context.d.ts delete mode 100644 api/@ohos.app.ability.EventHub.d.ts delete mode 100644 api/@ohos.app.ability.ServiceExtensionContext.d.ts delete mode 100644 api/@ohos.app.ability.abilityDelegator.d.ts delete mode 100644 api/@ohos.app.form.FormExtensionContext.d.ts rename api/{@ohos.app.ability.dataAbilityHelper.d.ts => ability/dataAbilityUtils.d.ts} (98%) rename api/{@ohos.app.featureAbility.context.d.ts => app/featureAbilityContext.d.ts} (98%) diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts index 340c4e952a..c75fe2d93c 100755 --- a/api/@ohos.app.ability.Ability.d.ts +++ b/api/@ohos.app.ability.Ability.d.ts @@ -14,7 +14,7 @@ */ import AbilityConstant from "./@ohos.application.AbilityConstant"; -import AbilityContext from "./@ohos.app.ability.AbilityContext"; +import AbilityContext from "./application/AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; import { Configuration } from './@ohos.application.Configuration'; diff --git a/api/@ohos.app.ability.AbilityContext.d.ts b/api/@ohos.app.ability.AbilityContext.d.ts deleted file mode 100644 index 9549de949e..0000000000 --- a/api/@ohos.app.ability.AbilityContext.d.ts +++ /dev/null @@ -1,528 +0,0 @@ -/* - * 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 { AbilityInfo } from "./bundle/abilityInfo"; -import { AbilityResult } from "./ability/abilityResult"; -import { AsyncCallback } from "./basic"; -import { ConnectOptions } from "./ability/connectOptions"; -import { HapModuleInfo } from "./bundle/hapModuleInfo"; -import Context from "./@ohos.app.ability.Context"; -import Want from "./@ohos.application.Want"; -import StartOptions from "./@ohos.application.StartOptions"; -import PermissionRequestResult from "./application/PermissionRequestResult"; -import { Configuration } from './@ohos.application.Configuration'; -import { Caller } from './@ohos.app.ability.Ability'; -import { LocalStorage } from 'StateManagement'; -import image from './@ohos.multimedia.image'; - -/** - * The context of an ability. It allows access to ability-specific resources. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ -export default class AbilityContext extends Context { - /** - * Indicates configuration information about an ability. - * @type { AbilityInfo } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - abilityInfo: AbilityInfo; - - /** - * Indicates configuration information about the module. - * @type { HapModuleInfo } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - currentHapModuleInfo: HapModuleInfo; - - /** - * Indicates configuration information. - * @type { Configuration } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - config: Configuration; - - /** - * Starts a new ability. - * @param want { Want } - Indicates the ability to start. - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, callback: AsyncCallback): void; - - /** - * Starts a new ability. - * @param { Want } want - Indicates the ability to start. - * @param { StartOptions } options - Indicates the start options. - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; - - /** - * Starts a new ability. - * @param { Want } want - Indicates the ability to start. - * @param { StartOptions } options - Indicates the start options. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, options?: StartOptions): Promise; - - /** - * Get the caller object of the startup capability - * @param { Want } want - Indicates the ability to start. - * @returns { Promise } Returns the Caller interface. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbilityByCall(want: Want): Promise; - - /** - * Starts a new ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Starts a new ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { StartOptions } options - Indicates the start options. - * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; - - /** - * Starts a new ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { StartOptions } options - Indicates the start options. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * @param { Want } want - Indicates the ability to start. - * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbilityForResult(want: Want, callback: AsyncCallback): void; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * @param { Want } want - Indicates the ability to start. - * @param { StartOptions } options - Indicates the start options. - * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * @param { Want } want - Indicates the ability to start. - * @param { StartOptions } options - Indicates the start options. - * @returns { Promise } Returns the result of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - startAbilityForResult(want: Want, options?: StartOptions): Promise; - - /** - * Starts an ability and returns the execution result when the ability is destroyed with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Starts an ability and returns the execution result when the ability is destroyed with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { StartOptions } options - Indicates the start options. - * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; - - /** - * Starts an ability and returns the execution result when the ability is destroyed with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { StartOptions } options - Indicates the start options. - * @returns { Promise } Returns the result of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; - - /** - * Starts a new service extension ability. - * @param { Want } want - Indicates the want info to start. - * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; - - /** - * Starts a new service extension ability. - * @param { Want } want - Indicates the want info to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbility(want: Want): Promise; - - /** - * Starts a new service extension ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Starts a new service extension ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - - /** - * Stops a service within the same application. - * @param { Want } want - Indicates the want info to start. - * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; - - /** - * Stops a service within the same application. - * @param { Want } want - Indicates the want info to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbility(want: Want): Promise; - - /** - * Stops a service within the same application with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the accountId to start. - * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Stops a service within the same application with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the accountId to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - - /** - * Destroys this Page ability. - * @param { AsyncCallback } callback - The callback of terminateSelf. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - terminateSelf(callback: AsyncCallback): void; - - /** - * Destroys this Page ability. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - terminateSelf(): Promise; - - /** - * Sets the result code and data to be returned by this Page ability to the caller - * and destroys this Page ability. - * @param { AbilityResult } parameter - Indicates the result to return. - * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; - - /** - * Sets the result code and data to be returned by this Page ability to the caller - * and destroys this Page ability. - * @param { AbilityResult } parameter - Indicates the result to return. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - terminateSelfWithResult(parameter: AbilityResult): Promise; - - /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * @param { Want } want - The element name of the service ability - * @param { ConnectOptions } options - The remote object instance - * @returns { number } Returns the number code of the ability connected - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - connectAbility(want: Want, options: ConnectOptions): number; - - /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @param { Want } want - The element name of the service ability - * @param { number } accountId - The account to connect - * @param { ConnectOptions } options - The remote object instance - * @returns { number } Returns the number code of the ability connected - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; - - /** - * The callback interface was connect successfully. - * @param { number } connection - The number code of the ability connected - * @param { AsyncCallback } callback - The callback of disconnectAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - disconnectAbility(connection: number, callback: AsyncCallback): void; - - /** - * The callback interface was connect successfully. - * @param { number } connection - The number code of the ability connected - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - disconnectAbility(connection: number): Promise; - - /** - * Set mission label of current ability. - * @param { string } label - The label of ability that showed in recent missions. - * @param { AsyncCallback } callback - The callback of setMissionLabel. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - setMissionLabel(label: string, callback: AsyncCallback): void; - - /** - * Set mission label of current ability. - * @param { string } label - The label of ability that showed in recent missions. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - setMissionLabel(label: string): Promise; - - /** - * Set mission icon of current ability. - * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. - * @param { AsyncCallback } callback - The callback of setMissionIcon. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - setMissionIcon(icon: image.PixelMap, callback: AsyncCallback): void; - - /** - * Set mission icon of current ability. - * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - setMissionIcon(icon: image.PixelMap): Promise; - - /** - * Requests certain permissions from the system. - * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter - * cannot be null or empty. - * @param { AsyncCallback } requestCallback - The callback is used to return the permission - * request result. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void; - - /** - * Requests certain permissions from the system. - * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter - * cannot be null or empty. - * @returns { Promise } Returns the permission request result. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - requestPermissionsFromUser(permissions: Array): Promise; - - /** - * Restore window stage data in ability continuation - * @param { LocalStorage } localStorage - the storage data used to restore window stage - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - restoreWindowStage(localStorage: LocalStorage): void; - - /** - * check to see ability is in terminating state. - * @returns { boolean } Returns true when ability is in terminating state, else returns false. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - isTerminating(): boolean; -} diff --git a/api/@ohos.app.ability.ApplicationContext.d.ts b/api/@ohos.app.ability.ApplicationContext.d.ts deleted file mode 100644 index 065247fca6..0000000000 --- a/api/@ohos.app.ability.ApplicationContext.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 Context from "./@ohos.app.ability.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. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ -export default class ApplicationContext extends Context { - /** - * Register ability lifecycle callback. - * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. - * @returns { number } Returns the number code of the callback. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; - - /** - * Unregister ability lifecycle callback. - * @param { number } callbackId - Indicates the number code of the callback. - * @param { AsyncCallback } callback - The callback of unregisterAbilityLifecycleCallback. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; - - /** - * Unregister ability lifecycle callback. - * @param { number } callbackId - Indicates the number code of the callback. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - unregisterAbilityLifecycleCallback(callbackId: number): Promise; - - /** - * Register environment callback. - * @param { EnvironmentCallback } callback - The environment callback. - * @returns { number } Returns the number code of the callback. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - registerEnvironmentCallback(callback: EnvironmentCallback): number; - - /** - * Unregister environment callback. - * @param { number } callbackId - Indicates the number code of the callback. - * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; - - /** - * Unregister environment callback. - * @param { number } callbackId - Indicates the number code of the callback. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - unregisterEnvironmentCallback(callbackId: number): Promise; -} diff --git a/api/@ohos.app.ability.Context.d.ts b/api/@ohos.app.ability.Context.d.ts deleted file mode 100644 index 674cefb9e1..0000000000 --- a/api/@ohos.app.ability.Context.d.ts +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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 { ApplicationInfo } from "./bundle/applicationInfo"; -import resmgr from "./@ohos.resourceManager"; -import BaseContext from "./application/BaseContext"; -import EventHub from "./@ohos.app.ability.EventHub"; -import ApplicationContext from "./@ohos.app.ability.ApplicationContext"; - -/** - * The base context of an ability or an application. It allows access to - * application-specific resources. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ -export default class Context extends BaseContext { - /** - * Indicates the capability of accessing application resources. - * @type { resmgr.ResourceManager } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - resourceManager: resmgr.ResourceManager; - - /** - * Indicates configuration information about an application. - * @type { ApplicationInfo } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - applicationInfo: ApplicationInfo; - - /** - * Indicates app cache dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - cacheDir: string; - - /** - * Indicates app temp dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - tempDir: string; - - /** - * Indicates app files dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - filesDir: string; - - /** - * Indicates app database dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - databaseDir: string; - - /** - * Indicates app preferences dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - preferencesDir: string; - - /** - * Indicates app bundle code dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - bundleCodeDir: string; - - /** - * Indicates app distributed files dir. - * @type { string } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - distributedFilesDir: string; - - /** - * Indicates event hub. - * @type { EventHub } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - eventHub: EventHub; - - /** - * Indicates file area. - * @type { AreaMode } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - area: AreaMode; - - /** - * Create a bundle context - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - * @param { string } bundleName - Indicates the bundle name. - * @returns { Context } Returns the application context. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - createBundleContext(bundleName: string): Context; - - /** - * Create a module context - * @param { string } moduleName - Indicates the module name. - * @returns { Context } Returns the application context. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - createModuleContext(moduleName: string): Context; - - /** - * Create a module context - * @param { string } bundleName - Indicates the bundle name. - * @param { string } moduleName - Indicates the module name. - * @returns { Context } Returns the application context. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - createModuleContext(bundleName: string, moduleName: string): Context; - - /** - * Get application context - * @returns { ApplicationContext } Returns the application context. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - getApplicationContext(): ApplicationContext; -} - -/** - * Enum for the file area mode - * @enum { number } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ -export enum AreaMode { - /** - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ - EL1 = 0, - /** - * @syscap SystemCapability.Ability.AbilityRuntime.Core - */ - EL2 = 1 -} diff --git a/api/@ohos.app.ability.EventHub.d.ts b/api/@ohos.app.ability.EventHub.d.ts deleted file mode 100644 index 708e937969..0000000000 --- a/api/@ohos.app.ability.EventHub.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 { BusinessError } from './basic'; - -/** - * The event center of a context, support the subscription and publication of events. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ -export default class EventHub { - /** - * Subscribe to an event. - * @param { string } event - Indicates the event. - * @param { Function } callback - Indicates the callback. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - on(event: string, callback: Function): void - - /** - * Unsubscribe from an event. - * @param { string } event - Indicates the event. - * @param { Function } callback - Indicates the callback. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - off(event: string, callback?: Function): void - - /** - * Trigger the event callbacks. - * @param { string } event - Indicates the event. - * @param { Object[] } args - Indicates the callback arguments. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @stagemodelonly - * @since 9 - */ - emit(event: string, ...args: Object[]): void -} \ No newline at end of file diff --git a/api/@ohos.app.ability.ServiceExtensionContext.d.ts b/api/@ohos.app.ability.ServiceExtensionContext.d.ts deleted file mode 100644 index 9b9b3afa18..0000000000 --- a/api/@ohos.app.ability.ServiceExtensionContext.d.ts +++ /dev/null @@ -1,305 +0,0 @@ -/* - * 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 { ConnectOptions } from "./ability/connectOptions"; -import { Caller } from './@ohos.app.ability.Ability'; -import ExtensionContext from "./application/ExtensionContext"; -import Want from "./@ohos.application.Want"; -import StartOptions from "./@ohos.application.StartOptions"; - -/** - * The context of service extension. It allows access to - * serviceExtension-specific resources. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ -export default class ServiceExtensionContext extends ExtensionContext { - /** - * Service extension uses this method to start a specific ability. - * @param { Want } want - Indicates the ability to start. - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, callback: AsyncCallback): void; - - /** - * Service extension uses this method to start a specific ability. - * @param { Want } want - Indicates the ability to start. - * @param { StartOptions } options - Indicates the start options. - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; - - /** - * Service extension uses this method to start a specific ability. - * @param { Want } want - Indicates the ability to start. - * @param { StartOptions } options - Indicates the start options. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, options?: StartOptions): Promise; - - /** - * Service extension uses this method to start a specific ability with account. - * @param { Want } want - Indicates the ability to start. - * @param { number } accountId - Indicates the accountId to start. - * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Service extension uses this method to start a specific ability with account. - * @param { Want } want - Indicates the ability to start. - * @param { number } accountId - Indicates the accountId to start. - * @param { StartOptions } options - Indicates the start options. - * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; - - /** - * Service extension uses this method to start a specific ability with account. - * @param { Want } want - Indicates the ability to start. - * @param { number } accountId - Indicates the accountId to start. - * @param { StartOptions } options - Indicates the start options. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; - - /** - * Starts a new service extension ability. - * @param { Want } want - Indicates the want info to start. - * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; - - /** - * Starts a new service extension ability. - * @param { Want } want - Indicates the want info to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbility(want: Want): Promise; - - /** - * Starts a new service extension ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Starts a new service extension ability with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the account to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - - /** - * Stops a service within the same application. - * @param { Want } want - Indicates the want info to start. - * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; - - /** - * Stops a service within the same application. - * @param { Want } want - Indicates the want info to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbility(want: Want): Promise; - - /** - * Stops a service within the same application with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the accountId to start. - * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; - - /** - * Stops a service within the same application with account. - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @param { Want } want - Indicates the want info to start. - * @param { number } accountId - Indicates the accountId to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; - - /** - * Destroys this service extension. - * @param { AsyncCallback } callback - The callback of terminateSelf. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - terminateSelf(callback: AsyncCallback): void; - - /** - * Destroys this service extension. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - terminateSelf(): Promise; - - /** - * Connects an ability to a Service extension. - *

This method can be called by an ability or service extension, but the destination of the connection must be a - * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target - * service extension when the Service extension is connected.

- * @param { Want } want - Indicates the service extension to connect. - * @param { ConnectOptions } options - Indicates the callback of connection. - * @returns { number } Returns the connection id. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - connectAbility(want: Want, options: ConnectOptions): number; - - /** - * Connects an ability to a Service extension with account. - *

This method can be called by an ability or service extension, but the destination of the connection must be a - * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target - * service extension when the Service extension is connected.

- * @param { Want } want - Indicates the service extension to connect. - * @param { number } accountId - Indicates the account to connect. - * @param { ConnectOptions } options - Indicates the callback of connection. - * @returns { number } Returns the connection id. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; - - /** - * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. - * @param { number } connection - the connection id returned from connectAbility api. - * @param { AsyncCallback } callback - The callback of disconnectAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - disconnectAbility(connection: number, callback: AsyncCallback): void; - - /** - * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. - * @param { number } connection - the connection id returned from connectAbility api. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - disconnectAbility(connection: number): Promise; - - /** - * Get the caller object of the startup capability - * @param { Want } want - Indicates the ability to start. - * @returns { Promise } Returns the Caller interface. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbilityByCall(want: Want): Promise; -} \ No newline at end of file diff --git a/api/@ohos.app.ability.abilityDelegator.d.ts b/api/@ohos.app.ability.abilityDelegator.d.ts deleted file mode 100644 index 0e9bde748c..0000000000 --- a/api/@ohos.app.ability.abilityDelegator.d.ts +++ /dev/null @@ -1,360 +0,0 @@ -/* - * 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 Ability from './@ohos.app.ability.Ability'; -import AbilityStage from './@ohos.application.AbilityStage'; -import { AbilityMonitor } from './application/abilityMonitor'; -import { AbilityStageMonitor } from './application/abilityStageMonitor'; -import Context from './@ohos.app.ability.Context'; -import Want from "./@ohos.application.Want"; -import { ShellCmdResult } from './application/shellCmdResult'; - -/** - * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. - * @interface - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ -export interface AbilityDelegator { - /** - * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. - * @param { AbilityMonitor } monitor - AbilityMonitor object - * @param { AsyncCallback } callback - The callback of addAbilityMonitor. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; - - /** - * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. - * @param { AbilityMonitor } monitor - AbilityMonitor object - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - addAbilityMonitor(monitor: AbilityMonitor): Promise; - - /** - * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @param { AsyncCallback } callback - The callback of addAbilityStageMonitor. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - - /** - * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; - - /** - * Remove a specified AbilityMonitor object from the application memory. - * @param { AbilityMonitor } monitor - AbilityMonitor object. - * @param { AsyncCallback } callback - The callback of removeAbilityMonitor. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; - - /** - * Remove a specified AbilityMonitor object from the application memory. - * @param { AbilityMonitor } monitor - AbilityMonitor object. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - removeAbilityMonitor(monitor: AbilityMonitor): Promise; - - /** - * Remove a specified AbilityStageMonitor object from the application memory. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @param { AsyncCallback } callback - The callback of removeAbilityStageMonitor. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - - /** - * Remove a specified AbilityStageMonitor object from the application memory. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; - - /** - * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. - * @param { AbilityMonitor } monitor - AbilityMonitor object. - * @param { AsyncCallback } callback - The callback is used to return the Ability object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; - - /** - * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. - * @param { AbilityMonitor } monitor - AbilityMonitor object. - * @param { number } timeout - Maximum wait time, in milliseconds. - * @param { AsyncCallback } callback - The callback is used to return the Ability object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback): void; - - /** - * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. - * @param { AbilityMonitor } monitor - AbilityMonitor object. - * @param { number } timeout - Maximum wait time, in milliseconds. - * @returns { Promise } Returns the Ability object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise; - - /** - * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - - /** - * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @param { number } timeout - Maximum wait time, in milliseconds. - * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; - - /** - * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. - * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. - * @param { number } timeout - Maximum wait time, in milliseconds. - * @returns { Promise } Returns the AbilityStage object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; - - /** - * Obtain the application context. - * @returns { Context } Returns the app Context. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - getAppContext(): Context; - - /** - * Obtain the lifecycle state of a specified ability. - * @param { Ability } ability - The Ability object. - * @returns { number } Returns the state of the Ability object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - getAbilityState(ability: Ability): number; - - /** - * Obtain the ability that is currently being displayed. - * @param { AsyncCallback } callback - The callback is used to return the Ability object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - getCurrentTopAbility(callback: AsyncCallback): void; - - /** - * Obtain the ability that is currently being displayed. - * @returns { Promise } Returns the Ability object. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - getCurrentTopAbility(): Promise - - /** - * Start a new ability. - * @param { Want } want - Indicates the ability to start - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - startAbility(want: Want, callback: AsyncCallback): void; - - /** - * Start a new ability. - * @param { Want } want - Indicates the ability to start - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - startAbility(want: Want): Promise; - - /** - * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. - * @param { Ability } ability - The ability object. - * @param { AsyncCallback } callback - The callback of doAbilityForeground. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - doAbilityForeground(ability: Ability, callback: AsyncCallback): void; - - /** - * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. - * @param { Ability } ability - The ability object. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - doAbilityForeground(ability: Ability): Promise; - - /** - * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. - * @param { Ability } ability - The ability object. - * @param { AsyncCallback } callback - The callback of doAbilityBackground. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - doAbilityBackground(ability: Ability, callback: AsyncCallback): void; - - /** - * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. - * @param { Ability } ability - The ability object. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - doAbilityBackground(ability: Ability): Promise; - - /** - * Prints log information to the unit testing console. - * The total length of the log information to be printed cannot exceed 1000 characters. - * @param { string } msg - Log information. - * @param { AsyncCallback } callback - The callback of print. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - print(msg: string, callback: AsyncCallback): void; - - /** - * Prints log information to the unit testing console. - * The total length of the log information to be printed cannot exceed 1000 characters. - * @param { string } msg - Log information. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - print(msg: string): Promise; - - /** - * Prints log information to the unit testing console. - * The total length of the log information to be printed cannot exceed 1000 characters. - * @param { string } msg - Log information. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - printSync(msg: string): void; - - /** - * Execute the given command in the aa tools side. - * @param { string } cmd - The shell command. - * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - executeShellCommand(cmd: string, callback: AsyncCallback): void; - - /** - * Execute the given command in the aa tools side. - * @param { string } cmd - Shell command. - * @param { number } timeoutSecs - Timeout, in seconds. - * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; - - /** - * Execute the given command in the aa tools side. - * @param { string } cmd - Shell command. - * @param { number } timeoutSecs - Timeout, in seconds. - * @returns { Promise } Returns the ShellCmdResult object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - executeShellCommand(cmd: string, timeoutSecs?: number): Promise; - - /** - * Finish the test and print log information to the unit testing console. - * The total length of the log information to be printed cannot exceed 1000 characters. - * @param { string } msg - Log information. - * @param { number } code - Result code. - * @param { AsyncCallback } callback - The callback of finishTest. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - finishTest(msg: string, code: number, callback: AsyncCallback): void; - - /** - * Finish the test and print log information to the unit testing console. - * The total length of the log information to be printed cannot exceed 1000 characters. - * @param { string } msg - Log information. - * @param { number } code - Result code. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - finishTest(msg: string, code: number): Promise; -} - -export default AbilityDelegator; diff --git a/api/@ohos.app.featureAbility.d.ts b/api/@ohos.app.featureAbility.d.ts index 4662f9b078..839d320813 100644 --- a/api/@ohos.app.featureAbility.d.ts +++ b/api/@ohos.app.featureAbility.d.ts @@ -19,8 +19,8 @@ import Want from './@ohos.application.Want'; import { StartAbilityParameter } from './ability/startAbilityParameter'; import { AbilityResult } from './ability/abilityResult'; import { AppVersionInfo as _AppVersionInfo } from './app/appVersionInfo'; -import { Context } from './@ohos.app.featureAbility.context'; -import { DataAbilityHelper } from './@ohos.app.ability.dataAbilityHelper'; +import { Context } from './app/featureAbilityContext'; +import { DataAbilityHelper } from './ability/dataAbilityUtils'; import { ConnectOptions } from './ability/connectOptions'; import { ProcessInfo as _ProcessInfo } from './app/processInfo'; import window from './@ohos.window'; diff --git a/api/@ohos.app.form.FormExtensionContext.d.ts b/api/@ohos.app.form.FormExtensionContext.d.ts deleted file mode 100644 index 36d2b54ebb..0000000000 --- a/api/@ohos.app.form.FormExtensionContext.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 ExtensionContext from "./application/ExtensionContext"; -import formBindingData from './@ohos.app.form.formBindingData'; -import Want from './@ohos.application.Want'; - -/** - * The context of form extension. It allows access to - * formExtension-specific resources. - * @syscap SystemCapability.Ability.Form - * @stagemodelonly - * @since 9 - */ -export default class FormExtensionContext extends ExtensionContext { - /** - * start an ability within the same bundle. - * @param { Want } want - includes ability name, parameters and relative info sending to an ability. - * @param { AsyncCallback } callback - The callback of startAbility. - * @returns { Promise } The promise returned by the function. - * @syscap SystemCapability.Ability.Form - * @systemapi - * @stagemodelonly - * @since 9 - */ - startAbility(want: Want, callback: AsyncCallback): void; - startAbility(want: Want): Promise; -} diff --git a/api/@ohos.app.particleAbility.d.ts b/api/@ohos.app.particleAbility.d.ts index 720bd45ed8..1e31a0c94d 100644 --- a/api/@ohos.app.particleAbility.d.ts +++ b/api/@ohos.app.particleAbility.d.ts @@ -15,7 +15,7 @@ import { AsyncCallback } from './basic'; import { StartAbilityParameter } from './ability/startAbilityParameter'; -import { DataAbilityHelper } from './@ohos.app.ability.dataAbilityHelper'; +import { DataAbilityHelper } from './ability/dataAbilityUtils'; import { NotificationRequest } from './notification/notificationRequest'; import { ConnectOptions } from './ability/connectOptions'; import Want from './@ohos.application.Want'; diff --git a/api/@ohos.app.ability.dataAbilityHelper.d.ts b/api/ability/dataAbilityUtils.d.ts similarity index 98% rename from api/@ohos.app.ability.dataAbilityHelper.d.ts rename to api/ability/dataAbilityUtils.d.ts index d1defbdf63..79ad8e7d7d 100644 --- a/api/@ohos.app.ability.dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityUtils.d.ts @@ -13,12 +13,12 @@ * limitations under the License. */ -import { AsyncCallback } from './basic'; -import { ResultSet } from './data/rdb/resultSet'; -import { DataAbilityOperation } from './ability/dataAbilityOperation'; -import { DataAbilityResult } from './ability/dataAbilityResult'; -import dataAbility from './@ohos.data.dataAbility'; -import rdb from './@ohos.data.rdb'; +import { AsyncCallback } from '../basic'; +import { ResultSet } from '../data/rdb/resultSet'; +import { DataAbilityOperation } from './dataAbilityOperation'; +import { DataAbilityResult } from './dataAbilityResult'; +import dataAbility from '../@ohos.data.dataAbility'; +import rdb from '../@ohos.data.rdb'; /** * DataAbilityHelper diff --git a/api/@ohos.app.featureAbility.context.d.ts b/api/app/featureAbilityContext.d.ts similarity index 98% rename from api/@ohos.app.featureAbility.context.d.ts rename to api/app/featureAbilityContext.d.ts index 4bfd481abd..8d0dca6422 100644 --- a/api/@ohos.app.featureAbility.context.d.ts +++ b/api/app/featureAbilityContext.d.ts @@ -13,15 +13,15 @@ * limitations under the License. */ -import { AsyncCallback } from './basic'; -import { ApplicationInfo } from './bundle/applicationInfo'; -import { ProcessInfo } from './app/processInfo'; -import { ElementName } from './bundle/elementName'; -import BaseContext from './application/BaseContext'; -import { HapModuleInfo } from './bundle/hapModuleInfo'; -import { AppVersionInfo } from './app/appVersionInfo'; -import { AbilityInfo } from './bundle/abilityInfo'; -import bundle from './@ohos.bundle'; +import { AsyncCallback } from '../basic'; +import { ApplicationInfo } from '../bundle/applicationInfo'; +import { ProcessInfo } from './processInfo'; +import { ElementName } from '../bundle/elementName'; +import BaseContext from '../application/BaseContext'; +import { HapModuleInfo } from '../bundle/hapModuleInfo'; +import { AppVersionInfo } from './appVersionInfo'; +import { AbilityInfo } from '../bundle/abilityInfo'; +import bundle from '../@ohos.bundle'; /** * The context of an ability or an application. It allows access to diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 7c774d9812..8b6a4c32f1 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -25,294 +25,504 @@ import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; import { Configuration } from '../@ohos.application.Configuration'; -import Caller from '../@ohos.application.Ability'; +import { Caller } from '../@ohos.app.ability.Ability'; import { LocalStorage } from 'StateManagement'; import image from '../@ohos.multimedia.image'; /** * The context of an ability. It allows access to ability-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.AbilityContext + * @stagemodelonly + * @since 9 */ export default class AbilityContext extends Context { /** * Indicates configuration information about an ability. - * - * @since 9 + * @type { AbilityInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ abilityInfo: AbilityInfo; /** - * Indicates configuration information about an module. - * - * @since 9 + * Indicates configuration information about the module. + * @type { HapModuleInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ currentHapModuleInfo: HapModuleInfo; /** * Indicates configuration information. - * - * @since 9 + * @type { Configuration } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ config: Configuration; /** * Starts a new ability. - * - * @since 9 + * @param want { Want } - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options?: StartOptions): Promise; /** * Get the caller object of the startup capability - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } Returns the Caller interface. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbilityByCall(want: Want): Promise; /** * Starts a new ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts a new ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @return Returns the {@link AbilityResult}. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbilityForResult(want: Want, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbilityForResult(want: Want, options?: StartOptions): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return Returns the {@link AbilityResult}. * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts a new service extension ability. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Stops a service within the same application. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Stops a service within the same application. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbility(want: Want): Promise; /** * Stops a service within the same application with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the accountId to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Stops a service within the same application with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Destroys this Page ability. - * - * @since 9 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this Page ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ terminateSelf(): Promise; /** * Sets the result code and data to be returned by this Page ability to the caller * and destroys this Page ability. - * - * @since 9 + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param parameter Indicates the result to return. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ terminateSelfWithResult(parameter: AbilityResult): Promise; /** * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * - * @since 9 + * @param { Want } want - The element name of the service ability + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want The element name of the service ability - * @param options The remote object instance - * @systemapi Hide this for inner system use. - * @return Returns the number code of the ability connected - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbility(want: Want, options: ConnectOptions): number; /** * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want The element name of the service ability - * @param accountId The account to connect - * @param options The remote object instance - * @systemapi hide for inner use. - * @return Returns the number code of the ability connected * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - The element name of the service ability + * @param { number } accountId - The account to connect + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; /** * The callback interface was connect successfully. - * + * @param { number } connection - The number code of the ability connected + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + disconnectAbility(connection: number, callback: AsyncCallback): void; + + /** + * The callback interface was connect successfully. + * @param { number } connection - The number code of the ability connected + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param connection The number code of the ability connected - * @systemapi Hide this for inner system use. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; /** * Set mission label of current ability. - * + * @param { string } label - The label of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionLabel. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + setMissionLabel(label: string, callback: AsyncCallback): void; + + /** + * Set mission label of current ability. + * @param { string } label - The label of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param label The label of ability that showed in recent missions. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - setMissionLabel(label: string, callback:AsyncCallback): void; - setMissionLabel(label: string): Promise; + setMissionLabel(label: string): Promise; /** * Set mission icon of current ability. - * + * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionIcon. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + setMissionIcon(icon: image.PixelMap, callback: AsyncCallback): void; + + /** + * Set mission icon of current ability. + * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param icon The icon of ability that showed in recent missions. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - setMissionIcon(icon: image.PixelMap, callback:AsyncCallback): void; - setMissionIcon(icon: image.PixelMap): Promise; + setMissionIcon(icon: image.PixelMap): Promise; - /** + /** * Requests certain permissions from the system. - * + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter + * cannot be null or empty. + * @param { AsyncCallback } requestCallback - The callback is used to return the permission + * request result. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void; + + /** + * Requests certain permissions from the system. + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter + * cannot be null or empty. + * @returns { Promise } Returns the permission request result. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null or empty. - * @return Returns the {@link PermissionRequestResult}. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback) : void; - requestPermissionsFromUser(permissions: Array) : Promise; + requestPermissionsFromUser(permissions: Array): Promise; /** * Restore window stage data in ability continuation - * - * @since 9 + * @param { LocalStorage } localStorage - the storage data used to restore window stage + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param LocalStorage the storage data used to restore window stage - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - restoreWindowStage(localStorage: LocalStorage) : void; + restoreWindowStage(localStorage: LocalStorage): void; /** * check to see ability is in terminating state. - * - * @since 9 + * @returns { boolean } Returns true when ability is in terminating state, else returns false. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns true when ability is in terminating state, else returns false. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ isTerminating(): boolean; } diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 6191bcdd48..516973add4 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -20,58 +20,74 @@ import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; /** * The context of an application. It allows access to application-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.ApplicationContext + * @stagemodelonly + * @since 9 */ export default class ApplicationContext extends Context { /** * Register ability lifecycle callback. - * - * @since 9 + * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. + * @returns { number } Returns the number code of the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callback The ability lifecycle callback. - * @return Returns the number code of the callback. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; /** * Unregister ability lifecycle callback. - * + * @param { number } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of unregisterAbilityLifecycleCallback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; + + /** + * Unregister ability lifecycle callback. + * @param { number } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callbackId Indicates the number code of the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; unregisterAbilityLifecycleCallback(callbackId: number): Promise; /** * Register environment callback. - * - * @since 9 + * @param { EnvironmentCallback } callback - The environment callback. + * @returns { number } Returns the number code of the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callback The environment callback. - * @return Returns the number code of the callback. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ registerEnvironmentCallback(callback: EnvironmentCallback): number; /** * Unregister environment callback. - * + * @param { number } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; + + /** + * Unregister environment callback. + * @param { number } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param callbackId Indicates the number code of the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; unregisterEnvironmentCallback(callbackId: number): Promise; } diff --git a/api/application/Context.d.ts b/api/application/Context.d.ts index 8563121f3a..32aeb23e08 100755 --- a/api/application/Context.d.ts +++ b/api/application/Context.d.ts @@ -22,168 +22,163 @@ import ApplicationContext from "./ApplicationContext"; /** * The base context of an ability or an application. It allows access to * application-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.Context + * @stagemodelonly + * @since 9 */ export default class Context extends BaseContext { /** * Indicates the capability of accessing application resources. - * - * @since 9 + * @type { resmgr.ResourceManager } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ resourceManager: resmgr.ResourceManager; /** * Indicates configuration information about an application. - * - * @since 9 + * @type { ApplicationInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ applicationInfo: ApplicationInfo; /** * Indicates app cache dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ cacheDir: string; /** * Indicates app temp dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ tempDir: string; /** * Indicates app files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - filesDir : string; + filesDir: string; /** * Indicates app database dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - databaseDir : string; + databaseDir: string; /** * Indicates app preferences dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - preferencesDir : string; + preferencesDir: string; /** * Indicates app bundle code dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - bundleCodeDir : string; + bundleCodeDir: string; /** * Indicates app distributed files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ distributedFilesDir: string; /** * Indicates event hub. - * - * @since 9 + * @type { EventHub } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ eventHub: EventHub; /** * Indicates file area. - * - * @since 9 + * @type { AreaMode } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ area: AreaMode; /** * Create a bundle context - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @param bundleName Indicates the bundle name. - * @return application context * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - * @StageModelOnly + * @param { string } bundleName - Indicates the bundle name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ createBundleContext(bundleName: string): Context; /** * Create a module context - * - * @since 9 + * @param { string } moduleName - Indicates the module name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param moduleName Indicates the module name. - * @return application context - * @StageModelOnly + * @stagemodelonly + * @since 9 */ createModuleContext(moduleName: string): Context; /** * Create a module context - * - * @since 9 + * @param { string } bundleName - Indicates the bundle name. + * @param { string } moduleName - Indicates the module name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @param bundleName Indicates the bundle name. - * @param moduleName Indicates the module name. - * @return application context - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ createModuleContext(bundleName: string, moduleName: string): Context; /** * Get application context - * - * @since 9 + * @returns { ApplicationContext } Returns the application context. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return application context - * @StageModelOnly + * @stagemodelonly + * @since 9 */ getApplicationContext(): ApplicationContext; } /** - * File area mode - * - * @since 9 + * Enum for the file area mode + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum AreaMode { /** diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index ed61b12efc..6947fca11f 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.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,50 +13,45 @@ * limitations under the License. */ +import { BusinessError } from '../basic'; + /** * The event center of a context, support the subscription and publication of events. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.EventHub + * @stagemodelonly + * @since 9 */ export default class EventHub { /** * Subscribe to an event. - * - * @since 9 + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param callback Indicates the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ on(event: string, callback: Function): void /** * Unsubscribe from an event. - * - * @since 9 + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param callback Indicates the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ off(event: string, callback?: Function): void /** * Trigger the event callbacks. - * - * @since 9 + * @param { string } event - Indicates the event. + * @param { Object[] } args - Indicates the callback arguments. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param args Indicates the callback arguments. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ emit(event: string, ...args: Object[]): void } \ No newline at end of file diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index 757cea7ffc..552e964ccf 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -15,7 +15,7 @@ import { AsyncCallback } from "../basic"; import { ConnectOptions } from "../ability/connectOptions"; -import Caller from '../@ohos.application.Ability'; +import { Caller } from '../@ohos.app.ability.Ability'; import ExtensionContext from "./ExtensionContext"; import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; @@ -23,172 +23,283 @@ import StartOptions from "../@ohos.application.StartOptions"; /** * The context of service extension. It allows access to * serviceExtension-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @permission N/A - * @StageModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.ServiceExtensionContext + * @systemapi + * @stagemodelonly + * @since 9 */ export default class ServiceExtensionContext extends ExtensionContext { /** * Service extension uses this method to start a specific ability. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options?: StartOptions): Promise; /** * Service extension uses this method to start a specific ability with account. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param accountId Indicates the accountId to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability with account. + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability with account. + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts a new service extension ability. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Stops a service within the same application. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Stops a service within the same application. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbility(want: Want): Promise; /** * Stops a service within the same application with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the accountId to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Stops a service within the same application with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Destroys this service extension. - * - * @since 9 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this service extension. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ terminateSelf(): Promise; /** * Connects an ability to a Service extension. - * *

This method can be called by an ability or service extension, but the destination of the connection must be a * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target * service extension when the Service extension is connected.

- * - * @since 9 + * @param { Want } want - Indicates the service extension to connect. + * @param { ConnectOptions } options - Indicates the callback of connection. + * @returns { number } Returns the connection id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the service extension to connect. - * @param options Indicates the callback of connection. - * @systemapi hide for inner use. - * @return connection id, int value. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbility(want: Want, options: ConnectOptions): number; /** * Connects an ability to a Service extension with account. - * *

This method can be called by an ability or service extension, but the destination of the connection must be a * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target * service extension when the Service extension is connected.

- * - * @since 9 + * @param { Want } want - Indicates the service extension to connect. + * @param { number } accountId - Indicates the account to connect. + * @param { ConnectOptions } options - Indicates the callback of connection. + * @returns { number } Returns the connection id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the service extension to connect. - * @param accountId Indicates the account to connect. - * @param options Indicates the callback of connection. - * @systemapi hide for inner use. - * @return connection id, int value. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; /** - * Disconnects an ability to a service extension, in contrast to - * {@link connectAbility}. - * + * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. + * @param { number } connection - the connection id returned from connectAbility api. + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + disconnectAbility(connection: number, callback: AsyncCallback): void; + + /** + * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. + * @param { number } connection - the connection id returned from connectAbility api. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param connection the connection id returned from connectAbility api. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; /** * Get the caller object of the startup capability - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } Returns the Caller interface. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - startAbilityByCall(want: Want): Promise; + startAbilityByCall(want: Want): Promise; } \ No newline at end of file diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index 46cb8dcfb4..520bd8ce43 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.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,7 +14,7 @@ */ import { AsyncCallback } from '../basic'; -import Ability from '../@ohos.application.Ability'; +import Ability from '../@ohos.app.ability.Ability'; import AbilityStage from '../@ohos.application.AbilityStage'; import { AbilityMonitor } from './abilityMonitor'; import { AbilityStageMonitor } from './abilityStageMonitor'; @@ -24,142 +24,249 @@ import { ShellCmdResult } from './shellCmdResult'; /** * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. - * - * @since 8 + * @interface * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegator from 'application/abilityDelegator.d' - * @permission N/A - * @deprecated since 9 - * @useinstead @ohos.app.ability.abilityDelegator + * @since 9 */ export interface AbilityDelegator { /** * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @param { AsyncCallback } callback - The callback of addAbilityMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object + * @since 9 */ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ addAbilityMonitor(monitor: AbilityMonitor): Promise; /** * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of addAbilityStageMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object + * @since 9 */ - addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; /** * Remove a specified AbilityMonitor object from the application memory. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object + * @since 9 */ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Remove a specified AbilityMonitor object from the application memory. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ removeAbilityMonitor(monitor: AbilityMonitor): Promise; /** * Remove a specified AbilityStageMonitor object from the application memory. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityStageMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Remove a specified AbilityStageMonitor object from the application memory. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object + * @since 9 */ - removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; /** * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object - * @param timeout Maximum wait time, in milliseconds - * @return success: return the Ability object, failure: return null + * @since 9 */ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback): void; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise; /** * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object - * @param timeout Maximum wait time, in milliseconds - * @return success: return the AbilityStage object, failure: return null + * @since 9 */ - waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; /** * Obtain the application context. - * - * @since 9 + * @returns { Context } Returns the app Context. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return App Context + * @since 9 */ getAppContext(): Context; /** * Obtain the lifecycle state of a specified ability. - * - * @since 9 + * @param { Ability } ability - The Ability object. + * @returns { number } Returns the state of the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The Ability object - * @return The state of the Ability object. enum AbilityLifecycleState + * @since 9 */ getAbilityState(ability: Ability): number; /** * Obtain the ability that is currently being displayed. - * - * @since 9 + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return The top ability of the current application + * @since 9 */ getCurrentTopAbility(callback: AsyncCallback): void; + + /** + * Obtain the ability that is currently being displayed. + * @returns { Promise } Returns the Ability object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ getCurrentTopAbility(): Promise /** * Start a new ability. - * - * @since 9 + * @param { Want } want - Indicates the ability to start + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start - * @return - + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Start a new ability. + * @param { Want } want - Indicates the ability to start + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ startAbility(want: Want): Promise; /** * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. - * + * @param { Ability } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityForeground. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + doAbilityForeground(ability: Ability, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * @param { Ability } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The ability object - * @return true: success false: failure + * @since 9 */ - doAbilityForeground(ability: Ability, callback: AsyncCallback): void; - doAbilityForeground(ability: Ability): Promise; + doAbilityForeground(ability: Ability): Promise; /** * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. - * + * @param { Ability } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityBackground. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + doAbilityBackground(ability: Ability, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * @param { Ability } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The ability object - * @return true: success false: failure + * @since 9 */ - doAbilityBackground(ability: Ability, callback: AsyncCallback): void; - doAbilityBackground(ability: Ability): Promise; + doAbilityBackground(ability: Ability): Promise; /** * Prints log information to the unit testing console. @@ -175,12 +282,34 @@ export interface AbilityDelegator { /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * + * @param { string } msg - Log information. + * @param { AsyncCallback } callback - The callback of printMsg. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + printMsg(msg: string, callback: AsyncCallback): void; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information + * @since 9 */ - printSync(msg: string): void; + printMsg(msg: string): Promise; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + printSync(msg: string): void; /** * Execute the given command in the aa tools side. @@ -195,16 +324,60 @@ export interface AbilityDelegator { executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; executeShellCommand(cmd: string, timeoutSecs?: number): Promise; + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - The shell command. + * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + executeShellCmd(cmd: string, callback: AsyncCallback): void; + + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - Shell command. + * @param { number } timeoutSecs - Timeout, in seconds. + * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + executeShellCmd(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; + + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - Shell command. + * @param { number } timeoutSecs - Timeout, in seconds. + * @returns { Promise } Returns the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + executeShellCmd(cmd: string, timeoutSecs?: number): Promise; + /** * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * - * @since 9 + * @param { string } msg - Log information. + * @param { number } code - Result code. + * @param { AsyncCallback } callback - The callback of finishTest. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information - * @param code Result code + * @since 9 */ finishTest(msg: string, code: number, callback: AsyncCallback): void; + + /** + * Finish the test and print log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @param { number } code - Result code. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ finishTest(msg: string, code: number): Promise; } -- Gitee From 22ae278a9ef712456ad0a7fbb8ca4d6900d8cdb4 Mon Sep 17 00:00:00 2001 From: yangzk Date: Fri, 14 Oct 2022 20:53:39 +0800 Subject: [PATCH 06/34] IssueNo: #I5RT32 Description: add Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.form.FormExtensionAbility.d.ts | 154 +++++++++++++++++++ api/@ohos.app.form.formHost.d.ts | 39 ++++- 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 api/@ohos.app.form.FormExtensionAbility.d.ts diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts new file mode 100644 index 0000000000..81c522c223 --- /dev/null +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -0,0 +1,154 @@ +/* + * 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 + * + * 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 formBindingData from './@ohos.app.form.formBindingData'; +import formInfo from "./@ohos.application.formInfo"; +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.Form + * @StageModelOnly + */ +export default class FormExtension { + /** + * Indicates form extension context. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + */ + context: FormExtensionContext; + + /** + * Called to return a {@link formBindingData#FormBindingData} object. + * + * @since 9 + * @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 + * acquisition, update, and deletion. + * @return Returns the created {@link formBindingData#FormBindingData} object. + * @StageModelOnly + */ + onCreate(want: Want): formBindingData.FormBindingData; + + /** + * Called when the form provider is notified that a temporary form is successfully converted to a normal form. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the form. + * @return - + * @StageModelOnly + */ + onCastToNormal(formId: string): void; + + /** + * Called to notify the form provider to update a specified form. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the form to update. + * @return - + * @StageModelOnly + */ + onUpdate(formId: string): void; + + /** + * Called when the form provider receives form events from the system. + * + * @since 9 + * @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 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 - + * @StageModelOnly + */ + 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 9 + * @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 + * used to identify the specific component on which the event is triggered. + * @return - + * @StageModelOnly + */ + onEvent(formId: string, message: string): void; + + /** + * Called to notify the form provider that a specified form has been destroyed. Override this method if + * you want your application, as the form provider, to be notified of form deletion. + * + * @since 9 + * @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 + * @param configuration Indicates the system configuration, such as language and color mode. + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; + + /** + * Called to return a {@link FormState} object. + * + *

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 9 + * @syscap SystemCapability.Ability.Form + * @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 formInfo#FormState} object. + * @StageModelOnly + */ + onAcquireFormState?(want: Want): formInfo.FormState; + + /** + * Called when the system shares the form. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + * @param formId Indicates the ID of the form. + * @systemapi hide for inner use. + * @return Returns the wantParams object. + * @StageModelOnly + */ + onShare?(formId: string): {[key: string]: any}; +} diff --git a/api/@ohos.app.form.formHost.d.ts b/api/@ohos.app.form.formHost.d.ts index 4e066920eb..e6d6bf84a9 100644 --- a/api/@ohos.app.form.formHost.d.ts +++ b/api/@ohos.app.form.formHost.d.ts @@ -490,13 +490,50 @@ declare namespace formHost { * @param { string } formId - Indicates the form ID. * @param { string } deviceId - Indicates the remote device ID. * @param { AsyncCallback } callback - The callback of shareForm. - * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.Form * @systemapi * @since 9 */ function shareForm(formId: string, deviceId: string, callback: AsyncCallback): void; + + /** + * Share form by formId and deviceId. + * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } formId - Indicates the form ID. + * @param { string } deviceId - Indicates the remote device ID. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ function shareForm(formId: string, deviceId: string): Promise; + + /** + * Notify form that privacy whether to be protected. + * @permission ohos.permission.REQUIRE_FORM. + * @param { Array } formIds - Indicates the specified form id. + * @param { boolean } isProtected - Indicates whether to be protected. + * @param { AsyncCallback } callback - The callback of notifyFormsPrivacyProtected. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean, callback: AsyncCallback): void; + + /** + * Notify form that privacy whether to be protected. + * @permission ohos.permission.REQUIRE_FORM. + * @param { Array } formIds - Indicates the specified form id. + * @param { boolean } isProtected - Indicates whether to be protected. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean): Promise; } export default formHost; \ No newline at end of file -- Gitee From 132609cfc6f4f9b15b4f00242cb4105a5b9a0b58 Mon Sep 17 00:00:00 2001 From: yangzk Date: Fri, 14 Oct 2022 21:20:40 +0800 Subject: [PATCH 07/34] IssueNo: #I5RT32 Description: add appManager Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.appManager.d.ts | 247 ++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 api/@ohos.app.ability.appManager.d.ts diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts new file mode 100644 index 0000000000..242edc1cba --- /dev/null +++ b/api/@ohos.app.ability.appManager.d.ts @@ -0,0 +1,247 @@ +/* + * 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 * as _ApplicationStateObserver from './application/ApplicationStateObserver'; +import * as _AbilityStateData from './application/AbilityStateData'; +import * as _AppStateData from './application/AppStateData'; +import { ProcessRunningInfo as _ProcessRunningInfo } from './application/ProcessRunningInfo'; +import { ProcessRunningInformation as _ProcessRunningInformation } from './application/ProcessRunningInformation'; + +/** + * This module provides the function of app manager service. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import appManager from '@ohos.application.appManager' + * @permission N/A + */ +declare namespace appManager { + /** + * @name ApplicationState + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi Hide this for inner system use. + * @permission N/A + */ + export enum ApplicationState { + STATE_CREATE, + STATE_FOREGROUND, + STATE_ACTIVE, + STATE_BACKGROUND, + STATE_DESTROY + } + + + /** + * @name ProcessState + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi Hide this for inner system use. + * @permission N/A + */ + export enum ProcessState { + STATE_CREATE, + STATE_FOREGROUND, + STATE_ACTIVE, + STATE_BACKGROUND, + STATE_DESTROY + } + + /** + * Register application state observer. + * + * @default - + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observer The application state observer. + * @systemapi hide this for inner system use + * @return Returns the number code of the observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + */ + function registerApplicationStateObserver(observer: ApplicationStateObserver): number; + + /** + * Register application state observer. + * + * @default - + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observer The application state observer. + * @param bundleNameList The list of bundleName. The max length is 128. + * @systemapi + * @return Returns the number code of the observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + */ + function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number; + + /** + * Unregister application state observer. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param observerId Indicates the number code of the observer. + * @systemapi hide this for inner system use + * @return - + * @permission ohos.permission.RUNNING_STATE_OBSERVER + */ + function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback): void; + function unregisterApplicationStateObserver(observerId: number): Promise; + + /** + * getForegroundApplications. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide this for inner system use + * @return Returns the list of AppStateData. + * @permission ohos.permission.GET_RUNNING_INFO + */ + function getForegroundApplications(callback: AsyncCallback>): void; + function getForegroundApplications(): Promise>; + + /** + * Kill process with account. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param bundleName The process bundle name. + * @param accountId The account id. + * @systemapi hide this for inner system use + * @return - + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + */ + function killProcessWithAccount(bundleName: string, accountId: number): Promise; + function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback): void; + + /** + * Is user running in stability test. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return Returns true if user is running stability test. + */ + function isRunningInStabilityTest(callback: AsyncCallback): void; + function isRunningInStabilityTest(): Promise; + + /** + * Get information about running processes + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return Returns the array of {@link ProcessRunningInfo}. + * @permission ohos.permission.GET_RUNNING_INFO + * @deprecated since 9 + * @useinstead getProcessRunningInformation + */ + function getProcessRunningInfos(): Promise>; + function getProcessRunningInfos(callback: AsyncCallback>): void; + + /** + * Kill processes by bundle name + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param bundleName bundle name. + * @systemapi hide this for inner system use + * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES + */ + function killProcessesByBundleName(bundleName: string): Promise; + function killProcessesByBundleName(bundleName: string, callback: AsyncCallback); + + /** + * Clear up application data by bundle name + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param bundleName bundle name. + * @systemapi hide this for inner system use + * @permission ohos.permission.CLEAN_APPLICATION_DATA + */ + function clearUpApplicationData(bundleName: string): Promise; + function clearUpApplicationData(bundleName: string, callback: AsyncCallback); + + /** + * Is it a ram-constrained device + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return whether a ram-constrained device. + */ + function isRamConstrainedDevice(): Promise; + function isRamConstrainedDevice(callback: AsyncCallback): void; + + /** + * Get the memory size of the application + * @since 7 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return application memory size. + */ + function getAppMemorySize(): Promise; + function getAppMemorySize(callback: AsyncCallback): void; + + /** + * Get information about running processes + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return Returns the array of {@link ProcessRunningInformation}. + * @permission ohos.permission.GET_RUNNING_INFO + */ + function getProcessRunningInformation(): Promise>; + function getProcessRunningInformation(callback: AsyncCallback>): void; + + /** + * The ability or extension state data. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + export type AbilityStateData = _AbilityStateData.default + + /** + * The application state data. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + export type AppStateData = _AppStateData.default + + /** + * The application state observer. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + */ + export type ApplicationStateObserver = _ApplicationStateObserver.default + + /** + * The class of an process running information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export type ProcessRunningInfo = _ProcessRunningInfo + + /** + * The class of an process running information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export type ProcessRunningInformation = _ProcessRunningInformation +} + +export default appManager; -- Gitee From 507c11418db01e26087ed34db4d50ab8d1ae9505 Mon Sep 17 00:00:00 2001 From: yangzk Date: Fri, 14 Oct 2022 21:40:09 +0800 Subject: [PATCH 08/34] IssueNo: #I5RT32 Description: add appManager Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.appManager.d.ts | 272 ++++++++++++++++---------- 1 file changed, 173 insertions(+), 99 deletions(-) diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts index 242edc1cba..69193ed0d5 100644 --- a/api/@ohos.app.ability.appManager.d.ts +++ b/api/@ohos.app.ability.appManager.d.ts @@ -22,19 +22,18 @@ import { ProcessRunningInformation as _ProcessRunningInformation } from './appli /** * This module provides the function of app manager service. - * - * @since 8 + * @namespace appManager * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import appManager from '@ohos.application.appManager' - * @permission N/A + * @since 9 + * */ declare namespace appManager { /** - * @name ApplicationState - * @since 9 + * Enum for the application state + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use. - * @permission N/A + * @systemapi + * @since 9 */ export enum ApplicationState { STATE_CREATE, @@ -44,13 +43,12 @@ declare namespace appManager { STATE_DESTROY } - /** - * @name ProcessState - * @since 9 + * Enum for the process state + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi Hide this for inner system use. - * @permission N/A + * @systemapi + * @since 9 */ export enum ProcessState { STATE_CREATE, @@ -62,184 +60,260 @@ declare namespace appManager { /** * Register application state observer. - * - * @default - - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param observer The application state observer. - * @systemapi hide this for inner system use - * @return Returns the number code of the observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { ApplicationStateObserver } observer - The application state observer. + * @return { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function registerApplicationStateObserver(observer: ApplicationStateObserver): number; /** * Register application state observer. - * - * @default - - * @since 9 + * @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. + * @return { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param observer The application state observer. - * @param bundleNameList The list of bundleName. The max length is 128. * @systemapi - * @return Returns the number code of the observer. - * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @since 9 */ - function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number; + function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number; /** * Unregister application state observer. - * - * @since 8 + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { number } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of unregisterApplicationStateObserver. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param observerId Indicates the number code of the observer. - * @systemapi hide this for inner system use - * @return - + * @systemapi + * @since 9 + */ + function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback): void; + + /** + * Unregister application state observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { number } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ - function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback): void; function unregisterApplicationStateObserver(observerId: number): Promise; /** * getForegroundApplications. - * - * @since 8 + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the list of AppStateData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide this for inner system use - * @return Returns the list of AppStateData. + * @systemapi + * @since 9 + */ + function getForegroundApplications(callback: AsyncCallback>): void; + + /** + * getForegroundApplications. * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the list of AppStateData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ - function getForegroundApplications(callback: AsyncCallback>): void; - function getForegroundApplications(): Promise>; + function getForegroundApplications(): Promise>; /** * Kill process with account. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param bundleName The process bundle name. - * @param accountId The account id. - * @systemapi hide this for inner system use - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { number } accountId - The account id. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ function killProcessWithAccount(bundleName: string, accountId: number): Promise; + + /** + * Kill process with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { number } accountId - The account id. + * @param { AsyncCallback } callback - The callback of killProcessWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback): void; - /** + /** * Is user running in stability test. - * - * @since 8 + * @param { AsyncCallback } callback - The callback is used to return true if user is running stability test. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns true if user is running stability test. + * @since 9 */ - function isRunningInStabilityTest(callback: AsyncCallback): void; - function isRunningInStabilityTest(): Promise; + function isRunningInStabilityTest(callback: AsyncCallback): void; /** - * Get information about running processes - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns the array of {@link ProcessRunningInfo}. - * @permission ohos.permission.GET_RUNNING_INFO - * @deprecated since 9 - * @useinstead getProcessRunningInformation - */ - function getProcessRunningInfos(): Promise>; - function getProcessRunningInfos(callback: AsyncCallback>): void; + * Is user running in stability test. + * @returns { Promise } Returns true if user is running stability test. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function isRunningInStabilityTest(): Promise; /** * Kill processes by bundle name - * @since 8 + * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - bundle name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param bundleName bundle name. - * @systemapi hide this for inner system use + * @systemapi + * @since 9 + */ + function killProcessesByBundleName(bundleName: string): Promise; + + /** + * Kill processes by bundle name * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - bundle name. + * @param { AsyncCallback } callback - The callback of killProcessesByBundleName. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ - function killProcessesByBundleName(bundleName: string): Promise; - function killProcessesByBundleName(bundleName: string, callback: AsyncCallback); + function killProcessesByBundleName(bundleName: string, callback: AsyncCallback); /** * Clear up application data by bundle name - * @since 8 + * @permission ohos.permission.CLEAN_APPLICATION_DATA + * @param { string } bundleName - bundle name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param bundleName bundle name. - * @systemapi hide this for inner system use + * @systemapi + * @since 9 + */ + function clearUpApplicationData(bundleName: string): Promise; + + /** + * Clear up application data by bundle name * @permission ohos.permission.CLEAN_APPLICATION_DATA + * @param { string } bundleName - bundle name. + * @param { AsyncCallback } callback - The callback of clearUpApplicationData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 */ - function clearUpApplicationData(bundleName: string): Promise; - function clearUpApplicationData(bundleName: string, callback: AsyncCallback); + function clearUpApplicationData(bundleName: string, callback: AsyncCallback); /** * Is it a ram-constrained device - * @since 7 + * @returns { Promise } Returns true if the device is ram-constrained. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return whether a ram-constrained device. + * @since 9 */ function isRamConstrainedDevice(): Promise; + + /** + * Is it a ram-constrained device + * @param { AsyncCallback } callback - The callback is used to return true if the device is ram-constrained. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function isRamConstrainedDevice(callback: AsyncCallback): void; /** * Get the memory size of the application - * @since 7 + * @returns { Promise } Returns the application memory size. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return application memory size. + * @since 9 */ function getAppMemorySize(): Promise; + + /** + * Get the memory size of the application + * @param { AsyncCallback } callback - The callback is used to return the application memory size. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ function getAppMemorySize(callback: AsyncCallback): void; /** - * Get information about running processes - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns the array of {@link ProcessRunningInformation}. - * @permission ohos.permission.GET_RUNNING_INFO - */ + * Get information about running processes + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ function getProcessRunningInformation(): Promise>; + + /** + * Get information about running processes + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ function getProcessRunningInformation(callback: AsyncCallback>): void; /** * The ability or extension state data. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. + * @systemapi + * @since 9 */ export type AbilityStateData = _AbilityStateData.default /** * The application state data. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. + * @systemapi + * @since 9 */ export type AppStateData = _AppStateData.default /** * The application state observer. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. + * @systemapi + * @since 9 */ export type ApplicationStateObserver = _ApplicationStateObserver.default /** * The class of an process running information. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export type ProcessRunningInfo = _ProcessRunningInfo /** - * The class of an process running information. - * - * @since 9 + * The class of a process running information. * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export type ProcessRunningInformation = _ProcessRunningInformation } -- Gitee From 34c5f93a4745f199bb53a3f01aa2459757fbb4eb Mon Sep 17 00:00:00 2001 From: yangzk Date: Fri, 14 Oct 2022 21:48:31 +0800 Subject: [PATCH 09/34] IssueNo: #I5RT32 Description: mod interface Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.ability.ability.d.ts | 2 +- api/@ohos.app.ability.Ability.d.ts | 26 +++++++- api/@ohos.app.ability.appManager.d.ts | 14 +++-- api/@ohos.app.ability.errorManager.d.ts | 11 ++-- api/@ohos.app.ability.missionManager.d.ts | 11 ++-- api/@ohos.app.form.FormExtensionAbility.d.ts | 16 ++--- api/@ohos.app.form.formHost.d.ts | 6 +- ...s.application.ServiceExtensionAbility.d.ts | 2 +- api/@ohos.application.formInfo.d.ts | 10 ++- api/application/AbilityContext.d.ts | 12 ++-- api/application/ApplicationContext.d.ts | 61 ++++++++++++++++--- api/application/ServiceExtensionContext.d.ts | 11 ++-- api/application/abilityMonitor.d.ts | 22 ++++--- 13 files changed, 147 insertions(+), 57 deletions(-) diff --git a/api/@ohos.ability.ability.d.ts b/api/@ohos.ability.ability.d.ts index 44be58f12e..d710852e0a 100755 --- a/api/@ohos.ability.ability.d.ts +++ b/api/@ohos.ability.ability.d.ts @@ -26,7 +26,7 @@ import { StartAbilityParameter as _StartAbilityParameter } from './ability/star * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly + * @FAModelOnly */ declare namespace ability { diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts index c75fe2d93c..9495a9745f 100755 --- a/api/@ohos.app.ability.Ability.d.ts +++ b/api/@ohos.app.ability.Ability.d.ts @@ -84,13 +84,35 @@ export interface Caller { /** * Register death listener notification callback. + * @param { string } type - release. * @param { OnReleaseCallBack } callback - Register a callback function for listening for notifications. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ - onRelease(callback: OnReleaseCallBack): void; + on(type: "release", callback: OnReleaseCallBack): void; + + /** + * Unregister death listener notification callback. + * @param { string } type - release. + * @param { OnReleaseCallBack } callback - Unregister a callback function for listening for notifications. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + off(type: "release", callback: OnReleaseCallBack): void; + + /** + * Unregister all death listener notification callback. + * @param { string } type - release. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + off(type: "release"): void; } /** @@ -265,7 +287,7 @@ export default class Ability { * @stagemodelonly * @since 9 */ - dump(params: Array): Array; + onDump(params: Array): Array; /** * Called when the system has determined to trim the memory, for example, when the ability is running in the diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts index 69193ed0d5..ebc1872c80 100644 --- a/api/@ohos.app.ability.appManager.d.ts +++ b/api/@ohos.app.ability.appManager.d.ts @@ -61,6 +61,7 @@ declare namespace appManager { /** * Register application state observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. * @param { ApplicationStateObserver } observer - The application state observer. * @return { number } Returns the number code of the observer. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -68,11 +69,12 @@ declare namespace appManager { * @systemapi * @since 9 */ - function registerApplicationStateObserver(observer: ApplicationStateObserver): number; + function on(type: "applicationState", observer: ApplicationStateObserver): number; /** * Register application state observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. * @param { ApplicationStateObserver } observer - The application state observer. * @param { Array } bundleNameList - The list of bundleName. The max length is 128. * @return { number } Returns the number code of the observer. @@ -81,23 +83,25 @@ declare namespace appManager { * @systemapi * @since 9 */ - function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number; + function on(type: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array): number; /** * Unregister application state observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. * @param { number } observerId - Indicates the number code of the observer. - * @param { AsyncCallback } callback - The callback of unregisterApplicationStateObserver. + * @param { AsyncCallback } callback - The callback of off. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @since 9 */ - function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback): void; + function off(type: "applicationState", observerId: number, callback: AsyncCallback): void; /** * Unregister application state observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. * @param { number } observerId - Indicates the number code of the observer. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -105,7 +109,7 @@ declare namespace appManager { * @systemapi * @since 9 */ - function unregisterApplicationStateObserver(observerId: number): Promise; + function off(type: "applicationState", observerId: number): Promise; /** * getForegroundApplications. diff --git a/api/@ohos.app.ability.errorManager.d.ts b/api/@ohos.app.ability.errorManager.d.ts index 903e9d89f5..10573f876d 100644 --- a/api/@ohos.app.ability.errorManager.d.ts +++ b/api/@ohos.app.ability.errorManager.d.ts @@ -25,33 +25,36 @@ import * as _ErrorObserver from './application/ErrorObserver'; declare namespace errorManager { /** * Register error observer. + * @param { string } type - error. * @param { ErrorObserver } observer - The error observer. * @returns { number } Returns the number code of the observer. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 */ - function registerErrorObserver(observer: ErrorObserver): number; + function on(type: "error", observer: ErrorObserver): number; /** * Unregister error observer. + * @param { string } type - error. * @param { number } observerId - Indicates the number code of the observer. - * @param { AsyncCallback } callback - The callback of unregisterErrorObserver. + * @param { AsyncCallback } callback - The callback of off. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 */ - function unregisterErrorObserver(observerId: number, callback: AsyncCallback): void; + function off(type: "error", observerId: number, callback: AsyncCallback): void; /** * Unregister error observer. + * @param { string } type - error. * @param { number } observerId - Indicates the number code of the observer. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 */ - function unregisterErrorObserver(observerId: number): Promise; + function off(type: "error", observerId: number): Promise; /** * The observer will be called by system when an error occurs. diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts index 7a0eac2e0d..d8fee24cb5 100644 --- a/api/@ohos.app.ability.missionManager.d.ts +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -30,33 +30,36 @@ import StartOptions from "./@ohos.application.StartOptions"; declare namespace missionManager { /** * Register the missionListener to ams. + * @param { string } type - mission. * @param { MissionListener } listener - Indicates the MissionListener to be registered. * @returns { number } Returns the index number of the MissionListener. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @since 9 */ - function registerMissionListener(listener: MissionListener): number; + function on(type: "mission", listener: MissionListener): number; /** * Unrgister the missionListener to ams. + * @param { string } type - mission. * @param { number } listenerId - Indicates the listener id to be unregistered. - * @param { AsyncCallback } callback - The callback of unregisterMissionListener. + * @param { AsyncCallback } callback - The callback of off. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @since 9 */ - function unregisterMissionListener(listenerId: number, callback: AsyncCallback): void; + function off(type: "mission", listenerId: number, callback: AsyncCallback): void; /** * Unrgister the missionListener to ams. + * @param { string } type - mission. * @param { number } listenerId - Indicates the listener id to be unregistered. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @since 9 */ - function unregisterMissionListener(listenerId: number): Promise; + function off(type: "mission", listenerId: number): Promise; /** * Get the missionInfo with the given missionId. diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts index 81c522c223..56dacc5b62 100644 --- a/api/@ohos.app.form.FormExtensionAbility.d.ts +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -26,7 +26,7 @@ import { Configuration } from './@ohos.application.Configuration'; * @syscap SystemCapability.Ability.Form * @StageModelOnly */ -export default class FormExtension { +export default class FormExtensionAbility { /** * Indicates form extension context. * @@ -48,7 +48,7 @@ export default class FormExtension { * @return Returns the created {@link formBindingData#FormBindingData} object. * @StageModelOnly */ - onCreate(want: Want): formBindingData.FormBindingData; + onAddForm(want: Want): formBindingData.FormBindingData; /** * Called when the form provider is notified that a temporary form is successfully converted to a normal form. @@ -59,7 +59,7 @@ export default class FormExtension { * @return - * @StageModelOnly */ - onCastToNormal(formId: string): void; + onCastToNormalForm(formId: string): void; /** * Called to notify the form provider to update a specified form. @@ -70,7 +70,7 @@ export default class FormExtension { * @return - * @StageModelOnly */ - onUpdate(formId: string): void; + onUpdateForm(formId: string): void; /** * Called when the form provider receives form events from the system. @@ -85,7 +85,7 @@ export default class FormExtension { * @return - * @StageModelOnly */ - onVisibilityChange(newStatus: { [key: string]: number }): void; + onChangeFormVisibility(newStatus: { [key: string]: number }): void; /** * Called when a specified message event defined by the form provider is triggered. This method is valid only for @@ -100,7 +100,7 @@ export default class FormExtension { * @return - * @StageModelOnly */ - onEvent(formId: string, message: string): void; + onFormEvent(formId: string, message: string): void; /** * Called to notify the form provider that a specified form has been destroyed. Override this method if @@ -112,7 +112,7 @@ export default class FormExtension { * @return - * @StageModelOnly */ - onDestroy(formId: string): void; + onRemoveForm(formId: string): void; /** * Called when the system configuration is updated. @@ -150,5 +150,5 @@ export default class FormExtension { * @return Returns the wantParams object. * @StageModelOnly */ - onShare?(formId: string): {[key: string]: any}; + onFormToBeShared?(formId: string): {[key: string]: any}; } diff --git a/api/@ohos.app.form.formHost.d.ts b/api/@ohos.app.form.formHost.d.ts index e6d6bf84a9..3f696e72a4 100644 --- a/api/@ohos.app.form.formHost.d.ts +++ b/api/@ohos.app.form.formHost.d.ts @@ -137,13 +137,13 @@ declare namespace formHost { * Converts a specified temporary form that has been obtained by the application into a normal form. * @permission ohos.permission.REQUIRE_FORM * @param { string } formId - Indicates the ID of the temporary form to convert. - * @param { AsyncCallback } callback - The callback of castTempForm. + * @param { AsyncCallback } callback - The callback of castToNormalForm. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.Form * @systemapi * @since 9 */ - function castTempForm(formId: string, callback: AsyncCallback): void; + function castToNormalForm(formId: string, callback: AsyncCallback): void; /** * Converts a specified temporary form that has been obtained by the application into a normal form. @@ -155,7 +155,7 @@ declare namespace formHost { * @systemapi * @since 9 */ - function castTempForm(formId: string): Promise; + function castToNormalForm(formId: string): Promise; /** * Sends a notification to the form framework to make the specified forms visible. diff --git a/api/@ohos.application.ServiceExtensionAbility.d.ts b/api/@ohos.application.ServiceExtensionAbility.d.ts index 9b7e74eb47..93d3064b2e 100644 --- a/api/@ohos.application.ServiceExtensionAbility.d.ts +++ b/api/@ohos.application.ServiceExtensionAbility.d.ts @@ -133,6 +133,6 @@ export default class ServiceExtensionAbility { * @return The dump info array. * @StageModelOnly */ - dump(params: Array): Array; + onDump(params: Array): Array; } diff --git a/api/@ohos.application.formInfo.d.ts b/api/@ohos.application.formInfo.d.ts index 46c60e5274..774eb4d383 100644 --- a/api/@ohos.application.formInfo.d.ts +++ b/api/@ohos.application.formInfo.d.ts @@ -190,7 +190,15 @@ declare namespace formInfo { * @since 8 * @syscap SystemCapability.Ability.Form */ - JS = 1 + JS = 1, + + /** + * eTS form. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + */ + eTS = 2 } /** diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 8b6a4c32f1..5174f3e58d 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -104,6 +104,7 @@ export default class AbilityContext extends Context { * @returns { Promise } Returns the Caller interface. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi * @stagemodelonly * @since 9 */ @@ -387,11 +388,10 @@ export default class AbilityContext extends Context { * @returns { number } Returns the number code of the ability connected * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi * @stagemodelonly * @since 9 */ - connectAbility(want: Want, options: ConnectOptions): number; + connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; /** * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. @@ -406,7 +406,7 @@ export default class AbilityContext extends Context { * @stagemodelonly * @since 9 */ - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; /** * The callback interface was connect successfully. @@ -414,11 +414,10 @@ export default class AbilityContext extends Context { * @param { AsyncCallback } callback - The callback of disconnectAbility. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi * @stagemodelonly * @since 9 */ - disconnectAbility(connection: number, callback: AsyncCallback): void; + disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; /** * The callback interface was connect successfully. @@ -426,11 +425,10 @@ export default class AbilityContext extends Context { * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi * @stagemodelonly * @since 9 */ - disconnectAbility(connection: number): Promise; + disconnectServiceExtensionAbility(connection: number): Promise; /** * Set mission label of current ability. diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 516973add4..54ef9d985f 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -17,6 +17,7 @@ import { AsyncCallback } from "../basic"; import Context from "./Context"; import AbilityLifecycleCallback from "../@ohos.application.AbilityLifecycleCallback"; import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; +import { ProcessRunningInformation } from "./ProcessRunningInformation"; /** * The context of an application. It allows access to application-specific resources. @@ -27,6 +28,7 @@ import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; export default class ApplicationContext extends Context { /** * Register ability lifecycle callback. + * @param { string } type - abilityLifecycle. * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. * @returns { number } Returns the number code of the callback. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -34,21 +36,23 @@ export default class ApplicationContext extends Context { * @stagemodelonly * @since 9 */ - registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; + on(type: "abilityLifecycle", callback: AbilityLifecycleCallback): number; /** * Unregister ability lifecycle callback. + * @param { string } type - abilityLifecycle. * @param { number } callbackId - Indicates the number code of the callback. - * @param { AsyncCallback } callback - The callback of unregisterAbilityLifecycleCallback. + * @param { AsyncCallback } callback - The callback of off. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 9 */ - unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; + off(type: "abilityLifecycle", callbackId: number, callback: AsyncCallback): void; /** * Unregister ability lifecycle callback. + * @param { string } type - abilityLifecycle. * @param { number } callbackId - Indicates the number code of the callback. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -56,10 +60,11 @@ export default class ApplicationContext extends Context { * @stagemodelonly * @since 9 */ - unregisterAbilityLifecycleCallback(callbackId: number): Promise; + off(type: "abilityLifecycle", callbackId: number): Promise; /** * Register environment callback. + * @param { string } type - environment. * @param { EnvironmentCallback } callback - The environment callback. * @returns { number } Returns the number code of the callback. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -67,10 +72,11 @@ export default class ApplicationContext extends Context { * @stagemodelonly * @since 9 */ - registerEnvironmentCallback(callback: EnvironmentCallback): number; + on(type: "environment", callback: EnvironmentCallback): number; /** * Unregister environment callback. + * @param { string } type - environment. * @param { number } callbackId - Indicates the number code of the callback. * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -78,10 +84,11 @@ export default class ApplicationContext extends Context { * @stagemodelonly * @since 9 */ - unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; + off(type: "environment", callbackId: number, callback: AsyncCallback): void; /** * Unregister environment callback. + * @param { string } type - environment. * @param { number } callbackId - Indicates the number code of the callback. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -89,5 +96,45 @@ export default class ApplicationContext extends Context { * @stagemodelonly * @since 9 */ - unregisterEnvironmentCallback(callbackId: number): Promise; + off(type: "environment", callbackId: number): Promise; + + /** + * Get information about running processes + * @returns { Promise> } Returns the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + getProcessRunningInformation(): Promise>; + + /** + * Get information about running processes + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + getProcessRunningInformation(callback: AsyncCallback>): void; + + /** + * Kill processes by self + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + killProcessesBySelf(): Promise; + + /** + * Kill processes by self + * @param { AsyncCallback } callback - The callback of killProcessesBySelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + killProcessesBySelf(callback: AsyncCallback); } diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index 552e964ccf..414f3d38f1 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -244,11 +244,10 @@ export default class ServiceExtensionContext extends ExtensionContext { * @returns { number } Returns the connection id. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi * @stagemodelonly * @since 9 */ - connectAbility(want: Want, options: ConnectOptions): number; + connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; /** * Connects an ability to a Service extension with account. @@ -265,7 +264,7 @@ export default class ServiceExtensionContext extends ExtensionContext { * @stagemodelonly * @since 9 */ - connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; /** * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. @@ -273,11 +272,10 @@ export default class ServiceExtensionContext extends ExtensionContext { * @param { AsyncCallback } callback - The callback of disconnectAbility. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi * @stagemodelonly * @since 9 */ - disconnectAbility(connection: number, callback: AsyncCallback): void; + disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; /** * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. @@ -285,11 +283,10 @@ export default class ServiceExtensionContext extends ExtensionContext { * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi * @stagemodelonly * @since 9 */ - disconnectAbility(connection: number): Promise; + disconnectServiceExtensionAbility(connection: number): Promise; /** * Get the caller object of the startup capability diff --git a/api/application/abilityMonitor.d.ts b/api/application/abilityMonitor.d.ts index 6af8397d2a..8dec39ad4f 100644 --- a/api/application/abilityMonitor.d.ts +++ b/api/application/abilityMonitor.d.ts @@ -33,13 +33,21 @@ export interface AbilityMonitor { */ abilityName: string; + /** + * The name of the module to monitor. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + moduleName: string; + /** * Called back when the ability is started for initialization. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityCreate?:(data: Ability) => void; + onAbilityCreate?:(ability: Ability) => void; /** * Called back when the state of the ability changes to foreground. @@ -47,7 +55,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityForeground?:(data: Ability) => void; + onAbilityForeground?:(ability: Ability) => void; /** * Called back when the state of the ability changes to background. @@ -55,7 +63,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityBackground?:(data: Ability) => void; + onAbilityBackground?:(ability: Ability) => void; /** * Called back before the ability is destroyed. @@ -63,7 +71,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityDestroy?:(data: Ability) => void; + onAbilityDestroy?:(ability: Ability) => void; /** * Called back when an ability window stage is created. @@ -71,7 +79,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageCreate?:(data: Ability) => void; + onWindowStageCreate?:(ability: Ability) => void; /** * Called back when an ability window stage is restored. @@ -79,7 +87,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageRestore?:(data: Ability) => void; + onWindowStageRestore?:(ability: Ability) => void; /** * Called back when an ability window stage is destroyed. @@ -87,7 +95,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageDestroy?:(data: Ability) => void; + onWindowStageDestroy?:(ability: Ability) => void; } export default AbilityMonitor; \ No newline at end of file -- Gitee From d106fea4bdaff924c3bddd9be688379d5929b7b3 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:12:15 +0800 Subject: [PATCH 10/34] IssueNo: #I5RT32 Description: revert FAModelOnly interface Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.ability.dataUriUtils.d.ts | 2 - api/@ohos.ability.featureAbility.d.ts | 2 - api/@ohos.ability.particleAbility.d.ts | 2 - api/@ohos.app.ability.dataUriUtils.d.ts | 68 ---- ....d.ts => @ohos.app.ability.wantAgent.d.ts} | 0 api/@ohos.app.featureAbility.d.ts | 298 ------------------ api/@ohos.app.particleAbility.d.ts | 118 ------- 7 files changed, 490 deletions(-) delete mode 100644 api/@ohos.app.ability.dataUriUtils.d.ts rename api/{@ohos.app.wantAgent.d.ts => @ohos.app.ability.wantAgent.d.ts} (100%) delete mode 100644 api/@ohos.app.featureAbility.d.ts delete mode 100644 api/@ohos.app.particleAbility.d.ts diff --git a/api/@ohos.ability.dataUriUtils.d.ts b/api/@ohos.ability.dataUriUtils.d.ts index f10e53a20d..af7b680500 100644 --- a/api/@ohos.ability.dataUriUtils.d.ts +++ b/api/@ohos.ability.dataUriUtils.d.ts @@ -19,8 +19,6 @@ * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A - * @deprecated since 9 - * @useinstead @ohos.app.ability.dataUriUtils */ declare namespace dataUriUtils { /** diff --git a/api/@ohos.ability.featureAbility.d.ts b/api/@ohos.ability.featureAbility.d.ts index fee1526470..944d6d321b 100644 --- a/api/@ohos.ability.featureAbility.d.ts +++ b/api/@ohos.ability.featureAbility.d.ts @@ -32,8 +32,6 @@ import window from './@ohos.window'; * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @permission N/A * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.featureAbility */ declare namespace featureAbility { /** diff --git a/api/@ohos.ability.particleAbility.d.ts b/api/@ohos.ability.particleAbility.d.ts index f822ef4578..04321ffcd7 100644 --- a/api/@ohos.ability.particleAbility.d.ts +++ b/api/@ohos.ability.particleAbility.d.ts @@ -27,8 +27,6 @@ import Want from './@ohos.application.Want'; * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @permission N/A * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.particleAbility */ declare namespace particleAbility { /** diff --git a/api/@ohos.app.ability.dataUriUtils.d.ts b/api/@ohos.app.ability.dataUriUtils.d.ts deleted file mode 100644 index e3f47a7138..0000000000 --- a/api/@ohos.app.ability.dataUriUtils.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 { BusinessError } from './basic'; - -/** - * A utility class used for handling objects that use the DataAbilityHelper scheme. - * @namespace dataUriUtils - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ -declare namespace dataUriUtils { - /** - * Obtains the ID attached to the end of the path component of the given uri. - * @param { string } uri - Indicates the uri object from which the ID is to be obtained. - * @returns { number } Returns the ID attached to the end of the path component. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - function getId(uri: string): number - - /** - * Attaches the given ID to the end of the path component of the given uri. - * @param { string } uri - Indicates the uri string from which the ID is to be obtained. - * @param { number } id - Indicates the ID to attach. - * @returns { number } Returns the uri object with the given ID attached. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - function attachId(uri: string, id: number): string - - /** - * Deletes the ID from the end of the path component of the given uri. - * @param { string } uri - Indicates the uri object from which the ID is to be deleted. - * @returns { string } Returns the uri object with the ID deleted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - function deleteId(uri: string): string - - /** - * Updates the ID in the specified uri. - * @param { string } uri - Indicates the uri object to be updated. - * @param { number } id - Indicates the new ID. - * @returns { string } Returns the updated uri object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @since 9 - */ - function updateId(uri: string, id: number): string - -} -export default dataUriUtils; \ No newline at end of file diff --git a/api/@ohos.app.wantAgent.d.ts b/api/@ohos.app.ability.wantAgent.d.ts similarity index 100% rename from api/@ohos.app.wantAgent.d.ts rename to api/@ohos.app.ability.wantAgent.d.ts diff --git a/api/@ohos.app.featureAbility.d.ts b/api/@ohos.app.featureAbility.d.ts deleted file mode 100644 index 839d320813..0000000000 --- a/api/@ohos.app.featureAbility.d.ts +++ /dev/null @@ -1,298 +0,0 @@ -/* - * 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 { StartAbilityParameter } from './ability/startAbilityParameter'; -import { AbilityResult } from './ability/abilityResult'; -import { AppVersionInfo as _AppVersionInfo } from './app/appVersionInfo'; -import { Context } from './app/featureAbilityContext'; -import { DataAbilityHelper } from './ability/dataAbilityUtils'; -import { ConnectOptions } from './ability/connectOptions'; -import { ProcessInfo as _ProcessInfo } from './app/processInfo'; -import window from './@ohos.window'; - -/** - * A Feature Ability represents an ability with a UI and is designed to interact with users. - * @namespace featureAbility - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ -declare namespace featureAbility { - /** - * Obtain the want sent from the source ability. - * @param { AsyncCallback } callback - The callback is used to return the want sent from the source ability. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function getWant(callback: AsyncCallback): void; - - /** - * Obtain the want sent from the source ability. - * @returns { Promise } Returns the want sent from the source ability. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function getWant(): Promise; - - /** - * Starts a new ability. - * @param { StartAbilityParameter } parameter - Indicates the ability to start. - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - /** - * Starts a new ability. - * @param { StartAbilityParameter } parameter - Indicates the ability to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function startAbility(parameter: StartAbilityParameter): Promise; - - /** - * Obtains the application context. - * @returns { Context } Returns the application context. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function getContext(): Context; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * @param { StartAbilityParameter } parameter - Indicates the ability to start. - * @param { AsyncCallback } callback - The callback is used to return the AbilityResult. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - /** - * Starts an ability and returns the execution result when the ability is destroyed. - * @param { StartAbilityParameter } parameter - Indicates the ability to start. - * @returns { Promise } Returns the AbilityResult. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function startAbilityForResult(parameter: StartAbilityParameter): Promise; - - /** - * Sets the result code and data to be returned by this Page ability to the caller - * and destroys this Page ability. - * @param { AbilityResult } parameter - Indicates the result to return. - * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; - - /** - * Sets the result code and data to be returned by this Page ability to the caller - * and destroys this Page ability. - * @param { AbilityResult } parameter - Indicates the result to return. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function terminateSelfWithResult(parameter: AbilityResult): Promise; - - /** - * Destroys this Page ability. - * @param { AsyncCallback } callback - The callback of terminateSelf. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function terminateSelf(callback: AsyncCallback): void; - - /** - * Destroys this Page ability. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function terminateSelf(): Promise; - - /** - * Obtains the dataAbilityHelper. - * @param uri Indicates the path of the file to open. - * @returns { DataAbilityHelper } Returns the DataAbilityHelper. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function acquireDataAbilityHelper(uri: string): DataAbilityHelper; - - /** - * Checks whether the main window of this ability has window focus. - * @param { AsyncCallback } callback - The callback is used to return {@code true} if this ability currently has window focus. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function hasWindowFocus(callback: AsyncCallback): void; - - /** - * Checks whether the main window of this ability has window focus. - * @returns { Promise } Returns {@code true} if this ability currently has window focus. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function hasWindowFocus(): Promise; - - /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. - * @param { Want } request - The element name of the service ability - * @param { ConnectOptions } options - The remote object instance - * @returns { number } Returns the number code of the ability connected. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function connectAbility(request: Want, options: ConnectOptions): number; - - /** - * The callback interface was connect successfully. - * @param { number } connection - The number code of the ability connected - * @param { AsyncCallback } callback - The callback of disconnectAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function disconnectAbility(connection: number, callback: AsyncCallback): void; - - /** - * The callback interface was connect successfully. - * @param { number } connection - The number code of the ability connected - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function disconnectAbility(connection: number): Promise; - - /** - * Obtains the window corresponding to the current ability. - * @param { AsyncCallback } callback - The callback is used to return the window corresponding to the current ability. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function getWindow(callback: AsyncCallback): void; - - /** - * Obtains the window corresponding to the current ability. - * @returns { Promise } Returns the window corresponding to the current ability. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function getWindow(): Promise; - - /** - * Obtain the window configuration - * @enum { number } - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - export enum AbilityWindowConfiguration { - WINDOW_MODE_UNDEFINED = 0, - WINDOW_MODE_FULLSCREEN = 1, - WINDOW_MODE_SPLIT_PRIMARY = 100, - WINDOW_MODE_SPLIT_SECONDARY = 101, - WINDOW_MODE_FLOATING = 102 - } - - /** - * Obtain the window properties. - * @enum { string } - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - export enum AbilityStartSetting { - BOUNDS_KEY = "abilityBounds", - WINDOW_MODE_KEY = "windowMode", - DISPLAY_ID_KEY = "displayId" - } - - /** - * Indicates the operation type of data. - * @enum { number } - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - export enum DataAbilityOperationType { - TYPE_INSERT = 1, - TYPE_UPDATE = 2, - TYPE_DELETE = 3, - TYPE_ASSERT = 4, - } - - /** - * Defines an AppVersionInfo object. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - export type AppVersionInfo = _AppVersionInfo - - /** - * This class saves process information about an application - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - export type ProcessInfo = _ProcessInfo -} -export default featureAbility; diff --git a/api/@ohos.app.particleAbility.d.ts b/api/@ohos.app.particleAbility.d.ts deleted file mode 100644 index 1e31a0c94d..0000000000 --- a/api/@ohos.app.particleAbility.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 { StartAbilityParameter } from './ability/startAbilityParameter'; -import { DataAbilityHelper } from './ability/dataAbilityUtils'; -import { NotificationRequest } from './notification/notificationRequest'; -import { ConnectOptions } from './ability/connectOptions'; -import Want from './@ohos.application.Want'; - -/** - * A Particle Ability represents an ability with service. - * @namespace particleAbility - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ -declare namespace particleAbility { - /** - * Service ability uses this method to start a specific ability. - * @param { StartAbilityParameter } parameter - Indicates the ability to start. - * @param { AsyncCallback } callback - The callback of startAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; - - /** - * Service ability uses this method to start a specific ability. - * @param { StartAbilityParameter } parameter - Indicates the ability to start. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function startAbility(parameter: StartAbilityParameter): Promise; - - /** - * Destroys this service ability. - * @param { AsyncCallback } callback - The callback of terminateSelf. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function terminateSelf(callback: AsyncCallback): void; - - /** - * Destroys this service ability. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function terminateSelf(): Promise; - - /** - * Obtains the dataAbilityHelper. - * @param { string } uri - Indicates the path of the file to open. - * @returns { DataAbilityHelper } Returns the dataAbilityHelper. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function acquireDataAbilityHelper(uri: string): DataAbilityHelper; - - /** - * Connects an ability to a Service ability. - * @param { Want } request - Indicates the Service ability to connect. - * @param { ConnectOptions } options - Callback object for the client. If this parameter is null, an exception is thrown. - * @returns { number } Returns the unique identifier of the connection between the client and the service side. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function connectAbility(request: Want, options: ConnectOptions): number; - - /** - * Disconnects ability to a Service ability. - * @param { number } connection - the connection id returned from connectAbility api. - * @param { AsyncCallback } callback - The callback of disconnectAbility. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function disconnectAbility(connection: number, callback: AsyncCallback): void; - - /** - * Disconnects ability to a Service ability. - * @param { number } connection - the connection id returned from connectAbility api. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - function disconnectAbility(connection: number): Promise; -} -export default particleAbility; -- Gitee From 637e63f1c6345768ec57fc5dc8efaf9b6c1a95b8 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:21:55 +0800 Subject: [PATCH 11/34] IssueNo: #I5RT32 Description: add AbilityConstant Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.AbilityConstant.d.ts | 121 +++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 api/@ohos.app.ability.AbilityConstant.d.ts diff --git a/api/@ohos.app.ability.AbilityConstant.d.ts b/api/@ohos.app.ability.AbilityConstant.d.ts new file mode 100644 index 0000000000..515d419899 --- /dev/null +++ b/api/@ohos.app.ability.AbilityConstant.d.ts @@ -0,0 +1,121 @@ +/* + * 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 AbilityConstant. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @StageModelOnly + */ +declare namespace AbilityConstant { + /** + * Interface of launch param. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export interface LaunchParam { + /** + * Indicates launch reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + launchReason: LaunchReason; + + /** + * Indicates last exit reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + lastExitReason: LastExitReason; + } + + /** + * Type of launch reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum LaunchReason { + UNKNOWN = 0, + START_ABILITY = 1, + CALL = 2, + CONTINUATION = 3, + } + + /** + * Type of last exit reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum LastExitReason { + UNKNOWN = 0, + ABILITY_NOT_RESPONDING = 1, + NORMAL = 2, + } + + /** + * Type of onContinue result. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum OnContinueResult { + AGREE = 0, + REJECT = 1, + MISMATCH = 2, + } + + /** + * Type of memory level. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum MemoryLevel { + MEMORY_LEVEL_MODERATE = 0, + MEMORY_LEVEL_LOW = 1, + MEMORY_LEVEL_CRITICAL = 2, + } + + /** + * Type of window mode. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum WindowMode { + WINDOW_MODE_UNDEFINED = 0, + WINDOW_MODE_FULLSCREEN = 1, + WINDOW_MODE_SPLIT_PRIMARY = 100, + WINDOW_MODE_SPLIT_SECONDARY = 101, + WINDOW_MODE_FLOATING = 102, + } +} + +export default AbilityConstant -- Gitee From 6300d51175f1b991c4e7dff8e523b8f5e89c3a60 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:24:24 +0800 Subject: [PATCH 12/34] IssueNo: #I5RT32 Description: fix jsdoc for AbilityConstant Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.AbilityConstant.d.ts | 53 ++++++++++------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/api/@ohos.app.ability.AbilityConstant.d.ts b/api/@ohos.app.ability.AbilityConstant.d.ts index 515d419899..f5c61caeb2 100644 --- a/api/@ohos.app.ability.AbilityConstant.d.ts +++ b/api/@ohos.app.ability.AbilityConstant.d.ts @@ -15,46 +15,43 @@ /** * The definition of AbilityConstant. - * - * @since 9 + * @namespace AbilityConstant * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ declare namespace AbilityConstant { /** * Interface of launch param. - * - * @since 9 + * @typedef LaunchParam * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export interface LaunchParam { /** * Indicates launch reason. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ launchReason: LaunchReason; /** * Indicates last exit reason. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ lastExitReason: LastExitReason; } /** * Type of launch reason. - * - * @since 9 + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum LaunchReason { UNKNOWN = 0, @@ -65,10 +62,10 @@ declare namespace AbilityConstant { /** * Type of last exit reason. - * - * @since 9 + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum LastExitReason { UNKNOWN = 0, @@ -78,10 +75,10 @@ declare namespace AbilityConstant { /** * Type of onContinue result. - * - * @since 9 + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum OnContinueResult { AGREE = 0, @@ -91,10 +88,10 @@ declare namespace AbilityConstant { /** * Type of memory level. - * - * @since 9 + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum MemoryLevel { MEMORY_LEVEL_MODERATE = 0, @@ -104,10 +101,10 @@ declare namespace AbilityConstant { /** * Type of window mode. - * - * @since 9 + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum WindowMode { WINDOW_MODE_UNDEFINED = 0, -- Gitee From bab4c4f7e4f426caf490ff0c4576434bb6f52d20 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:25:40 +0800 Subject: [PATCH 13/34] IssueNo: #I5RT32 Description: add abilityDelegatorRegistry Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ....app.ability.abilityDelegatorRegistry.d.ts | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 api/@ohos.app.ability.abilityDelegatorRegistry.d.ts diff --git a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts new file mode 100644 index 0000000000..ad936320c5 --- /dev/null +++ b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2021 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 { AbilityDelegator as _AbilityDelegator } from './application/abilityDelegator'; +import { AbilityDelegatorArgs as _AbilityDelegatorArgs } from './application/abilityDelegatorArgs'; +import { AbilityMonitor as _AbilityMonitor } from './application/abilityMonitor'; +import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult'; + +/** + * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered + * during application startup. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + * @permission N/A + */ +declare namespace abilityDelegatorRegistry { + /** + * Get the AbilityDelegator object of the application. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return the AbilityDelegator object initialized when the application is started. + */ + function getAbilityDelegator(): AbilityDelegator; + + /** + * Get unit test parameters stored in the AbilityDelegatorArgs object. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return the previously registered AbilityDelegatorArgs object. + */ + function getArguments(): AbilityDelegatorArgs; + + /** + * Describes all lifecycle states of an ability. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + export enum AbilityLifecycleState { + UNINITIALIZED, + CREATE, + FOREGROUND, + BACKGROUND, + DESTROY, + } + + /** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import AbilityDelegator from 'application/abilityDelegator.d' + */ + export type AbilityDelegator = _AbilityDelegator + + /** + * Store unit testing-related parameters, including test case names, and test runner name. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import AbilityDelegatorArgs from 'application/abilityDelegatorArgs.d' + */ + export type AbilityDelegatorArgs = _AbilityDelegatorArgs + + /** + * Provide methods for matching monitored Ability objects that meet specified conditions. + * The most recently matched Ability objects will be saved in the AbilityMonitor object. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import AbilityMonitor from 'application/abilityMonitor.d' + */ + export type AbilityMonitor = _AbilityMonitor + + /** + * A object that records the result of shell command executes. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @import import ShellCmdResult from 'application/shellCmdResult.d' + */ + export type ShellCmdResult = _ShellCmdResult +} + +export default abilityDelegatorRegistry; \ No newline at end of file -- Gitee From fe0ff3ac071444ba1e6002496903efd04b6aca99 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:29:42 +0800 Subject: [PATCH 14/34] IssueNo: #I5RT32 Description: fix jsdoc for abilityDelegatorRegistry Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ....app.ability.abilityDelegatorRegistry.d.ts | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts index ad936320c5..5d4d9147aa 100644 --- a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts +++ b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * 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 @@ -21,36 +21,32 @@ import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult' /** * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered * during application startup. - * - * @since 8 + * @namespace abilityDelegatorRegistry * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - * @permission N/A + * @since 9 */ declare namespace abilityDelegatorRegistry { /** * Get the AbilityDelegator object of the application. - * - * @since 8 + * @returns { AbilityDelegator } Return the AbilityDelegator object initialized when the application is started. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return the AbilityDelegator object initialized when the application is started. + * @since 9 */ function getAbilityDelegator(): AbilityDelegator; /** * Get unit test parameters stored in the AbilityDelegatorArgs object. - * - * @since 8 + * @returns { AbilityDelegator } Return the previously registered AbilityDelegatorArgs object. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return the previously registered AbilityDelegatorArgs object. + * @since 9 */ function getArguments(): AbilityDelegatorArgs; /** * Describes all lifecycle states of an ability. - * - * @since 8 + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 */ export enum AbilityLifecycleState { UNINITIALIZED, @@ -62,38 +58,30 @@ declare namespace abilityDelegatorRegistry { /** * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegator from 'application/abilityDelegator.d' + * @since 9 */ export type AbilityDelegator = _AbilityDelegator /** * Store unit testing-related parameters, including test case names, and test runner name. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegatorArgs from 'application/abilityDelegatorArgs.d' + * @since 9 */ export type AbilityDelegatorArgs = _AbilityDelegatorArgs /** * Provide methods for matching monitored Ability objects that meet specified conditions. * The most recently matched Ability objects will be saved in the AbilityMonitor object. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityMonitor from 'application/abilityMonitor.d' + * @since 9 */ export type AbilityMonitor = _AbilityMonitor /** * A object that records the result of shell command executes. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import ShellCmdResult from 'application/shellCmdResult.d' + * @since 9 */ export type ShellCmdResult = _ShellCmdResult } -- Gitee From 4bb9dd4f21073a12bb18ae6805e75b8a991d08c6 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:31:07 +0800 Subject: [PATCH 15/34] IssueNo: #I5RT32 Description: add AbilityLifecycleCallback Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ....app.ability.AbilityLifecycleCallback.d.ts | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 api/@ohos.app.ability.AbilityLifecycleCallback.d.ts diff --git a/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts new file mode 100644 index 0000000000..39cd4eb594 --- /dev/null +++ b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts @@ -0,0 +1,121 @@ +/* + * 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 Ability from "./@ohos.application.Ability"; +import dataAbility from "./@ohos.data.dataAbility"; +import window from './@ohos.window'; + +/** + * The ability lifecycle callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + */ +export default class AbilityLifecycleCallback { + /** + * Called back when an ability is started for initialization. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @StageModelOnly + */ + onAbilityCreate(ability: Ability): void; + + /** + * Called back when a window stage is created. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @param windowStage window stage to create + * @StageModelOnly + */ + onWindowStageCreate(ability: Ability, windowStage: window.WindowStage): void; + + /** + * Called back when a window stage is actived. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @param windowStage window stage to active + * @StageModelOnly + */ + onWindowStageActive(ability: Ability, windowStage: window.WindowStage): void; + + /** + * Called back when a window stage is inactived. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @param windowStage window stage to inactive + * @StageModelOnly + */ + onWindowStageInactive(ability: Ability, windowStage: window.WindowStage): void; + + /** + * Called back when a window stage is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @param windowStage window stage to destroy + * @StageModelOnly + */ + onWindowStageDestroy(ability: Ability, windowStage: window.WindowStage): void; + + /** + * Called back when an ability is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @StageModelOnly + */ + onAbilityDestroy(ability: Ability): void; + + /** + * Called back when the state of an ability changes to foreground. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @StageModelOnly + */ + onAbilityForeground(ability: Ability): void; + + /** + * Called back when the state of an ability changes to background. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @StageModelOnly + */ + onAbilityBackground(ability: Ability): void; + + /** + * Called back when an ability prepares to continue. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param ability: Indicates the ability to register for listening. + * @StageModelOnly + */ + onAbilityContinue(ability: Ability): void; +} \ No newline at end of file -- Gitee From 9d668eb6196976e43902de9681efc5e028d8b3d0 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:36:06 +0800 Subject: [PATCH 16/34] IssueNo: #I5RT32 Description: fix jsdoc for AbilityLifecycleCallback Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ....app.ability.AbilityLifecycleCallback.d.ts | 78 ++++++++----------- 1 file changed, 34 insertions(+), 44 deletions(-) diff --git a/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts index 39cd4eb594..a94e3e71d4 100644 --- a/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts +++ b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts @@ -13,109 +13,99 @@ * limitations under the License. */ -import Ability from "./@ohos.application.Ability"; +import Ability from "./@ohos.app.ability.Ability"; import dataAbility from "./@ohos.data.dataAbility"; import window from './@ohos.window'; /** * The ability lifecycle callback. - * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A */ export default class AbilityLifecycleCallback { /** * Called back when an ability is started for initialization. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAbilityCreate(ability: Ability): void; /** * Called back when a window stage is created. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to create * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @param windowStage window stage to create - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageCreate(ability: Ability, windowStage: window.WindowStage): void; /** * Called back when a window stage is actived. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to active * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @param windowStage window stage to active - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageActive(ability: Ability, windowStage: window.WindowStage): void; /** * Called back when a window stage is inactived. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to inactive * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @param windowStage window stage to inactive - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageInactive(ability: Ability, windowStage: window.WindowStage): void; /** * Called back when a window stage is destroyed. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to destroy * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @param windowStage window stage to destroy - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onWindowStageDestroy(ability: Ability, windowStage: window.WindowStage): void; /** * Called back when an ability is destroyed. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAbilityDestroy(ability: Ability): void; /** * Called back when the state of an ability changes to foreground. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAbilityForeground(ability: Ability): void; /** * Called back when the state of an ability changes to background. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAbilityBackground(ability: Ability): void; /** * Called back when an ability prepares to continue. - * - * @since 9 + * @param { Ability } ability - Indicates the ability to register for listening. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param ability: Indicates the ability to register for listening. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAbilityContinue(ability: Ability): void; } \ No newline at end of file -- Gitee From d81a92ad7fdd0d7b964505859ec39af7625277c7 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:41:13 +0800 Subject: [PATCH 17/34] IssueNo: #I5RT32 Description: add AbilityStage Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.AbilityStage.d.ts | 84 +++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 api/@ohos.app.ability.AbilityStage.d.ts diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts new file mode 100644 index 0000000000..a0369329ce --- /dev/null +++ b/api/@ohos.app.ability.AbilityStage.d.ts @@ -0,0 +1,84 @@ +/* + * 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 + * + * 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 AbilityConstant from "./@ohos.application.AbilityConstant"; +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 + * @permission N/A + * @StageModelOnly + */ +export default class AbilityStage { + /** + * Indicates configuration information about context. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + context: AbilityStageContext; + + /** + * Called back when an ability stage is started for initialization. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @return - + * @StageModelOnly + */ + onCreate(): void; + + /** + * Called back when start specified ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want info of startd ability. + * @return The user returns an ability string ID. If the ability of this ID has been started before, + * do not create a new instance and pull it back to the top of the stack. + * Otherwise, create a new instance and start it. + * @StageModelOnly + */ + onAcceptWant(want: Want): string; + + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param config Indicates the updated configuration. + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; + + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param level Indicates the memory trim level, which shows the current memory usage status. + * @return - + * @StageModelOnly + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; +} -- Gitee From ec99d67741117acf1976e08ad423e709ee030588 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:51:36 +0800 Subject: [PATCH 18/34] IssueNo: #I5RT32 Description: fix jsdoc for AbilityStage Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.AbilityStage.d.ts | 49 ++++++++++--------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts index a0369329ce..be54070e1d 100644 --- a/api/@ohos.app.ability.AbilityStage.d.ts +++ b/api/@ohos.app.ability.AbilityStage.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -20,65 +20,56 @@ import { Configuration } from './@ohos.application.Configuration'; /** * The class of an ability stage. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class AbilityStage { /** * Indicates configuration information about context. - * - * @since 9 + * @type { AbilityStageContext } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ context: AbilityStageContext; /** * Called back when an ability stage is started for initialization. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onCreate(): void; /** * Called back when start specified ability. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info of startd ability. - * @return The user returns an ability string ID. If the ability of this ID has been started before, + * @param { Want } want - Indicates the want info of startd ability. + * @return { string } The user returns an ability string ID. If the ability of this ID has been started before, * do not create a new instance and pull it back to the top of the stack. * Otherwise, create a new instance and start it. - * @StageModelOnly + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 */ onAcceptWant(want: Want): string; /** * Called when the system configuration is updated. - * - * @since 9 + * @param { Configuration } config - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param config Indicates the updated configuration. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onConfigurationUpdated(config: Configuration): void; /** * Called when the system has determined to trim the memory, for example, when the ability is running in the * background and there is no enough memory for running as many background processes as possible. - * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param level Indicates the memory trim level, which shows the current memory usage status. - * @return - - * @StageModelOnly */ - onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; } -- Gitee From c33c922b2700e0e6c425b4ca1dd6afb9bf551777 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:58:12 +0800 Subject: [PATCH 19/34] IssueNo: #I5RT32 Description: add common Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.common.d.ts | 125 ++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100755 api/@ohos.app.ability.common.d.ts diff --git a/api/@ohos.app.ability.common.d.ts b/api/@ohos.app.ability.common.d.ts new file mode 100755 index 0000000000..698635543d --- /dev/null +++ b/api/@ohos.app.ability.common.d.ts @@ -0,0 +1,125 @@ +/* + * 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 * as _AbilityContext from './application/AbilityContext'; +import * as _AbilityStageContext from './application/AbilityStageContext'; +import * as _ApplicationContext from './application/ApplicationContext'; +import * as _BaseContext from './application/BaseContext'; +import * as _Context from './application/Context'; +import * as _ExtensionContext from './application/ExtensionContext'; +import * as _FormExtensionContext from './application/FormExtensionContext'; +import * as _EventHub from './application/EventHub'; +import * as _PermissionRequestResult from './application/PermissionRequestResult'; + +/** + * The context of an application. It allows access to application-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +declare namespace common { + + /** + * The context of an ability. It allows access to ability-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type AbilityContext = _AbilityContext.default + + /** + * The context of an abilityStage. It allows access to abilityStage-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type AbilityStageContext = _AbilityStageContext.default + + /** + * The context of an application. It allows access to application-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type ApplicationContext = _ApplicationContext.default + + /** + * The base context of 'app.Context' for FA Mode or 'application.Context' for Stage Mode. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type BaseContext = _BaseContext.default + + /** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type Context = _Context.default + + /** + * The context of an extension. It allows access to extension-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type ExtensionContext = _ExtensionContext.default + + /** + * The context of form extension. It allows access to + * formExtension-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type FormExtensionContext = _FormExtensionContext.default + + /** + * File area mode + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export enum AreaMode { + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL1 = 0, + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL2 = 1 + } + + /** + * The event center of a context, support the subscription and publication of events. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type EventHub = _EventHub.default + + /** + * The result of requestPermissionsFromUser with asynchronous callback. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type PermissionRequestResult = _PermissionRequestResult.default +} + +export default common; -- Gitee From 09ed83e3243d99330570a6b429a59c7a1028b7a3 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 16:59:09 +0800 Subject: [PATCH 20/34] IssueNo: #I5RT32 Description: add EnvironmentCallback Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ...@ohos.app.ability.EnvironmentCallback.d.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 api/@ohos.app.ability.EnvironmentCallback.d.ts diff --git a/api/@ohos.app.ability.EnvironmentCallback.d.ts b/api/@ohos.app.ability.EnvironmentCallback.d.ts new file mode 100755 index 0000000000..e2c910976b --- /dev/null +++ b/api/@ohos.app.ability.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; +} -- Gitee From d6a94f7478d55409a1387383d362db98190471f1 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 17:00:52 +0800 Subject: [PATCH 21/34] IssueNo: #I5RT32 Description: fix jsdoc for EnvironmentCallback Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.EnvironmentCallback.d.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/api/@ohos.app.ability.EnvironmentCallback.d.ts b/api/@ohos.app.ability.EnvironmentCallback.d.ts index e2c910976b..1e1a9419ad 100755 --- a/api/@ohos.app.ability.EnvironmentCallback.d.ts +++ b/api/@ohos.app.ability.EnvironmentCallback.d.ts @@ -17,19 +17,16 @@ import { Configuration } from './@ohos.application.Configuration'; /** * The environment callback. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A + * @since 9 */ export default class EnvironmentCallback { /** * Called when the system configuration is updated. - * - * @since 9 + * @param { Configuration } config - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param config: Indicates the updated configuration. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - onConfigurationUpdated(config: Configuration): void; + onConfigurationUpdated(config: Configuration): void; } -- Gitee From f59061f1f5db0eea4b340900b5e35ce24db36d75 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 17:04:03 +0800 Subject: [PATCH 22/34] IssueNo: #I5RT32 Description: add ExtensionAbility Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.ExtensionAbility.d.ts | 44 +++++++++++++++++++++ api/@ohos.app.ability.common.d.ts | 18 ++++----- 2 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 api/@ohos.app.ability.ExtensionAbility.d.ts diff --git a/api/@ohos.app.ability.ExtensionAbility.d.ts b/api/@ohos.app.ability.ExtensionAbility.d.ts new file mode 100644 index 0000000000..744d45605a --- /dev/null +++ b/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -0,0 +1,44 @@ +/* + * 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 AbilityConstant from "./@ohos.application.AbilityConstant"; +import { Configuration } from './@ohos.application.Configuration'; + +/** + * class of extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +export default class ExtensionAbility { + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + onConfigurationUpdated(newConfig: Configuration): void; + + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; +} \ No newline at end of file diff --git a/api/@ohos.app.ability.common.d.ts b/api/@ohos.app.ability.common.d.ts index 698635543d..7c2d786101 100755 --- a/api/@ohos.app.ability.common.d.ts +++ b/api/@ohos.app.ability.common.d.ts @@ -13,15 +13,15 @@ * limitations under the License. */ -import * as _AbilityContext from './application/AbilityContext'; -import * as _AbilityStageContext from './application/AbilityStageContext'; -import * as _ApplicationContext from './application/ApplicationContext'; -import * as _BaseContext from './application/BaseContext'; -import * as _Context from './application/Context'; -import * as _ExtensionContext from './application/ExtensionContext'; -import * as _FormExtensionContext from './application/FormExtensionContext'; -import * as _EventHub from './application/EventHub'; -import * as _PermissionRequestResult from './application/PermissionRequestResult'; +import * as _AbilityContext from './application/AbilityContext'; +import * as _AbilityStageContext from './application/AbilityStageContext'; +import * as _ApplicationContext from './application/ApplicationContext'; +import * as _BaseContext from './application/BaseContext'; +import * as _Context from './application/Context'; +import * as _ExtensionContext from './application/ExtensionContext'; +import * as _FormExtensionContext from './application/FormExtensionContext'; +import * as _EventHub from './application/EventHub'; +import * as _PermissionRequestResult from './application/PermissionRequestResult'; /** * The context of an application. It allows access to application-specific resources. -- Gitee From ec811497e059e6d9299465e9acd1139ef61c9105 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 17:10:21 +0800 Subject: [PATCH 23/34] IssueNo: #I5RT32 Description: fix jsdoc for FormExtensionAbility Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.form.FormExtensionAbility.d.ts | 114 ++++++++----------- 1 file changed, 49 insertions(+), 65 deletions(-) diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts index 56dacc5b62..a3d519049a 100644 --- a/api/@ohos.app.form.FormExtensionAbility.d.ts +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -21,134 +21,118 @@ import { Configuration } from './@ohos.application.Configuration'; /** * class of form extension. - * - * @since 9 * @syscap SystemCapability.Ability.Form - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class FormExtensionAbility { /** * Indicates form extension context. - * - * @since 9 + * @type { FormExtensionContext } * @syscap SystemCapability.Ability.Form - * @StageModelOnly + * @stagemodelonly + * @since 9 */ context: FormExtensionContext; /** * Called to return a {@link formBindingData#FormBindingData} object. - * - * @since 9 + * @param { Want } 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 + * acquisition, update, and deletion. + * @return { formBindingData.FormBindingData } Returns the created {@link formBindingData#FormBindingData} object. * @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 - * acquisition, update, and deletion. - * @return Returns the created {@link formBindingData#FormBindingData} object. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAddForm(want: Want): formBindingData.FormBindingData; /** * Called when the form provider is notified that a temporary form is successfully converted to a normal form. - * - * @since 9 + * @param { string } formId - Indicates the ID of the form. * @syscap SystemCapability.Ability.Form - * @param formId Indicates the ID of the form. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onCastToNormalForm(formId: string): void; /** * Called to notify the form provider to update a specified form. - * - * @since 9 + * @param { string } formId - Indicates the ID of the form to update. * @syscap SystemCapability.Ability.Form - * @param formId Indicates the ID of the form to update. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onUpdateForm(formId: string): void; /** * Called when the form provider receives form events from the system. - * - * @since 9 + * @param { { [key: string]: number } } 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 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. * @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 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 - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onChangeFormVisibility(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 9 + * @param { string } 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 { string } message - Indicates the value of the {@code params} field of the message event. This parameter + * is used to identify the specific component on which the event is triggered. * @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 - * used to identify the specific component on which the event is triggered. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onFormEvent(formId: string, message: string): void; /** * Called to notify the form provider that a specified form has been destroyed. Override this method if * you want your application, as the form provider, to be notified of form deletion. - * - * @since 9 + * @param { string } formId - Indicates the ID of the destroyed form. * @syscap SystemCapability.Ability.Form - * @param formId Indicates the ID of the destroyed form. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onRemoveForm(formId: string): void; /** * Called when the system configuration is updated. - * - * @since 9 + * @param { Configuration } config - Indicates the system configuration, such as language and color mode. * @syscap SystemCapability.Ability.Form - * @param configuration Indicates the system configuration, such as language and color mode. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onConfigurationUpdated(config: Configuration): void; /** * Called to return a {@link FormState} object. - * *

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 9 + * @param { Want } 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 { formInfo.FormState } Returns the {@link formInfo#FormState} object. * @syscap SystemCapability.Ability.Form - * @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 formInfo#FormState} object. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ onAcquireFormState?(want: Want): formInfo.FormState; /** * Called when the system shares the form. - * - * @since 9 + * @param { string } formId - Indicates the ID of the form. + * @return { { [key: string]: any } } Returns the wantParams object. * @syscap SystemCapability.Ability.Form - * @param formId Indicates the ID of the form. - * @systemapi hide for inner use. - * @return Returns the wantParams object. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - onFormToBeShared?(formId: string): {[key: string]: any}; + onFormToBeShared?(formId: string): { [key: string]: any }; } -- Gitee From 1bb662825e27b6d9682ba8a857f45cde724e23b8 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 19:06:52 +0800 Subject: [PATCH 24/34] IssueNo: #I5RT32 Description: add ServiceExtensionAbility Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ...s.app.ability.ServiceExtensionAbility.d.ts | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 api/@ohos.app.ability.ServiceExtensionAbility.d.ts diff --git a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts new file mode 100644 index 0000000000..d7d512ca8f --- /dev/null +++ b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts @@ -0,0 +1,137 @@ +/* + * 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 + * + * 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 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 ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @StageModelOnly + */ +export default class ServiceExtensionAbility { + /** + * Indicates service extension ability context. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @StageModelOnly + */ + context: ServiceExtensionContext; + + /** + * Called back when a service extension is started for initialization. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the want of created service extension. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + onCreate(want: Want): void; + + /** + * Called back before a service extension is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + onDestroy(): void; + + /** + * Called back when a service extension is started. + * + * @since 9 + * @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 + * has been started for six times. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + onRequest(want: Want, startId: number): void; + + /** + * Called back when a service extension is first connected to an ability. + * + * @since 9 + * @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. + * @StageModelOnly + */ + onConnect(want: Want): rpc.RemoteObject; + + /** + * Called back when all abilities connected to a service extension are disconnected. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates disconnection information about the service extension. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + */ + onDisconnect(want: Want): void; + + /** + * Called when a new client attempts to connect to a service extension after all previous client connections to it + * are disconnected. + * + * @since 9 + * @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 + * @param config Indicates the updated configuration. + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; + + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param params Indicates the params from command. + * @return The dump info array. + * @StageModelOnly + */ + onDump(params: Array): Array; +} -- Gitee From 63022ed52daece1a1b7023debd3c5d3d6ed71cac Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 19:11:12 +0800 Subject: [PATCH 25/34] IssueNo: #I5RT32 Description: fix jsdoc for ServiceExtensionAbility Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ...s.app.ability.ServiceExtensionAbility.d.ts | 99 ++++++++----------- 1 file changed, 42 insertions(+), 57 deletions(-) diff --git a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts index d7d512ca8f..3675c902d0 100644 --- a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts +++ b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * 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 @@ -20,118 +20,103 @@ import { Configuration } from './@ohos.application.Configuration'; /** * class of service extension ability. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ export default class ServiceExtensionAbility { /** * Indicates service extension ability context. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ context: ServiceExtensionContext; /** * Called back when a service extension is started for initialization. - * - * @since 9 + * @param { Want } want - Indicates the want of created service extension. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want of created service extension. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onCreate(want: Want): void; /** * Called back before a service extension is destroyed. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onDestroy(): void; /** * Called back when a service extension is started. - * - * @since 9 + * @param { Want } want - Indicates the want of service extension to start. + * @param { number } 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 has been started for six times. * @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 - * has been started for six times. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onRequest(want: Want, startId: number): void; /** * Called back when a service extension is first connected to an ability. - * - * @since 9 + * @param { Want } want - Indicates connection information about the Service ability. * @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. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onConnect(want: Want): rpc.RemoteObject; /** * Called back when all abilities connected to a service extension are disconnected. - * - * @since 9 + * @param { Want } want - Indicates disconnection information about the service extension. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates disconnection information about the service extension. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onDisconnect(want: Want): void; /** * Called when a new client attempts to connect to a service extension after all previous client connections to it * are disconnected. - * - * @since 9 + * @param { Want } want - Indicates the want of the service extension being connected. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want of the service extension being connected. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onReconnect(want: Want): void; /** * Called when the system configuration is updated. - * - * @since 9 + * @param { Configuration } config - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param config Indicates the updated configuration. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ onConfigurationUpdated(config: Configuration): void; /** * Called when dump client information is required. * It is recommended that developers don't DUMP sensitive information. - * + * @param { Array } params - Indicates the params from command. + * @return { Array } The dump info array. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param params Indicates the params from command. - * @return The dump info array. - * @StageModelOnly */ onDump(params: Array): Array; } -- Gitee From c37ecdaba37d8eb3046e9f190535060a950c0fb4 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 19:16:54 +0800 Subject: [PATCH 26/34] IssueNo: #I5RT32 Description: add StartOptions Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.StartOptions.d.ts | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 api/@ohos.app.ability.StartOptions.d.ts diff --git a/api/@ohos.app.ability.StartOptions.d.ts b/api/@ohos.app.ability.StartOptions.d.ts new file mode 100644 index 0000000000..2650fce27a --- /dev/null +++ b/api/@ohos.app.ability.StartOptions.d.ts @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * StartOptions is the basic communication component of the system. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +export default class StartOptions { + /** + * windowMode + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + windowMode?: number; + + /** + * displayId + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + displayId?: number; +} \ No newline at end of file -- Gitee From fa0f7bdb910ee875b29006646cb02ac5c7a395ed Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 19:30:40 +0800 Subject: [PATCH 27/34] IssueNo: #I5RT32 Description: fix import Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.Ability.d.ts | 2 +- api/@ohos.app.ability.AbilityStage.d.ts | 2 +- api/@ohos.app.ability.ExtensionAbility.d.ts | 2 +- api/@ohos.app.ability.common.d.ts | 27 + api/@ohos.app.ability.missionManager.d.ts | 2 +- api/@ohos.app.form.formHost.d.ts | 2 +- api/@ohos.app.form.formProvider.d.ts | 2 +- api/@ohos.application.Ability.d.ts | 10 +- api/@ohos.application.AbilityConstant.d.ts | 2 + ....application.AbilityLifecycleCallback.d.ts | 2 + api/@ohos.application.AbilityStage.d.ts | 2 + ...@ohos.application.EnvironmentCallback.d.ts | 2 + api/@ohos.application.ExtensionAbility.d.ts | 2 + api/@ohos.application.FormExtension.d.ts | 2 + ...s.application.ServiceExtensionAbility.d.ts | 4 +- api/@ohos.application.StartOptions.d.ts | 2 + ....application.abilityDelegatorRegistry.d.ts | 2 + api/@ohos.application.abilityManager.d.ts | 2 +- api/@ohos.application.appManager.d.ts | 2 + api/@ohos.application.context.d.ts | 2 + api/@ohos.application.errorManager.d.ts | 2 +- api/@ohos.application.missionManager.d.ts | 2 +- api/@ohos.application.quickFixManager.d.ts | 155 ----- api/@ohos.wantAgent.d.ts | 2 +- api/ability/dataAbilityHelper.d.ts | 4 - api/ability/dataAbilityUtils.d.ts | 474 -------------- api/app/context.d.ts | 6 - api/app/featureAbilityContext.d.ts | 593 ------------------ 28 files changed, 65 insertions(+), 1248 deletions(-) delete mode 100644 api/@ohos.application.quickFixManager.d.ts delete mode 100644 api/ability/dataAbilityUtils.d.ts delete mode 100644 api/app/featureAbilityContext.d.ts diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts index 9495a9745f..ee19b722b6 100755 --- a/api/@ohos.app.ability.Ability.d.ts +++ b/api/@ohos.app.ability.Ability.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import AbilityConstant from "./@ohos.application.AbilityConstant"; +import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; import AbilityContext from "./application/AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts index be54070e1d..cc9634994f 100644 --- a/api/@ohos.app.ability.AbilityStage.d.ts +++ b/api/@ohos.app.ability.AbilityStage.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import AbilityConstant from "./@ohos.application.AbilityConstant"; +import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; import AbilityStageContext from "./application/AbilityStageContext"; import Want from './@ohos.application.Want'; import { Configuration } from './@ohos.application.Configuration'; diff --git a/api/@ohos.app.ability.ExtensionAbility.d.ts b/api/@ohos.app.ability.ExtensionAbility.d.ts index 744d45605a..5e7d6caf0b 100644 --- a/api/@ohos.app.ability.ExtensionAbility.d.ts +++ b/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import AbilityConstant from "./@ohos.application.AbilityConstant"; +import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; import { Configuration } from './@ohos.application.Configuration'; /** diff --git a/api/@ohos.app.ability.common.d.ts b/api/@ohos.app.ability.common.d.ts index 7c2d786101..1716916ce8 100755 --- a/api/@ohos.app.ability.common.d.ts +++ b/api/@ohos.app.ability.common.d.ts @@ -22,6 +22,9 @@ import * as _ExtensionContext from './application/ExtensionContext'; import * as _FormExtensionContext from './application/FormExtensionContext'; import * as _EventHub from './application/EventHub'; import * as _PermissionRequestResult from './application/PermissionRequestResult'; +import { PacMap as _PacMap } from "./ability/dataAbilityHelper"; +import { AbilityResult as _AbilityResult } from "./ability/abilityResult"; +import { ConnectOptions as _ConnectOptions } from "./ability/connectOptions"; /** * The context of an application. It allows access to application-specific resources. @@ -120,6 +123,30 @@ declare namespace common { * @since 9 */ export type PermissionRequestResult = _PermissionRequestResult.default + + /** + * Defines a PacMap object for storing a series of values. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type PacMap = _PacMap + + /** + * Indicates the result of startAbility. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type AbilityResult = _AbilityResult + + /** + * Indicates the callback of connection + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type ConnectOptions = _ConnectOptions } export default common; diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts index d8fee24cb5..efbed8686f 100644 --- a/api/@ohos.app.ability.missionManager.d.ts +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -17,7 +17,7 @@ import { AsyncCallback } from './basic'; import { MissionInfo as _MissionInfo } from './application/MissionInfo'; import { MissionListener as _MissionListener } from './application/MissionListener'; import { MissionSnapshot as _MissionSnapshot } from './application/MissionSnapshot'; -import StartOptions from "./@ohos.application.StartOptions"; +import StartOptions from "./@ohos.app.ability.StartOptions"; /** * This module provides the capability to manage abilities and obtaining system task information. diff --git a/api/@ohos.app.form.formHost.d.ts b/api/@ohos.app.form.formHost.d.ts index 3f696e72a4..dbc95cd2d2 100644 --- a/api/@ohos.app.form.formHost.d.ts +++ b/api/@ohos.app.form.formHost.d.ts @@ -16,7 +16,7 @@ import { AsyncCallback } from "./basic"; import { Callback } from "./basic"; import Want from './@ohos.application.Want'; -import formInfo from './@ohos.application.formInfo' +import formInfo from './@ohos.application.formInfo'; /** * Interface of formHost. diff --git a/api/@ohos.app.form.formProvider.d.ts b/api/@ohos.app.form.formProvider.d.ts index f2a87e039e..fb7f4dc857 100644 --- a/api/@ohos.app.form.formProvider.d.ts +++ b/api/@ohos.app.form.formProvider.d.ts @@ -16,7 +16,7 @@ import { AsyncCallback } from "./basic"; import formBindingData from "./@ohos.app.form.formBindingData"; import formInfo from "./@ohos.application.formInfo"; -import Want from "./@ohos.application.Want" +import Want from "./@ohos.application.Want"; /** * Interface of formProvider. diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 1d74c2371f..f0c54d72a5 100755 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -30,7 +30,7 @@ import rpc from './@ohos.rpc'; * @return - * @StageModelOnly * @deprecated since 9 - * @useinstead @ohos.app.ability.Ability + * @useinstead ohos.app.ability.Ability */ export interface OnReleaseCallBack { (msg: string): void; @@ -46,7 +46,7 @@ export interface OnReleaseCallBack { * @return rpc.Sequenceable * @StageModelOnly * @deprecated since 9 - * @useinstead @ohos.app.ability.Ability + * @useinstead ohos.app.ability.Ability */ export interface CalleeCallBack { (indata: rpc.MessageParcel): rpc.Sequenceable; @@ -60,7 +60,7 @@ export interface CalleeCallBack { * @permission N/A * @StageModelOnly * @deprecated since 9 - * @useinstead @ohos.app.ability.Ability + * @useinstead ohos.app.ability.Ability */ export interface Caller { /** @@ -117,7 +117,7 @@ export interface Caller { * @permission N/A * @StageModelOnly * @deprecated since 9 - * @useinstead @ohos.app.ability.Ability + * @useinstead ohos.app.ability.Ability */ export interface Callee { @@ -153,7 +153,7 @@ export interface Callee { * @permission N/A * @StageModelOnly * @deprecated since 9 - * @useinstead @ohos.app.ability.Ability + * @useinstead ohos.app.ability.Ability */ export default class Ability { /** diff --git a/api/@ohos.application.AbilityConstant.d.ts b/api/@ohos.application.AbilityConstant.d.ts index 2847a26649..1ee74d5e78 100644 --- a/api/@ohos.application.AbilityConstant.d.ts +++ b/api/@ohos.application.AbilityConstant.d.ts @@ -20,6 +20,8 @@ * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.AbilityConstant */ declare namespace AbilityConstant { /** diff --git a/api/@ohos.application.AbilityLifecycleCallback.d.ts b/api/@ohos.application.AbilityLifecycleCallback.d.ts index 33db234da5..4e1f22ac9c 100644 --- a/api/@ohos.application.AbilityLifecycleCallback.d.ts +++ b/api/@ohos.application.AbilityLifecycleCallback.d.ts @@ -23,6 +23,8 @@ import window from './@ohos.window'; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.AbilityLifecycleCallback */ export default class AbilityLifecycleCallback { /** diff --git a/api/@ohos.application.AbilityStage.d.ts b/api/@ohos.application.AbilityStage.d.ts index a0369329ce..8d7b4cc1c8 100644 --- a/api/@ohos.application.AbilityStage.d.ts +++ b/api/@ohos.application.AbilityStage.d.ts @@ -25,6 +25,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.AbilityStage */ export default class AbilityStage { /** diff --git a/api/@ohos.application.EnvironmentCallback.d.ts b/api/@ohos.application.EnvironmentCallback.d.ts index b19bd5792e..55f6504a70 100755 --- a/api/@ohos.application.EnvironmentCallback.d.ts +++ b/api/@ohos.application.EnvironmentCallback.d.ts @@ -21,6 +21,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.EnvironmentCallback */ export default class EnvironmentCallback { /** diff --git a/api/@ohos.application.ExtensionAbility.d.ts b/api/@ohos.application.ExtensionAbility.d.ts index 3cfd0d9213..eda81a8ac3 100644 --- a/api/@ohos.application.ExtensionAbility.d.ts +++ b/api/@ohos.application.ExtensionAbility.d.ts @@ -22,6 +22,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.ExtensionAbility */ export default class ExtensionAbility { /** diff --git a/api/@ohos.application.FormExtension.d.ts b/api/@ohos.application.FormExtension.d.ts index 4c52a8387e..e3bbfc7fdc 100644 --- a/api/@ohos.application.FormExtension.d.ts +++ b/api/@ohos.application.FormExtension.d.ts @@ -25,6 +25,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @since 9 * @syscap SystemCapability.Ability.Form * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.form.FormExtensionAbility */ export default class FormExtension { /** diff --git a/api/@ohos.application.ServiceExtensionAbility.d.ts b/api/@ohos.application.ServiceExtensionAbility.d.ts index 93d3064b2e..5b850b90f6 100644 --- a/api/@ohos.application.ServiceExtensionAbility.d.ts +++ b/api/@ohos.application.ServiceExtensionAbility.d.ts @@ -25,6 +25,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide for inner use. * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.ServiceExtensionAbility */ export default class ServiceExtensionAbility { /** @@ -133,6 +135,6 @@ export default class ServiceExtensionAbility { * @return The dump info array. * @StageModelOnly */ - onDump(params: Array): Array; + dump(params: Array): Array; } diff --git a/api/@ohos.application.StartOptions.d.ts b/api/@ohos.application.StartOptions.d.ts index b4cd41bbce..0fc112e6d9 100644 --- a/api/@ohos.application.StartOptions.d.ts +++ b/api/@ohos.application.StartOptions.d.ts @@ -21,6 +21,8 @@ * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.StartOptions */ export default class StartOptions { /** diff --git a/api/@ohos.application.abilityDelegatorRegistry.d.ts b/api/@ohos.application.abilityDelegatorRegistry.d.ts index ad936320c5..d8d7a51a5b 100644 --- a/api/@ohos.application.abilityDelegatorRegistry.d.ts +++ b/api/@ohos.application.abilityDelegatorRegistry.d.ts @@ -26,6 +26,8 @@ import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult' * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry */ declare namespace abilityDelegatorRegistry { /** diff --git a/api/@ohos.application.abilityManager.d.ts b/api/@ohos.application.abilityManager.d.ts index a161cc8290..dfa26ab42b 100644 --- a/api/@ohos.application.abilityManager.d.ts +++ b/api/@ohos.application.abilityManager.d.ts @@ -27,7 +27,7 @@ import { ElementName } from './bundle/elementName'; * @systemapi Hide this for inner system use * @permission N/A * @deprecated since 9 - * @useinstead @ohos.app.ability.abilityManager + * @useinstead ohos.app.ability.abilityManager */ declare namespace abilityManager { /** diff --git a/api/@ohos.application.appManager.d.ts b/api/@ohos.application.appManager.d.ts index 834a8ef58d..3be17cb201 100644 --- a/api/@ohos.application.appManager.d.ts +++ b/api/@ohos.application.appManager.d.ts @@ -27,6 +27,8 @@ import { ProcessRunningInformation as _ProcessRunningInformation } from './appli * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import appManager from '@ohos.application.appManager' * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager */ declare namespace appManager { /** diff --git a/api/@ohos.application.context.d.ts b/api/@ohos.application.context.d.ts index cae84c127a..d9fc6b0c6b 100755 --- a/api/@ohos.application.context.d.ts +++ b/api/@ohos.application.context.d.ts @@ -29,6 +29,8 @@ import * as _PermissionRequestResult from './application/PermissionRequestResul * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.common */ declare namespace context { diff --git a/api/@ohos.application.errorManager.d.ts b/api/@ohos.application.errorManager.d.ts index 912f35efd4..1709d8e029 100644 --- a/api/@ohos.application.errorManager.d.ts +++ b/api/@ohos.application.errorManager.d.ts @@ -24,7 +24,7 @@ import * as _ErrorObserver from './application/ErrorObserver'; * @import import errorManager from '@ohos.application.errorManager' * @permission N/A * @deprecated since 9 - * @useinstead @ohos.app.ability.errorManager + * @useinstead ohos.app.ability.errorManager */ declare namespace errorManager { /** diff --git a/api/@ohos.application.missionManager.d.ts b/api/@ohos.application.missionManager.d.ts index 3398ce0a51..46062f5f42 100644 --- a/api/@ohos.application.missionManager.d.ts +++ b/api/@ohos.application.missionManager.d.ts @@ -28,7 +28,7 @@ import StartOptions from "./@ohos.application.StartOptions"; * @permission ohos.permission.MANAGE_MISSIONS * @systemapi hide for inner use. * @deprecated since 9 - * @useinstead @ohos.app.ability.missionManager + * @useinstead ohos.app.ability.missionManager */ declare namespace missionManager { /** diff --git a/api/@ohos.application.quickFixManager.d.ts b/api/@ohos.application.quickFixManager.d.ts deleted file mode 100644 index 4db4e87d7c..0000000000 --- a/api/@ohos.application.quickFixManager.d.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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"; - -/** - * Interface of quickFixManager. - * - * @name quickFixManager - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - * @deprecated since 9 - * @useinstead @ohos.app.ability.quickFixManager - */ -declare namespace quickFixManager { - /** - * Quick fix info of hap module. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - export interface HapModuleQuickFixInfo { - /** - * Indicates hap module name. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly moduleName: string; - - /** - * Indicates hash value of a hap. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly originHapHash: string; - - /** - * Indicates installed path of quick fix file. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly quickFixFilePath: string; - } - - /** - * Quick fix info of application. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - export interface ApplicationQuickFixInfo { - /** - * Bundle name. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly bundleName: string; - - /** - * The version number of the bundle. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly bundleVersionCode: number; - - /** - * The version name of the bundle. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly bundleVersionName: string; - - /** - * The version number of the quick fix. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly quickFixVersionCode: number; - - /** - * The version name of the quick fix. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly quickFixVersionName: string; - - /** - * Hap module quick fix info. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. - */ - readonly hapModuleQuickFixInfo: Array; - } - - /** - * Apply quick fix files. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @param hapModuleQuickFixFiles Quick fix files need to apply, this value should include file path and file name. - * @systemapi Hide this for inner system use. - * @return - - * @permission ohos.permission.INSTALL_BUNDLE - */ - function applyQuickFix(hapModuleQuickFixFiles: Array, callback: AsyncCallback): void; - function applyQuickFix(hapModuleQuickFixFiles: Array): Promise; - - /** - * Get application quick fix info by bundle name. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @param bundleName Bundle name wish to query. - * @systemapi Hide this for inner system use. - * @return Returns the {@link ApplicationQuickFixInfo}. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - */ - function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback): void; - function getApplicationQuickFixInfo(bundleName: string): Promise; -} - -export default quickFixManager; \ No newline at end of file diff --git a/api/@ohos.wantAgent.d.ts b/api/@ohos.wantAgent.d.ts index a6344ef34f..9863e89de4 100644 --- a/api/@ohos.wantAgent.d.ts +++ b/api/@ohos.wantAgent.d.ts @@ -28,7 +28,7 @@ import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; * @import import wantAgent from '@ohos.wantAgent'; * @permission N/A * @deprecated since 9 - * @useinstead @ohos.app.wantAgent + * @useinstead ohos.app.ability.wantAgent */ declare namespace wantAgent { /** diff --git a/api/ability/dataAbilityHelper.d.ts b/api/ability/dataAbilityHelper.d.ts index 2ffbfefded..bb5cba6122 100644 --- a/api/ability/dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityHelper.d.ts @@ -26,8 +26,6 @@ import rdb from '../@ohos.data.rdb'; * * @since 7 * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.dataAbilityHelper */ export interface DataAbilityHelper { /** @@ -243,8 +241,6 @@ export interface DataAbilityHelper { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.ability.dataAbilityHelper */ export interface PacMap { diff --git a/api/ability/dataAbilityUtils.d.ts b/api/ability/dataAbilityUtils.d.ts deleted file mode 100644 index 79ad8e7d7d..0000000000 --- a/api/ability/dataAbilityUtils.d.ts +++ /dev/null @@ -1,474 +0,0 @@ -/* -* 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 { ResultSet } from '../data/rdb/resultSet'; -import { DataAbilityOperation } from './dataAbilityOperation'; -import { DataAbilityResult } from './dataAbilityResult'; -import dataAbility from '../@ohos.data.dataAbility'; -import rdb from '../@ohos.data.rdb'; - -/** - * DataAbilityHelper - * @interface - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ -export interface DataAbilityHelper { - /** - * Opens a file in a specified remote path. - * @param { string } uri - Indicates the path of the file to open. - * @param { string } mode - Indicates the file 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, "wa" for write-only access to append to any existing data, - * "rw" for read and write access on any existing data, or "rwt" for read and write access - * that truncates any existing file. - * @param { AsyncCallback } callback - The callback is used to return the file descriptor. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - openFile(uri: string, mode: string, callback: AsyncCallback): void; - - /** - * Opens a file in a specified remote path. - * @param { string } uri - Indicates the path of the file to open. - * @param { string } mode - Indicates the file 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, "wa" for write-only access to append to any existing data, - * "rw" for read and write access on any existing data, or "rwt" for read and write access - * that truncates any existing file. - * @returns { Promise } Returns the promise of file descriptor. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - openFile(uri: string, mode: string): Promise; - - /** - * Registers an observer to observe data specified by the given uri. - * @param { string } type - dataChange. - * @param { string } uri - Indicates the path of the data to operate. - * @param { AsyncCallback } callback - The callback when dataChange. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - on(type: 'dataChange', uri: string, callback: AsyncCallback): void; - - /** - * Deregisters all observers used for monitoring data specified by the given uri. - * @param { string } type - dataChange. - * @param { string } uri - Indicates the path of the data to operate. - * @param { AsyncCallback } callback - The callback when dataChange. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; - - /** - * Obtains the MIME type of the date specified by the given URI. - * @param { string } uri - Indicates the path of the data to operate. - * @param { AsyncCallback } callback - The callback is used to return the MIME type. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - getType(uri: string, callback: AsyncCallback): void; - - /** - * Obtains the MIME type of the date specified by the given URI. - * @param { string } uri - Indicates the path of the data to operate. - * @returns { Promise } Returns the promise of MIME type that matches the data specified by uri. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - getType(uri: string): Promise; - - /** - * Obtains the MIME types of files supported. - * @param { string } uri - Indicates the path of the files to obtain. - * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain. - * @param { AsyncCallback> } callback - The callback is used to return the matched MIME types Array. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; - - /** - * Obtains the MIME types of files supported. - * @param { string } uri - Indicates the path of the files to obtain. - * @param { string } mimeTypeFilter - Indicates the MIME types of the files to obtain. - * @returns { Promise> } Returns the promise of matched MIME types Array. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - getFileTypes(uri: string, mimeTypeFilter: string): Promise>; - - /** - * Converts the given uri that refers to the Data ability into a normalized uri. - * @param { string } uri - Indicates the uri object to normalize. - * @param { AsyncCallback } callback - The callback is used to return the normalized uri object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - normalizeUri(uri: string, callback: AsyncCallback): void; - - /** - * Converts the given uri that refers to the Data ability into a normalized uri. - * @param { string } uri - Indicates the uri object to normalize. - * @returns { Promise } Returns the promise of normalized uri object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - normalizeUri(uri: string): Promise; - - /** - * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. - * @param { string } uri - Indicates the uri object to normalize. - * @param { AsyncCallback } callback - The callback is used to return the denormalized uri object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - denormalizeUri(uri: string, callback: AsyncCallback): void; - - /** - * Converts the given normalized uri generated by normalizeUri(uri) into a denormalized one. - * @param { string } uri - Indicates the uri object to normalize. - * @returns { Promise } Returns the denormalized uri object. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - denormalizeUri(uri: string): Promise; - - /** - * Notifies the registered observers of a change to the data resource specified by uri. - * @param { string } uri - Indicates the path of the data to operate. - * @param { AsyncCallback } callback - The callback of notifyChange. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - notifyChange(uri: string, callback: AsyncCallback): void; - - /** - * Notifies the registered observers of a change to the data resource specified by uri. - * @param { string } uri - Indicates the path of the data to operate. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - notifyChange(uri: string): Promise; - - /** - * Inserts a single data record into the database. - * @param { string } uri - Indicates the path of the data to insert. - * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, - * a blank row will be inserted. - * @param { AsyncCallback } callback - The callback is used to return the index of the inserted data record. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; - - /** - * Inserts a single data record into the database. - * @param { string } uri - Indicates the path of the data to insert. - * @param { rdb.ValuesBucket } valuesBucket - Indicates the data record to insert. If this parameter is null, - * a blank row will be inserted. - * @returns { Promise } Returns the index of the inserted data record. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise; - - /** - * Inserts multiple data records into the database. - * @param { string } uri - Indicates the path of the data to batchInsert. - * @param { Array } valuesBuckets - Indicates the data records to insert. - * @param { AsyncCallback } callback - The callback is used to return the number of data records inserted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback): void; - - /** - * Inserts multiple data records into the database. - * @param { string } uri - Indicates the path of the data to batchInsert. - * @param { Array } valuesBuckets - Indicates the data records to insert. - * @returns { Promise } Returns the number of data records inserted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - batchInsert(uri: string, valuesBuckets: Array): Promise; - - /** - * Deletes one or more data records from the database. - * @param { string } uri - Indicates the path of the data to delete. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the - * processing logic when this parameter is null. - * @param { AsyncCallback } callback - The callback is used to return the number of data records deleted. - * @returns { Promise } Returns the number of data records deleted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - - /** - * Deletes one or more data records from the database. - * @param { string } uri - Indicates the path of the data to delete. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define the - * processing logic when this parameter is null. - * @returns { Promise } Returns the number of data records deleted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - delete(uri: string, predicates?: dataAbility.DataAbilityPredicates): Promise; - - /** - * Deletes one or more data records from the database. - * @param { string } uri - Indicates the path of the data to delete. - * @param { AsyncCallback } callback - The callback is used to return the number of data records deleted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - delete(uri: string, callback: AsyncCallback): void; - - /** - * Updates data records in the database. - * @param { string } uri - Indicates the path of data to update. - * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define - * the processing logic when this parameter is null. - * @param { AsyncCallback } callback - The callback is used to return the number of data records updated. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - - /** - * Updates data records in the database. - * @param { string } uri - Indicates the path of data to update. - * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define - * the processing logic when this parameter is null. - * @returns { Promise } Returns the number of data records updated. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - update(uri: string, valuesBucket: rdb.ValuesBucket, predicates?: dataAbility.DataAbilityPredicates): Promise; - - /** - * Updates data records in the database. - * @param { string } uri - Indicates the path of data to update. - * @param { rdb.ValuesBucket } valuesBucket - Indicates the data to update. - * @param { AsyncCallback } callback - The callback is used to return the number of data records updated. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - update(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback): void; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define - * the processing logic when this parameter is null. - * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - query(uri: string, callback: AsyncCallback): void; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. - * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - query(uri: string, columns: Array, callback: AsyncCallback): void; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define - * the processing logic when this parameter is null. - * @param { AsyncCallback } callback - The callback is used to return the query result {@link ResultSet}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - query(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { Array } columns - Indicates the columns to query. If this parameter is null, all columns are queried. - * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. You should define - * the processing logic when this parameter is null. - * @returns { Promise } Returns the query result {@link ResultSet}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - query(uri: string, columns?: Array, predicates?: dataAbility.DataAbilityPredicates): Promise; - - /** - * Calls the extended API of the DataAbility. This method uses a promise to return the result. - * @param { string } uri - URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx" - * @param { string } method - Indicates the method to call. - * @param { string } arg - Indicates the parameter of the String type. - * @param { PacMap } extras - Indicates the parameter of the PacMap type. - * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, - * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. - * If the PacMap object is to be transferred to a non-OHOS process, - * values of primitive types are supported, but not custom Sequenceable objects. - * @param { AsyncCallback } callback - The callback is used to return the query result {@link PacMap}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; - - /** - * Calls the extended API of the DataAbility. This method uses a promise to return the result. - * @param { string } uri - URI of the Data ability. Example: "dataability:///com.example.xxx.xxxx" - * @param { string } method - Indicates the method to call. - * @param { string } arg - Indicates the parameter of the String type. - * @param { PacMap } extras - Indicates the parameter of the PacMap type. - * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, - * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. - * If the PacMap object is to be transferred to a non-OHOS process, - * values of primitive types are supported, but not custom Sequenceable objects. - * @returns { Promise } Returns the query result {@link PacMap}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - call(uri: string, method: string, arg: string, extras: PacMap): Promise; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { Array } operations - Indicates the data operation list, which can contain - * multiple operations on the database. - * @param { AsyncCallback> } callback - The callback is used to return the result of each - * operation, in array {@link DataAbilityResult}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - executeBatch(uri: string, operations: Array, callback: AsyncCallback>): void; - - /** - * Queries data in the database. - * @param { string } uri - Indicates the path of data to query. - * @param { Array } operations - Indicates the data operation list, which can contain - * multiple operations on the database. - * @returns { Promise> } Returns the result of each operation, in array {@link DataAbilityResult}. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - executeBatch(uri: string, operations: Array): Promise>; -} - -/** - * Defines a PacMap object for storing a series of values. - * @typedef PacMap - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ -export interface PacMap { - /** - * Indicates the parameter of the PacMap type. - * If a custom Sequenceable object is put in the PacMap object and will be transferred across processes, - * you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object. - * If the PacMap object is to be transferred to a non-OHOS process, - * values of primitive types are supported, but not custom Sequenceable objects. - * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @famodelonly - * @since 9 - */ - [key: string]: number | string | boolean | Array | null; -} diff --git a/api/app/context.d.ts b/api/app/context.d.ts index 570a4802e0..e24a3dd24b 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -34,8 +34,6 @@ import bundle from '../@ohos.bundle'; * @import import abilityManager from 'app/context' * @permission N/A * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.featureAbility.context */ export interface Context extends BaseContext { @@ -277,8 +275,6 @@ export interface Context extends BaseContext { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.featureAbility.context */ interface PermissionRequestResult { /** @@ -312,8 +308,6 @@ interface PermissionRequestResult { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @FAModelOnly - * @deprecated since 9 - * @useinstead @ohos.app.featureAbility.context */ interface PermissionOptions { /** diff --git a/api/app/featureAbilityContext.d.ts b/api/app/featureAbilityContext.d.ts deleted file mode 100644 index 8d0dca6422..0000000000 --- a/api/app/featureAbilityContext.d.ts +++ /dev/null @@ -1,593 +0,0 @@ -/* -* 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 { ApplicationInfo } from '../bundle/applicationInfo'; -import { ProcessInfo } from './processInfo'; -import { ElementName } from '../bundle/elementName'; -import BaseContext from '../application/BaseContext'; -import { HapModuleInfo } from '../bundle/hapModuleInfo'; -import { AppVersionInfo } from './appVersionInfo'; -import { AbilityInfo } from '../bundle/abilityInfo'; -import bundle from '../@ohos.bundle'; - -/** - * The context of an ability or an application. It allows access to - * application-specific resources, request and verification permissions. - * Can only be obtained through the ability. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ -export interface Context extends BaseContext { - /** - * Get the local root dir of an app. If it is the first call, the dir - * will be created. - * @note If in the context of the ability, return the root dir of - * the ability; if in the context of the application, return the - * root dir of the application. - * @returns { Promise } Returns the root dir. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getOrCreateLocalDir(): Promise; - - /** - * Get the local root dir of an app. If it is the first call, the dir - * will be created. - * @note If in the context of the ability, return the root dir of - * the ability; if in the context of the application, return the - * root dir of the application. - * @param { AsyncCallback } callback - The callback is used to return the root dir. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getOrCreateLocalDir(callback: AsyncCallback): void; - - /** - * Verify whether the specified permission is allowed for a particular - * pid and uid running in the system. - * @note Pid and uid are optional. If you do not pass in pid and uid, it will check your own permission. - * @param { string } permission - The name of the specified permission. - * @param { PermissionOptions } options - Indicates the permission options. - * @returns { Promise } Returns {@code 0} if the PID and UID have the permission. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - verifyPermission(permission: string, options?: PermissionOptions): Promise; - - /** - * Verify whether the specified permission is allowed for a particular - * pid and uid running in the system. - * @note Pid and uid are optional. If you do not pass in pid and uid, it will check your own permission. - * @param { string } permission - The name of the specified permission. - * @param { PermissionOptions } options - Indicates the permission options. - * @param { AsyncCallback } callback - Returns {@code 0} if the PID and UID have the permission. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback): void; - - /** - * Verify whether the specified permission is allowed for a particular - * pid and uid running in the system. - * @note Pid and uid are optional. If you do not pass in pid and uid, it will check your own permission. - * @param { string } permission - The name of the specified permission. - * @param { AsyncCallback } callback - Returns {@code 0} if the PID and UID have the permission. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - verifyPermission(permission: string, callback: AsyncCallback): void; - - /** - * Requests certain permissions from the system. - * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter cannot be null. - * @param { number } requestCode - Indicates the request code to be passed to the PermissionRequestResult. - * @param { AsyncCallback } resultCallback - The callback is used to return the PermissionRequestResult. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - requestPermissionsFromUser(permissions: Array, requestCode: number, resultCallback: AsyncCallback): void; - - /** - * Requests certain permissions from the system. - * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter cannot be null. - * @param { number } requestCode - Indicates the request code to be passed to the PermissionRequestResult. - * @returns { Promise } Returns the PermissionRequestResult. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - requestPermissionsFromUser(permissions: Array, requestCode: number): Promise; - - /** - * Obtains information about the current application. - * @param { AsyncCallback } callback - The callback is used to return the ApplicationInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getApplicationInfo(callback: AsyncCallback): void - - /** - * Obtains information about the current application. - * @returns { Promise } Returns the ApplicationInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getApplicationInfo(): Promise; - - /** - * Obtains the bundle name of the current ability. - * @param { AsyncCallback } callback - The callback is used to return the bundle name. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getBundleName(callback: AsyncCallback): void - - /** - * Obtains the bundle name of the current ability. - * @returns { Promise } Returns the bundle name. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getBundleName(): Promise; - - /** - * Obtains the current display orientation of this ability. - * @param { AsyncCallback } callback - The callback is used to return the display orientation. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getDisplayOrientation(callback: AsyncCallback): void - - /** - * Obtains the current display orientation of this ability. - * @returns { Promise } Returns the display orientation. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getDisplayOrientation(): Promise; - - /** - * Sets the display orientation of the current ability. - * @param { bundle.DisplayOrientation } orientation - Indicates the new orientation for the current ability. - * @param { AsyncCallback } callback - The callback of setDisplayOrientation. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback): void - - /** - * Sets the display orientation of the current ability. - * @param { bundle.DisplayOrientation } orientation - Indicates the new orientation for the current ability. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise; - - /** - * Sets whether to show this ability on top of the lock screen whenever the lock screen is displayed, - * keeping the ability in the ACTIVE state. - * @param { boolean } show - Specifies whether to show this ability on top of the lock screen. The value true - * means to show it on the lock screen, and the value false means not. - * @param { AsyncCallback } callback - The callback of setShowOnLockScreen. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - setShowOnLockScreen(show: boolean, callback: AsyncCallback): void - - /** - * Sets whether to show this ability on top of the lock screen whenever the lock screen is displayed, - * keeping the ability in the ACTIVE state. - * @param { boolean } show - Specifies whether to show this ability on top of the lock screen. The value true - * means to show it on the lock screen, and the value false means not. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - setShowOnLockScreen(show: boolean): Promise; - - /** - * Sets whether to wake up the screen when this ability is restored. - * @param { boolean } wakeUp - Specifies whether to wake up the screen. The value true means to wake it up, - * and the value false means not. - * @param { AsyncCallback } callback - The callback of setWakeUpScreen. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback): void - - /** - * Sets whether to wake up the screen when this ability is restored. - * @param { boolean } wakeUp - Specifies whether to wake up the screen. The value true means to wake it up, - * and the value false means not. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - setWakeUpScreen(wakeUp: boolean): Promise; - - /** - * Obtains information about the current process, including the process ID and name. - * @param { AsyncCallback } callback - The callback is used to return the ProcessInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getProcessInfo(callback: AsyncCallback): void - - /** - * Obtains information about the current process, including the process ID and name. - * @returns { Promise } Returns the ProcessInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getProcessInfo(): Promise; - - /** - * Obtains the ohos.bundle.ElementName object of the current ability. This method is available only to Page abilities. - * @param { AsyncCallback } callback - The callback is used to return the ElementName. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getElementName(callback: AsyncCallback): void - - /** - * Obtains the ohos.bundle.ElementName object of the current ability. This method is available only to Page abilities. - * @returns { Promise } Returns the ElementName. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getElementName(): Promise; - - /** - * Obtains the name of the current process. - * @param { AsyncCallback } callback - The callback is used to return the process name. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getProcessName(callback: AsyncCallback): void - - /** - * Obtains the name of the current process. - * @returns { Promise } Returns the process name. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getProcessName(): Promise; - - /** - * Obtains the bundle name of the ability that called the current ability. - * @param { AsyncCallback } callback - The callback is used to return the calling bundle name. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getCallingBundle(callback: AsyncCallback): void - - /** - * Obtains the bundle name of the ability that called the current ability. - * @returns { Promise } Returns the calling bundle name. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getCallingBundle(): Promise; - - /** - * Obtains the file directory of this application on the internal storage. - * @param { AsyncCallback } callback - The callback is used to return the file directory. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getFilesDir(callback: AsyncCallback): void; - - /** - * Obtains the file directory of this application on the internal storage. - * @returns { Promise } Returns the file directory. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getFilesDir(): Promise; - - /** - * Obtains the cache directory of this application on the internal storage. - * @param { AsyncCallback } callback - The callback is used to return the cache directory. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getCacheDir(callback: AsyncCallback): void; - - /** - * Obtains the cache directory of this application on the internal storage. - * @returns { Promise } Returns the cache directory. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getCacheDir(): Promise; - - /** - * Obtains the distributed file path for storing ability or application data files. - * If the distributed file path does not exist, the system will create a path and return the created path. - * @returns { Promise } Returns the distributed file path. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getOrCreateDistributedDir(): Promise; - - /** - * Obtains the distributed file path for storing ability or application data files. - * If the distributed file path does not exist, the system will create a path and return the created path. - * @param { AsyncCallback } callback - The callback is used to return the distributed file path. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getOrCreateDistributedDir(callback: AsyncCallback): void; - - /** - * Obtains the application type. - * @param { AsyncCallback } callback - The callback is used to return the application type. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getAppType(callback: AsyncCallback): void - - /** - * Obtains the application type. - * @returns { Promise } Returns the application type. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getAppType(): Promise; - - /** - * Obtains the ModuleInfo object for this application. - * @param { AsyncCallback } callback - The callback is used to return the HapModuleInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getHapModuleInfo(callback: AsyncCallback): void - - /** - * Obtains the ModuleInfo object for this application. - * @returns { Promise } Returns the HapModuleInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getHapModuleInfo(): Promise; - - /** - * Obtains the application version information. - * @param { AsyncCallback } callback - The callback is used to return the application version info. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getAppVersionInfo(callback: AsyncCallback): void - - /** - * Obtains the application version information. - * @returns { Promise } Returns the application version info. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getAppVersionInfo(): Promise; - - /** - * Obtains the context of this application. - * @returns { Context } Returns the context of this application. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getApplicationContext(): Context; - - /** - * Checks the detailed information of this ability. - * @param { AsyncCallback } callback - The callback is used to return the AbilityInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getAbilityInfo(callback: AsyncCallback): void - - /** - * Checks the detailed information of this ability. - * @returns { Promise } Returns the AbilityInfo. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - getAbilityInfo(): Promise; - - /** - * Checks whether the configuration of this ability is changing. - * @param { AsyncCallback } callback - Returns true if the configuration of this ability is changing and false otherwise. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - isUpdatingConfigurations(callback: AsyncCallback): void; - - /** - * Checks whether the configuration of this ability is changing. - * @returns { Promise } Returns true if the configuration of this ability is changing and false otherwise. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - isUpdatingConfigurations(): Promise; - - /** - * Informs the system of the time required for drawing this Page ability. - * @param { AsyncCallback } callback - The callback of printDrawnCompleted. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - printDrawnCompleted(callback: AsyncCallback): void; - - /** - * Informs the system of the time required for drawing this Page ability. - * @returns { Promise } The promise returned by the function. - * @throws { BusinessError } 401 - If the input parameter is not valid parameter. - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - printDrawnCompleted(): Promise; -} - -/** - * the result of requestPermissionsFromUser with asynchronous callback - * @typedef PermissionRequestResult - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ -interface PermissionRequestResult { - /** - * The request code passed in by the user - * @type { number } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - requestCode: number; - - /** - * The permissions passed in by the user - * @type { Array } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - permissions: Array; - - /** - * The results for the corresponding request permissions - * @type { Array } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - authResults: Array; -} - -/** - * @typedef PermissionOptions - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ -interface PermissionOptions { - /** - * The process id - * @type { number } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - pid?: number; - - /** - * The user id - * @type { number } - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @famodelonly - * @since 9 - */ - uid?: number; -} -- Gitee From 0ad65fb79f76fa2ef2401754bb50033cef991626 Mon Sep 17 00:00:00 2001 From: yangzk Date: Mon, 17 Oct 2022 19:55:35 +0800 Subject: [PATCH 28/34] IssueNo: #I5RT32 Description: fix import Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.ability.ability.d.ts | 5 ++ api/@ohos.app.ability.Ability.d.ts | 36 +++++++----- api/@ohos.app.ability.AbilityStage.d.ts | 4 +- api/@ohos.app.ability.ExtensionAbility.d.ts | 2 +- ...s.app.ability.ServiceExtensionAbility.d.ts | 4 +- ....app.ability.abilityDelegatorRegistry.d.ts | 2 +- api/@ohos.app.ability.abilityManager.d.ts | 2 +- api/@ohos.app.form.FormExtensionAbility.d.ts | 6 +- api/application/AbilityContext.d.ts | 48 ++++++++++++++- api/application/AbilityRunningInfo.d.ts | 2 +- api/application/ApplicationContext.d.ts | 58 ++++++++++++++++++- api/application/ServiceExtensionContext.d.ts | 57 +++++++++++++++++- api/application/abilityDelegator.d.ts | 2 +- api/application/abilityMonitor.d.ts | 4 +- 14 files changed, 201 insertions(+), 31 deletions(-) diff --git a/api/@ohos.ability.ability.d.ts b/api/@ohos.ability.ability.d.ts index d710852e0a..dde2908026 100755 --- a/api/@ohos.ability.ability.d.ts +++ b/api/@ohos.ability.ability.d.ts @@ -50,6 +50,7 @@ declare namespace ability { /** * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ export type DataAbilityOperation = _DataAbilityOperation @@ -57,24 +58,28 @@ declare namespace ability { * @name DataAbilityResult * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ export type DataAbilityResult = _DataAbilityResult /** * @since 9 * @syscap SystemCapability.Ability.AbilityBase + * @FAModelOnly */ export type AbilityResult = _AbilityResult /** * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly */ export type ConnectOptions = _ConnectOptions /** * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ export type StartAbilityParameter = _StartAbilityParameter } diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts index ee19b722b6..7ed043a155 100755 --- a/api/@ohos.app.ability.Ability.d.ts +++ b/api/@ohos.app.ability.Ability.d.ts @@ -15,30 +15,30 @@ import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; import AbilityContext from "./application/AbilityContext"; +import rpc from './@ohos.rpc'; import Want from './@ohos.application.Want'; import window from './@ohos.window'; import { Configuration } from './@ohos.application.Configuration'; -import rpc from './@ohos.rpc'; /** * The prototype of the listener function interface registered by the Caller. - * @typedef OnReleaseCallBack + * @typedef OnReleaseCallback * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ -export interface OnReleaseCallBack { +export interface OnReleaseCallback { (msg: string): void; } /** * The prototype of the message listener function interface registered by the Callee. - * @typedef CalleeCallBack + * @typedef CalleeCallback * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ -export interface CalleeCallBack { +export interface CalleeCallback { (indata: rpc.MessageParcel): rpc.Sequenceable; } @@ -82,27 +82,37 @@ export interface Caller { */ release(): void; + /** + * Register death listener notification callback. + * @param { OnReleaseCallback } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + onRelease(callback: OnReleaseCallback): void; + /** * Register death listener notification callback. * @param { string } type - release. - * @param { OnReleaseCallBack } callback - Register a callback function for listening for notifications. + * @param { OnReleaseCallback } callback - Register a callback function for listening for notifications. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ - on(type: "release", callback: OnReleaseCallBack): void; + on(type: "release", callback: OnReleaseCallback): void; /** * Unregister death listener notification callback. * @param { string } type - release. - * @param { OnReleaseCallBack } callback - Unregister a callback function for listening for notifications. + * @param { OnReleaseCallback } callback - Unregister a callback function for listening for notifications. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ - off(type: "release", callback: OnReleaseCallBack): void; + off(type: "release", callback: OnReleaseCallback): void; /** * Unregister all death listener notification callback. @@ -126,13 +136,13 @@ export interface Callee { /** * Register data listener callback. * @param { string } method - A string registered to listen for notification events. - * @param { CalleeCallBack } callback - Register a callback function that listens for notification events. + * @param { CalleeCallback } callback - Register a callback function that listens for notification events. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ - on(method: string, callback: CalleeCallBack): void; + on(method: string, callback: CalleeCallback): void; /** * Unregister data listener callback. @@ -271,12 +281,12 @@ export default class Ability { /** * Called when the system configuration is updated. - * @param { Configuration } config - Indicates the updated configuration. + * @param { Configuration } newConfig - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @stagemodelonly * @since 9 */ - onConfigurationUpdated(config: Configuration): void; + onConfigurationUpdate(newConfig: Configuration): void; /** * Called when dump client information is required. diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts index cc9634994f..3078c51ca6 100644 --- a/api/@ohos.app.ability.AbilityStage.d.ts +++ b/api/@ohos.app.ability.AbilityStage.d.ts @@ -56,12 +56,12 @@ export default class AbilityStage { /** * Called when the system configuration is updated. - * @param { Configuration } config - Indicates the updated configuration. + * @param { Configuration } newConfig - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @stagemodelonly * @since 9 */ - onConfigurationUpdated(config: Configuration): void; + onConfigurationUpdate(newConfig: Configuration): void; /** * Called when the system has determined to trim the memory, for example, when the ability is running in the diff --git a/api/@ohos.app.ability.ExtensionAbility.d.ts b/api/@ohos.app.ability.ExtensionAbility.d.ts index 5e7d6caf0b..e63914c35b 100644 --- a/api/@ohos.app.ability.ExtensionAbility.d.ts +++ b/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -30,7 +30,7 @@ export default class ExtensionAbility { * @stagemodelonly * @since 9 */ - onConfigurationUpdated(newConfig: Configuration): void; + onConfigurationUpdate(newConfig: Configuration): void; /** * Called when the system has determined to trim the memory, for example, when the ability is running in the diff --git a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts index 3675c902d0..575bca4ddb 100644 --- a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts +++ b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts @@ -100,13 +100,13 @@ export default class ServiceExtensionAbility { /** * Called when the system configuration is updated. - * @param { Configuration } config - Indicates the updated configuration. + * @param { Configuration } newConfig - Indicates the updated configuration. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi * @stagemodelonly * @since 9 */ - onConfigurationUpdated(config: Configuration): void; + onConfigurationUpdate(newConfig: Configuration): void; /** * Called when dump client information is required. diff --git a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts index 5d4d9147aa..a3177d986c 100644 --- a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts +++ b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts @@ -35,7 +35,7 @@ declare namespace abilityDelegatorRegistry { function getAbilityDelegator(): AbilityDelegator; /** - * Get unit test parameters stored in the AbilityDelegatorArgs object. + * Get unit test arguments stored in the AbilityDelegatorArgs object. * @returns { AbilityDelegator } Return the previously registered AbilityDelegatorArgs object. * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts index a904da0cb8..60c76db94d 100644 --- a/api/@ohos.app.ability.abilityManager.d.ts +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -78,7 +78,7 @@ declare namespace abilityManager { function getAbilityRunningInfos(): Promise>; /** - * Get information about running abilities + * Get information about the running ability * @permission ohos.permission.GET_RUNNING_INFO * @param { AsyncCallback> } callback - The callback is used to return the array of AbilityRunningInfo. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts index a3d519049a..b32f18cb29 100644 --- a/api/@ohos.app.form.FormExtensionAbility.d.ts +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -104,12 +104,12 @@ export default class FormExtensionAbility { /** * Called when the system configuration is updated. - * @param { Configuration } config - Indicates the system configuration, such as language and color mode. + * @param { Configuration } newConfig - Indicates the system configuration, such as language and color mode. * @syscap SystemCapability.Ability.Form * @stagemodelonly * @since 9 */ - onConfigurationUpdated(config: Configuration): void; + onConfigurationUpdate(newConfig: Configuration): void; /** * Called to return a {@link FormState} object. @@ -134,5 +134,5 @@ export default class FormExtensionAbility { * @stagemodelonly * @since 9 */ - onFormToBeShared?(formId: string): { [key: string]: any }; + onShareForm?(formId: string): { [key: string]: any }; } diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 5174f3e58d..ffa23b2ef0 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -22,7 +22,7 @@ import { ConnectOptions } from "../ability/connectOptions"; import { HapModuleInfo } from "../bundle/hapModuleInfo"; import Context from "./Context"; import Want from "../@ohos.application.Want"; -import StartOptions from "../@ohos.application.StartOptions"; +import StartOptions from "../@ohos.app.ability.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; import { Configuration } from '../@ohos.application.Configuration'; import { Caller } from '../@ohos.app.ability.Ability'; @@ -381,6 +381,52 @@ export default class AbilityContext extends Context { */ terminateSelfWithResult(parameter: AbilityResult): Promise; + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want The element name of the service ability + * @param options The remote object instance + * @systemapi Hide this for inner system use. + * @return Returns the number code of the ability connected + * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbility + */ + connectAbility(want: Want, options: ConnectOptions): number; + + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want The element name of the service ability + * @param accountId The account to connect + * @param options The remote object instance + * @systemapi hide for inner use. + * @return Returns the number code of the ability connected + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbilityWithAccount + */ + connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * The callback interface was connect successfully. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param connection The number code of the ability connected + * @systemapi Hide this for inner system use. + * @StageModelOnly + * @deprecated since 9 + * @useinstead disconnectServiceExtensionAbility + */ + disconnectAbility(connection: number, callback:AsyncCallback): void; + disconnectAbility(connection: number): Promise; + /** * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. * @param { Want } want - The element name of the service ability diff --git a/api/application/AbilityRunningInfo.d.ts b/api/application/AbilityRunningInfo.d.ts index 864465c87b..63b82692d4 100644 --- a/api/application/AbilityRunningInfo.d.ts +++ b/api/application/AbilityRunningInfo.d.ts @@ -14,7 +14,7 @@ */ import { ElementName } from '../bundle/elementName'; -import abilityManager from '../@ohos.application.abilityManager'; +import abilityManager from '../@ohos.app.ability.abilityManager'; /** * The class of an ability running information. diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 54ef9d985f..8fc1e3b46f 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -15,8 +15,8 @@ import { AsyncCallback } from "../basic"; import Context from "./Context"; -import AbilityLifecycleCallback from "../@ohos.application.AbilityLifecycleCallback"; -import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; +import AbilityLifecycleCallback from "../@ohos.app.ability.AbilityLifecycleCallback"; +import EnvironmentCallback from "../@ohos.app.ability.EnvironmentCallback"; import { ProcessRunningInformation } from "./ProcessRunningInformation"; /** @@ -26,6 +26,60 @@ import { ProcessRunningInformation } from "./ProcessRunningInformation"; * @since 9 */ export default class ApplicationContext extends Context { + /** + * Register ability lifecycle callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param callback The ability lifecycle callback. + * @return Returns the number code of the callback. + * @StageModelOnly + * @deprecated since 9 + * @useinstead on + */ + registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; + + /** + * Unregister ability lifecycle callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param callbackId Indicates the number code of the callback. + * @return - + * @StageModelOnly + * @deprecated since 9 + * @useinstead off + */ + 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 + * @deprecated since 9 + * @useinstead on + */ + 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 + * @deprecated since 9 + * @useinstead off + */ + unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; + unregisterEnvironmentCallback(callbackId: number): Promise; + /** * Register ability lifecycle callback. * @param { string } type - abilityLifecycle. diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index 414f3d38f1..e6326f414e 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -18,7 +18,7 @@ import { ConnectOptions } from "../ability/connectOptions"; import { Caller } from '../@ohos.app.ability.Ability'; import ExtensionContext from "./ExtensionContext"; import Want from "../@ohos.application.Want"; -import StartOptions from "../@ohos.application.StartOptions"; +import StartOptions from "../@ohos.app.ability.StartOptions"; /** * The context of service extension. It allows access to @@ -234,6 +234,61 @@ export default class ServiceExtensionContext extends ExtensionContext { */ terminateSelf(): Promise; + /** + * Connects an ability to a Service extension. + * + *

This method can be called by an ability or service extension, but the destination of the connection must be a + * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target + * service extension when the Service extension is connected.

+ * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the service extension to connect. + * @param options Indicates the callback of connection. + * @systemapi hide for inner use. + * @return connection id, int value. + * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbility + */ + connectAbility(want: Want, options: ConnectOptions): number; + + /** + * Connects an ability to a Service extension with account. + * + *

This method can be called by an ability or service extension, but the destination of the connection must be a + * service extension. You must implement the {@link ConnectOptions} interface to obtain the proxy of the target + * service extension when the Service extension is connected.

+ * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param want Indicates the service extension to connect. + * @param accountId Indicates the account to connect. + * @param options Indicates the callback of connection. + * @systemapi hide for inner use. + * @return connection id, int value. + * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbilityWithAccount + */ + connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * Disconnects an ability to a service extension, in contrast to + * {@link connectAbility}. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @param connection the connection id returned from connectAbility api. + * @systemapi hide for inner use. + * @return - + * @StageModelOnly + * @deprecated since 9 + * @useinstead disconnectServiceExtensionAbility + */ + disconnectAbility(connection: number, callback:AsyncCallback): void; + disconnectAbility(connection: number): Promise; + /** * Connects an ability to a Service extension. *

This method can be called by an ability or service extension, but the destination of the connection must be a diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index 520bd8ce43..72ac4c9d98 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -15,7 +15,7 @@ import { AsyncCallback } from '../basic'; import Ability from '../@ohos.app.ability.Ability'; -import AbilityStage from '../@ohos.application.AbilityStage'; +import AbilityStage from '../@ohos.app.ability.AbilityStage'; import { AbilityMonitor } from './abilityMonitor'; import { AbilityStageMonitor } from './abilityStageMonitor'; import Context from './Context'; diff --git a/api/application/abilityMonitor.d.ts b/api/application/abilityMonitor.d.ts index 8dec39ad4f..dd0a1989f1 100644 --- a/api/application/abilityMonitor.d.ts +++ b/api/application/abilityMonitor.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import Ability from '../@ohos.application.Ability'; +import Ability from '../@ohos.app.ability.Ability'; /** * Provide methods for matching monitored Ability objects that meet specified conditions. @@ -39,7 +39,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - moduleName: string; + moduleName?: string; /** * Called back when the ability is started for initialization. -- Gitee From c9d41c2b805465cdb6fd20396a08d5f9a03c8104 Mon Sep 17 00:00:00 2001 From: yangzk Date: Tue, 18 Oct 2022 17:28:50 +0800 Subject: [PATCH 29/34] IssueNo: #I5RT32 Description: add wantConstant Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.wantConstant.d.ts | 439 ++++++++++++++++++++++++ 1 file changed, 439 insertions(+) create mode 100644 api/@ohos.app.ability.wantConstant.d.ts diff --git a/api/@ohos.app.ability.wantConstant.d.ts b/api/@ohos.app.ability.wantConstant.d.ts new file mode 100644 index 0000000000..05e563cd9f --- /dev/null +++ b/api/@ohos.app.ability.wantConstant.d.ts @@ -0,0 +1,439 @@ +/* + * 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 constant for action and entity in the want + * @namespace wantConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +declare namespace wantConstant { + /** + * the constant for action of the want + * @enum { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum Action { + /** + * Indicates the action of backing home. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_HOME = "ohos.want.action.home", + + /** + * Indicates the action of starting a Page ability that displays a keypad. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_DIAL = "ohos.want.action.dial", + + /** + * Indicates the action of starting a Page ability for search. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEARCH = "ohos.want.action.search", + + /** + * Indicates the action of starting a Page ability that provides wireless network settings, for example, + * Wi-Fi options. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_WIRELESS_SETTINGS = "ohos.settings.wireless", + + /** + * Indicates the action of starting a Page ability that manages installed applications. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_MANAGE_APPLICATIONS_SETTINGS = "ohos.settings.manage.applications", + + /** + * Indicates the action of starting a Page ability that displays details of a specified application. + * + *

You must specify the application bundle name in the {@code package} attribute of the {@code Intent} + * containing this action. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_APPLICATION_DETAILS_SETTINGS = "ohos.settings.application.details", + + /** + * Indicates the action of starting a Page ability for setting an alarm clock. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SET_ALARM = "ohos.want.action.setAlarm", + + /** + * Indicates the action of starting a Page ability that displays all alarm + * clocks. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SHOW_ALARMS = "ohos.want.action.showAlarms", + + /** + * Indicates the action of starting a Page ability for snoozing an alarm clock. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SNOOZE_ALARM = "ohos.want.action.snoozeAlarm", + + /** + * Indicates the action of starting a Page ability for deleting an alarm clock. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_DISMISS_ALARM = "ohos.want.action.dismissAlarm", + + /** + * Indicates the action of starting a Page ability for dismissing a timer. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_DISMISS_TIMER = "ohos.want.action.dismissTimer", + + /** + * Indicates the action of starting a Page ability for sending a sms. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEND_SMS = "ohos.want.action.sendSms", + + /** + * Indicates the action of starting a Page ability for opening contacts or pictures. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_CHOOSE = "ohos.want.action.choose", + + /** + * Indicates the action of starting a Page ability for take a picture. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_IMAGE_CAPTURE = "ohos.want.action.imageCapture", + + /** + * Indicates the action of starting a Page ability for Take a video. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_VIDEO_CAPTURE = "ohos.want.action.videoCapture", + + /** + * Indicates the action of showing the application selection dialog box. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SELECT = "ohos.want.action.select", + + /** + * Indicates the action of sending a single data record. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEND_DATA = "ohos.want.action.sendData", + + /** + * Indicates the action of sending multiple data records. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEND_MULTIPLE_DATA = "ohos.want.action.sendMultipleData", + + /** + * Indicates the action of requesting the media scanner to scan files and adding the files to the media library. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SCAN_MEDIA_FILE = "ohos.want.action.scanMediaFile", + + /** + * Indicates the action of viewing data. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_VIEW_DATA = "ohos.want.action.viewData", + + /** + * Indicates the action of editing data. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_EDIT_DATA = "ohos.want.action.editData", + + /** + * Indicates the choices you will show with {@link #ACTION_PICKER}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + INTENT_PARAMS_INTENT = "ability.want.params.INTENT", + + /** + * Indicates the CharSequence dialog title when used with a {@link #ACTION_PICKER}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + INTENT_PARAMS_TITLE = "ability.want.params.TITLE", + + /** + * Indicates the action of select file. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_FILE_SELECT = "ohos.action.fileSelect", + + /** + * Indicates the URI holding a stream of data associated with the Intent when used with a {@link #ACTION_SEND_DATA}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + PARAMS_STREAM = "ability.params.stream", + + /** + * Indicates the action of providing auth service. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth", + + /** + * Indicates the action of an application downloaded from the application market. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + ACTION_MARKET_DOWNLOAD = "ohos.want.action.marketDownload", + + /** + * Indicates the action of an application crowdtested from the application market. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + ACTION_MARKET_CROWDTEST = "ohos.want.action.marketCrowdTest", + + /** + * Indicates the param of sandbox flag. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox", + + /** + * Indicates the param of dlp bundle name. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName", + + /** + * Indicates the param of dlp module name. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName", + + /** + * Indicates the param of dlp ability name. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName", + + /** + * Indicates the param of dlp bundle index. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_INDEX = "ohos.dlp.params.index" + } + + /** + * the constant for Entity of the want + * @enum { string } + * @name Entity + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum Entity { + /** + * Indicates the default entity, which is used if the entity is not specified. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_DEFAULT = "entity.system.default", + + /** + * Indicates the home screen entity. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_HOME = "entity.system.home", + + /** + * Indicates the voice interaction entity. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_VOICE = "entity.system.voice", + + /** + * Indicates the browser category. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_BROWSABLE = "entity.system.browsable", + + /** + * Indicates the video category. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_VIDEO = "entity.system.video" + } + + export enum Flags { + /** + * Indicates the grant to perform read operations on the URI. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_AUTH_READ_URI_PERMISSION = 0x00000001, + + /** + * Indicates the grant to perform write operations on the URI. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002, + + /** + * Returns the result to the source ability. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_FORWARD_RESULT = 0x00000004, + + /** + * Determines whether an ability on the local device can be migrated to a remote device. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_CONTINUATION = 0x00000008, + + /** + * Specifies whether a component does not belong to OHOS. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_NOT_OHOS_COMPONENT = 0x00000010, + + /** + * Specifies whether an ability is started. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_FORM_ENABLED = 0x00000020, + + /** + * Indicates the grant for possible persisting on the URI. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040, + + /** + * Returns the result to the source ability slice. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + FLAG_AUTH_PREFIX_URI_PERMISSION = 0x00000080, + + /** + * Supports multi-device startup in the distributed scheduling system. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITYSLICE_MULTI_DEVICE = 0x00000100, + + /** + * Indicates that an ability using the Service template is started regardless of whether the host application has + * been started. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_START_FOREGROUND_ABILITY = 0x00000200, + + /** + * Indicates the continuation is reversible. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + FLAG_ABILITY_CONTINUATION_REVERSIBLE = 0x00000400, + + /** + * Install the specified ability if it's not installed. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_INSTALL_ON_DEMAND = 0x00000800, + + /** + * Install the specifiedi ability with background mode if it's not installed. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000, + + /** + * Indicates the operation of clearing other missions. This flag can be set for the {@code Intent} passed to + * {@link ohos.app.Context#startAbility} and must be used together with {@link FLAG_ABILITY_NEW_MISSION}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_CLEAR_MISSION = 0x00008000, + + /** + * Indicates the operation of creating a task on the historical mission stack. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_NEW_MISSION = 0x10000000, + + /** + * Indicates that the existing instance of the ability to start will be reused if it is already at the top of + * the mission stack. Otherwise, a new ability instance will be created. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_MISSION_TOP = 0x20000000 + } +} + +export default wantConstant; -- Gitee From 77fbeaa567a98bf4fe530c0f642ed157dd267d10 Mon Sep 17 00:00:00 2001 From: yangzk Date: Tue, 18 Oct 2022 19:26:35 +0800 Subject: [PATCH 30/34] IssueNo: #I5RT32 Description: add Configuration Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.ability.wantConstant.d.ts | 2 + api/@ohos.app.ability.Configuration.d.ts | 72 ++++++++++++++++++++++++ api/@ohos.application.Configuration.d.ts | 2 + 3 files changed, 76 insertions(+) create mode 100644 api/@ohos.app.ability.Configuration.d.ts diff --git a/api/@ohos.ability.wantConstant.d.ts b/api/@ohos.ability.wantConstant.d.ts index 15ce6b7a38..9ad6e2e43a 100644 --- a/api/@ohos.ability.wantConstant.d.ts +++ b/api/@ohos.ability.wantConstant.d.ts @@ -19,6 +19,8 @@ * @since 6 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant */ declare namespace wantConstant { /** diff --git a/api/@ohos.app.ability.Configuration.d.ts b/api/@ohos.app.ability.Configuration.d.ts new file mode 100644 index 0000000000..32194943c4 --- /dev/null +++ b/api/@ohos.app.ability.Configuration.d.ts @@ -0,0 +1,72 @@ +/* + * 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 ConfigurationConstant from "./@ohos.application.ConfigurationConstant"; + +/** + * configuration item. + * @typedef Configuration + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +export interface Configuration { + /** + * Indicates the current language of the application. + * @type { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + language?: string; + + /** + * Indicates the current colorMode of the application. + * @type { ConfigurationConstant.ColorMode } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + colorMode?: ConfigurationConstant.ColorMode; + + /** + * Indicates the screen direction of the current device. + * @type { ConfigurationConstant.Direction } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + direction?: ConfigurationConstant.Direction; + + /** + * Indicates the screen density of the current device. + * @type { ConfigurationConstant.ScreenDensity } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + screenDensity?: ConfigurationConstant.ScreenDensity; + + /** + * Indicates the displayId of the current device. + * @type { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + displayId?: number; + + /** + * Indicates whether a pointer type device has connected. + * @type { boolean } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + hasPointerDevice?: boolean; +} diff --git a/api/@ohos.application.Configuration.d.ts b/api/@ohos.application.Configuration.d.ts index b1c3861169..2d339a3940 100644 --- a/api/@ohos.application.Configuration.d.ts +++ b/api/@ohos.application.Configuration.d.ts @@ -22,6 +22,8 @@ import ConfigurationConstant from "./@ohos.application.ConfigurationConstant"; * @since 8 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.Configuration */ export interface Configuration { /** -- Gitee From 36de1563194845b8e1fa03e0b526323d0351fb70 Mon Sep 17 00:00:00 2001 From: yangzk Date: Tue, 18 Oct 2022 19:30:11 +0800 Subject: [PATCH 31/34] IssueNo: #I5RT32 Description: add ConfigurationConstant Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- ...hos.app.ability.ConfigurationConstant.d.ts | 65 +++++++++++++++++++ ...hos.application.ConfigurationConstant.d.ts | 2 + 2 files changed, 67 insertions(+) create mode 100644 api/@ohos.app.ability.ConfigurationConstant.d.ts diff --git a/api/@ohos.app.ability.ConfigurationConstant.d.ts b/api/@ohos.app.ability.ConfigurationConstant.d.ts new file mode 100644 index 0000000000..303647c93b --- /dev/null +++ b/api/@ohos.app.ability.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. + * @namespace ConfigurationConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + declare namespace ConfigurationConstant { + /** + * ColorMode + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum ColorMode { + COLOR_MODE_NOT_SET = -1, + COLOR_MODE_DARK = 0, + COLOR_MODE_LIGHT = 1, + } + + /** + * Direction + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum Direction { + DIRECTION_NOT_SET = -1, + DIRECTION_VERTICAL = 0, + DIRECTION_HORIZONTAL = 1, + } + + /** + * ScreenDensity + * @name ScreenDensity + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + 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.ConfigurationConstant.d.ts b/api/@ohos.application.ConfigurationConstant.d.ts index cdf3b32724..7e3853aa5d 100644 --- a/api/@ohos.application.ConfigurationConstant.d.ts +++ b/api/@ohos.application.ConfigurationConstant.d.ts @@ -19,6 +19,8 @@ * @since 8 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant */ declare namespace ConfigurationConstant { /** -- Gitee From 3154b9630e3d66b26e7f622b68ae6ea2914e3ac2 Mon Sep 17 00:00:00 2001 From: yangzk Date: Tue, 18 Oct 2022 19:39:48 +0800 Subject: [PATCH 32/34] IssueNo: #I5RT32 Description: add formInfo Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.form.formInfo.d.ts | 498 ++++++++++++++++++++++++++++ api/@ohos.application.formInfo.d.ts | 2 + 2 files changed, 500 insertions(+) create mode 100644 api/@ohos.app.form.formInfo.d.ts diff --git a/api/@ohos.app.form.formInfo.d.ts b/api/@ohos.app.form.formInfo.d.ts new file mode 100644 index 0000000000..f991fc2672 --- /dev/null +++ b/api/@ohos.app.form.formInfo.d.ts @@ -0,0 +1,498 @@ +/* + * 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. + * @namespace formInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ +declare namespace formInfo { + /** + * Provides information about a form. + * @typedef FormInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + interface FormInfo { + /** + * Obtains the bundle name of the application to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + bundleName: string; + + /** + * Obtains the name of the application module to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + moduleName: string; + + /** + * Obtains the class name of the ability to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + abilityName: string; + + /** + * Obtains the name of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + name: string; + + /** + * Obtains the name of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + description: string; + + /** + * Obtains the type of this form. Currently, JS forms are supported. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + type: FormType; + + /** + * Obtains the JS component name of this JS form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + jsComponentName: string; + + /** + * Obtains the color mode of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + colorMode: ColorMode; + + /** + * Checks whether this form is a default form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + isDefault: boolean; + + /** + * Obtains the updateEnabled. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + updateEnabled: boolean; + + /** + * Obtains whether notify visible of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + formVisibleNotify: boolean; + + /** + * Obtains the bundle relatedBundleName of the application to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + relatedBundleName: string; + + /** + * Obtains the scheduledUpdateTime. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + scheduledUpdateTime: string; + + /** + * Obtains the form config ability about this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + formConfigAbility: string; + + /** + * Obtains the updateDuration. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + updateDuration: number; + + /** + * Obtains the default grid style of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + defaultDimension: number; + + /** + * Obtains the grid styles supported by this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + supportDimensions: Array; + + /** + * Obtains the custom data defined in this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + customizeData: {[key: string]: [value: string]}; + } + + /** + * Type of form. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormType { + /** + * JS form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + JS = 1, + + /** + * eTS form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + eTS = 2 + } + + /** + * Color mode. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum ColorMode { + /** + * Automatic mode. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODE_AUTO = -1, + + /** + * Dark mode. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODE_DARK = 0, + + /** + * Light mode. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODE_LIGHT = 1 + } + + /** + * Provides state information about a form. + * @typedef FormStateInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + interface FormStateInfo { + /** + * Obtains the form state. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + formState: FormState; + + /** + * Obtains the want form . + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + want: Want; + } + + /** + * Provides state about a form. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormState { + /** + * Indicates that the form status is unknown due to an internal error. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + UNKNOWN = -1, + + /** + * Indicates that the form is in the default state. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + DEFAULT = 0, + + /** + * Indicates that the form is ready. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + READY = 1, + } + + /** + * Parameter of form. + * @enum { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormParam { + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: 1L + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: "119476135" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + 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: FormDimension.Dimension_1_2 + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + 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" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + 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. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + 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 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + 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 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + 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 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + TEMPORARY_KEY = "ohos.extra.param.key.form_temporary", + + /** + * Indicates the key specifying the name of the bundle to be obtained, which is represented as + * want: { + * "parameters": { + * BUNDLE_NAME_KEY: "bundleName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name", + + /** + * Indicates the key specifying the name of the ability to be obtained, which is represented as + * want: { + * "parameters": { + * ABILITY_NAME_KEY: "abilityName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name", + + /** + * Indicates the key specifying the the device ID, which is represented as + * want: { + * "parameters": { + * DEVICE_ID_KEY : "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + DEVICE_ID_KEY = "ohos.extra.param.key.device_id" + } + + /** + * The optional options used as filters to ask + * getFormsInfo to return formInfos from only forms that match the options. + * @typedef FormInfoFilter + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + interface FormInfoFilter { + /** + * optional moduleName that used to ask getFormsInfo to return + * form infos with the same moduleName. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + moduleName?: string; + } + + /** + * Defines the FormDimension enum. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormDimension { + /** + * 1 x 2 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_1_2 = 1, + + /** + * 2 x 2 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_2_2, + + /** + * 2 x 4 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_2_4, + + /** + * 4 x 4 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_4_4, + + /** + * 2 x 1 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_2_1, + } + /** + * The visibility of a form. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum VisibilityType { + /** + * Indicates the type of the form is visible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to visible. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + FORM_VISIBLE = 1, + /** + * Indicates the type of the form is invisible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to invisible. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + FORM_INVISIBLE, + } +} +export default formInfo; \ No newline at end of file diff --git a/api/@ohos.application.formInfo.d.ts b/api/@ohos.application.formInfo.d.ts index 774eb4d383..49b86ecead 100644 --- a/api/@ohos.application.formInfo.d.ts +++ b/api/@ohos.application.formInfo.d.ts @@ -21,6 +21,8 @@ import Want from './@ohos.application.Want'; * @name formInfo * @since 8 * @syscap SystemCapability.Ability.Form + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo */ declare namespace formInfo { /** -- Gitee From eb32a2c7cc84e3689d3ecc20294629d0dca75feb Mon Sep 17 00:00:00 2001 From: yangzk Date: Tue, 18 Oct 2022 20:06:01 +0800 Subject: [PATCH 33/34] IssueNo: #I5RT32 Description: add Want Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.Want.d.ts | 91 +++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 api/@ohos.app.ability.Want.d.ts diff --git a/api/@ohos.app.ability.Want.d.ts b/api/@ohos.app.ability.Want.d.ts new file mode 100644 index 0000000000..39f02017e5 --- /dev/null +++ b/api/@ohos.app.ability.Want.d.ts @@ -0,0 +1,91 @@ +/* + * 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. + */ + +/** + * Want is the basic communication component of the system. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +export default class Want { + /** + * device id + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + deviceId?: string; + + /** + * bundle name + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + bundleName?: string; + + /** + * ability name + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + abilityName?: string; + + /** + * The description of a URI in a Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + uri?: string; + + /** + * The description of the type in this Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + type?: string; + + /** + * The options of the flags in this Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + flags?: number; + + /** + * The description of an action in an want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + action?: string; + + /** + * The description of the WantParams object in an Want + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + parameters?: {[key: string]: any}; + + /** + * The description of a entities in a Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + entities?: Array; + + /** + * The description of an module name in an want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + moduleName?: string; +} -- Gitee From 53933f1f5594ccace3179c56851de26ea5d174fc Mon Sep 17 00:00:00 2001 From: yangzk Date: Tue, 18 Oct 2022 20:14:04 +0800 Subject: [PATCH 34/34] IssueNo: #I5RT32 Description: fix import Sig: SIG_ApplicationFramework Feature or Bugfix: Feature Binary Source: No Signed-off-by: yangzk Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14 --- api/@ohos.app.ability.Ability.d.ts | 4 ++-- api/@ohos.app.ability.AbilityStage.d.ts | 4 ++-- api/@ohos.app.ability.Configuration.d.ts | 2 +- api/@ohos.app.ability.EnvironmentCallback.d.ts | 2 +- api/@ohos.app.ability.ExtensionAbility.d.ts | 2 +- api/@ohos.app.ability.ServiceExtensionAbility.d.ts | 4 ++-- api/@ohos.app.ability.abilityManager.d.ts | 2 +- api/@ohos.app.ability.wantAgent.d.ts | 2 +- api/@ohos.app.form.FormExtensionAbility.d.ts | 6 +++--- api/@ohos.app.form.formHost.d.ts | 4 ++-- api/@ohos.app.form.formInfo.d.ts | 2 +- api/@ohos.app.form.formProvider.d.ts | 4 ++-- api/@ohos.application.Want.d.ts | 2 ++ 13 files changed, 21 insertions(+), 19 deletions(-) diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts index 7ed043a155..b41d046740 100755 --- a/api/@ohos.app.ability.Ability.d.ts +++ b/api/@ohos.app.ability.Ability.d.ts @@ -16,9 +16,9 @@ import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; import AbilityContext from "./application/AbilityContext"; import rpc from './@ohos.rpc'; -import Want from './@ohos.application.Want'; +import Want from './@ohos.app.ability.Want'; import window from './@ohos.window'; -import { Configuration } from './@ohos.application.Configuration'; +import { Configuration } from './@ohos.app.ability.Configuration'; /** * The prototype of the listener function interface registered by the Caller. diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts index 3078c51ca6..8aa0201a3f 100644 --- a/api/@ohos.app.ability.AbilityStage.d.ts +++ b/api/@ohos.app.ability.AbilityStage.d.ts @@ -15,8 +15,8 @@ import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; import AbilityStageContext from "./application/AbilityStageContext"; -import Want from './@ohos.application.Want'; -import { Configuration } from './@ohos.application.Configuration'; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; /** * The class of an ability stage. diff --git a/api/@ohos.app.ability.Configuration.d.ts b/api/@ohos.app.ability.Configuration.d.ts index 32194943c4..b5f11c28d2 100644 --- a/api/@ohos.app.ability.Configuration.d.ts +++ b/api/@ohos.app.ability.Configuration.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import ConfigurationConstant from "./@ohos.application.ConfigurationConstant"; +import ConfigurationConstant from "./@ohos.app.ability.ConfigurationConstant"; /** * configuration item. diff --git a/api/@ohos.app.ability.EnvironmentCallback.d.ts b/api/@ohos.app.ability.EnvironmentCallback.d.ts index 1e1a9419ad..03ccc013c3 100755 --- a/api/@ohos.app.ability.EnvironmentCallback.d.ts +++ b/api/@ohos.app.ability.EnvironmentCallback.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { Configuration } from './@ohos.application.Configuration'; +import { Configuration } from './@ohos.app.ability.Configuration'; /** * The environment callback. diff --git a/api/@ohos.app.ability.ExtensionAbility.d.ts b/api/@ohos.app.ability.ExtensionAbility.d.ts index e63914c35b..6f27489e3f 100644 --- a/api/@ohos.app.ability.ExtensionAbility.d.ts +++ b/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -14,7 +14,7 @@ */ import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; -import { Configuration } from './@ohos.application.Configuration'; +import { Configuration } from './@ohos.app.ability.Configuration'; /** * class of extension. diff --git a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts index 575bca4ddb..d4eaab2f12 100644 --- a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts +++ b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts @@ -15,8 +15,8 @@ import rpc from "./@ohos.rpc"; import ServiceExtensionContext from "./application/ServiceExtensionContext"; -import Want from './@ohos.application.Want'; -import { Configuration } from './@ohos.application.Configuration'; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; /** * class of service extension ability. diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts index 60c76db94d..fcf61cb6b2 100644 --- a/api/@ohos.app.ability.abilityManager.d.ts +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -14,7 +14,7 @@ */ import { AsyncCallback } from './basic'; -import { Configuration } from './@ohos.application.Configuration'; +import { Configuration } from './@ohos.app.ability.Configuration'; import { AbilityRunningInfo as _AbilityRunningInfo } from './application/AbilityRunningInfo'; import { ExtensionRunningInfo as _ExtensionRunningInfo } from './application/ExtensionRunningInfo'; import { ElementName } from './bundle/elementName'; diff --git a/api/@ohos.app.ability.wantAgent.d.ts b/api/@ohos.app.ability.wantAgent.d.ts index 0dd77890e8..ace81f0b44 100644 --- a/api/@ohos.app.ability.wantAgent.d.ts +++ b/api/@ohos.app.ability.wantAgent.d.ts @@ -14,7 +14,7 @@ */ import { AsyncCallback , Callback} from './basic'; -import Want from './@ohos.application.Want'; +import Want from './@ohos.app.ability.Want'; import { WantAgentInfo as _WantAgentInfo } from './wantAgent/wantAgentInfo'; import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts index b32f18cb29..aeed2002d1 100644 --- a/api/@ohos.app.form.FormExtensionAbility.d.ts +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -14,10 +14,10 @@ */ import formBindingData from './@ohos.app.form.formBindingData'; -import formInfo from "./@ohos.application.formInfo"; +import formInfo from "./@ohos.app.form.formInfo"; import FormExtensionContext from "./application/FormExtensionContext"; -import Want from './@ohos.application.Want'; -import { Configuration } from './@ohos.application.Configuration'; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; /** * class of form extension. diff --git a/api/@ohos.app.form.formHost.d.ts b/api/@ohos.app.form.formHost.d.ts index dbc95cd2d2..96d204f779 100644 --- a/api/@ohos.app.form.formHost.d.ts +++ b/api/@ohos.app.form.formHost.d.ts @@ -15,8 +15,8 @@ import { AsyncCallback } from "./basic"; import { Callback } from "./basic"; -import Want from './@ohos.application.Want'; -import formInfo from './@ohos.application.formInfo'; +import Want from './@ohos.app.ability.Want'; +import formInfo from './@ohos.app.form.formInfo'; /** * Interface of formHost. diff --git a/api/@ohos.app.form.formInfo.d.ts b/api/@ohos.app.form.formInfo.d.ts index f991fc2672..ee5c9648fe 100644 --- a/api/@ohos.app.form.formInfo.d.ts +++ b/api/@ohos.app.form.formInfo.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import Want from './@ohos.application.Want'; +import Want from './@ohos.app.ability.Want'; /** * interface of formInfo. diff --git a/api/@ohos.app.form.formProvider.d.ts b/api/@ohos.app.form.formProvider.d.ts index fb7f4dc857..31b048c783 100644 --- a/api/@ohos.app.form.formProvider.d.ts +++ b/api/@ohos.app.form.formProvider.d.ts @@ -15,8 +15,8 @@ import { AsyncCallback } from "./basic"; import formBindingData from "./@ohos.app.form.formBindingData"; -import formInfo from "./@ohos.application.formInfo"; -import Want from "./@ohos.application.Want"; +import formInfo from "./@ohos.app.form.formInfo"; +import Want from "./@ohos.app.ability.Want"; /** * Interface of formProvider. diff --git a/api/@ohos.application.Want.d.ts b/api/@ohos.application.Want.d.ts index 1a54ebefd9..b417aba928 100644 --- a/api/@ohos.application.Want.d.ts +++ b/api/@ohos.application.Want.d.ts @@ -20,6 +20,8 @@ * @since 8 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.Want */ export default class Want { /** -- Gitee