From 32db5d1e2ae99357db2ed4d1e056ccfae3d1769d Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 22 Feb 2022 21:06:35 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=8F=90=E4=BA=A4api7=E6=8E=A5=E5=8F=A3ts?= =?UTF-8?q?=E6=96=87=E4=BB=B6=20Signed-off-by:=20dy=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.ability.particleAbility.d.ts | 25 ++++++++ api/@ohos.bundle.d.ts | 75 +++++++++++++++++++++-- api/ability/dataAbilityHelper.d.ts | 39 ++++++++++++ api/app/appVersionInfo.d.ts | 45 ++++++++++++++ api/app/context.d.ts | 84 ++++++++++++++++++++++++++ api/app/processInfo.d.ts | 2 +- 6 files changed, 264 insertions(+), 6 deletions(-) create mode 100644 api/app/appVersionInfo.d.ts diff --git a/api/@ohos.ability.particleAbility.d.ts b/api/@ohos.ability.particleAbility.d.ts index fc367272ac..19e8831ee3 100644 --- a/api/@ohos.ability.particleAbility.d.ts +++ b/api/@ohos.ability.particleAbility.d.ts @@ -17,6 +17,8 @@ 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 './ability/want'; /** * A Particle Ability represents an ability with service. @@ -85,5 +87,28 @@ declare namespace particleAbility { */ function cancelBackgroundRunning(callback: AsyncCallback): void; function cancelBackgroundRunning(): 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; } export default particleAbility; diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 5aa37b05d9..cc6f7c2e84 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -391,21 +391,36 @@ declare namespace bundle { */ function getBundleInstaller(callback: AsyncCallback): void; function getBundleInstaller(): Promise; + + /** + * Obtains the interface used to get ability info. + * + * @since 7 + * @syscap SystemCapability.BundleManager.BundleFramework + * @param bundleName Indicates the application bundle name to be queried. + * @param abilityName Indicates the ability name. + * @return Returns the IBundleInstaller interface. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + */ + function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback): void; + function getAbilityInfo(bundleName: string, abilityName: string): Promise; /** - * Obtains based on a given bundle name. + * Obtains based on a given application info. * * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the application bundle name to be queried. * @param bundleFlags Indicates the flag used to specify information contained in the ApplicationInfo object * that will be returned. - * @param userId Indicates the user ID. + * @param userId Indicates the user ID or do not pass user ID. * @return Returns the ApplicationInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO */ function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number) : Promise; + function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback) : void; + function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number) : Promise; /** * Query the AbilityInfo by the given Want. @@ -446,12 +461,14 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleFlags Indicates the flag used to specify information contained in the ApplicationInfo objects * that will be returned. - * @param userId Indicates the user ID. + * @param userId Indicates the user ID or do not pass user ID. * @return Returns a list of ApplicationInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED */ function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; function getAllApplicationInfo(bundleFlags: number, userId: number) : Promise>; + function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; + function getAllApplicationInfo(bundleFlags: number, userId?: number) : Promise>; /** * Obtains bundle name by the given uid. @@ -478,8 +495,6 @@ declare namespace bundle { function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback) : void function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise; - /** - /** * Obtains the Want for starting the main ability of an application based on the * given bundle name. The main ability of an application is the ability that has the @@ -589,6 +604,56 @@ declare namespace bundle { */ function getPermissionDef(permissionName: string, callback: AsyncCallback): void; function getPermissionDef(permissionName: string): Promise; + + /** + * Get the gids list by bundleName + * @since 8 + * @SysCap SystemCapability.Appexecfwk + * @param bundleName Indicates the bundle name of the application. + * @return Returns a list of gids. + * @permission + * @systemapi + */ + function getBundleGids(bundleName: string, callback: AsyncCallback>): void; + function getBundleGids(bundleName: string): Promise>; + + /** + * Gets the specified ability label + * @since 8 + * @param bundleName Indicates the bundle name of the application. + * @param abilityName Indicates the ability name . + * @return Returns the specified ability label + */ + function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; + function getAbilityLabel(bundleName: string, abilityName: string): Promise; + + /** + * Gets the specified ability icon + * @since 8 + * @param bundleName Indicates the bundle name of the application. + * @param abilityName Indicates the ability name. + * @return Returns the specified ability icon + */ + function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; + function getAbilityIcon(bundleName: string, abilityName: string): Promise; + + /** + * Get whether to enable a specified ability + * @since 8 + * @param info Indicates information about the ability to set. + * @returns Returns whether to enable a specified ability + */ + function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; + function isAbilityEnabled(info: AbilityInfo): Promise; + + /** + * Get whether to enable a specified application + * @since 8 + * @param bundleName Indicates the bundle name of the application. + * @returns Returns whether to enable a specified application + */ + function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; + function isApplicationEnabled(bundleName: string): Promise; } export default bundle; diff --git a/api/ability/dataAbilityHelper.d.ts b/api/ability/dataAbilityHelper.d.ts index f1cf3feefb..52e547b75f 100644 --- a/api/ability/dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityHelper.d.ts @@ -198,4 +198,43 @@ export interface DataAbilityHelper { */ query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): Promise; + + /** + * Calls the method of the Data ability. + * + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param uri Indicates the Data ability of the method to call. + * @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; +} + +/** + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @permission N/A + */ + 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. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + */ + [key: string]: number | string | boolean | Array | null; } diff --git a/api/app/appVersionInfo.d.ts b/api/app/appVersionInfo.d.ts new file mode 100644 index 0000000000..526f43b886 --- /dev/null +++ b/api/app/appVersionInfo.d.ts @@ -0,0 +1,45 @@ +/* + * 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. + */ + +/** + * @name Obtains configuration information about an ability + * @since 7 + * @SysCap SystemCapability.Appexecfwk + * @permission NA + * @devices phone, tablet, tv, wearable, car + */ +export interface AppVersionInfo { + + /** + * @default appName + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly appName: string; + + /** + * @default versionCode + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly versionCode: number; + + /** + * @default versionName + * @since 7 + * @SysCap SystemCapability.Appexecfwk + */ + readonly versionName: string; +} diff --git a/api/app/context.d.ts b/api/app/context.d.ts index 6bdb28af61..857c1fcb6a 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -18,6 +18,10 @@ 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'; + /** * The context of an ability or an application. It allows access to @@ -126,6 +130,86 @@ export interface Context extends BaseContext { */ getCallingBundle(callback: AsyncCallback): void getCallingBundle(): Promise; + + /** + * Obtains the files dir. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getFilesDir(callback: AsyncCallback): void; + getFilesDir(): Promise; + + /** + * Obtains the cache Dir. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getCacheDir(callback: AsyncCallback): void; + getCacheDir(): Promise; + + /** + * Obtains the external cache dir. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getExternalCacheDir(callback: AsyncCallback): void; + getExternalCacheDir(): Promise; + + /** + * Obtains or create the distributed dir. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getOrCreateDistributedDir(): Promise; + getOrCreateDistributedDir(callback: AsyncCallback): void; + + /** + * Obtains the app type. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getAppType(callback: AsyncCallback): void + getAppType(): Promise; + + /** + * Obtains the hap module Info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getHapModuleInfo(callback: AsyncCallback): void + getHapModuleInfo(): Promise; + + /** + * Obtains the app version info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getAppVersionInfo(callback: AsyncCallback): void + getAppVersionInfo(): Promise; + + /** + * Obtains the application context. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getApplicationContext(): Context; + + /** + * Obtains the ability info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + */ + getAbilityInfo(callback: AsyncCallback): void + getAbilityInfo(): Promise; } /** diff --git a/api/app/processInfo.d.ts b/api/app/processInfo.d.ts index cd25a592d8..1f7e49dfc7 100644 --- a/api/app/processInfo.d.ts +++ b/api/app/processInfo.d.ts @@ -37,5 +37,5 @@ export interface ProcessInfo { * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.Core */ - processName: string; + processName: string; } \ No newline at end of file -- Gitee From 29badcd6078c3dc2542996126556283efccba0e3 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 22 Feb 2022 22:02:23 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9ts=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E4=BB=A5=E5=8F=8ASysCap=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- api/@ohos.bundle.d.ts | 35 +++++++++++++++++++++-------------- api/app/appVersionInfo.d.ts | 8 ++++---- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index cc6f7c2e84..4bd7007238 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -406,7 +406,7 @@ declare namespace bundle { function getAbilityInfo(bundleName: string, abilityName: string): Promise; /** - * Obtains based on a given application info. + * Obtains based on a given bundle name. * * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework @@ -606,31 +606,34 @@ declare namespace bundle { function getPermissionDef(permissionName: string): Promise; /** - * Get the gids list by bundleName + * Get the gids list by bundleName + * * @since 8 - * @SysCap SystemCapability.Appexecfwk - * @param bundleName Indicates the bundle name of the application. + * @SysCap SystemCapability.BundleManager.BundleFramework + * @param bundleName Indicates the bundle name of the application. * @return Returns a list of gids. - * @permission - * @systemapi */ function getBundleGids(bundleName: string, callback: AsyncCallback>): void; function getBundleGids(bundleName: string): Promise>; /** - * Gets the specified ability label + * Get the specified ability label + * * @since 8 - * @param bundleName Indicates the bundle name of the application. - * @param abilityName Indicates the ability name . + * @syscap SystemCapability.BundleManager.BundleFramework + * @param bundleName Indicates the bundle name of the application. + * @param abilityName Indicates the ability name. * @return Returns the specified ability label */ function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityLabel(bundleName: string, abilityName: string): Promise; /** - * Gets the specified ability icon + * Get the specified ability icon + * * @since 8 - * @param bundleName Indicates the bundle name of the application. + * @syscap SystemCapability.BundleManager.BundleFramework + * @param bundleName Indicates the bundle name of the application. * @param abilityName Indicates the ability name. * @return Returns the specified ability icon */ @@ -639,18 +642,22 @@ declare namespace bundle { /** * Get whether to enable a specified ability + * * @since 8 + * @syscap SystemCapability.BundleManager.BundleFramework * @param info Indicates information about the ability to set. - * @returns Returns whether to enable a specified ability + * @returns Returns whether to enable a specified ability */ function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; function isAbilityEnabled(info: AbilityInfo): Promise; /** * Get whether to enable a specified application + * * @since 8 - * @param bundleName Indicates the bundle name of the application. - * @returns Returns whether to enable a specified application + * @syscap SystemCapability.BundleManager.BundleFramework + * @param bundleName Indicates the bundle name of the application. + * @returns Returns whether to enable a specified application */ function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; function isApplicationEnabled(bundleName: string): Promise; diff --git a/api/app/appVersionInfo.d.ts b/api/app/appVersionInfo.d.ts index 526f43b886..58879170fe 100644 --- a/api/app/appVersionInfo.d.ts +++ b/api/app/appVersionInfo.d.ts @@ -16,7 +16,7 @@ /** * @name Obtains configuration information about an ability * @since 7 - * @SysCap SystemCapability.Appexecfwk + * @SysCap SystemCapability.Ability.AbilityRuntime.Core * @permission NA * @devices phone, tablet, tv, wearable, car */ @@ -25,21 +25,21 @@ export interface AppVersionInfo { /** * @default appName * @since 7 - * @SysCap SystemCapability.Appexecfwk + * @SysCap SystemCapability.Ability.AbilityRuntime.Core */ readonly appName: string; /** * @default versionCode * @since 7 - * @SysCap SystemCapability.Appexecfwk + * @SysCap SystemCapability.Ability.AbilityRuntime.Core */ readonly versionCode: number; /** * @default versionName * @since 7 - * @SysCap SystemCapability.Appexecfwk + * @SysCap SystemCapability.Ability.AbilityRuntime.Core */ readonly versionName: string; } -- Gitee From d5b7031098e0bad2e4140c85e8eeb19e749a17e3 Mon Sep 17 00:00:00 2001 From: dy Date: Wed, 23 Feb 2022 13:30:31 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8D=8F=E5=90=8Cts=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- api/@ohos.ability.featureAbility.d.ts | 81 +++++++++++++++++++++++++++ api/@ohos.bundle.d.ts | 7 +-- api/ability/abilityAgent.d.ts | 76 +++++++++++++++++++++++++ api/ability/assistantCode.d.ts | 39 +++++++++++++ 4 files changed, 199 insertions(+), 4 deletions(-) create mode 100644 api/ability/abilityAgent.d.ts create mode 100644 api/ability/assistantCode.d.ts diff --git a/api/@ohos.ability.featureAbility.d.ts b/api/@ohos.ability.featureAbility.d.ts index 20b110239b..91c64e56c7 100644 --- a/api/@ohos.ability.featureAbility.d.ts +++ b/api/@ohos.ability.featureAbility.d.ts @@ -13,6 +13,7 @@ * limitations under the License. */ import { AsyncCallback } from './basic'; +import { Callback } from './basic'; import { Want } from './ability/want'; import { StartAbilityParameter } from './ability/startAbilityParameter'; import { AbilityResult } from './ability/abilityResult'; @@ -20,6 +21,7 @@ import { Context } from './app/context'; import { DataAbilityHelper } from './ability/dataAbilityHelper'; import { ConnectOptions } from './ability/connectOptions'; import { ContinueAbilityOptions } from './ability/continueAbilityOptions'; +import { AbilityAgent } from './ability/abilityAgent'; /** * A Feature Ability represents an ability with a UI and is designed to interact with users. @@ -156,6 +158,85 @@ declare namespace featureAbility { function continueAbility(options: ContinueAbilityOptions, callback: AsyncCallback): void; function continueAbility(options: ContinueAbilityOptions): Promise; + /** + * start assist ability,different abilit connect info . + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param want info: bundlename,abilityname,B device deviceid + */ + function startAssistAbility(want: Want): void; + + /** + * stop ability connect + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param AsyncCallback + */ + function stopAssistAbility(callback: AsyncCallback): void; + function stopAssistAbility(): Promise; + + /** + * Register the observe of assistConnect. + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type assistConnect. + * @param callback callback interface. + */ + function on(type: 'assistConnect', callback: Callback): void; + + /** + * Register the observe of assistConnectFailed. + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type assistConnectFailed. + * @param callback callback interface. + */ + function on(type: 'assistConnectFailed', callback: Callback): void; + + /** + * Register the observe of assistDisconnect. + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type assistDisconnect. + * @param callback callback interface. + */ + function on(type: 'assistDisconnect', callback: Callback): void; + + /** + * UDeregister the observe of assistConnect. + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type assistConnect. + * @param callback callback interface. + */ + function off(type: 'assistConnect', callback?: Callback): void; + + /** + * UDeregister the observe of assistConnectFailed. + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type assistConnectFailed. + * @param callback callback interface. + */ + function off(type: 'assistConnectFailed', callback?: Callback): void; + + /** + * UDeregister the observe of assistDisconnect. + * @default - + * @since 7 + * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type assistDisconnect. + * @param callback callback interface. + */ + function off(type: 'assistDisconnect', callback?: Callback): void; + export enum AbilityWindowConfiguration { WINDOW_MODE_UNDEFINED = 0, WINDOW_MODE_FULLSCREEN = 1, diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 4bd7007238..f2e0b8dcdf 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -23,6 +23,7 @@ import { BundleInstaller } from './bundle/bundleInstaller'; import { ShortcutInfo } from './bundle/shortcutInfo'; import { ModuleUsageRecord } from './bundle/moduleUsageRecord'; import { PermissionDef } from './bundle/PermissionDef'; +import image from './@ohos.multimedia.image'; /** * bundle. @@ -418,7 +419,6 @@ declare namespace bundle { * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO */ function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; - function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number) : Promise; function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback) : void; function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number) : Promise; @@ -466,7 +466,6 @@ declare namespace bundle { * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED */ function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; - function getAllApplicationInfo(bundleFlags: number, userId: number) : Promise>; function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; function getAllApplicationInfo(bundleFlags: number, userId?: number) : Promise>; @@ -637,8 +636,8 @@ declare namespace bundle { * @param abilityName Indicates the ability name. * @return Returns the specified ability icon */ - function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; - function getAbilityIcon(bundleName: string, abilityName: string): Promise; + function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; + function getAbilityIcon(bundleName: string, abilityName: string): Promise; /** * Get whether to enable a specified ability diff --git a/api/ability/abilityAgent.d.ts b/api/ability/abilityAgent.d.ts new file mode 100644 index 0000000000..c6d61f438e --- /dev/null +++ b/api/ability/abilityAgent.d.ts @@ -0,0 +1,76 @@ +/* + * 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'; +/** + * AbilityAgent,oncallback object. + * @name AbilityAgent + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @permission N/A + */ + export interface AbilityAgent { + /** + * register message,get AsyncCallback info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type message + * @return Returns the register results. + */ + on(type: 'message', callback: AsyncCallback): void; + + /** + * register stateChange,get AsyncCallback info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type stateChange. + * @return Returns the register results. + */ + on(type: 'stateChange', callback: AsyncCallback): void; + + /** + * unRegister message,get AsyncCallback info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type message + * @return Returns the unRegister results. + */ + off(type: 'message', callback?: AsyncCallback): void; + + /** + * unRegister stateChange,get AsyncCallback info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param type stateChange. + * @return Returns the unRegister results. + */ + off(type: 'stateChange', callback?: AsyncCallback): void; + + /** + * postMessage,get AsyncCallback info. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @param data Message. + * @return - + */ + postMessage(data: Message, callback:AsyncCallback): void; + postMessage(data: Message): Promise; +} + +export interface Message { + type: string; + data: {[key: string]: Object}; +} + +export default AbilityAgent; diff --git a/api/ability/assistantCode.d.ts b/api/ability/assistantCode.d.ts new file mode 100644 index 0000000000..2807367578 --- /dev/null +++ b/api/ability/assistantCode.d.ts @@ -0,0 +1,39 @@ +/* + * 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. + */ + + /** + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @permission N/A + */ +export enum AssistantCode { + OK = 0, + ERR_UNCONNECTED = 1, + ERR_INVALID_PARAMETER = 2, + ERR_SYSTEM_ERROR = 3, + ERR_EVENT_HANDLER_IS_NOT_SET_UP = 4, + ERR_ABILITY_TYPE_NOT_SUPPORTED = 5, + ERR_SIGNATURE_IS_NOT_CONSISTENT = 6, + ERR_ABILITY_NOT_MATCHED = 7, + ERR_ABILITY_TERMINATED = 8, + ERR_DEVICE_OFFLINE = 9, + ERR_PROCESS_DIED = 10, + ERR_ABILITY_START_FAILED = 11, + ERR_VERSION_INCOMPATIBLE = 12, + ERR_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 13, + ERR_TIMEOUT = 14, + ERR_IN_ASSISTING_MODE = 15, + ERR_NETWORK_TYPE_NOT_SUPPORTED = 16 +} \ No newline at end of file -- Gitee From a8ba601fda48cb80ece5f920315557bbaa952717 Mon Sep 17 00:00:00 2001 From: dy Date: Wed, 23 Feb 2022 16:25:18 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=88=A0=E9=99=A4getBundleGids?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- api/@ohos.bundle.d.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index f2e0b8dcdf..0a07358ee2 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -604,17 +604,6 @@ declare namespace bundle { function getPermissionDef(permissionName: string, callback: AsyncCallback): void; function getPermissionDef(permissionName: string): Promise; - /** - * Get the gids list by bundleName - * - * @since 8 - * @SysCap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. - * @return Returns a list of gids. - */ - function getBundleGids(bundleName: string, callback: AsyncCallback>): void; - function getBundleGids(bundleName: string): Promise>; - /** * Get the specified ability label * -- Gitee From 39d2736351907936f6dc65c9be21e314abeb4e05 Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 25 Feb 2022 19:47:39 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9Api7=E7=9A=84ts=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- api/@ohos.ability.featureAbility.d.ts | 50 ++++---- api/@ohos.ability.particleAbility.d.ts | 12 +- api/@ohos.bundle.d.ts | 33 +++-- api/ability/abilityAgent.d.ts | 57 ++++++--- api/ability/assistantCode.d.ts | 161 +++++++++++++++++++++---- api/ability/dataAbilityHelper.d.ts | 5 +- api/app/appVersionInfo.d.ts | 5 +- api/app/context.d.ts | 20 +-- api/app/processInfo.d.ts | 4 +- 9 files changed, 251 insertions(+), 96 deletions(-) diff --git a/api/@ohos.ability.featureAbility.d.ts b/api/@ohos.ability.featureAbility.d.ts index 91c64e56c7..04121b147c 100644 --- a/api/@ohos.ability.featureAbility.d.ts +++ b/api/@ohos.ability.featureAbility.d.ts @@ -159,81 +159,87 @@ declare namespace featureAbility { function continueAbility(options: ContinueAbilityOptions): Promise; /** - * start assist ability,different abilit connect info . + * Starts the specified ability on the device to establish a collaboration session. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param want info: bundlename,abilityname,B device deviceid + * @param want Want about the ability to start. */ function startAssistAbility(want: Want): void; /** - * stop ability connect + * Disconnects this collaboration session. This method uses an asynchronous callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param AsyncCallback + * @param AsyncCallback Callback used to return the result. */ function stopAssistAbility(callback: AsyncCallback): void; function stopAssistAbility(): Promise; /** - * Register the observe of assistConnect. + * Listens for the even of successfully starting the specified ability for establishing a collaboration session. + * This method uses a callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type assistConnect. - * @param callback callback interface. + * @param type Event type. The value is fixed at assistConnect. + * @param callback Callback used to return the result. */ function on(type: 'assistConnect', callback: Callback): void; /** - * Register the observe of assistConnectFailed. + * Listens for the event of collaboration session failure. This method uses a callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type assistConnectFailed. - * @param callback callback interface. + * @param type Event type. The value is fixed at assistConnectFailed. + * @param callback Callback used to return the status code. For details, see AssistantCode. */ function on(type: 'assistConnectFailed', callback: Callback): void; /** - * Register the observe of assistDisconnect. + * Listens for the event of collaboration session disconnection. This method uses a callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type assistDisconnect. - * @param callback callback interface. + * @param type Event type. The value is fixed at assistDisconnect. + * @param callback Callback used to return the status code. For details, see AssistantCode. */ function on(type: 'assistDisconnect', callback: Callback): void; /** - * UDeregister the observe of assistConnect. + * Cancels listening for the even of successfully starting the specified ability + * for establishing a collaboration session. This method uses a callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type assistConnect. - * @param callback callback interface. + * @param type Event type. The value is fixed at assistConnect. + * @param callback Callback specified in featureAbility.on(type:'assistConnect'). + * If no callback is specified, listening will be canceled for all callbacks. */ function off(type: 'assistConnect', callback?: Callback): void; /** - * UDeregister the observe of assistConnectFailed. + * Cancels listening for the event of collaboration session failure. This method uses a callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type assistConnectFailed. - * @param callback callback interface. + * @param type Event type. The value is fixed at assistConnectFailed. + * @param callback Callback specified in featureAbility.on(type:'assistConnectFailed'). + * If no callback is specified, listening will be canceled for all callbacks. */ function off(type: 'assistConnectFailed', callback?: Callback): void; /** - * UDeregister the observe of assistDisconnect. + * Cancels listening for the event of collaboration session disconnection. + * This method uses a callback to return the result. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type assistDisconnect. - * @param callback callback interface. + * @param type Event type. The value is fixed at assistDisconnect. + * @param callback Callback specified in featureAbility.on(type:'assistDisconnect'). + * If no callback is specified, listening will be canceled for all callbacks. */ function off(type: 'assistDisconnect', callback?: Callback): void; diff --git a/api/@ohos.ability.particleAbility.d.ts b/api/@ohos.ability.particleAbility.d.ts index 19e8831ee3..acabd75578 100644 --- a/api/@ohos.ability.particleAbility.d.ts +++ b/api/@ohos.ability.particleAbility.d.ts @@ -89,23 +89,23 @@ declare namespace particleAbility { function cancelBackgroundRunning(): Promise; /** - * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * Binds an ability to a Service ability. * @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 + * @param request Want about the Service ability. + * @param options Callback object for the client. If this parameter is null, an exception is thrown. + * @return Returns Unique identifier of the connection between the client and the service side. * @FAModelOnly */ function connectAbility(request: Want, options:ConnectOptions ): number; /** - * The callback interface was connect successfully. + * disconnect ability to a Service ability. * @default - * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param connection The number code of the ability connected + * @param connection Return value of the particleAbility.connectAbility API. * @FAModelOnly */ function disconnectAbility(connection: number, callback:AsyncCallback): void; diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 5a38e71032..76b1b8592c 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -387,14 +387,13 @@ declare namespace bundle { function getBundleInstaller(): Promise; /** - * Obtains the interface used to get ability info. + * Obtains information about the current ability. * * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the application bundle name to be queried. * @param abilityName Indicates the ability name. - * @return Returns the IBundleInstaller interface. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @return Returns the AbilityInfo object for the current ability. */ function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityInfo(bundleName: string, abilityName: string): Promise; @@ -598,47 +597,47 @@ declare namespace bundle { function getPermissionDef(permissionName: string): Promise; /** - * Get the specified ability label + * Obtains the label of a specified ability. * * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. + * @param bundleName Indicates the bundle name of the application to which the ability belongs. * @param abilityName Indicates the ability name. - * @return Returns the specified ability label + * @return Returns the label representing the label of the specified ability. */ function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityLabel(bundleName: string, abilityName: string): Promise; - /** - * Get the specified ability icon + /** + * Obtains the icon of a specified ability. * * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. + * @param bundleName Indicates the bundle name of the application to which the ability belongs. * @param abilityName Indicates the ability name. - * @return Returns the specified ability icon + * @return Returns the PixelMap object representing the icon of the specified ability. */ function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityIcon(bundleName: string, abilityName: string): Promise; - /** - * Get whether to enable a specified ability + /** + * Checks whether a specified ability is enabled. * * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @param info Indicates information about the ability to set. - * @returns Returns whether to enable a specified ability + * @param info Indicates information about the ability to check. + * @returns Returns true if the ability is enabled; returns false otherwise. */ function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; function isAbilityEnabled(info: AbilityInfo): Promise; - /** - * Get whether to enable a specified application + /** + * Checks whether a specified application is enabled. * * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the bundle name of the application. - * @returns Returns whether to enable a specified application + * @returns Returns true if the application is enabled; returns false otherwise. */ function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; function isApplicationEnabled(bundleName: string): Promise; diff --git a/api/ability/abilityAgent.d.ts b/api/ability/abilityAgent.d.ts index c6d61f438e..a9374fedc1 100644 --- a/api/ability/abilityAgent.d.ts +++ b/api/ability/abilityAgent.d.ts @@ -13,8 +13,9 @@ * limitations under the License. */ import { AsyncCallback } from '../basic'; + /** - * AbilityAgent,oncallback object. + * AbilityAgent, onCallback object. * @name AbilityAgent * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel @@ -22,54 +23,78 @@ import { AsyncCallback } from '../basic'; */ export interface AbilityAgent { /** - * register message,get AsyncCallback info. + * Listens for the event of sending messages to the peer device. This method uses a callback to return the result. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type message - * @return Returns the register results. + * @param type Event type. The value is fixed at message. + * @param callback Callback used to return the result. */ on(type: 'message', callback: AsyncCallback): void; /** - * register stateChange,get AsyncCallback info. + * Listens for collaboration lifecycle change events. This method uses a callback to return the result. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type stateChange. - * @return Returns the register results. + * @param type Event type. The value is fixed at stateChange. + * @param callback Callback used to return the state value. For details about the state values, see LifecycleEvent. */ on(type: 'stateChange', callback: AsyncCallback): void; /** - * unRegister message,get AsyncCallback info. + * Cancels listening for the event of sending messages to the peer device. + * This method uses a callback to return the result. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type message - * @return Returns the unRegister results. + * @param type Event type. The value is fixed at message. + * @param callback Callback specified in abilityAgent.on(type: "message"). + * If no callback is specified, listening will be canceled for all callbacks. */ off(type: 'message', callback?: AsyncCallback): void; /** - * unRegister stateChange,get AsyncCallback info. + * Cancels listening for the collaboration lifecycle changes. + * This method uses a callback to return the result. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type stateChange. - * @return Returns the unRegister results. + * @param type Event type. The value is fixed at stateChange. + * @param callback Callback specified in abilityAgent.on(type: "stateChange"). + * If no callback is specified, listening will be canceled for all callbacks. */ off(type: 'stateChange', callback?: AsyncCallback): void; /** - * postMessage,get AsyncCallback info. + * Sends a message to the peer device. This method uses an asynchronous callback to return the result. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param data Message. - * @return - + * @param data Message to send. + * @param callback Callback used to return the result. */ postMessage(data: Message, callback:AsyncCallback): void; postMessage(data: Message): Promise; } +/** + * Defines a Message instance. + * @name AbilityAgent + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @permission N/A + */ export interface Message { + /** + * Message type. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + */ type: string; + + /** + * Message content. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + */ data: {[key: string]: Object}; } diff --git a/api/ability/assistantCode.d.ts b/api/ability/assistantCode.d.ts index 2807367578..2c68c3bfad 100644 --- a/api/ability/assistantCode.d.ts +++ b/api/ability/assistantCode.d.ts @@ -14,26 +14,145 @@ */ /** - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @permission N/A - */ + * Enumerates the collaboration states. + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + * @permission N/A + */ export enum AssistantCode { - OK = 0, - ERR_UNCONNECTED = 1, - ERR_INVALID_PARAMETER = 2, - ERR_SYSTEM_ERROR = 3, - ERR_EVENT_HANDLER_IS_NOT_SET_UP = 4, - ERR_ABILITY_TYPE_NOT_SUPPORTED = 5, - ERR_SIGNATURE_IS_NOT_CONSISTENT = 6, - ERR_ABILITY_NOT_MATCHED = 7, - ERR_ABILITY_TERMINATED = 8, - ERR_DEVICE_OFFLINE = 9, - ERR_PROCESS_DIED = 10, - ERR_ABILITY_START_FAILED = 11, - ERR_VERSION_INCOMPATIBLE = 12, - ERR_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 13, - ERR_TIMEOUT = 14, - ERR_IN_ASSISTING_MODE = 15, - ERR_NETWORK_TYPE_NOT_SUPPORTED = 16 + /** + * Operation succeeded. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + OK = 0, + + /** + * Failed to establish the collaboration session. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_UNCONNECTED = 1, + + /** + * Invalid parameters. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_INVALID_PARAMETER = 2, + + /** + * System error. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_SYSTEM_ERROR = 3, + + /** + * EventHandler is not set. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_EVENT_HANDLER_IS_NOT_SET_UP = 4, + + /** + * Invalid ability type. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_ABILITY_TYPE_NOT_SUPPORTED = 5, + + /** + * Signatures don't match. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_SIGNATURE_IS_NOT_CONSISTENT = 6, + + /** + * No matching ability. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_ABILITY_NOT_MATCHED = 7, + + /** + * Ability exited. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_ABILITY_TERMINATED = 8, + + /** + * The device is offline. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_DEVICE_OFFLINE = 9, + + /** + * The process has been killed. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_PROCESS_DIED = 10, + + /** + * Failed to start the ability. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_ABILITY_START_FAILED = 11, + + /** + * Incompatible versions. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_VERSION_INCOMPATIBLE = 12, + + /** + * The permission request for distributed communication was rejected. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 13, + + /** + * Operation timed out. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_TIMEOUT = 14, + + /** + * The ability is already in a collaboration session. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_IN_ASSISTING_MODE = 15, + + /** + * The networking mode is not supported. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ERR_NETWORK_TYPE_NOT_SUPPORTED = 16 } \ No newline at end of file diff --git a/api/ability/dataAbilityHelper.d.ts b/api/ability/dataAbilityHelper.d.ts index 52e547b75f..6af3586694 100644 --- a/api/ability/dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityHelper.d.ts @@ -200,11 +200,11 @@ export interface DataAbilityHelper { query(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): Promise; /** - * Calls the method of the Data ability. + * 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 Indicates the Data ability of the method to call. + * @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. @@ -220,6 +220,7 @@ export interface DataAbilityHelper { } /** + * Defines a PacMap object for storing a series of values. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel * @permission N/A diff --git a/api/app/appVersionInfo.d.ts b/api/app/appVersionInfo.d.ts index 58879170fe..c99b6b558f 100644 --- a/api/app/appVersionInfo.d.ts +++ b/api/app/appVersionInfo.d.ts @@ -14,7 +14,7 @@ */ /** - * @name Obtains configuration information about an ability + * Defines an AppVersionInfo object. * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.Core * @permission NA @@ -23,6 +23,7 @@ export interface AppVersionInfo { /** + * Application name. * @default appName * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.Core @@ -30,6 +31,7 @@ export interface AppVersionInfo { readonly appName: string; /** + * Application version number. * @default versionCode * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.Core @@ -37,6 +39,7 @@ export interface AppVersionInfo { readonly versionCode: number; /** + * Application version name. * @default versionName * @since 7 * @SysCap SystemCapability.Ability.AbilityRuntime.Core diff --git a/api/app/context.d.ts b/api/app/context.d.ts index 857c1fcb6a..aee3faf741 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -132,7 +132,7 @@ export interface Context extends BaseContext { getCallingBundle(): Promise; /** - * Obtains the files dir. + * Obtains the file directory of this application on the internal storage. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -141,7 +141,7 @@ export interface Context extends BaseContext { getFilesDir(): Promise; /** - * Obtains the cache Dir. + * Obtains the cache directory of this application on the internal storage. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -150,7 +150,8 @@ export interface Context extends BaseContext { getCacheDir(): Promise; /** - * Obtains the external cache dir. + * Obtains the absolute path to the application-specific cache directory on the primary + * external or shared storage device. The application can place its cache files in this directory. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -159,7 +160,8 @@ export interface Context extends BaseContext { getExternalCacheDir(): Promise; /** - * Obtains or create the distributed dir. + * 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 @@ -168,7 +170,7 @@ export interface Context extends BaseContext { getOrCreateDistributedDir(callback: AsyncCallback): void; /** - * Obtains the app type. + * Obtains the application type. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -177,7 +179,7 @@ export interface Context extends BaseContext { getAppType(): Promise; /** - * Obtains the hap module Info. + * Obtains the ModuleInfo object for this application. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -186,7 +188,7 @@ export interface Context extends BaseContext { getHapModuleInfo(): Promise; /** - * Obtains the app version info. + * Obtains the application version information. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -195,7 +197,7 @@ export interface Context extends BaseContext { getAppVersionInfo(): Promise; /** - * Obtains the application context. + * Obtains the context of this application. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly @@ -203,7 +205,7 @@ export interface Context extends BaseContext { getApplicationContext(): Context; /** - * Obtains the ability info. + * hecks the detailed information of this ability. * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly diff --git a/api/app/processInfo.d.ts b/api/app/processInfo.d.ts index 1f7e49dfc7..506b3cbe48 100644 --- a/api/app/processInfo.d.ts +++ b/api/app/processInfo.d.ts @@ -22,7 +22,7 @@ */ export interface ProcessInfo { /** - * The id of the current process + * ID of the current process. * * @default - * @since 7 @@ -31,7 +31,7 @@ export interface ProcessInfo { pid: number; /** - * The name of the current process + * Name of the current process. * * @default - * @since 7 -- Gitee From f2ebacfee980a0dabd9db0f7bf71f74f185c5b19 Mon Sep 17 00:00:00 2001 From: dy Date: Sun, 27 Feb 2022 17:10:17 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=96=B0=E5=A2=9Eapi7=E8=A1=A5=E9=BD=90?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- api/@ohos.app.abilityManager.d.ts | 20 ++++++++++++ api/ability/errorCode.d.ts | 53 +++++++++++++++++++++++++++++++ api/app/context.d.ts | 21 +++++++++++- 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 api/ability/errorCode.d.ts diff --git a/api/@ohos.app.abilityManager.d.ts b/api/@ohos.app.abilityManager.d.ts index 9b430de3ca..0dcfe8b5b3 100644 --- a/api/@ohos.app.abilityManager.d.ts +++ b/api/@ohos.app.abilityManager.d.ts @@ -80,6 +80,26 @@ declare namespace abilityManager { */ function deleteMissions(missionIds: Array): Promise; function deleteMissions(missionIds: Array, callback: AsyncCallback): void; + + /** + * Obtains the memory size of this application. + * @since 7 + * @SysCap N/A + * @return Returns memory size of this application. + */ + function getAppMemorySize(): Promise; + function getAppMemorySize(callback: AsyncCallback): void; + + /** + * Checks whether the current device is a low RAM (memory-limited) device. + * This method helps you determine whether any optimization is needed to enable your application + * to run on the target device. For example, you may need to disable some RAM-hogging features for a low RAM device. + * @since 7 + * @SysCap N/A + * @return Returns true if the current device is a low RAM device and false otherwise. + */ + function isRamConstrainedDevice(): Promise; + function isRamConstrainedDevice(callback: AsyncCallback): void; } export default abilityManager; diff --git a/api/ability/errorCode.d.ts b/api/ability/errorCode.d.ts new file mode 100644 index 0000000000..2ec71e47b2 --- /dev/null +++ b/api/ability/errorCode.d.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** + * Defines error codes used when starting an ability, for example, featureAbility.ErrorCode.NO_ERROR. + * @since 7 + * @sysCap N/A + */ +export enum ErrorCode { + /** + * Permission denied. + * @default - + * @since 7 + * @sysCap N/A + */ + PERMISSION_DENY = -3, + + /** + * Ability not found. + * @default - + * @since 7 + * @sysCap SystemCapability.Ability.AbilityBase + */ + ABILITY_NOT_FOUND = -2, + + /** + * Invalid parameter. + * @default - + * @since 7 + * @sysCap N/A + */ + INVALID_PARAMETER = -1, + + /** + * No error. + * @default - + * @since 7 + * @sysCap N/A + */ + NO_ERROR = 0 +} diff --git a/api/app/context.d.ts b/api/app/context.d.ts index aee3faf741..65ca11ab6e 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -205,13 +205,32 @@ export interface Context extends BaseContext { getApplicationContext(): Context; /** - * hecks the detailed information of this ability. + * 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.Appexecfwk + * @return true if the configuration of this ability is changing and false otherwise. + * @FAModelOnly + */ + isUpdatingConfigurations(): Promise; + isUpdatingConfigurations(callback: AsyncCallback): void; + + /** + * Informs the system of the time required for drawing this Page ability. + * @since 7 + * @sysCap SystemCapability.Appexecfwk + * @FAModelOnly + */ + printDrawnCompleted(): Promise; + printDrawnCompleted(callback: AsyncCallback): void; } /** -- Gitee From 5bcee2a731fe3943763ffe811c5cc21fa3c32045 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 1 Mar 2022 15:29:17 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- api/@ohos.ability.featureAbility.d.ts | 86 -------------- api/@ohos.bundle.d.ts | 1 + api/ability/abilityAgent.d.ts | 101 ---------------- api/ability/assistantCode.d.ts | 158 -------------------------- 4 files changed, 1 insertion(+), 345 deletions(-) delete mode 100644 api/ability/abilityAgent.d.ts delete mode 100644 api/ability/assistantCode.d.ts diff --git a/api/@ohos.ability.featureAbility.d.ts b/api/@ohos.ability.featureAbility.d.ts index 04121b147c..1d884835fd 100644 --- a/api/@ohos.ability.featureAbility.d.ts +++ b/api/@ohos.ability.featureAbility.d.ts @@ -21,7 +21,6 @@ import { Context } from './app/context'; import { DataAbilityHelper } from './ability/dataAbilityHelper'; import { ConnectOptions } from './ability/connectOptions'; import { ContinueAbilityOptions } from './ability/continueAbilityOptions'; -import { AbilityAgent } from './ability/abilityAgent'; /** * A Feature Ability represents an ability with a UI and is designed to interact with users. @@ -158,91 +157,6 @@ declare namespace featureAbility { function continueAbility(options: ContinueAbilityOptions, callback: AsyncCallback): void; function continueAbility(options: ContinueAbilityOptions): Promise; - /** - * Starts the specified ability on the device to establish a collaboration session. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param want Want about the ability to start. - */ - function startAssistAbility(want: Want): void; - - /** - * Disconnects this collaboration session. This method uses an asynchronous callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param AsyncCallback Callback used to return the result. - */ - function stopAssistAbility(callback: AsyncCallback): void; - function stopAssistAbility(): Promise; - - /** - * Listens for the even of successfully starting the specified ability for establishing a collaboration session. - * This method uses a callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at assistConnect. - * @param callback Callback used to return the result. - */ - function on(type: 'assistConnect', callback: Callback): void; - - /** - * Listens for the event of collaboration session failure. This method uses a callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at assistConnectFailed. - * @param callback Callback used to return the status code. For details, see AssistantCode. - */ - function on(type: 'assistConnectFailed', callback: Callback): void; - - /** - * Listens for the event of collaboration session disconnection. This method uses a callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at assistDisconnect. - * @param callback Callback used to return the status code. For details, see AssistantCode. - */ - function on(type: 'assistDisconnect', callback: Callback): void; - - /** - * Cancels listening for the even of successfully starting the specified ability - * for establishing a collaboration session. This method uses a callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at assistConnect. - * @param callback Callback specified in featureAbility.on(type:'assistConnect'). - * If no callback is specified, listening will be canceled for all callbacks. - */ - function off(type: 'assistConnect', callback?: Callback): void; - - /** - * Cancels listening for the event of collaboration session failure. This method uses a callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at assistConnectFailed. - * @param callback Callback specified in featureAbility.on(type:'assistConnectFailed'). - * If no callback is specified, listening will be canceled for all callbacks. - */ - function off(type: 'assistConnectFailed', callback?: Callback): void; - - /** - * Cancels listening for the event of collaboration session disconnection. - * This method uses a callback to return the result. - * @default - - * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at assistDisconnect. - * @param callback Callback specified in featureAbility.on(type:'assistDisconnect'). - * If no callback is specified, listening will be canceled for all callbacks. - */ - function off(type: 'assistDisconnect', callback?: Callback): void; - export enum AbilityWindowConfiguration { WINDOW_MODE_UNDEFINED = 0, WINDOW_MODE_FULLSCREEN = 1, diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 76b1b8592c..911196168b 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -603,6 +603,7 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the bundle name of the application to which the ability belongs. * @param abilityName Indicates the ability name. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @return Returns the label representing the label of the specified ability. */ function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; diff --git a/api/ability/abilityAgent.d.ts b/api/ability/abilityAgent.d.ts deleted file mode 100644 index a9374fedc1..0000000000 --- a/api/ability/abilityAgent.d.ts +++ /dev/null @@ -1,101 +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'; - -/** - * AbilityAgent, onCallback object. - * @name AbilityAgent - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @permission N/A - */ - export interface AbilityAgent { - /** - * Listens for the event of sending messages to the peer device. This method uses a callback to return the result. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at message. - * @param callback Callback used to return the result. - */ - on(type: 'message', callback: AsyncCallback): void; - - /** - * Listens for collaboration lifecycle change events. This method uses a callback to return the result. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at stateChange. - * @param callback Callback used to return the state value. For details about the state values, see LifecycleEvent. - */ - on(type: 'stateChange', callback: AsyncCallback): void; - - /** - * Cancels listening for the event of sending messages to the peer device. - * This method uses a callback to return the result. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at message. - * @param callback Callback specified in abilityAgent.on(type: "message"). - * If no callback is specified, listening will be canceled for all callbacks. - */ - off(type: 'message', callback?: AsyncCallback): void; - - /** - * Cancels listening for the collaboration lifecycle changes. - * This method uses a callback to return the result. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param type Event type. The value is fixed at stateChange. - * @param callback Callback specified in abilityAgent.on(type: "stateChange"). - * If no callback is specified, listening will be canceled for all callbacks. - */ - off(type: 'stateChange', callback?: AsyncCallback): void; - - /** - * Sends a message to the peer device. This method uses an asynchronous callback to return the result. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param data Message to send. - * @param callback Callback used to return the result. - */ - postMessage(data: Message, callback:AsyncCallback): void; - postMessage(data: Message): Promise; -} - -/** - * Defines a Message instance. - * @name AbilityAgent - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @permission N/A - */ -export interface Message { - /** - * Message type. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - */ - type: string; - - /** - * Message content. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - */ - data: {[key: string]: Object}; -} - -export default AbilityAgent; diff --git a/api/ability/assistantCode.d.ts b/api/ability/assistantCode.d.ts deleted file mode 100644 index 2c68c3bfad..0000000000 --- a/api/ability/assistantCode.d.ts +++ /dev/null @@ -1,158 +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. - */ - - /** - * Enumerates the collaboration states. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - * @permission N/A - */ -export enum AssistantCode { - /** - * Operation succeeded. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - OK = 0, - - /** - * Failed to establish the collaboration session. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_UNCONNECTED = 1, - - /** - * Invalid parameters. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_INVALID_PARAMETER = 2, - - /** - * System error. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_SYSTEM_ERROR = 3, - - /** - * EventHandler is not set. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_EVENT_HANDLER_IS_NOT_SET_UP = 4, - - /** - * Invalid ability type. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_ABILITY_TYPE_NOT_SUPPORTED = 5, - - /** - * Signatures don't match. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_SIGNATURE_IS_NOT_CONSISTENT = 6, - - /** - * No matching ability. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_ABILITY_NOT_MATCHED = 7, - - /** - * Ability exited. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_ABILITY_TERMINATED = 8, - - /** - * The device is offline. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_DEVICE_OFFLINE = 9, - - /** - * The process has been killed. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_PROCESS_DIED = 10, - - /** - * Failed to start the ability. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_ABILITY_START_FAILED = 11, - - /** - * Incompatible versions. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_VERSION_INCOMPATIBLE = 12, - - /** - * The permission request for distributed communication was rejected. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 13, - - /** - * Operation timed out. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_TIMEOUT = 14, - - /** - * The ability is already in a collaboration session. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_IN_ASSISTING_MODE = 15, - - /** - * The networking mode is not supported. - * @default - - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase - */ - ERR_NETWORK_TYPE_NOT_SUPPORTED = 16 -} \ No newline at end of file -- Gitee From c137453964b12645f6865759c3243d8b8f1c1342 Mon Sep 17 00:00:00 2001 From: dy Date: Wed, 2 Mar 2022 00:21:18 +0800 Subject: [PATCH 8/8] =?UTF-8?q?dts=E6=96=87=E4=BB=B6=E4=BF=AE=E6=94=B9sysc?= =?UTF-8?q?ap=20=20=E6=9B=B4=E6=94=B9errorcode=E7=9B=AE=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9errorcode=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- ...Code.d.ts => @ohos.ability.errorCode.d.ts} | 12 ++++---- api/@ohos.bundle.d.ts | 3 ++ api/ability/dataAbilityHelper.d.ts | 8 +++-- api/app/appVersionInfo.d.ts | 8 ++--- api/app/context.d.ts | 30 +++++++------------ api/app/processInfo.d.ts | 4 +-- 6 files changed, 30 insertions(+), 35 deletions(-) rename api/{ability/errorCode.d.ts => @ohos.ability.errorCode.d.ts} (86%) diff --git a/api/ability/errorCode.d.ts b/api/@ohos.ability.errorCode.d.ts similarity index 86% rename from api/ability/errorCode.d.ts rename to api/@ohos.ability.errorCode.d.ts index 2ec71e47b2..21640c16a0 100644 --- a/api/ability/errorCode.d.ts +++ b/api/@ohos.ability.errorCode.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * 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 @@ -16,14 +16,14 @@ /** * Defines error codes used when starting an ability, for example, featureAbility.ErrorCode.NO_ERROR. * @since 7 - * @sysCap N/A + * @syscap N/A */ export enum ErrorCode { /** * Permission denied. * @default - * @since 7 - * @sysCap N/A + * @syscap N/A */ PERMISSION_DENY = -3, @@ -31,7 +31,7 @@ export enum ErrorCode { * Ability not found. * @default - * @since 7 - * @sysCap SystemCapability.Ability.AbilityBase + * @syscap SystemCapability.Ability.AbilityBase */ ABILITY_NOT_FOUND = -2, @@ -39,7 +39,7 @@ export enum ErrorCode { * Invalid parameter. * @default - * @since 7 - * @sysCap N/A + * @syscap N/A */ INVALID_PARAMETER = -1, @@ -47,7 +47,7 @@ export enum ErrorCode { * No error. * @default - * @since 7 - * @sysCap N/A + * @syscap N/A */ NO_ERROR = 0 } diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 15e6ef539d..a01ebbcedb 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -393,6 +393,7 @@ declare namespace bundle { * @param bundleName Indicates the application bundle name to be queried. * @param abilityName Indicates the ability name. * @return Returns the AbilityInfo object for the current ability. + * @FAModelOnly */ function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityInfo(bundleName: string, abilityName: string): Promise; @@ -408,6 +409,7 @@ declare namespace bundle { * @param userId Indicates the user ID or do not pass user ID. * @return Returns the ApplicationInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO + * @FAModelOnly */ function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback) : void; @@ -455,6 +457,7 @@ declare namespace bundle { * @param userId Indicates the user ID or do not pass user ID. * @return Returns a list of ApplicationInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @FAModelOnly */ function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; diff --git a/api/ability/dataAbilityHelper.d.ts b/api/ability/dataAbilityHelper.d.ts index 996d05f1f7..2bf8f87962 100644 --- a/api/ability/dataAbilityHelper.d.ts +++ b/api/ability/dataAbilityHelper.d.ts @@ -203,7 +203,7 @@ export interface DataAbilityHelper { * Calls the extended API of the DataAbility. This method uses a promise to return the result. * * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @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. @@ -222,8 +222,9 @@ export interface DataAbilityHelper { /** * Defines a PacMap object for storing a series of values. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @permission N/A + * @FAModelOnly */ export interface PacMap { @@ -235,7 +236,8 @@ export interface DataAbilityHelper { * values of primitive types are supported, but not custom Sequenceable objects. * @default - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ [key: string]: number | string | boolean | Array | null; } diff --git a/api/app/appVersionInfo.d.ts b/api/app/appVersionInfo.d.ts index c99b6b558f..5ce579d730 100644 --- a/api/app/appVersionInfo.d.ts +++ b/api/app/appVersionInfo.d.ts @@ -16,7 +16,7 @@ /** * Defines an AppVersionInfo object. * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission NA * @devices phone, tablet, tv, wearable, car */ @@ -26,7 +26,7 @@ export interface AppVersionInfo { * Application name. * @default appName * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core */ readonly appName: string; @@ -34,7 +34,7 @@ export interface AppVersionInfo { * Application version number. * @default versionCode * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core */ readonly versionCode: number; @@ -42,7 +42,7 @@ export interface AppVersionInfo { * Application version name. * @default versionName * @since 7 - * @SysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core */ readonly versionName: string; } diff --git a/api/app/context.d.ts b/api/app/context.d.ts index bb7d5c7768..9b4e70f4ee 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -134,7 +134,7 @@ export interface Context extends BaseContext { /** * Obtains the file directory of this application on the internal storage. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getFilesDir(callback: AsyncCallback): void; @@ -143,27 +143,17 @@ export interface Context extends BaseContext { /** * Obtains the cache directory of this application on the internal storage. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getCacheDir(callback: AsyncCallback): void; getCacheDir(): Promise; - - /** - * Obtains the absolute path to the application-specific cache directory on the primary - * external or shared storage device. The application can place its cache files in this directory. - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core - * @FAModelOnly - */ - getExternalCacheDir(callback: AsyncCallback): void; - getExternalCacheDir(): 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 + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getOrCreateDistributedDir(): Promise; @@ -172,7 +162,7 @@ export interface Context extends BaseContext { /** * Obtains the application type. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getAppType(callback: AsyncCallback): void @@ -181,7 +171,7 @@ export interface Context extends BaseContext { /** * Obtains the ModuleInfo object for this application. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getHapModuleInfo(callback: AsyncCallback): void @@ -190,7 +180,7 @@ export interface Context extends BaseContext { /** * Obtains the application version information. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getAppVersionInfo(callback: AsyncCallback): void @@ -199,7 +189,7 @@ export interface Context extends BaseContext { /** * Obtains the context of this application. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getApplicationContext(): Context; @@ -207,7 +197,7 @@ export interface Context extends BaseContext { /** * Checks the detailed information of this ability. * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.Core + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly */ getAbilityInfo(callback: AsyncCallback): void @@ -216,7 +206,7 @@ export interface Context extends BaseContext { /** * Checks whether the configuration of this ability is changing. * @since 7 - * @sysCap SystemCapability.Appexecfwk + * @syscap SystemCapability.Appexecfwk * @return true if the configuration of this ability is changing and false otherwise. * @FAModelOnly */ @@ -226,7 +216,7 @@ export interface Context extends BaseContext { /** * Informs the system of the time required for drawing this Page ability. * @since 7 - * @sysCap SystemCapability.Appexecfwk + * @syscap SystemCapability.Appexecfwk * @FAModelOnly */ printDrawnCompleted(): Promise; diff --git a/api/app/processInfo.d.ts b/api/app/processInfo.d.ts index 91cf075e47..5f3c2a825d 100644 --- a/api/app/processInfo.d.ts +++ b/api/app/processInfo.d.ts @@ -22,7 +22,7 @@ */ export interface ProcessInfo { /** - * ID of the current process. + * The id of the current process * * @default - * @since 7 @@ -31,7 +31,7 @@ export interface ProcessInfo { pid: number; /** - * Name of the current process. + * The name of the current process * * @default - * @since 7 -- Gitee